| | |
| | | item.indexOf('上级库位编码')!==-1|| |
| | | item.indexOf('规格型号')!==-1|| |
| | | item.indexOf('存货分类')!==-1|| |
| | | item.indexOf('仓库编码')!==-1|| |
| | | item.indexOf('预计寿命')!==-1|| |
| | | item.indexOf('剩余寿命')!==-1|| |
| | | item.indexOf('模具编码')!==-1|| |
| | | item.indexOf('产品编码')!==-1|| |
| | | |
| | | item.indexOf('计量单位/组名称')!==-1 |
| | | " |
| | |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | |
| | | if (this.sheetName.indexOf('模具清单') !== -1) { |
| | | this.statusArr = [ |
| | | { code: 'Y', name: '正常' }, |
| | | { code: 'N', name: '故障' } |
| | | ] |
| | | |
| | | this.tableData[0].forEach(j => { |
| | | j.uuid = nanoid() |
| | | j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : '' |
| | | }) |
| | | this.tableData[1].forEach(j => { |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | }, |
| | | // 提交 |
| | | submit() { |
| | |
| | | } |
| | | if (this.sheetName.indexOf('缺陷定义') !== -1) { |
| | | const res = this.handleDefectDefineSubmitData() |
| | | if (res.code !== '200') { |
| | | return this.$message.info(res.message) |
| | | } |
| | | } |
| | | |
| | | if (this.sheetName.indexOf('模具清单') !== -1 && this.sheetName.indexOf('模具关联产品') !== -1) { |
| | | const res = this.handleMouldListSubmitData() |
| | | if (res.code !== '200') { |
| | | return this.$message.info(res.message) |
| | | } |
| | |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | // 处理模具清单提交数据 |
| | | handleMouldListSubmitData() { |
| | | let flag = true |
| | | let msg = '' |
| | | if ([...new Set(this.tableData[0].map(i => i['*模具编号(唯一)']))].length !== this.tableData[0].length) { |
| | | return this.$message.info('模具清单编号不能重复!') |
| | | } |
| | | // if ([...new Set(this.tableData[1].map(i => i['*往来单位编号(唯一)']))].length !== this.tableData[1].length) { |
| | | // return this.$message.info('往来单位编号不能重复!') |
| | | // } |
| | | this.tableData[0].forEach(j => { |
| | | if (!j['*模具编号(唯一)']) { |
| | | flag = false |
| | | msg = '*模具编号(唯一)不能为空!' |
| | | } |
| | | if (!j['*模具名称']) { |
| | | flag = false |
| | | msg = '*模具名称不能为空!' |
| | | } |
| | | }) |
| | | this.tableData[1].forEach(j => { |
| | | if (!j['模具编码'] && j['产品编码']) { |
| | | flag = false |
| | | msg = '模具编码不能为空!' |
| | | } |
| | | if (j['模具编码'] && !j['产品编码']) { |
| | | flag = false |
| | | msg = '产品编码不能为空!' |
| | | } |
| | | }) |
| | | |
| | | if (!flag) { |
| | | return { code: '301', message: msg } |
| | | } |
| | | |
| | | this.tableData[0].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | this.tableData[1].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | |
| | | // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据 |
| | | findParent(parents, childNode, treeData) { |
| | |
| | | '缺陷描述': '' |
| | | }) |
| | | } |
| | | // 模具清单 |
| | | if (this.sheetName.indexOf('模具清单') !== -1 && this.activeName === '0') { |
| | | this.tableData[0].unshift({ |
| | | uuid: nanoid(), |
| | | '*模具编号(唯一)': '', |
| | | '*模具名称': '', |
| | | '规格型号': '', |
| | | '*状态': 'Y', |
| | | '*仓库编码': '', |
| | | '预计寿命(次)': '', |
| | | '剩余寿命(次)': '' |
| | | }) |
| | | } |
| | | if (this.sheetName.indexOf('模具关联产品') !== -1 && this.activeName === '1') { |
| | | this.tableData[1].unshift({ |
| | | uuid: nanoid(), |
| | | '模具编码': '', |
| | | '产品编码': '' |
| | | }) |
| | | } |
| | | }, |
| | | delRow(row) { |
| | | // 针对单sheet |