style: 优化前端 CRUD 相关命名
This commit is contained in:
parent
6d024a90d7
commit
6d81928541
@ -1,8 +1,8 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
import { DeptParam } from '@/api/system/dept';
|
||||
import { MenuParam } from '@/api/system/menu';
|
||||
import { RoleParam } from '@/api/system/role';
|
||||
import { ListParam as DeptParam } from '@/api/system/dept';
|
||||
import { ListParam as MenuParam } from '@/api/system/menu';
|
||||
import { ListParam as RoleParam } from '@/api/system/role';
|
||||
import { TreeNodeData } from '@arco-design/web-vue';
|
||||
import { LabelValueState } from '@/store/modules/dict/types';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/monitor/online/user';
|
||||
|
||||
export interface OnlineUserRecord {
|
||||
export interface DataRecord {
|
||||
token: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
@ -13,19 +13,19 @@ export interface OnlineUserRecord {
|
||||
loginTime: string;
|
||||
}
|
||||
|
||||
export interface OnlineUserParam extends Partial<OnlineUserRecord> {
|
||||
export interface ListParam extends Partial<DataRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface OnlineUserListRes {
|
||||
list: OnlineUserRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listOnlineUser(params: OnlineUserParam) {
|
||||
return axios.get<OnlineUserListRes>(BASE_URL, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(BASE_URL, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
|
@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/dept';
|
||||
|
||||
export interface DeptRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
name: string;
|
||||
parentId?: string;
|
||||
@ -15,18 +15,18 @@ export interface DeptRecord {
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
children?: Array<DeptRecord>;
|
||||
children?: Array<DataRecord>;
|
||||
parentName?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface DeptParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export function listDept(params: DeptParam) {
|
||||
return axios.get<DeptRecord[]>(`${BASE_URL}/tree`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@ -34,18 +34,18 @@ export function listDept(params: DeptParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getDept(id: string) {
|
||||
return axios.get<DeptRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addDept(req: DeptRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
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);
|
||||
}
|
||||
|
||||
export function deleteDept(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/menu';
|
||||
|
||||
export interface MenuRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
title: string;
|
||||
parentId?: string;
|
||||
@ -22,17 +22,17 @@ export interface MenuRecord {
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
children?: Array<MenuRecord>;
|
||||
children?: Array<DataRecord>;
|
||||
parentName?: string;
|
||||
}
|
||||
|
||||
export interface MenuParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export function listMenu(params: MenuParam) {
|
||||
return axios.get<MenuRecord[]>(`${BASE_URL}/tree`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@ -40,18 +40,18 @@ export function listMenu(params: MenuParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMenu(id: string) {
|
||||
return axios.get<MenuRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addMenu(req: MenuRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
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);
|
||||
}
|
||||
|
||||
export function deleteMenu(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/role';
|
||||
|
||||
export interface RoleRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
name: string;
|
||||
code?: string;
|
||||
@ -21,7 +21,7 @@ export interface RoleRecord {
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface RoleParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
page?: number;
|
||||
@ -29,13 +29,13 @@ export interface RoleParam {
|
||||
sort?: Array<string>;
|
||||
}
|
||||
|
||||
export interface RoleListRes {
|
||||
list: RoleRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listRole(params: RoleParam) {
|
||||
return axios.get<RoleListRes>(`${BASE_URL}`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(`${BASE_URL}`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@ -43,18 +43,18 @@ export function listRole(params: RoleParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getRole(id: string) {
|
||||
return axios.get<RoleRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addRole(req: RoleRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
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);
|
||||
}
|
||||
|
||||
export function deleteRole(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/user';
|
||||
|
||||
export interface UserRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
@ -25,7 +25,7 @@ export interface UserRecord {
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface UserParam {
|
||||
export interface ListParam {
|
||||
username?: string;
|
||||
status?: number;
|
||||
createTime?: Array<string>;
|
||||
@ -34,13 +34,13 @@ export interface UserParam {
|
||||
sort?: Array<string>;
|
||||
}
|
||||
|
||||
export interface UserListRes {
|
||||
list: UserRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listUser(params: UserParam) {
|
||||
return axios.get<UserListRes>(`${BASE_URL}`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(`${BASE_URL}`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@ -48,19 +48,19 @@ export function listUser(params: UserParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getUser(id: string) {
|
||||
return axios.get<UserRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addUser(req: UserRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
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);
|
||||
}
|
||||
|
||||
export function deleteUser(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
}}</a-link>
|
||||
</template>
|
||||
<div>
|
||||
<a-empty v-if="list.length === 0">暂无公告</a-empty>
|
||||
<div v-for="(item, idx) in list" :key="idx" class="item">
|
||||
<a-empty v-if="dataList.length === 0">暂无公告</a-empty>
|
||||
<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-else-if="item.type === 2" color="cyan">消息</a-tag>
|
||||
<a-tag v-else color="blue">通知</a-tag>
|
||||
@ -42,7 +42,7 @@
|
||||
</template>
|
||||
<a-typography :style="{ marginTop: '-40px', textAlign: 'center' }">
|
||||
<a-typography-title>
|
||||
{{ detail.title }}
|
||||
{{ dataDetail.title }}
|
||||
</a-typography-title>
|
||||
<a-typography-paragraph>
|
||||
<div class="meta-data">
|
||||
@ -50,16 +50,16 @@
|
||||
<span>
|
||||
<icon-user class="icon" />
|
||||
<span class="label">发布人:</span>
|
||||
<span>{{ detail.createUserString }}</span>
|
||||
<span>{{ dataDetail.createUserString }}</span>
|
||||
</span>
|
||||
<a-divider direction="vertical" />
|
||||
<span>
|
||||
<svg-icon icon-class="clock-circle" class="icon" />
|
||||
<span class="label">发布时间:</span>
|
||||
<span>{{
|
||||
detail.effectiveTime
|
||||
? detail.effectiveTime
|
||||
: detail.createTime
|
||||
dataDetail.effectiveTime
|
||||
? dataDetail.effectiveTime
|
||||
: dataDetail.createTime
|
||||
}}</span>
|
||||
</span>
|
||||
</a-space>
|
||||
@ -67,13 +67,13 @@
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
<a-divider />
|
||||
<v-md-preview :text="detail.content"></v-md-preview>
|
||||
<v-md-preview :text="dataDetail.content"></v-md-preview>
|
||||
<a-divider />
|
||||
<div v-if="detail.updateTime" class="update-time-row">
|
||||
<div v-if="dataDetail.updateTime" class="update-time-row">
|
||||
<span>
|
||||
<icon-schedule class="icon" />
|
||||
<span>最后更新于:</span>
|
||||
<span>{{ detail.updateTime }}</span>
|
||||
<span>{{ dataDetail.updateTime }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</a-spin>
|
||||
@ -89,8 +89,8 @@
|
||||
} from '@/api/dashboard';
|
||||
import { DataRecord, get } from '@/api/system/announcement';
|
||||
|
||||
const list = ref<AnnouncementDashboardRecord[]>([]);
|
||||
const detail = ref<DataRecord>({});
|
||||
const dataList = ref<AnnouncementDashboardRecord[]>([]);
|
||||
const dataDetail = ref<DataRecord>({});
|
||||
const detailLoading = ref(false);
|
||||
const detailVisible = ref(false);
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
*/
|
||||
const getList = () => {
|
||||
listAnnouncement().then((res) => {
|
||||
list.value = res.data;
|
||||
dataList.value = res.data;
|
||||
});
|
||||
};
|
||||
getList();
|
||||
@ -115,7 +115,7 @@
|
||||
detailVisible.value = true;
|
||||
get(id)
|
||||
.then((res) => {
|
||||
detail.value = res.data;
|
||||
dataDetail.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false;
|
||||
@ -127,7 +127,7 @@
|
||||
*/
|
||||
const handleDetailCancel = () => {
|
||||
detailVisible.value = false;
|
||||
detail.value = {};
|
||||
dataDetail.value = {};
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="token"
|
||||
:data="onlineUserList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:pagination="{
|
||||
showTotal: true,
|
||||
@ -103,9 +103,9 @@
|
||||
<script lang="ts" setup>
|
||||
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
|
||||
import {
|
||||
OnlineUserParam,
|
||||
OnlineUserRecord,
|
||||
listOnlineUser,
|
||||
DataRecord,
|
||||
ListParam,
|
||||
list,
|
||||
kickout,
|
||||
} from '@/api/monitor/online';
|
||||
import { getToken } from '@/utils/auth';
|
||||
@ -113,7 +113,7 @@
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
const onlineUserList = ref<OnlineUserRecord[]>([]);
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const total = ref(0);
|
||||
const loading = ref(false);
|
||||
const currentToken = getToken();
|
||||
@ -135,11 +135,11 @@
|
||||
*
|
||||
* @param params 查询参数
|
||||
*/
|
||||
const getList = (params: OnlineUserParam = { ...queryParams.value }) => {
|
||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||
loading.value = true;
|
||||
listOnlineUser(params)
|
||||
list(params)
|
||||
.then((res) => {
|
||||
onlineUserList.value = res.data.list;
|
||||
dataList.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -303,7 +303,7 @@
|
||||
</template>
|
||||
<a-typography :style="{ marginTop: '-40px', textAlign: 'center' }">
|
||||
<a-typography-title>
|
||||
{{ detail.title }}
|
||||
{{ dataDetail.title }}
|
||||
</a-typography-title>
|
||||
<a-typography-paragraph>
|
||||
<div class="meta-data">
|
||||
@ -311,26 +311,26 @@
|
||||
<span>
|
||||
<icon-user class="icon" />
|
||||
<span class="label">发布人:</span>
|
||||
<span>{{ detail.createUserString }}</span>
|
||||
<span>{{ dataDetail.createUserString }}</span>
|
||||
</span>
|
||||
<a-divider direction="vertical" />
|
||||
<span>
|
||||
<svg-icon icon-class="clock-circle" class="icon" />
|
||||
<span class="label">发布时间:</span>
|
||||
<span>{{ detail.effectiveTime ? detail.effectiveTime : detail.createTime }}</span>
|
||||
<span>{{ dataDetail.effectiveTime ? dataDetail.effectiveTime : dataDetail.createTime }}</span>
|
||||
</span>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-typography-paragraph>
|
||||
</a-typography>
|
||||
<a-divider />
|
||||
<v-md-preview :text="detail.content"></v-md-preview>
|
||||
<v-md-preview :text="dataDetail.content"></v-md-preview>
|
||||
<a-divider />
|
||||
<div v-if="detail.updateTime" class="update-time-row">
|
||||
<div v-if="dataDetail.updateTime" class="update-time-row">
|
||||
<span>
|
||||
<icon-schedule class="icon" />
|
||||
<span>最后更新于:</span>
|
||||
<span>{{ detail.updateTime }}</span>
|
||||
<span>{{ dataDetail.updateTime }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</a-spin>
|
||||
@ -356,7 +356,7 @@
|
||||
const { AnnouncementTypeEnum } = proxy.useDict('AnnouncementTypeEnum');
|
||||
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const detail = ref<DataRecord>({
|
||||
const dataDetail = ref<DataRecord>({
|
||||
// TODO 待补充详情字段默认值
|
||||
});
|
||||
const total = ref(0);
|
||||
@ -485,7 +485,7 @@
|
||||
detailVisible.value = true;
|
||||
get(id)
|
||||
.then((res) => {
|
||||
detail.value = res.data;
|
||||
dataDetail.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false;
|
||||
@ -497,7 +497,7 @@
|
||||
*/
|
||||
const handleDetailCancel = () => {
|
||||
detailVisible.value = false;
|
||||
detail.value = {};
|
||||
dataDetail.value = {};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -94,7 +94,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:data="deptList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
@ -241,20 +241,20 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.name }}</span>
|
||||
<span v-else>{{ dataDetail.name }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="上级部门">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.parentName || '无' }}</span>
|
||||
<span v-else>{{ dataDetail.parentName || '无' }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="状态">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<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>
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@ -262,37 +262,37 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.sort }}</span>
|
||||
<span v-else>{{ dataDetail.sort }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="创建人">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.createUserString }}</span>
|
||||
<span v-else>{{ dataDetail.createUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="创建时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.createTime }}</span>
|
||||
<span v-else>{{ dataDetail.createTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改人">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.updateUserString }}</span>
|
||||
<span v-else>{{ dataDetail.updateUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.updateTime }}</span>
|
||||
<span v-else>{{ dataDetail.updateTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="描述">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ dept.description }}</span>
|
||||
<span v-else>{{ dataDetail.description }}</span>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-drawer>
|
||||
@ -304,13 +304,13 @@
|
||||
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
|
||||
import { TreeNodeData, TableData } from '@arco-design/web-vue';
|
||||
import {
|
||||
DeptRecord,
|
||||
DeptParam,
|
||||
listDept,
|
||||
getDept,
|
||||
addDept,
|
||||
updateDept,
|
||||
deleteDept,
|
||||
DataRecord,
|
||||
ListParam,
|
||||
list,
|
||||
get,
|
||||
add,
|
||||
update,
|
||||
del,
|
||||
} from '@/api/system/dept';
|
||||
import { listDeptTree } from '@/api/common';
|
||||
import checkPermission from '@/utils/permission';
|
||||
@ -318,8 +318,8 @@
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
|
||||
|
||||
const deptList = ref<DeptRecord[]>([]);
|
||||
const dept = ref<DeptRecord>({
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const dataDetail = ref<DataRecord>({
|
||||
name: '',
|
||||
sort: 0,
|
||||
description: '',
|
||||
@ -350,7 +350,7 @@
|
||||
sort: ['parentId,asc', 'sort,asc', 'createTime,desc'],
|
||||
},
|
||||
// 表单数据
|
||||
form: {} as DeptRecord,
|
||||
form: {} as DataRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
parentId: [{ required: true, message: '请选择上级部门' }],
|
||||
@ -365,11 +365,11 @@
|
||||
*
|
||||
* @param params 查询参数
|
||||
*/
|
||||
const getList = (params: DeptParam = { ...queryParams.value }) => {
|
||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||
loading.value = true;
|
||||
listDept(params)
|
||||
list(params)
|
||||
.then((res) => {
|
||||
deptList.value = res.data;
|
||||
dataList.value = res.data;
|
||||
setTimeout(() => {
|
||||
proxy.$refs.tableRef.expandAll();
|
||||
}, 0);
|
||||
@ -403,7 +403,7 @@
|
||||
treeData.value = res.data;
|
||||
});
|
||||
|
||||
getDept(id).then((res) => {
|
||||
get(id).then((res) => {
|
||||
form.value = res.data;
|
||||
title.value = '修改部门';
|
||||
visible.value = true;
|
||||
@ -441,13 +441,13 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateDept(form.value, form.value.id).then((res) => {
|
||||
update(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
});
|
||||
} else {
|
||||
addDept(form.value).then((res) => {
|
||||
add(form.value).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@ -466,9 +466,9 @@
|
||||
if (detailLoading.value) return;
|
||||
detailLoading.value = true;
|
||||
detailVisible.value = true;
|
||||
getDept(id)
|
||||
get(id)
|
||||
.then((res) => {
|
||||
dept.value = res.data;
|
||||
dataDetail.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false;
|
||||
@ -507,7 +507,7 @@
|
||||
* @param ids ID 列表
|
||||
*/
|
||||
const handleDelete = (ids: Array<string>) => {
|
||||
deleteDept(ids).then((res) => {
|
||||
del(ids).then((res) => {
|
||||
proxy.$message.success(res.msg);
|
||||
getList();
|
||||
});
|
||||
@ -570,10 +570,10 @@
|
||||
*
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: DeptRecord) => {
|
||||
const handleChangeStatus = (record: DataRecord) => {
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateDept(record, record.id)
|
||||
update(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
|
@ -97,7 +97,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:data="menuList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
@ -343,13 +343,13 @@
|
||||
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
|
||||
import { TreeNodeData, TableData } from '@arco-design/web-vue';
|
||||
import {
|
||||
MenuRecord,
|
||||
MenuParam,
|
||||
listMenu,
|
||||
getMenu,
|
||||
addMenu,
|
||||
updateMenu,
|
||||
deleteMenu,
|
||||
DataRecord,
|
||||
ListParam,
|
||||
list,
|
||||
get,
|
||||
add,
|
||||
update,
|
||||
del,
|
||||
} from '@/api/system/menu';
|
||||
import { listMenuTree } from '@/api/common';
|
||||
import checkPermission from '@/utils/permission';
|
||||
@ -357,7 +357,7 @@
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
|
||||
|
||||
const menuList = ref<MenuRecord[]>([]);
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const ids = ref<Array<string>>([]);
|
||||
const title = ref('');
|
||||
const single = ref(true);
|
||||
@ -378,7 +378,7 @@
|
||||
sort: ['parentId,asc', 'sort,asc', 'createTime,desc'],
|
||||
},
|
||||
// 表单数据
|
||||
form: {} as MenuRecord,
|
||||
form: {} as DataRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
title: [{ required: true, message: '请输入菜单标题' }],
|
||||
@ -396,11 +396,11 @@
|
||||
*
|
||||
* @param params 查询参数
|
||||
*/
|
||||
const getList = (params: MenuParam = { ...queryParams.value }) => {
|
||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||
loading.value = true;
|
||||
listMenu(params)
|
||||
list(params)
|
||||
.then((res) => {
|
||||
menuList.value = res.data;
|
||||
dataList.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
@ -431,7 +431,7 @@
|
||||
treeData.value = res.data;
|
||||
});
|
||||
|
||||
getMenu(id).then((res) => {
|
||||
get(id).then((res) => {
|
||||
form.value = res.data;
|
||||
title.value = '修改菜单';
|
||||
visible.value = true;
|
||||
@ -476,13 +476,13 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateMenu(form.value, form.value.id).then((res) => {
|
||||
update(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
});
|
||||
} else {
|
||||
addMenu(form.value).then((res) => {
|
||||
add(form.value).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@ -518,7 +518,7 @@
|
||||
* @param ids ID 列表
|
||||
*/
|
||||
const handleDelete = (ids: Array<string>) => {
|
||||
deleteMenu(ids).then((res) => {
|
||||
del(ids).then((res) => {
|
||||
proxy.$message.success(res.msg);
|
||||
getList();
|
||||
});
|
||||
@ -589,10 +589,10 @@
|
||||
*
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: MenuRecord) => {
|
||||
const handleChangeStatus = (record: DataRecord) => {
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateMenu(record, record.id)
|
||||
update(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
|
@ -94,7 +94,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:data="roleList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
@ -337,20 +337,20 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.name }}</span>
|
||||
<span v-else>{{ dataDetail.name }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="角色编码">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.code }}</span>
|
||||
<span v-else>{{ dataDetail.code }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="状态">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<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>
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@ -359,12 +359,12 @@
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>
|
||||
<span v-if="role.dataScope === 1">全部数据权限</span>
|
||||
<span v-else-if="role.dataScope === 2"
|
||||
<span v-if="dataDetail.dataScope === 1">全部数据权限</span>
|
||||
<span v-else-if="dataDetail.dataScope === 2"
|
||||
>本部门及以下数据权限</span
|
||||
>
|
||||
<span v-else-if="role.dataScope === 3">本部门数据权限</span>
|
||||
<span v-else-if="role.dataScope === 4">仅本人数据权限</span>
|
||||
<span v-else-if="dataDetail.dataScope === 3">本部门数据权限</span>
|
||||
<span v-else-if="dataDetail.dataScope === 4">仅本人数据权限</span>
|
||||
<span v-else>自定义数据权限</span>
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@ -372,52 +372,52 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.createUserString }}</span>
|
||||
<span v-else>{{ dataDetail.createUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="创建时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.createTime }}</span>
|
||||
<span v-else>{{ dataDetail.createTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改人">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.updateUserString }}</span>
|
||||
<span v-else>{{ dataDetail.updateUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.updateTime }}</span>
|
||||
<span v-else>{{ dataDetail.updateTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="描述">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ role.description }}</span>
|
||||
<span v-else>{{ dataDetail.description }}</span>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
<a-card :loading="menuLoading" title="功能权限" :bordered="false">
|
||||
<a-tree
|
||||
:data="menuOptions"
|
||||
:checked-keys="role.menuIds"
|
||||
:checked-keys="dataDetail.menuIds"
|
||||
:default-expand-all="false"
|
||||
check-strictly
|
||||
checkable
|
||||
/>
|
||||
</a-card>
|
||||
<a-card
|
||||
v-if="role.dataScope === 5"
|
||||
v-if="dataDetail.dataScope === 5"
|
||||
:loading="deptLoading"
|
||||
title="数据权限"
|
||||
:bordered="false"
|
||||
>
|
||||
<a-tree
|
||||
:data="deptOptions"
|
||||
:checked-keys="role.deptIds"
|
||||
:checked-keys="dataDetail.deptIds"
|
||||
default-expand-all
|
||||
check-strictly
|
||||
checkable
|
||||
@ -432,13 +432,13 @@
|
||||
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
|
||||
import { TreeNodeData } from '@arco-design/web-vue';
|
||||
import {
|
||||
RoleRecord,
|
||||
RoleParam,
|
||||
listRole,
|
||||
getRole,
|
||||
addRole,
|
||||
updateRole,
|
||||
deleteRole,
|
||||
DataRecord,
|
||||
ListParam,
|
||||
list,
|
||||
get,
|
||||
add,
|
||||
update,
|
||||
del,
|
||||
} from '@/api/system/role';
|
||||
import { listMenuTree, listDeptTree } from '@/api/common';
|
||||
import checkPermission from '@/utils/permission';
|
||||
@ -449,8 +449,8 @@
|
||||
'DisEnableStatusEnum'
|
||||
);
|
||||
|
||||
const roleList = ref<RoleRecord[]>([]);
|
||||
const role = ref<RoleRecord>({
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const dataDetail = ref<DataRecord>({
|
||||
name: '',
|
||||
code: '',
|
||||
status: 1,
|
||||
@ -495,7 +495,7 @@
|
||||
sort: ['createTime,desc'],
|
||||
},
|
||||
// 表单数据
|
||||
form: {} as RoleRecord,
|
||||
form: {} as DataRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
name: [
|
||||
@ -524,11 +524,11 @@
|
||||
*
|
||||
* @param params 查询参数
|
||||
*/
|
||||
const getList = (params: RoleParam = { ...queryParams.value }) => {
|
||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||
loading.value = true;
|
||||
listRole(params)
|
||||
list(params)
|
||||
.then((res) => {
|
||||
roleList.value = res.data.list;
|
||||
dataList.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
})
|
||||
.finally(() => {
|
||||
@ -559,7 +559,7 @@
|
||||
deptCheckStrictly.value = false;
|
||||
getMenuTree();
|
||||
getDeptTree();
|
||||
getRole(id).then((res) => {
|
||||
get(id).then((res) => {
|
||||
form.value = res.data;
|
||||
title.value = '修改角色';
|
||||
visible.value = true;
|
||||
@ -681,7 +681,7 @@
|
||||
if (form.value.id !== undefined) {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
form.value.deptIds = getDeptAllCheckedKeys();
|
||||
updateRole(form.value, form.value.id).then((res) => {
|
||||
update(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@ -689,7 +689,7 @@
|
||||
} else {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
form.value.deptIds = getDeptAllCheckedKeys();
|
||||
addRole(form.value).then((res) => {
|
||||
add(form.value).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@ -710,9 +710,9 @@
|
||||
getDeptTree();
|
||||
detailLoading.value = true;
|
||||
detailVisible.value = true;
|
||||
getRole(id)
|
||||
get(id)
|
||||
.then((res) => {
|
||||
role.value = res.data;
|
||||
dataDetail.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false;
|
||||
@ -751,7 +751,7 @@
|
||||
* @param ids ID 列表
|
||||
*/
|
||||
const handleDelete = (ids: Array<string>) => {
|
||||
deleteRole(ids).then((res) => {
|
||||
del(ids).then((res) => {
|
||||
proxy.$message.success(res.msg);
|
||||
getList();
|
||||
});
|
||||
@ -786,10 +786,10 @@
|
||||
*
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: RoleRecord) => {
|
||||
const handleChangeStatus = (record: DataRecord) => {
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateRole(record, record.id)
|
||||
update(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
|
@ -4,7 +4,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:data="operationLogList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:pagination="{
|
||||
showTotal: true,
|
||||
@ -66,7 +66,7 @@
|
||||
|
||||
const loginStore = useLoginStore();
|
||||
|
||||
const operationLogList = ref<OperationLogRecord[]>([]);
|
||||
const dataList = ref<OperationLogRecord[]>([]);
|
||||
const total = ref(0);
|
||||
const loading = ref(false);
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
loading.value = true;
|
||||
listOperationLog(params)
|
||||
.then((res) => {
|
||||
operationLogList.value = res.data.list;
|
||||
dataList.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -121,7 +121,7 @@
|
||||
<a-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
:data="userList"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:row-selection="{
|
||||
type: 'checkbox',
|
||||
@ -417,20 +417,20 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.username }}</span>
|
||||
<span v-else>{{ dataDetail.username }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="昵称">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.nickname }}</span>
|
||||
<span v-else>{{ dataDetail.nickname }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="性别">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>
|
||||
<span v-if="user.gender === 1">男</span>
|
||||
<span v-if="dataDetail.gender === 1">男</span>
|
||||
<span v-else>女</span>
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@ -439,7 +439,7 @@
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<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>
|
||||
</span>
|
||||
</a-descriptions-item>
|
||||
@ -447,55 +447,55 @@
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.email || '无' }}</span>
|
||||
<span v-else>{{ dataDetail.email || '无' }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="手机号码">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.phone || '无' }}</span>
|
||||
<span v-else>{{ dataDetail.phone || '无' }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="所属部门">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.deptName }}</span>
|
||||
<span v-else>{{ dataDetail.deptName }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="所属角色">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.roleNames }}</span>
|
||||
<span v-else>{{ dataDetail.roleNames }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="创建人">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.createUserString }}</span>
|
||||
<span v-else>{{ dataDetail.createUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="创建时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.createTime }}</span>
|
||||
<span v-else>{{ dataDetail.createTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改人">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.updateUserString }}</span>
|
||||
<span v-else>{{ dataDetail.updateUserString }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="修改时间">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.updateTime }}</span>
|
||||
<span v-else>{{ dataDetail.updateTime }}</span>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="描述">
|
||||
<a-skeleton v-if="detailLoading" :animation="true">
|
||||
<a-skeleton-line :rows="1" />
|
||||
</a-skeleton>
|
||||
<span v-else>{{ user.description }}</span>
|
||||
<span v-else>{{ dataDetail.description }}</span>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-drawer>
|
||||
@ -507,13 +507,13 @@
|
||||
import { getCurrentInstance, ref, toRefs, reactive, watch } from 'vue';
|
||||
import { TreeNodeData } from '@arco-design/web-vue';
|
||||
import {
|
||||
UserRecord,
|
||||
UserParam,
|
||||
listUser,
|
||||
getUser,
|
||||
addUser,
|
||||
updateUser,
|
||||
deleteUser,
|
||||
DataRecord,
|
||||
ListParam,
|
||||
list,
|
||||
get,
|
||||
add,
|
||||
update,
|
||||
del,
|
||||
resetPassword,
|
||||
updateUserRole,
|
||||
} from '@/api/system/user';
|
||||
@ -525,8 +525,8 @@
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
|
||||
|
||||
const userList = ref<UserRecord[]>([]);
|
||||
const user = ref<UserRecord>({
|
||||
const dataList = ref<DataRecord[]>([]);
|
||||
const dataDetail = ref<DataRecord>({
|
||||
username: '',
|
||||
nickname: '',
|
||||
gender: 1,
|
||||
@ -573,7 +573,7 @@
|
||||
sort: ['createTime,desc'],
|
||||
},
|
||||
// 表单数据
|
||||
form: {} as UserRecord,
|
||||
form: {} as DataRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
username: [{ required: true, message: '请输入用户名' }],
|
||||
@ -607,11 +607,11 @@
|
||||
*
|
||||
* @param params 查询参数
|
||||
*/
|
||||
const getList = (params: UserParam = { ...queryParams.value }) => {
|
||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||
loading.value = true;
|
||||
listUser(params)
|
||||
list(params)
|
||||
.then((res) => {
|
||||
userList.value = res.data.list;
|
||||
dataList.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
})
|
||||
.finally(() => {
|
||||
@ -640,7 +640,7 @@
|
||||
reset();
|
||||
getDeptOptions();
|
||||
getRoleOptions();
|
||||
getUser(id).then((res) => {
|
||||
get(id).then((res) => {
|
||||
form.value = res.data;
|
||||
title.value = '修改用户';
|
||||
visible.value = true;
|
||||
@ -655,7 +655,7 @@
|
||||
const toUpdateRole = (id: string) => {
|
||||
reset();
|
||||
getRoleOptions();
|
||||
getUser(id).then((res) => {
|
||||
get(id).then((res) => {
|
||||
form.value = res.data;
|
||||
userRoleVisible.value = true;
|
||||
});
|
||||
@ -726,13 +726,13 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateUser(form.value, form.value.id).then((res) => {
|
||||
update(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
});
|
||||
} else {
|
||||
addUser(form.value).then((res) => {
|
||||
add(form.value).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@ -768,9 +768,9 @@
|
||||
if (detailLoading.value) return;
|
||||
detailLoading.value = true;
|
||||
detailVisible.value = true;
|
||||
getUser(id)
|
||||
get(id)
|
||||
.then((res) => {
|
||||
user.value = res.data;
|
||||
dataDetail.value = res.data;
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false;
|
||||
@ -809,7 +809,7 @@
|
||||
* @param ids ID 列表
|
||||
*/
|
||||
const handleDelete = (ids: Array<string>) => {
|
||||
deleteUser(ids).then((res) => {
|
||||
del(ids).then((res) => {
|
||||
proxy.$message.success(res.msg);
|
||||
getList();
|
||||
});
|
||||
@ -855,14 +855,14 @@
|
||||
*
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: UserRecord) => {
|
||||
const handleChangeStatus = (record: DataRecord) => {
|
||||
const { id } = record;
|
||||
if (id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
getUser(id)
|
||||
get(id)
|
||||
.then((res) => {
|
||||
res.data.status = record.status;
|
||||
updateUser(res.data, id)
|
||||
update(res.data, id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user