feat: 部门联调
This commit is contained in:
@@ -6,6 +6,7 @@ export enum permission {
|
|||||||
export enum origanizemanage {
|
export enum origanizemanage {
|
||||||
userList = '/carbon-smart/api/user/queryUserByPage',
|
userList = '/carbon-smart/api/user/queryUserByPage',
|
||||||
addUser = '/carbon-smart/api/user/save',
|
addUser = '/carbon-smart/api/user/save',
|
||||||
|
editUser = '/carbon-smart/api/user/edit',
|
||||||
frozen = '/carbon-smart/api/user/frozen',
|
frozen = '/carbon-smart/api/user/frozen',
|
||||||
resetPwd = '/carbon-smart/api/user/resetPwd',
|
resetPwd = '/carbon-smart/api/user/resetPwd',
|
||||||
del = '/carbon-smart/api/user/del',
|
del = '/carbon-smart/api/user/del',
|
||||||
@@ -19,4 +20,11 @@ export enum department {
|
|||||||
dartList = `${BASE_URL}/api/user/queryDeptTree`,
|
dartList = `${BASE_URL}/api/user/queryDeptTree`,
|
||||||
deptSave = `${BASE_URL}/api/dept/save`,
|
deptSave = `${BASE_URL}/api/dept/save`,
|
||||||
deptEdit = `${BASE_URL}/api/dept/edit`,
|
deptEdit = `${BASE_URL}/api/dept/edit`,
|
||||||
|
deptDel = `${BASE_URL}/api/dept/del`,
|
||||||
|
addPermission = `${BASE_URL}/api/dept/addPermission`,
|
||||||
|
addRolePermission = `${BASE_URL}/api/dept/addRolePermission`,
|
||||||
|
delRole = `${BASE_URL}/api/dept/delRole`,
|
||||||
|
addRole = `${BASE_URL}/api/dept/addRole`,
|
||||||
|
editRole = `${BASE_URL}/api/dept/editRole`,
|
||||||
|
queryRoleTree = `${BASE_URL}/api/dept/queryRoleTree`,
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ const transform = (data, map) => {
|
|||||||
export const appConfig = {
|
export const appConfig = {
|
||||||
projectType: 'web',
|
projectType: 'web',
|
||||||
baseApi: '/api',
|
baseApi: '/api',
|
||||||
enablePermissions: true,
|
enablePermissions: false,
|
||||||
// themeColor: '#eee',
|
// themeColor: '#eee',
|
||||||
siderPosition: 'left',
|
siderPosition: 'left',
|
||||||
baseHeader: '/parkingManage',
|
baseHeader: '/parkingManage',
|
||||||
|
@@ -20,7 +20,7 @@ const equipment = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '设备台账',
|
title: '设备台账',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [],
|
// backApi: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -39,7 +39,7 @@ const equipment = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '分组管理',
|
title: '分组管理',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [],
|
// backApi: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -58,7 +58,7 @@ const equipment = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '能耗映射',
|
title: '能耗映射',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [],
|
// backApi: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -19,12 +19,7 @@ const home = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '首页',
|
title: '首页',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [
|
// backApi: [],
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/objs/FeedbackWeb/feedBackList',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -19,12 +19,7 @@ const organizationManage = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '企业管理',
|
title: '企业管理',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [
|
// backApi: [],
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/objs/FeedbackWeb/feedBackList',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -43,12 +38,7 @@ const organizationManage = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [
|
// backApi: [],
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/objs/FeedbackWeb/feedBackList',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -67,12 +57,7 @@ const organizationManage = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '部门/权限',
|
title: '部门/权限',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
backApi: [
|
// backApi: [],
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/objs/FeedbackWeb/feedBackList',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -59,7 +59,7 @@ export const formConfig = (disabled: Boolean) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '排序',
|
label: '排序',
|
||||||
field: 'order',
|
field: 'sort',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: disabled,
|
disabled: disabled,
|
||||||
@@ -92,7 +92,7 @@ export const formConfig2 = (disabled2: Boolean) => {
|
|||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
label: '角色名称',
|
label: '角色名称',
|
||||||
field: 'departname',
|
field: 'zhName',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: disabled2,
|
disabled: disabled2,
|
||||||
@@ -106,14 +106,14 @@ export const formConfig2 = (disabled2: Boolean) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: '上级领导',
|
// label: '上级领导',
|
||||||
field: 'department',
|
// field: 'department',
|
||||||
component: 'NsSelect',
|
// component: 'NsSelect',
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
disabled: true,
|
// disabled: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: '节点编码',
|
label: '节点编码',
|
||||||
field: 'code',
|
field: 'code',
|
||||||
|
@@ -6,16 +6,26 @@
|
|||||||
<div class="ns-table-title">部门管理</div>
|
<div class="ns-table-title">部门管理</div>
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12" class="tree">
|
<a-col :span="12" class="tree">
|
||||||
<ns-button style="margin: 10px" type="primary" @click="addApartment">新增部门</ns-button>
|
<ns-button :disabled="disabled" style="margin: 10px" type="primary" @click="addApartment"
|
||||||
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button>
|
>新增部门</ns-button
|
||||||
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button>
|
>
|
||||||
|
<ns-button :disabled="disabled" type="primary" @click="addApartmentSon"
|
||||||
|
>新增子部门</ns-button
|
||||||
|
>
|
||||||
|
<ns-button
|
||||||
|
:disabled="disabled"
|
||||||
|
style="margin: 10px"
|
||||||
|
type="primary"
|
||||||
|
@click="deleteApartment"
|
||||||
|
>删除</ns-button
|
||||||
|
>
|
||||||
<a-tree
|
<a-tree
|
||||||
v-if="apartmentTreeData?.length"
|
v-if="apartmentTreeData?.length"
|
||||||
:tree-data="apartmentTreeData"
|
:tree-data="apartmentTreeData"
|
||||||
defaultExpandAll
|
defaultExpandAll
|
||||||
@select="SelectApartmentTree">
|
@select="SelectApartmentTree">
|
||||||
<template #title="data">
|
<template #title="data">
|
||||||
{{ data.deptInfo.deptName }}
|
{{ data.deptInfo?.deptName }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -51,12 +61,20 @@
|
|||||||
<div class="ns-table-title">角色管理</div>
|
<div class="ns-table-title">角色管理</div>
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12" class="tree">
|
<a-col :span="12" class="tree">
|
||||||
<ns-button style="margin: 10px" type="primary" @click="addUser">新增角色</ns-button>
|
<ns-button :disabled="disabled2" style="margin: 10px" type="primary" @click="addUser"
|
||||||
<ns-button type="primary" @click="addUserSon">新增子角色</ns-button>
|
>新增角色</ns-button
|
||||||
<ns-button style="margin: 10px" type="primary" @click="deleteUser">删除</ns-button>
|
>
|
||||||
<a-tree :tree-data="userTreeData" defaultExpandAll @select="SelectUserTree">
|
<ns-button :disabled="disabled2" type="primary" @click="addUserSon">新增子角色</ns-button>
|
||||||
|
<ns-button :disabled="disabled2" style="margin: 10px" type="primary" @click="deleteUser"
|
||||||
|
>删除</ns-button
|
||||||
|
>
|
||||||
|
<a-tree
|
||||||
|
v-if="userTreeData.length"
|
||||||
|
:tree-data="userTreeData"
|
||||||
|
defaultExpandAll
|
||||||
|
@select="SelectUserTree">
|
||||||
<template #title="data">
|
<template #title="data">
|
||||||
{{ data }}
|
{{ data.zhName }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -94,10 +112,11 @@
|
|||||||
import { Modal } from 'ant-design-vue';
|
import { Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { uuid } from '@antv/x6/lib/util/string/uuid';
|
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { formConfig, formConfig2 } from './config';
|
import { formConfig, formConfig2 } from './config';
|
||||||
import { department } from '/@/api/origanizemanage';
|
import { department } from '/@/api/origanizemanage';
|
||||||
|
import { permission } from '/@/api/origanizemanage';
|
||||||
|
import { NsMessage } from '/nerv-lib/component';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'AuthorityManageIndex',
|
name: 'AuthorityManageIndex',
|
||||||
@@ -119,39 +138,10 @@
|
|||||||
const formSchema2 = formConfig2(disabled2 as any);
|
const formSchema2 = formConfig2(disabled2 as any);
|
||||||
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||||
const projectId = JSON.parse(sessionStorage.getItem('userInfo')).projectId;
|
const projectId = JSON.parse(sessionStorage.getItem('userInfo')).projectId;
|
||||||
|
const userAdminTreeData = ref([]);
|
||||||
watch(ApartcheckedKeys, () => {
|
|
||||||
console.log('checkedKeys', ApartcheckedKeys.value);
|
|
||||||
});
|
|
||||||
watch(UsercheckedKeys, () => {
|
|
||||||
console.log('checkedKeys', UsercheckedKeys.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 部门树
|
|
||||||
const getDepartList = (params) => {
|
|
||||||
return http.post(department.dartList, params);
|
|
||||||
};
|
|
||||||
getDepartList({ orgId: 1 }).then((res) => {
|
|
||||||
apartmentTreeData.value = res.data;
|
|
||||||
});
|
|
||||||
const opMap: any = {
|
|
||||||
type: 'add',
|
|
||||||
fuc: () => {},
|
|
||||||
record: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
const apartmentTreeData = ref([]);
|
const apartmentTreeData = ref([]);
|
||||||
|
|
||||||
const userTreeData = ref([
|
const userTreeData = ref([]);
|
||||||
{
|
|
||||||
title: '产品总监',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{ title: '产品经理', key: '0-0-0', info: { departname: '产品经理' } },
|
|
||||||
{ title: '产品助理', key: '0-0-1', info: { departname: '产品助理' } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const apartmentAdminTreeData = [
|
const apartmentAdminTreeData = [
|
||||||
{
|
{
|
||||||
@@ -174,17 +164,40 @@
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
watch(ApartcheckedKeys, () => {
|
||||||
|
console.log('checkedKeys', ApartcheckedKeys.value);
|
||||||
|
});
|
||||||
|
watch(UsercheckedKeys, () => {
|
||||||
|
console.log('checkedKeys', UsercheckedKeys.value);
|
||||||
|
});
|
||||||
|
|
||||||
const userAdminTreeData = ref([
|
// 部门树
|
||||||
{
|
const getDepartList = (params) => {
|
||||||
title: '产品总监',
|
return http.post(department.dartList, params);
|
||||||
key: '0-0',
|
};
|
||||||
children: [
|
getDepartList({ orgId }).then((res) => {
|
||||||
{ title: '产品经理1', key: '0-0-0' },
|
apartmentTreeData.value = res.data;
|
||||||
{ title: '产品经理2', key: '0-0-1' },
|
});
|
||||||
],
|
|
||||||
},
|
const getTree = () => {
|
||||||
]);
|
getDepartList({ orgId }).then((res) => {
|
||||||
|
apartmentTreeData.value = res.data;
|
||||||
|
NsMessage.success('操作成功');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUserTree = (params = { deptId: 2 }) => {
|
||||||
|
http.post(department.queryRoleTree, params).then((res) => {
|
||||||
|
userTreeData.value = res.data;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
getUserTree({ deptId: 2 });
|
||||||
|
const opMap: any = {
|
||||||
|
type: 'add',
|
||||||
|
fuc: () => {},
|
||||||
|
record: {},
|
||||||
|
callback: null,
|
||||||
|
};
|
||||||
|
|
||||||
function fetch(api, params) {
|
function fetch(api, params) {
|
||||||
return http.post(api, params);
|
return http.post(api, params);
|
||||||
@@ -192,9 +205,14 @@
|
|||||||
|
|
||||||
const addApartment = () => {
|
const addApartment = () => {
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'add';
|
opMap.type = 'addDept';
|
||||||
|
formData.value = {};
|
||||||
opMap.fuc = (params) => {
|
opMap.fuc = (params) => {
|
||||||
fetch(department.deptSave, { ...params, orgId, projectId });
|
return http.post(department.deptSave, {
|
||||||
|
...params,
|
||||||
|
orgId,
|
||||||
|
projectId,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -204,7 +222,7 @@
|
|||||||
opMap.type = 'addson';
|
opMap.type = 'addson';
|
||||||
formData.value = {};
|
formData.value = {};
|
||||||
opMap.fuc = (params) => {
|
opMap.fuc = (params) => {
|
||||||
fetch(department.deptSave, {
|
return http.post(department.deptSave, {
|
||||||
...params,
|
...params,
|
||||||
orgId,
|
orgId,
|
||||||
projectId,
|
projectId,
|
||||||
@@ -215,30 +233,58 @@
|
|||||||
|
|
||||||
const addUser = () => {
|
const addUser = () => {
|
||||||
disabled2.value = false;
|
disabled2.value = false;
|
||||||
|
opMap.type = 'addUser';
|
||||||
|
formData.value = {};
|
||||||
|
opMap.fuc = (params) => {
|
||||||
|
delete params.roleId;
|
||||||
|
return http.post(department.addRole, {
|
||||||
|
...params,
|
||||||
|
orgId,
|
||||||
|
projectId,
|
||||||
|
enName: 'leader',
|
||||||
|
roleNote: 'wqe',
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const addUserSon = () => {
|
const addUserSon = () => {
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'addson';
|
opMap.type = 'addUserSon';
|
||||||
|
formData.value = {};
|
||||||
|
opMap.fuc = (params) => {
|
||||||
|
delete params.roleId;
|
||||||
|
delete params.proleId;
|
||||||
|
return http.post(department.addRole, {
|
||||||
|
...params,
|
||||||
|
proleId: 4,
|
||||||
|
orgId,
|
||||||
|
projectId,
|
||||||
|
enName: 'leader',
|
||||||
|
roleNote: 'wqe',
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
const deleteApartment = () => {
|
const deleteApartment = () => {
|
||||||
|
// 删除逻辑
|
||||||
|
// opMap.type = 'deptDelete';
|
||||||
|
// opMap.fuc = (params) => {
|
||||||
|
// return http.post(department.deptDel, params).then(() => {
|
||||||
|
// NsMessage.success('删除成功');
|
||||||
|
// });
|
||||||
|
// };
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '是否确认删除',
|
title: '是否确认删除',
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
content: createVNode('div', { style: 'color:red;' }, ''),
|
content: createVNode('div', { style: 'color:red;' }, ''),
|
||||||
onOk() {
|
onOk() {
|
||||||
function deepDel(data = apartmentTreeData.value[0].children) {
|
http.post(department.deptDel, { deptId: selectRef.value.deptInfo.deptId }).then(() => {
|
||||||
data.map((item, index) => {
|
getTree();
|
||||||
if (item.key === selectKey.value) data.splice(index, 1);
|
clearData();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
deepDel();
|
|
||||||
console.log(selectKey.value);
|
|
||||||
},
|
},
|
||||||
onCancel() {
|
onCancel() {
|
||||||
console.log('Cancel');
|
console.log('Cancel');
|
||||||
},
|
},
|
||||||
class: 'test',
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -248,38 +294,46 @@
|
|||||||
icon: createVNode(ExclamationCircleOutlined),
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
content: createVNode('div', { style: 'color:red;' }, ''),
|
content: createVNode('div', { style: 'color:red;' }, ''),
|
||||||
onOk() {
|
onOk() {
|
||||||
function deepDel(data = userTreeData.value[0].children) {
|
http.post(department.delRole, { roleId: selectRef2.value.roleId }).then(() => {
|
||||||
data.map((item, index) => {
|
getUserTree();
|
||||||
if (item.key === selectKey2.value) data.splice(index, 1);
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
deepDel();
|
|
||||||
console.log(selectKey2.value);
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
console.log('Cancel');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
class: 'test',
|
class: 'test',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const clearData = () => {
|
||||||
|
selectRef.value = {};
|
||||||
|
formData.value = {};
|
||||||
|
opMap.type = '';
|
||||||
|
opMap.fuc = '';
|
||||||
|
selectKey.value = '';
|
||||||
|
};
|
||||||
|
// 部门选择
|
||||||
const SelectApartmentTree = (selectedKeys: any, info: any) => {
|
const SelectApartmentTree = (selectedKeys: any, info: any) => {
|
||||||
console.log(selectedKeys, info);
|
const { selected } = info;
|
||||||
|
disabled.value = !selected;
|
||||||
disabled.value = false;
|
console.log(info, 'info');
|
||||||
console.log(selectedKeys, 'selectedKeys');
|
|
||||||
console.log(info.node.dataRef, 'info');
|
|
||||||
selectKey.value = selectedKeys[0];
|
selectKey.value = selectedKeys[0];
|
||||||
selectRef.value = info.node.dataRef;
|
selectRef.value = info.node.dataRef;
|
||||||
formData.value = info.node.dataRef.deptInfo;
|
formData.value = cloneDeep(info.node.dataRef.deptInfo);
|
||||||
|
opMap.type = 'editDpet';
|
||||||
|
opMap.fuc = (params) => {
|
||||||
|
return http.post(department.deptEdit, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 角色选择
|
||||||
const SelectUserTree = (selectedKeys: any, info: any) => {
|
const SelectUserTree = (selectedKeys: any, info: any) => {
|
||||||
disabled2.value = false;
|
const { selected } = info;
|
||||||
|
disabled2.value = !selected;
|
||||||
console.log(selectedKeys, 'selectedKeys');
|
console.log(selectedKeys, 'selectedKeys');
|
||||||
console.log(info.node.dataRef.info, 'info');
|
console.log(info, 'info');
|
||||||
selectKey2.value = selectedKeys[0];
|
selectKey2.value = selectedKeys[0];
|
||||||
selectRef2.value = info.node.dataRef;
|
selectRef2.value = info.node.dataRef;
|
||||||
formData2.value = info.node.dataRef.info;
|
formData2.value = cloneDeep(info.node.dataRef);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CancelApartment = () => {
|
const CancelApartment = () => {
|
||||||
@@ -305,27 +359,27 @@
|
|||||||
|
|
||||||
// disabled.value = !disabled.value;
|
// disabled.value = !disabled.value;
|
||||||
// console.log(formData.value.name, 'formData');
|
// console.log(formData.value.name, 'formData');
|
||||||
console.log(opMap.type, 'opMap.type');
|
console.log(opMap.type, 'ApartmentSure');
|
||||||
if (opMap.type === 'add') {
|
const opArr = ['addDept', 'editDpet'];
|
||||||
|
if (opArr.includes(opMap.type)) {
|
||||||
console.log(formRef.value, formData);
|
console.log(formRef.value, formData);
|
||||||
opMap.fuc && opMap.fuc(formData.value);
|
opMap.fuc &&
|
||||||
|
opMap.fuc(formData.value).then(() => {
|
||||||
|
getTree();
|
||||||
|
});
|
||||||
} else if (selectRef.value && opMap.type === 'addson')
|
} else if (selectRef.value && opMap.type === 'addson')
|
||||||
opMap.fuc && opMap.fuc(formData.value);
|
opMap.fuc && opMap.fuc(formData.value);
|
||||||
else {
|
else if (opMap.type === 'deptDelete') {
|
||||||
console.log('ss');
|
opMap.fuc && opMap.fuc({ ...formData.value, selectRef: selectRef.value });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const UserSure = () => {
|
const UserSure = () => {
|
||||||
disabled2.value = !disabled2.value;
|
disabled2.value = !disabled2.value;
|
||||||
opMap.fuc && opMap.fuc(formData2.value);
|
|
||||||
console.log(formData2.value, 'formData2');
|
console.log(formData2.value, 'formData2');
|
||||||
console.log(opMap.type, 'opMap.type');
|
console.log(opMap.type, 'opMap.type');
|
||||||
if (opMap.type === 'add') {
|
const typeArr = ['addUserSon', 'addUser'];
|
||||||
userTreeData.value[0].children.push({
|
if (typeArr.includes(opMap.type)) {
|
||||||
title: formData2.value.departname,
|
opMap.fuc && opMap.fuc(formData2.value);
|
||||||
key: 'a2',
|
|
||||||
info: { ...formData2.value },
|
|
||||||
});
|
|
||||||
} else if (selectRef2.value && opMap.type === 'addson')
|
} else if (selectRef2.value && opMap.type === 'addson')
|
||||||
selectRef2.value['children'] = [
|
selectRef2.value['children'] = [
|
||||||
{
|
{
|
||||||
@@ -379,16 +433,19 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
height: calc(100vh-50px);
|
height: calc(100vh-50px);
|
||||||
border-right: 5px solid rgb(229, 235, 240);
|
border-right: 5px solid rgb(229, 235, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree {
|
.tree {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 89vh;
|
height: 89vh;
|
||||||
border-right: 2px solid rgb(229, 235, 240);
|
border-right: 2px solid rgb(229, 235, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
@@ -397,6 +454,7 @@
|
|||||||
height: 50vh;
|
height: 50vh;
|
||||||
border-bottom: 5px solid rgb(229, 235, 240);
|
border-bottom: 5px solid rgb(229, 235, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ns-table-title {
|
.ns-table-title {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
@@ -408,9 +466,11 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: 2px solid rgb(229, 235, 240);
|
border-bottom: 2px solid rgb(229, 235, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
width: 2000px;
|
width: 2000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin {
|
.admin {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
height: 42px;
|
height: 42px;
|
||||||
@@ -421,6 +481,7 @@
|
|||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
width: calc(100% + 32px);
|
width: calc(100% + 32px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
@@ -98,7 +98,7 @@ const options = ref([]);
|
|||||||
|
|
||||||
const getUserPerList = (transform, params = {}) => {
|
const getUserPerList = (transform, params = {}) => {
|
||||||
return http.post(origanizemanage.queryUserPerList, { ...params }).then((res) => {
|
return http.post(origanizemanage.queryUserPerList, { ...params }).then((res) => {
|
||||||
return res.data.map((item) => {
|
return res.data?.map((item) => {
|
||||||
item = { ...item, ...transform(item) };
|
item = { ...item, ...transform(item) };
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
@@ -64,11 +64,10 @@
|
|||||||
class="drawerTable"
|
class="drawerTable"
|
||||||
:model="data"
|
:model="data"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
ref="mainRef"
|
|
||||||
rowKey="uuid" />
|
rowKey="uuid" />
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
<a-button :disabled="!dynamicDisabled" type="primary" @click="onEdit">确定</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
|
|
||||||
@@ -79,12 +78,12 @@
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@cancel="handleClose">
|
@cancel="handleClose">
|
||||||
<ns-form :schemas="formSchema2" :model="formData2" formLayout="vertical" />
|
<ns-form ref="modalFormRef" :schemas="formSchema2" :model="formData2" formLayout="vertical" />
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createVNode, defineComponent, reactive, ref } from 'vue';
|
import { computed, createVNode, defineComponent, nextTick, reactive, ref } from 'vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
@@ -100,6 +99,7 @@
|
|||||||
let formData = ref({});
|
let formData = ref({});
|
||||||
let formData2 = ref({ userRoleList: [1, 1, 3] });
|
let formData2 = ref({ userRoleList: [1, 1, 3] });
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
|
const modalFormRef = ref();
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const addformvisible = ref(false);
|
const addformvisible = ref(false);
|
||||||
const searchValue = ref<string>('');
|
const searchValue = ref<string>('');
|
||||||
@@ -112,6 +112,9 @@
|
|||||||
const userAuthList = ref([]);
|
const userAuthList = ref([]);
|
||||||
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||||
|
|
||||||
|
const dynamicDisabled = computed(() => {
|
||||||
|
return formRef.value?.validateResult && userAuthList.value?.length;
|
||||||
|
});
|
||||||
const fetch = (api, params = { orgId }) => {
|
const fetch = (api, params = { orgId }) => {
|
||||||
return http.post(api, params);
|
return http.post(api, params);
|
||||||
};
|
};
|
||||||
@@ -147,8 +150,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tableFetch = (params) => {
|
const tableFetch = (params) => {
|
||||||
|
console.log(mainRef.value);
|
||||||
|
|
||||||
tableConfig.value.params = {
|
tableConfig.value.params = {
|
||||||
...tableConfig.value.params,
|
...mainRef.value.params,
|
||||||
...params,
|
...params,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -168,6 +173,8 @@
|
|||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
formData.value = {};
|
||||||
|
userAuthList.value.splice(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onEdit = () => {
|
const onEdit = () => {
|
||||||
@@ -184,19 +191,21 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
console.log(formData2.value, 'formData2.value');
|
console.log(casData.value, 'formData2.value');
|
||||||
if (casData.value?.length !== 3) {
|
if (casData.value?.length !== 3) {
|
||||||
NsMessage.error('未选择角色');
|
NsMessage.error('未选择角色');
|
||||||
}
|
}
|
||||||
|
const str = casData.value.map((item) => item?.label).join('/');
|
||||||
userAuthList.value.push({
|
userAuthList.value.push({
|
||||||
userAuthList: cloneDeep(casData.value),
|
deptRoleInfoList: str,
|
||||||
roleId: casData.value[2].value,
|
roleId: casData.value[2].value,
|
||||||
roleName: casData.value[2].label,
|
roleName: casData.value[2].label,
|
||||||
});
|
} as never);
|
||||||
addformvisible.value = false;
|
handleClose();
|
||||||
};
|
};
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
addformvisible.value = false;
|
addformvisible.value = false;
|
||||||
|
modalFormRef.value.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableConfig = ref({
|
const tableConfig = ref({
|
||||||
@@ -213,9 +222,10 @@
|
|||||||
handle: () => {
|
handle: () => {
|
||||||
opMap.type = 'add';
|
opMap.type = 'add';
|
||||||
opMap.fuc = (formData: any) => {
|
opMap.fuc = (formData: any) => {
|
||||||
console.log(formData, 'formData');
|
|
||||||
http.post(origanizemanage.addUser, formData).then(() => {
|
http.post(origanizemanage.addUser, formData).then(() => {
|
||||||
|
mainRef.value?.nsTableRef.reload();
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
NsMessage.success('操作成功');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
@@ -297,11 +307,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '部门/角色',
|
title: '部门/角色',
|
||||||
dataIndex: 'deptRoleInfoList',
|
dataIndex: 'userRoleInfos',
|
||||||
customRender: ({ value }) => {
|
customRender: ({ value }) => {
|
||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
return createVNode('div', {}, [
|
return createVNode('div', {}, [
|
||||||
createVNode('span', {}, value[0]),
|
createVNode('span', {}, value[0]?.deptRoleInfoList),
|
||||||
value.length > 1 &&
|
value.length > 1 &&
|
||||||
createVNode(
|
createVNode(
|
||||||
'a',
|
'a',
|
||||||
@@ -309,7 +319,9 @@
|
|||||||
onClick: () =>
|
onClick: () =>
|
||||||
NsModal.info({
|
NsModal.info({
|
||||||
icon: null,
|
icon: null,
|
||||||
content: createVNode('div', { innerHTML: value.join('<br>') }),
|
content: createVNode('div', {
|
||||||
|
innerHTML: value.map((item) => item?.deptRoleInfoList).join('<br>'),
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
`+${value.length}`,
|
`+${value.length}`,
|
||||||
@@ -331,14 +343,18 @@
|
|||||||
name: 'RoleTypeEdit',
|
name: 'RoleTypeEdit',
|
||||||
// dynamicParams: 'uuid',
|
// dynamicParams: 'uuid',
|
||||||
handle: (record: any) => {
|
handle: (record: any) => {
|
||||||
console.log(record, 'record');
|
userAuthList.value.splice(0);
|
||||||
|
setTimeout(() => {
|
||||||
formData.value = record;
|
formData.value = record;
|
||||||
|
userAuthList.value.push(...record.userRoleInfos);
|
||||||
|
}, 10);
|
||||||
opMap.type = 'edit';
|
opMap.type = 'edit';
|
||||||
opMap.fuc = (formData: any) => {
|
opMap.fuc = (formData: any) => {
|
||||||
Object.assign(
|
http.post(origanizemanage.editUser, formData).then(() => {
|
||||||
mockData.value.filter((item) => item.id === record.id)[0],
|
mainRef.value?.nsTableRef.reload();
|
||||||
formData,
|
visible.value = false;
|
||||||
);
|
NsMessage.success('操作成功');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
},
|
},
|
||||||
@@ -449,11 +465,6 @@
|
|||||||
name: 'RoleTypeAdd',
|
name: 'RoleTypeAdd',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handle: () => {
|
handle: () => {
|
||||||
// opMap.type = 'add';
|
|
||||||
// opMap.fuc = (formData2: any) => {
|
|
||||||
// console.log(formData2, 'formData2');
|
|
||||||
// userAuthList.value.push(cloneDeep(formData2));
|
|
||||||
// };
|
|
||||||
addformvisible.value = true;
|
addformvisible.value = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -464,11 +475,11 @@
|
|||||||
dataIndex: 'userRoleList',
|
dataIndex: 'userRoleList',
|
||||||
customRender: ({ record }) => {
|
customRender: ({ record }) => {
|
||||||
if (record) {
|
if (record) {
|
||||||
const res = record.userAuthList.reduce((pre, cur) => {
|
// const res = record.userAuthList.reduce((pre, cur) => {
|
||||||
pre.push(cur.label);
|
// pre.push(cur.label);
|
||||||
return pre;
|
// return pre;
|
||||||
}, []);
|
// }, []);
|
||||||
return res.join('/');
|
return record.deptRoleInfoList;
|
||||||
}
|
}
|
||||||
return '-';
|
return '-';
|
||||||
},
|
},
|
||||||
@@ -537,6 +548,8 @@
|
|||||||
onSearch2,
|
onSearch2,
|
||||||
handleOk,
|
handleOk,
|
||||||
handleClose,
|
handleClose,
|
||||||
|
dynamicDisabled,
|
||||||
|
modalFormRef,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
|
|
||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
import { getComponent } from '/nerv-base/router/helper/view-helper';
|
import { getComponent } from '/nerv-base/router/helper/view-helper';
|
||||||
import { ModuleMenu } from '/nerv-base/router/types';
|
import { ModuleMenu } from '/nerv-base/router/types';
|
||||||
import { RouteMenu, sortMenu } from '/nerv-base/router/helper/menu-helper';
|
import { RouteMenu, sortMenu } from '/nerv-base/router/helper/menu-helper';
|
||||||
import { isNumber } from 'lodash-es';
|
import { isNumber } from 'lodash-es';
|
||||||
|
const transForm = (data) => {
|
||||||
|
return JSON.stringify(data || []);
|
||||||
|
};
|
||||||
export function transformRouteToMenu(route: RouteRecordRaw, parentCode = '') {
|
export function transformRouteToMenu(route: RouteRecordRaw, parentCode = '') {
|
||||||
const { children, ...extend } = route;
|
const { children, ...extend } = route;
|
||||||
if (extend.component) {
|
if (extend.component) {
|
||||||
@@ -41,12 +41,12 @@ export function transformRouteToMenu(route: RouteRecordRaw, parentCode = '') {
|
|||||||
function dealBackApi(e: any) {
|
function dealBackApi(e: any) {
|
||||||
if (e.meta?.hideChildren) {
|
if (e.meta?.hideChildren) {
|
||||||
if (e.children !== undefined) {
|
if (e.children !== undefined) {
|
||||||
return e.children[0].meta?.backApi || [];
|
return transForm(e.children[0].meta?.backApi);
|
||||||
} else {
|
} else {
|
||||||
return e.meta?.backApi ? e.meta?.backApi : [];
|
return transForm(e.meta?.backApi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return e.meta?.backApi || [];
|
return transForm(e.meta?.backApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dealOp(e: any) {
|
function dealOp(e: any) {
|
||||||
|
@@ -87,12 +87,17 @@ export class NSAxios {
|
|||||||
// config.url = newUrl;
|
// config.url = newUrl;
|
||||||
return config;
|
return config;
|
||||||
}, undefined);
|
}, undefined);
|
||||||
|
const errCodeArr = [13, 1];
|
||||||
this.instance.interceptors.response.use(
|
this.instance.interceptors.response.use(
|
||||||
(res: AxiosResponse) => {
|
(res: AxiosResponse) => {
|
||||||
console.log('success', res);
|
console.log('success', res);
|
||||||
// todo
|
// todo
|
||||||
const code = res?.data?.retcode;
|
const code = res?.data?.retcode;
|
||||||
|
const msg = res?.data?.msg;
|
||||||
|
if (errCodeArr.includes(code)) {
|
||||||
|
NsMessage.error({ content: msg, key: this.errorMsgKey });
|
||||||
|
return Promise.reject(res);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
|
Reference in New Issue
Block a user