调整 合同、运力、客商、项目

This commit is contained in:
2026-09-15 11:59:55 +08:00
parent 79aa4f9fae
commit 6a87066097
15 changed files with 1857 additions and 957 deletions
+92 -38
View File
@@ -227,16 +227,22 @@
:disabled="isBasicInfoReadonly"
/>
</el-form-item>
<el-form-item label="承办部门" prop="undertakeDeptId">
<el-cascader
v-model="undertakeDeptCascaderValue"
:options="deptTreeOptions"
:props="deptCascaderProps"
<el-form-item label="平台公司" prop="undertakeDeptId">
<el-select
v-model="form.undertakeDeptId"
placeholder="请选择"
clearable
filterable
:disabled="isBasicInfoReadonly"
/>
@change="handleUndertakeDeptChange"
>
<el-option
v-for="item in platformCompanyOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="项目由来" prop="projectSource">
<el-select
@@ -913,7 +919,7 @@ import {
getList as getCustomerArchiveList,
getDetail as getCustomerArchiveDetail,
} from '@/api/vehicle/customer-archive';
import { getDeptTree } from '@/api/system/dept';
import { getDeptTree, getPlatformCompanySelect } from '@/api/system/dept';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { getList as getUserList } from '@/api/system/user';
@@ -1126,7 +1132,7 @@ export default {
{ max: 20, message: '项目简称不能超过20个字符', trigger: 'blur' },
],
businessDeptId: [{ required: true, message: '请选择业务部门', trigger: 'change' }],
undertakeDeptId: [{ required: true, message: '请选择承办部门', trigger: 'change' }],
undertakeDeptId: [{ required: true, message: '请选择平台公司', trigger: 'change' }],
businessMode: [{ required: true, message: '请选择业务模式', trigger: 'change' }],
customerNames: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
carrierNames: [{ required: true, message: '请选择下游承运商', trigger: 'change' }],
@@ -1182,7 +1188,7 @@ export default {
},
deptOptions: [],
businessDeptTreeOptions: [],
deptTreeOptions: [],
platformCompanyOptions: [],
cargoTypeOptions: [],
selectedCustomerId: [],
selectedCarrierIds: [],
@@ -1269,20 +1275,6 @@ export default {
this.handleBusinessDeptChange(this.form.businessDeptId);
},
},
// 承办部门:同上
undertakeDeptCascaderValue: {
get() {
const id = this.form.undertakeDeptId;
return id ? this.findDeptPath(id, this.deptTreeOptions) || [id] : [];
},
set(path) {
const value = Array.isArray(path)
? path.filter(item => item !== undefined && item !== null && item !== '')
: [];
this.form.undertakeDeptId = value.length ? value.at(-1) : '';
this.handleUndertakeDeptChange(this.form.undertakeDeptId);
},
},
permissionList() {
return {
addBtn: this.canCreate,
@@ -1694,6 +1686,7 @@ export default {
.map(item => this.getCustomerRowId(item))
.filter(Boolean);
this.syncSelectedCustomerOptions();
this.ensureCurrentPlatformOption();
},
fillDefaultUsers() {
const userId = this.userInfo?.userId || this.userInfo?.id || '';
@@ -2028,7 +2021,7 @@ export default {
handler: record.handlerUserName || record.changeUserName || record.handler || '',
reason: record.changeReason || '',
status: record.statusName || record.status || '',
action: '详情',
action: '查看',
};
return { ...changeRow, content: this.formatChangeContent(changeRow) };
});
@@ -2051,7 +2044,7 @@ export default {
projectName: '项目名称',
projectShortName: '项目简称',
businessDeptName: '业务部门',
undertakeDeptName: '承办部门',
undertakeDeptName: '平台公司',
projectSource: '项目由来',
sourceRemark: '项目由来说明',
fundLimit: '项目资金使用额度',
@@ -2112,6 +2105,18 @@ export default {
formatProjectChangeValue(field, value) {
const normalized = this.normalizeProjectChangeValue(value);
if (this.isEmptyProjectChangeValue(normalized)) return '';
if (field === 'transportType') {
const option = (this.transportTypeOptions || []).find(
item => String(item.value) === String(normalized)
);
return option?.label || String(normalized);
}
if (field === 'settlementMode') {
const option = (this.settlementModeOptions || []).find(
item => String(item.value) === String(normalized)
);
return option?.label || String(normalized);
}
if (field === 'attachmentsJson') {
const attachments = Array.isArray(normalized)
? normalized
@@ -2130,6 +2135,23 @@ export default {
if (typeof normalized === 'object') return JSON.stringify(normalized);
return String(normalized);
},
buildSituationChangeRows(beforeValue, afterValue) {
const before = this.parseSituation(beforeValue);
const after = this.parseSituation(afterValue);
const labels = {
projectIntro: '项目简介',
profitRemark: '盈利模式及利润测算情况说明',
riskPoint: '项目风险点',
emergencyPlan: '风险防范措施及应急预案',
};
return Object.keys(labels)
.filter(key => !this.isSameProjectChangeValue(before[key], after[key]))
.map(key => ({
field: labels[key],
before: this.formatProjectChangeValue(key, before[key]),
after: this.formatProjectChangeValue(key, after[key]),
}));
},
buildChangeRecordDetailRows(row = {}) {
const beforeData = this.parseChangeData(row.beforeData);
const afterData = this.parseChangeData(row.afterData);
@@ -2140,13 +2162,20 @@ export default {
...Object.keys(afterData),
]),
];
const rows = fields
const rows = [];
fields
.filter(field => field !== '变更内容' && !this.isSameProjectChangeValue(beforeData[field], afterData[field]))
.map(field => ({
field: this.getProjectChangeFieldLabel(field),
before: this.formatProjectChangeValue(field, beforeData[field]),
after: this.formatProjectChangeValue(field, afterData[field]),
}));
.forEach(field => {
if (field === 'situationRemark') {
rows.push(...this.buildSituationChangeRows(beforeData[field], afterData[field]));
return;
}
rows.push({
field: this.getProjectChangeFieldLabel(field),
before: this.formatProjectChangeValue(field, beforeData[field]),
after: this.formatProjectChangeValue(field, afterData[field]),
});
});
if (!rows.length && String(row.changeContent || '').trim()) {
rows.push({ field: '变更内容', before: '', after: String(row.changeContent).trim() });
}
@@ -2172,8 +2201,8 @@ export default {
},
handleUndertakeDeptChange(value) {
const id = Array.isArray(value) ? value.at(-1) : value;
const dept = this.deptOptions.find(item => String(item.value) === String(id));
this.form.undertakeDeptName = dept ? dept.rawLabel : '';
const dept = this.platformCompanyOptions.find(item => String(item.value) === String(id));
this.form.undertakeDeptName = dept ? dept.label : '';
this.$refs.projectForm?.validateField('undertakeDeptId');
},
// 由部门 id 反查「根 → 该节点」的 id 路径,供级联回显(找不到返回 null)
@@ -2198,12 +2227,31 @@ export default {
const businessDeptTree = ['add', 'edit', 'majorSupplement'].includes(this.dialogType)
? this.excludeExternalOrganization(deptTree)
: deptTree;
const undertakeDeptTree =
this.dialogType === 'add' ? this.excludeExternalOrganization(deptTree) : deptTree;
this.deptOptions = this.flattenDept(businessDeptTree);
this.businessDeptTreeOptions = this.toDeptCascaderOptions(businessDeptTree);
this.deptTreeOptions = this.toDeptCascaderOptions(undertakeDeptTree);
});
this.loadPlatformCompanyOptions();
},
loadPlatformCompanyOptions() {
getPlatformCompanySelect().then(res => {
const list = res.data.data || [];
this.platformCompanyOptions = list.map(item => ({
label: item.deptName || item.fullName || item.title || item.name,
value: item.id,
}));
this.ensureCurrentPlatformOption();
});
},
ensureCurrentPlatformOption() {
const id = this.form.undertakeDeptId;
if (!id) return;
const exists = this.platformCompanyOptions.some(item => String(item.value) === String(id));
if (!exists) {
this.platformCompanyOptions.unshift({
label: this.form.undertakeDeptName || String(id),
value: id,
});
}
},
excludeExternalOrganization(list = []) {
return list.reduce((result, item) => {
@@ -2248,7 +2296,7 @@ export default {
});
},
loadTransportTypeOptions() {
getBizDictionary({ code: 'transport_type' }).then(res => {
return getBizDictionary({ code: 'transport_type' }).then(res => {
this.transportTypeOptions = (res.data.data || []).map(item => ({
label: item.dictValue,
value: item.dictKey,
@@ -2256,7 +2304,7 @@ export default {
});
},
loadSettlementModeOptions() {
getBizDictionary({ code: 'settle_method' }).then(res => {
return getBizDictionary({ code: 'settle_method' }).then(res => {
const data = res.data?.data || [];
this.settlementModeOptions = data.map(item => ({
label: item.dictValue,
@@ -2485,6 +2533,12 @@ export default {
return;
}
try {
if (!this.transportTypeOptions.length) {
await this.loadTransportTypeOptions();
}
if (!this.settlementModeOptions.length) {
await this.loadSettlementModeOptions();
}
const response = await api.getChangeRecordDetail(row.projectId || row.id, row.recordIndex);
const detail = response?.data?.data || {};
this.changeRecordDetail = { ...row, ...detail };