Browse Source

feat: 权限逻辑处理

main
xuziqiang 5 months ago
parent
commit
bc80a22180
  1. 32
      hx-ai-intelligent/src/config/app.config.ts
  2. 2
      hx-ai-intelligent/src/router/equipmentControl.ts
  3. 2
      hx-ai-intelligent/src/router/equipmentManage.ts
  4. 2
      hx-ai-intelligent/src/router/home.ts
  5. 16
      hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts
  6. 347
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  7. 21
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  8. 2
      hx-ai-intelligent/vite.config.ts
  9. 4
      hx-op/src/config/app.config.ts
  10. 1
      lib/component/form/form/form-item.vue
  11. 4
      lib/saas/store/modules/app-config.ts
  12. 9
      lib/saas/store/modules/route.ts
  13. 1
      lib/saas/view/system/login.vue

32
hx-ai-intelligent/src/config/app.config.ts

@ -1,9 +1,9 @@
/** @format */ import { userInfo, userResource } from './../../../hx-op/src/api/user';
import { dateUtil } from '/nerv-lib/util/date-util';
import mockResource from './resource.json';
import { http } from '/nerv-lib/saas'; import { http } from '/nerv-lib/saas';
import { ref } from 'vue';
import { permission } from '/@/api/origanizemanage'; import { permission } from '/@/api/origanizemanage';
import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config';
import { authorizationService } from '/nerv-base/store/modules/authorization-service';
import { isEmpty } from 'lodash-es';
// const { permissionVos } = sessionStorage.getItem('userInfo'); // const { permissionVos } = sessionStorage.getItem('userInfo');
// ? JSON.parse(sessionStorage.getItem('userInfo')!) // ? JSON.parse(sessionStorage.getItem('userInfo')!)
@ -59,7 +59,13 @@ export const appConfig = {
api: '/carbon-smart/user/login/logInInfo', api: '/carbon-smart/user/login/logInInfo',
placeholder: '请选择', placeholder: '请选择',
autoSelectFirst: true, autoSelectFirst: true,
onChange: (cur) => { onChange: async (cur, record) => {
console.log(cur, record);
const configStore = appConfigStore();
const useAuthorization = authorizationService();
const res = await configStore.userResource(record);
useAuthorization.updateUserResource(res.data);
// value.value = cur; // value.value = cur;
}, },
resultField: 'data.linkList', resultField: 'data.linkList',
@ -73,9 +79,15 @@ export const appConfig = {
userLoginApi: (params) => { userLoginApi: (params) => {
return http.post('/carbon-smart/user/login', { ...params }); return http.post('/carbon-smart/user/login', { ...params });
}, },
userResourceApi: () => { userResourceApi: (params) => {
return http.post('/carbon-smart/user/login/logInInfo').then((res) => { console.log(params, 'userResource');
return { data: res.data.permissionVos };
const userInfo = JSON.parse(sessionStorage.getItem('userInfo')!);
const ownOrgInfo = userInfo.linkList?.filter(({ isOwn }) => isOwn)[0];
return http
.post('/carbon-smart/user/login/logInPermission', !isEmpty(params) ? params : ownOrgInfo)
.then((res) => {
return res;
}); });
}, },
userInfoApi: () => { userInfoApi: () => {
@ -83,8 +95,8 @@ export const appConfig = {
const info = res.data; const info = res.data;
const trD = transform(info, { const trD = transform(info, {
accountCode: 'userId', accountCode: 'userId',
accountName: 'realName', accountName: 'accountNo',
accountRealName: 'realName', accountRealName: 'accountNo',
orgId: 'orgId', orgId: 'orgId',
orgName: 'orgName', orgName: 'orgName',
projectId: 'projectId', projectId: 'projectId',

2
hx-ai-intelligent/src/router/equipmentControl.ts

@ -3,7 +3,7 @@ const equipmentControl = {
path: '/equipmentControl', path: '/equipmentControl',
name: 'EquipmentControl', name: 'EquipmentControl',
meta: { title: '设备群控', icon: 'dicizhishou', index: 4 }, meta: { title: '设备群控', icon: 'dicizhishou', index: 4 },
redirect: { name: 'homeIndex' }, redirect: { name: 'LightManage' },
children: [ children: [
{ {
path: 'lightManage', path: 'lightManage',

2
hx-ai-intelligent/src/router/equipmentManage.ts

@ -3,7 +3,7 @@ const equipment = {
path: '/equipmentManage', path: '/equipmentManage',
name: 'EquipmentManage', name: 'EquipmentManage',
meta: { title: '设备管理', icon: 'dicizhishou', index: 1 }, meta: { title: '设备管理', icon: 'dicizhishou', index: 1 },
redirect: { name: 'homeIndex' }, redirect: { name: 'Ledger' },
children: [ children: [
{ {
path: 'ledger', path: 'ledger',

2
hx-ai-intelligent/src/router/home.ts

@ -10,7 +10,7 @@ const home = {
name: 'homeIndex', name: 'homeIndex',
meta: { title: '首页', hideChildren: true, icon: 'dicizhishou' }, meta: { title: '首页', hideChildren: true, icon: 'dicizhishou' },
component: () => import('/@/view/developing.vue'), component: () => import('/@/view/developing.vue'),
redirect: { name: 'homeIndex' }, // redirect: { name: 'homeIndex' },
// children: [ // children: [
// { // {
// path: 'index', // path: 'index',

16
hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts

@ -2,11 +2,6 @@ import { ref } from 'vue';
export const formConfig = (disabled: Boolean) => { export const formConfig = (disabled: Boolean) => {
return ref([ return ref([
{
field: 'field111',
component: 'NsChildForm',
componentProps: {
schemas: [
{ label: '企业名称', field: 'orgName', show: false }, { label: '企业名称', field: 'orgName', show: false },
{ {
label: '部门名称', label: '部门名称',
@ -78,19 +73,11 @@ export const formConfig = (disabled: Boolean) => {
maxLength: 300, maxLength: 300,
}, },
}, },
],
},
},
]); ]);
}; };
export const formConfig2 = (disabled2: Boolean) => { export const formConfig2 = (disabled2: Boolean) => {
return ref([ return ref([
{
field: 'field111',
component: 'NsChildForm',
componentProps: {
schemas: [
{ label: '部门名称', field: 'deptName', show: false }, { label: '部门名称', field: 'deptName', show: false },
{ {
@ -162,8 +149,5 @@ export const formConfig2 = (disabled2: Boolean) => {
maxLength: 300, maxLength: 300,
}, },
}, },
],
},
},
]); ]);
}; };

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

@ -6,9 +6,13 @@
<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 style="margin: 10px" type="primary" @click="pipe(addApartment)">
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button> 新增部门
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button> </ns-button>
<ns-button type="primary" @click="pipe(addApartmentSon, true)">新增子部门</ns-button>
<ns-button style="margin: 10px" type="primary" @click="pipe(deleteDept)">
删除
</ns-button>
<a-tree <a-tree
v-if="apartmentTreeData?.length" v-if="apartmentTreeData?.length"
:tree-data="apartmentTreeData" :tree-data="apartmentTreeData"
@ -22,20 +26,16 @@
</a-col> </a-col>
<a-col :span="12" class="list"> <a-col :span="12" class="list">
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="部门信息"> <a-tab-pane :key="1" tab="部门信息">
<ns-form <ns-form
ref="formRef" ref="formRef"
:schemas="formSchema" :schemas="formSchema"
:wrapperCol="{ span: 18 }"
:model="formData" :model="formData"
formLayout="vertical" formLayout="vertical"
class="form" /> class="form" />
<!-- <ns-button style="margin: 16px" type="primary" @click="CancelApartment"
>取消
</ns-button>
<ns-button v-show="disabled" type="primary" @click="deptEdit">编辑</ns-button>
<ns-button v-show="!disabled" type="primary" @click="ApartmentSure">确定</ns-button> -->
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" :disabled="!selectKey?.length" tab="部门权限"> <a-tab-pane :key="2" tab="部门权限">
<a-tree <a-tree
:tree-data="apartmentAdminTreeData" :tree-data="apartmentAdminTreeData"
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }" :fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
@ -43,18 +43,14 @@
checkable checkable
:selectable="false" :selectable="false"
defaultExpandAll defaultExpandAll
@check="deptCheck" @check="deptCheck">
@select="ApartmentSelect">
<template #title="data"> {{ data.label }}</template> <template #title="data"> {{ data.label }}</template>
</a-tree> </a-tree>
<ns-button style="margin-left: 16px" type="primary" @click="apartmentPermission"
>确定
</ns-button>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<ns-button style="margin: 16px" type="primary" @click="CancelApartment">取消 </ns-button> <ns-button style="margin: 16px" type="primary" @click="CancelApartment">取消 </ns-button>
<ns-button v-show="disabled" type="primary" @click="deptEdit">编辑</ns-button> <ns-button v-show="disabled" type="primary" @click="pipe(deptEdit)">编辑</ns-button>
<ns-button v-show="!disabled" type="primary" @click="ApartmentSure">确定</ns-button> <ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
@ -62,17 +58,13 @@
<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 <ns-button style="margin: 10px" type="primary" @click="rolePipe(addUser, true)">
:disabled="!selectKey?.length" 新增角色
style="margin: 10px" </ns-button>
type="primary" <ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
@click="addUser" <ns-button style="margin: 10px" type="primary" @click="rolePipe(deleteUser)">
>新增角色</ns-button 删除
> </ns-button>
<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 <a-tree
v-if="userTreeData.length" v-if="userTreeData.length"
:tree-data="userTreeData" :tree-data="userTreeData"
@ -84,18 +76,17 @@
</a-tree> </a-tree>
</a-col> </a-col>
<a-col :span="12" class="list"> <a-col :span="12" class="list">
<a-tabs v-model:activeKey="activeKey2"> <a-tabs v-model:activeKey="roleActiveKey">
<a-tab-pane key="1" tab="角色信息"> <a-tab-pane :key="1" tab="角色信息">
<ns-form <ns-form
ref="formRoleRef"
:schemas="formSchema2" :schemas="formSchema2"
:model="formData2" :model="roleFormData"
:wrapperCol="{ span: 18 }"
formLayout="vertical" formLayout="vertical"
class="form" /> class="form" />
<ns-button style="margin: 16px" type="primary" @click="CancelUser">取消</ns-button>
<ns-button v-show="disabled2" type="primary" @click="roleEdit"> 编辑 </ns-button>
<ns-button v-show="!disabled2" type="primary" @click="UserSure"> 确定 </ns-button>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" :disabled="!selectKey2?.length" tab="角色权限"> <a-tab-pane :key="2" tab="角色权限">
<a-tree <a-tree
:tree-data="userAdminTreeData" :tree-data="userAdminTreeData"
v-model:checkedKeys="UsercheckedKeys" v-model:checkedKeys="UsercheckedKeys"
@ -103,20 +94,19 @@
:fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }" :fieldNames="{ children: 'menus', title: 'label', key: 'permissionId' }"
:selectable="false" :selectable="false"
checkable checkable
@check="roleCheck" @check="roleCheck" />
@select="UserSelect" />
<ns-button style="margin: 16px" type="primary" @click="rolePermission">
确定
</ns-button>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<ns-button style="margin: 16px" type="primary" @click="CancelUser">取消</ns-button>
<ns-button v-show="roleDisabled" type="primary" @click="roleEdit"> 编辑 </ns-button>
<ns-button v-show="!roleDisabled" type="primary" @click="UserSure"> 确定 </ns-button>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { createVNode, defineComponent, reactive, ref, watch, watchEffect } from 'vue'; import { createVNode, ref, watchEffect } from 'vue';
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';
@ -126,30 +116,84 @@
import { permission } from '/@/api/origanizemanage'; import { permission } from '/@/api/origanizemanage';
import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
export default defineComponent({ defineOptions({
name: 'AuthorityManageIndex', name: 'AuthorityManageIndex',
setup() { });
const formRef = ref(); const formRef = ref();
const formRoleRef = ref();
let formData = ref({}); let formData = ref({});
let formData2 = ref({}); let roleFormData = ref({});
const activeKey = ref('1'); const activeKey = ref(1);
const activeKey2 = ref('1'); const roleActiveKey = ref(1);
const disabled = ref(true); const disabled = ref(true);
const disabled2 = ref(true); const roleDisabled = ref(true);
const deptTreeCheckedKeys = ref(['0-0-0']); const deptTreeCheckedKeys = ref(['0-0-0']);
const ApartcheckedKeys = ref<string[]>([]); const ApartcheckedKeys = ref<string[]>([]);
const UsercheckedKeys = ref<string[]>([]); const UsercheckedKeys = ref<string[]>([]);
const currentOrgRef = ref();
const selectKey = ref(); const selectKey = ref();
const selectRef = ref(); const selectRef = ref();
const selectKey2 = ref(); const selectRoleKey = ref();
const selectRef2 = ref(); const selectRoleRef = ref();
const formSchema = formConfig(disabled as any); const formSchema = formConfig(disabled as any);
const formSchema2 = formConfig2(disabled2 as any); const formSchema2 = formConfig2(roleDisabled as any);
const { orgId, orgName, projectId } = JSON.parse(sessionStorage.getItem('userInfo')); const { orgId, orgName, projectId } = JSON.parse(sessionStorage.getItem('userInfo'));
const userAdminTreeData = ref([]); const userAdminTreeData = ref([]);
const apartmentTreeData = ref([]); const apartmentTreeData = ref([]);
const apartmentAdminTreeData = ref([]); const apartmentAdminTreeData = ref([]);
const userTreeData = ref([]); const userTreeData = ref([]);
//
const deptTotalCheckedKeys = ref([]);
const roleTotalCheckedKeys = ref([]);
//
const disabledTree = (data, disabled = true) => {
data.map((item) => {
item['disabled'] = disabled;
if (item.menus) {
disabledTree(item.menus, disabled);
}
});
};
watchEffect(() => {
disabledTree(apartmentAdminTreeData.value, disabled.value);
disabledTree(userAdminTreeData.value, roleDisabled.value);
});
/**操作拦截 */
const pipe = (func: Function, flag = false) => {
console.log(selectRef.value);
if (flag && !selectRef.value?.hasOwnProperty('own')) {
NsMessage.error('请先选择相关部门');
return;
}
if (!flag && !selectRef.value?.deptInfo) {
NsMessage.error('请先选择相关企业');
return;
}
func && func();
};
const rolePipe = (func: Function, linkDept = false) => {
console.log(selectRoleRef.value);
//
if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) {
NsMessage.error('请先选择相关部门');
return;
}
if (!linkDept && !selectRoleRef.value) {
NsMessage.error('请先选择相关角色');
return;
}
func && func();
};
/**操作拦截 */
const getPermissionTree = (params) => { const getPermissionTree = (params) => {
return http.post(permission.queryOrgPermission, params).then((res) => { return http.post(permission.queryOrgPermission, params).then((res) => {
apartmentAdminTreeData.value = get(res, 'data'); apartmentAdminTreeData.value = get(res, 'data');
@ -163,13 +207,6 @@
getPermissionTree({ projectId, orgId }); getPermissionTree({ projectId, orgId });
watch(ApartcheckedKeys, () => {
console.log('checkedKeys', ApartcheckedKeys.value);
});
watch(UsercheckedKeys, () => {
console.log('checkedKeys', UsercheckedKeys.value);
});
// //
const getDepartList = (params) => { const getDepartList = (params) => {
return http.post(department.queryDeptTree, params).then((res) => { return http.post(department.queryDeptTree, params).then((res) => {
@ -222,10 +259,11 @@
opMap.type = 'addDept'; opMap.type = 'addDept';
formData.value = {}; formData.value = {};
let sourceOrgId = ''; let sourceOrgId = '';
if (!selectRef.value.own) { if (!currentOrgRef.value.own) {
sourceOrgId = orgId; sourceOrgId = orgId;
} }
opMap.fuc = (params) => { opMap.fuc = (params) => {
return formRef.value.triggerSubmit().then(() => {
return http.post(department.deptSave, { return http.post(department.deptSave, {
...params, ...params,
orgId: selectRef.value.deptInfo?.orgId, orgId: selectRef.value.deptInfo?.orgId,
@ -233,6 +271,7 @@
projectId, projectId,
orgName, orgName,
}); });
});
}; };
return; return;
}; };
@ -242,14 +281,11 @@
opMap.type = 'addson'; opMap.type = 'addson';
formData.value = {}; formData.value = {};
let sourceOrgId = ''; let sourceOrgId = '';
if (!selectRef.value.own) { if (!currentOrgRef.value.own) {
sourceOrgId = orgId; sourceOrgId = orgId;
} }
opMap.fuc = (params) => { opMap.fuc = (params) => {
if (!selectRef.value?.deptInfo?.deptId) { return formRef.value.triggerSubmit().then(() => {
NsMessage.warn('请选择部门');
return;
}
return http.post(department.deptSave, { return http.post(department.deptSave, {
...params, ...params,
orgId, orgId,
@ -258,13 +294,14 @@
sourceOrgId, sourceOrgId,
// deptName: selectRef.value.deptInfo.deptName, // deptName: selectRef.value.deptInfo.deptName,
}); });
});
}; };
}; };
const addUser = () => { const addUser = () => {
disabled2.value = false; roleDisabled.value = false;
opMap.type = 'addUser'; opMap.type = 'addUser';
formData2.value = {}; roleFormData.value = {};
opMap.fuc = (params) => { opMap.fuc = (params) => {
delete params.roleId; delete params.roleId;
return http.post(department.addRole, { return http.post(department.addRole, {
@ -278,29 +315,23 @@
}; };
const addUserSon = () => { const addUserSon = () => {
disabled.value = false; roleDisabled.value = false;
opMap.type = 'addUserSon'; opMap.type = 'addUserSon';
formData2.value = {}; roleFormData.value = {};
opMap.fuc = (params) => { opMap.fuc = (params) => {
delete params.roleId; delete params.roleId;
return http.post(department.addRole, { return http.post(department.addRole, {
...params, ...params,
orgId, orgId,
projectId, projectId,
proleId: selectRef2.value.roleId, proleId: selectRoleRef.value.roleId,
deptId: selectRef.value.deptInfo.deptId, deptId: selectRef.value.deptInfo.deptId,
deptName: selectRef.value.deptInfo.deptName, deptName: selectRef.value.deptInfo.deptName,
}); });
}; };
}; };
const deleteApartment = () => { const deleteDept = () => {
// //
// 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),
@ -308,7 +339,7 @@
onOk() { onOk() {
http.post(department.deptDel, { deptId: selectRef.value.deptInfo.deptId }).then(() => { http.post(department.deptDel, { deptId: selectRef.value.deptInfo.deptId }).then(() => {
getTree(); getTree();
clearApartData(); clearDeptData();
}); });
}, },
onCancel() { onCancel() {
@ -323,7 +354,7 @@
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''), content: createVNode('div', { style: 'color:red;' }, ''),
onOk() { onOk() {
http.post(department.delRole, { roleId: selectRef2.value.roleId }).then(() => { http.post(department.delRole, { roleId: selectRoleRef.value.roleId }).then(() => {
getUserTree({ deptId: selectRef.value.deptInfo.deptId }); getUserTree({ deptId: selectRef.value.deptInfo.deptId });
}); });
}, },
@ -332,23 +363,17 @@
}); });
}; };
const clearApartData = () => { const clearDeptData = () => {
selectRef.value = {};
formData.value = {}; formData.value = {};
opMap.type = ''; opMap.type = '';
opMap.fuc = ''; opMap.fuc = '';
selectKey.value = '';
}; };
const clearRoleData = () => { const clearRoleData = () => {
selectRef2.value = {}; roleFormData.value = {};
formData2.value = {};
opMap.type = ''; opMap.type = '';
opMap.fuc = ''; opMap.fuc = '';
selectKey2.value = '';
}; };
const deptTotalCheckedKeys = ref([]);
const roleTotalCheckedKeys = ref([]);
// //
const deptCheck = (checked, { halfCheckedKeys }) => { const deptCheck = (checked, { halfCheckedKeys }) => {
console.log(checked, halfCheckedKeys); console.log(checked, halfCheckedKeys);
@ -393,8 +418,8 @@
}; };
// //
const apartmentPermission = () => { const deptPermission = () => {
http return http
.post(department.addPermission, { .post(department.addPermission, {
deptId: selectRef.value?.deptInfo.deptId, deptId: selectRef.value?.deptInfo.deptId,
projectId, projectId,
@ -409,7 +434,7 @@
http http
.post(department.addRolePermission, { .post(department.addRolePermission, {
// deptId: selectRef.value?.deptInfo.deptId, // deptId: selectRef.value?.deptInfo.deptId,
roleId: selectRef2.value?.roleId, roleId: selectRoleRef.value?.roleId,
projectId, projectId,
permissionVoList: roleTotalCheckedKeys.value, permissionVoList: roleTotalCheckedKeys.value,
}) })
@ -435,7 +460,7 @@
// //
const getRolePermission = () => { const getRolePermission = () => {
http http
.post(permission.queryRolePermission, { roleId: selectRef2.value?.roleId }) .post(permission.queryRolePermission, { roleId: selectRoleRef.value?.roleId })
.then((res) => { .then((res) => {
UsercheckedKeys.value = res.data UsercheckedKeys.value = res.data
?.filter((item) => !item.halfCheck) ?.filter((item) => !item.halfCheck)
@ -459,27 +484,32 @@
// //
const deptEdit = () => { const deptEdit = () => {
disabledTree();
disabled.value = false; disabled.value = false;
apartmentChoose(); apartmentChoose();
}; };
// //
const SelectApartmentTree = (selectedKeys: any, info: any) => { const SelectApartmentTree = (selectedKeys: any, info: any) => {
console.log(selectedKeys, info); console.log(info);
const { selected } = info;
// disabled.value = !selected; // tab
roleActiveKey.value = 1;
const { selected } = info;
if (!selectedKeys?.length) return; if (!selectedKeys?.length) return;
selectKey.value = [info.node.key]; selectKey.value = [info.node.key];
selectRef.value = info.node.dataRef; selectRef.value = info.node.dataRef;
ApartcheckedKeys.value.splice(0);
getDeptPermission();
formData.value = cloneDeep(info.node.dataRef.deptInfo);
// getUserTree({ deptId: selectRef.value.deptInfo.deptId }); //
if (!selectRef.value.hasOwnProperty('own')) {
formData.value = cloneDeep(info.node.dataRef.deptInfo);
} else {
currentOrgRef.value = selectRef.value;
formData.value = {};
}
getDeptPermission();
ApartcheckedKeys.value = [];
}; };
/** /**
@ -493,132 +523,77 @@
}; };
}; };
const roleEdit = () => { const roleEdit = () => {
disabled2.value = false; roleDisabled.value = false;
roleChoose(); roleChoose();
}; };
// //
const SelectUserTree = (selectedKeys: any, info: any) => { const SelectUserTree = (selectedKeys: any, info: any) => {
const { selected } = info; const { selected } = info;
// disabled2.value = !selected; // roleDisabled.value = !selected;
if (!selectedKeys?.length) return; if (!selectedKeys?.length) return;
selectKey2.value = selectedKeys[0]; selectRoleKey.value = selectedKeys[0];
selectRef2.value = info.node.dataRef; selectRoleRef.value = info.node.dataRef;
formData2.value = cloneDeep(info.node.dataRef); roleFormData.value = cloneDeep(info.node.dataRef);
UsercheckedKeys.value.splice(0); UsercheckedKeys.value = [];
getRolePermission(); getRolePermission();
getRolePermissionTree({ deptId: selectRef.value.deptInfo.deptId }); getRolePermissionTree({ deptId: selectRef.value.deptInfo.deptId });
}; };
const CancelApartment = () => { const CancelApartment = () => {
disabled.value = true; disabled.value = true;
//
// clearApartData();
}; };
const CancelUser = () => { const CancelUser = () => {
disabled2.value = true; roleDisabled.value = true;
};
const ApartmentSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
}; };
const UserSelect = (selectedKeys: any, info: any) => { //
console.log(selectedKeys, 'selectedKeys'); const deptSure = () => {
console.log(info, 'info');
};
const ApartmentSure = () => {
console.log(opMap.type, 'ApartmentSure');
const opArr = ['addDept', 'editDpet', 'addson']; const opArr = ['addDept', 'editDpet', 'addson'];
if (activeKey.value === 1) {
if (opArr.includes(opMap.type)) { if (opArr.includes(opMap.type)) {
console.log(formRef.value, formData); console.log(formRef.value, formData);
opMap.fuc && opMap.fuc &&
opMap.fuc(formData.value).then(() => { opMap.fuc(formData.value).then(() => {
getTree(); getTree();
clearApartData(); clearDeptData();
disabled.value = true;
});
}
} else {
deptPermission().then(() => {
clearDeptData();
disabled.value = true; disabled.value = true;
}); });
} else if (opMap.type === 'deptDelete') {
opMap.fuc && opMap.fuc({ ...formData.value, selectRef: selectRef.value });
} }
}; };
//
const UserSure = () => { const UserSure = () => {
disabled2.value = !disabled2.value; roleDisabled.value = !roleDisabled.value;
const typeArr = ['addUserSon', 'addUser', 'editRole']; const typeArr = ['addUserSon', 'addUser', 'editRole'];
if (roleActiveKey.value === 1) {
if (typeArr.includes(opMap.type)) { if (typeArr.includes(opMap.type)) {
opMap.fuc && opMap.fuc &&
opMap.fuc(formData2.value).then(() => { opMap.fuc(roleFormData.value).then(() => {
getUserTree(); getUserTree();
clearRoleData(); clearRoleData();
}); });
} else if (selectRef2.value && opMap.type === 'addson') }
selectRef2.value['children'] = [ } else {
{ rolePermission();
key: '123',
title: formData2.value.departname,
info: { ...cloneDeep(formData2.value) },
},
];
else {
console.log('ss');
} }
}; };
const disabledTree = (data, disabled) => {
console.log(userAdminTreeData.value, 'userAdminTreeData.value');
userAdminTreeData.value.map((item) => {
item['disabled'] = disabled;
});
};
return {
disabled,
disabled2,
formSchema,
formSchema2,
formData,
formData2,
apartmentTreeData,
userTreeData,
SelectApartmentTree,
SelectUserTree,
activeKey,
activeKey2,
ApartmentSure,
UserSure,
addApartment,
addApartmentSon,
deleteApartment,
deleteUser,
addUser,
addUserSon,
CancelApartment,
CancelUser,
apartmentAdminTreeData,
ApartmentSelect,
ApartcheckedKeys,
userAdminTreeData,
UsercheckedKeys,
UserSelect,
formRef,
apartmentPermission,
rolePermission,
deptEdit,
selectKey,
selectKey2,
deptTreeCheckedKeys,
deptCheck,
roleCheck,
roleEdit,
};
},
});
</script> </script>
<style scoped> <style lang="less" scoped>
:deep(.ant-tabs-tabpane) {
padding: 20px;
.form {
margin: 0 !important;
}
}
.main { .main {
display: flex; display: flex;
flex: 1; flex: 1;

21
hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue

@ -478,7 +478,7 @@
headerActions: [ headerActions: [
{ {
label: '新增', label: '新增',
name: 'RoleTypeAdd', name: 'userAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
addformvisible.value = true; addformvisible.value = true;
@ -504,26 +504,9 @@
columnActions: { columnActions: {
title: '操作', title: '操作',
actions: [ actions: [
// {
// label: '',
// name: 'RoleTypeEdit',
// // dynamicParams: 'uuid',
// handle: (record: any) => {
// console.log(record, 'record');
// formData2.value = record;
// opMap.type = 'edit';
// opMap.fuc = (formData2: any) => {
// Object.assign(
// mockData.value.filter((item) => item.id === record.id)[0],
// formData2,
// );
// };
// addformvisible.value = true;
// },
// },
{ {
label: '删除', label: '删除',
name: 'RoleTypeEdit', name: 'userAdd',
confirm: true, confirm: true,
handle: (record: any, name: any, reload: any) => { handle: (record: any, name: any, reload: any) => {
const id = record.roleId; const id = record.roleId;

2
hx-ai-intelligent/vite.config.ts

@ -12,7 +12,7 @@ const proxy = {
changeOrigin: true, changeOrigin: true,
}, },
'/carbon-smart': { '/carbon-smart': {
target: 'http://123.60.103.97:8224', target: 'http://192.168.112.144:8224',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/carbon-smart/, ''), rewrite: (path) => path.replace(/^\/carbon-smart/, ''),
}, },

4
hx-op/src/config/app.config.ts

@ -73,8 +73,8 @@ export const appConfig = {
const info = res.data; const info = res.data;
const trD = transform(info, { const trD = transform(info, {
accountCode: 'userId', accountCode: 'userId',
accountName: 'realName', accountName: 'accountNo',
accountRealName: 'realName', accountRealName: 'accountNo',
orgId: 'orgId', orgId: 'orgId',
orgName: 'orgName', orgName: 'orgName',
projectId: 'projectId', projectId: 'projectId',

1
lib/component/form/form/form-item.vue

@ -298,7 +298,6 @@
validateRef.value = text; validateRef.value = text;
}, },
}; };
console.log(on, 'checkON');
return { return {
...propsData, ...propsData,

4
lib/saas/store/modules/app-config.ts

@ -123,11 +123,11 @@ export const appConfigStore = defineStore({
return { data: {} }; return { data: {} };
} }
}, },
userResource() { userResource(params = {}) {
if (this.userResourceApi) { if (this.userResourceApi) {
return httpRequest({ return httpRequest({
api: this.userResourceApi, api: this.userResourceApi,
params: {}, params,
pathParams: {}, pathParams: {},
requestConfig, requestConfig,
}); });

9
lib/saas/store/modules/route.ts

@ -90,9 +90,9 @@ export const useRouteStore = defineStore({
}); });
// const initPcResource = { application: {}, menus: [] }; // const initPcResource = { application: {}, menus: [] };
let initPcResource = []; let initPcResource = [];
this.routeModule.sort((a, b) => { // this.routeModule.sort((a, b) => {
return a.route?.meta?.index - b.route?.meta?.index; // return a.route?.meta?.index - b.route?.meta?.index;
}); // });
const info = JSON.parse(JSON.stringify(this.routeModule)); const info = JSON.parse(JSON.stringify(this.routeModule));
initRouteMouleList(info); initRouteMouleList(info);
function initRouteMouleList(info) { function initRouteMouleList(info) {
@ -116,6 +116,9 @@ export const useRouteStore = defineStore({
}); });
} }
// initPcResource.application = appConfig.resourceInfo?.application as object; // initPcResource.application = appConfig.resourceInfo?.application as object;
console.log(info);
return;
initPcResource = appConfig.resourceInfo?.dealReosurceList initPcResource = appConfig.resourceInfo?.dealReosurceList
? appConfig.resourceInfo?.dealReosurceList(info) ? appConfig.resourceInfo?.dealReosurceList(info)
: info; : info;

1
lib/saas/view/system/login.vue

@ -105,7 +105,6 @@
loading.value = false; loading.value = false;
if (configStore.enablePermissions) { if (configStore.enablePermissions) {
const res = await configStore.userResource(); const res = await configStore.userResource();
console.log(res, 'cccccccccccccccccccccccccccccc');
if (configStore.customApplication) { if (configStore.customApplication) {
await useAuthorization.initMenuResource(); await useAuthorization.initMenuResource();

Loading…
Cancel
Save