refactor: 优化部分前端代码

1.前端部分 id 类型调整为 number(去除 Jackson 针对 Long 等类型的全局转换后,需要调整下前端部分 id 的类)
2.前端部分表格列去除 data-index(部分表格列,使用了 slot,则无需再使用 data-index 属性)
3.部分字典状态遗漏更改
This commit is contained in:
2023-09-17 20:38:56 +08:00
parent 1f73aa732d
commit 2755bc8479
19 changed files with 84 additions and 104 deletions

View File

@@ -110,7 +110,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
if (detailLoading.value) return;
detailLoading.value = true;
detailVisible.value = true;

View File

@@ -21,7 +21,7 @@
{{ rowIndex + 1 }}
</template>
</a-table-column>
<a-table-column title="模块" data-index="module">
<a-table-column title="模块">
<template #cell="{ record }">
<a-typography-paragraph
:ellipsis="{
@@ -35,7 +35,6 @@
<a-table-column title="总浏览量" data-index="pvCount" />
<a-table-column
title="日涨幅"
data-index="newPvFromYesterday"
:sortable="{
sortDirections: ['ascend', 'descend'],
}"

View File

@@ -14,10 +14,7 @@
:title="$t('basicProfile.column.updateContent')"
data-index="updateContent"
/>
<a-table-column
:title="$t('basicProfile.column.status')"
data-index="status"
>
<a-table-column :title="$t('basicProfile.column.status')">
<template #cell="{ record }">
<p v-if="record.status === 0">
<span class="circle"></span>

View File

@@ -343,7 +343,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
visible.value = true;
loading.value = true;
getSystemLog(id)

View File

