Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
53
klp-ui/src/api/mes/qc/chemicalItem.js
Normal file
53
klp-ui/src/api/mes/qc/chemicalItem.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询质量的化学成分明细列表
|
||||
export function listChemicalItem(query) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询质量的化学成分明细详细
|
||||
export function getChemicalItem(itemId) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem/' + itemId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增质量的化学成分明细
|
||||
export function addChemicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改质量的化学成分明细
|
||||
export function updateChemicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除质量的化学成分明细
|
||||
export function delChemicalItem(itemId) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem/' + itemId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 批量新增质量的化学成分明细
|
||||
export function batchAddChemicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/chemicalItem/batchImport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
53
klp-ui/src/api/mes/qc/physicalItem.js
Normal file
53
klp-ui/src/api/mes/qc/physicalItem.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物理性能明细列表
|
||||
export function listPhysicalItem(query) {
|
||||
return request({
|
||||
url: '/qc/physicalItem/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物理性能明细详细
|
||||
export function getPhysicalItem(physicalId) {
|
||||
return request({
|
||||
url: '/qc/physicalItem/' + physicalId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物理性能明细
|
||||
export function addPhysicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/physicalItem',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物理性能明细
|
||||
export function updatePhysicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/physicalItem',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物理性能明细
|
||||
export function delPhysicalItem(physicalId) {
|
||||
return request({
|
||||
url: '/qc/physicalItem/' + physicalId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 批量新增物理性能明细
|
||||
export function batchAddPhysicalItem(data) {
|
||||
return request({
|
||||
url: '/qc/physicalItem/batchImport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -49,6 +49,14 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批状态" prop="approveStatus">
|
||||
<el-select v-model="queryParams.approveStatus" placeholder="请选择审批状态" clearable>
|
||||
<el-option label="待审批" value="PENDING" />
|
||||
<el-option label="审批中" value="APPROVING" />
|
||||
<el-option label="已通过" value="PASSED" />
|
||||
<el-option label="已驳回" value="REJECTED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@@ -88,65 +96,58 @@
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<div v-loading="loading" class="certificate-list">
|
||||
<div
|
||||
v-for="item in certificateList"
|
||||
:key="item.certificateId"
|
||||
class="certificate-card"
|
||||
:class="{ 'certificate-card-selected': selectedIds.includes(item.certificateId) }"
|
||||
@click="handleCardClick(item)"
|
||||
>
|
||||
<div class="card-top-bar"></div>
|
||||
|
||||
<div class="card-title-row">
|
||||
<span class="card-doc-type">质量保证书</span>
|
||||
<span class="card-sep">|</span>
|
||||
<span class="card-env">MES-QC-{{ item.certificateNo || '' }}</span>
|
||||
</div>
|
||||
|
||||
<div class="card-cert-no">
|
||||
<span class="card-cert-no-label">No.</span>
|
||||
<span class="card-cert-no-value">{{ item.certificateNo }}</span>
|
||||
</div>
|
||||
|
||||
<div class="card-info-grid">
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">合同号</span>
|
||||
<span class="card-info-value">{{ item.contractNo || '-' }}</span>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="certificateList"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
class="certificate-table"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="证明书号" align="center" prop="certificateNo">
|
||||
<template #default="scope">
|
||||
<span class="cert-no">{{ scope.row.certificateNo || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同号" align="center" prop="contractNo" />
|
||||
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||
<el-table-column label="执行标准" align="center" prop="standard" />
|
||||
<el-table-column label="收货单位" align="center" prop="consignee" />
|
||||
<el-table-column label="生产厂家" align="center" prop="manufacturer" />
|
||||
<el-table-column label="签发日期" align="center" prop="issueDate">
|
||||
<template #default="scope">
|
||||
{{ parseTime(scope.row.issueDate, '{y}-{m}-{d}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="签发状态" align="center" prop="approveStatus" width="180">
|
||||
<template #default="scope">
|
||||
<el-tag :type="getStatusType(scope.row.approveStatus)" size="small">
|
||||
{{ getStatusText(scope.row.approveStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批信息" align="center" width="220">
|
||||
<template #default="scope">
|
||||
<div v-if="(scope.row.approveStatus || 'PENDING') === 'PASSED' || (scope.row.approveStatus || 'PENDING') === 'REJECTED'">
|
||||
<div>审批人: {{ scope.row.approveBy || '-' }}</div>
|
||||
<div>审批时间: {{ parseTime(scope.row.approveTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</div>
|
||||
</div>
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">产品名称</span>
|
||||
<span class="card-info-value">{{ item.productName || '-' }}</span>
|
||||
</div>
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">执行标准</span>
|
||||
<span class="card-info-value">{{ item.standard || '-' }}</span>
|
||||
</div>
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">收货单位</span>
|
||||
<span class="card-info-value">{{ item.consignee || '-' }}</span>
|
||||
</div>
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">生产厂家</span>
|
||||
<span class="card-info-value">{{ item.manufacturer || '-' }}</span>
|
||||
</div>
|
||||
<div class="card-info-item">
|
||||
<span class="card-info-label">签发日期</span>
|
||||
<span class="card-info-value">{{ parseTime(item.issueDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="card-stamp-placeholder">质检专用</div>
|
||||
<div class="card-actions">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(item)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(item)">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click.stop="handlePreview(item)">预览</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-printer" @click.stop="handlePrint(item)">打印</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" width="220">
|
||||
<template #default="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" :disabled="(scope.row.approveStatus || 'PENDING') === 'APPROVING' || (scope.row.approveStatus || 'PENDING') === 'PASSED'">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handlePreview(scope.row)">预览</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-printer" @click="handlePrint(scope.row)">打印</el-button>
|
||||
<el-button v-if="(scope.row.approveStatus || 'PENDING') === 'PENDING' || (scope.row.approveStatus || 'PENDING') === 'REJECTED'" size="mini" type="text" icon="el-icon-upload" @click="handleSubmit(scope.row)">提交审批</el-button>
|
||||
<el-button v-hasPermi="['qc:certificate:approve']" v-if="(scope.row.approveStatus || 'PENDING') === 'APPROVING'" size="mini" type="text" icon="el-icon-check" @click="handleApprove(scope.row, 'PASSED')">通过</el-button>
|
||||
<el-button v-hasPermi="['qc:certificate:approve']" v-if="(scope.row.approveStatus || 'PENDING') === 'APPROVING'" size="mini" type="text" icon="el-icon-close" @click="handleApprove(scope.row, 'REJECTED')">驳回</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
@@ -269,6 +270,18 @@ export default {
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
},
|
||||
statusMap: {
|
||||
'PENDING': '待提交',
|
||||
'APPROVING': '审批中',
|
||||
'PASSED': '已通过',
|
||||
'REJECTED': '已驳回'
|
||||
},
|
||||
statusTypeMap: {
|
||||
'PENDING': 'info',
|
||||
'APPROVING': 'warning',
|
||||
'PASSED': 'success',
|
||||
'REJECTED': 'danger'
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -276,6 +289,17 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getStatusText(status) {
|
||||
const actualStatus = status || 'PENDING';
|
||||
return this.statusMap[actualStatus] || '未知';
|
||||
},
|
||||
getStatusType(status) {
|
||||
const actualStatus = status || 'PENDING';
|
||||
return this.statusTypeMap[actualStatus] || 'info';
|
||||
},
|
||||
getActualStatus(status) {
|
||||
return status || 'PENDING';
|
||||
},
|
||||
/** 查询质量证明书主列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
@@ -321,29 +345,8 @@ export default {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
handleCardClick(item) {
|
||||
const index = this.selectedIds.indexOf(item.certificateId);
|
||||
if (index > -1) {
|
||||
this.selectedIds.splice(index, 1);
|
||||
} else {
|
||||
this.selectedIds.push(item.certificateId);
|
||||
}
|
||||
this.updateSelectionStatus();
|
||||
},
|
||||
handleCheckboxChange(certificateId, event) {
|
||||
if (event.target.checked) {
|
||||
if (!this.selectedIds.includes(certificateId)) {
|
||||
this.selectedIds.push(certificateId);
|
||||
}
|
||||
} else {
|
||||
const index = this.selectedIds.indexOf(certificateId);
|
||||
if (index > -1) {
|
||||
this.selectedIds.splice(index, 1);
|
||||
}
|
||||
}
|
||||
this.updateSelectionStatus();
|
||||
},
|
||||
updateSelectionStatus() {
|
||||
handleSelectionChange(val) {
|
||||
this.selectedIds = val.map(item => item.certificateId);
|
||||
this.ids = [...this.selectedIds];
|
||||
this.single = this.selectedIds.length !== 1;
|
||||
this.multiple = this.selectedIds.length === 0;
|
||||
@@ -380,7 +383,8 @@ export default {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCertificate(this.form).then(response => {
|
||||
const newForm = { ...this.form, approveStatus: 'PENDING' };
|
||||
addCertificate(newForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -391,6 +395,43 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 提交审批 */
|
||||
handleSubmit(row) {
|
||||
this.$modal.confirm('确认提交审批?').then(() => {
|
||||
this.loading = true;
|
||||
const params = {
|
||||
certificateId: row.certificateId,
|
||||
approveStatus: 'APPROVING'
|
||||
};
|
||||
updateCertificate(params).then(response => {
|
||||
this.$modal.msgSuccess("提交成功");
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 审批操作 */
|
||||
handleApprove(row, status) {
|
||||
const statusText = status === 'PASSED' ? '通过' : '驳回';
|
||||
this.$modal.confirm(`确认${statusText}该审批?`).then(() => {
|
||||
this.loading = true;
|
||||
const params = {
|
||||
certificateId: row.certificateId,
|
||||
approveStatus: status,
|
||||
approveBy: this.$store.getters.name,
|
||||
approveTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
};
|
||||
updateCertificate(params).then(response => {
|
||||
this.$modal.msgSuccess(`${statusText}成功`);
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const certificateIds = row.certificateId || this.ids;
|
||||
@@ -482,176 +523,19 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.certificate-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
|
||||
gap: 18px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.preview-content-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.certificate-card {
|
||||
background: #fcf9f2;
|
||||
border: 1px solid #d6cfc0;
|
||||
border-radius: 2px;
|
||||
padding: 18px 20px 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
box-shadow:
|
||||
0 1px 3px rgba(0, 0, 0, 0.06),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
||||
.certificate-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-top-bar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
background: linear-gradient(90deg, #3a3a3a 0%, #7a7a7a 50%, #3a3a3a 100%);
|
||||
}
|
||||
|
||||
.certificate-card:hover {
|
||||
border-color: #b8ad98;
|
||||
box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.certificate-card-selected {
|
||||
border-color: #7a6f5e;
|
||||
border-width: 2px;
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.card-checkbox {
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
right: 14px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.card-doc-type {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #2a2a2a;
|
||||
letter-spacing: 2px;
|
||||
font-family: "SimSun", "Songti SC", "Noto Serif SC", serif;
|
||||
}
|
||||
|
||||
.card-sep {
|
||||
color: #c0b8a8;
|
||||
font-size: 14px;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
.card-env {
|
||||
font-size: 10px;
|
||||
color: #9a9080;
|
||||
letter-spacing: 0.5px;
|
||||
.cert-no {
|
||||
font-family: "Courier New", monospace;
|
||||
}
|
||||
|
||||
.card-cert-no {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
margin-bottom: 14px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #ddd6c8;
|
||||
}
|
||||
|
||||
.card-cert-no-label {
|
||||
font-size: 11px;
|
||||
color: #8a8070;
|
||||
font-style: italic;
|
||||
font-family: "Times New Roman", serif;
|
||||
}
|
||||
|
||||
.card-cert-no-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1a1a1a;
|
||||
letter-spacing: 1px;
|
||||
font-family: "Courier New", "Times New Roman", monospace;
|
||||
}
|
||||
|
||||
.card-info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 2px 16px;
|
||||
}
|
||||
|
||||
.card-info-item {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px dotted #e6dfd0;
|
||||
}
|
||||
|
||||
.card-info-item:nth-last-child(-n+2) {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.card-info-label {
|
||||
font-size: 11px;
|
||||
color: #8a8270;
|
||||
min-width: 58px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.card-info-value {
|
||||
font-size: 13px;
|
||||
color: #222;
|
||||
color: #1f79b9;
|
||||
font-weight: 500;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 12px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #ddd6c8;
|
||||
}
|
||||
|
||||
.card-stamp-placeholder {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1.5px solid #9a8a7a;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #9a8a7a;
|
||||
font-size: 9px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.2;
|
||||
font-family: "SimSun", serif;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.card-actions .el-button {
|
||||
padding: 3px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
977
klp-ui/src/views/mes/qc/certificate/chemistry.vue
Normal file
977
klp-ui/src/views/mes/qc/certificate/chemistry.vue
Normal file
@@ -0,0 +1,977 @@
|
||||
<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-input
|
||||
v-model="queryParams.coilNo"
|
||||
placeholder="请输入钢卷号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="炉号" prop="heatNo">
|
||||
<el-input
|
||||
v-model="queryParams.heatNo"
|
||||
placeholder="请输入炉号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<coil-selector :use-trigger="true" multiple @confirm="handleBatchAdd"
|
||||
:filters="{ selectType: 'product', status: 0 }">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini">批量新增</el-button>
|
||||
</coil-selector>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="openImportDialog"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<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="heatNo" />
|
||||
<el-table-column label="碳(%)" align="center" prop="c" />
|
||||
<el-table-column label="硅(%)" align="center" prop="si" />
|
||||
<el-table-column label="锰(%)" align="center" prop="mn" />
|
||||
<el-table-column label="磷(%)" align="center" prop="p" />
|
||||
<el-table-column label="硫(%)" align="center" prop="s" />
|
||||
<el-table-column label="酸溶铝(%)" align="center" prop="als" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改质量的化学成分明细对话框 -->
|
||||
<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>
|
||||
<el-form-item label="炉号" prop="heatNo">
|
||||
<el-input v-model="form.heatNo" placeholder="请输入炉号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="碳(%)" prop="c">
|
||||
<el-input v-model="form.c" placeholder="请输入碳(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="硅(%)" prop="si">
|
||||
<el-input v-model="form.si" placeholder="请输入硅(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="锰(%)" prop="mn">
|
||||
<el-input v-model="form.mn" placeholder="请输入锰(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="磷(%)" prop="p">
|
||||
<el-input v-model="form.p" placeholder="请输入磷(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="硫(%)" prop="s">
|
||||
<el-input v-model="form.s" placeholder="请输入硫(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="酸溶铝(%)" prop="als">
|
||||
<el-input v-model="form.als" placeholder="请输入酸溶铝(%)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<el-dialog title="导入化学成分" :visible.sync="importDialogVisible" width="1100px" top="5vh" append-to-body>
|
||||
<div class="import-container">
|
||||
|
||||
<!-- 步骤条 -->
|
||||
<div class="import-steps">
|
||||
<div class="step" :class="{ active: true, done: importStatus !== 'idle' && importStatus !== 'validated' }">
|
||||
<div class="step-badge">1</div>
|
||||
<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-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-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-label">批量导入</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<div class="import-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-upload ref="importUpload" action="" :auto-upload="false" :show-file-list="false"
|
||||
:on-change="importHandleFileChange" accept=".xlsx,.xls"
|
||||
:disabled="importStatus !== 'idle' && importStatus !== 'validated'">
|
||||
<el-button :type="importFile ? 'default' : 'primary'" :icon="importFile ? 'el-icon-document' : 'el-icon-upload2'">
|
||||
{{ importFile ? importFile.name : '选择Excel文件' }}
|
||||
</el-button>
|
||||
</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 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="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>
|
||||
|
||||
<!-- 导入进度 -->
|
||||
<div v-if="importStatus === 'processing'" class="import-progress">
|
||||
<div class="progress-header">
|
||||
<i class="el-icon-loading" />
|
||||
<span>正在批量导入数据,请稍候...</span>
|
||||
</div>
|
||||
<el-progress :percentage="importProgress" :stroke-width="8" />
|
||||
</div>
|
||||
|
||||
<!-- 完成提示 -->
|
||||
<div v-if="importStatus === 'finished'" class="result-panel result-success">
|
||||
<div class="result-icon"><i class="el-icon-circle-check" /></div>
|
||||
<div class="result-body">
|
||||
<div class="result-title">导入完成</div>
|
||||
<div class="result-desc">共成功导入 <b>{{ importImportedCount }}</b> 条化学成分数据</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<div v-if="importStatus === 'error'" class="result-panel result-error">
|
||||
<div class="result-icon"><i class="el-icon-circle-close" /></div>
|
||||
<div class="result-body">
|
||||
<div class="result-title">导入失败</div>
|
||||
<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_HEADER_MAP = {
|
||||
'当前钢卷号': 'currentCoilNo',
|
||||
'C(%)': 'c',
|
||||
'Si(%)': 'si',
|
||||
'Mn(%)': 'mn',
|
||||
'P(%)': 'p',
|
||||
'S(%)': 's',
|
||||
'Als(%)': 'als'
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "ChemicalItem",
|
||||
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; }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 质量的化学成分明细表格数据
|
||||
chemicalItemList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
coilNo: undefined,
|
||||
heatNo: undefined,
|
||||
c: undefined,
|
||||
si: undefined,
|
||||
mn: undefined,
|
||||
p: undefined,
|
||||
s: undefined,
|
||||
als: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
coilNo: [
|
||||
{ required: true, message: "钢卷号不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
importDialogVisible: false,
|
||||
importFile: null,
|
||||
importRawData: [],
|
||||
importTableData: [],
|
||||
importErrorList: [],
|
||||
importProgress: 0,
|
||||
importImportedCount: 0,
|
||||
importTotalCount: 0,
|
||||
importStatus: 'idle', // idle | validated | matched | processing | finished | error
|
||||
importErrorMsg: '',
|
||||
importValidateLoading: false,
|
||||
importMatchingLoading: false,
|
||||
importLoading: false,
|
||||
candidateDialogVisible: false,
|
||||
candidateRowIndex: -1,
|
||||
candidateCoilNo: '',
|
||||
candidateList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询质量的化学成分明细列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listChemicalItem(this.queryParams).then(response => {
|
||||
this.chemicalItemList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
itemId: undefined,
|
||||
certificateId: undefined,
|
||||
coilId: undefined,
|
||||
coilNo: undefined,
|
||||
heatNo: undefined,
|
||||
c: undefined,
|
||||
si: undefined,
|
||||
mn: undefined,
|
||||
p: undefined,
|
||||
s: undefined,
|
||||
als: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.itemId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加质量的化学成分明细";
|
||||
},
|
||||
handleSelect(coil) {
|
||||
this.form.coilId = coil.coilId;
|
||||
this.form.coilNo = coil.currentCoilNo;
|
||||
},
|
||||
handleBatchAdd(rows) {
|
||||
this.loading = true;
|
||||
this.buttonLoading = true;
|
||||
const payload = rows.map(coil => ({
|
||||
coilId: coil.coilId,
|
||||
coilNo: coil.currentCoilNo,
|
||||
}))
|
||||
batchAddChemicalItem(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
openImportDialog() {
|
||||
this.importDialogVisible = true;
|
||||
},
|
||||
importHandleFileChange(file) {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading) return;
|
||||
this.importFile = file.raw;
|
||||
this.importErrorList = [];
|
||||
this.importStatus = 'idle';
|
||||
this.importReadExcel();
|
||||
},
|
||||
async importReadExcel() {
|
||||
if (!this.importFile) return;
|
||||
try {
|
||||
const reader = new FileReader();
|
||||
reader.readAsArrayBuffer(this.importFile);
|
||||
reader.onload = async (e) => {
|
||||
try {
|
||||
const data = new Uint8Array(e.target.result);
|
||||
const wb = XLSX.read(data, { type: 'array' });
|
||||
const ws = wb.Sheets[wb.SheetNames[0]];
|
||||
const json = XLSX.utils.sheet_to_json(ws, { header: 1 });
|
||||
this.importValidateHeaders(json[0]);
|
||||
this.importRawData = json.slice(1).filter(r => r.some(c => c != null && c !== ''));
|
||||
this.importFormatExcel();
|
||||
this.$message.success(`成功解析Excel,共读取到 ${this.importRawData.length} 条数据`);
|
||||
} catch (err) { this.importHandleError('解析Excel失败:' + err.message); }
|
||||
};
|
||||
} catch (err) { this.importHandleError('读取文件失败:' + err.message); }
|
||||
},
|
||||
importValidateHeaders(headers) {
|
||||
this.importErrorList = [];
|
||||
if (!headers || headers.length < CHEMI_TEMPLATE_HEADERS.length) {
|
||||
this.importErrorList.push({ rowNum: 1, errorMsg: `表头数量不匹配,要求至少${CHEMI_TEMPLATE_HEADERS.length}列` });
|
||||
return;
|
||||
}
|
||||
CHEMI_TEMPLATE_HEADERS.forEach((h, i) => {
|
||||
if (headers[i] !== h) this.importErrorList.push({ rowNum: 1, errorMsg: `第${i+1}列表头错误,要求:"${h}",实际:"${headers[i]||''}"` });
|
||||
});
|
||||
if (this.importErrorList.length > 0) this.$message.error('Excel表头格式不符合要求,请检查!');
|
||||
},
|
||||
importFormatExcel() {
|
||||
this.importTableData = [];
|
||||
if (!this.importRawData.length) return;
|
||||
this.importRawData.forEach((row, i) => {
|
||||
const obj = {};
|
||||
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);
|
||||
});
|
||||
},
|
||||
async importHandleValidate() {
|
||||
if (!this.importFile || !this.importRawData.length) { this.$message.warning('暂无数据可校验'); return; }
|
||||
this.importValidateLoading = true;
|
||||
this.importErrorList = [];
|
||||
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]; });
|
||||
if (!coilNo || !String(coilNo).trim()) this.importErrorList.push({ rowNum, errorMsg: '当前钢卷号不能为空' });
|
||||
}
|
||||
if (this.importErrorList.length > 0) {
|
||||
this.$message.error(`数据校验失败,共发现${this.importErrorList.length}条错误`);
|
||||
} else {
|
||||
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');
|
||||
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);
|
||||
if (!ok) return;
|
||||
this.importLoading = true;
|
||||
this.importStatus = 'processing';
|
||||
this.importProgress = 0;
|
||||
this.importTotalCount = rows.length;
|
||||
this.importErrorMsg = '';
|
||||
try {
|
||||
const payload = rows.map(row => {
|
||||
const item = { coilId: row._coilId, coilNo: row._coilNo };
|
||||
['c','si','mn','p','s','als'].forEach(f => { if (row[f]) item[f] = row[f]; });
|
||||
return item;
|
||||
});
|
||||
const addRes = await batchAddChemicalItem(payload);
|
||||
if (addRes.code !== 200) throw new Error(addRes.msg || '批量导入失败');
|
||||
this.importStatus = 'finished';
|
||||
this.importImportedCount = payload.length;
|
||||
this.importProgress = 100;
|
||||
this.$message.success(`导入完成!共成功导入${payload.length}条数据`);
|
||||
this.getList();
|
||||
} catch (err) {
|
||||
this.importHandleError(err.message);
|
||||
} finally {
|
||||
this.importLoading = false;
|
||||
}
|
||||
},
|
||||
importReset() {
|
||||
if (this.importValidateLoading || this.importMatchingLoading || this.importLoading || this.importStatus === 'processing') { this.$message.warning('当前有操作正在进行中'); return; }
|
||||
this.importFile = null;
|
||||
this.importRawData = [];
|
||||
this.importTableData = [];
|
||||
this.importErrorList = [];
|
||||
this.importProgress = 0;
|
||||
this.importImportedCount = 0;
|
||||
this.importTotalCount = 0;
|
||||
this.importStatus = 'idle';
|
||||
this.importErrorMsg = '';
|
||||
this.candidateDialogVisible = false;
|
||||
this.candidateRowIndex = -1;
|
||||
this.candidateCoilNo = '';
|
||||
this.candidateList = [];
|
||||
this.$refs.importUpload?.clearFiles();
|
||||
},
|
||||
importDownloadTemplate() {
|
||||
const data = [CHEMI_TEMPLATE_HEADERS, ['示例卷号', '0.05', '0.02', '0.30', '0.015', '0.008', '0.040']];
|
||||
const wb = XLSX.utils.book_new();
|
||||
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||
ws['!cols'] = [{ wch: 16 }, { wch: 8 }, { wch: 8 }, { wch: 8 }, { wch: 8 }, { wch: 8 }, { wch: 8 }];
|
||||
XLSX.utils.book_append_sheet(wb, ws, '导入模板');
|
||||
XLSX.writeFile(wb, '化学成分导入模板.xlsx');
|
||||
},
|
||||
importHandleError(msg) {
|
||||
this.$message.error(msg);
|
||||
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';
|
||||
return '';
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const itemId = row.itemId || this.ids
|
||||
getChemicalItem(itemId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改质量的化学成分明细";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.itemId != null) {
|
||||
updateChemicalItem(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addChemicalItem(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const itemIds = row.itemId || this.ids;
|
||||
this.$modal.confirm('是否确认删除质量的化学成分明细编号为"' + itemIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delChemicalItem(itemIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('qc/chemicalItem/export', {
|
||||
...this.queryParams
|
||||
}, `chemicalItem_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.import-container {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.import-steps {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 24px;
|
||||
padding: 20px 0 16px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.step {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
opacity: 0.45;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.step.active { opacity: 1; }
|
||||
.step.done { opacity: 0.65; }
|
||||
|
||||
.step-badge {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
background: #dcdfe6;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.step.active .step-badge {
|
||||
background: #409eff;
|
||||
box-shadow: 0 2px 8px rgba(64,158,255,0.35);
|
||||
}
|
||||
|
||||
.step.done .step-badge {
|
||||
background: #67c23a;
|
||||
}
|
||||
|
||||
.step-badge-warn { background: #e6a23c !important; }
|
||||
.step.active .step-badge-warn { background: #e6a23c !important; box-shadow: 0 2px 8px rgba(230,162,60,0.35) !important; }
|
||||
.step-badge-success { background: #67c23a !important; }
|
||||
.step.active .step-badge-success { background: #67c23a !important; box-shadow: 0 2px 8px rgba(103,194,58,0.35) !important; }
|
||||
|
||||
.step-label {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.step.active .step-label { color: #303133; font-weight: 600; }
|
||||
|
||||
.step-connector {
|
||||
width: 48px;
|
||||
height: 2px;
|
||||
background: #dcdfe6;
|
||||
margin: 0 4px;
|
||||
margin-bottom: 24px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.step-connector.done { background: #67c23a; }
|
||||
|
||||
.import-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 16px;
|
||||
padding: 12px 16px;
|
||||
background: #fafafa;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.toolbar-left, .toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.match-summary {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 14px 8px;
|
||||
border-radius: 8px;
|
||||
background: #fafafa;
|
||||
border: 1px solid #eee;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.summary-matched { border-color: #b7eb8f; background: #f6ffed; }
|
||||
.summary-ambiguous { border-color: #ffe58f; background: #fffbe6; }
|
||||
.summary-notfound { border-color: #ffa39e; background: #fff2f0; }
|
||||
.summary-total { border-color: #d9d9d9; background: #fafafa; }
|
||||
|
||||
.summary-num {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.summary-matched .summary-num { color: #52c41a; }
|
||||
.summary-ambiguous .summary-num { color: #faad14; }
|
||||
.summary-notfound .summary-num { color: #ff4d4f; }
|
||||
.summary-total .summary-num { color: #409eff; }
|
||||
|
||||
.summary-label {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.data-preview {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
::v-deep .tag-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::v-deep .tag-clickable:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.import-progress {
|
||||
padding: 24px;
|
||||
background: #f6ffed;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #b7eb8f;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.progress-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
color: #52c41a;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.result-panel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px 24px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.result-success {
|
||||
background: #f6ffed;
|
||||
border: 1px solid #b7eb8f;
|
||||
}
|
||||
|
||||
.result-error {
|
||||
background: #fff2f0;
|
||||
border: 1px solid #ffa39e;
|
||||
}
|
||||
|
||||
.result-icon {
|
||||
font-size: 36px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.result-success .result-icon { color: #52c41a; }
|
||||
.result-error .result-icon { color: #ff4d4f; }
|
||||
|
||||
.result-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.result-success .result-title { color: #389e0d; }
|
||||
.result-error .result-title { color: #cf1322; }
|
||||
|
||||
.result-desc {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.candidate-hint {
|
||||
margin-bottom: 12px;
|
||||
padding: 10px 14px;
|
||||
background: #fffbe6;
|
||||
border: 1px solid #ffe58f;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
color: #ad6800;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.candidate-footer {
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
@@ -111,10 +111,10 @@
|
||||
<td class="footer-content footer-remark-cell">
|
||||
<pre class="remark-text">{{ certificate.remark || '/' }}</pre>
|
||||
<div class="signature-area">
|
||||
<img src="@/assets/images/zhijian.png" class="stamp-image" alt="质检专用章" />
|
||||
<img v-if="certificate.approveStatus === 'PASSED'" src="@/assets/images/zhijian.png" class="stamp-image" alt="质检专用章" />
|
||||
<div class="signature-block">
|
||||
<div class="signature-label">质量负责人:</div>
|
||||
<img src="@/assets/images/yanghongyan.png" class="signature-image" alt="签名" />
|
||||
<img v-if="certificate.approveStatus === 'PASSED'" src="@/assets/images/yanghongyan.png" class="signature-image" alt="签名" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
<div class="tab-info">请点击齿轮图标选择质保书</div>
|
||||
</div>
|
||||
</div>
|
||||
<button v-if="certificateList.length > 0 && queryParams.pageNum < totalPage" class="nav-btn next" @click="nextPage">
|
||||
<button v-if="certificateList.length > 0 && queryParams.pageNum < totalPage" class="nav-btn next"
|
||||
@click="nextPage">
|
||||
<i class="el-icon-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -62,7 +63,8 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="签发日期">
|
||||
<el-date-picker v-model="currentCertificateInfo.issueDate" type="date" @change="handleCertificateInfoChange" />
|
||||
<el-date-picker v-model="currentCertificateInfo.issueDate" type="date"
|
||||
@change="handleCertificateInfoChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -216,9 +218,14 @@
|
||||
|
||||
<el-dialog :title="'选择钢卷'" :visible.sync="coilDialogVisible" width="900px" append-to-body>
|
||||
<div class="dialog-toolbar">
|
||||
|
||||
<el-form :model="coilQueryParams" ref="coilQueryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-form-item label="钢卷号" prop="coilNo">
|
||||
<el-input v-model="coilQueryParams.coilNo" placeholder="请输入钢卷号" clearable
|
||||
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||
<el-input v-model="coilQueryParams.enterCoilNo" placeholder="请输入入场钢卷号" clearable
|
||||
@keyup.enter.native="handleCoilQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||
<el-input v-model="coilQueryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleCoilQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="材质" prop="material">
|
||||
@@ -236,18 +243,20 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table v-loading="coilLoading" :data="coilList" height="350px" @row-click="handleCoilSelect">
|
||||
<el-table-column label="钢卷号" align="center" prop="currentCoilNo" />
|
||||
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" />
|
||||
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo" />
|
||||
<el-table-column label="材质" align="center" prop="material" />
|
||||
<el-table-column label="规格" align="center" prop="specification" />
|
||||
<el-table-column label="重量(t)" align="center" prop="netWeight" />
|
||||
</el-table>
|
||||
<pagination v-show="coilTotal > 0" :total="coilTotal" :page.sync="coilQueryParams.pageNum"
|
||||
<pagination v-show="coilTotal > 0" :total="coilTotal" :page.sync="coilQueryParams.pageNum"
|
||||
:limit.sync="coilQueryParams.pageSize" @pagination="getCoilList" />
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="'选择质保书'" :visible.sync="certificateDialogVisible" width="900px" append-to-body>
|
||||
<div class="dialog-toolbar">
|
||||
<el-form :model="certificateQueryParams" ref="certificateQueryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-form :model="certificateQueryParams" ref="certificateQueryForm" size="small" :inline="true"
|
||||
label-width="68px">
|
||||
<el-form-item label="证明书号" prop="certificateNo">
|
||||
<el-input v-model="certificateQueryParams.certificateNo" placeholder="请输入证明书号" clearable
|
||||
@keyup.enter.native="handleCertificateQuery" />
|
||||
@@ -278,9 +287,9 @@
|
||||
<span>{{ parseTime(scope.row.issueDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
|
||||
</el-table>
|
||||
<pagination v-show="certificateTotal > 0" :total="certificateTotal" :page.sync="certificateQueryParams.pageNum"
|
||||
<pagination v-show="certificateTotal > 0" :total="certificateTotal" :page.sync="certificateQueryParams.pageNum"
|
||||
:limit.sync="certificateQueryParams.pageSize" @pagination="getCertificateList" />
|
||||
</el-dialog>
|
||||
|
||||
@@ -305,7 +314,8 @@
|
||||
<el-input v-model="certificateForm.manufacturer" placeholder="请输入生产厂家" />
|
||||
</el-form-item>
|
||||
<el-form-item label="签发日期" prop="issueDate">
|
||||
<el-date-picker v-model="certificateForm.issueDate" value-format="yyyy-MM-dd HH:mm:ss" type="date" placeholder="请选择签发日期" />
|
||||
<el-date-picker v-model="certificateForm.issueDate" value-format="yyyy-MM-dd HH:mm:ss" type="date"
|
||||
placeholder="请选择签发日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="质保证明说明" prop="note">
|
||||
<el-input v-model="certificateForm.note" type="textarea" placeholder="请输入内容" auto-height />
|
||||
@@ -320,20 +330,12 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<CoilSelector
|
||||
:visible.sync="batchAddDialogVisible"
|
||||
:use-trigger="false"
|
||||
:multiple="true"
|
||||
@confirm="handleBatchAddConfirm"
|
||||
/>
|
||||
<CoilSelector :visible.sync="batchAddDialogVisible" :use-trigger="false" :multiple="true"
|
||||
@confirm="handleBatchAddConfirm" />
|
||||
|
||||
<!-- 隐藏的打印组件 -->
|
||||
<CertificatePrintPreview
|
||||
ref="certificatePrint"
|
||||
v-show="false"
|
||||
:certificate="printCertificateData"
|
||||
:items="printItemsData"
|
||||
/>
|
||||
<CertificatePrintPreview ref="certificatePrint" v-show="false" :certificate="printCertificateData"
|
||||
:items="printItemsData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -341,6 +343,8 @@
|
||||
import { listCertificateItem, getCertificateItem, delCertificateItem, addCertificateItem, updateCertificateItem } from "@/api/mes/qc/certificateItem";
|
||||
import { listCertificate, getCertificate, updateCertificate, addCertificate } from "@/api/mes/qc/certificate";
|
||||
import { listMaterialCoil } from "@/api/wms/coil";
|
||||
import { listChemicalItem } from "@/api/mes/qc/chemicalItem";
|
||||
import { listPhysicalItem } from "@/api/mes/qc/physicalItem";
|
||||
import CoilSelector from "@/components/CoilSelector/index.vue";
|
||||
import CertificatePrintPreview from "./components/CertificatePrintPreview.vue";
|
||||
import { print as printPdf } from "./lib/printUtils";
|
||||
@@ -515,13 +519,27 @@ export default {
|
||||
};
|
||||
this.getCoilList();
|
||||
},
|
||||
handleCoilSelect(row) {
|
||||
async fetchLatestChemAndPhys(coilId) {
|
||||
if (!coilId) return {};
|
||||
const [chemRes, physRes] = await Promise.all([
|
||||
listChemicalItem({ coilId, pageNum: 1, pageSize: 1 }),
|
||||
listPhysicalItem({ coilId, pageNum: 1, pageSize: 1 })
|
||||
]);
|
||||
const chem = chemRes.rows && chemRes.rows[0] || {};
|
||||
const phys = physRes.rows && physRes.rows[0] || {};
|
||||
const { c, si, mn, p, s, als, yieldStrength, tensileStrength, elongation, hardness, bendingTest, surfaceQuality, surfaceStructure, edgeStatus } = { ...chem, ...phys };
|
||||
return { c, si, mn, p, s, als, yieldStrength, tensileStrength, elongation, hardness, bendingTest, surfaceQuality, surfaceStructure, edgeStatus };
|
||||
},
|
||||
async handleCoilSelect(row) {
|
||||
if (this.currentEditRow) {
|
||||
this.currentEditRow.coilNo = row.currentCoilNo;
|
||||
this.currentEditRow.materialType = row.material;
|
||||
this.currentEditRow.size = row.specification;
|
||||
this.currentEditRow.weight = row.netWeight;
|
||||
this.currentEditRow.pieces = 1;
|
||||
const editRow = this.currentEditRow;
|
||||
editRow.coilNo = row.currentCoilNo;
|
||||
editRow.materialType = row.material;
|
||||
editRow.size = row.specification;
|
||||
editRow.weight = row.netWeight;
|
||||
editRow.pieces = 1;
|
||||
const data = await this.fetchLatestChemAndPhys(row.coilId);
|
||||
Object.assign(editRow, data);
|
||||
}
|
||||
this.coilDialogVisible = false;
|
||||
this.currentEditRow = null;
|
||||
@@ -556,7 +574,7 @@ export default {
|
||||
openBatchAddDialog() {
|
||||
this.batchAddDialogVisible = true;
|
||||
},
|
||||
handleBatchAddConfirm(coils) {
|
||||
async handleBatchAddConfirm(coils) {
|
||||
if (!coils || coils.length === 0) {
|
||||
this.$message.warning('请选择钢卷');
|
||||
return;
|
||||
@@ -566,41 +584,36 @@ export default {
|
||||
let successCount = 0;
|
||||
let failCount = 0;
|
||||
|
||||
coils.forEach((coil, index) => {
|
||||
const newRow = {
|
||||
certificateId: this.currentCertificateId,
|
||||
itemSeqNo: this.certificateItemList.length + index + 1,
|
||||
coilNo: coil.currentCoilNo,
|
||||
materialType: coil.material,
|
||||
size: coil.specification,
|
||||
weight: coil.netWeight,
|
||||
pieces: 1
|
||||
};
|
||||
|
||||
addCertificateItem(newRow).then(() => {
|
||||
for (let index = 0; index < coils.length; index++) {
|
||||
const coil = coils[index];
|
||||
try {
|
||||
const data = await this.fetchLatestChemAndPhys(coil.coilId);
|
||||
const newRow = {
|
||||
certificateId: this.currentCertificateId,
|
||||
itemSeqNo: this.certificateItemList.length + index + 1,
|
||||
coilNo: coil.currentCoilNo,
|
||||
materialType: coil.material,
|
||||
size: coil.specification,
|
||||
weight: coil.netWeight,
|
||||
pieces: 1,
|
||||
...data
|
||||
};
|
||||
await addCertificateItem(newRow);
|
||||
successCount++;
|
||||
if (successCount + failCount === totalCount) {
|
||||
this.batchAddDialogVisible = false;
|
||||
if (successCount === totalCount) {
|
||||
this.$message.success(`批量新增成功,共新增 ${successCount} 条明细`);
|
||||
} else {
|
||||
this.$message.warning(`批量新增完成,成功 ${successCount} 条,失败 ${failCount} 条`);
|
||||
}
|
||||
this.getList();
|
||||
}
|
||||
}).catch(() => {
|
||||
} catch {
|
||||
failCount++;
|
||||
if (successCount + failCount === totalCount) {
|
||||
this.batchAddDialogVisible = false;
|
||||
if (failCount === totalCount) {
|
||||
this.$message.error('批量新增失败');
|
||||
} else {
|
||||
this.$message.warning(`批量新增完成,成功 ${successCount} 条,失败 ${failCount} 条`);
|
||||
}
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.batchAddDialogVisible = false;
|
||||
if (failCount === 0) {
|
||||
this.$message.success(`批量新增成功,共新增 ${successCount} 条明细`);
|
||||
} else if (successCount === 0) {
|
||||
this.$message.error('批量新增失败');
|
||||
} else {
|
||||
this.$message.warning(`批量新增完成,成功 ${successCount} 条,失败 ${failCount} 条`);
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleAddCertificate() {
|
||||
this.certificateForm = {
|
||||
|
||||
1035
klp-ui/src/views/mes/qc/certificate/physics.vue
Normal file
1035
klp-ui/src/views/mes/qc/certificate/physics.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -711,7 +711,7 @@
|
||||
<div class="section sales-section">
|
||||
<div class="section-header">
|
||||
<span class="section-icon">💰</span>
|
||||
<span class="section-title">销售信息</span>
|
||||
<span class="section-title">生产合同信息</span>
|
||||
</div>
|
||||
<div class="section-body" v-if="salesInfo.orderId">
|
||||
<el-descriptions :column="3" border size="small">
|
||||
@@ -734,7 +734,7 @@
|
||||
|
||||
<div v-else class="empty-state">
|
||||
<i class="el-icon-document"></i>
|
||||
<span>未找到相关销售记录</span>
|
||||
<span>未找到相关生产合同信息</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -742,7 +742,7 @@
|
||||
<!-- 发货单信息 -->
|
||||
<div class="section-header">
|
||||
<span class="section-icon">💰</span>
|
||||
<span class="section-title">发货单对应的合同信息</span>
|
||||
<span class="section-title">发货合同信息</span>
|
||||
</div>
|
||||
<div class="section-body" v-if="deliveryOrderInfo.orderId">
|
||||
<el-descriptions :column="3" border size="small">
|
||||
@@ -765,7 +765,7 @@
|
||||
|
||||
<div v-else class="empty-state">
|
||||
<i class="el-icon-document"></i>
|
||||
<span>未找到相关发货单对应的合同信息记录</span>
|
||||
<span>未找到相关发货合同信息</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -807,7 +807,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section combined-section">
|
||||
<div class="section-header">
|
||||
<span class="section-icon">📋</span>
|
||||
@@ -878,6 +877,79 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 检验信息 -->
|
||||
<div class="section inspection-section">
|
||||
<div class="section-header">
|
||||
<span class="section-icon">🔬</span>
|
||||
<span class="section-title">检验信息</span>
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<el-table :data="inspectionTaskList" v-loading="inspectionLoading" size="small" border stripe style="width: 100%"
|
||||
@expand-change="handleInspectionExpand" :row-key="row => row.taskId">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="props">
|
||||
<div v-loading="inspectionItemLoadingMap[props.row.taskId]" style="padding: 8px;">
|
||||
<el-table :data="inspectionItemMap[props.row.taskId] || []" size="mini" border stripe style="width: 100%">
|
||||
<el-table-column label="检验项目名称" align="center" prop="itemName" min-width="120" />
|
||||
<el-table-column label="标准值" align="center" prop="standardValue" width="80" />
|
||||
<el-table-column label="上限" align="center" prop="upperLimit" width="80" />
|
||||
<el-table-column label="下限" align="center" prop="lowerLimit" width="80" />
|
||||
<el-table-column label="单位" align="center" prop="unit" width="60" />
|
||||
<el-table-column label="定性/定量" align="center" prop="itemType" width="80" />
|
||||
<el-table-column label="检验值" align="center" prop="inspectValue" width="100" />
|
||||
<el-table-column label="是否合格" align="center" prop="isQualified" width="80" />
|
||||
<el-table-column label="判定结果" align="center" prop="judgeResult" width="100" />
|
||||
<el-table-column label="检验人" align="center" prop="inspectUser" width="80" />
|
||||
<el-table-column label="检验时间" align="center" prop="inspectTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.inspectTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="100" />
|
||||
</el-table>
|
||||
<div v-if="!inspectionItemMap[props.row.taskId] || inspectionItemMap[props.row.taskId].length === 0"
|
||||
style="text-align:center;padding:16px;color:#999;font-size:13px;">
|
||||
暂无检验明细
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务编号" align="center" prop="taskCode" width="160" />
|
||||
<el-table-column label="任务类型" align="center" prop="taskType" width="100" />
|
||||
<el-table-column label="所属单位" align="center" prop="belongCompany" width="120" />
|
||||
<el-table-column label="方案名称" align="center" prop="schemeName" min-width="120" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status === 0 || scope.row.status === '0'" type="info" size="small">待检验</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 1 || scope.row.status === '1'" type="warning" size="small">已检验</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === 2 || scope.row.status === '2'" type="success" size="small">已审核</el-tag>
|
||||
<span v-else>{{ scope.row.status }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检验人" align="center" prop="inspectUser" width="80" />
|
||||
<el-table-column label="审核人" align="center" prop="auditUser" width="80" />
|
||||
<el-table-column label="最终结果" align="center" prop="result" min-width="100" />
|
||||
<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;">
|
||||
<div v-for="(coil, index) in scope.row.coilList" :key="coil.coilId || index">
|
||||
<CurrentCoilNo :currentCoilNo="coil.currentCoilNo || coil.coilNo || ''" />
|
||||
</div>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="100" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<div v-if="inspectionTaskList.length === 0 && !inspectionLoading"
|
||||
style="text-align:center;padding:24px 0;color:#999;font-size:14px;">
|
||||
<i class="el-icon-document" style="font-size:48px;display:block;margin-bottom:8px;color:#ddd;"></i>
|
||||
未找到相关检验信息
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 生产工艺数据图表 -->
|
||||
<div v-if="isColdHardCoil" class="section production-section">
|
||||
<div class="section-header">
|
||||
@@ -969,6 +1041,9 @@ import { getTimingSegByEncoilId, getTimingPlanDetailByHotcoilId, getTimingRealti
|
||||
import AbnormalTable from '@/views/wms/coil/components/AbnormalTable.vue';
|
||||
import FileList from "@/components/FileList";
|
||||
import CoilTraceResult from '@/views/wms/coil/panels/CoilTraceResult.vue';
|
||||
import { listInspectionTask } from "@/api/mes/qc/inspectionTask";
|
||||
import { listInspectionItem } from "@/api/mes/qc/inspectionItem";
|
||||
import CurrentCoilNo from "@/components/KLPService/Renderer/CurrentCoilNo.vue";
|
||||
|
||||
const TREND_GROUPS = [
|
||||
{
|
||||
@@ -1087,7 +1162,8 @@ export default {
|
||||
components: {
|
||||
AbnormalTable,
|
||||
FileList,
|
||||
CoilTraceResult
|
||||
CoilTraceResult,
|
||||
CurrentCoilNo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -1131,6 +1207,11 @@ export default {
|
||||
deliveryOrderInfo: {},
|
||||
// 销售异议信息
|
||||
salesObjectionInfo: [],
|
||||
// 检验信息
|
||||
inspectionTaskList: [],
|
||||
inspectionLoading: false,
|
||||
inspectionItemMap: {},
|
||||
inspectionItemLoadingMap: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -1159,6 +1240,7 @@ export default {
|
||||
await this.fetchDeliveryOrderInfo();
|
||||
this.mergeTransferList();
|
||||
await this.getSalesObjectionList();
|
||||
await this.getInspectionTasks();
|
||||
|
||||
// 如果是冷硬卷,加载生产数据
|
||||
if (this.isColdHardCoil) {
|
||||
@@ -1258,6 +1340,33 @@ export default {
|
||||
});
|
||||
this.tranferList = list;
|
||||
},
|
||||
async getInspectionTasks() {
|
||||
this.inspectionLoading = true;
|
||||
try {
|
||||
const res = await listInspectionTask({ coilIds: this.coilId, pageNum: 1, pageSize: 100 });
|
||||
this.inspectionTaskList = res.rows || [];
|
||||
} catch (e) {
|
||||
console.error('获取检验任务异常:', e);
|
||||
this.inspectionTaskList = [];
|
||||
} finally {
|
||||
this.inspectionLoading = false;
|
||||
}
|
||||
},
|
||||
async handleInspectionExpand(row, expandedRows) {
|
||||
if (!expandedRows || !expandedRows.includes(row)) return;
|
||||
const taskId = row.taskId;
|
||||
if (this.inspectionItemMap[taskId]) return;
|
||||
this.$set(this.inspectionItemLoadingMap, taskId, true);
|
||||
try {
|
||||
const res = await listInspectionItem({ taskId, pageNum: 1, pageSize: 100 });
|
||||
this.$set(this.inspectionItemMap, taskId, res.rows || []);
|
||||
} catch (e) {
|
||||
console.error('获取检验明细异常:', e);
|
||||
this.$set(this.inspectionItemMap, taskId, []);
|
||||
} finally {
|
||||
this.$set(this.inspectionItemLoadingMap, taskId, false);
|
||||
}
|
||||
},
|
||||
formatTime(timeStamp) {
|
||||
if (!timeStamp) return '-';
|
||||
const date = new Date(timeStamp);
|
||||
|
||||
Reference in New Issue
Block a user