Browse Source

feat: 权限逻辑处理

main
xuziqiang 3 months ago
parent
commit
bc80a22180
  1. 34
      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. 282
      hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts
  6. 1003
      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

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

@ -1,9 +1,9 @@
/** @format */
import { dateUtil } from '/nerv-lib/util/date-util';
import mockResource from './resource.json';
import { userInfo, userResource } from './../../../hx-op/src/api/user';
import { http } from '/nerv-lib/saas';
import { ref } from 'vue';
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');
// ? JSON.parse(sessionStorage.getItem('userInfo')!)
@ -59,7 +59,13 @@ export const appConfig = {
api: '/carbon-smart/user/login/logInInfo',
placeholder: '请选择',
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;
},
resultField: 'data.linkList',
@ -73,18 +79,24 @@ export const appConfig = {
userLoginApi: (params) => {
return http.post('/carbon-smart/user/login', { ...params });
},
userResourceApi: () => {
return http.post('/carbon-smart/user/login/logInInfo').then((res) => {
return { data: res.data.permissionVos };
});
userResourceApi: (params) => {
console.log(params, 'userResource');
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: () => {
return http.post('/carbon-smart/user/login/logInInfo').then((res) => {
const info = res.data;
const trD = transform(info, {
accountCode: 'userId',
accountName: 'realName',
accountRealName: 'realName',
accountName: 'accountNo',
accountRealName: 'accountNo',
orgId: 'orgId',
orgName: 'orgName',
projectId: 'projectId',

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

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

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

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

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

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

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

@ -2,83 +2,75 @@ import { ref } from 'vue';
export const formConfig = (disabled: Boolean) => {
return ref([
{ label: '企业名称', field: 'orgName', show: false },
{
field: 'field111',
component: 'NsChildForm',
label: '部门名称',
field: 'deptName',
component: 'NsInput',
componentProps: {
schemas: [
{ label: '企业名称', field: 'orgName', show: false },
{
label: '部门名称',
field: 'deptName',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入部门名称',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入部门名称',
},
],
},
// {
// label: '上级部门',
// field: 'department',
// component: 'NsSelect',
// componentProps: {
// disabled: true,
// options: [
// {
// label: '部门1',
// value: 1,
// },
// {
// label: '部门2',
// value: 2,
// },
// ],
// },
// },
{
label: '部门编码',
field: 'deptCode',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入部门编码',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入部门编码',
},
],
},
{
label: '排序',
field: 'sort',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入排序',
maxLength: 2,
},
},
{
field: 'remark',
label: '备注',
component: 'NsTextarea',
componentProps: {
disabled: disabled,
placeholder: '请输入',
maxLength: 300,
},
},
],
disabled: disabled,
placeholder: '请输入部门名称',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入部门名称',
},
],
},
// {
// label: '上级部门',
// field: 'department',
// component: 'NsSelect',
// componentProps: {
// disabled: true,
// options: [
// {
// label: '部门1',
// value: 1,
// },
// {
// label: '部门2',
// value: 2,
// },
// ],
// },
// },
{
label: '部门编码',
field: 'deptCode',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入部门编码',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入部门编码',
},
],
},
{
label: '排序',
field: 'sort',
component: 'NsInput',
componentProps: {
disabled: disabled,
placeholder: '请输入排序',
maxLength: 2,
},
},
{
field: 'remark',
label: '备注',
component: 'NsTextarea',
componentProps: {
disabled: disabled,
placeholder: '请输入',
maxLength: 300,
},
},
]);
@ -86,84 +78,76 @@ export const formConfig = (disabled: Boolean) => {
export const formConfig2 = (disabled2: Boolean) => {
return ref([
{ label: '部门名称', field: 'deptName', show: false },
{
field: 'field111',
component: 'NsChildForm',
label: '角色名称',
field: 'zhName',
component: 'NsInput',
componentProps: {
schemas: [
{ label: '部门名称', field: 'deptName', show: false },
{
label: '角色名称',
field: 'zhName',
component: 'NsInput',
componentProps: {
disabled: disabled2,
placeholder: '请输入角色名称',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入角色名称',
},
],
},
// {
// label: '上级领导',
// field: 'department',
// component: 'NsSelect',
// componentProps: {
// disabled: true,
// },
// },
{
label: '节点编码',
field: 'roleCode',
component: 'NsInput',
componentProps: {
disabled: disabled2,
placeholder: '请输入节点编码',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入节点编码',
},
],
},
{
label: '是否部门领导',
field: 'isLeader',
component: 'NsRadioGroup',
componentProps: {
disabled: disabled2,
radioType: 'radio',
options: [
{ label: '是', value: 0 },
{ label: '否', value: 1 },
],
},
rules: [
{
required: true,
message: '请选择是否部门领导',
},
],
},
{
field: 'remark',
label: '备注',
component: 'NsTextarea',
componentProps: {
disabled: disabled2,
placeholder: '请输入',
maxLength: 300,
},
},
disabled: disabled2,
placeholder: '请输入角色名称',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入角色名称',
},
],
},
// {
// label: '上级领导',
// field: 'department',
// component: 'NsSelect',
// componentProps: {
// disabled: true,
// },
// },
{
label: '节点编码',
field: 'roleCode',
component: 'NsInput',
componentProps: {
disabled: disabled2,
placeholder: '请输入节点编码',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入节点编码',
},
],
},
{
label: '是否部门领导',
field: 'isLeader',
component: 'NsRadioGroup',
componentProps: {
disabled: disabled2,
radioType: 'radio',
options: [
{ label: '是', value: 0 },
{ label: '否', value: 1 },
],
},
rules: [
{
required: true,
message: '请选择是否部门领导',
},
],
},
{
field: 'remark',
label: '备注',
component: 'NsTextarea',
componentProps: {
disabled: disabled2,
placeholder: '请输入',
maxLength: 300,
},
},
]);
};

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

File diff suppressed because it is too large

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

@ -478,7 +478,7 @@
headerActions: [
{
label: '新增',
name: 'RoleTypeAdd',
name: 'userAdd',
type: 'primary',
handle: () => {
addformvisible.value = true;
@ -504,26 +504,9 @@
columnActions: {
title: '操作',
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: '删除',
name: 'RoleTypeEdit',
name: 'userAdd',
confirm: true,
handle: (record: any, name: any, reload: any) => {
const id = record.roleId;

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

@ -12,7 +12,7 @@ const proxy = {
changeOrigin: true,
},
'/carbon-smart': {
target: 'http://123.60.103.97:8224',
target: 'http://192.168.112.144:8224',
changeOrigin: true,
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 trD = transform(info, {
accountCode: 'userId',
accountName: 'realName',
accountRealName: 'realName',
accountName: 'accountNo',
accountRealName: 'accountNo',
orgId: 'orgId',
orgName: 'orgName',
projectId: 'projectId',

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

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

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

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

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

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

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

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

Loading…
Cancel
Save