Merge remote-tracking branch 'origin/master'

This commit is contained in:
2026-10-14 12:45:02 +08:00
3 changed files with 66 additions and 21 deletions
@@ -636,6 +636,12 @@ export default {
}
const value = row[prop];
if (value === undefined || value === null || value === '') return '-';
if (
(prop === 'usedFundLimit' || prop === 'remainingFundLimit') &&
Number(value) === -1
) {
return '-';
}
return value;
},
applyDetail(detail) {
@@ -164,8 +164,8 @@
show-overflow-tooltip
/>
<el-table-column label="操作" width="120" fixed="right" align="center">
<template #default>
<el-link type="primary" @click="openChangeRecordsDialog">查看详情</el-link>
<template #default="{ row }">
<el-link type="primary" @click="openChangeRecordsDialog(row)">查看详情</el-link>
</template>
</el-table-column>
</el-table>
@@ -1049,6 +1049,7 @@ export default {
priceUnitLoading: false,
priceUnitRequest: null,
changeRows: [],
changeBatchRecords: [],
changePage: { current: 1, size: 10, total: 0 },
latestChangeRows: [],
latestChangeLoading: false,
@@ -2030,34 +2031,64 @@ export default {
this.latestChangeLoading = true;
this.latestChangeRows = [];
try {
const res = await api.getChangeRecords(1, 1, {
const res = await api.getChangeRecords(1, 1000, {
detailId: this.detailDialog.row.id,
});
const data = this.unwrapPage(res);
this.latestChangeRows = (data.records || []).slice(0, 1);
this.latestChangeRows = this.buildChangeRecordBatches(data.records || []);
} finally {
this.latestChangeLoading = false;
}
},
openChangeRecordsDialog() {
buildChangeRecordBatches(records = []) {
const batchMap = new Map();
records.forEach(record => {
const batchKey = record.adjustTime || '';
if (!batchMap.has(batchKey)) {
batchMap.set(batchKey, []);
}
batchMap.get(batchKey).push(record);
});
return Array.from(batchMap.entries()).map(([batchKey, batchRecords]) => {
const first = batchRecords[0] || {};
const lineNos = [
...new Set(batchRecords.map(item => item.lineNo).filter(value => value !== undefined && value !== null && value !== '')),
];
const cargoNames = [
...new Set(
batchRecords.map(item => item.cargoName).filter(value => value !== undefined && value !== null && value !== '')
),
];
const changeContents = batchRecords
.map(item => item.changeContent)
.filter(value => value !== undefined && value !== null && value !== '');
return {
...first,
lineNo: lineNos.join('、'),
cargoName: cargoNames.join('、'),
changeContent: changeContents.join(';'),
adjustUserName: first.adjustUserName,
adjustReason: first.adjustReason,
adjustTime: first.adjustTime || batchKey,
_batchKey: batchKey,
_batchRecords: batchRecords,
};
});
},
openChangeRecordsDialog(row) {
if (!this.detailDialog.row) return;
this.changeBatchRecords = Array.isArray(row?._batchRecords) ? row._batchRecords : [];
this.changeRecordsDialog.visible = true;
this.changePage.current = 1;
this.loadChangeRecords();
},
async loadChangeRecords() {
if (!this.detailDialog.row) return;
this.changeRecordsDialog.loading = true;
try {
const res = await api.getChangeRecords(this.changePage.current, this.changePage.size, {
detailId: this.detailDialog.row.id,
});
const data = this.unwrapPage(res);
this.changeRows = data.records || [];
this.changePage.total = data.total || 0;
} finally {
this.changeRecordsDialog.loading = false;
}
loadChangeRecords() {
const records = this.changeBatchRecords || [];
const size = Number(this.changePage.size) || 10;
const current = Number(this.changePage.current) || 1;
const fromIndex = Math.max(0, (current - 1) * size);
this.changeRows = records.slice(fromIndex, fromIndex + size);
this.changePage.total = records.length;
},
handleChangeSizeChange() {
this.changePage.current = 1;
+11 -3
View File
@@ -333,9 +333,17 @@ export default {
callback(new Error('上级组织未配置组织编码,请先完善上级组织编码'));
return;
}
const pattern = new RegExp(`^${escapeRegExp(this.parentDeptCode)}-\\d+$`);
// 公司:GWWL+三位数字;部门:所属公司编码+三位数字;其他:上级编码+三位数字(中间不加-)
let expectedPrefix = this.parentDeptCode;
const category = Number(this.form?.deptCategory);
if (category === 2) {
expectedPrefix = 'GWWL';
} else if (category === 3 && this.form?.belongCompanyCode) {
expectedPrefix = String(this.form.belongCompanyCode).trim();
}
const pattern = new RegExp(`^${escapeRegExp(expectedPrefix)}\\d{3}$`);
if (!pattern.test(deptCode)) {
callback(new Error(`组织编码格式应为:${this.parentDeptCode}-分段数字`));
callback(new Error(`组织编码格式应为:${expectedPrefix}三位数字(不足补零,中间不加-)`));
return;
}
callback();
@@ -650,7 +658,7 @@ export default {
methods: {
handleOaOrgFullSync() {
this.$confirm(
'全量同步将拉取 OA 全部公司/部门;已存在且 OA 更新时间一致的记录会跳过。是否清除非顶级组织?选择“是”将先删除顶级以外的组织后再同步;选择“否”则直接全量同步。',
'全量同步将拉取 OA 全部公司/部门;已存在且 OA 更新时间一致的记录会跳过。是否清除后同步?选择“是”将保留顶级「外部组织」与集团锚点(id=135/GWWL),删除其余组织后再同步;选择“否”则直接全量同步。',
'全量同步',
{
confirmButtonText: '是',