From 2059d2e8af04313787d46a9879ae15532e949891 Mon Sep 17 00:00:00 2001 From: chuan <2256222053@qq.com> Date: Tue, 7 Dec 2021 17:09:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=92=8C=E9=83=A8=E9=97=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加部门修改和部门搜索 --- src/api/system/dept.ts | 39 ++---- src/components/TreeSelect/index.vue | 11 +- src/views/system/dept/index.vue | 194 +++++++++------------------- 3 files changed, 71 insertions(+), 173 deletions(-) diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts index 0e341bb..d84b705 100644 --- a/src/api/system/dept.ts +++ b/src/api/system/dept.ts @@ -1,13 +1,5 @@ import request from '@/utils/request' -// export function list(queryParams:object) { -// return request({ -// url: '/youlai-admin/api/v1/oauth-clients', -// method: 'get', -// params: queryParams -// }) -// } - export const listDept = (queryParams?: object) => { return request({ url: '/youlai-admin/api/v1/depts/table', @@ -18,15 +10,11 @@ export const listDept = (queryParams?: object) => { export const getDept = (deptId: any) => { return request({ - url: '/youlai-admin/api/v1/depts/select', + url: '/youlai-admin/api/v1/depts/'+deptId, method: 'get' }) } -// export const listDeptExcludeChild = (deptId: any) => { -// return https().request>(`system/dept/list/exclude/${deptId}`, Method.GET, undefined, ContentType.form) -// } - export const delDept = (deptId: any) => { return request({ url: '/youlai-admin/api/v1/depts/'+deptId, @@ -34,10 +22,7 @@ export const delDept = (deptId: any) => { }) } - - // 新增部门 - export const addDept = (data: any) => { return request({ url: '/youlai-admin/api/v1/depts', @@ -47,22 +32,18 @@ export const addDept = (data: any) => { } // 修改部门 - -export const updateDept = (data: any) => { +export const updateDept = (id:string,data: any) => { return request({ - url: '/youlai-admin/api/v1/depts/' + id, + url: '/youlai-admin/api/v1/depts/'+id, method: 'put', data: data }) } -// // 根据角色ID查询部门树结构 -// export const roleDeptTreeselect = (roleId: number | string) => { -// return https().request(`system/dept/roleDeptTreeselect/${roleId}`, Method.GET, undefined, ContentType.form) -// } -// -// // 查询部门下拉树结构 -// -// export const treeselect = () => { -// return https().request>('system/dept/treeselect', Method.GET, undefined, ContentType.form) -// } + +export const getDeptSelectList = ()=> { + return request({ + url: '/youlai-admin/api/v1/depts/select', + method: 'get' + }) +} diff --git a/src/components/TreeSelect/index.vue b/src/components/TreeSelect/index.vue index 76289cb..21d3e59 100644 --- a/src/components/TreeSelect/index.vue +++ b/src/components/TreeSelect/index.vue @@ -50,7 +50,7 @@ export default defineComponent({ // 选项列表数据(树形结构的对象数组) options: { type: Array, required: true }, // 初始值 - defalut: { type: Number, default: null }, + defalut: { type: String, default: null }, // 可清空选项 clearable: { type: Boolean, default: true }, // 自动收起 @@ -71,9 +71,6 @@ export default defineComponent({ }, emits: ['callBack'], setup(props, ctx) { - console.log(props.options) - console.log(props.treeProps) - const instance = getCurrentInstance() as any const state = reactive({ valueId: 0, @@ -105,8 +102,6 @@ export default defineComponent({ // 处理默认值并显示 const defaultValue = () => { - console.log('xxxxxx') - if (props.defalut !== null) { const deafaultModels = props.originOptions.filter((item: any) => { return item[props.treeProps.value] === props.defalut @@ -168,9 +163,7 @@ export default defineComponent({