From 25aaa8b4f38d5a46f8b49a6f105ab9665689f654 Mon Sep 17 00:00:00 2001
From: FCD <2453864257@qq.com>
Date: Thu, 5 Feb 2026 11:11:50 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AD=97?=
=?UTF-8?q?=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/device/sparePartsLedger/index.vue | 244 +++++++++++---------
1 file changed, 134 insertions(+), 110 deletions(-)
diff --git a/src/views/device/sparePartsLedger/index.vue b/src/views/device/sparePartsLedger/index.vue
index 154da55..bad40cf 100644
--- a/src/views/device/sparePartsLedger/index.vue
+++ b/src/views/device/sparePartsLedger/index.vue
@@ -207,6 +207,12 @@
prop="materialDesc"
width="120"
/>
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -524,6 +448,39 @@
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
+ this.initCategoryList();
+ });
+ },
methods: {
+ dict,
+ validateWlCodeBlur(rule, value, callback){
+ if (typeof value !== 'string') {
+ callback(new Error('请输入正确的库位编码'));
+ }else {
+ const reg = /^[a-zA-Z0-9]+$/;
+ if (reg.test(value)){
+ callback();
+ }else {
+ callback(new Error('请输入正确的库位编码'));
+ }
+ }
+ },
// 生成表头序号
indexMethod(index) {
return index + 1;
@@ -1172,6 +1159,43 @@ export default {
`sparePartsLedger_template_${new Date().getTime()}.xlsx`
);
},
+ initCategoryList(){
+ // 同时监听两个字典,任意一个变化都会触发回调
+ this.$watch(
+ () => [
+ this.dict.type.power_transmission_parts,
+ this.dict.type.hydraulic_components,
+ this.dict.type.pneumatic_components,
+ this.dict.type.electric_control,
+ this.dict.type.process_consumables,
+ this.dict.type.general_pipeline_parts,
+ this.dict.type.fastening_sealing_parts
+ ],
+ ([val1, val2, val3, val4, val5, val6, val7,]) => {
+ // 确保两个字典都已加载完成(非undefined)
+ if (val1 && val2 && val3 && val4 && val5 && val6 && val7) {
+ this.categoryList = [
+ ...val1,
+ ...val2,
+ ...val3,
+ ...val4,
+ ...val5,
+ ...val6,
+ ...val7
+ ]
+ }
+ },
+ { immediate: true, deep: true }
+ );
+ },
+ changeType(res){
+ if (!res){
+ this.initCategoryList()
+ this.form.spareCategory = ''
+ }else {
+ this.categoryList = this.dict.type[res]
+ }
+ },
},
};