diff --git a/src/api/rohs/rohs.js b/src/api/rohs/rohs.js index d1f47ed..01882f5 100644 --- a/src/api/rohs/rohs.js +++ b/src/api/rohs/rohs.js @@ -15,6 +15,9 @@ export const saveRohs = data => createAPI(`/rohs/save`, 'post', data); // 修改 export const updateRohs = data => createAPI(`/rohs/update`, 'post', data); +// 仅更新RoHs备注(不受流程节点和状态限制) +export const updateRohsRemark = data => createAPI(`/rohs/updateRemark`, 'post', data); + // 仅保存材料明细(编辑时即时保存) export const updateRohsMaterials = data => createAPI(`/rohs/updateMaterials`, 'post', data); diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index 651d04d..3f69490 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -240,6 +240,7 @@ 上传附件 + RoHs备注 @@ -554,6 +555,26 @@ + + + + + + + + + 刷新 + 保存 + 取消 + + + @@ -848,6 +869,7 @@ export default { authFileDownLoad: false, authFileRemove: false, authFilePreview: false, + authDataEntry: false, authDelete: false, superAdmin: false, createBy2: this.$store.state.user.name, @@ -1025,8 +1047,12 @@ export default { activeName: 'basicInfo', showModalFlag: false, submitModalFlag: false, + rohsRemarkFlag: false, rejectOpinion: '', submitLoading: false, + rohsRemarkForm: { + rohsRemark: '' + }, modalData: { site: 'DEFAULT', referenceNo: '', @@ -1066,6 +1092,7 @@ export default { testReportIncludingItems: '', testReportIncludingItemsList: [], remark: '', + rohsRemark: '', status: '', sgsReportNumber: '', expiredDate: '', @@ -1328,6 +1355,60 @@ export default { canRejectAction () { return this.authReject && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.isReject === 'Y' }, + hasPersistedRohsRecord () { + return !!(this.modalData && this.modalData.site && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-')) + }, + openRohsRemarkDialog () { + this.$set(this.rohsRemarkForm, 'rohsRemark', this.modalData.rohsRemark || '') + this.rohsRemarkFlag = true + }, + refreshRohsRemark () { + if (!this.hasPersistedRohsRecord()) { + this.$set(this.rohsRemarkForm, 'rohsRemark', this.modalData.rohsRemark || '') + return + } + api.getRohsDetail(this.modalData.site, this.modalData.referenceNo).then(({data}) => { + if (data && data.code === 0 && data.data) { + this.$set(this.rohsRemarkForm, 'rohsRemark', data.data.rohsRemark || '') + } else { + this.$message.error((data && data.msg) || '刷新失败') + } + }).catch(() => { + this.$message.error('刷新失败') + }) + }, + saveRohsRemark () { + const rohsRemark = this.rohsRemarkForm.rohsRemark || '' + if (!this.hasPersistedRohsRecord()) { + this.$set(this.modalData, 'rohsRemark', rohsRemark) + this.rohsRemarkFlag = false + this.$message.success('暂存成功,保存单据后写入数据库') + return + } + const params = { + site: this.modalData.site, + referenceNo: this.modalData.referenceNo, + rohsRemark: rohsRemark + } + api.updateRohsRemark(params).then(({data}) => { + if (data && data.code === 0) { + this.$set(this.modalData, 'rohsRemark', rohsRemark) + if (this.currentRow && this.currentRow.site === this.modalData.site && this.currentRow.referenceNo === this.modalData.referenceNo) { + this.$set(this.currentRow, 'rohsRemark', rohsRemark) + } + const target = (this.dataList || []).find(item => item.site === this.modalData.site && item.referenceNo === this.modalData.referenceNo) + if (target) { + this.$set(target, 'rohsRemark', rohsRemark) + } + this.rohsRemarkFlag = false + this.$message.success('操作成功') + } else { + this.$message.error((data && data.msg) || '保存失败') + } + }).catch(() => { + this.$message.error('保存失败') + }) + }, loadModalButtonCondition () { if (!this.modalData.site || !this.modalData.referenceNo || this.modalData.status !== '审批中') { this.$set(this.modalData, 'createBy2', '') @@ -1376,6 +1457,7 @@ export default { this.authFileDownLoad = this.isAuth(this.menuId+":fileDownLoad") this.authFileRemove = this.isAuth(this.menuId+":fileRemove") this.authFilePreview = this.isAuth(this.menuId+":filePreview") + this.authDataEntry = this.isAuth(this.menuId+":dataEntry") this.authDelete = this.isAuth(this.menuId+":delete") }, // 校验是否为超级管理员 @@ -1555,7 +1637,7 @@ export default { this.$message.warning('没有新增权限') return } - if (row && !this.authUpdate) { + if (row && !this.authUpdate && !this.authDataEntry) { this.$message.warning('没有编辑权限') return } @@ -1564,7 +1646,11 @@ export default { this.fileList = [] this.uploadDialog = false this.submitModalFlag = false + this.rohsRemarkFlag = false this.rejectOpinion = '' + this.rohsRemarkForm = { + rohsRemark: '' + } this.projectMaterialDialogFlag = false this.projectMaterialSelections = [] this.materialSelections = [] @@ -1581,7 +1667,7 @@ export default { finalPartNo: '', customerPartNo: '' } - this.showModalFlag = !!(row && row.status === '已完成') + this.showModalFlag = !!(row && (row.status === '已完成' || !this.authUpdate)) if (row) { this.modalTitle = 'RoHs 编辑' @@ -1662,6 +1748,7 @@ export default { testReportIncludingItems: '', testReportIncludingItemsList: [], remark: '', + rohsRemark: '', status: '草稿', sgsReportNumber: '', expiredDate: '',