From 6e3153f560b32a31caf930ba0338daf238d6bd6a Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期四, 08 五月 2025 17:49:43 +0800 Subject: [PATCH] 工具管理-库位货架管理页面开发、仓库管理页面优化 --- src/views/tms/modules/WarehouseForm.vue | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/views/tms/modules/WarehouseForm.vue b/src/views/tms/modules/WarehouseForm.vue index 395abe5..be42c4d 100644 --- a/src/views/tms/modules/WarehouseForm.vue +++ b/src/views/tms/modules/WarehouseForm.vue @@ -25,7 +25,7 @@ </a-col> <a-col :span="12"> <a-form-model-item label="鍙跺瓙鑺傜偣鏍囪瘑" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="leafFlag"> - <a-radio-group v-model="model.leafFlag" placeholder="璇烽�夋嫨鏄惁鍙跺瓙鑺傜偣"> + <a-radio-group :disabled="leafDisableFlag" v-model="model.leafFlag" placeholder="璇烽�夋嫨鏄惁鍙跺瓙鑺傜偣"> <a-radio :value="'2'">鏈夊瓙鑺傜偣</a-radio> <a-radio :value="'1'">鏄彾瀛愯妭鐐�</a-radio> </a-radio-group> @@ -66,6 +66,7 @@ }, data () { return { + leafDisableFlag: false, model:{ }, labelCol: { @@ -80,6 +81,7 @@ validatorRules: { warehouseId: [ { required: true, message: '璇疯緭鍏ヤ粨搴撶紪鍙�!'}, + { validator: (rule, value, callback) => validateDuplicateValue('tms_warehouse', 'warehouse_id', value, this.model.id, callback)} ], warehouseName: [ { required: true, message: '璇疯緭鍏ヤ粨搴撳悕绉�!'}, @@ -95,6 +97,7 @@ ], }, url: { + list: "/tms/warehouse/list", add: "/tms/warehouse/add", edit: "/tms/warehouse/edit", queryById: "/tms/warehouse/queryById" @@ -104,13 +107,24 @@ computed: { formDisabled(){ return this.disabled - }, + } }, created () { //澶囦唤model鍘熷鍊� this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { + async updateLeafDisableFlag() { + const parentId = this.model.id; + try { + const res = await getAction(this.url.list, { parentId: parentId }); + if (res.success) { + this.leafDisableFlag = res.result.total > 0; + } + } catch (e) { + console.error(e); + } + }, add (treeSelected) { this.modelDefault.parentId = treeSelected.key this.modelDefault.parentWarehouseId = treeSelected.entity.warehouseId @@ -118,6 +132,10 @@ this.edit(this.modelDefault); }, edit (record) { + if (record.parentId === '-1') { + record.parentWarehouseId = '-1' + record.parentWarehouseName = '鑸畤鏁戠敓' + } this.model = Object.assign({}, record); this.visible = true; }, @@ -137,7 +155,6 @@ httpurl+=this.url.edit; method = 'put'; } - console.log(this.model) httpAction(httpurl,this.model,method).then((res)=>{ if(res.success){ that.$message.success(res.message); @@ -152,6 +169,13 @@ }) }, + }, + watch: { + 'model.id': function(newVal) { + if (newVal) { + this.updateLeafDisableFlag() + } + } } } </script> \ No newline at end of file -- Gitblit v1.9.3