diff --git a/src/api/part/partInformation.js b/src/api/part/partInformation.js index 9e76147..f46d7d7 100644 --- a/src/api/part/partInformation.js +++ b/src/api/part/partInformation.js @@ -119,3 +119,8 @@ export const deletePartManufacturer = data => createAPI(`/plm/partInformation/de * 删除物料制造商(单删) */ export const deleteManufacturer = data => createAPI(`/plm/partInformation/deleteManufacturer`,'post',data) + +/** + * 修改物料属性值 + */ +export const commitItemValue = data => createAPI(`/plm/partInformation/commitItemValue`,'post',data) diff --git a/src/views/modules/part/partInformation.vue b/src/views/modules/part/partInformation.vue index e2bdf96..0f23216 100644 --- a/src/views/modules/part/partInformation.vue +++ b/src/views/modules/part/partInformation.vue @@ -141,27 +141,15 @@ - - - 属性模板 - - - - - 计量单位 - - - - - + - + @@ -174,6 +162,18 @@ + + + 属性模板 + + + + + 计量单位 + + + + 物料分类 @@ -238,6 +238,11 @@ + + + 编辑 + + - - - + + + + + + + + + + @@ -392,6 +397,65 @@ + + +
+ + + + + + + + + + + +
+ + 保存 + 关闭 + +
+ @@ -422,60 +486,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -573,6 +583,7 @@ 关闭 +
@@ -698,7 +709,8 @@ getManufacturerListBy, // 根据条件查询可选制造商 addPartManufacturer, // 新增物料制造商 deletePartManufacturer, // 删除物料制造商 - deleteManufacturer // 删除物料制造商(单删) + deleteManufacturer, // 删除物料制造商(单删) + commitItemValue, // 修改物料属性值 } from '@/api/part/partInformation.js' import { getFileContentList, // 获取物料单附件列表 @@ -746,6 +758,7 @@ pageSize: 50, totalPage: 0, selectedDataNum: 0, + tempCodeNo: '', // 条件查询 searchData: { site: this.$store.state.user.site, @@ -829,6 +842,7 @@ // ======== 数据列表 ======== dataList: [], partItemList: [], + updatePartItemList: [], partAgentList: [], partManufacturerList: [], fileContentList: [], @@ -1372,6 +1386,62 @@ columnWidth: 70, }, ], + updateColumnItemList: [ + { + userId: this.$store.state.user.name, + functionId: 104001, + serialNumber: '104001Table6PropertiesItemID', + tableId: "104001Table6", + tableName: "物料属性表", + columnProp: 'propertiesItemNo', + headerAlign: "center", + align: "center", + columnLabel: '属性编码', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 90, + }, + { + userId: this.$store.state.user.name, + functionId: 104001, + serialNumber: '104001Table6PropertiesItemDesc', + tableId: "104001Table6", + tableName: "物料属性表", + columnProp: 'itemDesc', + headerAlign: "center", + align: "center", + columnLabel: '属性名称', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 90, + }, + { + userId: this.$store.state.user.name, + functionId: 104001, + serialNumber: '104001Table6ValueType', + tableId: "104001Table6", + tableName: "物料属性表", + columnProp: 'valueType', + headerAlign: "center", + align: "center", + columnLabel: '属性类型', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 70, + }, + ], columnAgentList: [ { userId: this.$store.state.user.name, @@ -1497,8 +1567,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3ManufacturerId', - tableId: "104001Table3", + serialNumber: '104001Table5ManufacturerId', + tableId: "104001Table5", tableName: "物料制造商表", columnProp: 'manufacturerId', headerAlign: "center", @@ -1514,8 +1584,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3ManufacturerName', - tableId: "104001Table3", + serialNumber: '104001Table5ManufacturerName', + tableId: "104001Table5", tableName: "物料制造商表", columnProp: 'manufacturerName', headerAlign: "center", @@ -1531,8 +1601,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3Active', - tableId: '104001Table3', + serialNumber: '104001Table5Active', + tableId: '104001Table5', tableName: '物料制造商表', columnProp: 'active', headerAlign: 'center', @@ -1548,8 +1618,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3CreateDate', - tableId: '104001Table3', + serialNumber: '104001Table5CreateDate', + tableId: '104001Table5', tableName: '物料制造商表', columnProp: 'createDate', headerAlign: 'center', @@ -1565,8 +1635,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3CreateBy', - tableId: '104001Table3', + serialNumber: '104001Table5CreateBy', + tableId: '104001Table5', tableName: '物料制造商表', columnProp: 'createBy', headerAlign: 'center', @@ -1582,8 +1652,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3UpdateDate', - tableId: '104001Table3', + serialNumber: '104001Table5UpdateDate', + tableId: '104001Table5', tableName: '物料制造商表', columnProp: 'updateDate', headerAlign: 'center', @@ -1599,8 +1669,8 @@ { userId: this.$store.state.user.name, functionId: 104001, - serialNumber: '104001Table3UpdateBy', - tableId: '104001Table3', + serialNumber: '104001Table5UpdateBy', + tableId: '104001Table5', tableName: '物料制造商表', columnProp: 'updateBy', headerAlign: 'center', @@ -1845,9 +1915,11 @@ itemModalDisableFlag: false, itemModalFlag: false, agentModelFlag: false, - manufacturerModelFlag: false + manufacturerModelFlag: false, + updateItemModelFlag: false } }, + mounted () { this.$nextTick(() => { this.height = window.innerHeight / 2 - 30 @@ -1855,10 +1927,80 @@ this.secondHeight = window.innerHeight / 2 - 206 }) }, + created () { this.getDataList() }, + methods: { + + focusNextInput (index, type) { + let aaa = '' + if (this.updatePartItemList.length - 1 === index) { + aaa = `${type}0` + } else { + aaa = `${type}${index + 1}` + } + this.$nextTick(() => { + this.$refs[aaa].focus() + }) + }, + + // 编辑物料属性 + updateItemValue () { + let tempData = { + site: this.$store.state.user.site, + partNo: this.partCurrentRow.partNo, + codeNo: this.partCurrentRow.codeNo, + recordType: 'B' + } + getPartItem(tempData).then(({data}) => { + if (data && data.code === 0) { + this.updatePartItemList = data.rows + this.updateItemModelFlag = true + } else { + this.updatePartItemList = [] + } + }) + }, + + // 确认修改物料属性 + commitItemValue () { + let tempData = { + itemList: JSON.parse(JSON.stringify(this.updatePartItemList)) + } + commitItemValue(tempData).then(({data}) => { + if (data && data.code === 0) { + this.getPartItem() + this.updateItemModelFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + // ======= 正则校验 ======= + handleInput (value, type) { + // 大于等于0,且只能输入4位小数 + let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1') + if (val === null || val === undefined || val === '') { + val = 0 + } + if (type === 1) { + this.modalData.weightNet = val + } else if (type === 2) { + this.modalData.volumeNet = val + } + }, + // ======== 分页相关方法 ======== /** * 每页数 @@ -2750,6 +2892,7 @@ */ getBaseList (val, type) { this.tagNo = val + this.tempCodeNo = this.modalData.codeNo this.$nextTick(() => { let strVal = '' if (val === 107) { @@ -2804,8 +2947,17 @@ this.modalData.manufacturerId = val.manufacturer_id this.modalData.manufacturerName = val.manufacturer_name } else if (this.tagNo === 20) { - this.modalData.codeNo = val.Code_no - this.$set(this.modalData, 'codeDesc', val.Code_desc) + if (val.Code_no != this.tempCodeNo) { + this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.modalData.codeNo = val.Code_no + this.$set(this.modalData, 'codeDesc', val.Code_desc) + }).catch(() => { + }) + } } }, @@ -2821,10 +2973,11 @@ }) return this.resultList }, - startDownload () { - }, - finishDownload () { - }, + + startDownload () {}, + + finishDownload () {}, + fields () { let json = '{' this.columnList.forEach((item, index) => { @@ -2850,5 +3003,8 @@ /deep/ .customer-tab .el-tabs__content { height: 294px; } +.numInput /deep/ .el-input__inner{ + text-align: right; +}