@@ -363,7 +363,7 @@
// TODO 待补充详情字段默认值
});
const total = ref(0);
const ids = ref<Array<string>>([]);
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
const multiple = ref(true);
@@ -427,7 +427,7 @@
*
* @param id ID
*/
const toUpdate = (id: string) => {
const toUpdate = (id: number) => {
reset();
get(id).then((res) => {
form.value = res.data;
@@ -482,7 +482,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
if (detailLoading.value) return;
detailLoading.value = true;
detailVisible.value = true;
@@ -527,7 +527,7 @@
*
* @param ids ID 列表
*/
const handleDelete = (ids: Array<string>) => {
const handleDelete = (ids: Array<number>) => {
del(ids).then((res) => {
proxy.$message.success(res.msg);
getList();

View File

@@ -254,8 +254,10 @@
<a-skeleton-line :rows="1" />
</a-skeleton>
<span v-else>
<a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag>
<dict-tag
:value="dataDetail.status"
:dict="dis_enable_status_enum"
/>
</span>
</a-descriptions-item>
<a-descriptions-item label="部门排序">
@@ -330,7 +332,7 @@
updateTime: '',
parentName: '',
});
const ids = ref<Array<string>>([]);
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
const multiple = ref(true);
@@ -397,7 +399,7 @@
*
* @param id ID
*/
const toUpdate = (id: string) => {
const toUpdate = (id: number) => {
reset();
listDeptTree({}).then((res) => {
treeData.value = res.data;
@@ -462,7 +464,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
if (detailLoading.value) return;
detailLoading.value = true;
detailVisible.value = true;
@@ -506,7 +508,7 @@
*
* @param ids ID 列表
*/
const handleDelete = (ids: Array<string>) => {
const handleDelete = (ids: Array<number>) => {
del(ids).then((res) => {
proxy.$message.success(res.msg);
getList();

View File

@@ -358,7 +358,7 @@
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const dataList = ref<DataRecord[]>([]);
const ids = ref<Array<string>>([]);
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
const multiple = ref(true);
@@ -425,7 +425,7 @@
*
* @param id ID
*/
const toUpdate = (id: string) => {
const toUpdate = (id: number) => {
reset();
listMenuTree({}).then((res) => {
treeData.value = res.data;
@@ -517,7 +517,7 @@
*
* @param ids ID 列表
*/
const handleDelete = (ids: Array<string>) => {
const handleDelete = (ids: Array<number>) => {
del(ids).then((res) => {
proxy.$message.success(res.msg);
getList();

View File

@@ -117,7 +117,7 @@
>
<template #columns>
<a-table-column title="ID" data-index="id" />
<a-table-column title="角色名称" data-index="name" :width="130">
<a-table-column title="角色名称" :width="130">
<template #cell="{ record }">
<a-link @click="toDetail(record.id)">{{ record.name }}</a-link>
</template>
@@ -129,7 +129,7 @@
</template>
</a-table-column>
<a-table-column title="角色排序" align="center" data-index="sort" />
<a-table-column title="状态" align="center" data-index="status">
<a-table-column title="状态" align="center">
<template #cell="{ record }">
<a-switch
v-model="record.status"
@@ -344,8 +344,10 @@
<a-skeleton-line :rows="1" />
</a-skeleton>
<span v-else>
<a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag>
<dict-tag
:value="dataDetail.status"
:dict="dis_enable_status_enum"
/>
</span>
</a-descriptions-item>
<a-descriptions-item label="数据权限">
@@ -455,7 +457,7 @@
deptIds: undefined,
});
const total = ref(0);
const ids = ref<Array<string>>([]);
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
const multiple = ref(true);
@@ -544,7 +546,7 @@
*
* @param id ID
*/
const toUpdate = (id: string) => {
const toUpdate = (id: number) => {
reset();
menuCheckStrictly.value = false;
deptCheckStrictly.value = false;
@@ -695,7 +697,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
if (detailLoading.value) return;
getMenuTree();
getDeptTree();
@@ -741,7 +743,7 @@
*
* @param ids ID 列表
*/
const handleDelete = (ids: Array<string>) => {
const handleDelete = (ids: Array<number>) => {
del(ids).then((res) => {
proxy.$message.success(res.msg);
getList();

View File

@@ -439,8 +439,10 @@
<a-skeleton-line :rows="1" />
</a-skeleton>
<span v-else>
<a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag>
<dict-tag
:value="dataDetail.status"
:dict="dis_enable_status_enum"
/>
</span>
</a-descriptions-item>
<a-descriptions-item label="邮箱">
@@ -543,7 +545,7 @@
deptId: undefined,
});
const total = ref(0);
const ids = ref<Array<string>>([]);
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
const multiple = ref(true);
@@ -636,7 +638,7 @@
*
* @param id ID
*/
const toUpdate = (id: string) => {
const toUpdate = (id: number) => {
reset();
getDeptOptions();
getRoleOptions();
@@ -652,7 +654,7 @@
*
* @param id ID
*/
const toUpdateRole = (id: string) => {
const toUpdateRole = (id: number) => {
reset();
getRoleOptions();
get(id).then((res) => {
@@ -703,7 +705,7 @@
description: '',
status: 1,
deptId: undefined,
roleIds: [] as Array<string>,
roleIds: [] as Array<number>,
disabled: false,
};
proxy.$refs.formRef?.resetFields();
@@ -764,7 +766,7 @@
*
* @param id ID
*/
const toDetail = async (id: string) => {
const toDetail = async (id: number) => {
if (detailLoading.value) return;
detailLoading.value = true;
detailVisible.value = true;
@@ -808,7 +810,7 @@
*
* @param ids ID 列表
*/
const handleDelete = (ids: Array<string>) => {
const handleDelete = (ids: Array<number>) => {
del(ids).then((res) => {
proxy.$message.success(res.msg);
getList();
@@ -820,7 +822,7 @@
*
* @param id ID
*/
const handleResetPassword = (id: string) => {
const handleResetPassword = (id: number) => {
resetPassword(id).then((res) => {
proxy.$message.success(res.msg);
});

View File

@@ -152,37 +152,22 @@
ellipsis
tooltip
/>
<a-table-column title="描述" data-index="comment" :width="170">
<a-table-column title="描述" :width="170">
<template #cell="{ record }">
<a-input v-model="record.comment" />
</template>
</a-table-column>
<a-table-column
title="列表"
data-index="showInList"
:width="60"
align="center"
>
<a-table-column title="列表" :width="60" align="center">
<template #cell="{ record }">
<a-checkbox v-model="record.showInList" value="true" />
</template>
</a-table-column>
<a-table-column
title="表单"
data-index="showInForm"
:width="60"
align="center"
>
<a-table-column title="表单" :width="60" align="center">
<template #cell="{ record }">
<a-checkbox v-model="record.showInForm" value="true" />
</template>
</a-table-column>
<a-table-column
title="必填"
data-index="isRequired"
:width="60"
align="center"
>
<a-table-column title="必填" :width="60" align="center">
<template #cell="{ record }">
<a-checkbox
v-if="record.showInForm"
@@ -192,21 +177,12 @@
<a-checkbox v-else disabled />
</template>
</a-table-column>
<a-table-column
title="查询"
data-index="showInQuery"
:width="60"
align="center"
>
<a-table-column title="查询" :width="60" align="center">
<template #cell="{ record }">
<a-checkbox v-model="record.showInQuery" value="true" />
</template>
</a-table-column>
<a-table-column
title="表单类型"
data-index="formType"
:width="150"
>
<a-table-column title="表单类型" :width="150">
<template #cell="{ record }">
<a-select
v-if="record.showInForm || record.showInQuery"
@@ -217,7 +193,7 @@
<span v-else>无需设置</span>
</template>
</a-table-column>
<a-table-column title="查询方式" data-index="queryType">
<a-table-column title="查询方式">
<template #cell="{ record }">
<a-select
v-if="record.showInQuery"