Browse Source

feat: 用户联调

main
xuziqiang 6 months ago
parent
commit
e1b0d817fe
  1. 23
      hx-ai-intelligent/src/api/origanizemanage.ts
  2. 2
      hx-ai-intelligent/src/config/app.config.ts
  3. 3
      hx-ai-intelligent/src/router/equipmentManage.ts
  4. 40
      hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts
  5. 78
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  6. 107
      hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts
  7. 356
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  8. 2
      hx-ai-intelligent/src/view/organizationManage/usermanage/mock.ts
  9. 2
      hx-ai-intelligent/vite.config.ts
  10. 2
      lib/component/table/table-header.vue
  11. 6
      lib/component/table/table.vue
  12. 2
      lib/saas/config/table.config.ts

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

@ -1,4 +1,19 @@
export const origanizemanage = {
userList: '/carbon-smart/api/user/queryUserByPage',
addUser: '/carbon-smart/api/user/save',
};
const BASE_URL = '/carbon-smart';
export enum origanizemanage {
userList = '/carbon-smart/api/user/queryUserByPage',
addUser = '/carbon-smart/api/user/save',
frozen = '/carbon-smart/api/user/frozen',
resetPwd = '/carbon-smart/api/user/resetPwd',
del = '/carbon-smart/api/user/del',
batchDel = '/carbon-smart/api/user/batchDel',
queryOrgTree = '/carbon-smart/api/user/queryOrgTree',
queryDeptTree = '/carbon-smart/api/user/queryDeptTree',
queryUserPerList = '/carbon-smart/api/user/queryUserPerList',
}
export enum department {
dartList = `${BASE_URL}/api/user/queryDeptTree`,
deptSave = `${BASE_URL}/api/dept/save`,
deptEdit = `${BASE_URL}/api/dept/edit`,
}

2
hx-ai-intelligent/src/config/app.config.ts

@ -74,6 +74,8 @@ export const appConfig = {
accountName: 'realName',
accountRealName: 'realName',
orgId: 'orgId',
orgName: 'orgName',
projectId: 'projectId',
});
return { data: { ...trD } };
});

3
hx-ai-intelligent/src/router/equipmentManage.ts

