feat: 用户联调
This commit is contained in:
@@ -1,4 +1,19 @@
|
|||||||
export const origanizemanage = {
|
const BASE_URL = '/carbon-smart';
|
||||||
userList: '/carbon-smart/api/user/queryUserByPage',
|
|
||||||
addUser: '/carbon-smart/api/user/save',
|
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`,
|
||||||
|
}
|
||||||
|
@@ -74,6 +74,8 @@ export const appConfig = {
|
|||||||
accountName: 'realName',
|
accountName: 'realName',
|
||||||
accountRealName: 'realName',
|
accountRealName: 'realName',
|
||||||
orgId: 'orgId',
|
orgId: 'orgId',
|
||||||
|
orgName: 'orgName',
|
||||||
|
projectId: 'projectId',
|
||||||
});
|
});
|
||||||
return { data: { ...trD } };
|
return { data: { ...trD } };
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,8 @@ const equipment = {
|
|||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
name: 'LedgerIndex',
|
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: {
|
meta: {
|
||||||
title: '设备台账',
|
title: '设备台账',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
@@ -9,7 +9,7 @@ export const formConfig = (disabled: Boolean) => {
|
|||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
label: '部门名称',
|
label: '部门名称',
|
||||||
field: 'name',
|
field: 'deptName',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: disabled,
|
disabled: disabled,
|
||||||
@@ -23,27 +23,27 @@ export const formConfig = (disabled: Boolean) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: '上级部门',
|
// label: '上级部门',
|
||||||
field: 'department',
|
// field: 'department',
|
||||||
component: 'NsSelect',
|
// component: 'NsSelect',
|
||||||
componentProps: {
|
// componentProps: {
|
||||||
disabled: true,
|
// disabled: true,
|
||||||
options: [
|
// options: [
|
||||||
{
|
// {
|
||||||
label: '部门1',
|
// label: '部门1',
|
||||||
value: 1,
|
// value: 1,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
label: '部门2',
|
// label: '部门2',
|
||||||
value: 2,
|
// value: 2,
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: '部门编码',
|
label: '部门编码',
|
||||||
field: 'code',
|
field: 'deptCode',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: disabled,
|
disabled: disabled,
|
||||||
|
@@ -9,9 +9,13 @@
|
|||||||
<ns-button style="margin: 10px" type="primary" @click="addApartment">新增部门</ns-button>
|
<ns-button style="margin: 10px" type="primary" @click="addApartment">新增部门</ns-button>
|
||||||
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button>
|
<ns-button type="primary" @click="addApartmentSon">新增子部门</ns-button>
|
||||||
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button>
|
<ns-button style="margin: 10px" type="primary" @click="deleteApartment">删除</ns-button>
|
||||||
<a-tree :tree-data="apartmentTreeData" defaultExpandAll @select="SelectApartmentTree">
|
<a-tree
|
||||||
<template #title="{ title }">
|
v-if="apartmentTreeData?.length"
|
||||||
{{ title }}
|
:tree-data="apartmentTreeData"
|
||||||
|
defaultExpandAll
|
||||||
|
@select="SelectApartmentTree">
|
||||||
|
<template #title="data">
|
||||||
|
{{ data.deptInfo.deptName }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -39,9 +43,7 @@
|
|||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<ns-button style="margin: 20px" type="primary" @click="CancelApartment">取消</ns-button>
|
<ns-button style="margin: 20px" type="primary" @click="CancelApartment">取消</ns-button>
|
||||||
<ns-button type="primary" @click="ApartmentSure">{{
|
<ns-button type="primary" @click="ApartmentSure">确定</ns-button>
|
||||||
disabled ? '编辑' : '确定'
|
|
||||||
}}</ns-button>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,8 +55,8 @@
|
|||||||
<ns-button type="primary" @click="addUserSon">新增子角色</ns-button>
|
<ns-button type="primary" @click="addUserSon">新增子角色</ns-button>
|
||||||
<ns-button style="margin: 10px" type="primary" @click="deleteUser">删除</ns-button>
|
<ns-button style="margin: 10px" type="primary" @click="deleteUser">删除</ns-button>
|
||||||
<a-tree :tree-data="userTreeData" defaultExpandAll @select="SelectUserTree">
|
<a-tree :tree-data="userTreeData" defaultExpandAll @select="SelectUserTree">
|
||||||
<template #title="{ title }">
|
<template #title="data">
|
||||||
{{ title }}
|
{{ data }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -95,6 +97,8 @@
|
|||||||
import { uuid } from '@antv/x6/lib/util/string/uuid';
|
import { uuid } from '@antv/x6/lib/util/string/uuid';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { formConfig, formConfig2 } from './config';
|
import { formConfig, formConfig2 } from './config';
|
||||||
|
import { department } from '/@/api/origanizemanage';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'AuthorityManageIndex',
|
name: 'AuthorityManageIndex',
|
||||||
setup() {
|
setup() {
|
||||||
@@ -113,6 +117,9 @@
|
|||||||
const selectRef2 = ref();
|
const selectRef2 = ref();
|
||||||
const formSchema = formConfig(disabled as any);
|
const formSchema = formConfig(disabled as any);
|
||||||
const formSchema2 = formConfig2(disabled2 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, () => {
|
watch(ApartcheckedKeys, () => {
|
||||||
console.log('checkedKeys', ApartcheckedKeys.value);
|
console.log('checkedKeys', ApartcheckedKeys.value);
|
||||||
});
|
});
|
||||||
@@ -120,23 +127,20 @@
|
|||||||
console.log('checkedKeys', UsercheckedKeys.value);
|
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 = {
|
const opMap: any = {
|
||||||
type: 'add',
|
type: 'add',
|
||||||
fuc: () => {},
|
fuc: () => {},
|
||||||
record: {},
|
record: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const apartmentTreeData = ref([
|
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 userTreeData = ref([
|
const userTreeData = ref([
|
||||||
{
|
{
|
||||||
@@ -182,14 +186,31 @@
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
function fetch(api, params) {
|
||||||
|
return http.post(api, params);
|
||||||
|
}
|
||||||
|
|
||||||
const addApartment = () => {
|
const addApartment = () => {
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'add';
|
opMap.type = 'add';
|
||||||
|
opMap.fuc = (params) => {
|
||||||
|
fetch(department.deptSave, { ...params, orgId, projectId });
|
||||||
|
};
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addApartmentSon = () => {
|
const addApartmentSon = () => {
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'addson';
|
opMap.type = 'addson';
|
||||||
|
formData.value = {};
|
||||||
|
opMap.fuc = (params) => {
|
||||||
|
fetch(department.deptSave, {
|
||||||
|
...params,
|
||||||
|
orgId,
|
||||||
|
projectId,
|
||||||
|
pdeptId: selectRef.value.deptInfo.deptId,
|
||||||
|
});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const addUser = () => {
|
const addUser = () => {
|
||||||
@@ -243,12 +264,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SelectApartmentTree = (selectedKeys: any, info: any) => {
|
const SelectApartmentTree = (selectedKeys: any, info: any) => {
|
||||||
|
console.log(selectedKeys, info);
|
||||||
|
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
console.log(selectedKeys, 'selectedKeys');
|
console.log(selectedKeys, 'selectedKeys');
|
||||||
console.log(info.node.dataRef, 'info');
|
console.log(info.node.dataRef, 'info');
|
||||||
selectKey.value = selectedKeys[0];
|
selectKey.value = selectedKeys[0];
|
||||||
selectRef.value = info.node.dataRef;
|
selectRef.value = info.node.dataRef;
|
||||||
formData.value = info.node.dataRef.info;
|
formData.value = info.node.dataRef.deptInfo;
|
||||||
};
|
};
|
||||||
const SelectUserTree = (selectedKeys: any, info: any) => {
|
const SelectUserTree = (selectedKeys: any, info: any) => {
|
||||||
disabled2.value = false;
|
disabled2.value = false;
|
||||||
@@ -280,24 +303,17 @@
|
|||||||
const ApartmentSure = () => {
|
const ApartmentSure = () => {
|
||||||
// formRef.value?.triggerSubmit().then(() => {});
|
// formRef.value?.triggerSubmit().then(() => {});
|
||||||
|
|
||||||
disabled.value = !disabled.value;
|
// disabled.value = !disabled.value;
|
||||||
opMap.fuc && opMap.fuc(formData.value);
|
|
||||||
// console.log(formData.value.name, 'formData');
|
// console.log(formData.value.name, 'formData');
|
||||||
console.log(opMap.type, 'opMap.type');
|
console.log(opMap.type, 'opMap.type');
|
||||||
if (opMap.type === 'add') {
|
if (opMap.type === 'add') {
|
||||||
apartmentTreeData.value[0].children.push({
|
console.log(formRef.value, formData);
|
||||||
title: formData.value.name,
|
opMap.fuc && opMap.fuc(formData.value);
|
||||||
key: 'a1',
|
|
||||||
info: { ...formData.value },
|
|
||||||
});
|
|
||||||
} else if (selectRef.value && opMap.type === 'addson')
|
} else if (selectRef.value && opMap.type === 'addson')
|
||||||
selectRef.value['children'] = [
|
opMap.fuc && opMap.fuc(formData.value);
|
||||||
{ key: '123', title: formData.value.name, info: { ...cloneDeep(formData.value) } },
|
|
||||||
];
|
|
||||||
else {
|
else {
|
||||||
console.log('ss');
|
console.log('ss');
|
||||||
}
|
}
|
||||||
formData.value = {};
|
|
||||||
};
|
};
|
||||||
const UserSure = () => {
|
const UserSure = () => {
|
||||||
disabled2.value = !disabled2.value;
|
disabled2.value = !disabled2.value;
|
||||||
|
@@ -4,6 +4,8 @@ import { Modal } from 'ant-design-vue';
|
|||||||
import { createVNode, ref } from 'vue';
|
import { createVNode, ref } from 'vue';
|
||||||
import { NsMessage } from '/nerv-lib/component';
|
import { NsMessage } from '/nerv-lib/component';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { http } from '/nerv-lib/util';
|
||||||
|
import { origanizemanage } from '/@/api/origanizemanage';
|
||||||
export const formConfig = [
|
export const formConfig = [
|
||||||
{
|
{
|
||||||
field: 'field111',
|
field: 'field111',
|
||||||
@@ -48,8 +50,8 @@ export const formConfig = [
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
radioType: 'radio',
|
radioType: 'radio',
|
||||||
options: [
|
options: [
|
||||||
{ label: '男', value: 1 },
|
{ label: '男', value: '男' },
|
||||||
{ label: '女', value: 2 },
|
{ label: '女', value: '女' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -80,8 +82,9 @@ export const formConfig = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '组织关系',
|
label: '组织关系',
|
||||||
field: 'relation',
|
field: 'orgName',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
|
defaultValue: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
maxLength: 30,
|
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) => {
|
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([
|
return ref([
|
||||||
{
|
{
|
||||||
field: 'information',
|
field: 'information',
|
||||||
component: 'NsCascader',
|
component: 'NsCascader',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
displayRender: ({ labels }: any) => {
|
displayRender: ({ labels, selectedOptions }: any) => {
|
||||||
casData.value = labels;
|
console.log(labels, selectedOptions);
|
||||||
|
|
||||||
|
casData.value = selectedOptions.map(({ label, value }) => {
|
||||||
|
return { label, value };
|
||||||
|
});
|
||||||
return labels.join('/');
|
return labels.join('/');
|
||||||
},
|
},
|
||||||
options: [
|
// defaultValue: [1, 1, 3],
|
||||||
{
|
// options: options,
|
||||||
value: '1',
|
// changeOnSelect: true,
|
||||||
label: '铁路局',
|
loadData: (selectedOptions, options) => {
|
||||||
children: [
|
console.log(selectedOptions, options, 'selectedOptions, options');
|
||||||
{
|
|
||||||
value: '2',
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
label: '产品部',
|
let transForm, params;
|
||||||
children: [
|
// load options lazily
|
||||||
{
|
if (!selectedOptions.length) {
|
||||||
value: '3',
|
transForm = (data) => {
|
||||||
label: '产品总监',
|
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];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@@ -5,37 +5,38 @@
|
|||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="ns-table-title">关联企业</div>
|
<div class="ns-table-title">关联企业</div>
|
||||||
<div>
|
<div style="height: 100%; overflow-y: auto">
|
||||||
<a-input-search
|
<a-input-search
|
||||||
v-model:value="searchValue"
|
v-model:value="searchValue"
|
||||||
style="margin-bottom: 8px"
|
style="margin-bottom: 8px"
|
||||||
placeholder="请输入关联企业"
|
placeholder="请输入关联企业"
|
||||||
@search="onSearch" />
|
@search="onSearch" />
|
||||||
<a-tree :tree-data="treeData" defaultExpandAll @select="handleSelect">
|
<a-tree
|
||||||
<template #title="{ title }">
|
v-if="treeData?.length"
|
||||||
{{ title }}
|
:tree-data="treeData"
|
||||||
<!-- <span v-if="title.indexOf(searchValue) > -1">
|
defaultExpandAll
|
||||||
{{ title.substring(0, title.indexOf(searchValue)) }}
|
@select="handleSelect">
|
||||||
</span>
|
<template #title="data">
|
||||||
<span v-else>{{ title }}</span> -->
|
{{ data.orgInfo?.orgName }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ns-table-title">关联部门</div>
|
|
||||||
<div>
|
<div>
|
||||||
|
<div class="ns-table-title">关联部门</div>
|
||||||
|
|
||||||
<a-input-search
|
<a-input-search
|
||||||
v-model:value="searchValue2"
|
v-model:value="searchValue2"
|
||||||
style="margin-bottom: 8px"
|
style="margin-bottom: 8px"
|
||||||
placeholder="请输入关联部门"
|
placeholder="请输入关联部门"
|
||||||
@search="onSearch2" />
|
@search="onSearch2" />
|
||||||
<a-tree :tree-data="treeData2" defaultExpandAll @select="handleSelect2">
|
<a-tree
|
||||||
<template #title="{ title }">
|
v-if="treeData2?.length"
|
||||||
{{ title }}
|
:tree-data="treeData2"
|
||||||
<!-- <span v-if="title.indexOf(searchValue) > -1">
|
defaultExpandAll
|
||||||
{{ title.substring(0, title.indexOf(searchValue)) }}
|
@select="handleSelect2">
|
||||||
</span>
|
<template #title="data">
|
||||||
<span v-else>{{ title }}</span> -->
|
{{ data.deptInfo?.deptName }}
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,17 +45,31 @@
|
|||||||
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
|
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
|
||||||
</div>
|
</div>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:width="1200"
|
:width="500"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:body-style="{ paddingBottom: '80px' }"
|
:body-style="{ paddingBottom: '80px' }"
|
||||||
:footer-style="{ textAlign: 'right' }"
|
:footer-style="{ textAlign: 'right' }"
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
@close="onClose">
|
@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>
|
<span class="admin">用户权限</span>
|
||||||
<ns-view-list-table v-bind="tableConfig2" :model="data" ref="mainRef" rowKey="uuid" />
|
<ns-view-list-table
|
||||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
v-bind="tableConfig2"
|
||||||
<a-button type="primary" @click="onEdit">确定</a-button>
|
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-drawer>
|
||||||
|
|
||||||
<a-modal
|
<a-modal
|
||||||
@@ -69,15 +84,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Modal } from 'ant-design-vue';
|
|
||||||
import { createVNode, defineComponent, reactive, ref } from 'vue';
|
import { createVNode, defineComponent, reactive, ref } from 'vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { NsMessage } from '/nerv-lib/component';
|
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||||
import { formConfig, formConfig2 } from './config';
|
import { formConfig, formConfig2 } from './config';
|
||||||
import { mockData, mockData2, treeData, treeData2 } from './mock';
|
import { origanizemanage, department } from '/@/api/origanizemanage';
|
||||||
import { origanizemanage } from '/@/api/origanizemanage';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'OrderListIndex',
|
name: 'OrderListIndex',
|
||||||
@@ -85,7 +98,7 @@
|
|||||||
const mainRef = ref();
|
const mainRef = ref();
|
||||||
const data = reactive({});
|
const data = reactive({});
|
||||||
let formData = ref({});
|
let formData = ref({});
|
||||||
let formData2 = ref({});
|
let formData2 = ref({ userRoleList: [1, 1, 3] });
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const addformvisible = ref(false);
|
const addformvisible = ref(false);
|
||||||
@@ -94,7 +107,24 @@
|
|||||||
const formSchema = formConfig;
|
const formSchema = formConfig;
|
||||||
const casData = ref([]);
|
const casData = ref([]);
|
||||||
const formSchema2 = formConfig2(casData);
|
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 = {
|
const opMap: any = {
|
||||||
type: 'add',
|
type: 'add',
|
||||||
fuc: () => {},
|
fuc: () => {},
|
||||||
@@ -103,18 +133,37 @@
|
|||||||
|
|
||||||
const onSearch = () => {
|
const onSearch = () => {
|
||||||
console.log(searchValue.value);
|
console.log(searchValue.value);
|
||||||
|
fetch(origanizemanage.queryOrgTree, { orgName: searchValue.value, orgId }).then((res) => {
|
||||||
|
treeData.value = res.data;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const onSearch2 = () => {
|
const onSearch2 = () => {
|
||||||
console.log(searchValue2.value);
|
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) => {
|
const handleSelect = (selectedKeys: any, info: any) => {
|
||||||
console.log(selectedKeys, 'selectedKeys');
|
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
||||||
console.log(info, 'info');
|
treeData2.value = res.data;
|
||||||
|
});
|
||||||
|
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect2 = (selectedKeys: any, info: any) => {
|
const handleSelect2 = (selectedKeys: any, info: any) => {
|
||||||
console.log(selectedKeys, 'selectedKeys');
|
tableFetch({ deptId: info.node?.deptInfo.deptId });
|
||||||
console.log(info, 'info');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
@@ -124,31 +173,38 @@
|
|||||||
const onEdit = () => {
|
const onEdit = () => {
|
||||||
formRef.value?.triggerSubmit().then(() => {
|
formRef.value?.triggerSubmit().then(() => {
|
||||||
console.log(formData.value, 'formData.value');
|
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;
|
visible.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
console.log(formData2.value, 'formData2.value');
|
console.log(formData2.value, 'formData2.value');
|
||||||
console.log(opMap.type, 'type');
|
if (casData.value?.length !== 3) {
|
||||||
if (opMap.type === 'add') {
|
NsMessage.error('未选择角色');
|
||||||
mockData2.value.push({ information: casData.value.join('/') });
|
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
userAuthList.value.push({
|
||||||
|
userAuthList: cloneDeep(casData.value),
|
||||||
|
roleId: casData.value[2].value,
|
||||||
|
roleName: casData.value[2].label,
|
||||||
|
});
|
||||||
addformvisible.value = false;
|
addformvisible.value = false;
|
||||||
};
|
};
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
addformvisible.value = false;
|
addformvisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableConfig = {
|
const tableConfig = ref({
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
api: origanizemanage.userList,
|
api: origanizemanage.userList,
|
||||||
params: {
|
params: {
|
||||||
orgId: JSON.parse(sessionStorage.getItem('userInfo')).orgId,
|
orgId,
|
||||||
},
|
},
|
||||||
listField: 'data.records',
|
|
||||||
headerActions: [
|
headerActions: [
|
||||||
{
|
{
|
||||||
label: '新增',
|
label: '新增',
|
||||||
@@ -158,11 +214,9 @@
|
|||||||
opMap.type = 'add';
|
opMap.type = 'add';
|
||||||
opMap.fuc = (formData: any) => {
|
opMap.fuc = (formData: any) => {
|
||||||
console.log(formData, 'formData');
|
console.log(formData, 'formData');
|
||||||
// origanizemanage.addUser
|
http.post(origanizemanage.addUser, formData).then(() => {
|
||||||
// mockData.value.push({
|
visible.value = false;
|
||||||
// id: Math.random().toString().slice(2, 6),
|
});
|
||||||
// ...cloneDeep(formData),
|
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
},
|
},
|
||||||
@@ -187,33 +241,14 @@
|
|||||||
{
|
{
|
||||||
label: '批量删除',
|
label: '批量删除',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
name: 'RoleTypeAdd',
|
name: 'userBatchDel',
|
||||||
dynamicDisabled: (data: any) => {
|
dynamicDisabled: (data: any) => {
|
||||||
return data.list.length === 0;
|
return data.list.length === 0;
|
||||||
},
|
},
|
||||||
confirm: true,
|
confirm: true,
|
||||||
isReload: true,
|
isReload: true,
|
||||||
handle: (data: any) => {
|
api: origanizemanage.batchDel,
|
||||||
console.log('object :>> ', data.list);
|
dynamicParams: { userIds: 'userId[]' },
|
||||||
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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
@@ -258,30 +293,34 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '组织关系',
|
title: '组织关系',
|
||||||
dataIndex: 'deptInfo',
|
dataIndex: 'orgName',
|
||||||
customRender: (value) => {
|
|
||||||
return value.record.deptInfo.orgName;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '部门/角色',
|
title: '部门/角色',
|
||||||
dataIndex: 'orgInfo',
|
dataIndex: 'deptRoleInfoList',
|
||||||
customRender: (value) => {
|
customRender: ({ value }) => {
|
||||||
// // console.log(value.record.orgInfo.orgName, 'ss');
|
if (!value) return '-';
|
||||||
// console.log(
|
return createVNode('div', {}, [
|
||||||
// value.record.userRoleList.map((item) => {
|
createVNode('span', {}, value[0]),
|
||||||
// return `${value.record.orgInfo.orgName}/${item.roleName}`;
|
value.length > 1 &&
|
||||||
// }),
|
createVNode(
|
||||||
// );
|
'a',
|
||||||
// value.record.userRoleList.map((item) => {
|
{
|
||||||
// return `${value.record.orgInfo.orgName}/${item.roleName}`;
|
onClick: () =>
|
||||||
// });
|
NsModal.info({
|
||||||
// return `${value.record.orgInfo.orgName}/`;
|
icon: null,
|
||||||
|
content: createVNode('div', { innerHTML: value.join('<br>') }),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
`+${value.length}`,
|
||||||
|
),
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'userStatus',
|
dataIndex: 'userStatus',
|
||||||
|
customRender: ({ value }) => ['正常', '冻结'][value],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
columnActions: {
|
columnActions: {
|
||||||
@@ -306,61 +345,30 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: '冻结',
|
||||||
name: 'RoleTypeEdit',
|
name: 'userFrozen',
|
||||||
handle: (record: any) => {
|
confirm: true,
|
||||||
console.log(record, 'record');
|
defaultParams: { userStatus: 1 },
|
||||||
Modal.confirm({
|
dynamicParams: 'userId',
|
||||||
title: '是否冻结该账户',
|
isReload: true,
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
api: origanizemanage.frozen,
|
||||||
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',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '重置密码',
|
label: '重置密码',
|
||||||
name: 'RoleTypeEdit',
|
name: 'userCodeReset',
|
||||||
handle: (record: any) => {
|
confirm: true,
|
||||||
console.log(record, 'record');
|
handle: ({ userId }: any) => {
|
||||||
Modal.confirm({
|
http
|
||||||
title: '是否重置密码',
|
.post(origanizemanage.resetPwd, { userId })
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
.then(() => NsModal.success({ content: '密码重置成功,初始密码123456' }));
|
||||||
content: createVNode('div', { style: 'color:red;' }, ''),
|
|
||||||
onOk() {
|
|
||||||
// Modal.success({
|
|
||||||
// title: '密码重置成功,初始密码123456',
|
|
||||||
// });
|
|
||||||
NsMessage.success('密码重置成功,初始密码123456');
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
console.log('Cancel');
|
|
||||||
},
|
|
||||||
class: 'test',
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
name: 'RoleTypeEdit',
|
name: 'userDelete',
|
||||||
dynamicParams: {
|
dynamicParams: 'userId',
|
||||||
uuid: 'uuid',
|
|
||||||
},
|
|
||||||
confirm: true,
|
confirm: true,
|
||||||
handle: (record: any, name: any, reload: any) => {
|
isReload: true,
|
||||||
console.log(record, name, reload, 'record');
|
api: origanizemanage.del,
|
||||||
mockData.value.splice(0, 1);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -409,15 +417,15 @@
|
|||||||
component: 'NsSelect',
|
component: 'NsSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
disabled: true,
|
allowClear: true,
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: '正常',
|
||||||
value: 1,
|
value: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '冻结',
|
label: '冻结',
|
||||||
value: 2,
|
value: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -427,14 +435,13 @@
|
|||||||
},
|
},
|
||||||
// pagination: { defaultPageSize: 10 },
|
// pagination: { defaultPageSize: 10 },
|
||||||
rowKey: 'id',
|
rowKey: 'id',
|
||||||
};
|
});
|
||||||
const tableConfig2 = {
|
const tableConfig2 = {
|
||||||
// api: {
|
// api: {
|
||||||
// url: '/carbon_emission/device/getGatewayList',
|
// url: '/carbon_emission/device/getGatewayList',
|
||||||
// method: 'post',
|
// method: 'post',
|
||||||
// },
|
// },
|
||||||
value: mockData2.value,
|
value: userAuthList.value,
|
||||||
listField: 'data.records',
|
|
||||||
rowSelection: null,
|
rowSelection: null,
|
||||||
headerActions: [
|
headerActions: [
|
||||||
{
|
{
|
||||||
@@ -442,11 +449,11 @@
|
|||||||
name: 'RoleTypeAdd',
|
name: 'RoleTypeAdd',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handle: () => {
|
handle: () => {
|
||||||
opMap.type = 'add';
|
// opMap.type = 'add';
|
||||||
opMap.fuc = (formData2: any) => {
|
// opMap.fuc = (formData2: any) => {
|
||||||
console.log(formData2, 'formData2');
|
// console.log(formData2, 'formData2');
|
||||||
mockData2.value.push(cloneDeep(formData2));
|
// userAuthList.value.push(cloneDeep(formData2));
|
||||||
};
|
// };
|
||||||
addformvisible.value = true;
|
addformvisible.value = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -454,36 +461,52 @@
|
|||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '角色信息',
|
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: {
|
columnActions: {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
// {
|
||||||
label: '编辑',
|
// label: '编辑',
|
||||||
name: 'RoleTypeEdit',
|
// name: 'RoleTypeEdit',
|
||||||
// dynamicParams: 'uuid',
|
// // dynamicParams: 'uuid',
|
||||||
handle: (record: any) => {
|
// handle: (record: any) => {
|
||||||
console.log(record, 'record');
|
// console.log(record, 'record');
|
||||||
formData2.value = record;
|
// formData2.value = record;
|
||||||
opMap.type = 'edit';
|
// opMap.type = 'edit';
|
||||||
opMap.fuc = (formData2: any) => {
|
// opMap.fuc = (formData2: any) => {
|
||||||
Object.assign(
|
// Object.assign(
|
||||||
mockData.value.filter((item) => item.id === record.id)[0],
|
// mockData.value.filter((item) => item.id === record.id)[0],
|
||||||
formData2,
|
// formData2,
|
||||||
);
|
// );
|
||||||
};
|
// };
|
||||||
addformvisible.value = true;
|
// addformvisible.value = true;
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
name: 'RoleTypeEdit',
|
name: 'RoleTypeEdit',
|
||||||
confirm: true,
|
confirm: true,
|
||||||
handle: (record: any, name: any, reload: any) => {
|
handle: (record: any, name: any, reload: any) => {
|
||||||
console.log(record, name, reload, 'record');
|
const id = record.roleId;
|
||||||
mockData2.value.splice(0, 1);
|
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;
|
display: flex;
|
||||||
}
|
}
|
||||||
.left {
|
.left {
|
||||||
width: 400px;
|
width: 350px;
|
||||||
border-right: 5px solid rgb(229, 235, 240);
|
border-right: 5px solid rgb(229, 235, 240);
|
||||||
min-width: fit-content;
|
min-width: fit-content;
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: auto;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.top {
|
.top {
|
||||||
height: 46vh;
|
height: 50%;
|
||||||
border-bottom: 5px solid rgb(229, 235, 240);
|
border-bottom: 5px solid rgb(229, 235, 240);
|
||||||
}
|
}
|
||||||
.ns-table-title {
|
.ns-table-title {
|
||||||
@@ -550,10 +573,13 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
padding-left: 16px;
|
|
||||||
width: calc(100% + 32px);
|
width: calc(100% + 32px);
|
||||||
}
|
}
|
||||||
.form {
|
.drawerTable {
|
||||||
margin-left: 10px;
|
:deep(.ns-table-container),
|
||||||
|
:deep(.ns-table-main) {
|
||||||
|
border-top: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { origanizemanage } from '/@/api/origanizemanage';
|
||||||
|
import { http } from '/nerv-lib/saas';
|
||||||
|
|
||||||
export const mockData = ref([
|
export const mockData = ref([
|
||||||
{
|
{
|
||||||
|
@@ -12,7 +12,7 @@ const proxy = {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/carbon-smart': {
|
'/carbon-smart': {
|
||||||
target: 'http://192.168.100.115:8224/',
|
target: 'http://192.168.112.144:8224',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/carbon-smart/, ''),
|
rewrite: (path) => path.replace(/^\/carbon-smart/, ''),
|
||||||
},
|
},
|
||||||
|
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.ns-table-header {
|
.ns-table-header {
|
||||||
min-width: 500px;
|
min-width: fit-content;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
// padding: 16px 0;
|
// padding: 16px 0;
|
||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
|
@@ -383,7 +383,7 @@
|
|||||||
|
|
||||||
if (pagination) {
|
if (pagination) {
|
||||||
const current = get(dataRef.value, props.pageField);
|
const current = get(dataRef.value, props.pageField);
|
||||||
// console.log(current);
|
console.log(current);
|
||||||
function getTotal() {
|
function getTotal() {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
if (isFunction(getPageParams)) {
|
if (isFunction(getPageParams)) {
|
||||||
@@ -406,7 +406,7 @@
|
|||||||
},
|
},
|
||||||
...(pagination as Props),
|
...(pagination as Props),
|
||||||
total: getTotal(),
|
total: getTotal(),
|
||||||
current: (current >= 0 ? current : 0) + props.pageFieldOffset, // 后端0 开始
|
current: (current >= 0 ? current : 0) + props.pageFieldOffset, // 后端1 开始
|
||||||
pageSize: get(dataRef.value, props.sizeField),
|
pageSize: get(dataRef.value, props.sizeField),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -432,7 +432,7 @@
|
|||||||
() => getTableBindValues.value.api,
|
() => getTableBindValues.value.api,
|
||||||
() => {
|
() => {
|
||||||
// console.log(getTableBindValues.value.api);
|
// console.log(getTableBindValues.value.api);
|
||||||
fetch(); //路由切换导致api切换 导致发送请求
|
// fetch(); //路由切换导致api切换 导致发送请求
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
@@ -5,7 +5,7 @@ export const tableConfig = {
|
|||||||
listField: 'data.records', // 数据集合
|
listField: 'data.records', // 数据集合
|
||||||
totalField: 'data.total', // 数据总数
|
totalField: 'data.total', // 数据总数
|
||||||
|
|
||||||
pageFieldOffset: 1, //前端页码1开始,后端0 偏移量 1
|
pageFieldOffset: 0, //前端页码1开始,后端0 偏移量 1
|
||||||
pageSizeOptions: ['10', '20', '40'], // 分页设置种类
|
pageSizeOptions: ['10', '20', '40'], // 分页设置种类
|
||||||
defaultPageSize: 10, // 默认每页数量
|
defaultPageSize: 10, // 默认每页数量
|
||||||
paramsPageSizeField: 'pageSize',
|
paramsPageSizeField: 'pageSize',
|
||||||
|
Reference in New Issue
Block a user