style: 优化前端 CRUD 相关命名

This commit is contained in:
Charles7c 2023-08-23 22:29:04 +08:00
parent 6d024a90d7
commit 6d81928541
14 changed files with 210 additions and 210 deletions

View File

@ -1,8 +1,8 @@
import axios from 'axios'; import axios from 'axios';
import qs from 'query-string'; import qs from 'query-string';
import { DeptParam } from '@/api/system/dept'; import { ListParam as DeptParam } from '@/api/system/dept';
import { MenuParam } from '@/api/system/menu'; import { ListParam as MenuParam } from '@/api/system/menu';
import { RoleParam } from '@/api/system/role'; import { ListParam as RoleParam } from '@/api/system/role';
import { TreeNodeData } from '@arco-design/web-vue'; import { TreeNodeData } from '@arco-design/web-vue';
import { LabelValueState } from '@/store/modules/dict/types'; import { LabelValueState } from '@/store/modules/dict/types';

View File

@ -3,7 +3,7 @@ import qs from 'query-string';
const BASE_URL = '/monitor/online/user'; const BASE_URL = '/monitor/online/user';
export interface OnlineUserRecord { export interface DataRecord {
token: string; token: string;
username: string; username: string;
nickname: string; nickname: string;
@ -13,19 +13,19 @@ export interface OnlineUserRecord {
loginTime: string; loginTime: string;
} }
export interface OnlineUserParam extends Partial<OnlineUserRecord> { export interface ListParam extends Partial<DataRecord> {
page: number; page: number;
size: number; size: number;
sort: Array<string>; sort: Array<string>;
} }
export interface OnlineUserListRes { export interface ListRes {
list: OnlineUserRecord[]; list: DataRecord[];
total: number; total: number;
} }
export function listOnlineUser(params: OnlineUserParam) { export function list(params: ListParam) {
return axios.get<OnlineUserListRes>(BASE_URL, { return axios.get<ListRes>(BASE_URL, {
params, params,
paramsSerializer: (obj) => { paramsSerializer: (obj) => {
return qs.stringify(obj); return qs.stringify(obj);

View File

@ -3,7 +3,7 @@ import qs from 'query-string';
const BASE_URL = '/system/dept'; const BASE_URL = '/system/dept';
export interface DeptRecord { export interface DataRecord {
id?: string; id?: string;
name: string; name: string;
parentId?: string; parentId?: string;
@ -15,18 +15,18 @@ export interface DeptRecord {
createTime?: string; createTime?: string;
updateUserString?: string; updateUserString?: string;
updateTime?: string; updateTime?: string;
children?: Array<DeptRecord>; children?: Array<DataRecord>;
parentName?: string; parentName?: string;
disabled?: boolean; disabled?: boolean;
} }
export interface DeptParam { export interface ListParam {
name?: string; name?: string;
status?: number; status?: number;
} }
export function listDept(params: DeptParam) { export function list(params: ListParam) {
return axios.get<DeptRecord[]>(`${BASE_URL}/tree`, { return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
params, params,
paramsSerializer: (obj) => { paramsSerializer: (obj) => {
return qs.stringify(obj); return qs.stringify(obj);
@ -34,18 +34,18 @@ export function listDept(params: DeptParam) {
}); });
} }
export function getDept(id: string) { export function get(id: string) {
return axios.get<DeptRecord>(`${BASE_URL}/${id}`); return axios.get<DataRecord>(`${BASE_URL}/${id}`);
} }
export function addDept(req: DeptRecord) { export function add(req: DataRecord) {
return axios.post(BASE_URL, req); return axios.post(BASE_URL, req);
} }
export function updateDept(req: DeptRecord, id: string) { export function update(req: DataRecord, id: string) {
return axios.put(`${BASE_URL}/${id}`, req); return axios.put(`${BASE_URL}/${id}`, req);
} }
export function deleteDept(ids: string | Array<string>) { export function del(ids: string | Array<string>) {
return axios.delete(`${BASE_URL}/${ids}`); return axios.delete(`${BASE_URL}/${ids}`);
} }

View File

@ -3,7 +3,7 @@ import qs from 'query-string';
const BASE_URL = '/system/menu'; const BASE_URL = '/system/menu';
export interface MenuRecord { export interface DataRecord {
id?: string; id?: string;
title: string; title: string;
parentId?: string; parentId?: string;
@ -22,17 +22,17 @@ export interface MenuRecord {
createTime?: string; createTime?: string;
updateUserString?: string; updateUserString?: string;
updateTime?: string; updateTime?: string;
children?: Array<MenuRecord>; children?: Array<DataRecord>;
parentName?: string; parentName?: string;
} }
export interface MenuParam { export interface ListParam {
name?: string; name?: string;
status?: number; status?: number;
} }
export function listMenu(params: MenuParam) { export function list(params: ListParam) {
return axios.get<MenuRecord[]>(`${BASE_URL}/tree`, { return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
params, params,
paramsSerializer: (obj) => { paramsSerializer: (obj) => {
return qs.stringify(obj); return qs.stringify(obj);
@ -40,18 +40,18 @@ export function listMenu(params: MenuParam) {
}); });
} }
export function getMenu(id: string) { export function get(id: string) {
return axios.get<MenuRecord>(`${BASE_URL}/${id}`); return axios.get<DataRecord>(`${BASE_URL}/${id}`);
} }
export function addMenu(req: MenuRecord) { export function add(req: DataRecord) {
return axios.post(BASE_URL, req); return axios.post(BASE_URL, req);
} }
export function updateMenu(req: MenuRecord, id: string) { export function update(req: DataRecord, id: string) {
return axios.put(`${BASE_URL}/${id}`, req); return axios.put(`${BASE_URL}/${id}`, req);
} }
export function deleteMenu(ids: string | Array<string>) { export function del(ids: string | Array<string>) {
return axios.delete(`${BASE_URL}/${ids}`); return axios.delete(`${BASE_URL}/${ids}`);
} }

View File

@ -3,7 +3,7 @@ import qs from 'query-string';
const BASE_URL = '/system/role'; const BASE_URL = '/system/role';
export interface RoleRecord { export interface DataRecord {
id?: string; id?: string;
name: string; name: string;
code?: string; code?: string;
@ -21,7 +21,7 @@ export interface RoleRecord {
disabled?: boolean; disabled?: boolean;
} }
export interface RoleParam { export interface ListParam {
name?: string; name?: string;
status?: number; status?: number;
page?: number; page?: number;
@ -29,13 +29,13 @@ export interface RoleParam {
sort?: Array<string>; sort?: Array<string>;
} }
export interface RoleListRes { export interface ListRes {
list: RoleRecord[]; list: DataRecord[];
total: number; total: number;
} }
export function listRole(params: RoleParam) { export function list(params: ListParam) {
return axios.get<RoleListRes>(`${BASE_URL}`, { return axios.get<ListRes>(`${BASE_URL}`, {
params, params,
paramsSerializer: (obj) => { paramsSerializer: (obj) => {
return qs.stringify(obj); return qs.stringify(obj);
@ -43,18 +43,18 @@ export function listRole(params: RoleParam) {
}); });
} }
export function getRole(id: string) { export function get(id: string) {
return axios.get<RoleRecord>(`${BASE_URL}/${id}`); return axios.get<DataRecord>(`${BASE_URL}/${id}`);
} }
export function addRole(req: RoleRecord) { export function add(req: DataRecord) {
return axios.post(BASE_URL, req); return axios.post(BASE_URL, req);
} }
export function updateRole(req: RoleRecord, id: string) { export function update(req: DataRecord, id: string) {
return axios.put(`${BASE_URL}/${id}`, req); return axios.put(`${BASE_URL}/${id}`, req);
} }
export function deleteRole(ids: string | Array<string>) { export function del(ids: string | Array<string>) {
return axios.delete(`${BASE_URL}/${ids}`); return axios.delete(`${BASE_URL}/${ids}`);
} }

View File

@ -3,7 +3,7 @@ import qs from 'query-string';
const BASE_URL = '/system/user'; const BASE_URL = '/system/user';
export interface UserRecord { export interface DataRecord {
id?: string; id?: string;
username: string; username: string;
nickname: string; nickname: string;
@ -25,7 +25,7 @@ export interface UserRecord {
disabled?: boolean; disabled?: boolean;
} }
export interface UserParam { export interface ListParam {
username?: string; username?: string;
status?: number; status?: number;
createTime?: Array<string>; createTime?: Array<string>;
@ -34,13 +34,13 @@ export interface UserParam {
sort?: Array<string>; sort?: Array<string>;
} }
export interface UserListRes { export interface ListRes {
list: UserRecord[]; list: DataRecord[];
total: number; total: number;
} }
export function listUser(params: UserParam) { export function list(params: ListParam) {
return axios.get<UserListRes>(`${BASE_URL}`, { return axios.get<ListRes>(`${BASE_URL}`, {
params, params,
paramsSerializer: (obj) => { paramsSerializer: (obj) => {
return qs.stringify(obj); return qs.stringify(obj);
@ -48,19 +48,19 @@ export function listUser(params: UserParam) {
}); });
} }
export function getUser(id: string) { export function get(id: string) {
return axios.get<UserRecord>(`${BASE_URL}/${id}`); return axios.get<DataRecord>(`${BASE_URL}/${id}`);
} }
export function addUser(req: UserRecord) { export function add(req: DataRecord) {
return axios.post(BASE_URL, req); return axios.post(BASE_URL, req);
} }
export function updateUser(req: UserRecord, id: string) { export function update(req: DataRecord, id: string) {
return axios.put(`${BASE_URL}/${id}`, req); return axios.put(`${BASE_URL}/${id}`, req);
} }
export function deleteUser(ids: string | Array<string>) { export function del(ids: string | Array<string>) {
return axios.delete(`${BASE_URL}/${ids}`); return axios.delete(`${BASE_URL}/${ids}`);
} }

View File

@ -11,8 +11,8 @@
}}</a-link> }}</a-link>
</template> </template>
<div> <div>
<a-empty v-if="list.length === 0">暂无公告</a-empty> <a-empty v-if="dataList.length === 0">暂无公告</a-empty>
<div v-for="(item, idx) in list" :key="idx" class="item"> <div v-for="(item, idx) in dataList" :key="idx" class="item">
<a-tag v-if="item.type === 1" color="orangered">活动</a-tag> <a-tag v-if="item.type === 1" color="orangered">活动</a-tag>
<a-tag v-else-if="item.type === 2" color="cyan">消息</a-tag> <a-tag v-else-if="item.type === 2" color="cyan">消息</a-tag>
<a-tag v-else color="blue">通知</a-tag> <a-tag v-else color="blue">通知</a-tag>
@ -42,7 +42,7 @@
</template> </template>
<a-typography :style="{ marginTop: '-40px', textAlign: 'center' }"> <a-typography :style="{ marginTop: '-40px', textAlign: 'center' }">
<a-typography-title> <a-typography-title>
{{ detail.title }} {{ dataDetail.title }}
</a-typography-title> </a-typography-title>
<a-typography-paragraph> <a-typography-paragraph>
<div class="meta-data"> <div class="meta-data">
@ -50,16 +50,16 @@
<span> <span>
<icon-user class="icon" /> <icon-user class="icon" />
<span class="label">发布人</span> <span class="label">发布人</span>
<span>{{ detail.createUserString }}</span> <span>{{ dataDetail.createUserString }}</span>
</span> </span>
<a-divider direction="vertical" /> <a-divider direction="vertical" />
<span> <span>
<svg-icon icon-class="clock-circle" class="icon" /> <svg-icon icon-class="clock-circle" class="icon" />
<span class="label">发布时间</span> <span class="label">发布时间</span>
<span>{{ <span>{{
detail.effectiveTime dataDetail.effectiveTime
? detail.effectiveTime ? dataDetail.effectiveTime
: detail.createTime : dataDetail.createTime
}}</span> }}</span>
</span> </span>
</a-space> </a-space>
@ -67,13 +67,13 @@
</a-typography-paragraph> </a-typography-paragraph>
</a-typography> </a-typography>
<a-divider /> <a-divider />
<v-md-preview :text="detail.content"></v-md-preview> <v-md-preview :text="dataDetail.content"></v-md-preview>
<a-divider /> <a-divider />
<div v-if="detail.updateTime" class="update-time-row"> <div v-if="dataDetail.updateTime" class="update-time-row">
<span> <span>
<icon-schedule class="icon" /> <icon-schedule class="icon" />
<span>最后更新于</span> <span>最后更新于</span>
<span>{{ detail.updateTime }}</span> <span>{{ dataDetail.updateTime }}</span>
</span> </span>
</div> </div>
</a-spin> </a-spin>
@ -89,8 +89,8 @@
} from '@/api/dashboard'; } from '@/api/dashboard';
import { DataRecord, get } from '@/api/system/announcement'; import { DataRecord, get } from '@/api/system/announcement';
const list = ref<AnnouncementDashboardRecord[]>([]); const dataList = ref<AnnouncementDashboardRecord[]>([]);
const detail = ref<DataRecord>({}); const dataDetail = ref<DataRecord>({});
const detailLoading = ref(false); const detailLoading = ref(false);
const detailVisible = ref(false); const detailVisible = ref(false);
@ -99,7 +99,7 @@
*/ */
const getList = () => { const getList = () => {
listAnnouncement().then((res) => { listAnnouncement().then((res) => {
list.value = res.data; dataList.value = res.data;
}); });
}; };
getList(); getList();
@ -115,7 +115,7 @@
detailVisible.value = true; detailVisible.value = true;
get(id) get(id)
.then((res) => { .then((res) => {
detail.value = res.data; dataDetail.value = res.data;
}) })
.finally(() => { .finally(() => {
detailLoading.value = false; detailLoading.value = false;
@ -127,7 +127,7 @@
*/ */
const handleDetailCancel = () => { const handleDetailCancel = () => {
detailVisible.value = false; detailVisible.value = false;
detail.value = {}; dataDetail.value = {};
}; };
</script> </script>

View File

@ -37,7 +37,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="token" row-key="token"
:data="onlineUserList" :data="dataList"
:loading="loading" :loading="loading"
:pagination="{ :pagination="{
showTotal: true, showTotal: true,
@ -103,9 +103,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue'; import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { import {
OnlineUserParam, DataRecord,
OnlineUserRecord, ListParam,
listOnlineUser, list,
kickout, kickout,
} from '@/api/monitor/online'; } from '@/api/monitor/online';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
@ -113,7 +113,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const onlineUserList = ref<OnlineUserRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const total = ref(0); const total = ref(0);
const loading = ref(false); const loading = ref(false);
const currentToken = getToken(); const currentToken = getToken();
@ -135,11 +135,11 @@
* *
* @param params 查询参数 * @param params 查询参数
*/ */
const getList = (params: OnlineUserParam = { ...queryParams.value }) => { const getList = (params: ListParam = { ...queryParams.value }) => {
loading.value = true; loading.value = true;
listOnlineUser(params) list(params)
.then((res) => { .then((res) => {
onlineUserList.value = res.data.list; dataList.value = res.data.list;
total.value = res.data.total; total.value = res.data.total;
}) })
.finally(() => { .finally(() => {

View File

@ -303,7 +303,7 @@
</template> </template>
<a-typography :style="{ marginTop: '-40px', textAlign: 'center' }"> <a-typography :style="{ marginTop: '-40px', textAlign: 'center' }">
<a-typography-title> <a-typography-title>
{{ detail.title }} {{ dataDetail.title }}
</a-typography-title> </a-typography-title>
<a-typography-paragraph> <a-typography-paragraph>
<div class="meta-data"> <div class="meta-data">
@ -311,26 +311,26 @@
<span> <span>
<icon-user class="icon" /> <icon-user class="icon" />
<span class="label">发布人</span> <span class="label">发布人</span>
<span>{{ detail.createUserString }}</span> <span>{{ dataDetail.createUserString }}</span>
</span> </span>
<a-divider direction="vertical" /> <a-divider direction="vertical" />
<span> <span>
<svg-icon icon-class="clock-circle" class="icon" /> <svg-icon icon-class="clock-circle" class="icon" />
<span class="label">发布时间</span> <span class="label">发布时间</span>
<span>{{ detail.effectiveTime ? detail.effectiveTime : detail.createTime }}</span> <span>{{ dataDetail.effectiveTime ? dataDetail.effectiveTime : dataDetail.createTime }}</span>
</span> </span>
</a-space> </a-space>
</div> </div>
</a-typography-paragraph> </a-typography-paragraph>
</a-typography> </a-typography>
<a-divider /> <a-divider />
<v-md-preview :text="detail.content"></v-md-preview> <v-md-preview :text="dataDetail.content"></v-md-preview>
<a-divider /> <a-divider />
<div v-if="detail.updateTime" class="update-time-row"> <div v-if="dataDetail.updateTime" class="update-time-row">
<span> <span>
<icon-schedule class="icon" /> <icon-schedule class="icon" />
<span>最后更新于</span> <span>最后更新于</span>
<span>{{ detail.updateTime }}</span> <span>{{ dataDetail.updateTime }}</span>
</span> </span>
</div> </div>
</a-spin> </a-spin>
@ -356,7 +356,7 @@
const { AnnouncementTypeEnum } = proxy.useDict('AnnouncementTypeEnum'); const { AnnouncementTypeEnum } = proxy.useDict('AnnouncementTypeEnum');
const dataList = ref<DataRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const detail = ref<DataRecord>({ const dataDetail = ref<DataRecord>({
// TODO // TODO
}); });
const total = ref(0); const total = ref(0);
@ -485,7 +485,7 @@
detailVisible.value = true; detailVisible.value = true;
get(id) get(id)
.then((res) => { .then((res) => {
detail.value = res.data; dataDetail.value = res.data;
}) })
.finally(() => { .finally(() => {
detailLoading.value = false; detailLoading.value = false;
@ -497,7 +497,7 @@
*/ */
const handleDetailCancel = () => { const handleDetailCancel = () => {
detailVisible.value = false; detailVisible.value = false;
detail.value = {}; dataDetail.value = {};
}; };
/** /**

View File

@ -94,7 +94,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:data="deptList" :data="dataList"
:loading="loading" :loading="loading"
:row-selection="{ :row-selection="{
type: 'checkbox', type: 'checkbox',
@ -241,20 +241,20 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.name }}</span> <span v-else>{{ dataDetail.name }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="上级部门"> <a-descriptions-item label="上级部门">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.parentName || '' }}</span> <span v-else>{{ dataDetail.parentName || '' }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="状态"> <a-descriptions-item label="状态">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else> <span v-else>
<a-tag v-if="dept.status === 1" color="green">启用</a-tag> <a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag> <a-tag v-else color="red">禁用</a-tag>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -262,37 +262,37 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.sort }}</span> <span v-else>{{ dataDetail.sort }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建人"> <a-descriptions-item label="创建人">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.createUserString }}</span> <span v-else>{{ dataDetail.createUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建时间"> <a-descriptions-item label="创建时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.createTime }}</span> <span v-else>{{ dataDetail.createTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改人"> <a-descriptions-item label="修改人">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.updateUserString }}</span> <span v-else>{{ dataDetail.updateUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改时间"> <a-descriptions-item label="修改时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.updateTime }}</span> <span v-else>{{ dataDetail.updateTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="描述"> <a-descriptions-item label="描述">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ dept.description }}</span> <span v-else>{{ dataDetail.description }}</span>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
</a-drawer> </a-drawer>
@ -304,13 +304,13 @@
import { getCurrentInstance, ref, toRefs, reactive } from 'vue'; import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { TreeNodeData, TableData } from '@arco-design/web-vue'; import { TreeNodeData, TableData } from '@arco-design/web-vue';
import { import {
DeptRecord, DataRecord,
DeptParam, ListParam,
listDept, list,
getDept, get,
addDept, add,
updateDept, update,
deleteDept, del,
} from '@/api/system/dept'; } from '@/api/system/dept';
import { listDeptTree } from '@/api/common'; import { listDeptTree } from '@/api/common';
import checkPermission from '@/utils/permission'; import checkPermission from '@/utils/permission';
@ -318,8 +318,8 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum'); const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const deptList = ref<DeptRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const dept = ref<DeptRecord>({ const dataDetail = ref<DataRecord>({
name: '', name: '',
sort: 0, sort: 0,
description: '', description: '',
@ -350,7 +350,7 @@
sort: ['parentId,asc', 'sort,asc', 'createTime,desc'], sort: ['parentId,asc', 'sort,asc', 'createTime,desc'],
}, },
// //
form: {} as DeptRecord, form: {} as DataRecord,
// //
rules: { rules: {
parentId: [{ required: true, message: '请选择上级部门' }], parentId: [{ required: true, message: '请选择上级部门' }],
@ -365,11 +365,11 @@
* *
* @param params 查询参数 * @param params 查询参数
*/ */
const getList = (params: DeptParam = { ...queryParams.value }) => { const getList = (params: ListParam = { ...queryParams.value }) => {
loading.value = true; loading.value = true;
listDept(params) list(params)
.then((res) => { .then((res) => {
deptList.value = res.data; dataList.value = res.data;
setTimeout(() => { setTimeout(() => {
proxy.$refs.tableRef.expandAll(); proxy.$refs.tableRef.expandAll();
}, 0); }, 0);
@ -403,7 +403,7 @@
treeData.value = res.data; treeData.value = res.data;
}); });
getDept(id).then((res) => { get(id).then((res) => {
form.value = res.data; form.value = res.data;
title.value = '修改部门'; title.value = '修改部门';
visible.value = true; visible.value = true;
@ -441,13 +441,13 @@
proxy.$refs.formRef.validate((valid: any) => { proxy.$refs.formRef.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
updateDept(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}); });
} else { } else {
addDept(form.value).then((res) => { add(form.value).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
@ -466,9 +466,9 @@
if (detailLoading.value) return; if (detailLoading.value) return;
detailLoading.value = true; detailLoading.value = true;
detailVisible.value = true; detailVisible.value = true;
getDept(id) get(id)
.then((res) => { .then((res) => {
dept.value = res.data; dataDetail.value = res.data;
}) })
.finally(() => { .finally(() => {
detailLoading.value = false; detailLoading.value = false;
@ -507,7 +507,7 @@
* @param ids ID 列表 * @param ids ID 列表
*/ */
const handleDelete = (ids: Array<string>) => { const handleDelete = (ids: Array<string>) => {
deleteDept(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
}); });
@ -570,10 +570,10 @@
* *
* @param record 记录信息 * @param record 记录信息
*/ */
const handleChangeStatus = (record: DeptRecord) => { const handleChangeStatus = (record: DataRecord) => {
if (record.id) { if (record.id) {
const tip = record.status === 1 ? '启用' : '禁用'; const tip = record.status === 1 ? '启用' : '禁用';
updateDept(record, record.id) update(record, record.id)
.then(() => { .then(() => {
proxy.$message.success(`${tip}成功`); proxy.$message.success(`${tip}成功`);
}) })

View File

@ -97,7 +97,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:data="menuList" :data="dataList"
:loading="loading" :loading="loading"
:row-selection="{ :row-selection="{
type: 'checkbox', type: 'checkbox',
@ -343,13 +343,13 @@
import { getCurrentInstance, ref, toRefs, reactive } from 'vue'; import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { TreeNodeData, TableData } from '@arco-design/web-vue'; import { TreeNodeData, TableData } from '@arco-design/web-vue';
import { import {
MenuRecord, DataRecord,
MenuParam, ListParam,
listMenu, list,
getMenu, get,
addMenu, add,
updateMenu, update,
deleteMenu, del,
} from '@/api/system/menu'; } from '@/api/system/menu';
import { listMenuTree } from '@/api/common'; import { listMenuTree } from '@/api/common';
import checkPermission from '@/utils/permission'; import checkPermission from '@/utils/permission';
@ -357,7 +357,7 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum'); const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const menuList = ref<MenuRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const ids = ref<Array<string>>([]); const ids = ref<Array<string>>([]);
const title = ref(''); const title = ref('');
const single = ref(true); const single = ref(true);
@ -378,7 +378,7 @@
sort: ['parentId,asc', 'sort,asc', 'createTime,desc'], sort: ['parentId,asc', 'sort,asc', 'createTime,desc'],
}, },
// //
form: {} as MenuRecord, form: {} as DataRecord,
// //
rules: { rules: {
title: [{ required: true, message: '请输入菜单标题' }], title: [{ required: true, message: '请输入菜单标题' }],
@ -396,11 +396,11 @@
* *
* @param params 查询参数 * @param params 查询参数
*/ */
const getList = (params: MenuParam = { ...queryParams.value }) => { const getList = (params: ListParam = { ...queryParams.value }) => {
loading.value = true; loading.value = true;
listMenu(params) list(params)
.then((res) => { .then((res) => {
menuList.value = res.data; dataList.value = res.data;
}) })
.finally(() => { .finally(() => {
loading.value = false; loading.value = false;
@ -431,7 +431,7 @@
treeData.value = res.data; treeData.value = res.data;
}); });
getMenu(id).then((res) => { get(id).then((res) => {
form.value = res.data; form.value = res.data;
title.value = '修改菜单'; title.value = '修改菜单';
visible.value = true; visible.value = true;
@ -476,13 +476,13 @@
proxy.$refs.formRef.validate((valid: any) => { proxy.$refs.formRef.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
updateMenu(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}); });
} else { } else {
addMenu(form.value).then((res) => { add(form.value).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
@ -518,7 +518,7 @@
* @param ids ID 列表 * @param ids ID 列表
*/ */
const handleDelete = (ids: Array<string>) => { const handleDelete = (ids: Array<string>) => {
deleteMenu(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
}); });
@ -589,10 +589,10 @@
* *
* @param record 记录信息 * @param record 记录信息
*/ */
const handleChangeStatus = (record: MenuRecord) => { const handleChangeStatus = (record: DataRecord) => {
if (record.id) { if (record.id) {
const tip = record.status === 1 ? '启用' : '禁用'; const tip = record.status === 1 ? '启用' : '禁用';
updateMenu(record, record.id) update(record, record.id)
.then(() => { .then(() => {
proxy.$message.success(`${tip}成功`); proxy.$message.success(`${tip}成功`);
}) })

View File

@ -94,7 +94,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:data="roleList" :data="dataList"
:loading="loading" :loading="loading"
:row-selection="{ :row-selection="{
type: 'checkbox', type: 'checkbox',
@ -337,20 +337,20 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.name }}</span> <span v-else>{{ dataDetail.name }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="角色编码"> <a-descriptions-item label="角色编码">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.code }}</span> <span v-else>{{ dataDetail.code }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="状态"> <a-descriptions-item label="状态">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else> <span v-else>
<a-tag v-if="role.status === 1" color="green">启用</a-tag> <a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag> <a-tag v-else color="red">禁用</a-tag>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -359,12 +359,12 @@
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else> <span v-else>
<span v-if="role.dataScope === 1">全部数据权限</span> <span v-if="dataDetail.dataScope === 1">全部数据权限</span>
<span v-else-if="role.dataScope === 2" <span v-else-if="dataDetail.dataScope === 2"
>本部门及以下数据权限</span >本部门及以下数据权限</span
> >
<span v-else-if="role.dataScope === 3">本部门数据权限</span> <span v-else-if="dataDetail.dataScope === 3">本部门数据权限</span>
<span v-else-if="role.dataScope === 4">仅本人数据权限</span> <span v-else-if="dataDetail.dataScope === 4">仅本人数据权限</span>
<span v-else>自定义数据权限</span> <span v-else>自定义数据权限</span>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -372,52 +372,52 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.createUserString }}</span> <span v-else>{{ dataDetail.createUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建时间"> <a-descriptions-item label="创建时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.createTime }}</span> <span v-else>{{ dataDetail.createTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改人"> <a-descriptions-item label="修改人">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.updateUserString }}</span> <span v-else>{{ dataDetail.updateUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改时间"> <a-descriptions-item label="修改时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.updateTime }}</span> <span v-else>{{ dataDetail.updateTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="描述"> <a-descriptions-item label="描述">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ role.description }}</span> <span v-else>{{ dataDetail.description }}</span>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
</a-card> </a-card>
<a-card :loading="menuLoading" title="功能权限" :bordered="false"> <a-card :loading="menuLoading" title="功能权限" :bordered="false">
<a-tree <a-tree
:data="menuOptions" :data="menuOptions"
:checked-keys="role.menuIds" :checked-keys="dataDetail.menuIds"
:default-expand-all="false" :default-expand-all="false"
check-strictly check-strictly
checkable checkable
/> />
</a-card> </a-card>
<a-card <a-card
v-if="role.dataScope === 5" v-if="dataDetail.dataScope === 5"
:loading="deptLoading" :loading="deptLoading"
title="数据权限" title="数据权限"
:bordered="false" :bordered="false"
> >
<a-tree <a-tree
:data="deptOptions" :data="deptOptions"
:checked-keys="role.deptIds" :checked-keys="dataDetail.deptIds"
default-expand-all default-expand-all
check-strictly check-strictly
checkable checkable
@ -432,13 +432,13 @@
import { getCurrentInstance, ref, toRefs, reactive } from 'vue'; import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { TreeNodeData } from '@arco-design/web-vue'; import { TreeNodeData } from '@arco-design/web-vue';
import { import {
RoleRecord, DataRecord,
RoleParam, ListParam,
listRole, list,
getRole, get,
addRole, add,
updateRole, update,
deleteRole, del,
} from '@/api/system/role'; } from '@/api/system/role';
import { listMenuTree, listDeptTree } from '@/api/common'; import { listMenuTree, listDeptTree } from '@/api/common';
import checkPermission from '@/utils/permission'; import checkPermission from '@/utils/permission';
@ -449,8 +449,8 @@
'DisEnableStatusEnum' 'DisEnableStatusEnum'
); );
const roleList = ref<RoleRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const role = ref<RoleRecord>({ const dataDetail = ref<DataRecord>({
name: '', name: '',
code: '', code: '',
status: 1, status: 1,
@ -495,7 +495,7 @@
sort: ['createTime,desc'], sort: ['createTime,desc'],
}, },
// //
form: {} as RoleRecord, form: {} as DataRecord,
// //
rules: { rules: {
name: [ name: [
@ -524,11 +524,11 @@
* *
* @param params 查询参数 * @param params 查询参数
*/ */
const getList = (params: RoleParam = { ...queryParams.value }) => { const getList = (params: ListParam = { ...queryParams.value }) => {
loading.value = true; loading.value = true;
listRole(params) list(params)
.then((res) => { .then((res) => {
roleList.value = res.data.list; dataList.value = res.data.list;
total.value = res.data.total; total.value = res.data.total;
}) })
.finally(() => { .finally(() => {
@ -559,7 +559,7 @@
deptCheckStrictly.value = false; deptCheckStrictly.value = false;
getMenuTree(); getMenuTree();
getDeptTree(); getDeptTree();
getRole(id).then((res) => { get(id).then((res) => {
form.value = res.data; form.value = res.data;
title.value = '修改角色'; title.value = '修改角色';
visible.value = true; visible.value = true;
@ -681,7 +681,7 @@
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
form.value.menuIds = getMenuAllCheckedKeys(); form.value.menuIds = getMenuAllCheckedKeys();
form.value.deptIds = getDeptAllCheckedKeys(); form.value.deptIds = getDeptAllCheckedKeys();
updateRole(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
@ -689,7 +689,7 @@
} else { } else {
form.value.menuIds = getMenuAllCheckedKeys(); form.value.menuIds = getMenuAllCheckedKeys();
form.value.deptIds = getDeptAllCheckedKeys(); form.value.deptIds = getDeptAllCheckedKeys();
addRole(form.value).then((res) => { add(form.value).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
@ -710,9 +710,9 @@
getDeptTree(); getDeptTree();
detailLoading.value = true; detailLoading.value = true;
detailVisible.value = true; detailVisible.value = true;
getRole(id) get(id)
.then((res) => { .then((res) => {
role.value = res.data; dataDetail.value = res.data;
}) })
.finally(() => { .finally(() => {
detailLoading.value = false; detailLoading.value = false;
@ -751,7 +751,7 @@
* @param ids ID 列表 * @param ids ID 列表
*/ */
const handleDelete = (ids: Array<string>) => { const handleDelete = (ids: Array<string>) => {
deleteRole(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
}); });
@ -786,10 +786,10 @@
* *
* @param record 记录信息 * @param record 记录信息
*/ */
const handleChangeStatus = (record: RoleRecord) => { const handleChangeStatus = (record: DataRecord) => {
if (record.id) { if (record.id) {
const tip = record.status === 1 ? '启用' : '禁用'; const tip = record.status === 1 ? '启用' : '禁用';
updateRole(record, record.id) update(record, record.id)
.then(() => { .then(() => {
proxy.$message.success(`${tip}成功`); proxy.$message.success(`${tip}成功`);
}) })

View File

@ -4,7 +4,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:data="operationLogList" :data="dataList"
:loading="loading" :loading="loading"
:pagination="{ :pagination="{
showTotal: true, showTotal: true,
@ -66,7 +66,7 @@
const loginStore = useLoginStore(); const loginStore = useLoginStore();
const operationLogList = ref<OperationLogRecord[]>([]); const dataList = ref<OperationLogRecord[]>([]);
const total = ref(0); const total = ref(0);
const loading = ref(false); const loading = ref(false);
@ -90,7 +90,7 @@
loading.value = true; loading.value = true;
listOperationLog(params) listOperationLog(params)
.then((res) => { .then((res) => {
operationLogList.value = res.data.list; dataList.value = res.data.list;
total.value = res.data.total; total.value = res.data.total;
}) })
.finally(() => { .finally(() => {

View File

@ -121,7 +121,7 @@
<a-table <a-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
:data="userList" :data="dataList"
:loading="loading" :loading="loading"
:row-selection="{ :row-selection="{
type: 'checkbox', type: 'checkbox',
@ -417,20 +417,20 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.username }}</span> <span v-else>{{ dataDetail.username }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="昵称"> <a-descriptions-item label="昵称">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.nickname }}</span> <span v-else>{{ dataDetail.nickname }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="性别"> <a-descriptions-item label="性别">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else> <span v-else>
<span v-if="user.gender === 1"></span> <span v-if="dataDetail.gender === 1"></span>
<span v-else></span> <span v-else></span>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -439,7 +439,7 @@
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else> <span v-else>
<a-tag v-if="user.status === 1" color="green">启用</a-tag> <a-tag v-if="dataDetail.status === 1" color="green">启用</a-tag>
<a-tag v-else color="red">禁用</a-tag> <a-tag v-else color="red">禁用</a-tag>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -447,55 +447,55 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.email || '' }}</span> <span v-else>{{ dataDetail.email || '' }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="手机号码"> <a-descriptions-item label="手机号码">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.phone || '' }}</span> <span v-else>{{ dataDetail.phone || '' }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="所属部门"> <a-descriptions-item label="所属部门">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.deptName }}</span> <span v-else>{{ dataDetail.deptName }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="所属角色"> <a-descriptions-item label="所属角色">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.roleNames }}</span> <span v-else>{{ dataDetail.roleNames }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建人"> <a-descriptions-item label="创建人">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.createUserString }}</span> <span v-else>{{ dataDetail.createUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建时间"> <a-descriptions-item label="创建时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.createTime }}</span> <span v-else>{{ dataDetail.createTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改人"> <a-descriptions-item label="修改人">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.updateUserString }}</span> <span v-else>{{ dataDetail.updateUserString }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="修改时间"> <a-descriptions-item label="修改时间">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.updateTime }}</span> <span v-else>{{ dataDetail.updateTime }}</span>
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="描述"> <a-descriptions-item label="描述">
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else>{{ user.description }}</span> <span v-else>{{ dataDetail.description }}</span>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
</a-drawer> </a-drawer>
@ -507,13 +507,13 @@
import { getCurrentInstance, ref, toRefs, reactive, watch } from 'vue'; import { getCurrentInstance, ref, toRefs, reactive, watch } from 'vue';
import { TreeNodeData } from '@arco-design/web-vue'; import { TreeNodeData } from '@arco-design/web-vue';
import { import {
UserRecord, DataRecord,
UserParam, ListParam,
listUser, list,
getUser, get,
addUser, add,
updateUser, update,
deleteUser, del,
resetPassword, resetPassword,
updateUserRole, updateUserRole,
} from '@/api/system/user'; } from '@/api/system/user';
@ -525,8 +525,8 @@
const { proxy } = getCurrentInstance() as any; const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum'); const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const userList = ref<UserRecord[]>([]); const dataList = ref<DataRecord[]>([]);
const user = ref<UserRecord>({ const dataDetail = ref<DataRecord>({
username: '', username: '',
nickname: '', nickname: '',
gender: 1, gender: 1,
@ -573,7 +573,7 @@
sort: ['createTime,desc'], sort: ['createTime,desc'],
}, },
// //
form: {} as UserRecord, form: {} as DataRecord,
// //
rules: { rules: {
username: [{ required: true, message: '请输入用户名' }], username: [{ required: true, message: '请输入用户名' }],
@ -607,11 +607,11 @@
* *
* @param params 查询参数 * @param params 查询参数
*/ */
const getList = (params: UserParam = { ...queryParams.value }) => { const getList = (params: ListParam = { ...queryParams.value }) => {
loading.value = true; loading.value = true;
listUser(params) list(params)
.then((res) => { .then((res) => {
userList.value = res.data.list; dataList.value = res.data.list;
total.value = res.data.total; total.value = res.data.total;
}) })
.finally(() => { .finally(() => {
@ -640,7 +640,7 @@
reset(); reset();
getDeptOptions(); getDeptOptions();
getRoleOptions(); getRoleOptions();
getUser(id).then((res) => { get(id).then((res) => {
form.value = res.data; form.value = res.data;
title.value = '修改用户'; title.value = '修改用户';
visible.value = true; visible.value = true;
@ -655,7 +655,7 @@
const toUpdateRole = (id: string) => { const toUpdateRole = (id: string) => {
reset(); reset();
getRoleOptions(); getRoleOptions();
getUser(id).then((res) => { get(id).then((res) => {
form.value = res.data; form.value = res.data;
userRoleVisible.value = true; userRoleVisible.value = true;
}); });
@ -726,13 +726,13 @@
proxy.$refs.formRef.validate((valid: any) => { proxy.$refs.formRef.validate((valid: any) => {
if (!valid) { if (!valid) {
if (form.value.id !== undefined) { if (form.value.id !== undefined) {
updateUser(form.value, form.value.id).then((res) => { update(form.value, form.value.id).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}); });
} else { } else {
addUser(form.value).then((res) => { add(form.value).then((res) => {
handleCancel(); handleCancel();
getList(); getList();
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
@ -768,9 +768,9 @@
if (detailLoading.value) return; if (detailLoading.value) return;
detailLoading.value = true; detailLoading.value = true;
detailVisible.value = true; detailVisible.value = true;
getUser(id) get(id)
.then((res) => { .then((res) => {
user.value = res.data; dataDetail.value = res.data;
}) })
.finally(() => { .finally(() => {
detailLoading.value = false; detailLoading.value = false;
@ -809,7 +809,7 @@
* @param ids ID 列表 * @param ids ID 列表
*/ */
const handleDelete = (ids: Array<string>) => { const handleDelete = (ids: Array<string>) => {
deleteUser(ids).then((res) => { del(ids).then((res) => {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
getList(); getList();
}); });
@ -855,14 +855,14 @@
* *
* @param record 记录信息 * @param record 记录信息
*/ */
const handleChangeStatus = (record: UserRecord) => { const handleChangeStatus = (record: DataRecord) => {
const { id } = record; const { id } = record;
if (id) { if (id) {
const tip = record.status === 1 ? '启用' : '禁用'; const tip = record.status === 1 ? '启用' : '禁用';
getUser(id) get(id)
.then((res) => { .then((res) => {
res.data.status = record.status; res.data.status = record.status;
updateUser(res.data, id) update(res.data, id)
.then(() => { .then(() => {
proxy.$message.success(`${tip}成功`); proxy.$message.success(`${tip}成功`);
}) })