From fe631515b71782a10a750874f6d4582fe027cd22 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 09:32:49 +0800
Subject: [PATCH] 公司-所有的表格添加斑马纹
---
src/views/system/dict/index.vue | 154 ++++++++++++++++++++++++++-------------------------
1 files changed, 79 insertions(+), 75 deletions(-)
diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue
index d1f5d8a..98ac047 100644
--- a/src/views/system/dict/index.vue
+++ b/src/views/system/dict/index.vue
@@ -101,7 +101,7 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
+ <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" stripe>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="瀛楀吀缂栧彿" align="center" prop="dictId" />
<el-table-column label="瀛楀吀鍚嶇О" align="center" prop="dictName" :show-overflow-tooltip="true"/>
@@ -123,20 +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
- type="text"
- icon="Edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['system:dict:edit']"
- >淇敼</el-button>
- <el-button
- 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>
@@ -163,7 +153,7 @@
<el-radio
v-for="dict in sys_normal_disable"
:key="dict.value"
- :label="dict.value"
+ :value="dict.value"
>{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
@@ -183,21 +173,22 @@
<script setup name="Dict">
import useDictStore from '@/store/modules/dict'
-import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
+import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"
+import {onMounted} from "vue";
-const { proxy } = getCurrentInstance();
-const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
+const { proxy } = getCurrentInstance()
+const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
-const typeList = ref([]);
-const open = ref(false);
-const loading = ref(true);
-const showSearch = ref(true);
-const ids = ref([]);
-const single = ref(true);
-const multiple = ref(true);
-const total = ref(0);
-const title = ref("");
-const dateRange = ref([]);
+const typeList = ref([])
+const open = ref(false)
+const loading = ref(true)
+const showSearch = ref(true)
+const ids = ref([])
+const single = ref(true)
+const multiple = ref(true)
+const total = ref(0)
+const title = ref("")
+const dateRange = ref([])
const data = reactive({
form: {},
@@ -212,24 +203,26 @@
dictName: [{ required: true, message: "瀛楀吀鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }],
dictType: [{ required: true, message: "瀛楀吀绫诲瀷涓嶈兘涓虹┖", trigger: "blur" }]
},
-});
+})
-const { queryParams, form, rules } = toRefs(data);
+const { queryParams, form, rules } = toRefs(data)
/** 鏌ヨ瀛楀吀绫诲瀷鍒楄〃 */
function getList() {
- loading.value = true;
+ loading.value = true
listType(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
- typeList.value = response.rows;
- total.value = response.total;
- loading.value = false;
- });
+ typeList.value = response.rows
+ total.value = response.total
+ loading.value = false
+ })
}
+
/** 鍙栨秷鎸夐挳 */
function cancel() {
- open.value = false;
- reset();
+ open.value = false
+ reset()
}
+
/** 琛ㄥ崟閲嶇疆 */
function reset() {
form.value = {
@@ -238,85 +231,96 @@
dictType: undefined,
status: "0",
remark: undefined
- };
- proxy.resetForm("dictRef");
+ }
+ proxy.resetForm("dictRef")
}
+
/** 鎼滅储鎸夐挳鎿嶄綔 */
function handleQuery() {
- queryParams.value.pageNum = 1;
- getList();
+ queryParams.value.pageNum = 1
+ getList()
}
+
/** 閲嶇疆鎸夐挳鎿嶄綔 */
function resetQuery() {
- dateRange.value = [];
- proxy.resetForm("queryRef");
- handleQuery();
+ dateRange.value = []
+ proxy.resetForm("queryRef")
+ handleQuery()
}
+
/** 鏂板鎸夐挳鎿嶄綔 */
function handleAdd() {
- reset();
- open.value = true;
- title.value = "娣诲姞瀛楀吀绫诲瀷";
+ 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;
+ ids.value = selection.map(item => item.dictId)
+ single.value = selection.length != 1
+ multiple.value = !selection.length
}
+
/** 淇敼鎸夐挳鎿嶄綔 */
function handleUpdate(row) {
- reset();
- const dictId = row.dictId || ids.value;
+ reset()
+ const dictId = row.dictId || ids.value
getType(dictId).then(response => {
- form.value = response.data;
- open.value = true;
- title.value = "淇敼瀛楀吀绫诲瀷";
- });
+ form.value = response.data
+ open.value = true
+ title.value = "淇敼瀛楀吀绫诲瀷"
+ })
}
+
/** 鎻愪氦鎸夐挳 */
function submitForm() {
proxy.$refs["dictRef"].validate(valid => {
if (valid) {
if (form.value.dictId != undefined) {
updateType(form.value).then(response => {
- proxy.$modal.msgSuccess("淇敼鎴愬姛");
- open.value = false;
- getList();
- });
+ proxy.$modal.msgSuccess("淇敼鎴愬姛")
+ open.value = false
+ getList()
+ })
} else {
addType(form.value).then(response => {
- proxy.$modal.msgSuccess("鏂板鎴愬姛");
- open.value = false;
- getList();
- });
+ proxy.$modal.msgSuccess("鏂板鎴愬姛")
+ open.value = false
+ getList()
+ })
}
}
- });
+ })
}
+
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
function handleDelete(row) {
- const dictIds = row.dictId || ids.value;
+ const dictIds = row.dictId || ids.value
proxy.$modal.confirm('鏄惁纭鍒犻櫎瀛楀吀缂栧彿涓�"' + dictIds + '"鐨勬暟鎹」锛�').then(function() {
- return delType(dictIds);
+ return delType(dictIds)
}).then(() => {
- getList();
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- }).catch(() => {});
+ getList()
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+ }).catch(() => {})
}
+
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
proxy.download("system/dict/type/export", {
...queryParams.value
- }, `dict_${new Date().getTime()}.xlsx`);
+ }, `dict_${new Date().getTime()}.xlsx`)
}
+
/** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
function handleRefreshCache() {
refreshCache().then(() => {
- proxy.$modal.msgSuccess("鍒锋柊鎴愬姛");
- useDictStore().cleanDict();
- });
+ proxy.$modal.msgSuccess("鍒锋柊鎴愬姛")
+ useDictStore().cleanDict()
+ })
}
-getList();
+onMounted(() => {
+ getList();
+});
</script>
--
Gitblit v1.9.3