diff --git a/hx-ai-intelligent/src/router/organizationManage.ts b/hx-ai-intelligent/src/router/organizationManage.ts index eb97190..e02f7c4 100644 --- a/hx-ai-intelligent/src/router/organizationManage.ts +++ b/hx-ai-intelligent/src/router/organizationManage.ts @@ -19,7 +19,6 @@ const organizationManage = { meta: { title: '用户管理', keepAlive: true, - isCheck: false, operates: [ { title: '新增', code: 'userAdd' }, { title: '导入', code: 'userImport' }, diff --git a/hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts b/hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts index 5431020..50da653 100644 --- a/hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts +++ b/hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts @@ -131,6 +131,7 @@ export const formConfig2 = (disabled2: Boolean) => { label: '是否部门领导', field: 'isLeader', component: 'NsRadioGroup', + defaultValue: 1, componentProps: { disabled: disabled2, radioType: 'radio', diff --git a/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue b/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue index b4c198a..b2565a8 100644 --- a/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue +++ b/hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue @@ -65,10 +65,10 @@ 取消 - + 编辑 - 确定 + 确定 @@ -79,11 +79,11 @@ - +
{{ data.zhName }} - +
@@ -139,20 +139,16 @@ - + 取消 编辑 - + 确定 @@ -167,7 +163,7 @@ import { Modal } from 'ant-design-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; 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 { department } from '/@/api/origanizemanage'; import { permission } from '/@/api/origanizemanage'; @@ -180,7 +176,7 @@ const formRef = ref(); const formRoleRef = ref(); let formData = ref({}); - let roleFormData = ref({}); + let roleFormData = ref({ isLeader: 1 }); const activeKey = ref(1); const roleActiveKey = ref(1); const disabled = ref(true); @@ -224,7 +220,7 @@ /**操作拦截 */ const pipe = (func: Function, flag = false, toggle = true) => { - if (toggle) activeKey.value = 1; + // if (toggle) activeKey.value = 1; if (flag) { // 只有部门的操作 if (selectRef.value?.hasOwnProperty('orgInfo') || !selectRef.value?.deptInfo) { @@ -243,13 +239,15 @@ const rolePipe = (func: Function, linkDept = false, toggle = true) => { console.log(selectRoleRef.value); - if (toggle) roleActiveKey.value = 1; + // if (toggle) roleActiveKey.value = 1; // 需要先选择部门 if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) { NsMessage.error('请先选择相关部门'); return; } - if (!linkDept && !selectRoleRef.value) { + console.log(123); + + if (!linkDept && isEmpty(selectRoleRef.value)) { NsMessage.error('请先选择相关角色'); return; } @@ -302,6 +300,7 @@ item['deptInfo'] = item.orgInfo; item['deptInfo']['deptName'] = item?.orgInfo?.orgName; item['own'] = !index; + item['selectable'] = false; item['children'] = item.deptTrees; return item; }); @@ -325,7 +324,7 @@ // 获取角色树 const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => { 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(() => { if (!roleTreeData.value?.length) { selectRoleRef.value = {}; - roleFormData.value = {}; + roleFormData.value = { isLeader: 1 }; } 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, }; + // 添加部门 const addApartment = (data) => { const { deptInfo } = data; + activeKey.value = 1; disabled.value = false; opMap.type = 'addDept'; @@ -369,23 +370,17 @@ orgId: deptInfo?.orgId, sourceOrgId, projectId, + pdeptId: deptInfo.pdeptId || '', orgName, }); }); }; }; - const getParent = (data) => { - if (data?.parent) { - getParent(data.parent); - } else { - data; - } - }; - + // 添加子部门 const addApartmentSon = (data) => { const { deptInfo } = data; - + activeKey.value = 1; disabled.value = false; opMap.type = 'addson'; formData.value = {}; @@ -410,7 +405,8 @@ const addUser = () => { roleDisabled.value = false; opMap.type = 'addUser'; - roleFormData.value = {}; + roleFormData.value = { isLeader: 1 }; + roleActiveKey.value = 1; opMap.fuc = (params) => { delete params.roleId; return formRoleRef.value.triggerSubmit().then(() => { @@ -428,7 +424,8 @@ const addUserSon = () => { roleDisabled.value = false; opMap.type = 'addUserSon'; - roleFormData.value = {}; + roleActiveKey.value = 1; + roleFormData.value = { isLeader: 1 }; opMap.fuc = (params) => { delete params.roleId; return formRoleRef.value.triggerSubmit().then(() => { @@ -444,8 +441,6 @@ }; }; const deleteDept = (data) => { - console.log(data); - // 删除逻辑 Modal.confirm({ title: '是否确认删除', @@ -458,6 +453,7 @@ // 删除选中的数据需要清空 deptTreeSelectedKeys.value = []; selectRef.value = ''; + roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: [] }]; } }); }, @@ -467,16 +463,20 @@ }); }; - const deleteUser = () => { + const deleteUser = (data) => { Modal.confirm({ title: '是否确认删除', onOk() { - http.post(department.delRole, { roleId: selectRoleRef.value.roleId }).then(() => { + http.post(department.delRole, { roleId: data.roleId }).then(() => { getUserTree({ deptId: selectRef.value.deptInfo.deptId }); clearRoleData(); // 清空select树 - roleTreeSelectedKeys.value = []; - selectRoleRef.value = ''; + if (data.selected) { + // 删除选中的数据需要清空 + roleTreeSelectedKeys.value = []; + selectRoleRef.value = ''; + } + NsMessage.success('操作成功'); }); }, @@ -554,6 +554,7 @@ }; // 保存角色权限 const rolePermission = () => { + if (!roleTotalCheckedKeys.value?.length) return; http .post(department.addRolePermission, { // deptId: selectRef.value?.deptInfo.deptId, @@ -645,6 +646,7 @@ rolePermissionTreeData.value = []; roleCheckedKeys.value = []; roleTreeSelectedKeys.value = []; + roleDisabled.value = true; }; /** @@ -739,10 +741,10 @@ // { title: '新增角色', func: addUser, key: 'addUser' }, ]); - const filterAction = (data, actions) => { + const filterAction = (data, actions, keyV = 'addDept') => { if (data.hasOwnProperty('orgInfo')) { // 企业节点 - return actions.filter(({ key }) => key === 'addDept'); + return actions.filter(({ key }) => key === keyV); } return actions; }; diff --git a/hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts b/hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts index 61ade5d..3b7e580 100644 --- a/hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts +++ b/hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts @@ -44,6 +44,7 @@ export const formConfig = (disabled) => { label: '性别', field: 'sex', component: 'NsRadioGroup', + defaultValue: '男', componentProps: { radioType: 'radio', options: [ diff --git a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue index a6ce9d3..e93785d 100644 --- a/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue +++ b/hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue @@ -4,30 +4,17 @@
- +
- - + @@ -87,7 +74,7 @@ import { formConfig, formConfig2 } from './config'; import { origanizemanage } from '/@/api/origanizemanage'; - defineOptions({ name: 'OrderListIndex' }); + defineOptions({ name: 'UserManageIndex' }); const mainRef = ref(); const data = reactive({}); @@ -113,19 +100,21 @@ const casData = ref([]); const formSchema2 = formConfig2(casData); const treeData = ref([]); + const treeDataDept = ref([]); const treeData2 = 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({ selectedKeys: ['0-0'], defaultExpandAll: true, api: origanizemanage.queryOrgTree, - defaultParams: { orgId }, + params: { orgId }, transform: (data) => { - const otherOrg = data[0].listOrg; + const otherOrg = data[0]?.listOrg; let treeData = []; // 特殊处理 - if (data[0].orgInfo) { + if (data[0]?.orgInfo) { treeData = data; } otherOrg?.map((item) => { @@ -153,7 +142,7 @@ const deptTreeConfig = ref({ defaultExpandAll: true, api: origanizemanage.queryDeptTree, - defaultParams: { orgId }, + params: { orgId }, header: { title: '关联部门', @@ -192,11 +181,11 @@ }); }); }; - getOrgTree(); + // getOrgTree(); // 部门树 - fetch(origanizemanage.queryDeptTree).then((res) => { - treeData2.value = res.data; - }); + // fetch(origanizemanage.queryDeptTree).then((res) => { + // treeData2.value = res.data; + // }); const onSearch = () => { console.log(searchValue.value); @@ -225,8 +214,10 @@ }; const handleSelect = (selectedKeys: any, info: any) => { + console.log(info); + fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => { - treeData2.value = res.data; + treeDataDept.value = res.data; }); tableFetch({ orgId: info.node?.orgInfo.orgId }); }; @@ -298,6 +289,7 @@ opMap.value.type = 'add'; setTimeout(() => { formData.value = { + sex: '男', orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName, }; userAuthList.value.splice(0); @@ -350,30 +342,23 @@ customRender: (text: any) => { return text.index + 1; }, - sorter: { - compare: (a, b) => a.address - b.address, - }, + sorter: true, }, { title: '账号', dataIndex: 'accountNo', - sorter: { - compare: (a, b) => a.accountNo - b.accountNo, - }, + sorter: true, }, { title: '姓名', dataIndex: 'realName', - sorter: { - compare: (a, b) => a.realName - b.realName, - }, + sorter: true, }, { title: '性别', dataIndex: 'sex', - sorter: { - compare: (a, b) => a.name - b.name, - }, + sorter: true, + textNumber: 4, }, { title: '手机号', @@ -381,11 +366,15 @@ }, { title: '邮箱', + textNumber: 5, + textEllipsis: true, dataIndex: 'email', }, { title: '组织关系', dataIndex: 'orgName', + // textNumber: 9, + // textEllipsis: true, }, { title: '部门/角色', diff --git a/lib/component/tree/props.ts b/lib/component/tree/props.ts index 3b73358..a040b37 100644 --- a/lib/component/tree/props.ts +++ b/lib/component/tree/props.ts @@ -14,6 +14,7 @@ export const treeProps = { type: [String, Object, Function] as PropType, default: undefined, }, + treeData: PropTypes.array.def([]), params: PropTypes.object.def(() => ({})), dynamicParams: PropTypes.oneOfType([ PropTypes.string, diff --git a/lib/component/tree/tree-api.vue b/lib/component/tree/tree-api.vue index 4a859ea..4226722 100644 --- a/lib/component/tree/tree-api.vue +++ b/lib/component/tree/tree-api.vue @@ -21,7 +21,7 @@