feat(钢卷管理): 添加钢卷号组件并优化相关功能
新增CoilNo组件用于统一显示钢卷号,支持G开头钢卷号特殊样式 在actflow、detail、panels等页面中使用新组件替换原有el-tag显示 添加showExportTime属性控制发货时间列的显示 优化ImportGuide组件,钢卷号自动添加G前缀
This commit is contained in:
@@ -2,46 +2,25 @@
|
||||
<div class="import-wizard-container">
|
||||
<!-- 文件上传区域 -->
|
||||
<div class="file-upload-area" :class="{ disabled: importStatus === ImportStatus.PROCESSING }">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-excel"
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:on-change="handleFileChange"
|
||||
accept=".xlsx,.xls"
|
||||
:disabled="importStatus === ImportStatus.PROCESSING || validateLoading || importLoading"
|
||||
>
|
||||
<el-upload ref="upload" class="upload-excel" action="" :auto-upload="false" :show-file-list="false"
|
||||
:on-change="handleFileChange" accept=".xlsx,.xls"
|
||||
:disabled="importStatus === ImportStatus.PROCESSING || validateLoading || importLoading">
|
||||
<el-button type="primary" icon="el-icon-upload2">选择Excel文件</el-button>
|
||||
</el-upload>
|
||||
|
||||
<!-- 操作按钮:新增loading和防呆 -->
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
@click="handleValidate"
|
||||
v-if="file && importStatus === ImportStatus.IDLE"
|
||||
:disabled="!file || validateLoading"
|
||||
:loading="validateLoading"
|
||||
>
|
||||
<el-button type="success" icon="el-icon-check" @click="handleValidate"
|
||||
v-if="file && importStatus === ImportStatus.IDLE" :disabled="!file || validateLoading"
|
||||
:loading="validateLoading">
|
||||
校验数据
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-circle-check"
|
||||
@click="startImport"
|
||||
<el-button type="warning" icon="el-icon-circle-check" @click="startImport"
|
||||
v-if="file && importStatus === ImportStatus.IDLE"
|
||||
:disabled="!file || !isValidated || errorList.length > 0 || importLoading"
|
||||
:loading="importLoading"
|
||||
>
|
||||
:disabled="!file || !isValidated || errorList.length > 0 || importLoading" :loading="importLoading">
|
||||
开始导入
|
||||
</el-button>
|
||||
<el-button
|
||||
type="default"
|
||||
icon="el-icon-refresh"
|
||||
@click="reset"
|
||||
:disabled="importStatus === ImportStatus.PROCESSING || validateLoading || importLoading"
|
||||
>
|
||||
<el-button type="default" icon="el-icon-refresh" @click="reset"
|
||||
:disabled="importStatus === ImportStatus.PROCESSING || validateLoading || importLoading">
|
||||
重置
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -57,46 +36,23 @@
|
||||
|
||||
<!-- 数据预览 -->
|
||||
<div v-if="tableData.length > 0 && importStatus === ImportStatus.IDLE" class="data-preview">
|
||||
<el-alert
|
||||
title="数据预览"
|
||||
type="info"
|
||||
:description="`共解析出 ${tableData.length} 条有效数据`"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert title="数据预览" type="info" :description="`共解析出 ${tableData.length} 条有效数据`" show-icon :closable="false" />
|
||||
<el-table :data="tableData" border size="small" max-height="300" stripe>
|
||||
<el-table-column
|
||||
v-for="column in TableColumnEnum"
|
||||
:key="column.prop"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
:width="column.width"
|
||||
:min-width="column.minWidth"
|
||||
/>
|
||||
<el-table-column v-for="column in TableColumnEnum" :key="column.prop" :prop="column.prop" :label="column.label"
|
||||
:width="column.width" :min-width="column.minWidth" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 导入进度展示 -->
|
||||
<div v-if="importStatus === ImportStatus.PROCESSING" class="import-progress">
|
||||
<el-alert
|
||||
title="正在导入数据"
|
||||
type="warning"
|
||||
:description="`当前进度:${progress}%`"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert title="正在导入数据" type="warning" :description="`当前进度:${progress}%`" show-icon :closable="false" />
|
||||
<el-progress :percentage="progress" status="success" />
|
||||
<p class="progress-tip">已导入 {{ importedCount }} / {{ totalCount }} 条数据</p>
|
||||
</div>
|
||||
|
||||
<!-- 导入完成提示 -->
|
||||
<div v-if="importStatus === ImportStatus.FINISHED" class="import-finished">
|
||||
<el-alert
|
||||
title="导入完成"
|
||||
type="success"
|
||||
:description="`共成功导入 ${importedCount} 条数据,总计 ${totalCount} 条`"
|
||||
show-icon
|
||||
/>
|
||||
<el-alert title="导入完成" type="success" :description="`共成功导入 ${importedCount} 条数据,总计 ${totalCount} 条`" show-icon />
|
||||
</div>
|
||||
|
||||
<!-- 导入失败提示 -->
|
||||
@@ -264,7 +220,7 @@ export default {
|
||||
// 枚举挂载到实例,方便模板使用
|
||||
ImportStatus,
|
||||
TableColumnEnum,
|
||||
|
||||
|
||||
// 文件对象
|
||||
file: null,
|
||||
// 解析后的原始数据
|
||||
@@ -314,7 +270,7 @@ export default {
|
||||
try {
|
||||
const response = await listWarehouse({ pageNum: 1, pageSize: 1000 });
|
||||
const map = {};
|
||||
|
||||
|
||||
for (let item of response.data) {
|
||||
map[item.warehouseName] = item.warehouseId;
|
||||
}
|
||||
@@ -503,8 +459,8 @@ export default {
|
||||
|
||||
// 二次确认,防止误操作
|
||||
const confirm = await this.$confirm(
|
||||
'确认导入已校验通过的数据?导入过程中请勿刷新页面或关闭浏览器!',
|
||||
'导入确认',
|
||||
'确认导入已校验通过的数据?导入过程中请勿刷新页面或关闭浏览器!',
|
||||
'导入确认',
|
||||
{
|
||||
confirmButtonText: '确认导入',
|
||||
cancelButtonText: '取消',
|
||||
@@ -555,6 +511,7 @@ export default {
|
||||
throw new Error(`第${row.rowNum}行导入失败:${error.message}`);
|
||||
}
|
||||
}
|
||||
this.$emit('finish', this.importedCount);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -576,8 +533,8 @@ export default {
|
||||
itemType,
|
||||
materialType: row.type,
|
||||
warehouseId: this.warehouseMap[row.logicWarehouse],
|
||||
enterCoilNo: row.inboundCoilNo,
|
||||
currentCoilNo: row.inboundCoilNo,
|
||||
enterCoilNo: 'G' + row.inboundCoilNo,
|
||||
currentCoilNo: 'G' + row.inboundCoilNo,
|
||||
supplierCoilNo: row.factoryCoilNo,
|
||||
grossWeight: row.weight,
|
||||
netWeight: row.weight,
|
||||
@@ -593,7 +550,7 @@ export default {
|
||||
// 3. 插入待处理操作
|
||||
const actionParams = {
|
||||
coilId,
|
||||
currentCoilNo: row.inboundCoilNo,
|
||||
currentCoilNo: 'G' + row.inboundCoilNo,
|
||||
actionStatus: SystemConstant.PENDING_ACTION_STATUS,
|
||||
itemType,
|
||||
itemId,
|
||||
@@ -606,7 +563,6 @@ export default {
|
||||
if (actionRes.code !== 200) {
|
||||
throw new Error(`待处理操作插入失败:${actionRes.message || '接口返回异常'}`);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
throw new Error(error.message);
|
||||
}
|
||||
@@ -632,8 +588,8 @@ export default {
|
||||
};
|
||||
|
||||
// 执行查询
|
||||
const res = itemType === 'raw_material'
|
||||
? await listRawMaterial(queryParams)
|
||||
const res = itemType === 'raw_material'
|
||||
? await listRawMaterial(queryParams)
|
||||
: await listProduct(queryParams);
|
||||
|
||||
// 空值判断函数
|
||||
@@ -672,8 +628,8 @@ export default {
|
||||
// 有数据时二次确认,防止误清空
|
||||
if (this.file || this.tableData.length > 0 || this.errorList.length > 0) {
|
||||
const confirm = await this.$confirm(
|
||||
'确认重置所有状态?已选择的文件、解析的数据和校验结果将被清空!',
|
||||
'重置确认',
|
||||
'确认重置所有状态?已选择的文件、解析的数据和校验结果将被清空!',
|
||||
'重置确认',
|
||||
{
|
||||
confirmButtonText: '确认重置',
|
||||
cancelButtonText: '取消',
|
||||
@@ -729,7 +685,8 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap; /* 适配小屏幕 */
|
||||
flex-wrap: wrap;
|
||||
/* 适配小屏幕 */
|
||||
}
|
||||
|
||||
.file-upload-area.disabled {
|
||||
|
||||
Reference in New Issue
Block a user