From aaec0f7bfe4a3ade3152fa7acb3f4a41ff319403 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 27 十一月 2023 10:34:42 +0800
Subject: [PATCH] fix 修复 字典使用 default 样式报警告问题

---
 src/views/system/dict/data.vue |   39 ++++++++-------------------------------
 1 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue
index f40c129..c2ef550 100644
--- a/src/views/system/dict/data.vue
+++ b/src/views/system/dict/data.vue
@@ -12,11 +12,6 @@
             <el-form-item label="瀛楀吀鏍囩" prop="dictLabel">
               <el-input v-model="queryParams.dictLabel" placeholder="璇疯緭鍏ュ瓧鍏告爣绛�" clearable style="width: 200px" @keyup.enter="handleQuery" />
             </el-form-item>
-            <el-form-item label="鐘舵��" prop="status">
-              <el-select v-model="queryParams.status" placeholder="鏁版嵁鐘舵��" clearable style="width: 200px">
-                <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
-              </el-select>
-            </el-form-item>
             <el-form-item>
               <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
               <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
@@ -54,18 +49,12 @@
         <el-table-column label="瀛楀吀缂栫爜" align="center" prop="dictCode" v-if="false" />
         <el-table-column label="瀛楀吀鏍囩" align="center" prop="dictLabel">
           <template #default="scope">
-            <span v-if="scope.row.listClass === '' || scope.row.listClass === 'default'">{{ scope.row.dictLabel }}</span>
-            <el-tag v-else :type="scope.row.listClass === 'primary' ? '' : scope.row.listClass">{{ scope.row.dictLabel
-            }}</el-tag>
+            <span v-if="(scope.row.listClass === '' || scope.row.listClass === 'default') && (scope.row.cssClass === '' || scope.row.cssClass == null)">{{ scope.row.dictLabel }}</span>
+            <el-tag v-else :type="(scope.row.listClass === 'primary' || scope.row.listClass === 'default') ? '' : scope.row.listClass" :class="scope.row.cssClass">{{ scope.row.dictLabel }}</el-tag>
           </template>
         </el-table-column>
         <el-table-column label="瀛楀吀閿��" align="center" prop="dictValue" />
         <el-table-column label="瀛楀吀鎺掑簭" align="center" prop="dictSort" />
-        <el-table-column label="鐘舵��" align="center" prop="status">
-          <template #default="scope">
-            <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
-          </template>
-        </el-table-column>
         <el-table-column label="澶囨敞" align="center" prop="remark" :show-overflow-tooltip="true" />
         <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180">
           <template #default="scope">
@@ -114,11 +103,6 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="鐘舵��" prop="status">
-          <el-radio-group v-model="form.status">
-            <el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
-          </el-radio-group>
-        </el-form-item>
         <el-form-item label="澶囨敞" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
         </el-form-item>
@@ -141,7 +125,6 @@
 import { DictDataForm, DictDataQuery, DictDataVO } from "@/api/system/dict/data/types";
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
-const { sys_normal_disable } = toRefs<any>(proxy?.useDict("sys_normal_disable"));
 const route = useRoute();
 
 const dataList = ref<DictDataVO[]>([]);
@@ -180,7 +163,6 @@
   cssClass: '',
   listClass: "default",
   dictSort: 0,
-  status: "0",
   remark: ''
 }
 const data = reactive<PageData<DictDataForm, DictDataQuery>>({
@@ -190,7 +172,6 @@
     pageSize: 10,
     dictName: '',
     dictType: '',
-    status: '',
     dictLabel: ''
   },
   rules: {
@@ -251,12 +232,10 @@
 }
 /** 鏂板鎸夐挳鎿嶄綔 */
 const handleAdd = () => {
+  reset();
+  form.value.dictType = queryParams.value.dictType;
   dialog.visible = true;
   dialog.title = "娣诲姞瀛楀吀鏁版嵁";
-  nextTick(() => {
-    reset();
-    form.value.dictType = queryParams.value.dictType;
-  })
 }
 /** 澶氶�夋閫変腑鏁版嵁 */
 const handleSelectionChange = (selection: DictDataVO[]) => {
@@ -265,15 +244,13 @@
   multiple.value = !selection.length;
 }
 /** 淇敼鎸夐挳鎿嶄綔 */
-const handleUpdate = (row?: DictDataVO) => {
+const handleUpdate = async (row?: DictDataVO) => {
+  reset();
   const dictCode = row?.dictCode || ids.value[0];
+  const res = await getData(dictCode);
+  Object.assign(form.value, res.data);
   dialog.visible = true;
   dialog.title = "淇敼瀛楀吀鏁版嵁";
-  nextTick(async () => {
-    const res = await getData(dictCode);
-    reset();
-    form.value = res.data;
-  })
 }
 /** 鎻愪氦鎸夐挳 */
 const submitForm = () => {

--
Gitblit v1.9.3