| | |
| | | item.indexOf('所属仓库编码')!==-1|| |
| | | item.indexOf('上级库位编码')!==-1|| |
| | | item.indexOf('规格型号')!==-1|| |
| | | item.indexOf('存货分类编码')!==-1|| |
| | | item.indexOf('存货分类')!==-1|| |
| | | |
| | | item.indexOf('计量单位/组名称')!==-1 |
| | | " |
| | |
| | | > |
| | | <el-option |
| | | v-for="item in meterMethodArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </div> |
| | | <div v-else-if="item.indexOf('工序类型')!==-1"> |
| | | <el-select |
| | | v-model="row[item]" |
| | | placeholder="请选择" |
| | | filterable |
| | | style="width:100%" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in stepTypeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | |
| | | { code: '1', name: '是' }, |
| | | { code: '0', name: '否' } |
| | | ], |
| | | stepTypeArr: [ |
| | | { code: 'Z', name: '自制' }, |
| | | { code: 'W', name: '外协' } |
| | | ], |
| | | orgArr: [], // 组织 |
| | | orgOptions: [], |
| | | defaultProps: { |
| | |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | if (this.sheetName.indexOf('设备类型') !== -1) { |
| | | this.statusArr = [ |
| | | { code: 'Y', name: '正常' }, |
| | | { code: 'N', name: '停用' } |
| | | ] |
| | | const orgArr = this.orgArr.map(i => i.torg_code) |
| | | |
| | | this.tableData[0].forEach(j => { |
| | | j.uuid = nanoid() |
| | | }) |
| | | this.tableData[1].forEach(j => { |
| | | j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : '' |
| | | j['*所属组织编码'] = j['*所属组织编码'] ? (orgArr.includes(j['*所属组织编码']) ? this.findParent([], j['*所属组织编码'], this.orgOptions).reverse() : '') : '' |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | |
| | | if (this.sheetName.indexOf('工序设置') !== -1) { |
| | | this.statusArr = [ |
| | | { code: 'Y', name: '正常' }, |
| | | { code: 'N', name: '停用' } |
| | | ] |
| | | this.tableData[0].forEach(j => { |
| | | j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : '' |
| | | j['*工序类型'] = j['*工序类型'] ? this.stepTypeArr.find(e => e.name === j['*工序类型']).code : '' |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | }, |
| | | // 提交 |
| | | submit() { |
| | |
| | | return this.$message.info(res.message) |
| | | } |
| | | } |
| | | if (this.sheetName.indexOf('设备类型') !== -1) { |
| | | const res = this.handleDeviceListSubmitData() |
| | | if (res.code !== '200') { |
| | | return this.$message.info(res.message) |
| | | } |
| | | } |
| | | if (this.sheetName.indexOf('工序设置') !== -1) { |
| | | const res = this.handleProcessListSubmitData() |
| | | if (res.code !== '200') { |
| | | return this.$message.info(res.message) |
| | | } |
| | | } |
| | | if (this.sheetName.indexOf('缺陷定义') !== -1) { |
| | | const res = this.handleDefectDefineSubmitData() |
| | | if (res.code !== '200') { |
| | | return this.$message.info(res.message) |
| | | } |
| | | } |
| | | |
| | | const data = { |
| | | fileCode: this.excelCode, |
| | |
| | | if (this.sheetName.indexOf('人员管理') !== -1) { |
| | | this.handlePersonListUploadTemplate(false) |
| | | } |
| | | if (this.sheetName.indexOf('设备类型') !== -1) { |
| | | this.tableData[0].forEach(j => { |
| | | j.uuid = nanoid() |
| | | }) |
| | | this.tableData[1].forEach(j => { |
| | | j['*所属组织编码'] = this.findParent([], j['*所属组织编码'], this.orgOptions).reverse() |
| | | j.uuid = nanoid() |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(e => { |
| | |
| | | const orgArr = this.orgArr.map(i => i.torg_code) |
| | | |
| | | // this.sheetName.indexOf('人员管理') |
| | | // 第一次提交 |
| | | // 第一次渲染 |
| | | if (isFirstUpload) { |
| | | this.tableData[0].forEach(j => { |
| | | j['所属岗位编码'] = j['所属岗位编码'] ? j['所属岗位编码'].split(',').filter(e => postArr.includes(e)) : [] |
| | |
| | | }) |
| | | } |
| | | |
| | | // 非第一次提交 |
| | | // 非第一次渲染 |
| | | if (!isFirstUpload) { |
| | | this.tableData[0].forEach(j => { |
| | | j.所属岗位编码 = typeof j.所属岗位编码 === 'string' ? j.所属岗位编码.split(',').filter(e => postArr.includes(e)) : [] |
| | |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | // 处理设备清单提交数据 |
| | | handleDeviceListSubmitData() { |
| | | 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['*设备编号(唯一)']) { |
| | | flag = false |
| | | msg = '*设备编号(唯一)不能为空!' |
| | | } |
| | | if (!j['*设备名称']) { |
| | | flag = false |
| | | msg = '*设备名称不能为空!' |
| | | } |
| | | if (!j['*所属组织编码']) { |
| | | flag = false |
| | | msg = '*所属组织编码不能为空!' |
| | | } |
| | | if (!j['*设备类型编码']) { |
| | | flag = false |
| | | msg = '*设备类型编码不能为空!' |
| | | } |
| | | if (!j['*状态']) { |
| | | flag = false |
| | | msg = '*状态不能为空!' |
| | | } |
| | | }) |
| | | |
| | | if (!flag) { |
| | | return { code: '301', message: msg } |
| | | } |
| | | |
| | | this.tableData[1].forEach(j => { |
| | | j['*所属组织编码'] = j['*所属组织编码'][j['*所属组织编码'].length - 1] |
| | | }) |
| | | |
| | | this.tableData[0].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | this.tableData[1].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | // 处理工序设置提交数据 |
| | | handleProcessListSubmitData() { |
| | | let flag = true |
| | | let msg = '' |
| | | if ([...new Set(this.tableData[0].map(i => i['*工序编号(唯一)']))].length !== this.tableData[0].length) { |
| | | return this.$message.info('编码不能重复!') |
| | | } |
| | | this.tableData[0].forEach(j => { |
| | | if (!j['*工序编号(唯一)']) { |
| | | flag = false |
| | | msg = '*工序编号(唯一)' |
| | | } |
| | | if (!j['*工序名称']) { |
| | | flag = false |
| | | msg = '*工序名称' |
| | | } |
| | | if (!j['*工序类型']) { |
| | | flag = false |
| | | msg = '*工序类型' |
| | | } |
| | | if (!j['*状态']) { |
| | | flag = false |
| | | msg = '*状态' |
| | | } |
| | | }) |
| | | |
| | | if (!flag) { |
| | | return { code: '301', message: msg + '不能为空!' } |
| | | } |
| | | |
| | | this.tableData[0].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | // 处理缺陷定义提交数据 |
| | | handleDefectDefineSubmitData() { |
| | | let flag = true |
| | | let msg = '' |
| | | if ([...new Set(this.tableData[0].map(i => i['*缺陷编号(唯一)']))].length !== this.tableData[0].length) { |
| | | return this.$message.info('编码不能重复!') |
| | | } |
| | | this.tableData[0].forEach(j => { |
| | | if (!j['*缺陷编号(唯一)']) { |
| | | flag = false |
| | | msg = '*缺陷编号(唯一)' |
| | | } |
| | | if (!j['*缺陷名称']) { |
| | | flag = false |
| | | msg = '*缺陷名称' |
| | | } |
| | | }) |
| | | |
| | | if (!flag) { |
| | | return { code: '301', message: msg + '不能为空!' } |
| | | } |
| | | |
| | | this.tableData[0].map(item => { |
| | | delete (item.uuid) |
| | | }) |
| | | |
| | | return { code: '200', message: '成功!' } |
| | | }, |
| | | |
| | | // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据 |
| | | findParent(parents, childNode, treeData) { |
| | | // console.log(parents, childNode, treeData, 2) |
| | |
| | | }) |
| | | } |
| | | // 存货档案 |
| | | if (this.sheetName.indexOf('存货类型') !== -1 && this.activeName === '0') { |
| | | if (this.sheetName.indexOf('存货分类') !== -1 && this.activeName === '0') { |
| | | this.tableData[0].unshift({ |
| | | uuid: nanoid(), |
| | | '*存货分类编码(唯一)': '', |
| | | '*存货分类编号(唯一)': '', |
| | | '*存货分类名称': '', |
| | | '上级编码': '' |
| | | }) |
| | |
| | | if (this.sheetName.indexOf('存货') !== -1 && this.activeName === '1') { |
| | | this.tableData[1].unshift({ |
| | | uuid: nanoid(), |
| | | '*存货编码(唯一)': '', |
| | | '*存货编号(唯一)': '', |
| | | '*存货名称': '', |
| | | '规格型号': '', |
| | | '*存货分类编码': '', |
| | |
| | | '是否委外': '0' |
| | | }) |
| | | } |
| | | // 设备清单 |
| | | if (this.sheetName.indexOf('设备类型') !== -1 && this.activeName === '0') { |
| | | this.tableData[0].unshift({ |
| | | uuid: nanoid(), |
| | | '*设备类型编号(唯一)': '', |
| | | '*设备类型名称': '', |
| | | '描述': '' |
| | | }) |
| | | } |
| | | if (this.sheetName.indexOf('设备清单') !== -1 && this.activeName === '1') { |
| | | this.tableData[1].unshift({ |
| | | uuid: nanoid(), |
| | | '*设备编号(唯一)': '', |
| | | '*设备名称': '', |
| | | '*所属组织编码': '', |
| | | '设备类型编码': '', |
| | | '*状态': 'Y' |
| | | }) |
| | | } |
| | | // 工序设置 |
| | | if (this.sheetName.indexOf('工序设置') !== -1) { |
| | | this.tableData[0].unshift({ |
| | | uuid: nanoid(), |
| | | '*工序编号(唯一)': '', |
| | | '*工序名称': '', |
| | | '*工序类型': 'Z', |
| | | '*状态': 'Y', |
| | | '描述': '' |
| | | }) |
| | | } |
| | | // 缺陷定义 |
| | | if (this.sheetName.indexOf('缺陷定义') !== -1) { |
| | | this.tableData[0].unshift({ |
| | | uuid: nanoid(), |
| | | '*缺陷编号(唯一)': '', |
| | | '*缺陷名称': '', |
| | | '缺陷描述': '' |
| | | }) |
| | | } |
| | | }, |
| | | delRow(row) { |
| | | // 针对单sheet |