diff --git a/src/api/sampleTracking/sampleTracking.js b/src/api/sampleTracking/sampleTracking.js index c7a0918..1a66b7a 100644 --- a/src/api/sampleTracking/sampleTracking.js +++ b/src/api/sampleTracking/sampleTracking.js @@ -11,6 +11,7 @@ export const saveProjectPartTracking = data => createAPI('/sampleTracking/projec export const updateProjectPartTracking = data => createAPI('/sampleTracking/projectPart/update', 'POST', data) export const deleteProjectPartTracking = data => createAPI('/sampleTracking/projectPart/delete', 'POST', data) export const syncProjectPartTracking = data => createAPI('/sampleTracking/projectPart/sync', 'POST', data) +export const syncProofTracking = data => createAPI('/sampleTracking/proofTracking/sync', 'POST', data) export const searchProofTracking = data => createAPI('/sampleTracking/proofTracking/search', 'POST', data) export const oneKeyCreateProofTracking = data => createAPI('/sampleTracking/proofTracking/oneKeyCreate', 'POST', data) @@ -19,4 +20,5 @@ export const batchUpdateProofTrackingPlan = data => createAPI('/sampleTracking/p export const updateProofTrackingProcess = data => createAPI('/sampleTracking/proofTracking/updateProcess', 'POST', data) export const updateProofTrackingComments = data => createAPI('/sampleTracking/proofTracking/updateComments', 'POST', data) export const finishProofTracking = data => createAPI('/sampleTracking/proofTracking/finishProofing', 'POST', data) +export const deleteProofTracking = data => createAPI('/sampleTracking/proofTracking/delete', 'POST', data) export const queryProofTrackingProcessHistory = data => createAPI('/sampleTracking/proofTracking/processHistory', 'POST', data) diff --git a/src/views/modules/sampleTracking/projectProofTracking.vue b/src/views/modules/sampleTracking/projectProofTracking.vue index 0322c8a..4a1675f 100644 --- a/src/views/modules/sampleTracking/projectProofTracking.vue +++ b/src/views/modules/sampleTracking/projectProofTracking.vue @@ -30,12 +30,13 @@ - 一键创建项目/物料 - 修改项目/物料 + 一键创建项目&物料 + 修改项目&物料 {{ batchEditMode ? '取消修改' : '批量修改' }} 保存修改 新增打样 同步到NPI + 同步打样到NPI @@ -154,10 +155,11 @@ - + @@ -725,12 +727,14 @@ import { batchUpdateProofTrackingPlan, createProofTrackingRecord, + deleteProofTracking, finishProofTracking, oneKeyCreateProofTracking, queryProofTrackingProcessHistory, searchProjectInfoTracking, searchProjectPartTracking, searchProofTracking, + syncProofTracking, syncProjectPartTracking, updateProjectInfoTracking, updateProjectPartTracking, @@ -888,6 +892,7 @@ export default { dataList: [], dataListLoading: false, syncNpiLoading: false, + syncProofLoading: false, pageIndex: 1, pageSize: 20, totalPage: 0, @@ -1252,10 +1257,23 @@ export default { } if (this.dataList.length > 0) { this.currentRow = this.dataList[0] + } else { + this.currentRow = null } + this.$nextTick(() => { + if (this.$refs.trackingTable && typeof this.$refs.trackingTable.setCurrentRow === 'function') { + this.$refs.trackingTable.setCurrentRow(this.currentRow || null) + } + }) } else { this.dataList = [] this.totalPage = 0 + this.currentRow = null + this.$nextTick(() => { + if (this.$refs.trackingTable && typeof this.$refs.trackingTable.setCurrentRow === 'function') { + this.$refs.trackingTable.setCurrentRow(null) + } + }) this.$message.error(data.msg || '查询失败') } }).catch(() => { @@ -1806,32 +1824,88 @@ export default { } const projectPartId = syncCheck.projectPartId this.currentRow = current - const operator = this.$store.state.user.name - this.syncNpiLoading = true - syncProjectPartTracking({ - projectPartId: projectPartId, - updateBy: operator, - createBy: operator, - userName: operator - }).then(({ data }) => { - if (data && data.code === 0) { - this.$message.success(`同步成功`) - this.getDataList() - } else { - const failMsg = (data && data.msg) || '同步到NPI失败' - if (failMsg.indexOf('缺少以下必填项') > -1) { - this.$alert(failMsg, '同步校验未通过', { - confirmButtonText: '确定' - }) + const projectNo = current.projectNo || '-' + const testPartNo = current.testPartNo || '-' + const confirmMsg = `确认将项目编码[${projectNo}]物料编码[${testPartNo}]同步到NPI吗?` + this.$confirm(confirmMsg, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + dangerouslyUseHTMLString: true + }).then(() => { + const operator = this.$store.state.user.name + this.syncNpiLoading = true + syncProjectPartTracking({ + projectPartId: projectPartId, + updateBy: operator, + createBy: operator, + userName: operator + }).then(({ data }) => { + if (data && data.code === 0) { + this.$message.success(`同步成功`) + this.getDataList() } else { - this.$message.error(failMsg) + const failMsg = (data && data.msg) || '同步到NPI失败' + if (failMsg.indexOf('缺少以下必填项') > -1) { + this.$alert(failMsg, '同步校验未通过', { + confirmButtonText: '确定' + }) + } else { + this.$message.error(failMsg) + } } - } - }).catch(() => { - this.$message.error('同步到NPI异常') - }).finally(() => { - this.syncNpiLoading = false + }).catch(() => { + this.$message.error('同步到NPI异常') + }).finally(() => { + this.syncNpiLoading = false + }) }) + .catch(() => {}) + }, + syncProofToNpi (row) { + const current = this.getActionRow(row) + if (!current || !current.trackingId) { + this.$message.warning('请先选择一条打样记录') + return + } + this.currentRow = current + const projectNo = current.projectNo || '-' + const testPartNo = current.testPartNo || '-' + const proofingNo = current.proofingNo || '-' + const confirmMsg = `确认将当前打样记录同步到NPI吗?
项目编码:${projectNo}
物料编码:${testPartNo}
打样单号:${proofingNo}` + this.$confirm(confirmMsg, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + dangerouslyUseHTMLString: true + }).then(() => { + const operator = this.$store.state.user.name + this.syncProofLoading = true + syncProofTracking({ + trackingId: current.trackingId, + updateBy: operator, + createBy: operator, + userName: operator + }).then(({ data }) => { + if (data && data.code === 0) { + this.$message.success('打样同步成功') + this.getDataList() + } else { + const failMsg = (data && data.msg) || '同步打样到NPI失败' + if (failMsg.indexOf('缺少以下必填项') > -1 || failMsg.indexOf('请先同步项目') > -1 || failMsg.indexOf('请先同步项目物料') > -1) { + this.$alert(failMsg, '同步校验未通过', { + confirmButtonText: '确定' + }) + } else { + this.$message.error(failMsg) + } + } + }).catch(() => { + this.$message.error('同步打样到NPI异常') + }).finally(() => { + this.syncProofLoading = false + }) + }).catch(() => {}) }, validateProofDialogData () { if (!this.proofDialogData.projectId || !this.proofDialogData.projectPartId) { @@ -2118,6 +2192,34 @@ export default { } this.finishDialogVisible = true }, + deleteProof (row) { + const current = row || this.currentRow + if (!current || !current.trackingId) { + this.$message.warning('请先选择记录') + return + } + this.$confirm('确定删除该打样记录吗?该操作仅删除打样记录,不会删除项目和项目物料。', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + deleteProofTracking({ + trackingId: current.trackingId, + updateBy: this.$store.state.user.name + }).then(({ data }) => { + if (data && data.code === 0) { + this.$message.success('打样记录删除成功') + this.processHistoryMap = {} + this.resetProcessTooltip() + this.getDataList() + } else { + this.$message.error((data && data.msg) || '删除打样记录失败') + } + }).catch(() => { + this.$message.error('删除打样记录异常') + }) + }).catch(() => {}) + }, submitFinishProof () { if (!this.finishForm.trackingId) { this.$message.warning('跟踪记录ID不能为空') @@ -2515,12 +2617,16 @@ export default { .action-link { color: #0c4dbb; - margin: 0 6px; + margin: 0 4px; cursor: pointer; } +.delete-link { + color: #f56c6c; +} + .end-link { - color: #d9001b; + color: #a303ff; }