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