refactor(wms/coil): 优化代码格式并新增热轧卷材质自动填充功能
1. 格式化多个vue文件的模板代码,调整长标签换行规范 2. 新增getFirstHeatCoilMaterial接口调用,从接口获取最早热轧卷板材质 3. 在分条、酸洗页面中自动将packingStatus填充为获取到的热轧材质 4. 调整typing页面的布局结构,优化表单排版
This commit is contained in:
@@ -193,8 +193,8 @@
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度(m)">
|
||||
<el-input-number :controls="false" v-model="item.length" placeholder="请输入长度" type="number" :step="0.01"
|
||||
:disabled="readonly">
|
||||
<el-input-number :controls="false" v-model="item.length" placeholder="请输入长度" type="number"
|
||||
:step="0.01" :disabled="readonly">
|
||||
<template slot="append">米</template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
@@ -205,8 +205,8 @@
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="实测厚度(mm)" prop="actualThickness" class="form-item-half">
|
||||
<el-input-number :controls="false" v-model="item.actualThickness" placeholder="请输入实测厚度"
|
||||
type="number" :step="0.01" :disabled="readonly">
|
||||
<el-input-number :controls="false" v-model="item.actualThickness" placeholder="请输入实测厚度" type="number"
|
||||
:step="0.01" :disabled="readonly">
|
||||
<template slot="append">mm</template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
@@ -229,7 +229,8 @@
|
||||
<MemoInput storageKey="coatingType" v-model="item.coatingType" placeholder="请输入镀层种类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="钢卷表面处理" prop="coilSurfaceTreatment">
|
||||
<MemoInput storageKey="surfaceTreatmentDesc" v-model="item.coilSurfaceTreatment" placeholder="请输入钢卷表面处理" />
|
||||
<MemoInput storageKey="surfaceTreatmentDesc" v-model="item.coilSurfaceTreatment"
|
||||
placeholder="请输入钢卷表面处理" />
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区" required>
|
||||
<WarehouseSelect v-model="item.warehouseId" placeholder="请选择逻辑库区" :disabled="readonly" />
|
||||
@@ -239,10 +240,12 @@
|
||||
:disabled="readonly" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="生产开始时间">
|
||||
<TimeInput v-model="item.productionStartTime" @input="() => calculateProductionDuration(item)" :disabled="readonly" />
|
||||
<TimeInput v-model="item.productionStartTime" @input="() => calculateProductionDuration(item)"
|
||||
:disabled="readonly" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产结束时间">
|
||||
<TimeInput v-model="item.productionEndTime" @input="() => calculateProductionDuration(item)" :disabled="readonly" :show-now-button="true" />
|
||||
<TimeInput v-model="item.productionEndTime" @input="() => calculateProductionDuration(item)"
|
||||
:disabled="readonly" :show-now-button="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产耗时">
|
||||
<el-input v-model="item.formattedDuration" placeholder="自动计算" disabled />
|
||||
@@ -257,30 +260,18 @@
|
||||
|
||||
<el-form-item label="异常信息">
|
||||
<div class="abnormal-container">
|
||||
<div
|
||||
v-for="(abnormal, abnormalIndex) in item.abnormals"
|
||||
:key="abnormalIndex"
|
||||
class="abnormal-item"
|
||||
@click="editAbnormal(index, abnormalIndex)"
|
||||
>
|
||||
<div v-for="(abnormal, abnormalIndex) in item.abnormals" :key="abnormalIndex" class="abnormal-item"
|
||||
@click="editAbnormal(index, abnormalIndex)">
|
||||
<div class="abnormal-content">
|
||||
<div class="abnormal-info">
|
||||
<div class="abnormal-position">{{ getAbnormalPositionText(abnormal.position) }}</div>
|
||||
<div class="abnormal-code">{{ getAbnormalCodeText(abnormal.defectCode) }}</div>
|
||||
</div>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="mini"
|
||||
icon="el-icon-close"
|
||||
class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index, abnormalIndex)"
|
||||
></el-button>
|
||||
<el-button type="danger" size="mini" icon="el-icon-close" class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index, abnormalIndex)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="abnormal-add"
|
||||
@click="addAbnormal(index)"
|
||||
>
|
||||
<div class="abnormal-add" @click="addAbnormal(index)">
|
||||
<i class="el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -293,16 +284,9 @@
|
||||
</div>
|
||||
|
||||
<!-- 异常表单弹窗 -->
|
||||
<el-dialog
|
||||
:title="currentAbnormalIndex === -1 ? '新增异常' : '编辑异常'"
|
||||
:visible.sync="abnormalDialogVisible"
|
||||
width="600px"
|
||||
>
|
||||
<abnormal-form
|
||||
ref="abnormalForm"
|
||||
v-model="abnormalForm"
|
||||
:show-coil-selector="false"
|
||||
></abnormal-form>
|
||||
<el-dialog :title="currentAbnormalIndex === -1 ? '新增异常' : '编辑异常'" :visible.sync="abnormalDialogVisible"
|
||||
width="600px">
|
||||
<abnormal-form ref="abnormalForm" v-model="abnormalForm" :show-coil-selector="false"></abnormal-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="abnormalDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="saveAbnormal">确 定</el-button>
|
||||
@@ -312,7 +296,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, splitMaterialCoil } from '@/api/wms/coil';
|
||||
import { getMaterialCoil, splitMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
||||
import { listWarehouse } from '@/api/wms/warehouse';
|
||||
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
@@ -414,7 +398,9 @@ export default {
|
||||
defectCode: null,
|
||||
degree: null,
|
||||
remark: null
|
||||
}
|
||||
},
|
||||
// 最早热轧卷板材质
|
||||
firstHeatMaterial: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -549,6 +535,21 @@ export default {
|
||||
itemMaterial: data?.material || '',
|
||||
itemSpecification: data?.specification || '',
|
||||
};
|
||||
|
||||
// 获取最早的热轧卷板材质
|
||||
try {
|
||||
const firstHeatMaterial = await getFirstHeatCoilMaterial(this.motherCoil.enterCoilNo);
|
||||
if (firstHeatMaterial.code === 200 && firstHeatMaterial.msg) {
|
||||
this.firstHeatMaterial = firstHeatMaterial.msg
|
||||
}
|
||||
|
||||
for (const item of this.splitList) {
|
||||
item.packingStatus = this.firstHeatMaterial || ''
|
||||
}
|
||||
} catch (error) {
|
||||
// console.error('获取最早的热轧卷板材质失败', error);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('加载母卷信息失败');
|
||||
@@ -585,7 +586,7 @@ export default {
|
||||
actualWarehouseId: null,
|
||||
qualityStatus: '',
|
||||
packagingRequirement: '',
|
||||
packingStatus: '',
|
||||
packingStatus: this.firstHeatMaterial || '',
|
||||
trimmingRequirement: '',
|
||||
temperGrade: '',
|
||||
coatingType: '',
|
||||
@@ -690,7 +691,7 @@ export default {
|
||||
coilId,
|
||||
contractId: this.splitList[index].contractId
|
||||
}))
|
||||
.filter(req => req.contractId);
|
||||
.filter(req => req.contractId);
|
||||
// 为每个子卷添加合同关联
|
||||
Promise.all(requests.map(async (req, index) => {
|
||||
addCoilContractRel(req);
|
||||
@@ -750,26 +751,26 @@ export default {
|
||||
// 格式化毫秒值为xx天xx小时xx分钟
|
||||
formatDuration(milliseconds) {
|
||||
if (!milliseconds || milliseconds < 0) return '';
|
||||
|
||||
|
||||
const seconds = Math.floor(milliseconds / 1000);
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
|
||||
|
||||
const remainingHours = hours % 24;
|
||||
const remainingMinutes = minutes % 60;
|
||||
|
||||
|
||||
let result = '';
|
||||
if (days > 0) result += `${days}天`;
|
||||
if (remainingHours > 0) result += `${remainingHours}小时`;
|
||||
if (remainingMinutes > 0) result += `${remainingMinutes}分钟`;
|
||||
|
||||
|
||||
return result || '0分钟';
|
||||
},
|
||||
// 计算生产耗时
|
||||
calculateProductionDuration(item) {
|
||||
if (!item) return;
|
||||
|
||||
|
||||
const { productionStartTime, productionEndTime } = item;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
@@ -792,7 +793,7 @@ export default {
|
||||
this.$set(item, 'formattedDuration', '');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 新增异常
|
||||
addAbnormal(subCoilIndex) {
|
||||
this.currentSubCoilIndex = subCoilIndex;
|
||||
@@ -809,7 +810,7 @@ export default {
|
||||
};
|
||||
this.abnormalDialogVisible = true;
|
||||
},
|
||||
|
||||
|
||||
// 编辑异常
|
||||
editAbnormal(subCoilIndex, abnormalIndex) {
|
||||
this.currentSubCoilIndex = subCoilIndex;
|
||||
@@ -817,14 +818,14 @@ export default {
|
||||
this.abnormalForm = { ...this.splitList[subCoilIndex].abnormals[abnormalIndex] };
|
||||
this.abnormalDialogVisible = true;
|
||||
},
|
||||
|
||||
|
||||
// 保存异常
|
||||
saveAbnormal() {
|
||||
this.$refs.abnormalForm.validate(valid => {
|
||||
if (valid) {
|
||||
// 计算缺陷长度
|
||||
this.abnormalForm.length = this.abnormalForm.endPosition - this.abnormalForm.startPosition;
|
||||
|
||||
|
||||
if (this.currentAbnormalIndex === -1) {
|
||||
// 新增异常
|
||||
this.splitList[this.currentSubCoilIndex].abnormals.push({ ...this.abnormalForm });
|
||||
@@ -832,12 +833,12 @@ export default {
|
||||
// 编辑异常
|
||||
this.splitList[this.currentSubCoilIndex].abnormals[this.currentAbnormalIndex] = { ...this.abnormalForm };
|
||||
}
|
||||
|
||||
|
||||
this.abnormalDialogVisible = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 删除异常
|
||||
deleteAbnormal(subCoilIndex, abnormalIndex) {
|
||||
this.$confirm('确定要删除这个异常信息吗?', '提示', {
|
||||
@@ -848,7 +849,7 @@ export default {
|
||||
this.splitList[subCoilIndex].abnormals.splice(abnormalIndex, 1);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 获取异常位置文本
|
||||
getAbnormalPositionText(position) {
|
||||
if (!position) return '';
|
||||
@@ -857,7 +858,7 @@ export default {
|
||||
const item = dict.find(item => item.value === position);
|
||||
return item ? item.label : position;
|
||||
},
|
||||
|
||||
|
||||
// 获取异常代码文本
|
||||
getAbnormalCodeText(code) {
|
||||
if (!code) return '';
|
||||
|
||||
Reference in New Issue
Block a user