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]
+ }
+ },
},
};