Showing
13 changed files
with
227 additions
and
140 deletions
@@ -9,7 +9,6 @@ import {ErrorMessageMode} from "/#/axios"; | @@ -9,7 +9,6 @@ import {ErrorMessageMode} from "/#/axios"; | ||
9 | enum Api { | 9 | enum Api { |
10 | DeptList = '/dept/all', | 10 | DeptList = '/dept/all', |
11 | basicUrl = '/dept', | 11 | basicUrl = '/dept', |
12 | - // CONFIG_ITEM_URL = '/dictItem' | ||
13 | } | 12 | } |
14 | 13 | ||
15 | export const getDeptList = (params?: DeptListItem) => | 14 | export const getDeptList = (params?: DeptListItem) => |
@@ -19,11 +18,7 @@ export const getDeptList = (params?: DeptListItem) => | @@ -19,11 +18,7 @@ export const getDeptList = (params?: DeptListItem) => | ||
19 | * @description: save or edit dept api | 18 | * @description: save or edit dept api |
20 | */ | 19 | */ |
21 | export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { | 20 | export function saveOrEditDeptApi(params: DeptOperationParams, update: boolean = false, mode: ErrorMessageMode = 'modal') { |
22 | - // console.log(params); | ||
23 | if (!update) { | 21 | if (!update) { |
24 | - // console.log("-------------后台的参数-------------------"); | ||
25 | - // console.log(params); | ||
26 | - | ||
27 | return defHttp.post<DeptOperationApiResult>( | 22 | return defHttp.post<DeptOperationApiResult>( |
28 | { | 23 | { |
29 | url: Api.basicUrl, | 24 | url: Api.basicUrl, |
@@ -2,13 +2,13 @@ import {defHttp} from "/@/utils/http/axios"; | @@ -2,13 +2,13 @@ import {defHttp} from "/@/utils/http/axios"; | ||
2 | import {GroupListResultModel} from "/@/api/system/model/groupModel"; | 2 | import {GroupListResultModel} from "/@/api/system/model/groupModel"; |
3 | 3 | ||
4 | enum GroupApi { | 4 | enum GroupApi { |
5 | - BASE_URL="/group" | 5 | + BASE_URL="/organization" |
6 | } | 6 | } |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * 查询当前用户的所辖分组 | 9 | + * 查询当前用户的所属组织 |
10 | */ | 10 | */ |
11 | export const findCurrentUserGroups=()=> | 11 | export const findCurrentUserGroups=()=> |
12 | defHttp.get<GroupListResultModel>({ | 12 | defHttp.get<GroupListResultModel>({ |
13 | - url: GroupApi.BASE_URL+"/me/groups", | 13 | + url: GroupApi.BASE_URL+"/me/organizations", |
14 | }); | 14 | }); |
@@ -36,12 +36,11 @@ export interface AccountListItem { | @@ -36,12 +36,11 @@ export interface AccountListItem { | ||
36 | accountExpireTime?: string; | 36 | accountExpireTime?: string; |
37 | } | 37 | } |
38 | 38 | ||
39 | -export interface DeptListItem { | 39 | +export interface OrganizationListItem { |
40 | id: string; | 40 | id: string; |
41 | - orderNo: string; | ||
42 | - createTime: string; | 41 | + name: string; |
42 | + parentId?: string; | ||
43 | remark: string; | 43 | remark: string; |
44 | - status: number; | ||
45 | } | 44 | } |
46 | 45 | ||
47 | export interface MenuListItem { | 46 | export interface MenuListItem { |
@@ -75,13 +74,13 @@ export interface ChangeAccountParams { | @@ -75,13 +74,13 @@ export interface ChangeAccountParams { | ||
75 | resetPassword?: string; | 74 | resetPassword?: string; |
76 | } | 75 | } |
77 | 76 | ||
78 | -export class RoleOrGroupParam { | 77 | +export class RoleOrOrganizationParam { |
79 | userId: string; | 78 | userId: string; |
80 | queryRole: boolean; | 79 | queryRole: boolean; |
81 | - queryGroup: boolean; | ||
82 | - constructor(userId: string, queryRole: boolean, queryGroup: boolean) { | 80 | + queryOrganization: boolean; |
81 | + constructor(userId: string, queryRole: boolean, queryOrganization: boolean) { | ||
83 | this.queryRole = queryRole; | 82 | this.queryRole = queryRole; |
84 | - this.queryGroup = queryGroup; | 83 | + this.queryOrganization = queryOrganization; |
85 | this.userId = userId; | 84 | this.userId = userId; |
86 | } | 85 | } |
87 | } | 86 | } |
@@ -91,7 +90,7 @@ export class RoleOrGroupParam { | @@ -91,7 +90,7 @@ export class RoleOrGroupParam { | ||
91 | */ | 90 | */ |
92 | export type AccountListGetResultModel = BasicFetchResult<AccountListItem>; | 91 | export type AccountListGetResultModel = BasicFetchResult<AccountListItem>; |
93 | 92 | ||
94 | -export type DeptListGetResultModel = BasicFetchResult<DeptListItem>; | 93 | +export type OrganizationListGetResultModel = BasicFetchResult<OrganizationListItem>; |
95 | 94 | ||
96 | export type MenuListGetResultModel = BasicFetchResult<MenuListItem>; | 95 | export type MenuListGetResultModel = BasicFetchResult<MenuListItem>; |
97 | 96 |
1 | import { | 1 | import { |
2 | AccountParams, | 2 | AccountParams, |
3 | - DeptListItem, | 3 | + OrganizationListItem, |
4 | MenuParams, | 4 | MenuParams, |
5 | RoleParams, | 5 | RoleParams, |
6 | RolePageParams, | 6 | RolePageParams, |
7 | MenuListGetResultModel, | 7 | MenuListGetResultModel, |
8 | - DeptListGetResultModel, | 8 | + OrganizationListGetResultModel, |
9 | AccountListGetResultModel, | 9 | AccountListGetResultModel, |
10 | RolePageListGetResultModel, | 10 | RolePageListGetResultModel, |
11 | RoleListGetResultModel, | 11 | RoleListGetResultModel, |
12 | RoleReqDTO, | 12 | RoleReqDTO, |
13 | AccountListItem, | 13 | AccountListItem, |
14 | AccountListModel, | 14 | AccountListModel, |
15 | - RoleOrGroupParam, | 15 | + RoleOrOrganizationParam, |
16 | ChangeAccountParams, | 16 | ChangeAccountParams, |
17 | } from './model/systemModel'; | 17 | } from './model/systemModel'; |
18 | import { defHttp } from '/@/utils/http/axios'; | 18 | import { defHttp } from '/@/utils/http/axios'; |
@@ -28,6 +28,7 @@ enum Api { | @@ -28,6 +28,7 @@ enum Api { | ||
28 | DeleteRole = '/role', | 28 | DeleteRole = '/role', |
29 | GetAllRoleList = '/role/find/list', | 29 | GetAllRoleList = '/role/find/list', |
30 | BaseUserUrl = '/user', | 30 | BaseUserUrl = '/user', |
31 | + BaseOrganization = '/organization', | ||
31 | } | 32 | } |
32 | 33 | ||
33 | export const getAccountInfo = (userId: string) => | 34 | export const getAccountInfo = (userId: string) => |
@@ -35,9 +36,35 @@ export const getAccountInfo = (userId: string) => | @@ -35,9 +36,35 @@ export const getAccountInfo = (userId: string) => | ||
35 | 36 | ||
36 | export const getAccountList = (params: AccountParams) => | 37 | export const getAccountList = (params: AccountParams) => |
37 | defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params }); | 38 | defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params }); |
39 | +/** | ||
40 | + * 获取组织列表 | ||
41 | + * @param params 请求参数 | ||
42 | + */ | ||
43 | +export const getOrganizationList = (params?: OrganizationListItem) => | ||
44 | + defHttp.get<OrganizationListGetResultModel>({ | ||
45 | + url: Api.BaseOrganization + '/me/organizations', | ||
46 | + params, | ||
47 | + }); | ||
38 | 48 | ||
39 | -export const getDeptList = (params?: DeptListItem) => | ||
40 | - defHttp.get<DeptListGetResultModel>({ url: Api.DeptList, params }); | 49 | +/** |
50 | + * 更新或者保存组织 | ||
51 | + * @param params | ||
52 | + * @param isUpdate | ||
53 | + */ | ||
54 | +export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate?: boolean) => { | ||
55 | + if (isUpdate) { | ||
56 | + return defHttp.put<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | ||
57 | + } else { | ||
58 | + return defHttp.post<OrganizationListGetResultModel>({ url: Api.BaseOrganization, params }); | ||
59 | + } | ||
60 | +}; | ||
61 | + | ||
62 | +/** | ||
63 | + * 删除组织 | ||
64 | + * @param ids 删除的ID | ||
65 | + */ | ||
66 | +export const delOrganization = (ids: string[]) => | ||
67 | + defHttp.delete({ url: Api.BaseOrganization, data: ids }); | ||
41 | 68 | ||
42 | export const getMenuList = (params?: MenuParams) => | 69 | export const getMenuList = (params?: MenuParams) => |
43 | defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); | 70 | defHttp.get<MenuListGetResultModel>({ url: Api.MenuList, params }); |
@@ -98,7 +125,8 @@ export const deleteUser = (ids: string[]) => | @@ -98,7 +125,8 @@ export const deleteUser = (ids: string[]) => | ||
98 | * 查询当前用户的关系 | 125 | * 查询当前用户的关系 |
99 | * @param params | 126 | * @param params |
100 | */ | 127 | */ |
101 | -export const findCurrentUserRelation = (params: RoleOrGroupParam) => | 128 | + |
129 | +export const findCurrentUserRelation = (params: RoleOrOrganizationParam) => | ||
102 | defHttp.post<Array<string>>({ | 130 | defHttp.post<Array<string>>({ |
103 | url: Api.BaseUserUrl + '/relation', | 131 | url: Api.BaseUserUrl + '/relation', |
104 | params: params, | 132 | params: params, |
1 | export default { | 1 | export default { |
2 | + common:{ | ||
3 | + createTime:"create time", | ||
4 | + updateTime:"update time", | ||
5 | + operation:"operation", | ||
6 | + remark:"remark", | ||
7 | + enable:"enable", | ||
8 | + disable:"disable", | ||
9 | + sort:"sort", | ||
10 | + status:"status", | ||
11 | + }, | ||
2 | tenant:{ | 12 | tenant:{ |
3 | tenant:"tenant", | 13 | tenant:"tenant", |
4 | tenantManagement:"tenant management", | 14 | tenantManagement:"tenant management", |
5 | tenantSetting:"tenant setting" | 15 | tenantSetting:"tenant setting" |
6 | }, | 16 | }, |
17 | + organization:{ | ||
18 | + queryOrganizationName:"organization name", | ||
19 | + toolOrganizationList:"organization list", | ||
20 | + toolCreateOrganization:"create organization", | ||
21 | + toolEditOrganization:"edit organization", | ||
22 | + parentOrganization:"parent organization", | ||
23 | + }, | ||
7 | dept:{ | 24 | dept:{ |
8 | queryDeptName:"dept name", | 25 | queryDeptName:"dept name", |
9 | queryDeptStatus:"status", | 26 | queryDeptStatus:"status", |
1 | export default { | 1 | export default { |
2 | + common: { | ||
3 | + createTime: '创建时间', | ||
4 | + updateTime: '更新时间', | ||
5 | + operation: '操作', | ||
6 | + remark: '备注', | ||
7 | + enable: '启用', | ||
8 | + disable: '禁用', | ||
9 | + sort: '排序', | ||
10 | + status: '状态', | ||
11 | + }, | ||
2 | tenant: { | 12 | tenant: { |
3 | tenant: '租户', | 13 | tenant: '租户', |
4 | tenantManagement: '租户管理', | 14 | tenantManagement: '租户管理', |
5 | tenantSetting: '租户设置', | 15 | tenantSetting: '租户设置', |
6 | }, | 16 | }, |
17 | + organization: { | ||
18 | + queryOrganizationName: '组织名称', | ||
19 | + toolOrganizationList: '组织列表', | ||
20 | + toolCreateOrganization: '新增组织', | ||
21 | + toolEditOrganization: '编辑组织', | ||
22 | + parentOrganization: '上级组织', | ||
23 | + }, | ||
7 | dept: { | 24 | dept: { |
8 | queryDeptName: '部门名称', | 25 | queryDeptName: '部门名称', |
9 | queryDeptStatus: '状态', | 26 | queryDeptStatus: '状态', |
src/views/common/OrganizationIdTree.vue
renamed from
src/views/system/account/DeptTree.vue
1 | <template> | 1 | <template> |
2 | <div class="bg-white m-4 mr-0 overflow-hidden"> | 2 | <div class="bg-white m-4 mr-0 overflow-hidden"> |
3 | <BasicTree | 3 | <BasicTree |
4 | - title="部门列表" | 4 | + title="组织列表" |
5 | toolbar | 5 | toolbar |
6 | search | 6 | search |
7 | :clickRowToExpand="false" | 7 | :clickRowToExpand="false" |
8 | :treeData="treeData" | 8 | :treeData="treeData" |
9 | - :replaceFields="{ key: 'id', title: 'deptName' }" | 9 | + :replaceFields="{ key: 'id', title: 'name' }" |
10 | @select="handleSelect" | 10 | @select="handleSelect" |
11 | /> | 11 | /> |
12 | </div> | 12 | </div> |
@@ -15,10 +15,10 @@ | @@ -15,10 +15,10 @@ | ||
15 | import { defineComponent, onMounted, ref } from 'vue'; | 15 | import { defineComponent, onMounted, ref } from 'vue'; |
16 | 16 | ||
17 | import { BasicTree, TreeItem } from '/@/components/Tree'; | 17 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
18 | - import { getDeptList } from '/@/api/system/system'; | 18 | + import { getOrganizationList } from '/@/api/system/system'; |
19 | 19 | ||
20 | export default defineComponent({ | 20 | export default defineComponent({ |
21 | - name: 'DeptTree', | 21 | + name: 'OrganizationIdTree', |
22 | components: { BasicTree }, | 22 | components: { BasicTree }, |
23 | 23 | ||
24 | emits: ['select'], | 24 | emits: ['select'], |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | const treeData = ref<TreeItem[]>([]); | 26 | const treeData = ref<TreeItem[]>([]); |
27 | 27 | ||
28 | async function fetch() { | 28 | async function fetch() { |
29 | - treeData.value = (await getDeptList()) as unknown as TreeItem[]; | 29 | + treeData.value = (await getOrganizationList()) as unknown as TreeItem[]; |
30 | } | 30 | } |
31 | 31 | ||
32 | function handleSelect(keys) { | 32 | function handleSelect(keys) { |
@@ -7,15 +7,15 @@ | @@ -7,15 +7,15 @@ | ||
7 | @ok="handleSubmit" | 7 | @ok="handleSubmit" |
8 | > | 8 | > |
9 | <BasicForm @register="registerForm"> | 9 | <BasicForm @register="registerForm"> |
10 | - <template #groupId="{ model, field }"> | 10 | + <template #organizationId="{ model, field }"> |
11 | <BasicTree | 11 | <BasicTree |
12 | v-model:value="model[field]" | 12 | v-model:value="model[field]" |
13 | - :treeData="groupTreeData" | 13 | + :treeData="organizationTreeData" |
14 | :replaceFields="{ title: 'name' }" | 14 | :replaceFields="{ title: 'name' }" |
15 | :checked-keys="checkGroup" | 15 | :checked-keys="checkGroup" |
16 | checkable | 16 | checkable |
17 | toolbar | 17 | toolbar |
18 | - title="所辖分组" | 18 | + title="所属组织" |
19 | /> | 19 | /> |
20 | </template> | 20 | </template> |
21 | </BasicForm> | 21 | </BasicForm> |
@@ -26,10 +26,14 @@ | @@ -26,10 +26,14 @@ | ||
26 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 26 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
27 | import { BasicForm, useForm } from '/@/components/Form/index'; | 27 | import { BasicForm, useForm } from '/@/components/Form/index'; |
28 | import { accountFormSchema } from './account.data'; | 28 | import { accountFormSchema } from './account.data'; |
29 | - import { findCurrentUserRelation, getDeptList, SaveOrUpdateUserInfo } from '/@/api/system/system'; | 29 | + import { |
30 | + findCurrentUserRelation, | ||
31 | + getOrganizationList, | ||
32 | + SaveOrUpdateUserInfo, | ||
33 | + } from '/@/api/system/system'; | ||
30 | import { BasicTree, TreeItem } from '/@/components/Tree'; | 34 | import { BasicTree, TreeItem } from '/@/components/Tree'; |
31 | import { findCurrentUserGroups } from '/@/api/system/group'; | 35 | import { findCurrentUserGroups } from '/@/api/system/group'; |
32 | - import { RoleOrGroupParam } from '/@/api/system/model/systemModel'; | 36 | + import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; |
33 | import { useMessage } from '/@/hooks/web/useMessage'; | 37 | import { useMessage } from '/@/hooks/web/useMessage'; |
34 | export default defineComponent({ | 38 | export default defineComponent({ |
35 | name: 'AccountModal', | 39 | name: 'AccountModal', |
@@ -38,7 +42,7 @@ | @@ -38,7 +42,7 @@ | ||
38 | setup(_, { emit }) { | 42 | setup(_, { emit }) { |
39 | const isUpdate = ref(true); | 43 | const isUpdate = ref(true); |
40 | const rowId = ref(''); | 44 | const rowId = ref(''); |
41 | - const groupTreeData = ref<TreeItem[]>([]); | 45 | + const organizationTreeData = ref<TreeItem[]>([]); |
42 | const checkGroup = ref<string[]>([]); | 46 | const checkGroup = ref<string[]>([]); |
43 | const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ | 47 | const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ |
44 | labelWidth: 100, | 48 | labelWidth: 100, |
@@ -54,7 +58,7 @@ | @@ -54,7 +58,7 @@ | ||
54 | setModalProps({ confirmLoading: false }); | 58 | setModalProps({ confirmLoading: false }); |
55 | isUpdate.value = !!data?.isUpdate; | 59 | isUpdate.value = !!data?.isUpdate; |
56 | const groupListModel = await findCurrentUserGroups(); | 60 | const groupListModel = await findCurrentUserGroups(); |
57 | - if (unref(groupTreeData).length === 0) { | 61 | + if (unref(organizationTreeData).length === 0) { |
58 | let treeValues = new Array<TreeItem>(); | 62 | let treeValues = new Array<TreeItem>(); |
59 | groupListModel.map((item) => { | 63 | groupListModel.map((item) => { |
60 | const groupData = { | 64 | const groupData = { |
@@ -65,12 +69,12 @@ | @@ -65,12 +69,12 @@ | ||
65 | }; | 69 | }; |
66 | treeValues.push(groupData); | 70 | treeValues.push(groupData); |
67 | }); | 71 | }); |
68 | - groupTreeData.value = treeValues; | 72 | + organizationTreeData.value = treeValues; |
69 | } | 73 | } |
70 | 74 | ||
71 | if (unref(isUpdate)) { | 75 | if (unref(isUpdate)) { |
72 | rowId.value = data.record.id; | 76 | rowId.value = data.record.id; |
73 | - const roleParams = new RoleOrGroupParam(rowId.value, true, false); | 77 | + const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); |
74 | findCurrentUserRelation(roleParams).then((result) => { | 78 | findCurrentUserRelation(roleParams).then((result) => { |
75 | Reflect.set(data.record, 'roleIds', result); | 79 | Reflect.set(data.record, 'roleIds', result); |
76 | Reflect.set(data.record, 'password', '******'); | 80 | Reflect.set(data.record, 'password', '******'); |
@@ -78,10 +82,10 @@ | @@ -78,10 +82,10 @@ | ||
78 | ...data.record, | 82 | ...data.record, |
79 | }); | 83 | }); |
80 | }); | 84 | }); |
81 | - const groupParams = new RoleOrGroupParam(rowId.value, false, true); | ||
82 | - checkGroup.value = await findCurrentUserRelation(groupParams); | 85 | + const organizationParams = new RoleOrOrganizationParam(rowId.value, false, true); |
86 | + checkGroup.value = await findCurrentUserRelation(organizationParams); | ||
83 | } | 87 | } |
84 | - const deptData = await getDeptList(); | 88 | + const deptData = await getOrganizationList(); |
85 | await updateSchema([ | 89 | await updateSchema([ |
86 | { | 90 | { |
87 | field: 'username', | 91 | field: 'username', |
@@ -115,8 +119,14 @@ | @@ -115,8 +119,14 @@ | ||
115 | setModalProps({ confirmLoading: false }); | 119 | setModalProps({ confirmLoading: false }); |
116 | } | 120 | } |
117 | } | 121 | } |
118 | - | ||
119 | - return { registerModal, registerForm, getTitle, handleSubmit, groupTreeData, checkGroup }; | 122 | + return { |
123 | + registerModal, | ||
124 | + registerForm, | ||
125 | + getTitle, | ||
126 | + handleSubmit, | ||
127 | + organizationTreeData, | ||
128 | + checkGroup, | ||
129 | + }; | ||
120 | }, | 130 | }, |
121 | }); | 131 | }); |
122 | </script> | 132 | </script> |
@@ -168,22 +168,9 @@ export const accountFormSchema: FormSchema[] = [ | @@ -168,22 +168,9 @@ export const accountFormSchema: FormSchema[] = [ | ||
168 | }, | 168 | }, |
169 | }, | 169 | }, |
170 | { | 170 | { |
171 | - field: 'deptId', | ||
172 | - label: '所属部门', | ||
173 | - component: 'TreeSelect', | ||
174 | - componentProps: { | ||
175 | - replaceFields: { | ||
176 | - title: 'deptName', | ||
177 | - key: 'id', | ||
178 | - value: 'id', | ||
179 | - }, | ||
180 | - }, | ||
181 | - required: true, | ||
182 | - }, | ||
183 | - { | ||
184 | - field: 'groupIds', | 171 | + field: 'organizationIds', |
185 | label: ' ', | 172 | label: ' ', |
186 | component: 'Input', | 173 | component: 'Input', |
187 | - slot:'groupId', | 174 | + slot:'organizationId', |
188 | }, | 175 | }, |
189 | ]; | 176 | ]; |
1 | <template> | 1 | <template> |
2 | <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> | 2 | <PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> |
3 | - <DeptTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> | 3 | + <OrganizationIdTree class="w-1/4 xl:w-1/5" @select="handleSelect" /> |
4 | <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo"> | 4 | <BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo"> |
5 | <template #toolbar> | 5 | <template #toolbar> |
6 | <a-button type="primary" @click="handleCreate">新增账号</a-button> | 6 | <a-button type="primary" @click="handleCreate">新增账号</a-button> |
@@ -66,7 +66,8 @@ | @@ -66,7 +66,8 @@ | ||
66 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 66 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
67 | import { deleteUser, getAccountList } from '/@/api/system/system'; | 67 | import { deleteUser, getAccountList } from '/@/api/system/system'; |
68 | import { PageWrapper } from '/@/components/Page'; | 68 | import { PageWrapper } from '/@/components/Page'; |
69 | - import DeptTree from './DeptTree.vue'; | 69 | + |
70 | + import OrganizationIdTree from '../../common/OrganizationIdTree.vue'; | ||
70 | import { Tag } from 'ant-design-vue'; | 71 | import { Tag } from 'ant-design-vue'; |
71 | import { useModal } from '/@/components/Modal'; | 72 | import { useModal } from '/@/components/Modal'; |
72 | import AccountModal from './AccountModal.vue'; | 73 | import AccountModal from './AccountModal.vue'; |
@@ -77,7 +78,8 @@ | @@ -77,7 +78,8 @@ | ||
77 | 78 | ||
78 | export default defineComponent({ | 79 | export default defineComponent({ |
79 | name: 'AccountManagement', | 80 | name: 'AccountManagement', |
80 | - components: { BasicTable, PageWrapper, DeptTree, AccountModal, TableAction, Tag }, | 81 | + |
82 | + components: { BasicTable, PageWrapper, OrganizationIdTree, AccountModal, TableAction, Tag }, | ||
81 | setup() { | 83 | setup() { |
82 | const go = useGo(); | 84 | const go = useGo(); |
83 | const [registerModal, { openModal }] = useModal(); | 85 | const [registerModal, { openModal }] = useModal(); |
src/views/system/organization/OrganizationDrawer.vue
renamed from
src/views/system/dept/DeptDrawer.vue
@@ -4,13 +4,14 @@ | @@ -4,13 +4,14 @@ | ||
4 | @register="registerDrawer" | 4 | @register="registerDrawer" |
5 | showFooter | 5 | showFooter |
6 | :title="getTitle" | 6 | :title="getTitle" |
7 | - width="50%" | 7 | + width="30%" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | > | 9 | > |
10 | <BasicForm @register="registerForm" /> | 10 | <BasicForm @register="registerForm" /> |
11 | </BasicDrawer> | 11 | </BasicDrawer> |
12 | </template> | 12 | </template> |
13 | <script lang="ts"> | 13 | <script lang="ts"> |
14 | +<<<<<<< HEAD:src/views/system/dept/DeptDrawer.vue | ||
14 | import { defineComponent, ref, computed, unref } from 'vue'; | 15 | import { defineComponent, ref, computed, unref } from 'vue'; |
15 | import { BasicForm, useForm } from '/@/components/Form/index'; | 16 | import { BasicForm, useForm } from '/@/components/Form/index'; |
16 | import { formSchema } from './dept.data'; | 17 | import { formSchema } from './dept.data'; |
@@ -63,6 +64,55 @@ | @@ -63,6 +64,55 @@ | ||
63 | componentProps: { treeData }, | 64 | componentProps: { treeData }, |
64 | }); | 65 | }); |
65 | }); | 66 | }); |
67 | +======= | ||
68 | +import {defineComponent, ref, computed, unref} from 'vue'; | ||
69 | +import {BasicForm, useForm} from '/@/components/Form'; | ||
70 | +import {formSchema} from './organization.data'; | ||
71 | +import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | ||
72 | +import {useI18n} from "/@/hooks/web/useI18n"; | ||
73 | +import {getOrganizationList, saveOrUpdateOrganization} from "/@/api/system/system"; | ||
74 | +export default defineComponent({ | ||
75 | + name: 'OrganizationDrawer', | ||
76 | + components: {BasicDrawer, BasicForm}, | ||
77 | + emits: ['success', 'register'], | ||
78 | + setup(_, {emit}) { | ||
79 | + const isUpdate = ref(true); | ||
80 | + let organizationId; | ||
81 | + | ||
82 | + const [registerForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | ||
83 | + labelWidth: 100, | ||
84 | + schemas: formSchema, | ||
85 | + showActionButtonGroup: false | ||
86 | + }); | ||
87 | + const {t} = useI18n(); //加载国际化 | ||
88 | + | ||
89 | + //默认传递页面数据 | ||
90 | + const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | ||
91 | + await resetFields(); | ||
92 | + setDrawerProps({confirmLoading: false}); | ||
93 | + isUpdate.value = !!data?.isUpdate; | ||
94 | + | ||
95 | + //如果是编辑操作,设置页面数据 | ||
96 | + if (unref(isUpdate)) { | ||
97 | + //为表单赋值 | ||
98 | + await setFieldsValue({ | ||
99 | + ...data.record, | ||
100 | + }); | ||
101 | + | ||
102 | + } | ||
103 | + if (isUpdate.value) { | ||
104 | + organizationId = Reflect.get(data.record, 'id'); | ||
105 | + } | ||
106 | + let treeData = await getOrganizationList(); | ||
107 | + await updateSchema({ | ||
108 | + field: 'parentId', | ||
109 | + componentProps: {treeData}, | ||
110 | + }); | ||
111 | + }); | ||
112 | + | ||
113 | + //得到页面标题 | ||
114 | + const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.organization.toolCreateOrganization') : t('routes.common.organization.toolEditOrganization'))); | ||
115 | +>>>>>>> main:src/views/system/organization/OrganizationDrawer.vue | ||
66 | 116 | ||
67 | //得到页面标题 | 117 | //得到页面标题 |
68 | const getTitle = computed(() => | 118 | const getTitle = computed(() => |
@@ -71,6 +121,7 @@ | @@ -71,6 +121,7 @@ | ||
71 | : t('routes.common.dept.toolEditDept') | 121 | : t('routes.common.dept.toolEditDept') |
72 | ); | 122 | ); |
73 | 123 | ||
124 | +<<<<<<< HEAD:src/views/system/dept/DeptDrawer.vue | ||
74 | //提交按钮 | 125 | //提交按钮 |
75 | async function handleSubmit() { | 126 | async function handleSubmit() { |
76 | try { | 127 | try { |
@@ -95,6 +146,16 @@ | @@ -95,6 +146,16 @@ | ||
95 | } finally { | 146 | } finally { |
96 | setDrawerProps({ confirmLoading: false }); | 147 | setDrawerProps({ confirmLoading: false }); |
97 | } | 148 | } |
149 | +======= | ||
150 | + if (isUpdate.value) { | ||
151 | + Reflect.set(values, 'id', organizationId); | ||
152 | + } | ||
153 | + await saveOrUpdateOrganization(values, isUpdate.value); | ||
154 | + closeDrawer();//关闭侧框 | ||
155 | + emit('success'); | ||
156 | + } finally { | ||
157 | + setDrawerProps({confirmLoading: false}); | ||
158 | +>>>>>>> main:src/views/system/organization/OrganizationDrawer.vue | ||
98 | } | 159 | } |
99 | 160 | ||
100 | return { registerDrawer, registerForm, getTitle, handleSubmit }; | 161 | return { registerDrawer, registerForm, getTitle, handleSubmit }; |
src/views/system/organization/index.vue
renamed from
src/views/system/dept/index.vue
@@ -3,18 +3,19 @@ | @@ -3,18 +3,19 @@ | ||
3 | <BasicTable @register="registerTable" @fetch-success="onFetchSuccess"> | 3 | <BasicTable @register="registerTable" @fetch-success="onFetchSuccess"> |
4 | <template #toolbar> | 4 | <template #toolbar> |
5 | <a-button type="primary" @click="handleCreate"> | 5 | <a-button type="primary" @click="handleCreate"> |
6 | - <!-- 新增部门--> | ||
7 | - {{ getI18nCreateDept }} | 6 | + {{ getI18n }} |
8 | </a-button> | 7 | </a-button> |
9 | </template> | 8 | </template> |
10 | <template #action="{ record }"> | 9 | <template #action="{ record }"> |
11 | <TableAction | 10 | <TableAction |
12 | :actions="[ | 11 | :actions="[ |
13 | { | 12 | { |
13 | + label:'编辑', | ||
14 | icon: 'clarity:note-edit-line', | 14 | icon: 'clarity:note-edit-line', |
15 | onClick: handleEdit.bind(null, record), | 15 | onClick: handleEdit.bind(null, record), |
16 | }, | 16 | }, |
17 | { | 17 | { |
18 | + label:'删除', | ||
18 | icon: 'ant-design:delete-outlined', | 19 | icon: 'ant-design:delete-outlined', |
19 | color: 'error', | 20 | color: 'error', |
20 | popConfirm: { | 21 | popConfirm: { |
@@ -33,9 +34,9 @@ | @@ -33,9 +34,9 @@ | ||
33 | import { computed, defineComponent, nextTick } from 'vue'; | 34 | import { computed, defineComponent, nextTick } from 'vue'; |
34 | 35 | ||
35 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 36 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
36 | - import { getDeptList } from '/@/api/system/dept'; | ||
37 | 37 | ||
38 | // 加载自定义侧边弹出框 组件 | 38 | // 加载自定义侧边弹出框 组件 |
39 | +<<<<<<< HEAD:src/views/system/dept/index.vue | ||
39 | import { useDrawer } from '/@/components/Drawer'; | 40 | import { useDrawer } from '/@/components/Drawer'; |
40 | import DeptDrawer from './DeptDrawer.vue'; | 41 | import DeptDrawer from './DeptDrawer.vue'; |
41 | 42 | ||
@@ -43,12 +44,21 @@ | @@ -43,12 +44,21 @@ | ||
43 | import { delDept } from '/@/api/system/dept'; | 44 | import { delDept } from '/@/api/system/dept'; |
44 | import { useI18n } from '/@/hooks/web/useI18n'; | 45 | import { useI18n } from '/@/hooks/web/useI18n'; |
45 | import { notification } from 'ant-design-vue'; | 46 | import { notification } from 'ant-design-vue'; |
47 | +======= | ||
48 | + import {useDrawer} from '/@/components/Drawer'; | ||
49 | + import DeptDrawer from './OrganizationDrawer.vue'; | ||
50 | + import { columns } from './organization.data'; | ||
51 | + import {useI18n} from "/@/hooks/web/useI18n"; | ||
52 | + import {delOrganization, getOrganizationList} from "/@/api/system/system"; | ||
53 | + import {useMessage} from "/@/hooks/web/useMessage"; | ||
54 | +>>>>>>> main:src/views/system/organization/index.vue | ||
46 | 55 | ||
47 | export default defineComponent({ | 56 | export default defineComponent({ |
48 | name: 'DeptManagement', | 57 | name: 'DeptManagement', |
49 | components: { BasicTable, DeptDrawer, TableAction }, | 58 | components: { BasicTable, DeptDrawer, TableAction }, |
50 | setup() { | 59 | setup() { |
51 | const [registerModal, { openDrawer }] = useDrawer(); | 60 | const [registerModal, { openDrawer }] = useDrawer(); |
61 | +<<<<<<< HEAD:src/views/system/dept/index.vue | ||
52 | const { t } = useI18n(); //加载国际化 | 62 | const { t } = useI18n(); //加载国际化 |
53 | // 新增部门 | 63 | // 新增部门 |
54 | const getI18nCreateDept = computed(() => t('routes.common.dept.toolCreateDept')); | 64 | const getI18nCreateDept = computed(() => t('routes.common.dept.toolCreateDept')); |
@@ -56,22 +66,30 @@ | @@ -56,22 +66,30 @@ | ||
56 | const [registerTable, { reload, expandAll }] = useTable({ | 66 | const [registerTable, { reload, expandAll }] = useTable({ |
57 | title: t('routes.common.dept.toolDeptList'), | 67 | title: t('routes.common.dept.toolDeptList'), |
58 | api: getDeptList, | 68 | api: getDeptList, |
69 | +======= | ||
70 | + const {t} = useI18n(); //加载国际化 | ||
71 | + const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); | ||
72 | + const {createMessage} = useMessage(); | ||
73 | + const [registerTable, { reload,expandAll }] = useTable({ | ||
74 | + title: t('routes.common.organization.toolOrganizationList'), | ||
75 | + api: getOrganizationList, | ||
76 | +>>>>>>> main:src/views/system/organization/index.vue | ||
59 | columns, | 77 | columns, |
60 | - formConfig: { | ||
61 | - labelWidth: 120, | ||
62 | - schemas: searchFormSchema, | ||
63 | - }, | ||
64 | isTreeTable: true, | 78 | isTreeTable: true, |
65 | pagination: false, | 79 | pagination: false, |
66 | striped: false, | 80 | striped: false, |
67 | - useSearchForm: true, | 81 | + useSearchForm: false, |
68 | showTableSetting: true, | 82 | showTableSetting: true, |
69 | bordered: true, | 83 | bordered: true, |
70 | showIndexColumn: false, | 84 | showIndexColumn: false, |
71 | canResize: false, | 85 | canResize: false, |
72 | actionColumn: { | 86 | actionColumn: { |
73 | width: 80, | 87 | width: 80, |
88 | +<<<<<<< HEAD:src/views/system/dept/index.vue | ||
74 | title: t('routes.common.dept.tableTitleDeptOperation'), //操作 | 89 | title: t('routes.common.dept.tableTitleDeptOperation'), //操作 |
90 | +======= | ||
91 | + title: t('routes.common.common.operation'),//操作 | ||
92 | +>>>>>>> main:src/views/system/organization/index.vue | ||
75 | dataIndex: 'action', | 93 | dataIndex: 'action', |
76 | slots: { customRender: 'action' }, | 94 | slots: { customRender: 'action' }, |
77 | fixed: undefined, | 95 | fixed: undefined, |
@@ -101,14 +119,20 @@ | @@ -101,14 +119,20 @@ | ||
101 | async function handleDelete(record: Recordable) { | 119 | async function handleDelete(record: Recordable) { |
102 | // console.log(record); | 120 | // console.log(record); |
103 | try { | 121 | try { |
122 | +<<<<<<< HEAD:src/views/system/dept/index.vue | ||
104 | let ids = [record.id]; | 123 | let ids = [record.id]; |
105 | await delDept(ids); | 124 | await delDept(ids); |
106 | notification.success({ | 125 | notification.success({ |
107 | message: '成功', | 126 | message: '成功', |
108 | description: '删除部门成功', | 127 | description: '删除部门成功', |
109 | duration: 3, | 128 | duration: 3, |
129 | +======= | ||
130 | + let ids = [record.id,]; | ||
131 | + await delOrganization(ids).then(()=>{ | ||
132 | + createMessage.success("删除组织成功"); | ||
133 | + handleSuccess(); | ||
134 | +>>>>>>> main:src/views/system/organization/index.vue | ||
110 | }); | 135 | }); |
111 | - await reload(); | ||
112 | } catch (e) { | 136 | } catch (e) { |
113 | return Promise.reject(e); | 137 | return Promise.reject(e); |
114 | } | 138 | } |
@@ -126,7 +150,7 @@ | @@ -126,7 +150,7 @@ | ||
126 | return { | 150 | return { |
127 | registerTable, | 151 | registerTable, |
128 | registerModal, | 152 | registerModal, |
129 | - getI18nCreateDept, | 153 | + getI18n, |
130 | getDeleteTitle, | 154 | getDeleteTitle, |
131 | handleCreate, | 155 | handleCreate, |
132 | handleEdit, | 156 | handleEdit, |
src/views/system/organization/organization.data.ts
renamed from
src/views/system/dept/dept.data.ts
1 | import { BasicColumn } from '/@/components/Table'; | 1 | import { BasicColumn } from '/@/components/Table'; |
2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
3 | -import { h } from 'vue'; | ||
4 | -import { Tag } from 'ant-design-vue'; | ||
5 | import {useI18n} from "/@/hooks/web/useI18n"; | 3 | import {useI18n} from "/@/hooks/web/useI18n"; |
6 | const { t } = useI18n(); | 4 | const { t } = useI18n(); |
7 | 5 | ||
8 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ |
9 | { | 7 | { |
10 | - title: t('routes.common.dept.queryDeptName'),//部门名称 | ||
11 | - dataIndex: 'deptName', | 8 | + title: t('routes.common.organization.queryOrganizationName'), |
9 | + dataIndex: 'name', | ||
12 | width: 160, | 10 | width: 160, |
13 | align: 'left', | 11 | align: 'left', |
14 | }, | 12 | }, |
15 | { | 13 | { |
16 | - title: t('routes.common.dept.tableTitleDeptSort'),//排序 | ||
17 | - dataIndex: 'orderNo', | 14 | + title: t('routes.common.common.sort'),//排序 |
15 | + dataIndex: 'sort', | ||
18 | width: 50, | 16 | width: 50, |
19 | }, | 17 | }, |
20 | { | 18 | { |
21 | - title: t('routes.common.dept.queryDeptStatus'),//状态 | ||
22 | - dataIndex: 'status', | ||
23 | - width: 80, | ||
24 | - customRender: ({ record }) => { | ||
25 | - const status = record.status; | ||
26 | - const enable = ~~status === 0; | ||
27 | - const color = enable ? 'green' : 'red'; | ||
28 | - const text = enable ? t('routes.common.dept.drawerTitleDeptEnable') : t('routes.common.dept.drawerTitleDeptDisable'); | ||
29 | - // const text = enable ? '启用' : '停用'; | ||
30 | - return h(Tag, { color: color }, () => text); | ||
31 | - }, | ||
32 | - }, | ||
33 | - { | ||
34 | - title: t('routes.common.dept.tableTitleDeptCreateTime'),//创建时间 | 19 | + title: t('routes.common.common.createTime'),//创建时间 |
35 | dataIndex: 'createTime', | 20 | dataIndex: 'createTime', |
36 | width: 180, | 21 | width: 180, |
37 | }, | 22 | }, |
38 | { | 23 | { |
39 | - title: t('routes.common.dept.tableTitleMemo'),//备注 | 24 | + title: t('routes.common.common.remark'),//备注 |
40 | dataIndex: 'remark', | 25 | dataIndex: 'remark', |
26 | + width: 300, | ||
41 | }, | 27 | }, |
42 | ]; | 28 | ]; |
43 | - | ||
44 | -export const searchFormSchema: FormSchema[] = [ | ||
45 | - { | ||
46 | - field: 'deptName', | ||
47 | - label: t('routes.common.dept.queryDeptName'),//部门名称 | ||
48 | - component: 'Input', | ||
49 | - colProps: { span: 8 }, | ||
50 | - }, | ||
51 | - { | ||
52 | - field: 'status', | ||
53 | - label: t('routes.common.dept.queryDeptStatus'),//状态 | ||
54 | - component: 'Select', | ||
55 | - componentProps: { | ||
56 | - options: [ | ||
57 | - { label: t('routes.common.dept.drawerTitleDeptEnable'), value: 0 }, | ||
58 | - // { label: '启用', value: 0 }, | ||
59 | - { label: t('routes.common.dept.drawerTitleDeptDisable'), value: 1 }, | ||
60 | - // { label: '停用', value: 1 }, | ||
61 | - ], | ||
62 | - }, | ||
63 | - colProps: { span: 8 }, | ||
64 | - }, | ||
65 | -]; | ||
66 | - | ||
67 | export const formSchema: FormSchema[] = [ | 29 | export const formSchema: FormSchema[] = [ |
68 | { | 30 | { |
69 | - field: 'deptName', | ||
70 | - label: t('routes.common.dept.queryDeptName'),//部门名称 | ||
71 | - component: 'Input', | ||
72 | - required: true, | ||
73 | - }, | ||
74 | - { | ||
75 | field: 'parentId', | 31 | field: 'parentId', |
76 | - label: t('routes.common.dept.drawerTitleDeptParentDept'),//上级部门 | 32 | + label: t('routes.common.organization.parentOrganization'), |
77 | component: 'TreeSelect', | 33 | component: 'TreeSelect', |
78 | componentProps: { | 34 | componentProps: { |
79 | replaceFields: { | 35 | replaceFields: { |
80 | - title: 'deptName', | 36 | + title: 'name', |
81 | key: 'id', | 37 | key: 'id', |
82 | value: 'id', | 38 | value: 'id', |
83 | }, | 39 | }, |
@@ -86,28 +42,19 @@ export const formSchema: FormSchema[] = [ | @@ -86,28 +42,19 @@ export const formSchema: FormSchema[] = [ | ||
86 | // required: true, | 42 | // required: true, |
87 | }, | 43 | }, |
88 | { | 44 | { |
89 | - field: 'orderNo', | ||
90 | - label: t('routes.common.dept.tableTitleDeptSort'),//排序 | ||
91 | - component: 'InputNumber', | 45 | + field: 'name', |
46 | + label: t('routes.common.organization.queryOrganizationName'), | ||
47 | + component: 'Input', | ||
92 | required: true, | 48 | required: true, |
93 | }, | 49 | }, |
94 | { | 50 | { |
95 | - field: 'status', | ||
96 | - label: t('routes.common.dept.queryDeptStatus'),//状态 | ||
97 | - component: 'RadioButtonGroup', | ||
98 | - defaultValue: 0, | ||
99 | - componentProps: { | ||
100 | - options: [ | ||
101 | - { label: t('routes.common.dept.drawerTitleDeptEnable'), value: 0 }, | ||
102 | - // { label: '启用', value: 0 }, | ||
103 | - { label: t('routes.common.dept.drawerTitleDeptDisable'), value: 1 }, | ||
104 | - // { label: '停用', value: 1 }, | ||
105 | - ], | ||
106 | - }, | 51 | + field: 'sort', |
52 | + label: t('routes.common.common.sort'),//排序 | ||
53 | + component: 'InputNumber', | ||
107 | required: true, | 54 | required: true, |
108 | }, | 55 | }, |
109 | { | 56 | { |
110 | - label: t('routes.common.dept.tableTitleMemo'),//备注 | 57 | + label: t('routes.common.common.remark'),//备注 |
111 | field: 'remark', | 58 | field: 'remark', |
112 | component: 'InputTextArea', | 59 | component: 'InputTextArea', |
113 | }, | 60 | }, |