fix: bug修改
This commit is contained in:
@@ -19,7 +19,6 @@ const organizationManage = {
|
|||||||
meta: {
|
meta: {
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
isCheck: false,
|
|
||||||
operates: [
|
operates: [
|
||||||
{ title: '新增', code: 'userAdd' },
|
{ title: '新增', code: 'userAdd' },
|
||||||
{ title: '导入', code: 'userImport' },
|
{ title: '导入', code: 'userImport' },
|
||||||
|
@@ -131,6 +131,7 @@ export const formConfig2 = (disabled2: Boolean) => {
|
|||||||
label: '是否部门领导',
|
label: '是否部门领导',
|
||||||
field: 'isLeader',
|
field: 'isLeader',
|
||||||
component: 'NsRadioGroup',
|
component: 'NsRadioGroup',
|
||||||
|
defaultValue: 1,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
disabled: disabled2,
|
disabled: disabled2,
|
||||||
radioType: 'radio',
|
radioType: 'radio',
|
||||||
|
@@ -65,10 +65,10 @@
|
|||||||
</a-tabs>
|
</a-tabs>
|
||||||
<a-space v-if="activeKey === 1 || deptPermissionTreeData?.length">
|
<a-space v-if="activeKey === 1 || deptPermissionTreeData?.length">
|
||||||
<ns-button type="primary" @click="CancelApartment">取消 </ns-button>
|
<ns-button type="primary" @click="CancelApartment">取消 </ns-button>
|
||||||
<ns-button v-show="disabled" type="primary" @click="pipe(deptEdit, true, false)">
|
<ns-button v-if="disabled" type="primary" @click="pipe(deptEdit, true, false)">
|
||||||
编辑
|
编辑
|
||||||
</ns-button>
|
</ns-button>
|
||||||
<ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button>
|
<ns-button v-else type="primary" @click="deptSure">确定</ns-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -79,11 +79,11 @@
|
|||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="8" class="tree">
|
<a-col :span="8" class="tree">
|
||||||
<a-space wrap style="margin-bottom: 16px; justify-content: flex-start">
|
<a-space wrap style="margin-bottom: 16px; justify-content: flex-start">
|
||||||
<ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
|
<!-- <ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
|
||||||
新增角色
|
新增角色
|
||||||
</ns-button>
|
</ns-button>
|
||||||
<ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
|
<ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
|
||||||
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button>
|
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button> -->
|
||||||
</a-space>
|
</a-space>
|
||||||
<a-tree
|
<a-tree
|
||||||
v-if="roleTreeData.length"
|
v-if="roleTreeData.length"
|
||||||
@@ -95,19 +95,19 @@
|
|||||||
<template #title="data">
|
<template #title="data">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center">
|
<div style="display: flex; justify-content: space-between; align-items: center">
|
||||||
<span> {{ data.zhName }}</span>
|
<span> {{ data.zhName }}</span>
|
||||||
<!-- <a-dropdown>
|
<a-dropdown>
|
||||||
<ns-icon name="actionMore" size="14" class="actionMore" />
|
<ns-icon name="actionMore" size="14" class="actionMore" />
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu>
|
<a-menu>
|
||||||
<a-menu-item
|
<a-menu-item
|
||||||
v-for="(action, index) in dropRoleActions"
|
v-for="(action, index) in filterAction(data, dropRoleActions, 'addUser')"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="action.func(data)">
|
@click="action.func(data)">
|
||||||
<span>{{ action.title }}</span>
|
<span>{{ action.title }}</span>
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown> -->
|
</a-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-tree>
|
</a-tree>
|
||||||
@@ -139,20 +139,16 @@
|
|||||||
<a-empty style="margin-top: 120px" v-else />
|
<a-empty style="margin-top: 120px" v-else />
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<a-space>
|
<a-space v-if="roleActiveKey === 1 || rolePermissionTreeData?.length">
|
||||||
<ns-button type="primary" @click="CancelUser">取消</ns-button>
|
<ns-button type="primary" @click="CancelUser">取消</ns-button>
|
||||||
<ns-button
|
<ns-button
|
||||||
v-show="roleDisabled"
|
v-if="roleDisabled"
|
||||||
:disabled="!roleTreeData?.length"
|
:disabled="!roleTreeData?.length"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="rolePipe(roleEdit, false, false)">
|
@click="rolePipe(roleEdit, false, false)">
|
||||||
编辑
|
编辑
|
||||||
</ns-button>
|
</ns-button>
|
||||||
<ns-button
|
<ns-button v-else :disabled="!roleTreeData?.length" type="primary" @click="roleSure">
|
||||||
v-show="!roleDisabled"
|
|
||||||
:disabled="!roleTreeData?.length"
|
|
||||||
type="primary"
|
|
||||||
@click="roleSure">
|
|
||||||
确定
|
确定
|
||||||
</ns-button>
|
</ns-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
@@ -167,7 +163,7 @@
|
|||||||
import { Modal } from 'ant-design-vue';
|
import { Modal } from 'ant-design-vue';
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { cloneDeep, get } from 'lodash-es';
|
import { cloneDeep, get, isEmpty } from 'lodash-es';
|
||||||
import { formConfig, formConfig2 } from './config';
|
import { formConfig, formConfig2 } from './config';
|
||||||
import { department } from '/@/api/origanizemanage';
|
import { department } from '/@/api/origanizemanage';
|
||||||
import { permission } from '/@/api/origanizemanage';
|
import { permission } from '/@/api/origanizemanage';
|
||||||
@@ -180,7 +176,7 @@
|
|||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const formRoleRef = ref();
|
const formRoleRef = ref();
|
||||||
let formData = ref({});
|
let formData = ref({});
|
||||||
let roleFormData = ref({});
|
let roleFormData = ref({ isLeader: 1 });
|
||||||
const activeKey = ref(1);
|
const activeKey = ref(1);
|
||||||
const roleActiveKey = ref(1);
|
const roleActiveKey = ref(1);
|
||||||
const disabled = ref(true);
|
const disabled = ref(true);
|
||||||
@@ -224,7 +220,7 @@
|
|||||||
|
|
||||||
/**操作拦截 */
|
/**操作拦截 */
|
||||||
const pipe = (func: Function, flag = false, toggle = true) => {
|
const pipe = (func: Function, flag = false, toggle = true) => {
|
||||||
if (toggle) activeKey.value = 1;
|
// if (toggle) activeKey.value = 1;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
// 只有部门的操作
|
// 只有部门的操作
|
||||||
if (selectRef.value?.hasOwnProperty('orgInfo') || !selectRef.value?.deptInfo) {
|
if (selectRef.value?.hasOwnProperty('orgInfo') || !selectRef.value?.deptInfo) {
|
||||||
@@ -243,13 +239,15 @@
|
|||||||
|
|
||||||
const rolePipe = (func: Function, linkDept = false, toggle = true) => {
|
const rolePipe = (func: Function, linkDept = false, toggle = true) => {
|
||||||
console.log(selectRoleRef.value);
|
console.log(selectRoleRef.value);
|
||||||
if (toggle) roleActiveKey.value = 1;
|
// if (toggle) roleActiveKey.value = 1;
|
||||||
// 需要先选择部门
|
// 需要先选择部门
|
||||||
if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) {
|
if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) {
|
||||||
NsMessage.error('请先选择相关部门');
|
NsMessage.error('请先选择相关部门');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!linkDept && !selectRoleRef.value) {
|
console.log(123);
|
||||||
|
|
||||||
|
if (!linkDept && isEmpty(selectRoleRef.value)) {
|
||||||
NsMessage.error('请先选择相关角色');
|
NsMessage.error('请先选择相关角色');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -302,6 +300,7 @@
|
|||||||
item['deptInfo'] = item.orgInfo;
|
item['deptInfo'] = item.orgInfo;
|
||||||
item['deptInfo']['deptName'] = item?.orgInfo?.orgName;
|
item['deptInfo']['deptName'] = item?.orgInfo?.orgName;
|
||||||
item['own'] = !index;
|
item['own'] = !index;
|
||||||
|
item['selectable'] = false;
|
||||||
item['children'] = item.deptTrees;
|
item['children'] = item.deptTrees;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
@@ -325,7 +324,7 @@
|
|||||||
// 获取角色树
|
// 获取角色树
|
||||||
const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => {
|
const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => {
|
||||||
return http.post(department.queryRoleTree, params).then((res) => {
|
return http.post(department.queryRoleTree, params).then((res) => {
|
||||||
roleTreeData.value = res.data;
|
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: res.data }];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 根据依赖刷新角色树
|
// 根据依赖刷新角色树
|
||||||
@@ -334,12 +333,12 @@
|
|||||||
getUserTree().then(() => {
|
getUserTree().then(() => {
|
||||||
if (!roleTreeData.value?.length) {
|
if (!roleTreeData.value?.length) {
|
||||||
selectRoleRef.value = {};
|
selectRoleRef.value = {};
|
||||||
roleFormData.value = {};
|
roleFormData.value = { isLeader: 1 };
|
||||||
}
|
}
|
||||||
const info = {
|
const info = {
|
||||||
node: { key: '0-0', dataRef: { ...roleTreeData.value[0] } },
|
node: { key: '0-0-0', dataRef: { ...roleTreeData.value[0].children[0] } },
|
||||||
};
|
};
|
||||||
SelectUserTree(['0-0'], info);
|
SelectUserTree(['0-0-0'], info);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -351,8 +350,10 @@
|
|||||||
callback: null,
|
callback: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 添加部门
|
||||||
const addApartment = (data) => {
|
const addApartment = (data) => {
|
||||||
const { deptInfo } = data;
|
const { deptInfo } = data;
|
||||||
|
activeKey.value = 1;
|
||||||
|
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'addDept';
|
opMap.type = 'addDept';
|
||||||
@@ -369,23 +370,17 @@
|
|||||||
orgId: deptInfo?.orgId,
|
orgId: deptInfo?.orgId,
|
||||||
sourceOrgId,
|
sourceOrgId,
|
||||||
projectId,
|
projectId,
|
||||||
|
pdeptId: deptInfo.pdeptId || '',
|
||||||
orgName,
|
orgName,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getParent = (data) => {
|
// 添加子部门
|
||||||
if (data?.parent) {
|
|
||||||
getParent(data.parent);
|
|
||||||
} else {
|
|
||||||
data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const addApartmentSon = (data) => {
|
const addApartmentSon = (data) => {
|
||||||
const { deptInfo } = data;
|
const { deptInfo } = data;
|
||||||
|
activeKey.value = 1;
|
||||||
disabled.value = false;
|
disabled.value = false;
|
||||||
opMap.type = 'addson';
|
opMap.type = 'addson';
|
||||||
formData.value = {};
|
formData.value = {};
|
||||||
@@ -410,7 +405,8 @@
|
|||||||
const addUser = () => {
|
const addUser = () => {
|
||||||
roleDisabled.value = false;
|
roleDisabled.value = false;
|
||||||
opMap.type = 'addUser';
|
opMap.type = 'addUser';
|
||||||
roleFormData.value = {};
|
roleFormData.value = { isLeader: 1 };
|
||||||
|
roleActiveKey.value = 1;
|
||||||
opMap.fuc = (params) => {
|
opMap.fuc = (params) => {
|
||||||
delete params.roleId;
|
delete params.roleId;
|
||||||
return formRoleRef.value.triggerSubmit().then(() => {
|
return formRoleRef.value.triggerSubmit().then(() => {
|
||||||
@@ -428,7 +424,8 @@
|
|||||||
const addUserSon = () => {
|
const addUserSon = () => {
|
||||||
roleDisabled.value = false;
|
roleDisabled.value = false;
|
||||||
opMap.type = 'addUserSon';
|
opMap.type = 'addUserSon';
|
||||||
roleFormData.value = {};
|
roleActiveKey.value = 1;
|
||||||
|
roleFormData.value = { isLeader: 1 };
|
||||||
opMap.fuc = (params) => {
|
opMap.fuc = (params) => {
|
||||||
delete params.roleId;
|
delete params.roleId;
|
||||||
return formRoleRef.value.triggerSubmit().then(() => {
|
return formRoleRef.value.triggerSubmit().then(() => {
|
||||||
@@ -444,8 +441,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
const deleteDept = (data) => {
|
const deleteDept = (data) => {
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
// 删除逻辑
|
// 删除逻辑
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '是否确认删除',
|
title: '是否确认删除',
|
||||||
@@ -458,6 +453,7 @@
|
|||||||
// 删除选中的数据需要清空
|
// 删除选中的数据需要清空
|
||||||
deptTreeSelectedKeys.value = [];
|
deptTreeSelectedKeys.value = [];
|
||||||
selectRef.value = '';
|
selectRef.value = '';
|
||||||
|
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: [] }];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -467,16 +463,20 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteUser = () => {
|
const deleteUser = (data) => {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '是否确认删除',
|
title: '是否确认删除',
|
||||||
onOk() {
|
onOk() {
|
||||||
http.post(department.delRole, { roleId: selectRoleRef.value.roleId }).then(() => {
|
http.post(department.delRole, { roleId: data.roleId }).then(() => {
|
||||||
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
|
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
|
||||||
clearRoleData();
|
clearRoleData();
|
||||||
// 清空select树
|
// 清空select树
|
||||||
|
if (data.selected) {
|
||||||
|
// 删除选中的数据需要清空
|
||||||
roleTreeSelectedKeys.value = [];
|
roleTreeSelectedKeys.value = [];
|
||||||
selectRoleRef.value = '';
|
selectRoleRef.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
NsMessage.success('操作成功');
|
NsMessage.success('操作成功');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -554,6 +554,7 @@
|
|||||||
};
|
};
|
||||||
// 保存角色权限
|
// 保存角色权限
|
||||||
const rolePermission = () => {
|
const rolePermission = () => {
|
||||||
|
if (!roleTotalCheckedKeys.value?.length) return;
|
||||||
http
|
http
|
||||||
.post(department.addRolePermission, {
|
.post(department.addRolePermission, {
|
||||||
// deptId: selectRef.value?.deptInfo.deptId,
|
// deptId: selectRef.value?.deptInfo.deptId,
|
||||||
@@ -645,6 +646,7 @@
|
|||||||
rolePermissionTreeData.value = [];
|
rolePermissionTreeData.value = [];
|
||||||
roleCheckedKeys.value = [];
|
roleCheckedKeys.value = [];
|
||||||
roleTreeSelectedKeys.value = [];
|
roleTreeSelectedKeys.value = [];
|
||||||
|
roleDisabled.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -739,10 +741,10 @@
|
|||||||
// { title: '新增角色', func: addUser, key: 'addUser' },
|
// { title: '新增角色', func: addUser, key: 'addUser' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const filterAction = (data, actions) => {
|
const filterAction = (data, actions, keyV = 'addDept') => {
|
||||||
if (data.hasOwnProperty('orgInfo')) {
|
if (data.hasOwnProperty('orgInfo')) {
|
||||||
// 企业节点
|
// 企业节点
|
||||||
return actions.filter(({ key }) => key === 'addDept');
|
return actions.filter(({ key }) => key === keyV);
|
||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
};
|
};
|
||||||
|
@@ -44,6 +44,7 @@ export const formConfig = (disabled) => {
|
|||||||
label: '性别',
|
label: '性别',
|
||||||
field: 'sex',
|
field: 'sex',
|
||||||
component: 'NsRadioGroup',
|
component: 'NsRadioGroup',
|
||||||
|
defaultValue: '男',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
radioType: 'radio',
|
radioType: 'radio',
|
||||||
options: [
|
options: [
|
||||||
|
@@ -4,30 +4,17 @@
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect">
|
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect" v-model:treeData="treeData">
|
||||||
<template #title="data">
|
<template #title="data">
|
||||||
{{ data.orgInfo?.orgName }}
|
{{ data.orgInfo?.orgName }}
|
||||||
</template>
|
</template>
|
||||||
</ns-tree-api>
|
</ns-tree-api>
|
||||||
</div>
|
</div>
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<!-- <div class="ns-table-title">关联部门</div>
|
<ns-tree-api
|
||||||
|
v-bind="deptTreeConfig"
|
||||||
<a-input-search
|
@select="handleSelect2"
|
||||||
v-model:value="searchValue2"
|
v-model:treeData="treeDataDept">
|
||||||
style="margin-bottom: 8px"
|
|
||||||
placeholder="请输入关联部门"
|
|
||||||
@search="onSearch2" />
|
|
||||||
<a-tree
|
|
||||||
v-if="treeData2?.length"
|
|
||||||
:tree-data="treeData2"
|
|
||||||
defaultExpandAll
|
|
||||||
@select="handleSelect2">
|
|
||||||
<template #title="data">
|
|
||||||
{{ data.deptInfo?.deptName }}
|
|
||||||
</template>
|
|
||||||
</a-tree> -->
|
|
||||||
<ns-tree-api v-bind="deptTreeConfig" @select="handleSelect2">
|
|
||||||
<template #title="data">
|
<template #title="data">
|
||||||
{{ data.deptInfo?.deptName }}
|
{{ data.deptInfo?.deptName }}
|
||||||
</template>
|
</template>
|
||||||
@@ -87,7 +74,7 @@
|
|||||||
import { formConfig, formConfig2 } from './config';
|
import { formConfig, formConfig2 } from './config';
|
||||||
import { origanizemanage } from '/@/api/origanizemanage';
|
import { origanizemanage } from '/@/api/origanizemanage';
|
||||||
|
|
||||||
defineOptions({ name: 'OrderListIndex' });
|
defineOptions({ name: 'UserManageIndex' });
|
||||||
|
|
||||||
const mainRef = ref();
|
const mainRef = ref();
|
||||||
const data = reactive({});
|
const data = reactive({});
|
||||||
@@ -113,19 +100,21 @@
|
|||||||
const casData = ref([]);
|
const casData = ref([]);
|
||||||
const formSchema2 = formConfig2(casData);
|
const formSchema2 = formConfig2(casData);
|
||||||
const treeData = ref([]);
|
const treeData = ref([]);
|
||||||
|
const treeDataDept = ref([]);
|
||||||
const treeData2 = ref([]);
|
const treeData2 = ref([]);
|
||||||
const userAuthList = ref([]);
|
const userAuthList = ref([]);
|
||||||
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
// const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
|
||||||
|
const orgId = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||||
const orgTreeConfig = ref({
|
const orgTreeConfig = ref({
|
||||||
selectedKeys: ['0-0'],
|
selectedKeys: ['0-0'],
|
||||||
defaultExpandAll: true,
|
defaultExpandAll: true,
|
||||||
api: origanizemanage.queryOrgTree,
|
api: origanizemanage.queryOrgTree,
|
||||||
defaultParams: { orgId },
|
params: { orgId },
|
||||||
transform: (data) => {
|
transform: (data) => {
|
||||||
const otherOrg = data[0].listOrg;
|
const otherOrg = data[0]?.listOrg;
|
||||||
let treeData = [];
|
let treeData = [];
|
||||||
// 特殊处理
|
// 特殊处理
|
||||||
if (data[0].orgInfo) {
|
if (data[0]?.orgInfo) {
|
||||||
treeData = data;
|
treeData = data;
|
||||||
}
|
}
|
||||||
otherOrg?.map((item) => {
|
otherOrg?.map((item) => {
|
||||||
@@ -153,7 +142,7 @@
|
|||||||
const deptTreeConfig = ref({
|
const deptTreeConfig = ref({
|
||||||
defaultExpandAll: true,
|
defaultExpandAll: true,
|
||||||
api: origanizemanage.queryDeptTree,
|
api: origanizemanage.queryDeptTree,
|
||||||
defaultParams: { orgId },
|
params: { orgId },
|
||||||
|
|
||||||
header: {
|
header: {
|
||||||
title: '关联部门',
|
title: '关联部门',
|
||||||
@@ -192,11 +181,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getOrgTree();
|
// getOrgTree();
|
||||||
// 部门树
|
// 部门树
|
||||||
fetch(origanizemanage.queryDeptTree).then((res) => {
|
// fetch(origanizemanage.queryDeptTree).then((res) => {
|
||||||
treeData2.value = res.data;
|
// treeData2.value = res.data;
|
||||||
});
|
// });
|
||||||
|
|
||||||
const onSearch = () => {
|
const onSearch = () => {
|
||||||
console.log(searchValue.value);
|
console.log(searchValue.value);
|
||||||
@@ -225,8 +214,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = (selectedKeys: any, info: any) => {
|
const handleSelect = (selectedKeys: any, info: any) => {
|
||||||
|
console.log(info);
|
||||||
|
|
||||||
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
|
||||||
treeData2.value = res.data;
|
treeDataDept.value = res.data;
|
||||||
});
|
});
|
||||||
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
tableFetch({ orgId: info.node?.orgInfo.orgId });
|
||||||
};
|
};
|
||||||
@@ -298,6 +289,7 @@
|
|||||||
opMap.value.type = 'add';
|
opMap.value.type = 'add';
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
|
sex: '男',
|
||||||
orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
|
orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
|
||||||
};
|
};
|
||||||
userAuthList.value.splice(0);
|
userAuthList.value.splice(0);
|
||||||
@@ -350,30 +342,23 @@
|
|||||||
customRender: (text: any) => {
|
customRender: (text: any) => {
|
||||||
return text.index + 1;
|
return text.index + 1;
|
||||||
},
|
},
|
||||||
sorter: {
|
sorter: true,
|
||||||
compare: (a, b) => a.address - b.address,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '账号',
|
title: '账号',
|
||||||
dataIndex: 'accountNo',
|
dataIndex: 'accountNo',
|
||||||
sorter: {
|
sorter: true,
|
||||||
compare: (a, b) => a.accountNo - b.accountNo,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'realName',
|
dataIndex: 'realName',
|
||||||
sorter: {
|
sorter: true,
|
||||||
compare: (a, b) => a.realName - b.realName,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '性别',
|
title: '性别',
|
||||||
dataIndex: 'sex',
|
dataIndex: 'sex',
|
||||||
sorter: {
|
sorter: true,
|
||||||
compare: (a, b) => a.name - b.name,
|
textNumber: 4,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '手机号',
|
title: '手机号',
|
||||||
@@ -381,11 +366,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '邮箱',
|
title: '邮箱',
|
||||||
|
textNumber: 5,
|
||||||
|
textEllipsis: true,
|
||||||
dataIndex: 'email',
|
dataIndex: 'email',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '组织关系',
|
title: '组织关系',
|
||||||
dataIndex: 'orgName',
|
dataIndex: 'orgName',
|
||||||
|
// textNumber: 9,
|
||||||
|
// textEllipsis: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '部门/角色',
|
title: '部门/角色',
|
||||||
|
@@ -14,6 +14,7 @@ export const treeProps = {
|
|||||||
type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
|
type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
|
treeData: PropTypes.array.def([]),
|
||||||
params: PropTypes.object.def(() => ({})),
|
params: PropTypes.object.def(() => ({})),
|
||||||
dynamicParams: PropTypes.oneOfType([
|
dynamicParams: PropTypes.oneOfType([
|
||||||
PropTypes.string,
|
PropTypes.string,
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
</a-spin>
|
</a-spin>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, nextTick, reactive, ref, unref, useAttrs } from 'vue';
|
import { computed, nextTick, reactive, ref, unref, useAttrs, watch } from 'vue';
|
||||||
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
|
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
|
||||||
import { useApi } from '/nerv-lib/use/use-api';
|
import { useApi } from '/nerv-lib/use/use-api';
|
||||||
import { AxiosRequestConfig } from 'axios';
|
import { AxiosRequestConfig } from 'axios';
|
||||||
@@ -33,16 +33,28 @@
|
|||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'NsTreeApi',
|
name: 'NsTreeApi',
|
||||||
});
|
});
|
||||||
|
const emit = defineEmits(['update:treeData']);
|
||||||
|
// const model = defineModel('treeData');
|
||||||
|
|
||||||
const formElRef = ref();
|
const formElRef = ref();
|
||||||
const props = defineProps(treeProps);
|
const props = defineProps(treeProps);
|
||||||
const treeData = ref<TreeDataItem[]>([]);
|
|
||||||
|
const treeData = ref(props.treeData);
|
||||||
const selectedKeys = ref(props.selectedKeys || []);
|
const selectedKeys = ref(props.selectedKeys || []);
|
||||||
const { httpRequest } = useApi();
|
const { httpRequest } = useApi();
|
||||||
const requestConfig: AxiosRequestConfig = { method: 'get' };
|
const requestConfig: AxiosRequestConfig = { method: 'get' };
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const attrs = useAttrs();
|
const attrs = useAttrs();
|
||||||
const formModel = reactive({});
|
const formModel = reactive({});
|
||||||
|
watch(
|
||||||
|
() => props.treeData,
|
||||||
|
(val) => {
|
||||||
|
treeData.value = val;
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
const treeState = reactive({
|
const treeState = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
@@ -56,6 +68,7 @@
|
|||||||
return props.isSticky ? 'sticky' : 'static';
|
return props.isSticky ? 'sticky' : 'static';
|
||||||
});
|
});
|
||||||
const formFinish = debounce((data: object) => {
|
const formFinish = debounce((data: object) => {
|
||||||
|
selectedKeys.value = [];
|
||||||
getData(data);
|
getData(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
const getBindValue = computed(() => ({
|
const getBindValue = computed(() => ({
|
||||||
@@ -83,6 +96,8 @@
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
treeData.value = transform(get(res, resultField));
|
treeData.value = transform(get(res, resultField));
|
||||||
|
emit('update:treeData', treeData.value);
|
||||||
|
// model.value = treeData.value;
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
@@ -110,16 +110,16 @@
|
|||||||
errorShow.value = true;
|
errorShow.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (!code.value) {
|
if (!code.value) {
|
||||||
// errorMsg.value = '请输入验证码';
|
errorMsg.value = '请输入验证码';
|
||||||
// errorShow.value = true;
|
errorShow.value = true;
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// if (code.value.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase()) {
|
if (code.value.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase()) {
|
||||||
// errorMsg.value = '请输入正确的验证码';
|
errorMsg.value = '请输入正确的验证码';
|
||||||
// errorShow.value = true;
|
errorShow.value = true;
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
if (userName.value !== '' && password.value !== '') {
|
if (userName.value !== '' && password.value !== '') {
|
||||||
errorShow.value = false;
|
errorShow.value = false;
|
||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
|
Reference in New Issue
Block a user