feat: 企业联调

This commit is contained in:
xuziqiang
2024-06-12 16:41:30 +08:00
parent 8e6abb5c57
commit 680855f310
12 changed files with 1831 additions and 1636 deletions

View File

@@ -1,16 +1,18 @@
import { mockData } from './mock';
import { cloneDeep } from 'lodash-es';
import { Modal, message } from 'ant-design-vue';
import { createVNode, ref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { createVNode, nextTick, ref } from 'vue';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { enterPrise } from '/@/api/origanizemanage';
import { http } from '/nerv-lib/util/http';
import { generateRandomString } from '/@/util/generateRandomString';
type status = 'NORMAL' | 'FREEZE';
export const formConfig = [
{
field: 'orgId',
label: '企业ID',
label: '组织ID',
component: 'NsInput',
show: false,
},
@@ -29,7 +31,7 @@ export const formConfig = [
},
{
field: 'orgName',
label: '企业名称',
label: '组织名称',
component: 'NsInput',
componentProps: {
placeholder: '请输入',
@@ -112,6 +114,55 @@ export const formConfig = [
},
];
const handle = async (record: any) => {
const { orgName, orgId } = record;
const res = await http.post(enterPrise.queryRootAc, {
orgId,
});
const { accountNo, userId } = res.data[0];
NsModal.confirm({
title: '重置密码',
icon: createVNode(ExclamationCircleOutlined),
okText: '重置',
content: createVNode('div', {}, [
createVNode('p', {}, `组织名称: ${orgName}`),
createVNode('p', {}, `管理员账号: ${accountNo}`),
]),
onOk() {
NsModal.confirm({
title: '重置密码',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认重置该组织管理员密码',
onOk() {
const password = generateRandomString(6);
http.post(enterPrise.resetPwd, { userId, password }).then(() => {
NsModal.success({
okText: '确认',
content: createVNode('div', {}, [
createVNode('p', {}, '重置成功'),
createVNode('p', {}, '点击【确认】后自动复制密码并离开'),
]),
onOk: () => {
try {
navigator.clipboard.writeText(password);
NsMessage.success('复制成功');
} catch (err) {
console.error('复制失败', err);
}
},
});
});
},
});
},
onCancel() {
console.log('Cancel');
},
});
};
export const tableConfig = ({
visible,
formData,
@@ -119,10 +170,11 @@ export const tableConfig = ({
getOrgRandomCode,
borderVisible,
serviceVisible,
server: { getTree },
server: { getTree, currentServerRecord, getPermissionData },
boundary: { getBoundaryTree, currentBoundaryRecord },
}: any) => {
return {
// title: '企业管理',
// title: '组织管理',
api: enterPrise.list,
headerActions: [
{
@@ -216,16 +268,23 @@ export const tableConfig = ({
label: '组织边界',
handle: (record: any) => {
console.log(record, 'record');
borderVisible.value = true;
const { orgId, orgName } = (currentBoundaryRecord.value = record);
getBoundaryTree({ orgId, orgName });
nextTick(() => {
borderVisible.value = true;
});
},
},
{
label: '服务',
handle: (record: any) => {
console.log(record, 'record');
const { projectId } = record;
getTree({ projectId: 'beijingDQ' });
serviceVisible.value = true;
const { orgId } = (currentServerRecord.value = record);
opType.value = 'serverAdd';
// getTree({});
getPermissionData({ orgId });
nextTick(() => {
serviceVisible.value = true;
});
},
},
{
@@ -255,38 +314,7 @@ export const tableConfig = ({
{
label: '重置密码',
name: 'RoleTypeEdit',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '重置密码',
icon: createVNode(ExclamationCircleOutlined),
okText: '重置',
content: h('div', {}, [
h('p', `企业名称: ${record.jituanname}`),
h('p', '管理员账号: hxdtadmin'),
]),
onOk() {
Modal.confirm({
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认重置该企业管理员密码',
onOk() {
Modal.success({
okText: '确认',
content: h('div', {}, [
h('p', '重置成功'),
h('p', '点击【确认】后自动复制密码并离开'),
]),
});
},
});
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
},
handle,
},
{
label: '删除',