Commit 565024f07697df551f55cc19191a8d958ed24e38
1 parent
f833cb1e
feat(front): 添加组织管理的CRUD及添加用户时的所属组织
Showing
13 changed files
with
147 additions
and
187 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'; |
| @@ -27,7 +27,8 @@ enum Api { | @@ -27,7 +27,8 @@ enum Api { | ||
| 27 | SaveOrUpdateRoleInfoWithMenu = '/role/saveOrUpdateRoleInfoWithMenu', | 27 | SaveOrUpdateRoleInfoWithMenu = '/role/saveOrUpdateRoleInfoWithMenu', |
| 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)=> |
| @@ -36,8 +37,34 @@ export const getAccountInfo=(userId:string)=> | @@ -36,8 +37,34 @@ export const getAccountInfo=(userId:string)=> | ||
| 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}); |
| 38 | 39 | ||
| 39 | -export const getDeptList = (params?: DeptListItem) => | ||
| 40 | - defHttp.get<DeptListGetResultModel>({url: Api.DeptList, params}); | 40 | +/** |
| 41 | + * 获取组织列表 | ||
| 42 | + * @param params 请求参数 | ||
| 43 | + */ | ||
| 44 | +export const getOrganizationList = (params?: OrganizationListItem) => | ||
| 45 | + defHttp.get<OrganizationListGetResultModel>({url: Api.BaseOrganization+'/me/organizations', params}); | ||
| 46 | + | ||
| 47 | +/** | ||
| 48 | + * 更新或者保存组织 | ||
| 49 | + * @param params | ||
| 50 | + * @param isUpdate | ||
| 51 | + */ | ||
| 52 | +export const saveOrUpdateOrganization = (params?:OrganizationListItem,isUpdate?:boolean) => | ||
| 53 | +{ | ||
| 54 | + if(isUpdate){ | ||
| 55 | + return defHttp.put<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | ||
| 56 | + }else{ | ||
| 57 | + return defHttp.post<OrganizationListGetResultModel>({url: Api.BaseOrganization, params}); | ||
| 58 | + } | ||
| 59 | +}; | ||
| 60 | + | ||
| 61 | +/** | ||
| 62 | + * 删除组织 | ||
| 63 | + * @param ids 删除的ID | ||
| 64 | + */ | ||
| 65 | +export const delOrganization = (ids: string[]) => | ||
| 66 | + defHttp.delete({url: Api.BaseOrganization, data: ids}) | ||
| 67 | + | ||
| 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,7 @@ export const deleteUser = (ids: string[]) => | @@ -98,7 +125,7 @@ export const deleteUser = (ids: string[]) => | ||
| 98 | * 查询当前用户的关系 | 125 | * 查询当前用户的关系 |
| 99 | * @param params | 126 | * @param params |
| 100 | */ | 127 | */ |
| 101 | -export const findCurrentUserRelation=(params:RoleOrGroupParam)=> | 128 | +export const findCurrentUserRelation=(params:RoleOrOrganizationParam)=> |
| 102 | defHttp.post<Array<string>>({ | 129 | defHttp.post<Array<string>>({ |
| 103 | url: Api.BaseUserUrl+"/relation", | 130 | url: Api.BaseUserUrl+"/relation", |
| 104 | params:params | 131 | 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:"状态", |
| @@ -2,15 +2,15 @@ | @@ -2,15 +2,15 @@ | ||
| 2 | <BasicModal width="650px" v-bind="$attrs" @register="registerModal" :title="getTitle" | 2 | <BasicModal width="650px" v-bind="$attrs" @register="registerModal" :title="getTitle" |
| 3 | @ok="handleSubmit"> | 3 | @ok="handleSubmit"> |
| 4 | <BasicForm @register="registerForm"> | 4 | <BasicForm @register="registerForm"> |
| 5 | - <template #groupId="{ model, field }"> | 5 | + <template #organizationId="{ model, field }"> |
| 6 | <BasicTree | 6 | <BasicTree |
| 7 | v-model:value="model[field]" | 7 | v-model:value="model[field]" |
| 8 | - :treeData="groupTreeData" | 8 | + :treeData="organizationTreeData" |
| 9 | :replaceFields="{ title: 'name' }" | 9 | :replaceFields="{ title: 'name' }" |
| 10 | :checked-keys="checkGroup" | 10 | :checked-keys="checkGroup" |
| 11 | checkable | 11 | checkable |
| 12 | toolbar | 12 | toolbar |
| 13 | - title="所辖分组" | 13 | + title="所属组织" |
| 14 | /> | 14 | /> |
| 15 | </template> | 15 | </template> |
| 16 | </BasicForm> | 16 | </BasicForm> |
| @@ -21,10 +21,10 @@ import {defineComponent, ref, computed, unref} from 'vue'; | @@ -21,10 +21,10 @@ import {defineComponent, ref, computed, unref} from 'vue'; | ||
| 21 | import {BasicModal, useModalInner} from '/@/components/Modal'; | 21 | import {BasicModal, useModalInner} from '/@/components/Modal'; |
| 22 | import {BasicForm, useForm} from '/@/components/Form/index'; | 22 | import {BasicForm, useForm} from '/@/components/Form/index'; |
| 23 | import {accountFormSchema} from './account.data'; | 23 | import {accountFormSchema} from './account.data'; |
| 24 | -import {findCurrentUserRelation, getDeptList, SaveOrUpdateUserInfo} from '/@/api/system/system'; | 24 | +import {findCurrentUserRelation, getOrganizationList, SaveOrUpdateUserInfo} from '/@/api/system/system'; |
| 25 | import {BasicTree, TreeItem} from "/@/components/Tree"; | 25 | import {BasicTree, TreeItem} from "/@/components/Tree"; |
| 26 | import {findCurrentUserGroups} from "/@/api/system/group"; | 26 | import {findCurrentUserGroups} from "/@/api/system/group"; |
| 27 | -import {RoleOrGroupParam} from "/@/api/system/model/systemModel"; | 27 | +import {RoleOrOrganizationParam} from "/@/api/system/model/systemModel"; |
| 28 | import {useMessage} from "/@/hooks/web/useMessage"; | 28 | import {useMessage} from "/@/hooks/web/useMessage"; |
| 29 | export default defineComponent({ | 29 | export default defineComponent({ |
| 30 | name: 'AccountModal', | 30 | name: 'AccountModal', |
| @@ -33,7 +33,7 @@ export default defineComponent({ | @@ -33,7 +33,7 @@ export default defineComponent({ | ||
| 33 | setup(_, {emit}) { | 33 | setup(_, {emit}) { |
| 34 | const isUpdate = ref(true); | 34 | const isUpdate = ref(true); |
| 35 | const rowId = ref(''); | 35 | const rowId = ref(''); |
| 36 | - const groupTreeData = ref<TreeItem[]>([]); | 36 | + const organizationTreeData = ref<TreeItem[]>([]); |
| 37 | const checkGroup = ref<string[]>([]); | 37 | const checkGroup = ref<string[]>([]); |
| 38 | const [registerForm, {setFieldsValue, updateSchema, resetFields, validate}] = useForm({ | 38 | const [registerForm, {setFieldsValue, updateSchema, resetFields, validate}] = useForm({ |
| 39 | labelWidth: 100, | 39 | labelWidth: 100, |
| @@ -49,7 +49,7 @@ export default defineComponent({ | @@ -49,7 +49,7 @@ export default defineComponent({ | ||
| 49 | setModalProps({confirmLoading: false}); | 49 | setModalProps({confirmLoading: false}); |
| 50 | isUpdate.value = !!data?.isUpdate; | 50 | isUpdate.value = !!data?.isUpdate; |
| 51 | const groupListModel = await findCurrentUserGroups(); | 51 | const groupListModel = await findCurrentUserGroups(); |
| 52 | - if (unref(groupTreeData).length === 0) { | 52 | + if (unref(organizationTreeData).length === 0) { |
| 53 | let treeValues = new Array<TreeItem>(); | 53 | let treeValues = new Array<TreeItem>(); |
| 54 | groupListModel.map((item) => { | 54 | groupListModel.map((item) => { |
| 55 | const groupData = { | 55 | const groupData = { |
| @@ -60,12 +60,12 @@ export default defineComponent({ | @@ -60,12 +60,12 @@ export default defineComponent({ | ||
| 60 | } | 60 | } |
| 61 | treeValues.push(groupData); | 61 | treeValues.push(groupData); |
| 62 | }) | 62 | }) |
| 63 | - groupTreeData.value = treeValues; | 63 | + organizationTreeData.value = treeValues; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | if (unref(isUpdate)) { | 66 | if (unref(isUpdate)) { |
| 67 | rowId.value = data.record.id; | 67 | rowId.value = data.record.id; |
| 68 | - const roleParams = new RoleOrGroupParam(rowId.value,true,false); | 68 | + const roleParams = new RoleOrOrganizationParam(rowId.value,true,false); |
| 69 | findCurrentUserRelation(roleParams).then((result)=>{ | 69 | findCurrentUserRelation(roleParams).then((result)=>{ |
| 70 | Reflect.set(data.record,"roleIds",result); | 70 | Reflect.set(data.record,"roleIds",result); |
| 71 | Reflect.set(data.record,"password","******"); | 71 | Reflect.set(data.record,"password","******"); |
| @@ -73,10 +73,10 @@ export default defineComponent({ | @@ -73,10 +73,10 @@ export default defineComponent({ | ||
| 73 | ...data.record, | 73 | ...data.record, |
| 74 | }); | 74 | }); |
| 75 | }) | 75 | }) |
| 76 | - const groupParams = new RoleOrGroupParam(rowId.value,false,true); | ||
| 77 | - checkGroup.value = await findCurrentUserRelation(groupParams); | 76 | + const organizationParams = new RoleOrOrganizationParam(rowId.value,false,true); |
| 77 | + checkGroup.value = await findCurrentUserRelation(organizationParams); | ||
| 78 | } | 78 | } |
| 79 | - const deptData = await getDeptList(); | 79 | + const deptData = await getOrganizationList(); |
| 80 | await updateSchema([ | 80 | await updateSchema([ |
| 81 | { | 81 | { |
| 82 | field: 'username', | 82 | field: 'username', |
| @@ -110,7 +110,7 @@ export default defineComponent({ | @@ -110,7 +110,7 @@ export default defineComponent({ | ||
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | - return {registerModal, registerForm, getTitle, handleSubmit, groupTreeData,checkGroup}; | 113 | + return {registerModal, registerForm, getTitle, handleSubmit, organizationTreeData,checkGroup}; |
| 114 | }, | 114 | }, |
| 115 | }); | 115 | }); |
| 116 | </script> | 116 | </script> |
src/views/system/account/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" |
| @@ -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) { |
| @@ -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 | ]; |
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 56 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 57 | import {deleteUser, getAccountList} from '/@/api/system/system'; | 57 | import {deleteUser, getAccountList} from '/@/api/system/system'; |
| 58 | import { PageWrapper } from '/@/components/Page'; | 58 | import { PageWrapper } from '/@/components/Page'; |
| 59 | - import DeptTree from './DeptTree.vue'; | 59 | + import DeptTree from './OrganizationIdTree.vue'; |
| 60 | import {Tag} from "ant-design-vue"; | 60 | import {Tag} from "ant-design-vue"; |
| 61 | import { useModal } from '/@/components/Modal'; | 61 | import { useModal } from '/@/components/Modal'; |
| 62 | import AccountModal from './AccountModal.vue'; | 62 | import AccountModal from './AccountModal.vue'; |
src/views/system/organization/OrganizationDrawer.vue
renamed from
src/views/system/dept/DeptDrawer.vue
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 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"/> |
| @@ -12,62 +12,52 @@ | @@ -12,62 +12,52 @@ | ||
| 12 | </template> | 12 | </template> |
| 13 | <script lang="ts"> | 13 | <script lang="ts"> |
| 14 | import {defineComponent, ref, computed, unref} from 'vue'; | 14 | import {defineComponent, ref, computed, unref} from 'vue'; |
| 15 | -import {BasicForm, useForm} from '/@/components/Form/index'; | ||
| 16 | -import {formSchema} from './dept.data'; | 15 | +import {BasicForm, useForm} from '/@/components/Form'; |
| 16 | +import {formSchema} from './organization.data'; | ||
| 17 | import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; | 17 | import {BasicDrawer, useDrawerInner} from '/@/components/Drawer'; |
| 18 | - | ||
| 19 | -// 加载部门 | ||
| 20 | -import { getDeptList } from '/@/api/system/dept'; | ||
| 21 | import {useI18n} from "/@/hooks/web/useI18n"; | 18 | import {useI18n} from "/@/hooks/web/useI18n"; |
| 22 | -import {saveOrEditDeptApi} from "/@/api/system/dept"; | ||
| 23 | - | ||
| 24 | - | 19 | +import {getOrganizationList, saveOrUpdateOrganization} from "/@/api/system/system"; |
| 25 | export default defineComponent({ | 20 | export default defineComponent({ |
| 26 | - name: 'DeptDrawer', | 21 | + name: 'OrganizationDrawer', |
| 27 | components: {BasicDrawer, BasicForm}, | 22 | components: {BasicDrawer, BasicForm}, |
| 28 | emits: ['success', 'register'], | 23 | emits: ['success', 'register'], |
| 29 | setup(_, {emit}) { | 24 | setup(_, {emit}) { |
| 30 | const isUpdate = ref(true); | 25 | const isUpdate = ref(true); |
| 31 | - let deptId,tenantCode,creator,createTime; | 26 | + let organizationId; |
| 32 | 27 | ||
| 33 | const [registerForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ | 28 | const [registerForm, {resetFields, setFieldsValue, updateSchema, validate}] = useForm({ |
| 34 | labelWidth: 100, | 29 | labelWidth: 100, |
| 35 | schemas: formSchema, | 30 | schemas: formSchema, |
| 36 | - showActionButtonGroup: false, | ||
| 37 | - baseColProps: {lg: 12, md: 24}, | 31 | + showActionButtonGroup: false |
| 38 | }); | 32 | }); |
| 39 | const {t} = useI18n(); //加载国际化 | 33 | const {t} = useI18n(); //加载国际化 |
| 40 | 34 | ||
| 41 | //默认传递页面数据 | 35 | //默认传递页面数据 |
| 42 | const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { | 36 | const [registerDrawer, {setDrawerProps, closeDrawer}] = useDrawerInner(async (data) => { |
| 43 | - resetFields(); | 37 | + await resetFields(); |
| 44 | setDrawerProps({confirmLoading: false}); | 38 | setDrawerProps({confirmLoading: false}); |
| 45 | isUpdate.value = !!data?.isUpdate; | 39 | isUpdate.value = !!data?.isUpdate; |
| 46 | 40 | ||
| 47 | //如果是编辑操作,设置页面数据 | 41 | //如果是编辑操作,设置页面数据 |
| 48 | if (unref(isUpdate)) { | 42 | if (unref(isUpdate)) { |
| 49 | //为表单赋值 | 43 | //为表单赋值 |
| 50 | - setFieldsValue({ | 44 | + await setFieldsValue({ |
| 51 | ...data.record, | 45 | ...data.record, |
| 52 | }); | 46 | }); |
| 53 | 47 | ||
| 54 | } | 48 | } |
| 55 | if (isUpdate.value) { | 49 | if (isUpdate.value) { |
| 56 | - tenantCode= Reflect.get(data.record, 'tenantCode'); | ||
| 57 | - creator= Reflect.get(data.record, 'creator'); | ||
| 58 | - createTime= Reflect.get(data.record, 'createTime'); | ||
| 59 | - deptId = Reflect.get(data.record, 'id'); | 50 | + organizationId = Reflect.get(data.record, 'id'); |
| 60 | } | 51 | } |
| 61 | - //加载部门 | ||
| 62 | - let treeData = await getDeptList(); | ||
| 63 | - updateSchema({ | 52 | + let treeData = await getOrganizationList(); |
| 53 | + await updateSchema({ | ||
| 64 | field: 'parentId', | 54 | field: 'parentId', |
| 65 | componentProps: {treeData}, | 55 | componentProps: {treeData}, |
| 66 | }); | 56 | }); |
| 67 | }); | 57 | }); |
| 68 | 58 | ||
| 69 | //得到页面标题 | 59 | //得到页面标题 |
| 70 | - const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.dept.toolCreateDept') : t('routes.common.dept.toolEditDept'))); | 60 | + const getTitle = computed(() => (!unref(isUpdate) ? t('routes.common.organization.toolCreateOrganization') : t('routes.common.organization.toolEditOrganization'))); |
| 71 | 61 | ||
| 72 | //提交按钮 | 62 | //提交按钮 |
| 73 | async function handleSubmit() { | 63 | async function handleSubmit() { |
| @@ -76,19 +66,9 @@ export default defineComponent({ | @@ -76,19 +66,9 @@ export default defineComponent({ | ||
| 76 | setDrawerProps({confirmLoading: true}); | 66 | setDrawerProps({confirmLoading: true}); |
| 77 | 67 | ||
| 78 | if (isUpdate.value) { | 68 | if (isUpdate.value) { |
| 79 | - Reflect.set(values, 'id', deptId); | ||
| 80 | - Reflect.set(values, 'tenantCode', tenantCode); | ||
| 81 | - Reflect.set(values, 'creator', creator); | ||
| 82 | - Reflect.set(values, 'createTime', createTime); | 69 | + Reflect.set(values, 'id', organizationId); |
| 83 | } | 70 | } |
| 84 | - | ||
| 85 | - // TODO custom api | ||
| 86 | - // console.log("-------------提交后台的参数-------------------"); | ||
| 87 | - // console.log(values); | ||
| 88 | - const data = await saveOrEditDeptApi(values, isUpdate.value); | ||
| 89 | - console.log("_______保存返回结果____data:",data); | ||
| 90 | - | ||
| 91 | - | 71 | + await saveOrUpdateOrganization(values, isUpdate.value); |
| 92 | closeDrawer();//关闭侧框 | 72 | closeDrawer();//关闭侧框 |
| 93 | emit('success'); | 73 | emit('success'); |
| 94 | } finally { | 74 | } finally { |
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,16 +34,14 @@ | @@ -33,16 +34,14 @@ | ||
| 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 | import {useDrawer} from '/@/components/Drawer'; | 39 | import {useDrawer} from '/@/components/Drawer'; |
| 40 | - import DeptDrawer from './DeptDrawer.vue'; | ||
| 41 | - | ||
| 42 | - import { columns, searchFormSchema } from './dept.data'; | ||
| 43 | - import {delDept} from "/@/api/system/dept"; | 40 | + import DeptDrawer from './OrganizationDrawer.vue'; |
| 41 | + import { columns } from './organization.data'; | ||
| 44 | import {useI18n} from "/@/hooks/web/useI18n"; | 42 | import {useI18n} from "/@/hooks/web/useI18n"; |
| 45 | - import {notification} from "ant-design-vue"; | 43 | + import {delOrganization, getOrganizationList} from "/@/api/system/system"; |
| 44 | + import {useMessage} from "/@/hooks/web/useMessage"; | ||
| 46 | 45 | ||
| 47 | export default defineComponent({ | 46 | export default defineComponent({ |
| 48 | name: 'DeptManagement', | 47 | name: 'DeptManagement', |
| @@ -50,28 +49,23 @@ | @@ -50,28 +49,23 @@ | ||
| 50 | setup() { | 49 | setup() { |
| 51 | const [registerModal, { openDrawer }] = useDrawer(); | 50 | const [registerModal, { openDrawer }] = useDrawer(); |
| 52 | const {t} = useI18n(); //加载国际化 | 51 | const {t} = useI18n(); //加载国际化 |
| 53 | - // 新增部门 | ||
| 54 | - const getI18nCreateDept = computed(() => t('routes.common.dept.toolCreateDept')); | ||
| 55 | - | 52 | + const getI18n = computed(() => t('routes.common.organization.toolCreateOrganization')); |
| 53 | + const {createMessage} = useMessage(); | ||
| 56 | const [registerTable, { reload,expandAll }] = useTable({ | 54 | const [registerTable, { reload,expandAll }] = useTable({ |
| 57 | - title: t('routes.common.dept.toolDeptList'), | ||
| 58 | - api: getDeptList, | 55 | + title: t('routes.common.organization.toolOrganizationList'), |
| 56 | + api: getOrganizationList, | ||
| 59 | columns, | 57 | columns, |
| 60 | - formConfig: { | ||
| 61 | - labelWidth: 120, | ||
| 62 | - schemas: searchFormSchema, | ||
| 63 | - }, | ||
| 64 | isTreeTable: true, | 58 | isTreeTable: true, |
| 65 | pagination: false, | 59 | pagination: false, |
| 66 | striped: false, | 60 | striped: false, |
| 67 | - useSearchForm: true, | 61 | + useSearchForm: false, |
| 68 | showTableSetting: true, | 62 | showTableSetting: true, |
| 69 | bordered: true, | 63 | bordered: true, |
| 70 | showIndexColumn: false, | 64 | showIndexColumn: false, |
| 71 | canResize: false, | 65 | canResize: false, |
| 72 | actionColumn: { | 66 | actionColumn: { |
| 73 | width: 80, | 67 | width: 80, |
| 74 | - title: t('routes.common.dept.tableTitleDeptOperation'),//操作 | 68 | + title: t('routes.common.common.operation'),//操作 |
| 75 | dataIndex: 'action', | 69 | dataIndex: 'action', |
| 76 | slots: { customRender: 'action' }, | 70 | slots: { customRender: 'action' }, |
| 77 | fixed: undefined, | 71 | fixed: undefined, |
| @@ -102,13 +96,10 @@ | @@ -102,13 +96,10 @@ | ||
| 102 | // console.log(record); | 96 | // console.log(record); |
| 103 | try { | 97 | try { |
| 104 | let ids = [record.id,]; | 98 | let ids = [record.id,]; |
| 105 | - await delDept(ids); | ||
| 106 | - notification.success({ | ||
| 107 | - message: "成功", | ||
| 108 | - description: "删除部门成功", | ||
| 109 | - duration: 3, | 99 | + await delOrganization(ids).then(()=>{ |
| 100 | + createMessage.success("删除组织成功"); | ||
| 101 | + handleSuccess(); | ||
| 110 | }); | 102 | }); |
| 111 | - await reload(); | ||
| 112 | } catch (e) { | 103 | } catch (e) { |
| 113 | return Promise.reject(e); | 104 | return Promise.reject(e); |
| 114 | } | 105 | } |
| @@ -126,7 +117,7 @@ | @@ -126,7 +117,7 @@ | ||
| 126 | return { | 117 | return { |
| 127 | registerTable, | 118 | registerTable, |
| 128 | registerModal, | 119 | registerModal, |
| 129 | - getI18nCreateDept, | 120 | + getI18n, |
| 130 | getDeleteTitle, | 121 | getDeleteTitle, |
| 131 | handleCreate, | 122 | handleCreate, |
| 132 | handleEdit, | 123 | 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 | }, |