feat: 新增合同配置页面,优化多页面合同关联逻辑

1.  新增crm/contract/selectConfig页面,支持本地配置可选合同列表,区分手动/接口同步来源
2.  优化ContractSelect组件,新增上次选中合同置顶、本地存储选中记录功能
3.  为合卷、分条、退火计划、钢卷编辑页面添加合同必填校验与自动关联逻辑
4.  移除各业务页面冗余的合同关系手动调用代码,统一关联逻辑
This commit is contained in:
2026-06-18 13:49:52 +08:00
parent 7f1a89eb61
commit ee49fbdcc0
7 changed files with 392 additions and 63 deletions

View File

@@ -134,12 +134,14 @@ export default {
},
set(val) {
this.$emit('input', val);
if (val) {
localStorage.setItem('lastSelectedContractId', val);
}
}
}
},
mounted() {
if (this.mode == "today") {
// 从localstorage中获取合同列表
this.loadFromLocalStorage();
} else {
this.loadContractList();
@@ -197,10 +199,23 @@ export default {
this.contractList = this.contractList.filter((item, index, self) =>
index === self.findIndex(t => t.orderId === item.orderId)
);
// 上一次选择的合同放在列表第一位
this.sortLastSelectedToFirst();
// 保存到localStorage
this.saveToLocalStorage();
}
},
// 将上一次选择的合同排到列表第一位
sortLastSelectedToFirst() {
const lastId = localStorage.getItem('lastSelectedContractId');
if (!lastId) return;
const index = this.contractList.findIndex(item => String(item.orderId) === String(lastId));
if (index > 0) {
const [item] = this.contractList.splice(index, 1);
this.contractList.unshift(item);
}
},
// 打开选择弹窗
async openSelectDialog() {
this.dialogVisible = true;