|
|
@@ -57,6 +57,8 @@
|
|
|
v-if="['purchaser', 'supplier', 'decisionStage', 'status'].includes(col.key)"
|
|
|
v-model="row[col.key]"
|
|
|
filterable
|
|
|
+ allow-create
|
|
|
+ default-first-option
|
|
|
:remote="col.key === 'supplier'"
|
|
|
:remote-method="col.key === 'supplier' ? searchSuppliers : undefined"
|
|
|
:loading="col.key === 'purchaser' ? purchaserLoading : col.key === 'supplier' ? supplierLoading : false"
|
|
|
@@ -187,8 +189,8 @@ const TABLE_COLUMNS: ColDef[] = [
|
|
|
{ key: 'issue', label: '异常问题', minWidth: 120, type: 'text' },
|
|
|
];
|
|
|
|
|
|
-const DECISION_STAGE_OPTIONS = ['待决策', '已发资料', '集采再询价', '竞价或扩额', '替代采购', '已维护价格'];
|
|
|
-const STATUS_OPTIONS = ['待决策', '已下订单', '已通知送货', '已部分到货', '已完成', '已删除', '被替代'];
|
|
|
+const DECISION_STAGE_OPTIONS = ref(['待决策', '已发资料', '集采再询价', '竞价或扩额', '替代采购', '已维护价格']);
|
|
|
+const STATUS_OPTIONS = ref(['待决策', '已下订单', '已通知送货', '已部分到货', '已完成', '已删除', '被替代']);
|
|
|
|
|
|
// ── 数据状态 ──
|
|
|
interface ParsedRow {
|
|
|
@@ -384,8 +386,30 @@ async function autoMatchSourceList(row: ParsedRow) {
|
|
|
// ── 可编辑列变更处理 ──
|
|
|
function onCellChange(row: ParsedRow, key: string) {
|
|
|
if (key === 'purchaser') {
|
|
|
+ const val = String(row.purchaser ?? '').trim();
|
|
|
+ if (val && !purchaserOptions.value.includes(val)) {
|
|
|
+ purchaserOptions.value.push(val);
|
|
|
+ }
|
|
|
autoMatchSupplierLocal(row);
|
|
|
}
|
|
|
+ if (key === 'decisionStage') {
|
|
|
+ const val = String(row.decisionStage ?? '').trim();
|
|
|
+ if (val && !DECISION_STAGE_OPTIONS.value.includes(val)) {
|
|
|
+ DECISION_STAGE_OPTIONS.value.push(val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (key === 'status') {
|
|
|
+ const val = String(row.status ?? '').trim();
|
|
|
+ if (val && !STATUS_OPTIONS.value.includes(val)) {
|
|
|
+ STATUS_OPTIONS.value.push(val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (key === 'supplier') {
|
|
|
+ const val = String(row.supplier ?? '').trim();
|
|
|
+ if (val && !supplierOptions.value.some((s) => s.value === val)) {
|
|
|
+ supplierOptions.value.unshift({ value: val, label: val });
|
|
|
+ }
|
|
|
+ }
|
|
|
if (key === 'supplier' && row.supplier && row.itemNum) {
|
|
|
saveSupplySourceRule(
|
|
|
String(row.itemNum),
|
|
|
@@ -503,6 +527,8 @@ function onFileChange(e: Event) {
|
|
|
|
|
|
// 子物料号为空则跳过
|
|
|
if (!row.itemNum) continue;
|
|
|
+ // 无BOM关键字段的行跳过(仅有采购负责人但无订单/合同/父物料号的无效行)
|
|
|
+ if (!row.salesOrderNo && !row.contractNo && !row.parentItemNum) continue;
|
|
|
|
|
|
// 默认状态
|
|
|
if (!row.status) row.status = '待决策';
|