@ -15,7 +15,8 @@ const equipment = {
{
path: 'index',
name: 'LedgerIndex',
component: () => import('/@/view/equipmentManage/ledger/index.vue'),
component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
// component: () => import('/@/view/equipmentManage/ledger/index.vue'),
meta: {
title: '设备台账',
keepAlive: true,

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

@ -9,7 +9,7 @@ export const formConfig = (disabled: Boolean) => {
schemas: [
{
label: '部门名称',
field: 'name',
field: 'deptName',
component: 'NsInput',
componentProps: {
disabled: disabled,
@ -23,27 +23,27 @@ export const formConfig = (disabled: Boolean) => {
},
],
},
{
label: '上级部门',
field: 'department',
component: 'NsSelect',
componentProps: {
disabled: true,
options: [
{
label: '部门1',
value: 1,
},
{
label: '部门2',
value: 2,
},
],
},
},
// {
// label: '上级部门',
// field: 'department',
// component: 'NsSelect',
// componentProps: {
// disabled: true,
// options: [
// {
// label: '部门1',
// value: 1,
// },
// {
// label: '部门2',
// value: 2,
// },
// ],
// },
// },
{
label: '部门编码',
field: 'code',
field: 'deptCode',
component: 'NsInput',
componentProps: {
disabled: disabled,

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

@ -9,9 +9,13 @@
<ns-button style="margin: 10px" type="primary" @click="addApartment">新增部门</ns-button>
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button>
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button>
<a-tree :tree-data="apartmentTreeData" defaultExpandAll @select="SelectApartmentTree">
<template #title="{ title }">
{{ title }}
<a-tree
v-if="apartmentTreeData?.length"
:tree-data="apartmentTreeData"
defaultExpandAll
@select="SelectApartmentTree">
<template #title="data">
{{ data.deptInfo.deptName }}
</template>
</a-tree>
</a-col>
@ -39,9 +43,7 @@
</a-tab-pane>
</a-tabs>
<ns-button style="margin: 20px" type="primary" @click="CancelApartment">取消</ns-button>
<ns-button type="primary" @click="ApartmentSure">{{
disabled ? '编辑' : '确定'
}}</ns-button>
<ns-button type="primary" @click="ApartmentSure">确定</ns-button>
</a-col>
</a-row>
</div>
@ -53,8 +55,8 @@
<ns-button type="primary" @click="addUserSon">新增子角色</ns-button>
<ns-button style="margin: 10px" type="primary" @click="deleteUser">删除</ns-button>
<a-tree :tree-data="userTreeData" defaultExpandAll @select="SelectUserTree">
<template #title="{ title }">
{{ title }}
<template #title="data">
{{ data }}
</template>
</a-tree>
</a-col>
@ -95,6 +97,8 @@
import { uuid } from '@antv/x6/lib/util/string/uuid';
import { cloneDeep } from 'lodash-es';
import { formConfig, formConfig2 } from './config';
import { department } from '/@/api/origanizemanage';
export default defineComponent({
name: 'AuthorityManageIndex',
setup() {
@ -113,6 +117,9 @@
const selectRef2 = ref();
const formSchema = formConfig(disabled as any);
const formSchema2 = formConfig2(disabled2 as any);
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const projectId = JSON.parse(sessionStorage.getItem('userInfo')).projectId;
watch(ApartcheckedKeys, () => {
console.log('checkedKeys', ApartcheckedKeys.value);
});
@ -120,23 +127,20 @@
console.log('checkedKeys', UsercheckedKeys.value);
});
//
const getDepartList = (params) => {
return http.post(department.dartList, params);
};
getDepartList({ orgId: 1 }).then((res) => {
apartmentTreeData.value = res.data;
});
const opMap: any = {
type: 'add',
fuc: () => {},
record: {},
};
const apartmentTreeData = ref([
{
title: '铁路总局',
key: '0-0',
info: { name: '铁路总局' },
children: [
{ title: '济阳站', key: '0-0-0', info: { name: '济阳站' } },
{ title: '临沂站', key: '0-0-1', info: { name: '临沂站' } },
],
},
]);
const apartmentTreeData = ref([]);
const userTreeData = ref([
{
@ -182,14 +186,31 @@
},
]);
function fetch(api, params) {
return http.post(api, params);
}
const addApartment = () => {
disabled.value = false;
opMap.type = 'add';
opMap.fuc = (params) => {
fetch(department.deptSave, { ...params, orgId, projectId });
};
return;
};
const addApartmentSon = () => {
disabled.value = false;
opMap.type = 'addson';
formData.value = {};
opMap.fuc = (params) => {
fetch(department.deptSave, {
...params,
orgId,
projectId,
pdeptId: selectRef.value.deptInfo.deptId,
});
};
};
const addUser = () => {
@ -243,12 +264,14 @@
};
const SelectApartmentTree = (selectedKeys: any, info: any) => {
console.log(selectedKeys, info);
disabled.value = false;
console.log(selectedKeys, 'selectedKeys');
console.log(info.node.dataRef, 'info');
selectKey.value = selectedKeys[0];
selectRef.value = info.node.dataRef;
formData.value = info.node.dataRef.info;
formData.value = info.node.dataRef.deptInfo;
};
const SelectUserTree = (selectedKeys: any, info: any) => {
disabled2.value = false;
@ -280,24 +303,17 @@
const ApartmentSure = () => {
// formRef.value?.triggerSubmit().then(() => {});
disabled.value = !disabled.value;
opMap.fuc && opMap.fuc(formData.value);
// disabled.value = !disabled.value;
// console.log(formData.value.name, 'formData');
console.log(opMap.type, 'opMap.type');
if (opMap.type === 'add') {
apartmentTreeData.value[0].children.push({
title: formData.value.name,
key: 'a1',
info: { ...formData.value },
});
console.log(formRef.value, formData);
opMap.fuc && opMap.fuc(formData.value);
} else if (selectRef.value && opMap.type === 'addson')
selectRef.value['children'] = [
{ key: '123', title: formData.value.name, info: { ...cloneDeep(formData.value) } },
];
opMap.fuc && opMap.fuc(formData.value);
else {
console.log('ss');
}
formData.value = {};
};
const UserSure = () => {
disabled2.value = !disabled2.value;

107
hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts

@ -4,6 +4,8 @@ import { Modal } from 'ant-design-vue';
import { createVNode, ref } from 'vue';
import { NsMessage } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { http } from '/nerv-lib/util';
import { origanizemanage } from '/@/api/origanizemanage';
export const formConfig = [
{
field: 'field111',
@ -48,8 +50,8 @@ export const formConfig = [
componentProps: {
radioType: 'radio',
options: [
{ label: '男', value: 1 },
{ label: '女', value: 2 },
{ label: '男', value: '男' },
{ label: '女', value: '女' },
],
},
},
@ -80,8 +82,9 @@ export const formConfig = [
},
{
label: '组织关系',
field: 'relation',
field: 'orgName',
component: 'NsInput',
defaultValue: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
componentProps: {
disabled: true,
maxLength: 30,
@ -91,35 +94,93 @@ export const formConfig = [
},
},
];
const options = ref([]);
const getUserPerList = (transform, params = {}) => {
return http.post(origanizemanage.queryUserPerList, { ...params }).then((res) => {
return res.data.map((item) => {
item = { ...item, ...transform(item) };
return item;
});
});
};
export const formConfig2 = (casData: any) => {
// const transForm = (data) => {
// data['label'] = data.orgName;
// data['value'] = data.orgId;
// data['isLeaf'] = false;
// data['level'] = 1;
// return data;
// };
// getUserPerList(transForm).then((res) => {
// options.value = [...res];
// });
return ref([
{
field: 'information',
component: 'NsCascader',
componentProps: {
placeholder: '请选择',
displayRender: ({ labels }: any) => {
casData.value = labels;
displayRender: ({ labels, selectedOptions }: any) => {
console.log(labels, selectedOptions);
casData.value = selectedOptions.map(({ label, value }) => {
return { label, value };
});
return labels.join('/');
},
options: [
{
value: '1',
label: '铁路局',
children: [
{
value: '2',
label: '产品部',
children: [
{
value: '3',
label: '产品总监',
},
],
},
],
},
],
// defaultValue: [1, 1, 3],
// options: options,
// changeOnSelect: true,
loadData: (selectedOptions, options) => {
console.log(selectedOptions, options, 'selectedOptions, options');
const targetOption = selectedOptions[selectedOptions.length - 1];
let transForm, params;
// load options lazily
if (!selectedOptions.length) {
transForm = (data) => {
data['label'] = data.orgName;
data['value'] = data.orgId;
data['isLeaf'] = false;
data['level'] = 1;
return data;
};
getUserPerList(transForm).then((res) => {
options.value = [...res];
});
}
const id = targetOption?.value;
const level = targetOption?.level;
if (targetOption) {
targetOption.loading = true;
}
if (level === 1) {
transForm = (data) => {
data['label'] = data.deptName;
data['value'] = data.deptId;
data['isLeaf'] = false;
data['level'] = 2;
return data;
};
params = { orgId: id };
} else if (level === 2) {
transForm = (data) => {
data['label'] = data.roleName;
data['value'] = data.roleId;
data['level'] = 3;
return data;
};
params = { deptId: id };
}
if (targetOption) {
getUserPerList(transForm, { ...params }).then((res) => {
targetOption.loading = false;
targetOption.children = [...res];
});
}
},
},
},
]);

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

@ -5,37 +5,38 @@
<div class="left">
<div class="top">
<div class="ns-table-title">关联企业</div>
<div>
<div style="height: 100%; overflow-y: auto">
<a-input-search
v-model:value="searchValue"
style="margin-bottom: 8px"
placeholder="请输入关联企业"
@search="onSearch" />
<a-tree :tree-data="treeData" defaultExpandAll @select="handleSelect">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }}
</span>
<span v-else>{{ title }}</span> -->
<a-tree
v-if="treeData?.length"
:tree-data="treeData"
defaultExpandAll
@select="handleSelect">
<template #title="data">
{{ data.orgInfo?.orgName }}
</template>
</a-tree>
</div>
</div>
<div class="ns-table-title">关联部门</div>
<div>
<div class="ns-table-title">关联部门</div>
<a-input-search
v-model:value="searchValue2"
style="margin-bottom: 8px"
placeholder="请输入关联部门"
@search="onSearch2" />
<a-tree :tree-data="treeData2" defaultExpandAll @select="handleSelect2">
<template #title="{ title }">
{{ title }}
<!-- <span v-if="title.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }}
</span>
<span v-else>{{ title }}</span> -->
<a-tree
v-if="treeData2?.length"
:tree-data="treeData2"
defaultExpandAll
@select="handleSelect2">
<template #title="data">
{{ data.deptInfo?.deptName }}
</template>
</a-tree>
</div>
@ -44,17 +45,31 @@
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
</div>
<a-drawer
:width="1200"
:width="500"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<ns-form ref="formRef" :schemas="formSchema" :model="formData" class="form" />
<ns-form
ref="formRef"
:schemas="formSchema"
:model="formData"
class="form"
:wrapperCol="{ span: 20 }"
formLayout="vertical" />
<span class="admin">用户权限</span>
<ns-view-list-table v-bind="tableConfig2" :model="data" ref="mainRef" rowKey="uuid" />
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
<ns-view-list-table
v-bind="tableConfig2"
class="drawerTable"
:model="data"
:pagination="false"
ref="mainRef"
rowKey="uuid" />
<template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onEdit">确定</a-button>
</template>
</a-drawer>
<a-modal
@ -69,15 +84,13 @@
</div>
</template>
<script lang="ts">
import { Modal } from 'ant-design-vue';
import { createVNode, defineComponent, reactive, ref } from 'vue';
import { http } from '/nerv-lib/util/http';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { cloneDeep } from 'lodash-es';
import { NsMessage } from '/nerv-lib/component';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { formConfig, formConfig2 } from './config';
import { mockData, mockData2, treeData, treeData2 } from './mock';
import { origanizemanage } from '/@/api/origanizemanage';
import { origanizemanage, department } from '/@/api/origanizemanage';
export default defineComponent({
name: 'OrderListIndex',
@ -85,7 +98,7 @@
const mainRef = ref();
const data = reactive({});
let formData = ref({});
let formData2 = ref({});
let formData2 = ref({ userRoleList: [1, 1, 3] });
const formRef = ref();
const visible = ref(false);
const addformvisible = ref(false);
@ -94,7 +107,24 @@
const formSchema = formConfig;
const casData = ref([]);
const formSchema2 = formConfig2(casData);
const treeData = ref([]);
const treeData2 = ref([]);
const userAuthList = ref([]);
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
//
fetch(origanizemanage.queryOrgTree).then((res) => {
treeData.value = res.data;
});
//
fetch(origanizemanage.queryDeptTree).then((res) => {
treeData2.value = res.data;
});
const opMap: any = {
type: 'add',
fuc: () => {},
@ -103,18 +133,37 @@
const onSearch = () => {
console.log(searchValue.value);
fetch(origanizemanage.queryOrgTree, { orgName: searchValue.value, orgId }).then((res) => {
treeData.value = res.data;
});
};
const onSearch2 = () => {
console.log(searchValue2.value);
fetch(origanizemanage.queryDeptTree, { deptName: searchValue2.value, orgId }).then(
(res) => {
treeData2.value = res.data;
},
);
};
const tableFetch = (params) => {
tableConfig.value.params = {
...tableConfig.value.params,
...params,
};
mainRef.value?.nsTableRef.reload();
};
const handleSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
treeData2.value = res.data;
});
tableFetch({ orgId: info.node?.orgInfo.orgId });
};
const handleSelect2 = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
tableFetch({ deptId: info.node?.deptInfo.deptId });
};
const onClose = () => {
@ -124,31 +173,38 @@
const onEdit = () => {
formRef.value?.triggerSubmit().then(() => {
console.log(formData.value, 'formData.value');
opMap.fuc && opMap.fuc(formData.value);
if (!userAuthList.value.length) {
NsMessage.error('请添加用户权限');
return;
}
opMap.fuc && opMap.fuc({ ...formData.value, userRoleList: userAuthList.value, orgId });
visible.value = false;
});
};
const handleOk = () => {
console.log(formData2.value, 'formData2.value');
console.log(opMap.type, 'type');
if (opMap.type === 'add') {
mockData2.value.push({ information: casData.value.join('/') });
} else {
if (casData.value?.length !== 3) {
NsMessage.error('未选择角色');
}
userAuthList.value.push({
userAuthList: cloneDeep(casData.value),
roleId: casData.value[2].value,
roleName: casData.value[2].label,
});
addformvisible.value = false;
};
const handleClose = () => {
addformvisible.value = false;
};
const tableConfig = {
const tableConfig = ref({
title: '用户管理',
api: origanizemanage.userList,
params: {
orgId: JSON.parse(sessionStorage.getItem('userInfo')).orgId,
orgId,
},
listField: 'data.records',
headerActions: [
{
label: '新增',
@ -158,11 +214,9 @@
opMap.type = 'add';
opMap.fuc = (formData: any) => {
console.log(formData, 'formData');
// origanizemanage.addUser
// mockData.value.push({
// id: Math.random().toString().slice(2, 6),
// ...cloneDeep(formData),
// });
http.post(origanizemanage.addUser, formData).then(() => {
visible.value = false;
});
};
visible.value = true;
},
@ -187,33 +241,14 @@
{
label: '批量删除',
type: 'primary',
name: 'RoleTypeAdd',
name: 'userBatchDel',
dynamicDisabled: (data: any) => {
return data.list.length === 0;
},
confirm: true,
isReload: true,
handle: (data: any) => {
console.log('object :>> ', data.list);
const idList = data.list.map((item) => item.id);
mockData.value.splice(0);
return;
const copyData = cloneDeep(mockData.value);
mockData.value = copyData.filter((tar) => {
return !idList.includes(tar.id);
});
console.log(mockData.value);
return;
copyData.map((item, index) => {
if (idList.includes(item.id)) {
mockData.value.filter((tar) => {
return !idList.includes(tar.id);
});
}
});
},
api: origanizemanage.batchDel,
dynamicParams: { userIds: 'userId[]' },
},
],
columns: [
@ -258,30 +293,34 @@
},
{
title: '组织关系',
dataIndex: 'deptInfo',
customRender: (value) => {
return value.record.deptInfo.orgName;
},
dataIndex: 'orgName',
},
{
title: '部门/角色',
dataIndex: 'orgInfo',
customRender: (value) => {
// // console.log(value.record.orgInfo.orgName, 'ss');
// console.log(
// value.record.userRoleList.map((item) => {
// return `${value.record.orgInfo.orgName}/${item.roleName}`;
// }),
// );
// value.record.userRoleList.map((item) => {
// return `${value.record.orgInfo.orgName}/${item.roleName}`;
// });
// return `${value.record.orgInfo.orgName}/`;
dataIndex: 'deptRoleInfoList',
customRender: ({ value }) => {
if (!value) return '-';
return createVNode('div', {}, [
createVNode('span', {}, value[0]),
value.length > 1 &&
createVNode(
'a',
{
onClick: () =>
NsModal.info({
icon: null,
content: createVNode('div', { innerHTML: value.join('<br>') }),
}),
},
`+${value.length}`,
),
]);
},
},
{
title: '状态',
dataIndex: 'userStatus',
customRender: ({ value }) => ['正常', '冻结'][value],
},
],
columnActions: {
@ -306,61 +345,30 @@
},
{
label: '冻结',
name: 'RoleTypeEdit',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '是否冻结该账户',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
// http
// .post('/api/parking_merchant/objs/gateInfo/delete', {
// uuid: record.uuid,
// })
// .then((res) => {
// mainRef.value.nsTableRef.reload();
// });
NsMessage.success('冻结成功');
},
class: 'test',
});
},
name: 'userFrozen',
confirm: true,
defaultParams: { userStatus: 1 },
dynamicParams: 'userId',
isReload: true,
api: origanizemanage.frozen,
},
{
label: '重置密码',
name: 'RoleTypeEdit',
handle: (record: any) => {
console.log(record, 'record');
Modal.confirm({
title: '是否重置密码',
icon: createVNode(ExclamationCircleOutlined),
content: createVNode('div', { style: 'color:red;' }, ''),
onOk() {
// Modal.success({
// title: ',123456',
// });
NsMessage.success('密码重置成功,初始密码123456');
},
onCancel() {
console.log('Cancel');
},
class: 'test',
});
name: 'userCodeReset',
confirm: true,
handle: ({ userId }: any) => {
http
.post(origanizemanage.resetPwd, { userId })
.then(() => NsModal.success({ content: '密码重置成功,初始密码123456' }));
},
},
{
label: '删除',
name: 'RoleTypeEdit',
dynamicParams: {
uuid: 'uuid',
},
name: 'userDelete',
dynamicParams: 'userId',
confirm: true,
handle: (record: any, name: any, reload: any) => {
console.log(record, name, reload, 'record');
mockData.value.splice(0, 1);
},
isReload: true,
api: origanizemanage.del,
},
],
},
@ -409,15 +417,15 @@
component: 'NsSelect',
componentProps: {
placeholder: '请选择',
disabled: true,
allowClear: true,
options: [
{
label: '正常',
value: 1,
value: 0,
},
{
label: '冻结',
value: 2,
value: 1,
},
],
},
@ -427,14 +435,13 @@
},
// pagination: { defaultPageSize: 10 },
rowKey: 'id',
};
});
const tableConfig2 = {
// api: {
// url: '/carbon_emission/device/getGatewayList',
// method: 'post',
// },
value: mockData2.value,
listField: 'data.records',
value: userAuthList.value,
rowSelection: null,
headerActions: [
{
@ -442,11 +449,11 @@
name: 'RoleTypeAdd',
type: 'primary',
handle: () => {
opMap.type = 'add';
opMap.fuc = (formData2: any) => {
console.log(formData2, 'formData2');
mockData2.value.push(cloneDeep(formData2));
};
// opMap.type = 'add';
// opMap.fuc = (formData2: any) => {
// console.log(formData2, 'formData2');
// userAuthList.value.push(cloneDeep(formData2));
// };
addformvisible.value = true;
},
},
@ -454,36 +461,52 @@
columns: [
{
title: '角色信息',
dataIndex: 'information',
dataIndex: 'userRoleList',
customRender: ({ record }) => {
if (record) {
const res = record.userAuthList.reduce((pre, cur) => {
pre.push(cur.label);
return pre;
}, []);
return res.join('/');
}
return '-';
},
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'RoleTypeEdit',
// dynamicParams: 'uuid',
handle: (record: any) => {
console.log(record, 'record');
formData2.value = record;
opMap.type = 'edit';
opMap.fuc = (formData2: any) => {
Object.assign(
mockData.value.filter((item) => item.id === record.id)[0],
formData2,
);
};
addformvisible.value = true;
},
},
// {
// label: '',
// name: 'RoleTypeEdit',
// // dynamicParams: 'uuid',
// handle: (record: any) => {
// console.log(record, 'record');
// formData2.value = record;
// opMap.type = 'edit';
// opMap.fuc = (formData2: any) => {
// Object.assign(
// mockData.value.filter((item) => item.id === record.id)[0],
// formData2,
// );
// };
// addformvisible.value = true;
// },
// },
{
label: '删除',
name: 'RoleTypeEdit',
confirm: true,
handle: (record: any, name: any, reload: any) => {
console.log(record, name, reload, 'record');
mockData2.value.splice(0, 1);
const id = record.roleId;
console.log(userAuthList.value, id);
let idx = 0;
userAuthList.value?.some((item, index) => {
idx = index;
if (item.roleId === id) return true;
});
userAuthList.value.splice(idx, 1);
},
},
],
@ -523,16 +546,16 @@
display: flex;
}
.left {
width: 400px;
width: 350px;
border-right: 5px solid rgb(229, 235, 240);
min-width: fit-content;
}
.right {
flex: 1;
overflow: auto;
min-width: 0;
}
.top {
height: 46vh;
height: 50%;
border-bottom: 5px solid rgb(229, 235, 240);
}
.ns-table-title {
@ -550,10 +573,13 @@
font-size: 16px;
font-weight: bold;
user-select: text;
padding-left: 16px;
width: calc(100% + 32px);
}
.form {
margin-left: 10px;
.drawerTable {
:deep(.ns-table-container),
:deep(.ns-table-main) {
border-top: 0;
padding: 0;
}
}
</style>

2
hx-ai-intelligent/src/view/organizationManage/usermanage/mock.ts

@ -1,4 +1,6 @@
import { ref } from 'vue';
import { origanizemanage } from '/@/api/origanizemanage';
import { http } from '/nerv-lib/saas';
export const mockData = ref([
{

2
hx-ai-intelligent/vite.config.ts

@ -12,7 +12,7 @@ const proxy = {
changeOrigin: true,
},
'/carbon-smart': {
target: 'http://192.168.100.115:8224/',
target: 'http://192.168.112.144:8224',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/carbon-smart/, ''),
},

2
lib/component/table/table-header.vue

@ -76,7 +76,7 @@
<style lang="less" scoped>
.ns-table-header {
min-width: 500px;
min-width: fit-content;
user-select: none;
// padding: 16px 0;
padding-top: 16px;

6
lib/component/table/table.vue

@ -383,7 +383,7 @@
if (pagination) {
const current = get(dataRef.value, props.pageField);
// console.log(current);
console.log(current);
function getTotal() {
let total = 0;
if (isFunction(getPageParams)) {
@ -406,7 +406,7 @@
},
...(pagination as Props),
total: getTotal(),
current: (current >= 0 ? current : 0) + props.pageFieldOffset, // 0
current: (current >= 0 ? current : 0) + props.pageFieldOffset, // 1
pageSize: get(dataRef.value, props.sizeField),
};
}
@ -432,7 +432,7 @@
() => getTableBindValues.value.api,
() => {
// console.log(getTableBindValues.value.api);
fetch(); //api
// fetch(); //api
},
{
immediate: true,

2
lib/saas/config/table.config.ts

@ -5,7 +5,7 @@ export const tableConfig = {
listField: 'data.records', // 数据集合
totalField: 'data.total', // 数据总数
pageFieldOffset: 1, //前端页码1开始,后端0 偏移量 1
pageFieldOffset: 0, //前端页码1开始,后端0 偏移量 1
pageSizeOptions: ['10', '20', '40'], // 分页设置种类
defaultPageSize: 10, // 默认每页数量
paramsPageSizeField: 'pageSize',

Loading…
Cancel
Save