Browse Source

feat: 细节调整

main
xuziqiang 3 months ago
parent
commit
d58f066b39
  1. 25
      hx-ai-intelligent/src/config/app.config.ts
  2. 6
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  3. 25
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  4. 2
      hx-op/.env
  5. 4
      hx-op/src/api/origanizemanage.ts
  6. 75
      hx-op/src/view/organizationManage/enterpriseManage/config.ts
  7. 27
      hx-op/src/view/organizationManage/enterpriseManage/index.vue
  8. 30
      lib/util/http/axios.ts

25
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 } };
});
},

6
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 });
}
};

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

@ -5,7 +5,7 @@
<div class="left">
<div class="top">
<div class="ns-table-title">关联企业</div>
<div style="height: 100%; overflow-y: auto">
<div>
<a-input-search
v-model:value="searchValue"
style="margin-bottom: 8px"
@ -22,7 +22,7 @@
</a-tree>
</div>
</div>
<div>
<div class="top">
<div class="ns-table-title">关联部门</div>
<a-input-search
@ -371,6 +371,17 @@
defaultParams: { userStatus: 1 },
dynamicParams: 'userId',
isReload: true,
ifShow: ({ userStatus }) => 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;

2
hx-op/.env

@ -1,5 +1,5 @@
# port
VITE_PORT = 3301
VITE_PORT = 3302
#mode
VITE_GLOB_APP_RUN_TYPE = saas

4
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`,
}

75
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,
},
},
{

27
hx-op/src/view/organizationManage/enterpriseManage/index.vue

@ -2,19 +2,13 @@
<template>
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" rowKey="uuid" />
<a-drawer
:width="600"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<ns-drawer v-bind="addDrawerConfig">
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" />
<template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
</template>
</a-drawer>
</ns-drawer>
<a-drawer
:width="600"
:visible="borderVisible"
@ -94,6 +88,15 @@
const tableConfig = computed(() => {
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();

30
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;

Loading…
Cancel
Save