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/data.vue | 164 +++++++++++++++++++++++++++++-------------------------
1 files changed, 88 insertions(+), 76 deletions(-)
diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue
index f6207dc..23ca2a9 100644
--- a/src/views/system/dict/data.vue
+++ b/src/views/system/dict/data.vue
@@ -86,7 +86,7 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
+ <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange" stripe>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="瀛楀吀缂栫爜" align="center" prop="dictCode" />
<el-table-column label="瀛楀吀鏍囩" align="center" prop="dictLabel">
@@ -157,7 +157,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>
@@ -177,24 +177,24 @@
<script setup name="Data">
import useDictStore from '@/store/modules/dict'
-import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type";
-import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
+import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"
+import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"
-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 dataList = 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 defaultDictType = ref("");
-const typeOptions = ref([]);
-const route = useRoute();
+const dataList = 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 defaultDictType = ref("")
+const typeOptions = ref([])
+const route = useRoute()
// 鏁版嵁鏍囩鍥炴樉鏍峰紡
const listClassOptions = ref([
{ value: "default", label: "榛樿" },
@@ -203,7 +203,7 @@
{ value: "info", label: "淇℃伅" },
{ value: "warning", label: "璀﹀憡" },
{ value: "danger", label: "鍗遍櫓" }
-]);
+])
const data = reactive({
form: {},
@@ -219,39 +219,42 @@
dictValue: [{ required: true, message: "鏁版嵁閿�间笉鑳戒负绌�", trigger: "blur" }],
dictSort: [{ required: true, message: "鏁版嵁椤哄簭涓嶈兘涓虹┖", trigger: "blur" }]
}
-});
+})
-const { queryParams, form, rules } = toRefs(data);
+const { queryParams, form, rules } = toRefs(data)
/** 鏌ヨ瀛楀吀绫诲瀷璇︾粏 */
function getTypes(dictId) {
getType(dictId).then(response => {
- queryParams.value.dictType = response.data.dictType;
- defaultDictType.value = response.data.dictType;
- getList();
- });
+ queryParams.value.dictType = response.data.dictType
+ defaultDictType.value = response.data.dictType
+ getList()
+ })
}
/** 鏌ヨ瀛楀吀绫诲瀷鍒楄〃 */
function getTypeList() {
getDictOptionselect().then(response => {
- typeOptions.value = response.data;
- });
+ typeOptions.value = response.data
+ })
}
+
/** 鏌ヨ瀛楀吀鏁版嵁鍒楄〃 */
function getList() {
- loading.value = true;
+ loading.value = true
listData(queryParams.value).then(response => {
- dataList.value = response.rows;
- total.value = response.total;
- loading.value = false;
- });
+ dataList.value = response.rows
+ total.value = response.total
+ loading.value = false
+ })
}
+
/** 鍙栨秷鎸夐挳 */
function cancel() {
- open.value = false;
- reset();
+ open.value = false
+ reset()
}
+
/** 琛ㄥ崟閲嶇疆 */
function reset() {
form.value = {
@@ -263,88 +266,97 @@
dictSort: 0,
status: "0",
remark: undefined
- };
- proxy.resetForm("dataRef");
+ }
+ proxy.resetForm("dataRef")
}
+
/** 鎼滅储鎸夐挳鎿嶄綔 */
function handleQuery() {
- queryParams.value.pageNum = 1;
- getList();
+ queryParams.value.pageNum = 1
+ getList()
}
+
/** 杩斿洖鎸夐挳鎿嶄綔 */
function handleClose() {
- const obj = { path: "/system/dict" };
- proxy.$tab.closeOpenPage(obj);
+ const obj = { path: "/system/dict" }
+ proxy.$tab.closeOpenPage(obj)
}
+
/** 閲嶇疆鎸夐挳鎿嶄綔 */
function resetQuery() {
- proxy.resetForm("queryRef");
- queryParams.value.dictType = defaultDictType.value;
- handleQuery();
+ proxy.resetForm("queryRef")
+ queryParams.value.dictType = defaultDictType.value
+ handleQuery()
}
+
/** 鏂板鎸夐挳鎿嶄綔 */
function handleAdd() {
- reset();
- open.value = true;
- title.value = "娣诲姞瀛楀吀鏁版嵁";
- form.value.dictType = queryParams.value.dictType;
+ reset()
+ open.value = true
+ title.value = "娣诲姞瀛楀吀鏁版嵁"
+ form.value.dictType = queryParams.value.dictType
}
+
/** 澶氶�夋閫変腑鏁版嵁 */
function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.dictCode);
- single.value = selection.length != 1;
- multiple.value = !selection.length;
+ ids.value = selection.map(item => item.dictCode)
+ single.value = selection.length != 1
+ multiple.value = !selection.length
}
+
/** 淇敼鎸夐挳鎿嶄綔 */
function handleUpdate(row) {
- reset();
- const dictCode = row.dictCode || ids.value;
+ reset()
+ const dictCode = row.dictCode || ids.value
getData(dictCode).then(response => {
- form.value = response.data;
- open.value = true;
- title.value = "淇敼瀛楀吀鏁版嵁";
- });
+ form.value = response.data
+ open.value = true
+ title.value = "淇敼瀛楀吀鏁版嵁"
+ })
}
+
/** 鎻愪氦鎸夐挳 */
function submitForm() {
proxy.$refs["dataRef"].validate(valid => {
if (valid) {
if (form.value.dictCode != undefined) {
updateData(form.value).then(response => {
- useDictStore().removeDict(queryParams.value.dictType);
- proxy.$modal.msgSuccess("淇敼鎴愬姛");
- open.value = false;
- getList();
- });
+ useDictStore().removeDict(queryParams.value.dictType)
+ proxy.$modal.msgSuccess("淇敼鎴愬姛")
+ open.value = false
+ getList()
+ })
} else {
addData(form.value).then(response => {
- useDictStore().removeDict(queryParams.value.dictType);
- proxy.$modal.msgSuccess("鏂板鎴愬姛");
- open.value = false;
- getList();
- });
+ useDictStore().removeDict(queryParams.value.dictType)
+ proxy.$modal.msgSuccess("鏂板鎴愬姛")
+ open.value = false
+ getList()
+ })
}
}
- });
+ })
}
+
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
function handleDelete(row) {
- const dictCodes = row.dictCode || ids.value;
+ const dictCodes = row.dictCode || ids.value
proxy.$modal.confirm('鏄惁纭鍒犻櫎瀛楀吀缂栫爜涓�"' + dictCodes + '"鐨勬暟鎹」锛�').then(function() {
- return delData(dictCodes);
+ return delData(dictCodes)
}).then(() => {
- getList();
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- useDictStore().removeDict(queryParams.value.dictType);
- }).catch(() => {});
+ getList()
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+ useDictStore().removeDict(queryParams.value.dictType)
+ }).catch(() => {})
}
+
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
proxy.download("system/dict/data/export", {
...queryParams.value
- }, `dict_data_${new Date().getTime()}.xlsx`);
+ }, `dict_data_${new Date().getTime()}.xlsx`)
}
-getTypes(route.params && route.params.dictId);
-getTypeList();
+getTypes(route.params && route.params.dictId)
+getTypeList()
</script>
--
Gitblit v1.9.3