Jelajahi Sumber

动态控制值新增

dengrui 1 Minggu lalu
induk
melakukan
d59eb37d56
1 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 7 2
      src/views/system/dict/components/dict-item.vue

+ 7 - 2
src/views/system/dict/components/dict-item.vue

@@ -38,7 +38,11 @@ watch?.(
     resetQuery();
   }
 );
-
+// 控制该数组里面的值不能新增
+const noAddTypeCode = ["device_type"];
+const addValStatus = computed(() => {
+  return noAddTypeCode.includes(props.typeCode);
+});
 const queryFormRef = ref(ElForm);
 const dataFormRef = ref(ElForm);
 
@@ -117,7 +121,7 @@ function openDialog(form?: any) {
     dataFormRef.value.label = "";
     dataFormRef.value = "";
     formData.dictLabel = "";
-    formData.dictValue = ""
+    formData.dictValue = "";
   }
 }
 
@@ -224,6 +228,7 @@ onMounted?.(() => {
         <el-button
           v-hasPerm="[ButtonPermKeys.SYSTEM.BTNS.dict_add]"
           type="primary"
+          v-if="!addValStatus"
           @click="openDialog()"
           ><i-ep-plus />新增</el-button
         >