diff --git a/src/views/modules/part/bom_create.vue b/src/views/modules/part/bom_create.vue index 5f1a5ce..2198ae6 100644 --- a/src/views/modules/part/bom_create.vue +++ b/src/views/modules/part/bom_create.vue @@ -1660,13 +1660,13 @@ export default { { userId: this.$store.state.user.name, functionId: 601002, - serialNumber: '601002Table2ConsumptionItem', + serialNumber: '601002Table2OperationNo', tableId: '601002Table2', tableName: 'BOM子物料表', - columnProp: 'consumptionItem', + columnProp: 'operationNo', headerAlign: 'center', align: 'center', - columnLabel: '消耗项目', + columnLabel: '工序编码', columnHidden: false, columnImage: false, columnSortable: false, @@ -1678,31 +1678,31 @@ export default { { userId: this.$store.state.user.name, functionId: 601002, - serialNumber: '601002Table2IssueType', + serialNumber: '601002Table2OperationName', tableId: '601002Table2', tableName: 'BOM子物料表', - columnProp: 'issueType', + columnProp: 'operationName', headerAlign: 'center', - align: 'center', - columnLabel: '生产属性', + align: 'left', + columnLabel: '工序名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', - columnWidth: 140 + columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 601002, - serialNumber: '601002Table2OperationNo', + serialNumber: '601002Table2ConsumptionItem', tableId: '601002Table2', tableName: 'BOM子物料表', - columnProp: 'operationNo', + columnProp: 'consumptionItem', headerAlign: 'center', align: 'center', - columnLabel: '工序编码', + columnLabel: '消耗项目', columnHidden: false, columnImage: false, columnSortable: false, @@ -1714,20 +1714,20 @@ export default { { userId: this.$store.state.user.name, functionId: 601002, - serialNumber: '601002Table2OperationName', + serialNumber: '601002Table2IssueType', tableId: '601002Table2', tableName: 'BOM子物料表', - columnProp: 'operationName', + columnProp: 'issueType', headerAlign: 'center', - align: 'left', - columnLabel: '工序名称', + align: 'center', + columnLabel: '生产属性', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', - columnWidth: 120 + columnWidth: 140 }, { userId: this.$store.state.user.name, diff --git a/src/views/modules/part/part_create.vue b/src/views/modules/part/part_create.vue index 51e9e7c..495ddd1 100644 --- a/src/views/modules/part/part_create.vue +++ b/src/views/modules/part/part_create.vue @@ -3473,7 +3473,7 @@ export default { this.$message.warning("请填写模板名称!") return } - + // 确保 buNo 字段正确填充(可能需要从 bu 中提取) if (!this.tempData.buNo || this.tempData.buNo === '') { // 如果 bu 是 "site_buNo" 格式,提取 buNo @@ -3484,14 +3484,14 @@ export default { this.tempData.buNo = this.tempData.bu } } - + console.log('保存模板数据:', this.tempData) console.log('保存模式:', this.templateEditMode ? '编辑' : '新增') - + // 根据模式选择调用新增还是更新API const apiMethod = this.templateEditMode ? templateUpdate : templateAdd const actionText = this.templateEditMode ? '更新' : '新增' - + apiMethod(this.tempData).then(({data}) => { if (data&&data.code===0){ this.getTemplateList() @@ -3571,26 +3571,21 @@ export default { if (this.modalData.tempNo && this.modalData.tempNo !== '') { // 编辑模式:加载选中模板的数据 this.templateEditMode = true - + // 从 templateList 中找到对应的模板名称 const selectedTemplate = this.templateList.find(t => t.templateNo === this.modalData.tempNo) const templateName = selectedTemplate ? selectedTemplate.templateName : '' - + // 调用API获取模板详情(传递整个 modalData 对象) chooseTemplate(this.modalData).then(({data}) => { console.log('获取模板数据返回:', data) if (data && data.code === 0 && data.data) { console.log('模板详情数据:', data.data) - + // 处理 BU 数据 let buValue = data.data.buNo || this.modalData.buNo || '' + buValue = this.$store.state.user.site+'_'+buValue let buNoValue = buValue - - // 如果 buValue 包含下划线,说明是 "site_buNo" 格式,需要提取 - if (buValue && buValue.includes('_')) { - buNoValue = buValue.split('_')[1] - } - // 将模板数据填充到 tempData this.tempData = { site: this.$store.state.user.site, diff --git a/src/views/modules/part/quicklyCreateBom.vue b/src/views/modules/part/quicklyCreateBom.vue index 86f0ff1..205bb29 100644 --- a/src/views/modules/part/quicklyCreateBom.vue +++ b/src/views/modules/part/quicklyCreateBom.vue @@ -2307,10 +2307,10 @@ export default { columnWidth: 100 }, { - columnProp: 'partType2', + columnProp: 'tempNo', headerAlign: "center", align: "center", - columnLabel: '零件类型', + columnLabel: '模板', columnHidden: false, columnImage: false, status: true, @@ -2318,16 +2318,17 @@ export default { columnWidth: 100 }, { - columnProp: 'tempNo', + columnProp: 'partType2', headerAlign: "center", align: "center", - columnLabel: '模板', + columnLabel: '零件类型', columnHidden: false, columnImage: false, status: true, fixed: '', columnWidth: 100 }, + { columnProp: 'umName', headerAlign: "center", @@ -3260,11 +3261,11 @@ export default { console.log('activated 触发 - 当前 partNo:', this.searchData.partNo) console.log('activated 触发 - 路由参数 partNo:', this.$route.query.data.partNo) console.log('activated 触发 - savedPartData:', this.savedPartData) - + // 如果产品编码已通过"维护"生成,从保存的副本恢复数据 if (this.partNoGenerated && this.savedPartData) { console.log('产品编码已生成,从 savedPartData 恢复数据:', this.savedPartData.partNo) - + // 从保存的副本恢复数据 this.searchData.site = this.savedPartData.site this.searchData.buNo = this.savedPartData.buNo @@ -3273,15 +3274,15 @@ export default { this.searchData.testPartId = this.savedPartData.testPartId this.searchData.codeNo = this.savedPartData.codeNo || this.$route.query.data.partCodeNo this.searchData.rfqDetailId = this.savedPartData.rfqDetailId || this.$route.query.data.id - + console.log('恢复后的 searchData.partNo:', this.searchData.partNo) - + // 刷新相关数据 this.getNodeTree(); this.getPartItem(); return } - + // 产品编码未生成时,正常从路由参数加载数据 console.log('从路由参数加载初始数据') this.searchData = this.$route.query.data @@ -3605,7 +3606,7 @@ export default { this.searchData.partNo = row.partNo this.searchData.partDesc = row.partDesc this.searchData.testPartId = row.id - + // 标记产品编码已生成(从 * 变成实际编码)并保存数据副本 if (row.partNo && row.partNo !== '*') { this.partNoGenerated = true @@ -3620,9 +3621,9 @@ export default { } console.log('设置 partNoGenerated = true,保存的数据:', this.savedPartData) } - + console.log('更新后的 searchData.partNo:', this.searchData.partNo) - + await this.getNodeTree() let tempData = { site: this.$store.state.user.site, @@ -4681,8 +4682,44 @@ export default { } getChooselist1(propLists).then((data) => { if (data.data && data.data.code === 0){ + // 对 umList 进行排序,将"米"和"千张"放在最前面 + let umList = data.data.list[this.partList1.length][0] || [] + if (Array.isArray(umList) && umList.length > 0) { + try { + const priorityList = [] + const otherList = [] + + umList.forEach(item => { + if (!item) return + const umid = String(item.fieldname1 || item.UMID || '') + const umName = String(item.caption1 || item.UMName || '') + const isQianZhang = umid === '1002' || umName.includes('千张') + const isMi = umName === '米' || (umName.includes('米') && umName.length <= 2 && !umName.includes('千')) + + if (isMi || isQianZhang) { + priorityList.push({ item, isMi, isQianZhang }) + } else { + otherList.push(item) + } + }) + + // 米优先,然后千张 + priorityList.sort((a, b) => { + if (a.isMi && !b.isMi) return -1 + if (!a.isMi && b.isMi) return 1 + return 0 + }) + + if (priorityList.length > 0) { + umList = [...priorityList.map(p => p.item), ...otherList] + } + } catch (error) { + console.warn('计量单位排序失败,使用原始顺序:', error) + } + } + for (let i = 0; i < this.partList1.length; i++) { - this.$set(this.partList1[i], 'umList', data.data.list[this.partList1.length][0]); + this.$set(this.partList1[i], 'umList', umList); this.$set(this.partList1[i], 'partFamilyList', data.data.list[i][0]); this.$set(this.partList1[i], 'partProductGroupList1', data.data.list[i][1]); this.$set(this.partList1[i], 'partProductGroupList2', data.data.list[i][2]);