feat: 合并Gin_Vue

This commit is contained in:
TsMask
2023-10-16 17:12:24 +08:00
parent 771320a839
commit 743568861d
77 changed files with 734 additions and 1870 deletions

View File

@@ -91,22 +91,22 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: '用户编号',
dataIndex: 'id',
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'accountId',
dataIndex: 'userName',
align: 'center',
},
{
title: '用户',
dataIndex: 'name',
title: '用户昵称',
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
dataIndex: 'phone',
dataIndex: 'phonenumber',
align: 'center',
},
{
@@ -125,13 +125,13 @@ let tableColumns: ColumnsType = [
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value);
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
{
title: '操作',
key: 'id',
key: 'userId',
align: 'center',
},
];
@@ -170,7 +170,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -209,23 +209,25 @@ function fnModalOk(userIds: string[] | number[]) {
message.error(`请选择要分配的用户`, 2);
return;
}
const hide = message.loading('请稍等...', 0);
const key = 'authUserChecked';
message.loading({ content: '请稍等...', key });
authUserChecked({
checked: true,
userIds: userIds.join(','),
roleId: roleId,
}).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
modalState.visibleBySelectUser = false;
message.success({
content: `授权用户添加成功`,
key,
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
@@ -244,19 +246,21 @@ function fnRecordDelete(userId: string | number) {
title: '提示',
content: `确认取消用户编号为 【${userId}】 的数据项授权?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'authUserChecked';
message.loading({ content: '请稍等...', key });
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then(
res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `取消授权成功`,
key,
duration: 3,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 3,
});
}
@@ -334,7 +338,7 @@ onMounted(() => {
></a-input>
</a-form-item>
</a-col>
<!-- <a-col :lg="6" :md="12" :xs="24">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
@@ -343,7 +347,7 @@ onMounted(() => {
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col> -->
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
@@ -429,9 +433,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -453,7 +457,7 @@ onMounted(() => {
<!-- 表格列表 -->
<a-table
class="table"
row-key="id"
row-key="userId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -471,13 +475,13 @@ onMounted(() => {
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysNormalDisable" :value="record.status" />
</template>
<template v-if="column.key === 'id'">
<template v-if="column.key === 'userId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>取消授权</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.id)"
@click.prevent="fnRecordDelete(record.userId)"
v-perms:has="['system:role:remove']"
>
<template #icon><UserDeleteOutlined /></template>

View File

@@ -88,14 +88,24 @@ let tableState: TabeStateType = reactive({
let tableColumns: ColumnsType = [
{
title: '用户编号',
dataIndex: 'id',
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
dataIndex: 'accountId',
dataIndex: 'userName',
align: 'center',
},
},
{
title: '用户昵称',
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
dataIndex: 'phonenumber',
align: 'center',
},
{
title: '用户状态',
dataIndex: 'status',
@@ -107,8 +117,8 @@ let tableColumns: ColumnsType = [
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
if (!opt.value) return '';
return parseDateToStr(opt.value);
if (+opt.value <= 0) return '';
return parseDateToStr(+opt.value);
},
},
];
@@ -224,7 +234,7 @@ watch(
></a-input>
</a-form-item>
</a-col>
<!-- <a-col :lg="8" :md="12" :xs="24">
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
@@ -233,7 +243,7 @@ watch(
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col> -->
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-select
@@ -264,7 +274,7 @@ watch(
<a-table
class="table"
row-key="id"
row-key="userId"
:columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data"
@@ -277,11 +287,11 @@ watch(
onChange: fnTableSelectedRowKeys,
}"
>
<!-- <template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag :options="dict.sysNormalDisable" :value="record.status" />
</template>
</template> -->
</template>
</a-table>
</a-modal>
</template>

View File

@@ -183,7 +183,7 @@ function fnTableSize({ key }: MenuInfo) {
}
/**表格斑马纹 */
function fnTableStriped(_record: unknown, index: number):any {
function fnTableStriped(_record: unknown, index: number): any {
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
}
@@ -624,18 +624,20 @@ function fnRecordDelete(roleId: string = '0') {
title: '提示',
content: `确认删除角色编号为 【${roleId}】 的数据项?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'delRole';
message.loading({ content: '请稍等...', key });
delRole(roleId).then(res => {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
key,
duration: 2,
});
fnGetList();
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
@@ -650,17 +652,20 @@ function fnExportList() {
title: '提示',
content: `确认根据搜索条件导出xlsx表格文件吗?`,
onOk() {
const hide = message.loading('请稍等...', 0);
const key = 'exportRole';
message.loading({ content: '请稍等...', key });
exportRole(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
key,
duration: 2,
});
saveAs(res.data, `role_${Date.now()}.xlsx`);
} else {
message.error({
content: `${res.msg}`,
key,
duration: 2,
});
}
@@ -838,9 +843,9 @@ onMounted(() => {
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<a-dropdown trigger="click">
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
</a-button>
@@ -928,7 +933,7 @@ onMounted(() => {
<template #icon><DeleteOutlined /></template>
</a-button>
</a-tooltip>
<!-- <a-tooltip v-if="record.roleId !== '1'">
<a-tooltip v-if="record.roleId !== '1'">
<template #title>分配数据权限</template>
<a-button
type="link"
@@ -937,7 +942,7 @@ onMounted(() => {
>
<template #icon><SecurityScanOutlined /></template>
</a-button>
</a-tooltip> -->
</a-tooltip>
<a-tooltip v-if="record.roleId !== '1'">
<template #title>分配用户</template>
<a-button
@@ -1099,7 +1104,7 @@ onMounted(() => {
<a-input-number
v-model:value="modalState.from.roleSort"
:min="0"
:max="9999"
:max="65535"
:step="1"
placeholder="排序值"
></a-input-number>