feat(qc): 新增厂家卷号匹配功能,优化卷号录入体验

本次改动在检验任务、化学成分报告、物理性能报告模块中:
1. 支持通过入场卷号和厂家卷号双向搜索匹配
2. 新增多选卷号标签式展示与删除功能
3. 新增批量导入时厂家卷号自动匹配入场卷号的逻辑,包含多匹配结果弹窗选择
4. 在表格中新增厂家卷号展示列,更新导入模板支持厂家卷号字段
This commit is contained in:
2026-06-01 16:40:13 +08:00
parent 37b2987279
commit ca285f78c6
4 changed files with 525 additions and 56 deletions

View File

@@ -73,17 +73,56 @@
</el-form-item>
</el-form>
<el-form :model="form" ref="taskForm" label-width="80px" size="small" v-if="form.taskType === '产品检验'">
<el-form-item label="入场卷号" prop="enterCoilNos" :rules="[{ required: true, message: '请输入入场卷号', trigger: 'blur' }]">
<el-autocomplete
v-model="form.enterCoilNos"
:fetch-suggestions="queryCoilNo"
placeholder="请输入入场卷号输入2个字符以上自动搜索"
:loading="coilNoLoading"
:trigger-on-focus="false"
clearable
style="width: 280px;"
/>
</el-form-item>
<div style="background: #f5f7fa; border: 1px solid #e4e7ed; border-radius: 6px; padding: 12px 16px 8px 16px; margin-bottom: 4px;">
<div style="font-size: 12px; color: #909399; margin-bottom: 8px; line-height: 1.6;">
<i class="el-icon-info" style="margin-right: 4px;"></i>
可输入入场卷号或厂家卷号两者互通匹配
</div>
<el-form-item label="入场卷号" prop="enterCoilNos" :rules="[{ required: true, message: '请输入入场卷号', trigger: 'blur' }]">
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;">
<el-tag
v-for="(coilNo, index) in selectedEnterCoilNos"
:key="'enter-' + index"
closable
@close="removeEnterCoilNo(index)"
>
{{ coilNo }}
</el-tag>
</div>
<el-autocomplete
v-model="tempEnterCoilNo"
:fetch-suggestions="queryCoilNo"
placeholder="输入入场卷号搜索添加"
:loading="coilNoLoading"
:trigger-on-focus="false"
clearable
style="width: 280px;"
@select="handleSelectCoilNo"
/>
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;" v-if="selectedSupplierCoilNos.length > 0">
<el-tag
v-for="(coilNo, index) in selectedSupplierCoilNos"
:key="'supplier-' + index"
type="info"
closable
@close="removeSupplierCoilNo(index)"
>
{{ coilNo }}
</el-tag>
</div>
<el-autocomplete
v-model="tempSupplierCoilNo"
:fetch-suggestions="querySupplierCoilNo"
placeholder="或输入厂家卷号自动匹配"
:loading="supplierCoilNoLoading"
:trigger-on-focus="false"
clearable
size="small"
style="width: 280px; margin-top: 6px;"
@select="handleSelectSupplierCoilNo"
/>
</el-form-item>
</div>
</el-form>
<!-- <div style="margin-bottom: 8px;">
<CoilSelector use-trigger multiple @confirm="handleCoilConfirm">
@@ -190,6 +229,11 @@ export default {
},
coilNoOptions: [],
coilNoLoading: false,
selectedEnterCoilNos: [],
tempEnterCoilNo: '',
selectedSupplierCoilNos: [],
tempSupplierCoilNo: '',
supplierCoilNoLoading: false,
};
},
computed: {
@@ -208,6 +252,10 @@ export default {
this.checkItemList = [];
this.form.taskCode = undefined;
this.selectedCoils = [];
this.selectedEnterCoilNos = [];
this.tempEnterCoilNo = '';
this.selectedSupplierCoilNos = [];
this.tempSupplierCoilNo = '';
this.getList();
}
}
@@ -264,7 +312,8 @@ export default {
taskType: this.form.taskType,
belongCompany: this.form.belongCompany || undefined,
coilIds: coilIds || undefined,
enterCoilNos: this.form.enterCoilNos || undefined
enterCoilNos: this.form.enterCoilNos || undefined,
supplierCoilNos: this.form.supplierCoilNos || undefined
});
this.dialogVisible = false;
}
@@ -303,11 +352,59 @@ export default {
const options = (response.rows || []).map(item => ({
value: item.enterCoilNo,
label: item.enterCoilNo
}));
})).filter(opt => !this.selectedEnterCoilNos.includes(opt.value));
cb(options);
}).finally(() => {
this.coilNoLoading = false;
});
},
handleSelectCoilNo(item) {
if (!this.selectedEnterCoilNos.includes(item.value)) {
this.selectedEnterCoilNos.push(item.value);
}
this.tempEnterCoilNo = '';
this.form.enterCoilNos = this.selectedEnterCoilNos.join(',');
},
removeEnterCoilNo(index) {
this.selectedEnterCoilNos.splice(index, 1);
this.form.enterCoilNos = this.selectedEnterCoilNos.join(',');
},
querySupplierCoilNo(queryString, cb) {
if (!queryString || queryString.length < 2) {
cb([]);
return;
}
this.supplierCoilNoLoading = true;
listMaterialCoil({
supplierCoilNo: queryString,
pageNum: 1,
pageSize: 20
}).then(response => {
const options = (response.rows || []).map(item => ({
value: item.supplierCoilNo,
label: item.supplierCoilNo,
enterCoilNo: item.enterCoilNo
})).filter(opt => !this.selectedSupplierCoilNos.includes(opt.value));
cb(options);
}).finally(() => {
this.supplierCoilNoLoading = false;
});
},
handleSelectSupplierCoilNo(item) {
if (!this.selectedSupplierCoilNos.includes(item.value)) {
this.selectedSupplierCoilNos.push(item.value);
}
this.form.supplierCoilNos = this.selectedSupplierCoilNos.join(',');
if (item.enterCoilNo && !this.selectedEnterCoilNos.includes(item.enterCoilNo)) {
this.selectedEnterCoilNos.push(item.enterCoilNo);
this.form.enterCoilNos = this.selectedEnterCoilNos.join(',');
this.$refs["taskForm"].validateField('enterCoilNos');
}
this.tempSupplierCoilNo = '';
},
removeSupplierCoilNo(index) {
this.selectedSupplierCoilNos.splice(index, 1);
this.form.supplierCoilNos = this.selectedSupplierCoilNos.join(',');
}
}
};