新增:新增公共查询枚举字典 API,优化前端获取枚举数据的方式

This commit is contained in:
2023-02-26 21:49:03 +08:00
parent 8200ea822f
commit a79b3e0e96
18 changed files with 205 additions and 83 deletions

View File

@@ -19,7 +19,7 @@
<a-form-item field="status" hide-label>
<a-select
v-model="queryParams.status"
:options="statusOptions"
:options="DisEnableStatusEnum"
placeholder="状态搜索"
allow-clear
style="width: 150px"
@@ -282,11 +282,7 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import {
SelectOptionData,
TreeNodeData,
TableData,
} from '@arco-design/web-vue';
import { TreeNodeData, TableData } from '@arco-design/web-vue';
import {
DeptRecord,
DeptParam,
@@ -299,6 +295,7 @@
import { listDeptTree } from '@/api/common';
const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const deptList = ref<DeptRecord[]>([]);
const dept = ref<DeptRecord>({
@@ -322,10 +319,6 @@
const exportLoading = ref(false);
const visible = ref(false);
const detailVisible = ref(false);
const statusOptions = ref<SelectOptionData[]>([
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 },
]);
const treeData = ref<TreeNodeData[]>();
const data = reactive({

View File

@@ -19,7 +19,7 @@
<a-form-item field="status" hide-label>
<a-select
v-model="queryParams.status"
:options="statusOptions"
:options="DisEnableStatusEnum"
placeholder="状态搜索"
allow-clear
style="width: 150px"
@@ -335,11 +335,7 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import {
SelectOptionData,
TreeNodeData,
TableData,
} from '@arco-design/web-vue';
import { TreeNodeData, TableData } from '@arco-design/web-vue';
import {
MenuRecord,
MenuParam,
@@ -352,6 +348,7 @@
import { listMenuTree } from '@/api/common';
const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const menuList = ref<MenuRecord[]>([]);
const ids = ref<Array<number>>([]);
@@ -364,10 +361,6 @@
const expandAll = ref(false);
const visible = ref(false);
const showChooseIcon = ref(false);
const statusOptions = ref<SelectOptionData[]>([
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 },
]);
const treeData = ref<TreeNodeData[]>();
const data = reactive({

View File

@@ -19,7 +19,7 @@
<a-form-item field="status" hide-label>
<a-select
v-model="queryParams.status"
:options="statusOptions"
:options="DisEnableStatusEnum"
placeholder="状态搜索"
allow-clear
style="width: 150px"
@@ -267,7 +267,6 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { SelectOptionData } from '@arco-design/web-vue';
import {
PostRecord,
PostParam,
@@ -279,6 +278,7 @@
} from '@/api/system/post';
const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const postList = ref<PostRecord[]>([]);
const post = ref<PostRecord>({
@@ -301,10 +301,6 @@
const exportLoading = ref(false);
const visible = ref(false);
const detailVisible = ref(false);
const statusOptions = ref<SelectOptionData[]>([
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 },
]);
const data = reactive({
// 查询参数

View File

@@ -19,7 +19,7 @@
<a-form-item field="status" hide-label>
<a-select
v-model="queryParams.status"
:options="statusOptions"
:options="DisEnableStatusEnum"
placeholder="状态搜索"
allow-clear
style="width: 150px"
@@ -244,7 +244,7 @@
<a-form-item label="数据权限" field="dataScope">
<a-select
v-model="form.dataScope"
:options="dataScopeOptions"
:options="DataScopeEnum"
placeholder="请选择数据权限"
/>
</a-form-item>
@@ -378,7 +378,7 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import { SelectOptionData, TreeNodeData } from '@arco-design/web-vue';
import { TreeNodeData } from '@arco-design/web-vue';
import {
RoleRecord,
RoleParam,
@@ -391,6 +391,7 @@
import { listMenuTree, listDeptTree } from '@/api/common';
const { proxy } = getCurrentInstance() as any;
const { DataScopeEnum, DisEnableStatusEnum } = proxy.useDict('DataScopeEnum', 'DisEnableStatusEnum');
const roleList = ref<RoleRecord[]>([]);
const role = ref<RoleRecord>({
@@ -417,17 +418,6 @@
const exportLoading = ref(false);
const visible = ref(false);
const detailVisible = ref(false);
const statusOptions = ref<SelectOptionData[]>([
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 },
]);
const dataScopeOptions = ref<SelectOptionData[]>([
{ label: '全部数据权限', value: 1 },
{ label: '本部门及以下数据权限', value: 2 },
{ label: '本部门数据权限', value: 3 },
{ label: '仅本人数据权限', value: 4 },
{ label: '自定义数据权限', value: 5 },
]);
const menuLoading = ref(false);
const deptLoading = ref(false);
const menuOptions = ref<TreeNodeData[]>([]);

View File

@@ -36,7 +36,7 @@
<a-form-item field="status" hide-label>
<a-select
v-model="queryParams.status"
:options="statusOptions"
:options="DisEnableStatusEnum"
placeholder="状态搜索"
allow-clear
style="width: 150px"
@@ -484,7 +484,7 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive, watch } from 'vue';
import { SelectOptionData, TreeNodeData } from '@arco-design/web-vue';
import { TreeNodeData } from '@arco-design/web-vue';
import {
UserRecord,
UserParam,
@@ -496,15 +496,12 @@
resetPassword,
updateUserRole,
} from '@/api/system/user';
import {
LabelValueRecord,
listDeptTree,
listPostDict,
listRoleDict,
} from '@/api/common';
import { listDeptTree, listPostDict, listRoleDict } from '@/api/common';
import { LabelValueState } from '@/store/modules/dict/types';
import getAvatar from '@/utils/avatar';
const { proxy } = getCurrentInstance() as any;
const { DisEnableStatusEnum } = proxy.useDict('DisEnableStatusEnum');
const userList = ref<UserRecord[]>([]);
const user = ref<UserRecord>({
@@ -535,16 +532,12 @@
const visible = ref(false);
const userRoleVisible = ref(false);
const detailVisible = ref(false);
const statusOptions = ref<SelectOptionData[]>([
{ label: '启用', value: 1 },
{ label: '禁用', value: 2 },
]);
const deptLoading = ref(false);
const postLoading = ref(false);
const roleLoading = ref(false);
const deptOptions = ref<TreeNodeData[]>([]);
const postOptions = ref<LabelValueRecord[]>([]);
const roleOptions = ref<LabelValueRecord[]>([]);
const postOptions = ref<LabelValueState[]>([]);
const roleOptions = ref<LabelValueState[]>([]);
const deptTree = ref<TreeNodeData[]>([]);
const deptName = ref('');