diff --git a/src/option/system/user.js b/src/option/system/user.js index b450ba5..af99bf3 100644 --- a/src/option/system/user.js +++ b/src/option/system/user.js @@ -492,17 +492,35 @@ export const treeOption = { nodeKey: 'id', lazy: true, treeLoad: function (node, resolve) { - const parentId = node.level === 0 ? 0 : node.data.id; - getDeptLazyTree(parentId).then(res => { - resolve( - res.data.data.map(item => { - return { - ...item, - leaf: !item.hasChildren, - }; - }) - ); + const toTreeNode = item => ({ + ...item, + leaf: !item.hasChildren, }); + // 用户管理组织树从第二级开始展示:根层隐藏一级组织,直接展示其子节点 + if (node.level === 0) { + getDeptLazyTree(0) + .then(res => { + const roots = res.data.data || []; + if (!roots.length) { + resolve([]); + return; + } + return Promise.all(roots.map(root => getDeptLazyTree(root.id))).then(childResults => { + const secondLevel = []; + childResults.forEach(childRes => { + (childRes.data.data || []).forEach(item => secondLevel.push(toTreeNode(item))); + }); + resolve(secondLevel); + }); + }) + .catch(() => resolve([])); + return; + } + getDeptLazyTree(node.data.id) + .then(res => { + resolve((res.data.data || []).map(toTreeNode)); + }) + .catch(() => resolve([])); }, addBtn: false, menu: false, diff --git a/src/views/authority/role.vue b/src/views/authority/role.vue index 3a6cce2..78172d3 100644 --- a/src/views/authority/role.vue +++ b/src/views/authority/role.vue @@ -102,7 +102,7 @@ style="margin-bottom: 12px; background: #f5f7fa; padding: 6px 10px; border-radius: 4px" > 勾选多个菜单后点击「设置」,可批量配置数据权限;设置后菜单旁展示当前范围仅展示菜单权限已勾选的菜单,已配置的数据权限会保留。勾选多个菜单后点击「设置」可批量配置 设置 diff --git a/src/views/system/user.vue b/src/views/system/user.vue index 53f3997..545514f 100644 --- a/src/views/system/user.vue +++ b/src/views/system/user.vue @@ -713,6 +713,12 @@ export default { } this.selectDeptOnTree(deptId); }, + startDeptTreeFromSecondLevel(tree) { + if (!Array.isArray(tree) || !tree.length) { + return []; + } + return tree.flatMap(node => (Array.isArray(node.children) ? node.children : [])); + }, findDeptIdByName(name, tree = this.permissionDeptTree) { if (!name) return null; for (const node of tree || []) { @@ -733,7 +739,7 @@ export default { const tenantId = this.userInfo.tenantId || this.website.tenantId; try { const res = await getDeptTree(tenantId); - this.permissionDeptTree = res.data.data || []; + this.permissionDeptTree = this.startDeptTreeFromSecondLevel(res.data.data || []); } catch (error) { this.$message.error('组织树加载失败'); return; @@ -963,9 +969,11 @@ export default { column.dicData = res.data.data; }); getDeptTree(tenantId).then(res => { - this.permissionDeptTree = res.data.data; + // 用户管理组织从第二级开始展示:去掉一级根节点,保留其子节点 + const deptTree = this.startDeptTreeFromSecondLevel(res.data.data || []); + this.permissionDeptTree = deptTree; const column = this.findColumn(this.userOption.group, 'deptId'); - column.dicData = res.data.data; + column.dicData = deptTree; }); getPostList(tenantId).then(res => { this.postList = res.data.data; diff --git a/src/views/vehicle/customer-archive.vue b/src/views/vehicle/customer-archive.vue index 2cffd52..d7c03c7 100644 --- a/src/views/vehicle/customer-archive.vue +++ b/src/views/vehicle/customer-archive.vue @@ -310,6 +310,7 @@ v-model="archiveForm.customerCode" maxlength="20" show-word-limit + :disabled="Boolean(archiveForm.id)" placeholder="请输入,留空则自动生成" /> @@ -378,7 +379,7 @@ placeholder="请输入" maxlength="18" show-word-limit - :disabled="kingdeeLocked && Boolean(archiveForm.id)" + :disabled="Boolean(archiveForm.id)" @input=" archiveForm.unifiedCreditCode = String( archiveForm.unifiedCreditCode || '' @@ -394,7 +395,7 @@ placeholder="请输入" maxlength="100" show-word-limit - :disabled="kingdeeLocked" + :disabled="kingdeeLocked && !archiveForm.id" @blur="checkArchiveNameRisk" /> @@ -535,7 +536,7 @@ @@ -545,7 +546,7 @@ @@ -4245,7 +4246,9 @@ export default { '核准日期', ]); const scope = this.getBusinessLicenseOcrValue(fields, ['经营范围']); - if (code) this.archiveForm.unifiedCreditCode = code.replace(/\s/g, '').toUpperCase(); + if (code && !this.archiveForm.id) { + this.archiveForm.unifiedCreditCode = code.replace(/\s/g, '').toUpperCase(); + } if (name) this.archiveForm.fullName = name; if (name) this.checkArchiveNameRisk(); if (legalPerson) this.archiveForm.legalPerson = legalPerson;