feat(qc): 新增入场钢卷号字段并优化质检相关流程
1. 在质检任务相关BO、VO、实体类中新增enterCoilNos字段 2. 调整检验任务查询逻辑,支持按入场钢卷号筛选 3. 优化钢卷相关页面的字段展示和表单校验 4. 简化理化导入流程,移除钢卷匹配步骤
This commit is contained in:
@@ -86,6 +86,10 @@ public class QcInspectionTask extends BaseEntity {
|
||||
* 钢卷ID集合,多个使用英文逗号分隔
|
||||
*/
|
||||
private String coilIds;
|
||||
/**
|
||||
* 钢卷号集合
|
||||
*/
|
||||
private String enterCoilNos;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
|
||||
@@ -99,5 +99,8 @@ public class QcInspectionTaskBo extends BaseEntity {
|
||||
*/
|
||||
private String coilIds;
|
||||
|
||||
|
||||
/**
|
||||
* 钢卷号集合
|
||||
*/
|
||||
private String enterCoilNos;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,11 @@ public class QcInspectionTaskVo {
|
||||
*/
|
||||
private String coilIds;
|
||||
|
||||
/**
|
||||
* 钢卷号集合
|
||||
*/
|
||||
private String enterCoilNos;
|
||||
|
||||
private List<WmsMaterialCoilVo> coilList;
|
||||
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ public class QcInspectionTaskServiceImpl implements IQcInspectionTaskService {
|
||||
lqw.eq(bo.getAuditTime() != null, QcInspectionTask::getAuditTime, bo.getAuditTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getResult()), QcInspectionTask::getResult, bo.getResult());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCoilIds()), QcInspectionTask::getCoilIds, bo.getCoilIds());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getEnterCoilNos()), QcInspectionTask::getEnterCoilNos, bo.getEnterCoilNos());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<result property="result" column="result"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="coilIds" column="coil_ids"/>
|
||||
<result property="enterCoilNos" column="enter_coil_nos"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
|
||||
@@ -72,7 +72,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin-bottom: 8px;">
|
||||
<el-form :model="form" ref="taskForm" label-width="80px" size="small">
|
||||
<el-form-item label="入场卷号" prop="enterCoilNos" :rules="[{ required: true, message: '请输入入场卷号', trigger: 'blur' }]">
|
||||
<el-input v-model="form.enterCoilNos" placeholder="请输入入场卷号" style="width: 280px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <div style="margin-bottom: 8px;">
|
||||
<CoilSelector use-trigger multiple @confirm="handleCoilConfirm">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="small">选择钢卷</el-button>
|
||||
</CoilSelector>
|
||||
@@ -86,7 +91,7 @@
|
||||
<CurrentCoilNo @click.native="handleClickCoil(coil)" :currentCoilNo="coil.currentCoilNo || coil.coilNo || ''" />
|
||||
<el-button type="text" icon="el-icon-close" size="mini" @click="selectedCoils.splice(index, 1)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -247,7 +252,8 @@ export default {
|
||||
taskCode: this.form.taskCode,
|
||||
taskType: this.form.taskType,
|
||||
belongCompany: this.form.belongCompany || undefined,
|
||||
coilIds: coilIds || undefined
|
||||
coilIds: coilIds || undefined,
|
||||
enterCoilNos: this.form.enterCoilNos || undefined
|
||||
});
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="钢卷号" prop="coilNo">
|
||||
<el-form-item label="入场钢卷号" prop="coilNo">
|
||||
<el-input
|
||||
v-model="queryParams.coilNo"
|
||||
placeholder="请输入钢卷号"
|
||||
placeholder="请输入入场钢卷号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<el-table v-loading="loading" :data="chemicalItemList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="钢卷号" align="center" prop="coilNo" />
|
||||
<el-table-column label="入场钢卷号" align="center" prop="coilNo" />
|
||||
<el-table-column label="炉号" align="center" prop="heatNo" />
|
||||
<el-table-column label="碳(%)" align="center" prop="c" />
|
||||
<el-table-column label="硅(%)" align="center" prop="si" />
|
||||
@@ -120,12 +120,11 @@
|
||||
<!-- 添加或修改质量的化学成分明细对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="钢卷" prop="coilId">
|
||||
<coil-selector v-model="form.coilId" :use-trigger="true" @select="handleSelect"
|
||||
:filters="{ selectType: 'product', status: 0, dataType: 1 }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="钢卷号" prop="coilNo">
|
||||
<el-input v-model="form.coilNo" placeholder="自动填写" />
|
||||
<el-form-item label="入场钢卷号" prop="coilNo">
|
||||
<el-input v-model="form.coilNo" placeholder="请输入入场钢卷号" />
|
||||
<!-- <coil-selector :use-trigger="true" @select="handleSelect"
|
||||
:filters="{ selectType: 'product', status: 0, dataType: 1 }" /> -->
|
||||
<!-- <el-input v-model="form.coilNo" placeholder="自动填写" /> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="炉号" prop="heatNo">
|
||||
<el-input v-model="form.heatNo" placeholder="请输入炉号" />
|
||||
@@ -169,23 +168,18 @@
|
||||
<div class="step-label">下载模板</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus !== 'idle' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus !== 'idle' && importStatus !== 'validated' }">
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'processing' || importStatus === 'finished', done: importStatus !== 'idle' && importStatus !== 'validated' }">
|
||||
<div class="step-badge">2</div>
|
||||
<div class="step-label">上传文件</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'processing' || importStatus === 'finished' }">
|
||||
<div class="step-connector" :class="{ done: importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'processing' || importStatus === 'finished' }">
|
||||
<div class="step-badge">3</div>
|
||||
<div class="step-label">校验数据</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'finished' }">
|
||||
<div class="step-badge step-badge-warn">4</div>
|
||||
<div class="step-label">匹配钢卷</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'finished' }">
|
||||
<div class="step-badge step-badge-success">5</div>
|
||||
<div class="step-badge step-badge-success">4</div>
|
||||
<div class="step-label">批量导入</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,64 +196,29 @@
|
||||
</el-upload>
|
||||
<el-button type="success" plain icon="el-icon-check" @click="importHandleValidate"
|
||||
:disabled="!importFile || importValidateLoading || importStatus !== 'idle'" :loading="importValidateLoading">校验数据</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-coordinate" @click="importMatchCoils"
|
||||
v-if="importStatus === 'validated'" :loading="importMatchingLoading"
|
||||
:disabled="importMatchingLoading || importErrorList.length > 0">匹配钢卷</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button v-if="importStatus === 'matched'" type="primary" icon="el-icon-upload-success" @click="importStartImport" :loading="importLoading">开始导入</el-button>
|
||||
<el-button v-if="importStatus === 'validated'" type="primary" icon="el-icon-upload-success" @click="importStartImport" :loading="importLoading">开始导入</el-button>
|
||||
<el-button plain icon="el-icon-download" @click="importDownloadTemplate">下载模板</el-button>
|
||||
<el-button plain icon="el-icon-refresh" @click="importReset">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 匹配结果摘要 -->
|
||||
<div v-if="importStatus === 'matched'" class="match-summary">
|
||||
<div class="summary-item summary-matched">
|
||||
<span class="summary-num">{{ matchedCount }}</span>
|
||||
<span class="summary-label">已匹配</span>
|
||||
</div>
|
||||
<div class="summary-item summary-ambiguous">
|
||||
<span class="summary-num">{{ ambiguousCount }}</span>
|
||||
<span class="summary-label">待选择</span>
|
||||
</div>
|
||||
<div class="summary-item summary-notfound">
|
||||
<span class="summary-num">{{ notFoundCount }}</span>
|
||||
<span class="summary-label">未找到</span>
|
||||
</div>
|
||||
<div class="summary-item summary-total">
|
||||
<span class="summary-num">{{ importTableData.length }}</span>
|
||||
<span class="summary-label">总计</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 数据预览表格 -->
|
||||
<div v-if="importTableData.length > 0" class="data-preview">
|
||||
<el-table ref="importTable" :data="importTableData" border size="small" max-height="340" stripe
|
||||
:row-class-name="importTableRowClassName">
|
||||
<el-table-column label="#" width="48" type="index" align="center" />
|
||||
<el-table-column prop="currentCoilNo" label="当前钢卷号" width="140" />
|
||||
<el-table-column prop="coilNo" label="入场钢卷号" width="140" />
|
||||
<el-table-column prop="c" label="C(%)" width="70" align="center" />
|
||||
<el-table-column prop="si" label="Si(%)" width="70" align="center" />
|
||||
<el-table-column prop="mn" label="Mn(%)" width="70" align="center" />
|
||||
<el-table-column prop="p" label="P(%)" width="70" align="center" />
|
||||
<el-table-column prop="s" label="S(%)" width="70" align="center" />
|
||||
<el-table-column prop="als" label="Als(%)" width="70" align="center" />
|
||||
<el-table-column label="匹配结果" width="130" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row._status === 'matched'" type="success" size="mini" effect="plain">已匹配</el-tag>
|
||||
<el-tag v-else-if="scope.row._status === 'ambiguous'" type="warning" size="mini" effect="plain" class="tag-clickable" @click="importOpenCandidateDialog(scope.$index)">
|
||||
<i class="el-icon-question" /> 需选择
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row._status === 'not_found'" type="danger" size="mini" effect="plain">未找到</el-tag>
|
||||
<el-tag v-else type="info" size="mini" effect="plain">待处理</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="90" align="center" fixed="right" v-if="importStatus === 'matched'">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row._status === 'ambiguous'" type="warning" size="mini" plain @click="importOpenCandidateDialog(scope.$index)">选择钢卷</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -289,48 +248,21 @@
|
||||
<div class="result-desc">{{ importErrorMsg }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 未找到的提示 -->
|
||||
<div v-if="importErrorList.length > 0 && importStatus !== 'error'" class="result-panel result-error">
|
||||
<div class="result-icon"><i class="el-icon-warning-outline" /></div>
|
||||
<div class="result-body">
|
||||
<div class="result-title">{{ importErrorList.length }} 条记录未找到对应钢卷</div>
|
||||
<div class="result-desc">这些记录将在导入时被跳过,请检查钢卷号是否正确</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 钢卷选择对话框(多匹配时) -->
|
||||
<el-dialog title="选择钢卷" :visible.sync="candidateDialogVisible" width="700px" top="20vh" append-to-body>
|
||||
<div class="candidate-hint">
|
||||
<i class="el-icon-info" />
|
||||
当前钢卷号 <b>{{ candidateCoilNo }}</b> 匹配到多条记录,请选择一条:
|
||||
</div>
|
||||
<el-table ref="candidateTable" :data="candidateList" border height="300" highlight-current-row @row-click="importSelectCandidate">
|
||||
<el-table-column type="index" label="#" width="48" align="center" />
|
||||
<el-table-column prop="currentCoilNo" label="当前钢卷号" width="140" />
|
||||
<el-table-column prop="material" label="材质" width="100" />
|
||||
<el-table-column prop="specification" label="规格" width="120" />
|
||||
<el-table-column prop="netWeight" label="重量(t)" width="100" align="center" />
|
||||
<el-table-column prop="warehouseName" label="库区" />
|
||||
</el-table>
|
||||
<div class="candidate-footer">点击行即可选中</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as XLSX from 'xlsx';
|
||||
import { listChemicalItem, getChemicalItem, delChemicalItem, addChemicalItem, updateChemicalItem, batchAddChemicalItem } from "@/api/mes/qc/chemicalItem";
|
||||
import { listMaterialCoil } from "@/api/wms/coil";
|
||||
import CoilSelector from "@/components/CoilSelector";
|
||||
|
||||
const CHEMI_TEMPLATE_HEADERS = ['当前钢卷号', 'C(%)', 'Si(%)', 'Mn(%)', 'P(%)', 'S(%)', 'Als(%)'];
|
||||
const CHEMI_TEMPLATE_HEADERS = ['入场钢卷号', 'C(%)', 'Si(%)', 'Mn(%)', 'P(%)', 'S(%)', 'Als(%)'];
|
||||
|
||||
const CHEMI_HEADER_MAP = {
|
||||
'当前钢卷号': 'currentCoilNo',
|
||||
'入场钢卷号': 'coilNo',
|
||||
'C(%)': 'c',
|
||||
'Si(%)': 'si',
|
||||
'Mn(%)': 'mn',
|
||||
@@ -344,11 +276,7 @@ export default {
|
||||
components: {
|
||||
CoilSelector
|
||||
},
|
||||
computed: {
|
||||
matchedCount() { return this.importTableData.filter(r => r._status === 'matched').length; },
|
||||
ambiguousCount() { return this.importTableData.filter(r => r._status === 'ambiguous').length; },
|
||||
notFoundCount() { return this.importTableData.filter(r => r._status === 'not_found').length; }
|
||||
},
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
@@ -389,7 +317,7 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
coilNo: [
|
||||
{ required: true, message: "钢卷号不能为空", trigger: "blur" }
|
||||
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
importDialogVisible: false,
|
||||
@@ -403,12 +331,7 @@ export default {
|
||||
importStatus: 'idle', // idle | validated | matched | processing | finished | error
|
||||
importErrorMsg: '',
|
||||
importValidateLoading: false,
|
||||
importMatchingLoading: false,
|
||||
importLoading: false,
|
||||
candidateDialogVisible: false,
|
||||
candidateRowIndex: -1,
|
||||
candidateCoilNo: '',
|
||||
candidateList: []
|
||||
importLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -434,7 +357,6 @@ export default {
|
||||
this.form = {
|
||||
itemId: undefined,
|
||||
certificateId: undefined,
|
||||
coilId: undefined,
|
||||
coilNo: undefined,
|
||||
heatNo: undefined,
|
||||
c: undefined,
|
||||
@@ -475,15 +397,13 @@ export default {
|
||||
this.title = "添加质量的化学成分明细";
|
||||
},
|
||||
handleSelect(coil) {
|
||||
this.form.coilId = coil.coilId;
|
||||
this.form.coilNo = coil.currentCoilNo;
|
||||
this.form.coilNo = coil.enterCoilNo;
|
||||
},
|
||||
handleBatchAdd(rows) {
|
||||
this.loading = true;
|
||||
this.buttonLoading = true;
|
||||
const payload = rows.map(coil => ({
|
||||
coilId: coil.coilId,
|
||||
coilNo: coil.currentCoilNo,
|
||||
coilNo: coil.enterCoilNo,
|
||||
}))
|
||||
batchAddChemicalItem(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
@@ -497,7 +417,7 @@ export default {
|
||||
this.importDialogVisible = true;
|
||||
},
|
||||
importHandleFileChange(file) {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading) return;
|
||||
if (this.importValidateLoading || this.importLoading) return;
|
||||
this.importFile = file.raw;
|
||||
this.importErrorList = [];
|
||||
this.importStatus = 'idle';
|
||||
@@ -541,10 +461,6 @@ export default {
|
||||
CHEMI_TEMPLATE_HEADERS.forEach((h, j) => { obj[CHEMI_HEADER_MAP[h]] = row[j] != null ? String(row[j]).trim() : ''; });
|
||||
obj.rowNum = i + 2;
|
||||
obj._status = 'pending';
|
||||
obj._coilId = null;
|
||||
obj._coilNo = null;
|
||||
obj._candidates = [];
|
||||
obj._errorMsg = '';
|
||||
this.importTableData.push(obj);
|
||||
});
|
||||
},
|
||||
@@ -555,76 +471,22 @@ export default {
|
||||
for (let i = 0; i < this.importRawData.length; i++) {
|
||||
const rowNum = i + 2;
|
||||
let coilNo = '';
|
||||
CHEMI_TEMPLATE_HEADERS.forEach((h, j) => { if (CHEMI_HEADER_MAP[h] === 'currentCoilNo') coilNo = this.importRawData[i][j]; });
|
||||
CHEMI_TEMPLATE_HEADERS.forEach((h, j) => { if (CHEMI_HEADER_MAP[h] === 'coilNo') coilNo = this.importRawData[i][j]; });
|
||||
if (!coilNo || !String(coilNo).trim()) this.importErrorList.push({ rowNum, errorMsg: '当前钢卷号不能为空' });
|
||||
}
|
||||
if (this.importErrorList.length > 0) {
|
||||
this.$message.error(`数据校验失败,共发现${this.importErrorList.length}条错误`);
|
||||
} else {
|
||||
this.importTableData.forEach(row => { row._status = 'valid'; });
|
||||
this.$message.success('数据校验通过');
|
||||
this.importStatus = 'validated';
|
||||
}
|
||||
this.importValidateLoading = false;
|
||||
},
|
||||
async importMatchCoils() {
|
||||
this.importMatchingLoading = true;
|
||||
this.importErrorList = [];
|
||||
for (let i = 0; i < this.importTableData.length; i++) {
|
||||
const row = this.importTableData[i];
|
||||
const coilNo = row.currentCoilNo;
|
||||
if (!coilNo) { row._status = 'not_found'; row._errorMsg = '钢卷号为空'; continue; }
|
||||
try {
|
||||
const res = await listMaterialCoil({ currentCoilNo: coilNo, dataType: 1, pageSize: 999 });
|
||||
const coils = res.rows || [];
|
||||
if (coils.length === 0) {
|
||||
row._status = 'not_found';
|
||||
row._errorMsg = `未找到钢卷号"${coilNo}"`;
|
||||
} else if (coils.length === 1) {
|
||||
row._status = 'matched';
|
||||
row._coilId = coils[0].coilId;
|
||||
row._coilNo = coils[0].currentCoilNo;
|
||||
} else {
|
||||
row._status = 'ambiguous';
|
||||
row._candidates = coils;
|
||||
}
|
||||
} catch (err) {
|
||||
row._status = 'not_found';
|
||||
row._errorMsg = err.message;
|
||||
}
|
||||
}
|
||||
const notFound = this.importTableData.filter(r => r._status === 'not_found');
|
||||
if (notFound.length > 0) {
|
||||
this.importErrorList = notFound.map(r => ({ rowNum: r.rowNum, errorMsg: r._errorMsg }));
|
||||
this.$message.warning(`${notFound.length} 条记录未找到对应钢卷,已被剔除`);
|
||||
}
|
||||
this.importMatchingLoading = false;
|
||||
this.importStatus = 'matched';
|
||||
},
|
||||
importOpenCandidateDialog(index) {
|
||||
const row = this.importTableData[index];
|
||||
if (!row || row._status !== 'ambiguous') return;
|
||||
this.candidateRowIndex = index;
|
||||
this.candidateCoilNo = row.currentCoilNo;
|
||||
this.candidateList = row._candidates;
|
||||
this.candidateDialogVisible = true;
|
||||
},
|
||||
importSelectCandidate(coil) {
|
||||
if (this.candidateRowIndex < 0) return;
|
||||
const row = this.importTableData[this.candidateRowIndex];
|
||||
row._status = 'matched';
|
||||
row._coilId = coil.coilId;
|
||||
row._coilNo = coil.currentCoilNo;
|
||||
row._candidates = [];
|
||||
this.candidateDialogVisible = false;
|
||||
this.candidateRowIndex = -1;
|
||||
this.candidateList = [];
|
||||
this.$message.success(`已为第 ${row.rowNum} 行选择钢卷:${coil.currentCoilNo}`);
|
||||
},
|
||||
async importStartImport() {
|
||||
const rows = this.importTableData.filter(r => r._status === 'matched');
|
||||
const rows = this.importTableData.filter(r => r._status === 'valid');
|
||||
if (!rows.length) { this.$message.warning('没有可导入的数据'); return; }
|
||||
const skipped = this.importTableData.length - rows.length;
|
||||
const ok = await this.$confirm(`确认导入 ${rows.length} 条数据?${skipped ? `(${skipped} 条未匹配的记录将被跳过)` : ''}`, '导入确认', { confirmButtonText: '确认导入', cancelButtonText: '取消', type: 'warning' }).catch(() => false);
|
||||
const ok = await this.$confirm(`确认导入 ${rows.length} 条数据?`, '导入确认', { confirmButtonText: '确认导入', cancelButtonText: '取消', type: 'warning' }).catch(() => false);
|
||||
if (!ok) return;
|
||||
this.importLoading = true;
|
||||
this.importStatus = 'processing';
|
||||
@@ -633,7 +495,7 @@ export default {
|
||||
this.importErrorMsg = '';
|
||||
try {
|
||||
const payload = rows.map(row => {
|
||||
const item = { coilId: row._coilId, coilNo: row._coilNo };
|
||||
const item = { coilId: null, coilNo: row.coilNo };
|
||||
['c','si','mn','p','s','als'].forEach(f => { if (row[f]) item[f] = row[f]; });
|
||||
return item;
|
||||
});
|
||||
@@ -651,7 +513,7 @@ export default {
|
||||
}
|
||||
},
|
||||
importReset() {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading || this.importStatus === 'processing') { this.$message.warning('当前有操作正在进行中'); return; }
|
||||
if (this.importValidateLoading || this.importLoading || this.importStatus === 'processing') { this.$message.warning('当前有操作正在进行中'); return; }
|
||||
this.importFile = null;
|
||||
this.importRawData = [];
|
||||
this.importTableData = [];
|
||||
@@ -661,10 +523,6 @@ export default {
|
||||
this.importTotalCount = 0;
|
||||
this.importStatus = 'idle';
|
||||
this.importErrorMsg = '';
|
||||
this.candidateDialogVisible = false;
|
||||
this.candidateRowIndex = -1;
|
||||
this.candidateCoilNo = '';
|
||||
this.candidateList = [];
|
||||
this.$refs.importUpload?.clearFiles();
|
||||
},
|
||||
importDownloadTemplate() {
|
||||
@@ -680,13 +538,9 @@ export default {
|
||||
this.importStatus = 'error';
|
||||
this.importErrorMsg = msg;
|
||||
this.importValidateLoading = false;
|
||||
this.importMatchingLoading = false;
|
||||
this.importLoading = false;
|
||||
},
|
||||
importTableRowClassName({ row }) {
|
||||
if (row._status === 'ambiguous') return 'row-ambiguous';
|
||||
if (row._status === 'not_found') return 'row-notfound';
|
||||
if (row._status === 'matched') return 'row-matched';
|
||||
importTableRowClassName() {
|
||||
return '';
|
||||
},
|
||||
|
||||
|
||||
@@ -519,11 +519,11 @@ export default {
|
||||
};
|
||||
this.getCoilList();
|
||||
},
|
||||
async fetchLatestChemAndPhys(coilId) {
|
||||
if (!coilId) return {};
|
||||
async fetchLatestChemAndPhys(coilNo) {
|
||||
if (!coilNo) return {};
|
||||
const [chemRes, physRes] = await Promise.all([
|
||||
listChemicalItem({ coilId, pageNum: 1, pageSize: 1 }),
|
||||
listPhysicalItem({ coilId, pageNum: 1, pageSize: 1 })
|
||||
listChemicalItem({ coilNo, pageNum: 1, pageSize: 1 }),
|
||||
listPhysicalItem({ coilNo, pageNum: 1, pageSize: 1 })
|
||||
]);
|
||||
const chem = chemRes.rows && chemRes.rows[0] || {};
|
||||
const phys = physRes.rows && physRes.rows[0] || {};
|
||||
@@ -538,7 +538,7 @@ export default {
|
||||
editRow.size = row.specification;
|
||||
editRow.weight = row.netWeight;
|
||||
editRow.pieces = 1;
|
||||
const data = await this.fetchLatestChemAndPhys(row.coilId);
|
||||
const data = await this.fetchLatestChemAndPhys(row.enterCoilNo);
|
||||
Object.assign(editRow, data);
|
||||
}
|
||||
this.coilDialogVisible = false;
|
||||
@@ -583,11 +583,12 @@ export default {
|
||||
const totalCount = coils.length;
|
||||
let successCount = 0;
|
||||
let failCount = 0;
|
||||
this.loading = true;
|
||||
|
||||
for (let index = 0; index < coils.length; index++) {
|
||||
const coil = coils[index];
|
||||
try {
|
||||
const data = await this.fetchLatestChemAndPhys(coil.coilId);
|
||||
const data = await this.fetchLatestChemAndPhys(coil.enterCoilNo);
|
||||
const newRow = {
|
||||
certificateId: this.currentCertificateId,
|
||||
itemSeqNo: this.certificateItemList.length + index + 1,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="钢卷号" prop="coilNo">
|
||||
<el-form-item label="入场钢卷号" prop="coilNo">
|
||||
<el-input
|
||||
v-model="queryParams.coilNo"
|
||||
placeholder="请输入钢卷号"
|
||||
placeholder="请输入入场钢卷号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
@@ -131,7 +131,7 @@
|
||||
<el-table v-loading="loading" :data="physicalItemList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="物理性能ID" align="center" prop="physicalId" v-if="false"/>
|
||||
<el-table-column label="钢卷号" align="center" prop="coilNo" />
|
||||
<el-table-column label="入场钢卷号" align="center" prop="coilNo" />
|
||||
<el-table-column label="屈服强度(MPa)" align="center" prop="yieldStrength" />
|
||||
<el-table-column label="抗拉强度(MPa)" align="center" prop="tensileStrength" />
|
||||
<el-table-column label="伸长率(%)" align="center" prop="elongation" />
|
||||
@@ -170,12 +170,10 @@
|
||||
<!-- 添加或修改物理性能明细对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="钢卷" prop="coilId">
|
||||
<coil-selector v-model="form.coilId" :use-trigger="true" @select="handleSelect"
|
||||
:filters="{ selectType: 'product', status: 0, dataType: 1 }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="钢卷号" prop="coilNo">
|
||||
<el-input v-model="form.coilNo" placeholder="自动填写" />
|
||||
<el-form-item label="入场钢卷号" prop="coilNo">
|
||||
<!-- <coil-selector :use-trigger="true" @select="handleSelect"
|
||||
:filters="{ selectType: 'product', status: 0, dataType: 1 }" /> -->
|
||||
<el-input v-model="form.coilNo" placeholder="请输入入场钢卷号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="屈服强度(MPa)" prop="yieldStrength">
|
||||
<el-input v-model="form.yieldStrength" placeholder="请输入屈服强度(MPa)" />
|
||||
@@ -219,23 +217,18 @@
|
||||
<div class="step-label">下载模板</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus !== 'idle' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus !== 'idle' && importStatus !== 'validated' }">
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'processing' || importStatus === 'finished', done: importStatus !== 'idle' && importStatus !== 'validated' }">
|
||||
<div class="step-badge">2</div>
|
||||
<div class="step-label">上传文件</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'processing' || importStatus === 'finished' }">
|
||||
<div class="step-connector" :class="{ done: importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'validated' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'processing' || importStatus === 'finished' }">
|
||||
<div class="step-badge">3</div>
|
||||
<div class="step-label">校验数据</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'processing' || importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'matched' || importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'finished' }">
|
||||
<div class="step-badge step-badge-warn">4</div>
|
||||
<div class="step-label">匹配钢卷</div>
|
||||
</div>
|
||||
<div class="step-connector" :class="{ done: importStatus === 'finished' }" />
|
||||
<div class="step" :class="{ active: importStatus === 'processing' || importStatus === 'finished', done: importStatus === 'finished' }">
|
||||
<div class="step-badge step-badge-success">5</div>
|
||||
<div class="step-badge step-badge-success">4</div>
|
||||
<div class="step-label">批量导入</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -252,43 +245,22 @@
|
||||
</el-upload>
|
||||
<el-button type="success" plain icon="el-icon-check" @click="importHandleValidate"
|
||||
:disabled="!importFile || importValidateLoading || importStatus !== 'idle'" :loading="importValidateLoading">校验数据</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-coordinate" @click="importMatchCoils"
|
||||
v-if="importStatus === 'validated'" :loading="importMatchingLoading"
|
||||
:disabled="importMatchingLoading || importErrorList.length > 0">匹配钢卷</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button v-if="importStatus === 'matched'" type="primary" icon="el-icon-upload-success" @click="importStartImport" :loading="importLoading">开始导入</el-button>
|
||||
<el-button v-if="importStatus === 'validated'" type="primary" icon="el-icon-upload-success" @click="importStartImport" :loading="importLoading">开始导入</el-button>
|
||||
<el-button plain icon="el-icon-download" @click="importDownloadTemplate">下载模板</el-button>
|
||||
<el-button plain icon="el-icon-refresh" @click="importReset">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 匹配结果摘要 -->
|
||||
<div v-if="importStatus === 'matched'" class="match-summary">
|
||||
<div class="summary-item summary-matched">
|
||||
<span class="summary-num">{{ matchedCount }}</span>
|
||||
<span class="summary-label">已匹配</span>
|
||||
</div>
|
||||
<div class="summary-item summary-ambiguous">
|
||||
<span class="summary-num">{{ ambiguousCount }}</span>
|
||||
<span class="summary-label">待选择</span>
|
||||
</div>
|
||||
<div class="summary-item summary-notfound">
|
||||
<span class="summary-num">{{ notFoundCount }}</span>
|
||||
<span class="summary-label">未找到</span>
|
||||
</div>
|
||||
<div class="summary-item summary-total">
|
||||
<span class="summary-num">{{ importTableData.length }}</span>
|
||||
<span class="summary-label">总计</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 数据预览表格 -->
|
||||
<div v-if="importTableData.length > 0" class="data-preview">
|
||||
<el-table ref="importTable" :data="importTableData" border size="small" max-height="340" stripe
|
||||
:row-class-name="importTableRowClassName">
|
||||
<el-table-column label="#" width="48" type="index" align="center" />
|
||||
<el-table-column prop="currentCoilNo" label="当前钢卷号" width="140" />
|
||||
<el-table-column prop="coilNo" label="入场钢卷号" width="140" />
|
||||
<el-table-column prop="yieldStrength" label="屈服强度(MPa)" width="110" align="center" />
|
||||
<el-table-column prop="tensileStrength" label="抗拉强度(MPa)" width="110" align="center" />
|
||||
<el-table-column prop="elongation" label="伸长率(%)" width="80" align="center" />
|
||||
@@ -297,21 +269,7 @@
|
||||
<el-table-column prop="surfaceQuality" label="表面质量" width="80" align="center" />
|
||||
<el-table-column prop="surfaceStructure" label="表面结构" width="80" align="center" />
|
||||
<el-table-column prop="edgeStatus" label="边缘状态" width="80" align="center" />
|
||||
<el-table-column label="匹配结果" width="130" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row._status === 'matched'" type="success" size="mini" effect="plain">已匹配</el-tag>
|
||||
<el-tag v-else-if="scope.row._status === 'ambiguous'" type="warning" size="mini" effect="plain" class="tag-clickable" @click="importOpenCandidateDialog(scope.$index)">
|
||||
<i class="el-icon-question" /> 需选择
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row._status === 'not_found'" type="danger" size="mini" effect="plain">未找到</el-tag>
|
||||
<el-tag v-else type="info" size="mini" effect="plain">待处理</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="90" align="center" fixed="right" v-if="importStatus === 'matched'">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row._status === 'ambiguous'" type="warning" size="mini" plain @click="importOpenCandidateDialog(scope.$index)">选择钢卷</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -342,41 +300,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 未找到的提示 -->
|
||||
<div v-if="importErrorList.length > 0 && importStatus !== 'error'" class="result-panel result-error">
|
||||
<div class="result-icon"><i class="el-icon-warning-outline" /></div>
|
||||
<div class="result-body">
|
||||
<div class="result-title">{{ importErrorList.length }} 条记录未找到对应钢卷</div>
|
||||
<div class="result-desc">这些记录将在导入时被跳过,请检查钢卷号是否正确</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 钢卷选择对话框(多匹配时) -->
|
||||
<el-dialog title="选择钢卷" :visible.sync="candidateDialogVisible" width="700px" top="20vh" append-to-body>
|
||||
<div class="candidate-hint">
|
||||
<i class="el-icon-info" />
|
||||
当前钢卷号 <b>{{ candidateCoilNo }}</b> 匹配到多条记录,请选择一条:
|
||||
</div>
|
||||
<el-table ref="candidateTable" :data="candidateList" border height="300" highlight-current-row @row-click="importSelectCandidate">
|
||||
<el-table-column type="index" label="#" width="48" align="center" />
|
||||
<el-table-column prop="currentCoilNo" label="当前钢卷号" width="140" />
|
||||
<el-table-column prop="material" label="材质" width="100" />
|
||||
<el-table-column prop="specification" label="规格" width="120" />
|
||||
<el-table-column prop="netWeight" label="重量(t)" width="100" align="center" />
|
||||
<el-table-column prop="warehouseName" label="库区" />
|
||||
</el-table>
|
||||
<div class="candidate-footer">点击行即可选中</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as XLSX from 'xlsx';
|
||||
import { listPhysicalItem, getPhysicalItem, delPhysicalItem, addPhysicalItem, updatePhysicalItem, batchAddPhysicalItem } from "@/api/mes/qc/physicalItem";
|
||||
import { listMaterialCoil } from "@/api/wms/coil";
|
||||
import CoilSelector from "@/components/CoilSelector";
|
||||
|
||||
const PHYS_TEMPLATE_HEADERS = [
|
||||
@@ -385,7 +319,7 @@ const PHYS_TEMPLATE_HEADERS = [
|
||||
];
|
||||
|
||||
const PHYS_HEADER_MAP = {
|
||||
'当前钢卷号': 'currentCoilNo',
|
||||
'当前钢卷号': 'coilNo',
|
||||
'屈服强度(MPa)': 'yieldStrength',
|
||||
'抗拉强度(MPa)': 'tensileStrength',
|
||||
'伸长率(%)': 'elongation',
|
||||
@@ -401,11 +335,7 @@ export default {
|
||||
components: {
|
||||
CoilSelector
|
||||
},
|
||||
computed: {
|
||||
matchedCount() { return this.importTableData.filter(r => r._status === 'matched').length; },
|
||||
ambiguousCount() { return this.importTableData.filter(r => r._status === 'ambiguous').length; },
|
||||
notFoundCount() { return this.importTableData.filter(r => r._status === 'not_found').length; }
|
||||
},
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
@@ -447,7 +377,7 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
coilNo: [
|
||||
{ required: true, message: "钢卷号不能为空", trigger: "blur" }
|
||||
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
importDialogVisible: false,
|
||||
@@ -461,12 +391,7 @@ export default {
|
||||
importStatus: 'idle', // idle | validated | matched | processing | finished | error
|
||||
importErrorMsg: '',
|
||||
importValidateLoading: false,
|
||||
importMatchingLoading: false,
|
||||
importLoading: false,
|
||||
candidateDialogVisible: false,
|
||||
candidateRowIndex: -1,
|
||||
candidateCoilNo: '',
|
||||
candidateList: []
|
||||
importLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -492,7 +417,6 @@ export default {
|
||||
this.form = {
|
||||
physicalId: undefined,
|
||||
certificateId: undefined,
|
||||
coilId: undefined,
|
||||
coilNo: undefined,
|
||||
yieldStrength: undefined,
|
||||
tensileStrength: undefined,
|
||||
@@ -534,15 +458,13 @@ export default {
|
||||
this.title = "添加物理性能明细";
|
||||
},
|
||||
handleSelect(coil) {
|
||||
this.form.coilId = coil.coilId;
|
||||
this.form.coilNo = coil.currentCoilNo;
|
||||
this.form.coilNo = coil.enterCoilNo;
|
||||
},
|
||||
handleBatchAdd(rows) {
|
||||
this.loading = true;
|
||||
this.buttonLoading = true;
|
||||
const payload = rows.map(coil => ({
|
||||
coilId: coil.coilId,
|
||||
coilNo: coil.currentCoilNo,
|
||||
coilNo: coil.coilNo,
|
||||
}))
|
||||
batchAddPhysicalItem(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
@@ -556,7 +478,7 @@ export default {
|
||||
this.importDialogVisible = true;
|
||||
},
|
||||
importHandleFileChange(file) {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading) return;
|
||||
if (this.importValidateLoading || this.importLoading) return;
|
||||
this.importFile = file.raw;
|
||||
this.importErrorList = [];
|
||||
this.importStatus = 'idle';
|
||||
@@ -600,10 +522,6 @@ export default {
|
||||
PHYS_TEMPLATE_HEADERS.forEach((h, j) => { obj[PHYS_HEADER_MAP[h]] = row[j] != null ? String(row[j]).trim() : ''; });
|
||||
obj.rowNum = i + 2;
|
||||
obj._status = 'pending';
|
||||
obj._coilId = null;
|
||||
obj._coilNo = null;
|
||||
obj._candidates = [];
|
||||
obj._errorMsg = '';
|
||||
this.importTableData.push(obj);
|
||||
});
|
||||
},
|
||||
@@ -614,76 +532,22 @@ export default {
|
||||
for (let i = 0; i < this.importRawData.length; i++) {
|
||||
const rowNum = i + 2;
|
||||
let coilNo = '';
|
||||
PHYS_TEMPLATE_HEADERS.forEach((h, j) => { if (PHYS_HEADER_MAP[h] === 'currentCoilNo') coilNo = this.importRawData[i][j]; });
|
||||
PHYS_TEMPLATE_HEADERS.forEach((h, j) => { if (PHYS_HEADER_MAP[h] === 'coilNo') coilNo = this.importRawData[i][j]; });
|
||||
if (!coilNo || !String(coilNo).trim()) this.importErrorList.push({ rowNum, errorMsg: '当前钢卷号不能为空' });
|
||||
}
|
||||
if (this.importErrorList.length > 0) {
|
||||
this.$message.error(`数据校验失败,共发现${this.importErrorList.length}条错误`);
|
||||
} else {
|
||||
this.importTableData.forEach(row => { row._status = 'valid'; });
|
||||
this.$message.success('数据校验通过');
|
||||
this.importStatus = 'validated';
|
||||
}
|
||||
this.importValidateLoading = false;
|
||||
},
|
||||
async importMatchCoils() {
|
||||
this.importMatchingLoading = true;
|
||||
this.importErrorList = [];
|
||||
for (let i = 0; i < this.importTableData.length; i++) {
|
||||
const row = this.importTableData[i];
|
||||
const coilNo = row.currentCoilNo;
|
||||
if (!coilNo) { row._status = 'not_found'; row._errorMsg = '钢卷号为空'; continue; }
|
||||
try {
|
||||
const res = await listMaterialCoil({ currentCoilNo: coilNo, dataType: 1, pageSize: 999 });
|
||||
const coils = res.rows || [];
|
||||
if (coils.length === 0) {
|
||||
row._status = 'not_found';
|
||||
row._errorMsg = `未找到钢卷号"${coilNo}"`;
|
||||
} else if (coils.length === 1) {
|
||||
row._status = 'matched';
|
||||
row._coilId = coils[0].coilId;
|
||||
row._coilNo = coils[0].currentCoilNo;
|
||||
} else {
|
||||
row._status = 'ambiguous';
|
||||
row._candidates = coils;
|
||||
}
|
||||
} catch (err) {
|
||||
row._status = 'not_found';
|
||||
row._errorMsg = err.message;
|
||||
}
|
||||
}
|
||||
const notFound = this.importTableData.filter(r => r._status === 'not_found');
|
||||
if (notFound.length > 0) {
|
||||
this.importErrorList = notFound.map(r => ({ rowNum: r.rowNum, errorMsg: r._errorMsg }));
|
||||
this.$message.warning(`${notFound.length} 条记录未找到对应钢卷,已被剔除`);
|
||||
}
|
||||
this.importMatchingLoading = false;
|
||||
this.importStatus = 'matched';
|
||||
},
|
||||
importOpenCandidateDialog(index) {
|
||||
const row = this.importTableData[index];
|
||||
if (!row || row._status !== 'ambiguous') return;
|
||||
this.candidateRowIndex = index;
|
||||
this.candidateCoilNo = row.currentCoilNo;
|
||||
this.candidateList = row._candidates;
|
||||
this.candidateDialogVisible = true;
|
||||
},
|
||||
importSelectCandidate(coil) {
|
||||
if (this.candidateRowIndex < 0) return;
|
||||
const row = this.importTableData[this.candidateRowIndex];
|
||||
row._status = 'matched';
|
||||
row._coilId = coil.coilId;
|
||||
row._coilNo = coil.currentCoilNo;
|
||||
row._candidates = [];
|
||||
this.candidateDialogVisible = false;
|
||||
this.candidateRowIndex = -1;
|
||||
this.candidateList = [];
|
||||
this.$message.success(`已为第 ${row.rowNum} 行选择钢卷:${coil.currentCoilNo}`);
|
||||
},
|
||||
async importStartImport() {
|
||||
const rows = this.importTableData.filter(r => r._status === 'matched');
|
||||
const rows = this.importTableData.filter(r => r._status === 'valid');
|
||||
if (!rows.length) { this.$message.warning('没有可导入的数据'); return; }
|
||||
const skipped = this.importTableData.length - rows.length;
|
||||
const ok = await this.$confirm(`确认导入 ${rows.length} 条数据?${skipped ? `(${skipped} 条未匹配的记录将被跳过)` : ''}`, '导入确认', { confirmButtonText: '确认导入', cancelButtonText: '取消', type: 'warning' }).catch(() => false);
|
||||
const ok = await this.$confirm(`确认导入 ${rows.length} 条数据?`, '导入确认', { confirmButtonText: '确认导入', cancelButtonText: '取消', type: 'warning' }).catch(() => false);
|
||||
if (!ok) return;
|
||||
this.importLoading = true;
|
||||
this.importStatus = 'processing';
|
||||
@@ -692,7 +556,7 @@ export default {
|
||||
this.importErrorMsg = '';
|
||||
try {
|
||||
const payload = rows.map(row => {
|
||||
const item = { coilId: row._coilId, coilNo: row._coilNo };
|
||||
const item = { coilId: null, coilNo: row.coilNo };
|
||||
['yieldStrength','tensileStrength','elongation','hardness','bendingTest','surfaceQuality','surfaceStructure','edgeStatus'].forEach(f => { if (row[f]) item[f] = row[f]; });
|
||||
return item;
|
||||
});
|
||||
@@ -710,7 +574,7 @@ export default {
|
||||
}
|
||||
},
|
||||
importReset() {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading || this.importStatus === 'processing') { this.$message.warning('当前有操作正在进行中'); return; }
|
||||
if (this.importValidateLoading || this.importLoading || this.importStatus === 'processing') { this.$message.warning('当前有操作正在进行中'); return; }
|
||||
this.importFile = null;
|
||||
this.importRawData = [];
|
||||
this.importTableData = [];
|
||||
@@ -720,10 +584,6 @@ export default {
|
||||
this.importTotalCount = 0;
|
||||
this.importStatus = 'idle';
|
||||
this.importErrorMsg = '';
|
||||
this.candidateDialogVisible = false;
|
||||
this.candidateRowIndex = -1;
|
||||
this.candidateCoilNo = '';
|
||||
this.candidateList = [];
|
||||
this.$refs.importUpload?.clearFiles();
|
||||
},
|
||||
importDownloadTemplate() {
|
||||
@@ -739,13 +599,9 @@ export default {
|
||||
this.importStatus = 'error';
|
||||
this.importErrorMsg = msg;
|
||||
this.importValidateLoading = false;
|
||||
this.importMatchingLoading = false;
|
||||
this.importLoading = false;
|
||||
},
|
||||
importTableRowClassName({ row }) {
|
||||
if (row._status === 'ambiguous') return 'row-ambiguous';
|
||||
if (row._status === 'not_found') return 'row-notfound';
|
||||
if (row._status === 'matched') return 'row-matched';
|
||||
importTableRowClassName() {
|
||||
return '';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<el-table-column label="任务ID" align="center" prop="taskId" v-if="false" />
|
||||
<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="belongCompany" />
|
||||
<el-table-column label="方案名称" align="center" prop="schemeName" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="90">
|
||||
@@ -99,7 +100,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最终结果" align="center" prop="result" />
|
||||
<el-table-column label="关联钢卷" align="center" width="140">
|
||||
<!-- <el-table-column label="关联钢卷" align="center" width="140">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.coilList && scope.row.coilList.length > 0"
|
||||
style="display: flex; flex-wrap: wrap; gap: 4px;">
|
||||
@@ -109,7 +110,7 @@
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
||||
<template slot-scope="scope">
|
||||
@@ -244,6 +245,9 @@
|
||||
<el-form-item label="任务编号" prop="taskCode">
|
||||
<el-input v-model="taskForm.taskCode" placeholder="请输入任务编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入场卷号" prop="enterCoilNos">
|
||||
<el-input v-model="taskForm.enterCoilNos" placeholder="请输入入场卷号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型" prop="taskType">
|
||||
<el-select v-model="taskForm.taskType" placeholder="请选择任务类型" clearable filterable allow-create>
|
||||
<el-option label="内控检验" value="内控检验" />
|
||||
@@ -263,7 +267,8 @@
|
||||
<el-input v-model="taskForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="margin: 0 0 12px 80px;">
|
||||
|
||||
<!-- <div style="margin: 0 0 12px 80px;">
|
||||
<CoilSelector use-trigger multiple @confirm="handleTaskCoilConfirm">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="small">选择钢卷</el-button>
|
||||
</CoilSelector>
|
||||
@@ -279,7 +284,7 @@
|
||||
<CurrentCoilNo :currentCoilNo="coil.currentCoilNo || coil.coilNo || ''" />
|
||||
<el-button type="text" icon="el-icon-close" size="mini" @click="taskCoilList.splice(index, 1)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitTaskForm">确 定</el-button>
|
||||
<el-button @click="cancelTask">取 消</el-button>
|
||||
@@ -396,7 +401,13 @@ export default {
|
||||
result: undefined,
|
||||
},
|
||||
taskForm: {},
|
||||
taskRules: {},
|
||||
taskRules: {
|
||||
taskCode: [{ required: true, message: '请输入任务编号', trigger: 'blur' }],
|
||||
enterCoilNos: [{ required: true, message: '请输入入场卷号', trigger: 'blur' }],
|
||||
taskType: [{ required: true, message: '请选择任务类型', trigger: 'change' }],
|
||||
belongCompany: [{ required: true, message: '请输入所属公司', trigger: 'blur' }],
|
||||
schemeName: [{ required: true, message: '请输入检验方案名称', trigger: 'blur' }],
|
||||
},
|
||||
|
||||
itemLoading: false,
|
||||
itemIds: [],
|
||||
@@ -566,7 +577,7 @@ export default {
|
||||
handleQuickCreate() {
|
||||
this.schemeVisible = true;
|
||||
},
|
||||
handleSchemeConfirm({ template, taskCode, taskType, belongCompany, coilIds }) {
|
||||
handleSchemeConfirm({ template, taskCode, taskType, belongCompany, coilIds, enterCoilNos }) {
|
||||
this.taskLoading = true;
|
||||
addInspectionTaskWithItems({
|
||||
taskCode: taskCode,
|
||||
@@ -574,7 +585,8 @@ export default {
|
||||
schemeName: template.templateName,
|
||||
belongCompany: belongCompany,
|
||||
taskType: taskType,
|
||||
coilIds: coilIds
|
||||
coilIds: coilIds || undefined,
|
||||
enterCoilNos: enterCoilNos || undefined
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("快捷创建成功");
|
||||
this.getTaskList();
|
||||
|
||||
@@ -1343,7 +1343,7 @@ export default {
|
||||
async getInspectionTasks() {
|
||||
this.inspectionLoading = true;
|
||||
try {
|
||||
const res = await listInspectionTask({ coilIds: this.coilId, pageNum: 1, pageSize: 100 });
|
||||
const res = await listInspectionTask({ enterCoilNos: this.coilInfo.enterCoilNo, pageNum: 1, pageSize: 100 });
|
||||
this.inspectionTaskList = res.rows || [];
|
||||
} catch (e) {
|
||||
console.error('获取检验任务异常:', e);
|
||||
|
||||
Reference in New Issue
Block a user