From 6bbceeae0a692ef60f429dbca889752fcb09ec9a Mon Sep 17 00:00:00 2001 From: houshuai <17802598606@163.com> Date: 星期四, 03 七月 2025 19:42:01 +0800 Subject: [PATCH] 线边库和订单 基本页面搭建 --- src/views/lsw/modules/LswMaterialForm.vue | 77 +++++++++++++++++++++++++++++--------- 1 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/views/lsw/modules/LswMaterialForm.vue b/src/views/lsw/modules/LswMaterialForm.vue index 8c4958e..98276bb 100644 --- a/src/views/lsw/modules/LswMaterialForm.vue +++ b/src/views/lsw/modules/LswMaterialForm.vue @@ -69,6 +69,7 @@ }, data() { return { + warehouseColOptions: [], labelCol: { xs: { span: 24 }, sm: { span: 5 }, @@ -81,8 +82,6 @@ }, // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 addDefaultRowNum: 1, - validatorRules: { - }, refKeys: ['lswMaterialInventory', ], tableKeys:['lswMaterialInventory', ], activeKey: 'lswMaterialInventory', @@ -91,14 +90,6 @@ loading: false, dataSource: [], columns: [ - { - title: '鐗╂枡ID', - key: 'materialId', - type: JVXETypes.input, - width:"200px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', - }, { title: '鎵规鍙�', key: 'batchNumber', @@ -110,10 +101,12 @@ { title: '搴撳瓨绫诲瀷', key: 'inventoryCategory', - type: JVXETypes.input, + type: JVXETypes.select, width:"200px", - placeholder: '璇疯緭鍏�${title}', + placeholder: '璇烽�夋嫨${title}', defaultValue:'', + options:[], + dictCode: 'inventoryCategory' }, { title: '鏁伴噺', @@ -124,27 +117,46 @@ defaultValue:'', }, { - title: '搴撳瓨鍦癐D', + title: '搴撳瓨鍦�', key: 'warehouseId', - type: JVXETypes.input, - width:"200px", - placeholder: '璇疯緭鍏�${title}', - defaultValue:'', + type: JVXETypes.select, + width: "200px", + options: this.warehouseColOptions, }, { title: '搴撳瓨鐘舵��', key: 'inventoryStatus', - type: JVXETypes.input, + type: JVXETypes.select, width:"200px", placeholder: '璇疯緭鍏�${title}', defaultValue:'', + options:[], + dictCode: 'inventory_status' }, ] + }, + validatorRules: { + materialNumber: [ + { required: true, message: '鐗╂枡缂栫爜鏄繀閫夐」', trigger: 'change' } + ], + materialName: [ + { required: true, message: '鐗╂枡鍚嶇О鏄繀閫夐」', trigger: 'change' } + ], + materialModel: [ + { required: true, message: '鐗╂枡鍨嬪彿鏄繀閫夐」', trigger: 'change' } + ], + materialCategory: [ + { required: true, message: '鐗╂枡绫诲瀷鏄繀閫夐」', trigger: 'change' } + ], + materialUnit: [ + { required: true, message: '鍗曚綅鏄繀閫夐」', trigger: 'change' } + ], }, url: { add: "/lswmaterial/lswMaterial/add", edit: "/lswmaterial/lswMaterial/edit", queryById: "/lswmaterial/lswMaterial/queryById", + warehouseList:"/base/lineSideWarehouse/list", lswMaterialInventory: { list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId' }, @@ -165,8 +177,37 @@ }, }, created () { + this.loadWarehouseOptions(); }, methods: { + async loadWarehouseOptions() { + try { + const res = await getAction(this.url.warehouseList); + console.log("浠撳簱API鍝嶅簲:", res); + let data = []; + data = res.result.records; + console.log("澶勭悊鍚庣殑浠撳簱鏁版嵁:", data); + const options = data.map(item => ({ + text: item.warehouseName || `浠撳簱(${item.id})`, // 鏄剧ず鏂囨湰 + value: item.id // 瀹為檯鍊� + })); + console.log("鏍煎紡鍖栧悗鐨勯�夐」:", options); + const warehouseCol = this.lswMaterialInventoryTable.columns.find( + col => col.key === 'warehouseId' + ); + if (warehouseCol) { + this.$set(warehouseCol, 'options', options); + this.warehouseColOptions = warehouseCol.options + console.log("鏇存柊鍚庣殑鍒楅�夐」:", warehouseCol.options); + } + this.$nextTick(() => { + this.$forceUpdate(); + console.log("宸插己鍒舵洿鏂拌鍥�"); + }); + } catch (error) { + console.error('鍔犺浇浠撳簱鍒楄〃澶辫触:', error); + } + }, addBefore(){ this.lswMaterialInventoryTable.dataSource=[] }, -- Gitblit v1.9.3