From 6666ce5526b1ed17f5c3906c94620cad586745a5 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 28 六月 2024 17:01:39 +0800
Subject: [PATCH] 优化代码

---
 src/views/system/dict/index.vue |   47 +++++++++++++++++++----------------------------
 1 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue
index f4f2e6f..7bbd174 100644
--- a/src/views/system/dict/index.vue
+++ b/src/views/system/dict/index.vue
@@ -6,7 +6,6 @@
                v-model="queryParams.dictName"
                placeholder="璇疯緭鍏ュ瓧鍏稿悕绉�"
                clearable
-               size="small"
                style="width: 240px"
                @keyup.enter="handleQuery"
             />
@@ -16,7 +15,6 @@
                v-model="queryParams.dictType"
                placeholder="璇疯緭鍏ュ瓧鍏哥被鍨�"
                clearable
-               size="small"
                style="width: 240px"
                @keyup.enter="handleQuery"
             />
@@ -26,7 +24,6 @@
                v-model="queryParams.status"
                placeholder="瀛楀吀鐘舵��"
                clearable
-               size="small"
                style="width: 240px"
             >
                <el-option
@@ -37,11 +34,9 @@
                />
             </el-select>
          </el-form-item>
-         <el-form-item label="鍒涘缓鏃堕棿">
+         <el-form-item label="鍒涘缓鏃堕棿" style="width: 308px">
             <el-date-picker
                v-model="dateRange"
-               size="small"
-               style="width: 240px"
                value-format="YYYY-MM-DD"
                type="daterange"
                range-separator="-"
@@ -50,8 +45,8 @@
             ></el-date-picker>
          </el-form-item>
          <el-form-item>
-            <el-button type="primary" icon="Search" size="mini" @click="handleQuery">鎼滅储</el-button>
-            <el-button icon="Refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
+            <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+            <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
          </el-form-item>
       </el-form>
 
@@ -61,7 +56,6 @@
                type="primary"
                plain
                icon="Plus"
-               size="mini"
                @click="handleAdd"
                v-hasPermi="['system:dict:add']"
             >鏂板</el-button>
@@ -71,7 +65,6 @@
                type="success"
                plain
                icon="Edit"
-               size="mini"
                :disabled="single"
                @click="handleUpdate"
                v-hasPermi="['system:dict:edit']"
@@ -82,7 +75,6 @@
                type="danger"
                plain
                icon="Delete"
-               size="mini"
                :disabled="multiple"
                @click="handleDelete"
                v-hasPermi="['system:dict:remove']"
@@ -93,7 +85,6 @@
                type="warning"
                plain
                icon="Download"
-               size="mini"
                @click="handleExport"
                v-hasPermi="['system:dict:export']"
             >瀵煎嚭</el-button>
@@ -103,7 +94,6 @@
                type="danger"
                plain
                icon="Refresh"
-               size="mini"
                @click="handleRefreshCache"
                v-hasPermi="['system:dict:remove']"
             >鍒锋柊缂撳瓨</el-button>
@@ -133,22 +123,10 @@
                <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
          </el-table-column>
-         <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+         <el-table-column label="鎿嶄綔" align="center" width="160" class-name="small-padding fixed-width">
             <template #default="scope">
-               <el-button
-                  size="mini"
-                  type="text"
-                  icon="Edit"
-                  @click="handleUpdate(scope.row)"
-                  v-hasPermi="['system:dict:edit']"
-               >淇敼</el-button>
-               <el-button
-                  size="mini"
-                  type="text"
-                  icon="Delete"
-                  @click="handleDelete(scope.row)"
-                  v-hasPermi="['system:dict:remove']"
-               >鍒犻櫎</el-button>
+               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dict:edit']">淇敼</el-button>
+               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dict:remove']">鍒犻櫎</el-button>
             </template>
          </el-table-column>
       </el-table>
@@ -194,6 +172,7 @@
 </template>
 
 <script setup name="Dict">
+import useDictStore from '@/store/modules/dict'
 import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
 
 const { proxy } = getCurrentInstance();
@@ -236,11 +215,13 @@
     loading.value = false;
   });
 }
+
 /** 鍙栨秷鎸夐挳 */
 function cancel() {
   open.value = false;
   reset();
 }
+
 /** 琛ㄥ崟閲嶇疆 */
 function reset() {
   form.value = {
@@ -252,29 +233,34 @@
   };
   proxy.resetForm("dictRef");
 }
+
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 function handleQuery() {
   queryParams.value.pageNum = 1;
   getList();
 }
+
 /** 閲嶇疆鎸夐挳鎿嶄綔 */
 function resetQuery() {
   dateRange.value = [];
   proxy.resetForm("queryRef");
   handleQuery();
 }
+
 /** 鏂板鎸夐挳鎿嶄綔 */
 function handleAdd() {
   reset();
   open.value = true;
   title.value = "娣诲姞瀛楀吀绫诲瀷";
 }
+
 /** 澶氶�夋閫変腑鏁版嵁 */
 function handleSelectionChange(selection) {
   ids.value = selection.map(item => item.dictId);
   single.value = selection.length != 1;
   multiple.value = !selection.length;
 }
+
 /** 淇敼鎸夐挳鎿嶄綔 */
 function handleUpdate(row) {
   reset();
@@ -285,6 +271,7 @@
     title.value = "淇敼瀛楀吀绫诲瀷";
   });
 }
+
 /** 鎻愪氦鎸夐挳 */
 function submitForm() {
   proxy.$refs["dictRef"].validate(valid => {
@@ -305,6 +292,7 @@
     }
   });
 }
+
 /** 鍒犻櫎鎸夐挳鎿嶄綔 */
 function handleDelete(row) {
   const dictIds = row.dictId || ids.value;
@@ -315,16 +303,19 @@
     proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
   }).catch(() => {});
 }
+
 /** 瀵煎嚭鎸夐挳鎿嶄綔 */
 function handleExport() {
   proxy.download("system/dict/type/export", {
     ...queryParams.value
   }, `dict_${new Date().getTime()}.xlsx`);
 }
+
 /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
 function handleRefreshCache() {
   refreshCache().then(() => {
     proxy.$modal.msgSuccess("鍒锋柊鎴愬姛");
+    useDictStore().cleanDict();
   });
 }
 

--
Gitblit v1.9.3