From d58f066b395457af52a48f1643497fccdcf528de Mon Sep 17 00:00:00 2001
From: xuziqiang <1344691446@qq.com>
Date: Tue, 11 Jun 2024 13:37:10 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hx-ai-intelligent/src/config/app.config.ts | 25 +++++---
.../organizationManage/departmentManage/index.vue | 6 +-
.../view/organizationManage/usermanage/index.vue | 25 ++++++--
hx-op/.env | 2 +-
hx-op/src/api/origanizemanage.ts | 4 ++
.../organizationManage/enterpriseManage/config.ts | 75 +++++++++++-----------
.../organizationManage/enterpriseManage/index.vue | 27 +++++---
lib/util/http/axios.ts | 30 ++++-----
8 files changed, 116 insertions(+), 78 deletions(-)
diff --git a/hx-ai-intelligent/src/config/app.config.ts b/hx-ai-intelligent/src/config/app.config.ts
index 5a871c2..e34034e 100644
--- a/hx-ai-intelligent/src/config/app.config.ts
+++ b/hx-ai-intelligent/src/config/app.config.ts
@@ -5,7 +5,11 @@ import { http } from '/nerv-lib/saas';
import { ref } from 'vue';
import { permission } from '/@/api/origanizemanage';
-const value = ref('1');
+// const { linkList } = sessionStorage.getItem('userInfo')
+// ? JSON.parse(sessionStorage.getItem('userInfo')!)
+// : [{}];
+// const value = ref(linkList[0]?.orgId);
+
const transform = (data, map) => {
return Object.keys(map).reduce((pre, cur) => {
pre[cur] = data[map[cur]];
@@ -49,18 +53,20 @@ export const appConfig = {
// },
headerSlotConfig: {
- component: 'NsSelect',
+ component: 'NsSelectApi',
componentProps: {
style: { width: '200px' },
+ api: '/carbon-smart/user/login/logInInfo',
placeholder: '请选择',
- value,
+ autoSelectFirst: true,
onChange: (cur) => {
- value.value = cur;
+ // value.value = cur;
},
- options: [
- { label: '济阳', value: '1' },
- { label: '临沂', value: '2' },
- ],
+ resultField: 'data.linkList',
+ labelField: 'orgName',
+ valueField: 'orgId',
+ immediate: true,
+ dropdownReload: true,
},
},
timeout: 60 * 1000,
@@ -78,7 +84,10 @@ export const appConfig = {
orgId: 'orgId',
orgName: 'orgName',
projectId: 'projectId',
+ linkList: 'linkList',
+ permissionInfoList: 'permissionInfoList',
});
+
return { data: { ...trD } };
});
},
diff --git a/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue b/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
index d1dae33..939c433 100644
--- a/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
+++ b/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
@@ -439,16 +439,14 @@
// disabled.value = !disabled.value;
// console.log(formData.value.name, 'formData');
console.log(opMap.type, 'ApartmentSure');
- const opArr = ['addDept', 'editDpet'];
+ const opArr = ['addDept', 'editDpet', 'addson'];
if (opArr.includes(opMap.type)) {
console.log(formRef.value, formData);
opMap.fuc &&
opMap.fuc(formData.value).then(() => {
getTree();
});
- } else if (selectRef.value && opMap.type === 'addson')
- opMap.fuc && opMap.fuc(formData.value);
- else if (opMap.type === 'deptDelete') {
+ } else if (opMap.type === 'deptDelete') {
opMap.fuc && opMap.fuc({ ...formData.value, selectRef: selectRef.value });
}
};
diff --git a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
index c09d6be..4191c5d 100644
--- a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
+++ b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
@@ -5,7 +5,7 @@
关联企业
-
-
+
关联部门
userStatus === 0,
+ api: origanizemanage.frozen,
+ },
+ {
+ label: '解冻',
+ name: 'userUnFrozen',
+ confirm: true,
+ defaultParams: { userStatus: 0 },
+ dynamicParams: 'userId',
+ ifShow: ({ userStatus }) => userStatus === 1,
+ isReload: true,
api: origanizemanage.frozen,
},
{
@@ -565,8 +576,13 @@
}
.left {
width: 350px;
- border-right: 5px solid rgb(229, 235, 240);
+ max-height: calc(100vh - 96px);
+ overflow: hidden;
+ border-right: 16px solid rgb(229, 235, 240);
min-width: fit-content;
+ .top:first-child {
+ border-bottom: 16px solid #e5ebf0;
+ }
}
.right {
flex: 1;
@@ -574,7 +590,8 @@
}
.top {
height: 50%;
- border-bottom: 5px solid rgb(229, 235, 240);
+ // border-bottom: 5px solid rgb(229, 235, 240);
+ overflow-y: auto;
}
.ns-table-title {
text-align: left;
diff --git a/hx-op/.env b/hx-op/.env
index 8286906..572cfdb 100644
--- a/hx-op/.env
+++ b/hx-op/.env
@@ -1,5 +1,5 @@
# port
-VITE_PORT = 3301
+VITE_PORT = 3302
#mode
VITE_GLOB_APP_RUN_TYPE = saas
diff --git a/hx-op/src/api/origanizemanage.ts b/hx-op/src/api/origanizemanage.ts
index 2850f3d..90a6d9e 100644
--- a/hx-op/src/api/origanizemanage.ts
+++ b/hx-op/src/api/origanizemanage.ts
@@ -6,4 +6,8 @@ export enum enterPrise {
edit = `${BASE_URL}/admin/org/edit`,
save = `${BASE_URL}/admin/org/save`,
link = `${BASE_URL}/admin/org/link`,
+ getArea = `${BASE_URL}/system/queryAddressTree`,
+ freeze = `${BASE_URL}/admin/org/freeze`,
+ getCode = `${BASE_URL}/admin/org/getCode`,
+ queryRootAc = `${BASE_URL}/admin/org/queryRootAc`,
}
diff --git a/hx-op/src/view/organizationManage/enterpriseManage/config.ts b/hx-op/src/view/organizationManage/enterpriseManage/config.ts
index 1a8869a..8ff215f 100644
--- a/hx-op/src/view/organizationManage/enterpriseManage/config.ts
+++ b/hx-op/src/view/organizationManage/enterpriseManage/config.ts
@@ -1,18 +1,19 @@
import { mockData } from './mock';
import { cloneDeep } from 'lodash-es';
-import { Modal } from 'ant-design-vue';
+import { Modal, message } from 'ant-design-vue';
import { createVNode, ref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { enterPrise } from '/@/api/origanizemanage';
+type status = 'NORMAL' | 'FREEZE';
export const formConfig = [
{
- field: 'zuzhi',
+ field: 'projectId',
label: '组织ID',
component: 'NsInput',
componentProps: {
- placeholder: '请输入组织ID',
+ disabled: true,
},
rules: [
{
@@ -50,19 +51,17 @@ export const formConfig = [
{
field: 'cityName',
label: '省市区',
- component: 'NsInputCity',
- defaultValue: '',
- fieldMap: ['provinceName', 'cityName', 'areaName', 'province', 'city', 'area'],
+ component: 'NsCascader',
componentProps: {
placeholder: '请选择',
- api: '/api/parking_merchant/objs/BaseArea',
- isSeparate: true,
+ api: enterPrise.getArea,
+ fieldNames: { label: 'regionName', value: 'regionCode' },
+ showSearch: true,
},
rules: [
{
required: true,
- message: '请选择区域',
- trigger: 'blur',
+ message: '请选择省市区',
},
],
},
@@ -76,7 +75,7 @@ export const formConfig = [
},
},
{
- field: 'person',
+ field: 'contacts',
label: '联系人',
component: 'NsInput',
componentProps: {
@@ -92,7 +91,7 @@ export const formConfig = [
],
},
{
- field: 'phone',
+ field: 'phoneNumber',
label: '联系电话',
component: 'NsInput',
componentProps: {
@@ -119,14 +118,6 @@ export const tableConfig = (visible) => {
name: 'RoleTypeAdd',
type: 'primary',
handle: () => {
- opMap.type = 'add';
- opMap.fuc = (formData: any) => {
- console.log(formData, 'formData');
- mockData.value.push({
- id: Math.random().toString().slice(2, 6),
- ...cloneDeep(formData),
- });
- };
visible.value = true;
},
},
@@ -144,11 +135,11 @@ export const tableConfig = (visible) => {
},
{
title: '组织ID',
- dataIndex: 'orgCode',
+ dataIndex: 'projectId',
},
{
title: '集团名称',
- dataIndex: 'intro',
+ dataIndex: 'cliqueName',
},
{
title: '组织名称',
@@ -157,6 +148,9 @@ export const tableConfig = (visible) => {
{
title: '状态',
dataIndex: 'status',
+ customRender: ({ value }) => {
+ return { NORMAL: '正常', FREEZE: '冻结' }[value as status];
+ },
},
{
title: '省市区',
@@ -172,15 +166,16 @@ export const tableConfig = (visible) => {
},
{
title: '联系人',
- dataIndex: 'person',
+ dataIndex: 'contacts',
},
{
title: '联系电话',
- dataIndex: 'phone',
+ dataIndex: 'phoneNumber',
},
],
columnActions: {
title: '操作',
+ autoMergeAction: false,
actions: [
{
label: '编辑',
@@ -211,18 +206,26 @@ export const tableConfig = (visible) => {
},
{
label: '冻结',
- name: 'RoleTypeEdit',
- handle: (record: any) => {
- console.log(record, 'record');
- Modal.confirm({
- title: '是否冻结该账户',
- icon: createVNode(ExclamationCircleOutlined),
- content: createVNode('div', { style: 'color:red;' }, ''),
- onOk() {
- NsMessage.success('冻结成功');
- },
- class: 'test',
- });
+ name: 'enterPriseFreeze',
+ confirm: true,
+ isReload: true,
+ ifShow: ({ status }) => status === 'NORMAL',
+ api: enterPrise.freeze,
+ dynamicParams: 'orgId',
+ defaultParams: {
+ isFreeze: true,
+ },
+ },
+ {
+ label: '解冻',
+ name: 'enterPriseUnFreeze',
+ confirm: true,
+ isReload: true,
+ ifShow: ({ status }) => status === 'FREEZE',
+ dynamicParams: 'orgId',
+ api: enterPrise.freeze,
+ defaultParams: {
+ isFreeze: false,
},
},
{
diff --git a/hx-op/src/view/organizationManage/enterpriseManage/index.vue b/hx-op/src/view/organizationManage/enterpriseManage/index.vue
index 2aa8150..9f8aa3f 100644
--- a/hx-op/src/view/organizationManage/enterpriseManage/index.vue
+++ b/hx-op/src/view/organizationManage/enterpriseManage/index.vue
@@ -2,19 +2,13 @@
-
+
取消
确定
-
+
{
return insertConfig(visible);
});
+
+ const getOrgRandomCode = () => {
+ http.post(enterPrise.getCode).then((res) => {
+ formData.value.projectId = res.data;
+ });
+ };
+ getOrgRandomCode();
+
+ // drawer form
const opMap: any = {
type: 'add',
fuc: () => {},
@@ -120,6 +123,14 @@
serviceVisible.value = false;
};
+ const addDrawerConfig = ref({
+ width: '520',
+ visible: visible,
+ footerStyle: { textAlign: 'right' },
+ destroyOnClose: true,
+ onClose: onClose,
+ });
+
const borderAdd = () => {
treeAddVisible.value = true;
treeAdd.value?.toggle();
diff --git a/lib/util/http/axios.ts b/lib/util/http/axios.ts
index 1f44468..792fdfb 100644
--- a/lib/util/http/axios.ts
+++ b/lib/util/http/axios.ts
@@ -72,31 +72,27 @@ export class NSAxios {
if (this.projectType !== 'web') config.url = `/${this.projectType}/${url}`;
}
- // let newUrl = url as string;
- // if (config.method === 'get' && config.params) {
- // newUrl += '?';
- // const keys = Object.keys(config.params);
- // for (const key of keys) {
- // if (config.params[key] !== undefined) {
- // newUrl += `${key}=${encodeURIComponent(config.params[key])}&`;
- // }
- // }
- // newUrl = newUrl.substring(0, newUrl.length - 1);
- // config.params = {};
- // }
- // config.url = newUrl;
return config;
}, undefined);
const errCodeArr = [13, 1, 3005];
- // const newMap = new Map([])
+ const errCodeMap = new Map([
+ [13, ''],
+ [1, ''],
+ [3005, JSON.stringify(() => routerConfig.logout())],
+ ]);
+
+ // type closeType = (() => void) | undefined;
this.instance.interceptors.response.use(
(res: AxiosResponse) => {
- console.log('success', res);
// todo
const code = res?.data?.retcode;
const msg = res?.data?.msg;
- if (errCodeArr.includes(code)) {
- NsMessage.error({ content: msg, key: this.errorMsgKey });
+ if (errCodeMap.has(code)) {
+ NsMessage.error({
+ content: msg,
+ key: this.errorMsgKey,
+ onClose: JSON.parse(errCodeMap.get(code)!),
+ });
return Promise.reject(res);
}
return res;