|
|
@@ -97,13 +97,13 @@
|
|
|
<el-table-column fixed="right" prop="cntAll" header-align="center" align="center" min-width="80"
|
|
|
:show-tooltip-when-overflow="true" label="计划数量">
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" prop="isTechnology" header-align="center" align="center" min-width="140"
|
|
|
+ <el-table-column fixed="right" prop="isTechnology" header-align="center" align="center" min-width="110"
|
|
|
:show-tooltip-when-overflow="true" label="是否编制工艺">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.isTechnology == 2 ? '否' : '是' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" prop="techId" header-align="center" align="center" min-width="140"
|
|
|
+ <el-table-column fixed="right" prop="techId" header-align="center" align="center" min-width="100"
|
|
|
:show-tooltip-when-overflow="true" label="是否有工艺">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.techId == null || scope.row.techId == 0 ? '否' : '是' }}
|
|
|
@@ -112,12 +112,15 @@
|
|
|
<el-table-column prop="notes" header-align="center" align="center" min-width="140"
|
|
|
:show-tooltip-when-overflow="true" label="备注">
|
|
|
</el-table-column>
|
|
|
- <el-table-column v-if="!disabled" fixed="right" prop="disposal" header-align="center" align="center" width="120"
|
|
|
+ <el-table-column v-if="!disabled" fixed="right" prop="disposal" header-align="center" align="center" width="150"
|
|
|
:show-tooltip-when-overflow="true" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="text" v-if="scope.row.techId == null || scope.row.techId == 0"
|
|
|
@click="handleCrafts(0, scope.row.productId)">新建工艺</el-button>
|
|
|
- <el-button type="text" v-else @click="handleCrafts(scope.row.techId, scope.row.productId)">修改工艺</el-button>
|
|
|
+ <template v-else>
|
|
|
+ <el-button type="text" @click="handleCrafts(scope.row.techId, scope.row.productId)">修改工艺</el-button>
|
|
|
+ <el-button type="text" @click="exportCraft(scope.row)">导出</el-button>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -259,6 +262,41 @@ export default {
|
|
|
console.log('productId:' + productId)
|
|
|
this.$emit('showCraftsAddOrDetail', techId, this.orderId, productId)
|
|
|
}
|
|
|
+ ,
|
|
|
+ // 导出某一行的工艺为 Excel
|
|
|
+ exportCraft(row) {
|
|
|
+ // 按需求构造传入的部分数据
|
|
|
+ const payload = {
|
|
|
+ batchNumber: row.batchNumber || '',
|
|
|
+ cntAll: row.cntAll || 0,
|
|
|
+ orderCode: this.dataForm.orderCode || '',
|
|
|
+ productName: row.productName || '',
|
|
|
+ // 后端字段要求的是 techI(按用户说明),这里传入当前行的 techId
|
|
|
+ techI: row.techId || 0
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/biz-service/projTechnology/exportExcel'),
|
|
|
+ method: 'post',
|
|
|
+ data: this.$http.adornData(payload),
|
|
|
+ responseType: 'blob'
|
|
|
+ }).then(response => {
|
|
|
+ const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' })
|
|
|
+ const url = window.URL.createObjectURL(blob)
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.href = url
|
|
|
+ // 使用产品名作为文件名的一部分,回退到通用名
|
|
|
+ const name = (row.productName ? row.productName + '-' : '') + '工艺导出.xlsx'
|
|
|
+ link.setAttribute('download', name)
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link)
|
|
|
+ window.URL.revokeObjectURL(url)
|
|
|
+ }).catch(err => {
|
|
|
+ console.error('导出失败', err)
|
|
|
+ this.$message.error('导出失败')
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|