Browse Source

feat: 补充用户模块权限json

main
xuziqiang 6 months ago
parent
commit
946384b9ed
  1. 1
      hx-ai-intelligent/src/api/origanizemanage.ts
  2. 35
      hx-ai-intelligent/src/router/organizationManage.ts
  3. 20
      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';
export enum permission {
add = `${BASE_URL}/admin/permission/save`,
permissionTree = `${BASE_URL}/api/dept/permissionTree`,
}
export enum origanizemanage {

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

@ -38,6 +38,41 @@ const organizationManage = {
meta: {
title: '用户管理',
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: [],
},
},

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

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

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

@ -101,14 +101,14 @@
</a-tab-pane>
</a-tabs>
<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-row>
</div>
</div>
</template>
<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 { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { http } from '/nerv-lib/util/http';
@ -142,6 +142,10 @@
const apartmentTreeData = ref([]);
const userTreeData = ref([]);
const getPermissionTree = (params) => {
return http.post(permission.permissionTree, params);
};
getPermissionTree({ projectId });
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) => {
userTreeData.value = res.data;
});
};
getUserTree({ deptId: 2 });
//
watchEffect(() => {
if (selectRef.value) getUserTree();
});
const opMap: any = {
type: 'add',
fuc: () => {},
@ -234,15 +242,14 @@
const addUser = () => {
disabled2.value = false;
opMap.type = 'addUser';
formData.value = {};
formData2.value = {};
opMap.fuc = (params) => {
delete params.roleId;
return http.post(department.addRole, {
...params,
orgId,
projectId,
enName: 'leader',
roleNote: 'wqe',
deptId: selectRef.value.deptInfo.deptId,
});
};
};
@ -250,17 +257,15 @@
const addUserSon = () => {
disabled.value = false;
opMap.type = 'addUserSon';
formData.value = {};
formData2.value = {};
opMap.fuc = (params) => {
delete params.roleId;
delete params.proleId;
return http.post(department.addRole, {
...params,
proleId: 4,
orgId,
projectId,
enName: 'leader',
roleNote: 'wqe',
proleId: selectRef2.value.roleId,
deptId: selectRef.value.deptInfo.deptId,
});
};
};
@ -295,7 +300,7 @@
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
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);
};
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
// getUserTree({ deptId: selectRef.value.deptInfo.deptId });
};
//
@ -334,6 +339,10 @@
selectKey2.value = selectedKeys[0];
selectRef2.value = info.node.dataRef;
formData2.value = cloneDeep(info.node.dataRef);
opMap.type = 'editRole';
opMap.fuc = (params) => {
return http.post(department.editRole, params);
};
};
const CancelApartment = () => {
@ -377,9 +386,12 @@
disabled2.value = !disabled2.value;
console.log(formData2.value, 'formData2');
console.log(opMap.type, 'opMap.type');
const typeArr = ['addUserSon', 'addUser'];
const typeArr = ['addUserSon', 'addUser', 'editRole'];
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')
selectRef2.value['children'] = [
{

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

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

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

@ -108,18 +108,10 @@ export const appConfigStore = defineStore({
},
userLogin(data: loginData) {
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, {
// transformRequest: [
// (mode, headers) => {
// if (headers.qsToken) {
// delete headers.qsToken;
// }
// return JSON.stringify(mode);
// },
// ],
// });
return http.post(this.userLoginApi, data);
} else {
return null;
}

3
lib/util/http/axios.ts

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

Loading…
Cancel
Save