🐛 业务部门下拉展示所属公司,并映射项目旧平台公司ID
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -93,6 +93,7 @@
|
||||
<script>
|
||||
import { getList, getDetail, submit, remove } from '@/api/system/business-dept-config';
|
||||
import { getBusinessDeptSelect, getPlatformCompanySelect } from '@/api/system/dept';
|
||||
import { normalizeBusinessDeptOptions } from '@/utils/dept';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
@@ -154,8 +155,9 @@ export default {
|
||||
{
|
||||
label: '业务部门',
|
||||
prop: 'businessDeptName',
|
||||
minWidth: 160,
|
||||
minWidth: 260,
|
||||
display: false,
|
||||
formatter: row => this.formatBusinessDeptLabel(row),
|
||||
},
|
||||
{
|
||||
label: '平台公司',
|
||||
@@ -277,11 +279,16 @@ export default {
|
||||
Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then(
|
||||
([platformRes, businessRes]) => {
|
||||
this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data);
|
||||
this.businessDeptOptions = this.normalizeDeptOptions(businessRes?.data?.data);
|
||||
// 业务部门配置页始终展示「部门(所属公司)」,便于与平台公司配对
|
||||
this.businessDeptOptions = normalizeBusinessDeptOptions(businessRes?.data?.data, {
|
||||
alwaysShowCompany: true,
|
||||
});
|
||||
const platformColumn = this.findColumn(this.option.column, 'platformCompanyId');
|
||||
if (platformColumn) platformColumn.dicData = this.platformCompanyOptions;
|
||||
const businessColumn = this.findColumn(this.option.column, 'businessDeptId');
|
||||
if (businessColumn) businessColumn.dicData = this.businessDeptOptions;
|
||||
// 下拉选项就绪后刷新列表展示名(避免列表先于选项返回时只显示裸部门名)
|
||||
this.refreshBusinessDeptLabels();
|
||||
}
|
||||
);
|
||||
},
|
||||
@@ -292,6 +299,19 @@ export default {
|
||||
kingdeeDeptCode: item.kingdeeDeptCode || '',
|
||||
}));
|
||||
},
|
||||
/** 列表业务部门列:部门名(所属公司) */
|
||||
formatBusinessDeptLabel(row) {
|
||||
if (!row) return '-';
|
||||
const matched = this.businessDeptOptions.find(
|
||||
item => String(item.value) === String(row.businessDeptId)
|
||||
);
|
||||
if (matched?.label) return matched.label;
|
||||
return row.businessDeptName || '-';
|
||||
},
|
||||
refreshBusinessDeptLabels() {
|
||||
if (!this.data?.length) return;
|
||||
this.data = this.data.map(row => ({ ...row }));
|
||||
},
|
||||
formatSerial(value) {
|
||||
// Avue number 空值常落成 -1,历史脏数据也按空展示
|
||||
if (value === null || value === undefined || value === '' || value === -1 || value === '-1') {
|
||||
@@ -317,13 +337,15 @@ export default {
|
||||
},
|
||||
handleBusinessDeptChange(value) {
|
||||
const matched = this.businessDeptOptions.find(item => String(item.value) === String(value));
|
||||
this.form.businessDeptName = matched ? matched.label : '';
|
||||
this.form.businessDeptName = matched ? matched.rawLabel || matched.label : '';
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
const loadOptions = Promise.all([getPlatformCompanySelect(), getBusinessDeptSelect()]).then(
|
||||
([platformRes, businessRes]) => {
|
||||
this.platformCompanyOptions = this.normalizeDeptOptions(platformRes?.data?.data);
|
||||
this.businessDeptOptions = this.normalizeDeptOptions(businessRes?.data?.data);
|
||||
this.businessDeptOptions = normalizeBusinessDeptOptions(businessRes?.data?.data, {
|
||||
alwaysShowCompany: true,
|
||||
});
|
||||
const platformColumn = this.findColumn(this.option.column, 'platformCompanyId');
|
||||
if (platformColumn) platformColumn.dicData = this.platformCompanyOptions;
|
||||
const businessColumn = this.findColumn(this.option.column, 'businessDeptId');
|
||||
|
||||
Reference in New Issue
Block a user