From fc658ea40e59c6628357cb2423bc2e6af8854d34 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Fri, 22 Nov 2024 17:14:51 +0800 Subject: [PATCH 1/5] =?UTF-8?q?2024-11-22=20=E7=89=A9=E6=96=99=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/part/partInformation.js | 5 + src/views/modules/part/bomManagement.vue | 5 +- src/views/modules/part/partInformation.vue | 1432 ++++++++--------- .../projectInfo/com_project_info_part.vue | 1087 ++++++++----- 4 files changed, 1335 insertions(+), 1194 deletions(-) diff --git a/src/api/part/partInformation.js b/src/api/part/partInformation.js index b1a4c7b..08f8337 100644 --- a/src/api/part/partInformation.js +++ b/src/api/part/partInformation.js @@ -309,3 +309,8 @@ export const getPartRevisionEngChgLevel = data => createAPI(`/plm/partInformatio export const queryPartUnitCostList = data => createAPI(`/plm/partInformation/queryPartUnitCostList`,'post',data) +export const getItemListByCodeNo = data => createAPI(`/plm/partInformation/getItemListByCodeNo`,'post',data) + +export const getItemExclusionAlreadyExists = data => createAPI(`/plm/partInformation/getItemExclusionAlreadyExists`,'post',data) + +export const getPartCharacteristicList = data => createAPI(`/plm/partInformation/getPartCharacteristicList`,'post',data) diff --git a/src/views/modules/part/bomManagement.vue b/src/views/modules/part/bomManagement.vue index b9f1f61..49a0233 100644 --- a/src/views/modules/part/bomManagement.vue +++ b/src/views/modules/part/bomManagement.vue @@ -431,6 +431,7 @@ - + 关闭 @@ -488,6 +489,7 @@ Next Part No - + @@ -170,50 +171,50 @@ 安全代码 / Safety Code - + 计划人 / Planner - + 会计组 / Accounting Group - + 计量单位 / Inventory UoM - + 产品代码 / Product Code - + 商品组1 / Comm Group 1 - + 产品大类 / Product Family - + 商品组2 / Comm Group 2 - + @@ -223,7 +224,7 @@ 资产等级 / Asset Class - + @@ -233,43 +234,34 @@ 零件状态 / Part Status - + - + - - - + + + + + ABC类 / ABC Class ABC类 / ABC Class - + - - - - - - - - - - 属性模板 - - + - - + + - + @@ -284,7 +276,7 @@ 来源国家 / Country of Origin - + @@ -297,7 +289,7 @@ 区域代码 / Region Code - + @@ -308,7 +300,7 @@ 海关统计序号 / Customs Stat No - + @@ -322,19 +314,17 @@ - + - - - + @@ -368,7 +358,7 @@ 零件成本组 / Part Cost Group - + @@ -407,7 +397,7 @@ 计划方法 / Planning Method - + @@ -510,11 +500,66 @@ - + + + + 属性模板 + + + + + 新增 + 删除 + + +
+ + + + + + +
+
+ + 新增 @@ -624,87 +669,87 @@ - - - 新增 - {{ attributeDialog?'编辑':'保存' }} - -
- - - - - -
-
- - - - - -
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + 新增 - + 新增 - + 新增 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
@@ -1353,6 +1362,49 @@
+ + + + + + + + + + 查询 + + + + + + + + + + 保存 + 关闭 + + +
@@ -1456,6 +1508,9 @@ getNextPartNo, // 获取下一个物料编码 getPartRevisionEngChgLevel, // 获取下一个物料revision queryPartUnitCostList, // 查询物料的 unitCost 列表 + getItemListByCodeNo, // 查询模板中的属性 + getItemExclusionAlreadyExists, // 查属性模板,不包括已存在的 + getPartCharacteristicList, // 获取维护的物料属性 } from '@/api/part/partInformation.js' import { getFileContentList, // 获取物料单附件列表 @@ -1490,7 +1545,6 @@ this.modalData.productGroupId4 = this.modalData.productGroupId4.toUpperCase() this.modalData.hazardCode = this.modalData.hazardCode.toUpperCase() this.modalData.productGroupId3 = this.modalData.productGroupId3.toUpperCase() - //this.modalData.umId = this.modalData.umId.toUpperCase() this.modalData.groupId = this.modalData.groupId.toUpperCase() this.modalData.productGroupId1 = this.modalData.productGroupId1.toUpperCase() this.modalData.familyId = this.modalData.familyId.toUpperCase() @@ -1507,6 +1561,13 @@ this.modalData.ifsPartNo = this.modalData.ifsPartNo.toUpperCase() } }, + + // "modalData.codeNo"(newValue, oldValue) { + // if (!newValue) { + // this.partItemList = [] + // } + // }, + itemData: { deep: true, handler: function (newV, oldV) { @@ -1576,7 +1637,7 @@ loading: false, saveLoading: false, // 初始页签 - activeTable: 'part_item', + activeTable: 'part_agent', inventoryPartTable: 'General', // ======== 数据对象 ======== modalData: { @@ -1772,6 +1833,7 @@ routingAlternativeList: [], copyAttributeList: [], fileList: [], + characteristicList: [], // ======== 列表表头 ======== columnList: [ { @@ -2200,7 +2262,7 @@ tableName: "物料属性表", columnProp: 'propertiesItemNo', headerAlign: "center", - align: "center", + align: "left", columnLabel: '属性编码', columnHidden: false, columnImage: false, @@ -2222,7 +2284,7 @@ columnImage: false, status: true, fixed: '', - columnWidth: 120, + columnWidth: 150, }, { userId: this.$store.state.user.name, @@ -2238,7 +2300,7 @@ columnImage: false, status: true, fixed: '', - columnWidth: 100, + columnWidth: 60, }, { userId: this.$store.state.user.name, @@ -2256,22 +2318,6 @@ fixed: '', columnWidth: 100, }, - // { - // userId: this.$store.state.user.name, - // functionId: 104001, - // serialNumber: '104001Table2ValueChooseFlag', - // tableId: "104001Table2", - // tableName: "物料属性表", - // columnProp: 'numValue', - // headerAlign: "center", - // align: "center", - // columnLabel: '数字值', - // columnHidden: false, - // columnImage: false, - // status: true, - // fixed: '', - // columnWidth: 70, - // }, ], updateColumnItemList: [ { @@ -3054,6 +3100,41 @@ fixed: '', } ], + characteristicColumnList: [ + { + columnProp: 'propertiesItemNo', + headerAlign: "center", + align: "left", + columnLabel: '属性编码', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 100, + }, + { + columnProp: 'itemDesc', + headerAlign: "center", + align: "left", + columnLabel: '属性名称', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 200, + }, + { + columnProp: 'valueType', + headerAlign: "center", + align: "center", + columnLabel: '属性类型', + columnHidden: false, + columnImage: false, + status: true, + fixed: '', + columnWidth: 60, + }, + ], // ======== 必填规则 ======== rules: { partNo: [ @@ -3147,6 +3228,8 @@ partSelections: [], bomAlternativeSelections: [], routingAlternativeSelections: [], + characteristicSelections: [], + itemSelections: [], // ======== 选中的当前行数据 ======== partCurrentRow: {}, // ======== 模态框开关控制 ======== @@ -3167,20 +3250,22 @@ copyPartModelFlag: false, attributeDialog: true, uploadDialog: false, + saveItemModelFlag: false } }, mounted () { this.$nextTick(() => { - this.height = window.innerHeight / 2 - 30 + this.height = window.innerHeight / 2 - 100 /*第二个表格高度的动态调整*/ - this.secondHeight = window.innerHeight - this.height - 180 + this.secondHeight = window.innerHeight - this.height - 215 }) }, created () { this.getDataList() }, + activated() { if (this.$route.params.partNo) { this.searchData.partNo = this.$route.params.partNo @@ -3221,6 +3306,22 @@ } }, + // 获取维护的物料属性 + getPartCharacteristicList () { + let tempData = { + site: this.modalData.site, + partNo: this.modalData.partNo, + recordType: 'IP' + } + getPartCharacteristicList(tempData).then(({data}) => { + if (data && data.code === 0) { + this.partItemList = data.rows + } else { + this.partItemList = [] + } + }) + }, + // 查询物料的bom版本列表 queryPartRevisionList () { let tempData = { @@ -3310,14 +3411,6 @@ this.$message.warning('请选择生效日期(Phase In)!') return } - // if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate === '' || this.revisionData.effPhaseOutDate == null)) { - // this.$message.warning('请选择失效日期(Phase Out)!') - // return - // } - // if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate < this.revisionData.effPhaseInDate)) { - // this.$message.warning('失效日期不能早于生效日期!') - // return - // } if (this.revisionData.flag === '1') { saveRevision(this.revisionData).then(({data}) => { if (data && data.code === 0) { @@ -3415,9 +3508,7 @@ this.modalData.umId = data.data.umId this.modalData.umName = data.data.umName this.modalData.weightNet = data.data.weightNet - //this.modalData.uomForWeightNet = data.data.uomForWeightNet this.modalData.volumeNet = data.data.volumeNet - //this.modalData.uomForVolumeNet = data.data.uomForVolumeNet } } }) @@ -3445,26 +3536,6 @@ }) }, - // /** - // * 编辑物料属性 - // */ - // updateItemValue () { - // let tempData = { - // site: this.$store.state.user.site, - // partNo: this.partCurrentRow.partNo, - // codeNo: this.partCurrentRow.codeNo, - // recordType: 'IP' - // } - // getPartItem(tempData).then(({data}) => { - // if (data && data.code === 0) { - // this.updatePartItemList = data.rows - // this.updateItemModelFlag = true - // } else { - // this.updatePartItemList = [] - // } - // }) - // }, - clickSave () { if (!this.attributeDialog) { // 保存 this.updateItemValue() @@ -3655,47 +3726,31 @@ }, // ======== 分页相关方法 ======== - /** - * 每页数 - * @param val - */ + // 每页数 sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() }, - /** - * 当前页 - * @param val - */ + // 当前页 currentChangeHandle (val) { this.pageIndex = val this.getDataList() }, - - /** - * 每页数 - * @param val - */ + // 每页数 locationSizeChangeHandle (val) { this.locationPageSize = val this.locationPageIndex = 1 this.getLocationList() }, - /** - * 当前页 - * @param val - */ + // 当前页 locationCurrentChangeHandle (val) { this.locationPageIndex = val this.getLocationList() }, // ======== 页签切换相关方法 ======== - /** - * 未知 - * @returns {boolean} - */ + // 未知 selectFlag(row, index) { if (row.status !== 'Y') { return true @@ -3703,20 +3758,14 @@ return false } }, - /** - * 列表表格选择替换 - * @param tab - * @param event - */ + + // 列表表格选择替换 tabClick (tab, event) { // 刷新列表数据 this.refreshCurrentTabTable() }, - /** - * 当前值发生变化的时候修改 - * @param row - * @param oldRow - */ + + // 当前值发生变化的时候修改 changeCurrentRow (row, oldRow) { // 判断是否是获取焦点的事件 if (row) { @@ -3725,13 +3774,13 @@ this.refreshCurrentTabTable() } }, - /** - * 刷新页签的table数据 - */ + + // 刷新页签的table数据 refreshCurrentTabTable () { - if (this.activeTable === 'part_item') { - this.getPartItem() - } else if (this.activeTable === 'part_agent') { + // if (this.activeTable === 'part_item') { + // this.getPartItem() + // } else + if (this.activeTable === 'part_agent') { this.getPartAgent() } else if (this.activeTable === 'part_file') { this.getFileContentData() @@ -3743,9 +3792,7 @@ }, // ======== 列表数据刷新方法 ======== - /** - * 查询物料属性 - */ + // 查询物料属性 getPartItem () { let tempData = { site: this.$store.state.user.site, @@ -3761,9 +3808,24 @@ } }) }, - /** - * 查询物料代理商 - */ + + // 查询模板中的属性 + getItemListByCodeNo () { + let tempData = { + site: this.$store.state.user.site, + codeNo: this.modalData.codeNo, + recordType: 'IP' + } + getItemListByCodeNo(tempData).then(({data}) => { + if (data && data.code === 0) { + this.partItemList = data.rows + } else { + this.partItemList = [] + } + }) + }, + + // 查询物料代理商 getPartAgent () { let tempData = { site: this.$store.state.user.site, @@ -3778,9 +3840,8 @@ } }) }, - /** - * 查询物料制造商 - */ + + // 查询物料制造商 getPartManufacturer () { let tempData = { site: this.$store.state.user.site, @@ -3795,9 +3856,8 @@ } }) }, - /** - * 查询物料库位 - */ + + // 查询物料库位 getDefaultLocation () { let tempData = { site: this.$store.state.user.site, @@ -3811,10 +3871,9 @@ } }) }, + // ======== 列表数据刷新方法 ======== - /** - * 获取数据列表 - */ + // 获取数据列表 getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex @@ -3840,9 +3899,7 @@ }, // ======== 新增/编辑模态框 ======== - /** - * 物料信息新增模态框 - */ + // 物料信息新增模态框 addModal () { getProjectPartNo(this.searchData).then(({data}) => { if (data && data.code === 0) { @@ -3941,8 +3998,10 @@ overReportTolerance: 0, fixedLeadTimeHour: 0, density: undefined, - variableLeadTimeHour: 0 + variableLeadTimeHour: 0, + partItemList: [] } + this.partItemList = [] this.inventoryPartTable = 'General' this.modalDisableFlag = false this.modalFlag = true @@ -3951,10 +4010,8 @@ } }) }, - /** - * 物料信息编辑模态框 - * @param row - */ + + // 物料信息编辑模态框 updateModal (row) { this.modalData = { flag: '2', @@ -4052,8 +4109,10 @@ fixedLeadTimeHour: row.fixedLeadTimeHour, density: row.density, variableLeadTimeHour: row.variableLeadTimeHour, - createDate: row.createDate + createDate: row.createDate, + partItemList: [] } + this.getPartCharacteristicList() this.inventoryPartTable = 'General' this.modalDisableFlag = true this.modalFlag = true @@ -4160,8 +4219,10 @@ createDate: row.createDate, bomAlternativeList: [], routingAlternativeList: [], - ifsPartNo: '' + ifsPartNo: '', + partItemList: [] } + this.getPartCharacteristicList() // 查出该物料的BOM和routing的替代 this.getBomAndRoutingList() this.inventoryPartTable = 'General' @@ -4191,25 +4252,12 @@ this.routingAlternativeSelections = val }, - /** - * 选择代理商 - */ + // 选择代理商 getAgentList () { - // // 先清空缓存选中 - // this.$nextTick(() => this.$refs.agentTable.clearSelection()) - // // 拿到选中的代理商id - // let tempDataList = this.modalData.agentId.split(';') // 查询所有代理商 getAgentListBy(this.agentData).then(({data}) => { if (data && data.code === 0) { this.agentList1 = data.rows - // this.agentList.forEach(val => { - // // 回显选中的代理商 - // if (tempDataList.includes(val.agentId)) { - // this.$nextTick(() => this.$refs.agentTable.toggleRowSelection(val, true)) - // } - // }) - // this.agentModelFlag = true } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' @@ -4217,44 +4265,6 @@ } }) }, - /** - * 代理商多选 - * @param row - */ - agentClickRow (row) { - this.$refs.agentTable.toggleRowSelection(row); - }, - /** - * 获得选中的代理商 - * @param val - */ - selectionAgent (val) { - this.agentSelections = val - }, - /** - * 返回列表唯一值 - * @param row - * @returns {string|[{trigger: string, message: string, required: boolean}]|*} - */ - getRowKeys (row) { - // 唯一值,一般都为id - return row.agentId - }, - /** - * 确认多选代理商 - * @returns {boolean} - */ - confirmAgent () { - this.modalData.agentId = '' - this.modalData.agentName = '' - for (let i = 0; i < this.agentSelections.length; i++) { - this.modalData.agentId = this.modalData.agentId + ";" + this.agentSelections[i].agentId - this.modalData.agentName = this.modalData.agentName + ";" + this.agentSelections[i].agentName - } - this.modalData.agentId = this.modalData.agentId.substring(1) - this.modalData.agentName = this.modalData.agentName.substring(1) - this.agentModelFlag = false - }, savePartAgent () { this.agentSelections1 = null @@ -4270,20 +4280,25 @@ } this.agentModelFlag = true }, + // 可选代理商 agentClickRow1 (row) { this.$refs.agentTable1.toggleRowSelection(row) }, + // 已有代理商 agentClickRow2 (row) { this.$refs.agentTable2.toggleRowSelection(row) }, + selectionAgent1 (val) { this.agentSelections1 = val }, + selectionAgent2 (val) { this.agentSelections2 = val }, + // 添加代理商 addAgent () { if (this.agentSelections1 == null || this.agentSelections1.length === 0) { @@ -4309,6 +4324,7 @@ } }) }, + // 删除物料代理商 deleteAgent () { if(this.agentSelections2 == null || this.agentSelections2.length === 0){ @@ -4334,6 +4350,7 @@ } }) }, + // 单删 deleteAgent2 (row) { this.$confirm(`是否删除该代理商?`, '提示', { @@ -4359,25 +4376,13 @@ }).catch(() => { }) }, - /** - * 选择制造商 - */ + + // 选择制造商 getManufacturerList () { - // // 先清空缓存选中 - // this.$nextTick(() => this.$refs.agentTable.clearSelection()) - // // 拿到选中的代理商id - // let tempDataList = this.modalData.agentId.split(';') // 查询所有代理商 getManufacturerListBy(this.manufacturerData).then(({data}) => { if (data && data.code === 0) { this.manufacturerList1 = data.rows - // this.agentList.forEach(val => { - // // 回显选中的代理商 - // if (tempDataList.includes(val.agentId)) { - // this.$nextTick(() => this.$refs.agentTable.toggleRowSelection(val, true)) - // } - // }) - // this.agentModelFlag = true } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' @@ -4385,9 +4390,8 @@ } }) }, - /** - * 选择默认库位 - */ + + // 选择默认库位 getLocationList () { this.locationData.limit = this.locationPageSize this.locationData.page = this.locationPageIndex @@ -4403,44 +4407,6 @@ } }) }, - /** - * 制造商多选 - * @param row - */ - manufacturerClickRow (row) { - this.$refs.manufacturerTable.toggleRowSelection(row); - }, - /** - * 获得选中的制造商 - * @param val - */ - selectionManufacturer (val) { - this.manufacturerSelections = val - }, - /** - * 返回列表唯一值 - * @param row - * @returns {string|[{trigger: string, message: string, required: boolean}]|*} - */ - getRowKeys2 (row) { - // 唯一值,一般都为id - return row.manufacturerId - }, - /** - * 确认多选制造商 - * @returns {boolean} - */ - confirmManufacturer () { - this.modalData.manufacturerId = '' - this.modalData.manufacturerName = '' - for (let i = 0; i < this.manufacturerSelections.length; i++) { - this.modalData.manufacturerId = this.modalData.manufacturerId + ";" + this.manufacturerSelections[i].manufacturerId - this.modalData.manufacturerName = this.modalData.manufacturerName + ";" + this.agentSelections[i].manufacturerName - } - this.modalData.manufacturerId = this.modalData.manufacturerId.substring(1) - this.modalData.manufacturerName = this.modalData.manufacturerName.substring(1) - this.manufacturerModelFlag = false - }, savePartManufacturer () { this.manufacturerSelections1 = null @@ -4456,20 +4422,25 @@ } this.manufacturerModelFlag = true }, + // 可选制造商 manufacturerClickRow1 (row) { this.$refs.manufacturerTable1.toggleRowSelection(row) }, + // 已有制造商 manufacturerClickRow2 (row) { this.$refs.manufacturerTable2.toggleRowSelection(row) }, + selectionManufacturer1 (val) { this.manufacturerSelections1 = val }, + selectionManufacturer2 (val) { this.manufacturerSelections2 = val }, + // 添加制造商 addManufacturer () { if (this.manufacturerSelections1 == null || this.manufacturerSelections1.length === 0) { @@ -4495,6 +4466,7 @@ } }) }, + // 删除物料制造商 deleteManufacturer () { if (this.manufacturerSelections2 == null || this.manufacturerSelections2.length === 0) { @@ -4520,6 +4492,7 @@ } }) }, + // 单删 deleteManufacturer2 (row) { this.$confirm(`是否删除该制造商?`, '提示', { @@ -4546,7 +4519,6 @@ }) }, - saveDefaultLocation () { this.locationSelections1 = null this.locationSelections2 = null @@ -4570,20 +4542,25 @@ } this.locationModelFlag = true }, + // 可选库位 locationClickRow1 (row) { this.$refs.locationTable1.toggleRowSelection(row) }, + // 已有库位 locationClickRow2 (row) { this.$refs.locationTable2.toggleRowSelection(row) }, + selectionLocation1 (val) { this.locationSelections1 = val }, + selectionLocation2 (val) { this.locationSelections2 = val }, + // 添加库位 addLocation () { if (this.locationSelections1 == null || this.locationSelections1.length === 0) { @@ -4612,6 +4589,7 @@ } }) }, + // 删除库位 deleteLocation () { if (this.locationSelections2 == null || this.locationSelections2.length === 0) { @@ -4640,6 +4618,7 @@ } }) }, + // 单删 deleteLocation2 (row) { this.$confirm(`是否删除该库位?`, '提示', { @@ -4666,7 +4645,6 @@ }) }, - // 关闭后刷新列表 refreshDetailList () { this.getPartAgent() @@ -4675,9 +4653,7 @@ }, // ======== 新增/编辑/删除方法 ======== - /** - * 物料信息新增/编辑 - */ + // 物料信息新增/编辑 saveData () { if (this.modalData.partNo === '' || this.modalData.partNo == null) { this.$message.warning('请填写物料编码!') @@ -4699,10 +4675,11 @@ this.$message.warning('请选择计量单位!') return } - // if (this.modalData.codeNo === '' || this.modalData.codeNo == null) { - // this.$message.warning('请选择属性模板!') - // return - // } + if (this.partItemList.length > 0 && (this.modalData.codeNo == null || this.modalData.codeNo === '')) { + this.$message.warning('存在物料属性,属性模板不能为空值!') + return + } + this.modalData.partItemList = this.partItemList if (this.modalData.flag === '1') { this.saveLoading = true partInformationSave(this.modalData).then(({data}) => { @@ -4786,9 +4763,8 @@ }) } }, - /** - * 物料信息删除 - */ + + // 物料信息删除 delModal () { if (this.partSelections.length === 0) { this.$message.warning('请勾选要删除的物料信息!') @@ -4872,362 +4848,390 @@ }) }, + // 新增属性模态框 + savePartItemModal () { + this.itemData.propertiesItemNo = '' + this.itemData.itemDesc = '' + this.characteristicSelections = [] + this.getItemExclusionAlreadyExists() + this.saveItemModelFlag = true + }, + + itemSelectionChange (selection) { + this.itemSelections = selection + }, + + // 删除属性 + deletePartItemModal () { + if (this.itemSelections.length === 0) { + this.$message.warning('请选择要删除的属性!') + } else { + this.$confirm("请是否确认删除该属性记录?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + this.partItemList = this.partItemList.filter(val => !this.itemSelections.includes(val)) + this.itemSelections = [] + }) + } + }, + + // 查属性模板,不包括已存在的 + getItemExclusionAlreadyExists () { + let itemNos = this.partItemList.map(item => item.propertiesItemNo).join(",") + let tempData = { + site: this.modalData.site, + recordType: 'IP', + propertiesItemNo: this.itemData.propertiesItemNo, + itemDesc: this.itemData.itemDesc, + itemNos: itemNos + } + getItemExclusionAlreadyExists(tempData).then(({data}) => { + if (data && data.code === 0) { + this.characteristicList = data.rows + } else { + this.characteristicList = [] + } + }) + }, + + // 将选择的属性加入 + saveCharacteristic () { + if (this.characteristicSelections == null || this.characteristicSelections.length === 0) { + this.$message.warning('请选择属性!') + return + } + this.partItemList = [...this.partItemList,...this.characteristicSelections] + this.saveItemModelFlag = false + }, + + characteristicClickRow (row) { + this.$refs.characteristicTable.toggleRowSelection(row) + }, + + characteristicSelectionChange(selection) { + this.characteristicSelections = selection + }, + + // 安全代码输入校验 hazardCodeBlur (tagNo) { - if (this.modalData.hazardCode != null && this.modalData.hazardCode !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and hazard_code = '" + this.modalData.hazardCode + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.hazardCode = data.baseListData[0].hazard_code - this.modalData.hazardDesc = data.baseListData[0].hazard_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and hazard_code = '" + this.modalData.hazardCode + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.hazardDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.hazardCode = data.baseListData[0].hazard_code + this.modalData.hazardDesc = data.baseListData[0].hazard_desc + } else { + this.modalData.hazardDesc = '' + } + } + }) + }, // 计划人输入校验 productGroupId4Blur (tagNo) { - if (this.modalData.productGroupId4 != null && this.modalData.productGroupId4 !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and product_group_id = '" + this.modalData.productGroupId4 + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.productGroupId4 = data.baseListData[0].product_group_id - this.modalData.productGroupName4 = data.baseListData[0].product_group_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and product_group_id = '" + this.modalData.productGroupId4 + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.productGroupName4 = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.productGroupId4 = data.baseListData[0].product_group_id + this.modalData.productGroupName4 = data.baseListData[0].product_group_name + } else { + this.modalData.productGroupName4 = '' + } + } + }) + }, // 会计组输入校验 productGroupId3Blur (tagNo) { - if (this.modalData.productGroupId3 != null && this.modalData.productGroupId3 !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and product_group_id = '" + this.modalData.productGroupId3 + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.productGroupId3 = data.baseListData[0].product_group_id - this.modalData.productGroupName3 = data.baseListData[0].product_group_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and product_group_id = '" + this.modalData.productGroupId3 + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.productGroupName3 = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.productGroupId3 = data.baseListData[0].product_group_id + this.modalData.productGroupName3 = data.baseListData[0].product_group_name + } else { + this.modalData.productGroupName3 = '' + } + } + }) + }, // 计量单位输入校验 umIdBlur (tagNo) { - if (this.modalData.umId != null && this.modalData.umId !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and um_id = '" + this.modalData.umId + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.umId = data.baseListData[0].um_id - this.modalData.umName = data.baseListData[0].um_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and um_id = '" + this.modalData.umId + "'" } - this.modalData.umName = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.umId = data.baseListData[0].um_id + this.modalData.umName = data.baseListData[0].um_name + } else { + this.modalData.umName = '' + } + } + }) }, // 产品代码输入校验 groupIdBlur (tagNo) { - if (this.modalData.groupId != null && this.modalData.groupId !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and group_id = '" + this.modalData.groupId + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.groupId = data.baseListData[0].group_id - this.modalData.groupName = data.baseListData[0].group_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and group_id = '" + this.modalData.groupId + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.groupName = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.groupId = data.baseListData[0].group_id + this.modalData.groupName = data.baseListData[0].group_name + } else { + this.modalData.groupName = '' + } + } + }) }, // 商品组1输入校验 productGroupId1Blur (tagNo) { - if (this.modalData.productGroupId1 != null && this.modalData.productGroupId1 !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and product_group_id = '" + this.modalData.productGroupId1 + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.productGroupId1 = data.baseListData[0].product_group_id - this.modalData.productGroupName1 = data.baseListData[0].product_group_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and product_group_id = '" + this.modalData.productGroupId1 + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.productGroupName1 = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.productGroupId1 = data.baseListData[0].product_group_id + this.modalData.productGroupName1 = data.baseListData[0].product_group_name + } else { + this.modalData.productGroupName1 = '' + } + } + }) }, // 产品大类输入校验 familyIdBlur (tagNo) { - if (this.modalData.familyId != null && this.modalData.familyId !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and family_id = '" + this.modalData.familyId + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.familyId = data.baseListData[0].family_id - this.modalData.familyName = data.baseListData[0].family_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and family_id = '" + this.modalData.familyId + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.familyName = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.familyId = data.baseListData[0].family_id + this.modalData.familyName = data.baseListData[0].family_name + } else { + this.modalData.familyName = '' + } + } + }) }, // 商品组2输入校验 productGroupId2Blur (tagNo) { - if (this.modalData.productGroupId2 != null && this.modalData.productGroupId2 !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and product_group_id = '" + this.modalData.productGroupId2 + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.productGroupId2 = data.baseListData[0].product_group_id - this.modalData.productGroupName2 = data.baseListData[0].product_group_name - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and product_group_id = '" + this.modalData.productGroupId2 + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.productGroupName2 = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.productGroupId2 = data.baseListData[0].product_group_id + this.modalData.productGroupName2 = data.baseListData[0].product_group_name + } else { + this.modalData.productGroupName2 = '' + } + } + }) }, // 资产等级输入校验 assetClassBlur (tagNo) { - if (this.modalData.assetClass != null && this.modalData.assetClass !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and asset_class = '" + this.modalData.assetClass + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.assetClass = data.baseListData[0].asset_class - this.modalData.assetClassDesc = data.baseListData[0].asset_class_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and asset_class = '" + this.modalData.assetClass + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.assetClassDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.assetClass = data.baseListData[0].asset_class + this.modalData.assetClassDesc = data.baseListData[0].asset_class_desc + } else { + this.modalData.assetClassDesc = '' + } + } + }) }, // 零件状态输入校验 partStatusBlur (tagNo) { - if (this.modalData.partStatus != null && this.modalData.partStatus !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and part_status = '" + this.modalData.partStatus + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.partStatus = data.baseListData[0].part_status - this.modalData.partStatusDesc = data.baseListData[0].part_status_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and part_status = '" + this.modalData.partStatus + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.partStatusDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.partStatus = data.baseListData[0].part_status + this.modalData.partStatusDesc = data.baseListData[0].part_status_desc + } else { + this.modalData.partStatusDesc = '' + } + } + }) }, // abc类输入校验 abcClassBlur (tagNo) { - if (this.modalData.abcClass != null && this.modalData.abcClass !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and abc_class = '" + this.modalData.abcClass + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.abcClass = data.baseListData[0].abc_class - this.modalData.abcClassDesc = data.baseListData[0].abc_class_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and abc_class = '" + this.modalData.abcClass + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.abcClassDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.abcClass = data.baseListData[0].abc_class + this.modalData.abcClassDesc = data.baseListData[0].abc_class_desc + } else { + this.modalData.abcClassDesc = '' + } + } + }) }, // 属性模板输入校验 codeNoBlur (tagNo) { - if (this.modalData.codeNo != null && this.modalData.codeNo !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and Code_no = '" + this.modalData.codeNo + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.codeNo = data.baseListData[0].Code_no - this.modalData.codeDesc = data.baseListData[0].Code_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and Code_no = '" + this.modalData.codeNo + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.codeDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.codeNo = data.baseListData[0].Code_no + this.modalData.codeDesc = data.baseListData[0].Code_desc + this.getItemListByCodeNo() + } else { + this.modalData.codeDesc = '' + } + } + }) }, // 来源国家输入校验 countryOfOriginBlur (tagNo) { - if (this.modalData.countryOfOrigin != null && this.modalData.countryOfOrigin !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and country_of_origin = '" + this.modalData.countryOfOrigin + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.countryOfOrigin = data.baseListData[0].country_of_origin - this.modalData.countryOfOriginDesc = data.baseListData[0].country_of_origin_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and country_of_origin = '" + this.modalData.countryOfOrigin + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.countryOfOriginDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.countryOfOrigin = data.baseListData[0].country_of_origin + this.modalData.countryOfOriginDesc = data.baseListData[0].country_of_origin_desc + } else { + this.modalData.countryOfOriginDesc = '' + } + } + }) }, // 区域代码输入校验 regionOfOriginBlur (tagNo) { - if (this.modalData.regionOfOrigin != null && this.modalData.regionOfOrigin !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and region_of_origin = '" + this.modalData.regionOfOrigin + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.regionOfOrigin = data.baseListData[0].region_of_origin - this.modalData.regionOfOriginDesc = data.baseListData[0].region_of_origin_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and region_of_origin = '" + this.modalData.regionOfOrigin + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.regionOfOriginDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.regionOfOrigin = data.baseListData[0].region_of_origin + this.modalData.regionOfOriginDesc = data.baseListData[0].region_of_origin_desc + } else { + this.modalData.regionOfOriginDesc = '' + } + } + }) }, // 海关统计序号输入校验 customsStatNoBlur (tagNo) { - if (this.modalData.customsStatNo != null && this.modalData.customsStatNo !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and customs_stat_no = '" + this.modalData.customsStatNo + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.customsStatNo = data.baseListData[0].customs_stat_no - this.modalData.customsStatDesc = data.baseListData[0].customs_stat_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and customs_stat_no = '" + this.modalData.customsStatNo + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.customsStatDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.customsStatNo = data.baseListData[0].customs_stat_no + this.modalData.customsStatDesc = data.baseListData[0].customs_stat_desc + } else { + this.modalData.customsStatDesc = '' + } + } + }) }, // 零件成本组输入校验 partCostGroupIdBlur (tagNo) { - if (this.modalData.partCostGroupId != null && this.modalData.partCostGroupId !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and part_cost_group_id = '" + this.modalData.partCostGroupId + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.partCostGroupId = data.baseListData[0].part_cost_group_id - this.modalData.partCostGroupDesc = data.baseListData[0].part_cost_group_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and part_cost_group_id = '" + this.modalData.partCostGroupId + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.partCostGroupDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.partCostGroupId = data.baseListData[0].part_cost_group_id + this.modalData.partCostGroupDesc = data.baseListData[0].part_cost_group_desc + } else { + this.modalData.partCostGroupDesc = '' + } + } + }) }, // 计划方法 planningMethodBlur (tagNo) { - if (this.modalData.planningMethod != null && this.modalData.planningMethod !== '') { - let tempData = { - tagno: tagNo, - conditionSql: " and planning_method = '" + this.modalData.planningMethod + "'" + " and site = '" + this.modalData.site + "'" - } - verifyData(tempData).then(({data}) => { - if (data && data.code === 0) { - if (data.baseListData.length > 0) { - this.modalData.planningMethod = data.baseListData[0].planning_method - this.modalData.planningMethodDesc = data.baseListData[0].planning_method_desc - return - } - } - }) + let tempData = { + tagno: tagNo, + conditionSql: " and planning_method = '" + this.modalData.planningMethod + "'" + " and site = '" + this.modalData.site + "'" } - this.modalData.planningMethodDesc = '' + verifyData(tempData).then(({data}) => { + if (data && data.code === 0) { + if (data.baseListData.length > 0) { + this.modalData.planningMethod = data.baseListData[0].planning_method + this.modalData.planningMethodDesc = data.baseListData[0].planning_method_desc + } else { + this.modalData.planningMethodDesc = '' + } + } + }) }, // ======== 列表操作方法 ======== - /** - * 单机选中物料信息 - * @param row - */ + // 单机选中物料信息 partClickRow (row,column) { - // if (column.label === '操作'){ - // return - // } - // this.$refs.partTable.toggleRowSelection(row) this.partCurrentRow = JSON.parse(JSON.stringify(row)) }, - /** - * 复选物料信息 - * @param val - */ + + // 复选物料信息 selectionPart (val) { this.partSelections = val this.$refs.selectDiv.setLengthselected(this.partSelections.length) @@ -5246,43 +5250,8 @@ }) }, - // ======== 属性页签相关方法 ======== - - // /** - // * 编辑属性值方法 - // * @returns {boolean} - // */ - // itemSaveData () { - // if(this.itemData.partNo === '' || this.itemData.partNo == null){ - // this.$message.warning('未选择物料!') - // return false - // } - // if(this.itemData.propertiesItemNo === ''|| this.itemData.propertiesItemNo == null){ - // this.$message.warning('未选择属性!') - // return false - // } - // savePartItemValue(this.itemData).then(({data}) => { - // if (data && data.code === 0) { - // this.itemModalFlag = false - // this.getPartItem() - // this.$message({ - // message: '操作成功', - // type: 'success', - // duration: 1500, - // onClose: () => {} - // }) - // } else { - // this.$alert(data.msg, '错误', { - // confirmButtonText: '确定' - // }) - // } - // }) - // }, - // ======== 附件的相关方法 ======== - /** - * 获取物料附件列表 - */ + // 获取物料附件列表 getFileContentData () { let currentData = { orderRef1: this.$store.state.user.site, @@ -5296,9 +5265,8 @@ } }) }, - /** - * 上传文件 - */ + + // 上传文件 uploadFile () { let currentData = { titleCon: '物料附件上传', @@ -5312,10 +5280,8 @@ // this.$refs.partUploadFile.init(currentData); // }) }, - /** - * 文件删除 - * @param row - */ + + // 文件删除 deleteFile (row) { this.$confirm('确定要删除此文件?', '提示', { confirmButtonText: '确定', @@ -5340,10 +5306,8 @@ }).catch(() => { }) }, - /** - * 文件下载 - * @param row - */ + + // 文件下载 downloadFile (row) { downLoadQuotationFile(row).then(({data}) => { // 不限制文件下载类型 @@ -5401,11 +5365,7 @@ }, // ======== chooseList相关方法 ======== - /** - * 获取基础数据列表S - * @param val - * @param type - */ + // 获取基础数据列表S getBaseList (val, type) { this.tagNo = val this.tempCodeNo = this.modalData.codeNo @@ -5451,10 +5411,8 @@ this.$refs.baseList.init(val, strVal) }) }, - /** - * 列表方法的回调 - * @param val - */ + + // 列表方法的回调 getBaseData (val) { if (this.tagNo === 1007) { this.modalData.umId = val.um_id @@ -5481,22 +5439,9 @@ this.modalData.manufacturerId = val.manufacturer_id this.modalData.manufacturerName = val.manufacturer_name } else if (this.tagNo === 20) { - if (this.modalData.flag === '2') { - 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(() => { - }) - } - } else { - this.modalData.codeNo = val.Code_no - this.$set(this.modalData, 'codeDesc', val.Code_desc) - } + this.modalData.codeNo = val.Code_no + this.$set(this.modalData, 'codeDesc', val.Code_desc) + this.getItemListByCodeNo() } else if (this.tagNo === 123) { this.modalData.hazardCode = val.hazard_code this.modalData.hazardDesc = val.hazard_desc @@ -5528,9 +5473,7 @@ }, // ======== 导出相关方法 ======== - /** - * 导出excel - */ + // 导出excel async createExportData () { this.searchData.limit = -1 this.searchData.page = 1 @@ -5557,23 +5500,24 @@ let s = eval('(' + json + ')') return s }, - toMenu(type,row){ - let path = ''; + + toMenu (type,row) { + let path = '' if (type === 'Routing'){ path = 'routing' }else if (type === 'BOM'){ path = 'bom' } - if (this.$router.resolve(`/part-${path}Management`).resolved.name === '404'){ - this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',}); - }else { + if (this.$router.resolve(`/part-${path}Management`).resolved.name === '404') { + this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',}) + } else { this.$router.push({name:`part-${path}Management`,params:{partNo:row.partNo},}) } }, rowStyle ({row}) { if (this.partCurrentRow.partNo === row.partNo) { - return { 'background-color': '#E8F7F6', cursor: 'pointer' }; + return { 'background-color': '#E8F7F6', cursor: 'pointer' } } }, } @@ -5582,11 +5526,7 @@