Browse Source

feat: 部门样式调整

main
xuziqiang 3 months ago
parent
commit
b55ab2353e
  1. 8
      hx-ai-intelligent/src/icon/actionMore.svg
  2. 4
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  3. 4
      hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts
  4. 356
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  5. 2
      lib/component/table/table.vue
  6. 1
      lib/util/http/axios.ts

8
hx-ai-intelligent/src/icon/actionMore.svg

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="2.5601806640625" height="11.380615234375" viewBox="0 0 2.5601806640625 11.380615234375" fill="none">
<path d="M1.26462 2.52904C1.72366 2.54024 2.15274 2.30174 2.38556 1.90594C2.61838 1.51015 2.61838 1.01924 2.38556 0.623459C2.15274 0.227661 1.72366 -0.0108337 1.26462 0.00037384C0.578369 0.0171204 0.0307617 0.578232 0.0307617 1.26469C0.0307617 1.95116 0.578369 2.51227 1.26462 2.52904Z" fill="#5A5A68" >
</path>
<path d="M0 5.69049C0 6.38898 0.566193 6.9552 1.26471 6.9552C1.96317 6.9552 2.52936 6.38898 2.52936 5.69049C2.52936 4.99204 1.96317 4.42578 1.26471 4.42578C0.566193 4.42578 0 4.99204 0 5.69049Z" fill="#5A5A68" >
</path>
<path d="M1.26471 11.3805C1.9632 11.3805 2.52942 10.8143 2.52942 10.1158C2.52942 9.4173 1.9632 8.85107 1.26471 8.85107C0.566223 8.85107 0 9.4173 0 10.1158C0 10.8143 0.566223 11.3805 1.26471 11.3805Z" fill="#5A5A68" >
</path>
</svg>

After

Width:  |  Height:  |  Size: 961 B

4
hx-ai-intelligent/src/view/equipmentManage/group/config.ts

