Browse Source

feat: 补充用户模块权限json

main
xuziqiang 5 months ago
parent
commit
946384b9ed
  1. 1
      hx-ai-intelligent/src/api/origanizemanage.ts
  2. 35
      hx-ai-intelligent/src/router/organizationManage.ts
  3. 10
      hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts
  4. 44
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  5. 10
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  6. 14
      lib/saas/store/modules/app-config.ts
  7. 3
      lib/util/http/axios.ts

1
hx-ai-intelligent/src/api/origanizemanage.ts

@ -1,6 +1,7 @@
const BASE_URL = '/carbon-smart'; const BASE_URL = '/carbon-smart';
export enum permission { export enum permission {
add = `${BASE_URL}/admin/permission/save`, add = `${BASE_URL}/admin/permission/save`,
permissionTree = `${BASE_URL}/api/dept/permissionTree`,
} }
export enum origanizemanage { export enum origanizemanage {

35
hx-ai-intelligent/src/router/organizationManage.ts

@ -38,6 +38,41 @@ const organizationManage = {
meta: { meta: {
title: '用户管理', title: '用户管理',
keepAlive: true, keepAlive: true,
operates: [
{ title: '新增', code: 'userAdd' },
{
title: '导入',
code: 'userImport',
},
{
title: '模板下载',
code: 'userTemDownload',
},
{
title: '导出',
code: 'userExports',
},
{
title: '批量删除',
code: 'userBatchDel',
},
{
title: '编辑',
code: 'userEdit',
},
{
title: '冻结',
code: 'userFrozen',
},
{
title: '重置密码',
code: 'userCodeReset',
},
{
title: '删除',
code: 'userDelete',
},
],
// backApi: [], // backApi: [],
}, },
}, },

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

@ -116,7 +116,7 @@ export const formConfig2 = (disabled2: Boolean) => {
// }, // },
{ {
label: '节点编码', label: '节点编码',
field: 'code', field: 'roleCode',
component: 'NsInput', component: 'NsInput',
componentProps: { componentProps: {
disabled: disabled2, disabled: disabled2,
@ -132,15 +132,16 @@ export const formConfig2 = (disabled2: Boolean) => {
}, },
{ {
label: '是否部门领导', label: '是否部门领导',
field: 'isleader', field: 'isLeader',
component: 'NsRadioGroup', component: 'NsRadioGroup',
componentProps: { componentProps: {
disabled: disabled2, disabled: disabled2,
radioType: 'radio', radioType: 'radio',
options: [ options: [
{ label: '是', value: 1 }, { label: '是', value: 0 },
{ label: '否', value: 2 }, { label: '否', value: 1 },
], ],
},
rules: [ rules: [
{ {
required: true, required: true,
@ -148,7 +149,6 @@ export const formConfig2 = (disabled2: Boolean) => {
}, },
], ],
}, },
},
{ {
field: 'remark', field: 'remark',
label: '备注', label: '备注',

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

@ -101,14 +101,14 @@
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<ns-button style="margin: 20px" type="primary" @click="CancelUser">取消</ns-button> <ns-button style="margin: 20px" type="primary" @click="CancelUser">取消</ns-button>
<ns-button type="primary" @click="UserSure">{{ disabled2 ? '编辑' : '确定' }}</ns-button> <ns-button 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">
import { createVNode, defineComponent, reactive, ref, watch } from 'vue'; import { createVNode, defineComponent, reactive, ref, watch, 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';
@ -142,6 +142,10 @@
const apartmentTreeData = ref([]); const apartmentTreeData = ref([]);
const userTreeData = ref([]); const userTreeData = ref([]);
const getPermissionTree = (params) => {
return http.post(permission.permissionTree, params);
};
getPermissionTree({ projectId });
const apartmentAdminTreeData = [ const apartmentAdminTreeData = [
{ {
@ -186,12 +190,16 @@
}); });
}; };
const getUserTree = (params = { deptId: 2 }) => { const getUserTree = (params = { deptId: selectRef.value.deptInfo.deptId }) => {
http.post(department.queryRoleTree, params).then((res) => { http.post(department.queryRoleTree, params).then((res) => {
userTreeData.value = res.data; userTreeData.value = res.data;
}); });
}; };
getUserTree({ deptId: 2 }); //
watchEffect(() => {
if (selectRef.value) getUserTree();
});
const opMap: any = { const opMap: any = {
type: 'add', type: 'add',
fuc: () => {}, fuc: () => {},
@ -234,15 +242,14 @@
const addUser = () => { const addUser = () => {
disabled2.value = false; disabled2.value = false;
opMap.type = 'addUser'; opMap.type = 'addUser';
formData.value = {}; formData2.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,
enName: 'leader', deptId: selectRef.value.deptInfo.deptId,
roleNote: 'wqe',
}); });
}; };
}; };
@ -250,17 +257,15 @@
const addUserSon = () => { const addUserSon = () => {
disabled.value = false; disabled.value = false;
opMap.type = 'addUserSon'; opMap.type = 'addUserSon';
formData.value = {}; formData2.value = {};
opMap.fuc = (params) => { opMap.fuc = (params) => {
delete params.roleId; delete params.roleId;
delete params.proleId;
return http.post(department.addRole, { return http.post(department.addRole, {
...params, ...params,
proleId: 4,
orgId, orgId,
projectId, projectId,
enName: 'leader', proleId: selectRef2.value.roleId,
roleNote: 'wqe', deptId: selectRef.value.deptInfo.deptId,
}); });
}; };
}; };
@ -295,7 +300,7 @@
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: selectRef2.value.roleId }).then(() => {
getUserTree(); getUserTree({ deptId: selectRef.value.deptInfo.deptId });
}); });
}, },
@ -322,7 +327,7 @@
return http.post(department.deptEdit, params); return http.post(department.deptEdit, params);
}; };
getUserTree({ deptId: selectRef.value.deptInfo.deptId }); // getUserTree({ deptId: selectRef.value.deptInfo.deptId });
}; };
// //
@ -334,6 +339,10 @@
selectKey2.value = selectedKeys[0]; selectKey2.value = selectedKeys[0];
selectRef2.value = info.node.dataRef; selectRef2.value = info.node.dataRef;
formData2.value = cloneDeep(info.node.dataRef); formData2.value = cloneDeep(info.node.dataRef);
opMap.type = 'editRole';
opMap.fuc = (params) => {
return http.post(department.editRole, params);
};
}; };
const CancelApartment = () => { const CancelApartment = () => {
@ -377,9 +386,12 @@
disabled2.value = !disabled2.value; disabled2.value = !disabled2.value;
console.log(formData2.value, 'formData2'); console.log(formData2.value, 'formData2');
console.log(opMap.type, 'opMap.type'); console.log(opMap.type, 'opMap.type');
const typeArr = ['addUserSon', 'addUser']; const typeArr = ['addUserSon', 'addUser', 'editRole'];
if (typeArr.includes(opMap.type)) { if (typeArr.includes(opMap.type)) {
opMap.fuc && opMap.fuc(formData2.value); opMap.fuc &&
opMap.fuc(formData2.value).then(() => {
getUserTree();
});
} else if (selectRef2.value && opMap.type === 'addson') } else if (selectRef2.value && opMap.type === 'addson')
selectRef2.value['children'] = [ selectRef2.value['children'] = [
{ {

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

@ -222,7 +222,7 @@
headerActions: [ headerActions: [
{ {
label: '新增', label: '新增',
name: 'RoleTypeAdd', name: 'userAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
opMap.type = 'add'; opMap.type = 'add';
@ -239,19 +239,19 @@
{ {
label: '导入', label: '导入',
type: 'primary', type: 'primary',
name: 'RoleTypeAdd', name: 'userImport',
handle: () => {}, handle: () => {},
}, },
{ {
label: '模板下载', label: '模板下载',
type: 'primary', type: 'primary',
name: 'RoleTypeAdd', name: 'userTemDownload',
handle: () => {}, handle: () => {},
}, },
{ {
label: '导出', label: '导出',
type: 'primary', type: 'primary',
name: 'exports', name: 'userExports',
}, },
{ {
label: '批量删除', label: '批量删除',
@ -345,7 +345,7 @@
actions: [ actions: [
{ {
label: '编辑', label: '编辑',
name: 'RoleTypeEdit', name: 'userEdit',
// dynamicParams: 'uuid', // dynamicParams: 'uuid',
handle: (record: any) => { handle: (record: any) => {
userAuthList.value.splice(0); userAuthList.value.splice(0);

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

@ -108,18 +108,10 @@ export const appConfigStore = defineStore({
}, },
userLogin(data: loginData) { userLogin(data: loginData) {
if (this.userLoginApi) { if (this.userLoginApi) {
return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig }); console.log(data);
// return httpRequest({ api: this.userLoginApi, params: data, pathParams: {}, requestConfig });
// return http.post(this.userLoginApi, data, { return http.post(this.userLoginApi, data);
// transformRequest: [
// (mode, headers) => {
// if (headers.qsToken) {
// delete headers.qsToken;
// }
// return JSON.stringify(mode);
// },
// ],
// });
} else { } else {
return null; return null;
} }

3
lib/util/http/axios.ts

@ -87,7 +87,8 @@ export class NSAxios {
// config.url = newUrl; // config.url = newUrl;
return config; return config;
}, undefined); }, undefined);
const errCodeArr = [13, 1]; const errCodeArr = [13, 1, 3005];
// const newMap = new Map([])
this.instance.interceptors.response.use( this.instance.interceptors.response.use(
(res: AxiosResponse) => { (res: AxiosResponse) => {
console.log('success', res); console.log('success', res);

Loading…
Cancel
Save