feat(qc): 新增厂家卷号匹配功能,优化卷号录入体验
本次改动在检验任务、化学成分报告、物理性能报告模块中: 1. 支持通过入场卷号和厂家卷号双向搜索匹配 2. 新增多选卷号标签式展示与删除功能 3. 新增批量导入时厂家卷号自动匹配入场卷号的逻辑,包含多匹配结果弹窗选择 4. 在表格中新增厂家卷号展示列,更新导入模板支持厂家卷号字段
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
<el-table-column label="任务编号" align="center" prop="taskCode" />
|
||||
<el-table-column label="任务类型" align="center" prop="taskType" />
|
||||
<el-table-column label="入场卷号" align="center" prop="enterCoilNos" />
|
||||
<el-table-column label="厂家卷号" align="center" prop="supplierCoilNos" />
|
||||
<el-table-column label="所属单位" align="center" prop="belongCompany" />
|
||||
<el-table-column label="方案名称" align="center" prop="schemeName" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="90">
|
||||
@@ -258,27 +259,57 @@
|
||||
<el-option label="产品检验" value="产品检验" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="入场卷号" prop="enterCoilNos" v-if="taskForm.taskType === '产品检验'">
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;">
|
||||
<el-tag
|
||||
v-for="(coilNo, index) in selectedEnterCoilNos"
|
||||
:key="index"
|
||||
closable
|
||||
@close="removeEnterCoilNo(index)"
|
||||
>
|
||||
{{ coilNo }}
|
||||
</el-tag>
|
||||
<template v-if="taskForm.taskType === '产品检验'">
|
||||
<div style="background: #f5f7fa; border: 1px solid #e4e7ed; border-radius: 6px; padding: 12px 16px 8px 16px; margin-bottom: 18px;">
|
||||
<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">
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;">
|
||||
<el-tag
|
||||
v-for="(coilNo, index) in selectedEnterCoilNos"
|
||||
:key="index"
|
||||
closable
|
||||
@close="removeEnterCoilNo(index)"
|
||||
>
|
||||
{{ coilNo }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-autocomplete
|
||||
v-model="tempEnterCoilNo"
|
||||
:fetch-suggestions="queryEnterCoilNo"
|
||||
placeholder="输入入场卷号搜索添加"
|
||||
:loading="enterCoilNoLoading"
|
||||
:trigger-on-focus="false"
|
||||
clearable
|
||||
@select="handleSelectEnterCoilNo"
|
||||
/>
|
||||
<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="'s-' + 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"
|
||||
@select="handleSelectSupplierCoilNo"
|
||||
style="margin-top: 6px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-autocomplete
|
||||
v-model="tempEnterCoilNo"
|
||||
:fetch-suggestions="queryEnterCoilNo"
|
||||
placeholder="2个字符以上自动搜索"
|
||||
:loading="enterCoilNoLoading"
|
||||
:trigger-on-focus="false"
|
||||
clearable
|
||||
@select="handleSelectEnterCoilNo"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="所属单位" prop="belongCompany">
|
||||
<el-input v-model="taskForm.belongCompany" placeholder="请输入所属单位" />
|
||||
</el-form-item>
|
||||
@@ -488,6 +519,9 @@ export default {
|
||||
enterCoilNoLoading: false,
|
||||
selectedEnterCoilNos: [],
|
||||
tempEnterCoilNo: '',
|
||||
selectedSupplierCoilNos: [],
|
||||
tempSupplierCoilNo: '',
|
||||
supplierCoilNoLoading: false,
|
||||
attachmentOpen: false,
|
||||
attachmentTitle: '',
|
||||
attachmentLoading: false,
|
||||
@@ -558,6 +592,8 @@ export default {
|
||||
this.resetTaskForm();
|
||||
this.selectedEnterCoilNos = [];
|
||||
this.tempEnterCoilNo = '';
|
||||
this.selectedSupplierCoilNos = [];
|
||||
this.tempSupplierCoilNo = '';
|
||||
this.taskOpen = true;
|
||||
this.taskTitle = "添加检验任务";
|
||||
},
|
||||
@@ -581,6 +617,13 @@ export default {
|
||||
this.selectedEnterCoilNos = [];
|
||||
}
|
||||
this.tempEnterCoilNo = '';
|
||||
// 初始化已选择的厂家卷号
|
||||
if (response.data.supplierCoilNos) {
|
||||
this.selectedSupplierCoilNos = response.data.supplierCoilNos.split(',').filter(item => item.trim());
|
||||
} else {
|
||||
this.selectedSupplierCoilNos = [];
|
||||
}
|
||||
this.tempSupplierCoilNo = '';
|
||||
this.taskLoading = false;
|
||||
this.taskOpen = true;
|
||||
this.taskTitle = "修改检验任务";
|
||||
@@ -636,7 +679,7 @@ export default {
|
||||
handleQuickCreate() {
|
||||
this.schemeVisible = true;
|
||||
},
|
||||
handleSchemeConfirm({ template, taskCode, taskType, belongCompany, coilIds, enterCoilNos }) {
|
||||
handleSchemeConfirm({ template, taskCode, taskType, belongCompany, coilIds, enterCoilNos, supplierCoilNos }) {
|
||||
this.taskLoading = true;
|
||||
addInspectionTaskWithItems({
|
||||
taskCode: taskCode,
|
||||
@@ -645,7 +688,8 @@ export default {
|
||||
belongCompany: belongCompany,
|
||||
taskType: taskType,
|
||||
coilIds: coilIds || undefined,
|
||||
enterCoilNos: enterCoilNos || undefined
|
||||
enterCoilNos: enterCoilNos || undefined,
|
||||
supplierCoilNos: supplierCoilNos || undefined
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("快捷创建成功");
|
||||
this.getTaskList();
|
||||
@@ -757,6 +801,43 @@ export default {
|
||||
this.selectedEnterCoilNos.splice(index, 1);
|
||||
this.taskForm.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.taskForm.supplierCoilNos = this.selectedSupplierCoilNos.join(',');
|
||||
if (item.enterCoilNo && !this.selectedEnterCoilNos.includes(item.enterCoilNo)) {
|
||||
this.selectedEnterCoilNos.push(item.enterCoilNo);
|
||||
this.taskForm.enterCoilNos = this.selectedEnterCoilNos.join(',');
|
||||
this.$refs["taskForm"].validateField('enterCoilNos');
|
||||
}
|
||||
this.tempSupplierCoilNo = '';
|
||||
},
|
||||
removeSupplierCoilNo(index) {
|
||||
this.selectedSupplierCoilNos.splice(index, 1);
|
||||
this.taskForm.supplierCoilNos = this.selectedSupplierCoilNos.join(',');
|
||||
},
|
||||
cancelTask() {
|
||||
this.taskOpen = false;
|
||||
this.resetTaskForm();
|
||||
@@ -787,6 +868,8 @@ export default {
|
||||
this.taskCoilList = [];
|
||||
this.selectedEnterCoilNos = [];
|
||||
this.tempEnterCoilNo = '';
|
||||
this.selectedSupplierCoilNos = [];
|
||||
this.tempSupplierCoilNo = '';
|
||||
this.resetForm("taskForm");
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user