@ -48,6 +48,10 @@ export const tableConfig = (el, elGroup, elFormula) => {
value: mockData.value, value: mockData.value,
treeConfig: { treeConfig: {
defaultExpandAll: true, defaultExpandAll: true,
header: {
icon: 'orgLink',
title: '分组管理',
},
api: () => { api: () => {
return new Promise((resolve) => { return new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {

4
hx-ai-intelligent/src/view/equipmentManage/ledger/config.ts

@ -5,6 +5,10 @@ export const tableConfig = {
// api: '/carbon_emission/device/getDeviceList', // api: '/carbon_emission/device/getDeviceList',
value: data.dataSource, value: data.dataSource,
treeConfig: { treeConfig: {
header: {
icon: 'orgLink',
title: '设备类别',
},
defaultExpandAll: true, defaultExpandAll: true,
api: () => { api: () => {
return new Promise((resolve) => { return new Promise((resolve) => {

356
hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue

@ -3,110 +3,151 @@
<template> <template>
<div class="main"> <div class="main">
<div class="left"> <div class="left">
<div class="ns-table-title">部门管理</div> <div class="ns-table-title ns-title-extra-box">部门管理</div>
<a-row> <a-row>
<a-col :span="12" class="tree"> <a-col :span="8" class="tree">
<ns-button style="margin: 10px" type="primary" @click="pipe(addApartment)">
新增部门
</ns-button>
<ns-button type="primary" @click="pipe(addApartmentSon, true)">新增子部门</ns-button>
<ns-button style="margin: 10px" type="primary" @click="pipe(deleteDept, true)">
删除
</ns-button>
<a-tree <a-tree
ref="treeRef"
v-if="deptTreeData?.length" v-if="deptTreeData?.length"
:tree-data="deptTreeData" :tree-data="deptTreeData"
:selectedKeys="deptTreeSelectedKeys" :selectedKeys="deptTreeSelectedKeys"
blockNode
defaultExpandAll defaultExpandAll
@select="SelectApartmentTree"> @select="SelectApartmentTree">
<template #title="data"> <template #title="data">
{{ data.deptInfo?.deptName }} <div style="display: flex; justify-content: space-between; align-items: center">
<span>{{ data.deptInfo?.deptName }}</span>
<a-dropdown>
<ns-icon name="actionMore" size="14" class="actionMore" />
<template #overlay>
<a-menu>
<a-menu-item
v-for="(action, index) in filterAction(data, dropActions)"
:key="index"
@click="action.func(data)">
<span>{{ action.title }}</span>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</div>
</template> </template>
</a-tree> </a-tree>
<a-empty style="margin-top: 120px" v-else />
</a-col> </a-col>
<a-col :span="12" class="list"> <a-col :span="16" class="list">
<a-tabs v-model:activeKey="activeKey"> <div class="pane">
<a-tab-pane :key="1" tab="部门信息"> <a-tabs v-model:activeKey="activeKey">
<ns-form <a-tab-pane :key="1" tab="部门信息">
ref="formRef" <ns-form
:schemas="formSchema" ref="formRef"
:wrapperCol="{ span: 18 }" :schemas="formSchema"
:model="formData" :wrapperCol="{ span: 19 }"
formLayout="vertical" :labelCol="{ span: 5 }"
class="form" /> :model="formData"
</a-tab-pane> formLayout="vertical"
<a-tab-pane :key="2" :disabled="selectRef?.hasOwnProperty('orgInfo')" tab="部门权限"> class="form" />
<a-tree </a-tab-pane>
v-if="deptPermissionTreeData?.length" <a-tab-pane :key="2" :disabled="selectRef?.hasOwnProperty('orgInfo')" tab="部门权限">
:tree-data="deptPermissionTreeData" <a-tree
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }" v-if="deptPermissionTreeData?.length"
v-model:checkedKeys="deptcheckedKeys" :tree-data="deptPermissionTreeData"
checkable :fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
:selectable="false" v-model:checkedKeys="deptcheckedKeys"
defaultExpandAll checkable
@check="deptCheck"> :selectable="false"
<template #title="data"> {{ data.label }}</template> defaultExpandAll
</a-tree> @check="deptCheck">
</a-tab-pane> <template #title="data"> {{ data.label }}</template>
</a-tabs> </a-tree>
<ns-button style="margin: 16px" type="primary" @click="CancelApartment">取消 </ns-button> <a-empty style="margin-top: 120px" v-else />
<ns-button v-show="disabled" type="primary" @click="pipe(deptEdit, true, false)" </a-tab-pane>
>编辑</ns-button </a-tabs>
> <a-space v-if="activeKey === 1 || deptPermissionTreeData?.length">
<ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button> <ns-button type="primary" @click="CancelApartment">取消 </ns-button>
<ns-button v-show="disabled" type="primary" @click="pipe(deptEdit, true, false)">
编辑
</ns-button>
<ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button>
</a-space>
</div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
<div class="right"> <div class="right">
<div class="ns-table-title">角色管理</div> <div class="ns-table-title ns-title-extra-box">角色管理</div>
<a-row> <a-row>
<a-col :span="12" class="tree"> <a-col :span="8" class="tree">
<ns-button style="margin: 10px" type="primary" @click="rolePipe(addUser, true)"> <a-space wrap style="margin-bottom: 16px">
新增角色 <ns-button type="primary" @click="rolePipe(addUser, true)"> 新增角色 </ns-button>
</ns-button> <ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
<ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button> <ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button>
<ns-button style="margin: 10px" type="primary" @click="rolePipe(deleteUser)"> </a-space>
删除
</ns-button>
<a-tree <a-tree
v-if="roleTreeData.length" v-if="roleTreeData.length"
:tree-data="roleTreeData" :tree-data="roleTreeData"
:selectedKeys="roleTreeSelectedKeys" :selectedKeys="roleTreeSelectedKeys"
blockNode
defaultExpandAll defaultExpandAll
@select="SelectUserTree"> @select="SelectUserTree">
<template #title="data"> <template #title="data">
{{ data.zhName }} <div style="display: flex; justify-content: space-between; align-items: center">
<span> {{ data.zhName }}</span>
<!-- <a-dropdown>
<ns-icon name="actionMore" size="14" class="actionMore" />
<template #overlay>
<a-menu>
<a-menu-item
v-for="(action, index) in dropRoleActions"
:key="index"
@click="action.func(data)">
<span>{{ action.title }}</span>
</a-menu-item>
</a-menu>
</template>
</a-dropdown> -->
</div>
</template> </template>
</a-tree> </a-tree>
<a-empty style="margin-top: 120px" v-else />
</a-col> </a-col>
<a-col :span="12" class="list"> <a-col :span="16" class="list">
<a-tabs v-model:activeKey="roleActiveKey"> <div class="pane">
<a-tab-pane :key="1" tab="角色信息"> <a-tabs v-model:activeKey="roleActiveKey">
<ns-form <a-tab-pane :key="1" tab="角色信息">
ref="formRoleRef" <ns-form
:schemas="formSchema2" ref="formRoleRef"
:model="roleFormData" :schemas="formSchema2"
:wrapperCol="{ span: 18 }" :model="roleFormData"
formLayout="vertical" :labelCol="{ span: 5 }"
class="form" /> :wrapperCol="{ span: 19 }"
</a-tab-pane> formLayout="vertical"
<a-tab-pane :key="2" tab="角色权限"> class="form" />
<a-tree </a-tab-pane>
v-if="rolePermissionTreeData?.length" <a-tab-pane :key="2" tab="角色权限">
:tree-data="rolePermissionTreeData" <a-tree
v-model:checkedKeys="roleCheckedKeys" v-if="rolePermissionTreeData?.length"
defaultExpandAll :tree-data="rolePermissionTreeData"
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }" v-model:checkedKeys="roleCheckedKeys"
:selectable="false" defaultExpandAll
checkable :fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
@check="roleCheck" /> :selectable="false"
</a-tab-pane> checkable
</a-tabs> @check="roleCheck" />
<ns-button style="margin: 16px" type="primary" @click="CancelUser">取消</ns-button> <a-empty style="margin-top: 120px" v-else />
<ns-button v-show="roleDisabled" type="primary" @click="rolePipe(roleEdit, false, false)"> </a-tab-pane>
编辑 </a-tabs>
</ns-button> <a-space v-if="activeKey === 1 || rolePermissionTreeData?.length">
<ns-button v-show="!roleDisabled" type="primary" @click="roleSure"> 确定 </ns-button> <ns-button type="primary" @click="CancelUser">取消</ns-button>
<ns-button
v-show="roleDisabled"
type="primary"
@click="rolePipe(roleEdit, false, false)">
编辑
</ns-button>
<ns-button v-show="!roleDisabled" type="primary" @click="roleSure"> 确定 </ns-button>
</a-space>
</div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
@ -174,8 +215,6 @@
/**操作拦截 */ /**操作拦截 */
const pipe = (func: Function, flag = false, toggle = true) => { const pipe = (func: Function, flag = false, toggle = true) => {
console.log(selectRef.value);
if (toggle) activeKey.value = 1; if (toggle) activeKey.value = 1;
if (flag) { if (flag) {
// //
@ -237,6 +276,14 @@
}; };
getPermissionTree({ projectId, orgId }); getPermissionTree({ projectId, orgId });
//
const initDept = () => {
if (!deptTreeData.value?.length || !deptTreeData.value[0]?.children?.length) return;
const info = {
node: { key: '0-0-0', dataRef: { deptInfo: deptTreeData.value[0]?.children[0].deptInfo } },
};
SelectApartmentTree(['0-0-0'], info);
};
// //
const getDepartList = (params) => { const getDepartList = (params) => {
@ -255,6 +302,7 @@
}; };
getDepartList({ orgId }).then((res) => { getDepartList({ orgId }).then((res) => {
deptTreeData.value = res; deptTreeData.value = res;
initDept();
}); });
// //
@ -267,14 +315,24 @@
// //
const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => { const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => {
http.post(department.queryRoleTree, params).then((res) => { return http.post(department.queryRoleTree, params).then((res) => {
roleTreeData.value = res.data; roleTreeData.value = res.data;
}); });
}; };
// //
watchEffect(() => { watchEffect(() => {
if (selectRef.value) { if (selectRef.value) {
getUserTree(); getUserTree().then(() => {
return;
if (!roleTreeData.value?.length) {
selectRoleRef.value = {};
roleFormData.value = {};
}
const info = {
node: { key: '0-0', dataRef: { ...roleTreeData.value[0] } },
};
SelectUserTree(['0-0'], info);
});
} }
}); });
@ -285,26 +343,28 @@
callback: null, callback: null,
}; };
const addApartment = () => { const addApartment = (data) => {
const { deptInfo } = data;
disabled.value = false; disabled.value = false;
opMap.type = 'addDept'; opMap.type = 'addDept';
formData.value = {}; formData.value = {};
let sourceOrgId = ''; let sourceOrgId = '';
if (!currentOrgRef.value.own) { if (deptInfo.orgId !== orgId) {
//
sourceOrgId = orgId; sourceOrgId = orgId;
} }
opMap.fuc = (params) => { opMap.fuc = (params) => {
return formRef.value.triggerSubmit().then(() => { return formRef.value.triggerSubmit().then(() => {
return http.post(department.deptSave, { return http.post(department.deptSave, {
...params, ...params,
orgId: selectRef.value.deptInfo?.orgId, orgId: deptInfo?.orgId,
sourceOrgId, sourceOrgId,
projectId, projectId,
orgName, orgName,
}); });
}); });
}; };
return;
}; };
const addApartmentSon = () => { const addApartmentSon = () => {
@ -365,17 +425,22 @@
}); });
}; };
}; };
const deleteDept = () => { const deleteDept = (data) => {
console.log(data);
// //
Modal.confirm({ Modal.confirm({
title: '是否确认删除', title: '是否确认删除',
onOk() { onOk() {
http.post(department.deptDel, { deptId: selectRef.value.deptInfo.deptId }).then(() => { http.post(department.deptDel, { deptId: data.deptInfo.deptId }).then(() => {
getTree(); getTree();
clearDeptData(); clearDeptData();
// select // select
deptTreeSelectedKeys.value = []; if (data.selected) {
selectRef.value = ''; //
deptTreeSelectedKeys.value = [];
selectRef.value = '';
}
}); });
}, },
onCancel() { onCancel() {
@ -647,55 +712,116 @@
rolePermission(); rolePermission();
} }
}; };
// dropdown
const dropActions = ref([
{ title: '新增部门', func: addApartment, key: 'addDept' },
{ title: '新增子部门', func: addApartmentSon, key: 'addDeptSon' },
{ title: '删除', func: deleteDept, key: 'deleteDept' },
// { title: '', func: addUser, key: 'addUser' },
]);
const filterAction = (data, actions) => {
if (data.hasOwnProperty('orgInfo')) {
//
return actions.filter(({ key }) => key === 'addDept');
}
return actions;
};
// dropdown
const dropRoleActions = ref([
{ title: '新增角色', func: addUser, key: 'addUser' },
{ title: '新增子角色', func: addUserSon, key: 'addUserSon' },
{ title: '删除', func: deleteUser, key: 'deleteUser' },
]);
const treeRef = ref();
console.log(treeRef);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep(.ns-form::after) {
display: none;
}
.actionMore {
display: none;
}
:deep(.ant-row) {
height: calc(100% - 44px);
}
:deep(.ant-tree-node-content-wrapper) {
&:hover {
.actionMore {
display: block;
}
}
}
:deep(.ant-tabs-nav-wrap) {
padding: 0;
}
:deep(.ant-tabs-tabpane) { :deep(.ant-tabs-tabpane) {
padding: 20px; padding-top: @ns-gap;
.form { .form {
margin: 0 !important; margin: 0 !important;
} }
} }
:deep(.ant-space) {
justify-content: flex-end;
}
.main { .main {
display: flex; display: flex;
flex: 1; height: 100%;
background-color: @ns-content-bg;
> div:first-child {
margin-right: @ns-gap;
}
} }
.left { .left,
.right {
width: 50%; width: 50%;
height: calc(100vh-50px); height: 100%;
border-right: 5px solid rgb(229, 235, 240); padding: @ns-gap;
background-color: @white;
border-radius: @ns-border-radius;
box-shadow: @ns-content-box-shadow;
} }
.tree { .tree {
width: 400px; height: 100%;
height: 89vh; overflow: hidden;
border-right: 2px solid rgb(229, 235, 240); overflow-y: auto;
border-radius: @ns-border-radius;
border: 1px solid #ebeef5;
padding: 16px;
} }
.list {
.right { padding-left: @ns-gap;
width: 50%; height: 100%;
} .pane {
padding-left: @ns-gap;
.top { border-left: 1px solid #ebeef5;
height: 50vh; height: 100%;
border-bottom: 5px solid rgb(229, 235, 240); display: flex;
flex-direction: column;
justify-content: space-between;
:deep(.ant-tabs-content) {
height: 100%;
.ant-tree {
height: 100%;
overflow-y: scroll;
}
}
}
} }
.ns-table-title { .ns-table-title {
text-align: left; text-align: left;
height: 46px; font-size: 16px;
line-height: 46px;
font-size: 18px;
font-weight: bold; font-weight: bold;
user-select: text; user-select: text;
padding-left: 16px;
width: 100%; width: 100%;
border-bottom: 2px solid rgb(229, 235, 240); margin-bottom: @ns-gap;
}
.table {
width: 2000px;
} }
.admin { .admin {

2
lib/component/table/table.vue

@ -667,7 +667,7 @@
display: flex; display: flex;
.ns-part-tree { .ns-part-tree {
width: 300px; width: 300px;
padding: 16px; // padding: 16px;
overflow-y: auto; overflow-y: auto;
} }
.ns-part-table { .ns-part-table {

1
lib/util/http/axios.ts

@ -78,6 +78,7 @@ export class NSAxios {
const errCodeMap = new Map<number, any>([ const errCodeMap = new Map<number, any>([
[13, ''], [13, ''],
[1, ''], [1, ''],
[11, ''],
[3005, ''], [3005, ''],
[10086, () => routerConfig.logout()], [10086, () => routerConfig.logout()],
]); ]);

Loading…
Cancel
Save