diff --git a/src/views/modules/fanuc/labor.vue b/src/views/modules/fanuc/labor.vue index e55c5a1..1d9d68a 100644 --- a/src/views/modules/fanuc/labor.vue +++ b/src/views/modules/fanuc/labor.vue @@ -230,16 +230,14 @@ - - + + - + - - - + { - if (data && data.code === 0) { - this.refreshCurrentTabTable2() - this.modalFlag1 = false - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { + this.$refs.costForm.validate((valid,obj) => { + if (valid){ + if (this.modalData1.flag1 === '1') { // 新增 + appendByLaborClass(this.modalData1).then(({data}) => { + if (data && data.code === 0) { + this.refreshCurrentTabTable2() + this.modalFlag1 = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => { + } + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) } }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - }) - } else { // 修改 - amendByLaborClass(this.modalData1).then(({data}) => { - if (data && data.code === 0) { - this.refreshCurrentTabTable2() - this.modalFlag1 = false - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { + } else { // 修改 + amendByLaborClass(this.modalData1).then(({data}) => { + if (data && data.code === 0) { + this.refreshCurrentTabTable2() + this.modalFlag1 = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => { + } + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) } }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) } - }) - } + }else { + let i = 1; + Object.keys(obj).forEach((key)=>{ + if (i === 1){ + this.$message.warning(obj[key][0].message) + } + i++; + }) + } + }) + }, // 删除方法