Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
86
klp-ui/src/components/TimeInput.vue
Normal file
86
klp-ui/src/components/TimeInput.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="time-input-group">
|
||||
<el-date-picker v-model="dateValue" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 140px;" @change="updateDateTime" />
|
||||
<span class="time-separator">@</span>
|
||||
<el-input-number :controls="false" v-model="hourValue" placeholder="时" min="0" max="23" style="width: 60px;" @change="updateDateTime" />
|
||||
<span class="time-separator">:</span>
|
||||
<el-input-number :controls="false" v-model="minuteValue" placeholder="分" min="0" max="59" style="width: 60px;" @change="updateDateTime" />
|
||||
<span class="time-separator">:00</span>
|
||||
<el-button v-if="showNowButton" type="text" size="small" @click="setToNow" style="margin-left: 8px;">此刻</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'TimeInput',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
showNowButton: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dateValue: '',
|
||||
hourValue: '',
|
||||
minuteValue: ''
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(newValue) {
|
||||
this.parseDateTime(newValue);
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
parseDateTime(dateTimeStr) {
|
||||
if (!dateTimeStr) {
|
||||
this.dateValue = '';
|
||||
this.hourValue = '';
|
||||
this.minuteValue = '';
|
||||
return;
|
||||
}
|
||||
const date = new Date(dateTimeStr);
|
||||
if (!isNaN(date.getTime())) {
|
||||
this.dateValue = date.toISOString().split('T')[0];
|
||||
this.hourValue = date.getHours();
|
||||
this.minuteValue = date.getMinutes();
|
||||
}
|
||||
},
|
||||
updateDateTime() {
|
||||
if (this.dateValue && this.hourValue !== '' && this.minuteValue !== '') {
|
||||
const dateTimeStr = `${this.dateValue} ${this.hourValue}:${this.minuteValue}:00`;
|
||||
this.$emit('input', dateTimeStr);
|
||||
} else {
|
||||
this.$emit('input', '');
|
||||
}
|
||||
},
|
||||
setToNow() {
|
||||
const now = new Date();
|
||||
this.dateValue = now.toISOString().split('T')[0];
|
||||
this.hourValue = now.getHours();
|
||||
this.minuteValue = now.getMinutes();
|
||||
this.updateDateTime();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.time-input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-separator {
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
querys: {
|
||||
dataType: 1,
|
||||
// 筛选异常数量大于等于1的
|
||||
minAbnormalCount: 1
|
||||
// minAbnormalCount: 1
|
||||
},
|
||||
labelType: '2',
|
||||
qrcode: false,
|
||||
|
||||
@@ -65,7 +65,9 @@
|
||||
<dict-tag :options="dict.type.coil_abnormal_position" :value="scope.row.position" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="长度坐标" align="center" prop="lengthCoord" />
|
||||
<el-table-column label="开始位置" align="center" prop="startPosition" />
|
||||
<el-table-column label="结束位置" align="center" prop="endPosition" />
|
||||
<el-table-column label="缺陷长度" align="center" prop="length" />
|
||||
<el-table-column label="缺陷代码" align="center" prop="defectCode">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.coil_abnormal_code" :value="scope.row.defectCode" />
|
||||
@@ -120,7 +122,10 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度坐标" prop="lengthCoord">
|
||||
<el-input v-model="form.lengthCoord" placeholder="请输入长度坐标" />
|
||||
<!-- <el-input v-model="form.lengthCoord" placeholder="请输入长度坐标" /> -->
|
||||
<el-input v-model="form.startPosition" placeholder="请输入开始位置" />
|
||||
<el-input v-model="form.endPosition" placeholder="请输入结束位置" />
|
||||
<!-- <el-input v-model="form.length" placeholder="请输入缺陷长度" /> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="缺陷代码" prop="defectCode">
|
||||
<el-radio-group v-model="form.defectCode">
|
||||
@@ -339,7 +344,7 @@ export default {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.abnormalId != null) {
|
||||
updateCoilAbnormal(this.form).then(response => {
|
||||
updateCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -347,7 +352,7 @@ export default {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCoilAbnormal(this.form).then(response => {
|
||||
addCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
@@ -58,7 +58,9 @@
|
||||
<dict-tag :options="dict.type.coil_abnormal_position" :value="scope.row.position" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="长度坐标" align="center" prop="lengthCoord" />
|
||||
<el-table-column label="开始位置" align="center" prop="startPosition" />
|
||||
<el-table-column label="结束位置" align="center" prop="endPosition" />
|
||||
<el-table-column label="缺陷长度" align="center" prop="length" />
|
||||
<el-table-column label="缺陷代码" align="center" prop="defectCode">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.coil_abnormal_code" :value="scope.row.defectCode" />
|
||||
@@ -106,9 +108,15 @@
|
||||
dict.label }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度坐标" prop="lengthCoord">
|
||||
<el-input v-model="form.lengthCoord" placeholder="请输入长度坐标" />
|
||||
<el-form-item label="开始位置" prop="startPosition">
|
||||
<el-input v-model="form.startPosition" prop="startPosition" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束位置" prop="endPosition">
|
||||
<el-input v-model="form.endPosition" prop="endPosition" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="缺陷长度" prop="length">
|
||||
<el-input v-model="form.length" placeholder="请输入缺陷长度" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="缺陷代码" prop="defectCode">
|
||||
<el-radio-group v-model="form.defectCode">
|
||||
<el-radio-button v-for="dict in dict.type.coil_abnormal_code" :key="dict.value" :label="dict.value">{{
|
||||
@@ -293,7 +301,7 @@ export default {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.abnormalId != null) {
|
||||
updateCoilAbnormal(this.form).then(response => {
|
||||
updateCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -301,7 +309,7 @@ export default {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCoilAbnormal(this.form).then(response => {
|
||||
addCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
@@ -215,6 +215,21 @@
|
||||
<WarehouseSelect v-model="targetCoil.warehouseId" placeholder="请选择逻辑库区" :disabled="readonly" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<el-form-item label="生产开始时间" prop="productionStartTime" class="form-item-half">
|
||||
<TimeInput v-model="targetCoil.productionStartTime" @input="calculateProductionDuration" :disabled="readonly" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产结束时间" prop="productionEndTime" class="form-item-half">
|
||||
<TimeInput v-model="targetCoil.productionEndTime" @input="calculateProductionDuration" :disabled="readonly" :show-now-button="true" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<el-form-item label="生产耗时" prop="productionDuration" class="form-item-half">
|
||||
<el-input v-model="targetCoil.formattedDuration" placeholder="自动计算" disabled />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -231,6 +246,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
|
||||
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
|
||||
import ProductSelector from "@/components/KLPService/ProductSelect";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
import TimeInput from "@/components/TimeInput";
|
||||
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
|
||||
|
||||
export default {
|
||||
@@ -240,7 +256,8 @@ export default {
|
||||
ActualWarehouseSelect,
|
||||
RawMaterialSelector,
|
||||
ProductSelector,
|
||||
WarehouseSelect
|
||||
WarehouseSelect,
|
||||
TimeInput
|
||||
},
|
||||
dicts: ['coil_quality_status'],
|
||||
data() {
|
||||
@@ -270,6 +287,10 @@ export default {
|
||||
coatingType: '',
|
||||
actualLength: undefined,
|
||||
actualWidth: undefined,
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
},
|
||||
rules: {
|
||||
currentCoilNo: [
|
||||
@@ -759,6 +780,49 @@ export default {
|
||||
this.$router.back();
|
||||
},
|
||||
|
||||
// 格式化毫秒值为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() {
|
||||
const { productionStartTime, productionEndTime } = this.targetCoil;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
this.$set(this.targetCoil, 'productionDuration', '');
|
||||
this.$set(this.targetCoil, 'formattedDuration', '');
|
||||
} else {
|
||||
const durationMs = end - start;
|
||||
const durationMinutes = Math.round(durationMs / (1000 * 60));
|
||||
this.$set(this.targetCoil, 'productionDuration', durationMinutes);
|
||||
this.$set(this.targetCoil, 'formattedDuration', this.formatDuration(durationMinutes * 60 * 1000));
|
||||
}
|
||||
} else {
|
||||
this.$set(this.targetCoil, 'productionDuration', '');
|
||||
this.$set(this.targetCoil, 'formattedDuration', '');
|
||||
}
|
||||
},
|
||||
// closePage 关闭当前页面
|
||||
closePage() {
|
||||
this.$router.back();
|
||||
|
||||
@@ -54,12 +54,12 @@
|
||||
<div
|
||||
style="flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; border: 1px solid #333; box-sizing: border-box; padding: 3px; word-break: break-all; overflow-wrap: break-word;"
|
||||
class="label-cell">
|
||||
实际库区
|
||||
厂家名称
|
||||
</div>
|
||||
<div
|
||||
style="flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; border: 1px solid #333; box-sizing: border-box; padding: 3px; word-break: break-all; overflow-wrap: break-word;"
|
||||
class="value-cell">
|
||||
<input type="text" class="nob" :value="content.actualWarehouseName || ''" />
|
||||
{{ content.manufacturer || '' }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div style="display: flex; flex: 1; align-items: center;">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="位置" prop="position">
|
||||
<el-select v-model="queryParams.position" placeholder="请选择位置" clearable>
|
||||
@@ -32,7 +32,9 @@
|
||||
<dict-tag :options="dict.type.coil_abnormal_position" :value="scope.row.position" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="长度坐标" align="center" prop="lengthCoord" />
|
||||
<el-table-column label="开始位置" align="center" prop="startPosition" />
|
||||
<el-table-column label="结束位置" align="center" prop="endPosition" />
|
||||
<el-table-column label="缺陷长度" align="center" prop="length" />
|
||||
<el-table-column label="缺陷代码" align="center" prop="defectCode">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.coil_abnormal_code" :value="scope.row.defectCode" />
|
||||
@@ -64,7 +66,10 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度坐标" prop="lengthCoord">
|
||||
<el-input v-model="form.lengthCoord" placeholder="请输入长度坐标" />
|
||||
<!-- <el-input v-model="form.lengthCoord" placeholder="请输入长度坐标" /> -->
|
||||
<el-input v-model="form.startPosition" placeholder="请输入开始位置" />
|
||||
<el-input v-model="form.endPosition" placeholder="请输入结束位置" />
|
||||
<!-- <el-input v-model="form.length" placeholder="请输入缺陷长度" /> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="缺陷代码" prop="defectCode">
|
||||
<el-radio-group v-model="form.defectCode">
|
||||
@@ -228,7 +233,7 @@ export default {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.abnormalId != null) {
|
||||
updateCoilAbnormal(this.form).then(response => {
|
||||
updateCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -236,7 +241,7 @@ export default {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCoilAbnormal(this.form).then(response => {
|
||||
addCoilAbnormal({...this.form, length: this.form.endPosition - this.form.startPosition}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
<el-table-column label="业务目的" align="center" prop="businessPurpose" v-if="showBusinessPurpose" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.businessPurpose" placeholder="业务目的" filterable
|
||||
@change="handleBusinessPurposeChange(scope.row)">
|
||||
@change="handleRowChange(scope.row)">
|
||||
<el-option v-for="item in dict.type.coil_business_purpose" :key="item.value" :value="item.value"
|
||||
:label="item.label" />
|
||||
</el-select>
|
||||
@@ -182,8 +182,8 @@
|
||||
|
||||
<el-table-column label="关联订单" align="center" prop="relatedToOrder" v-if="showRelatedToOrder" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-switch @change="handleRelatedToOrderChange(scope.row)" v-model="scope.row.isRelatedToOrder"
|
||||
:active-value="1" :inactive-value="0" />
|
||||
<el-switch @change="handleRowChange(scope.row)" v-model="scope.row.isRelatedToOrder" :active-value="1"
|
||||
:inactive-value="0" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -230,7 +230,21 @@
|
||||
<el-tag v-else type="info" size="mini">未发货</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip/> -->
|
||||
|
||||
<el-table-column label="实测宽度" align="center" prop="width" v-if="showWidthEdit" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.actualWidth" placeholder="请输入实测宽度"
|
||||
@change="handleRowChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="预留宽度" align="center" prop="width" v-if="showWidthEdit" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.reservedWidth" placeholder="请输入预留宽度"
|
||||
@change="handleRowChange(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<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-view" @click="handlePreviewLabel(scope.row)">
|
||||
@@ -247,18 +261,16 @@
|
||||
@click="handleCancelExport(scope.row)">
|
||||
撤回发货
|
||||
</el-button>
|
||||
<el-button size="mini" v-if="showProductionTimeEdit" type="text" icon="el-icon-close"
|
||||
@click="handleProductionTimeEdit(scope.row)">
|
||||
加工修正
|
||||
</el-button>
|
||||
<el-button size="mini" v-if="showExportTime" type="text" icon="el-icon-sold-out"
|
||||
@click="handleReturnCoil(scope.row)">
|
||||
退货钢卷
|
||||
</el-button>
|
||||
<el-button size="mini" v-if="showAbnormal" type="text" icon="el-icon-upload"
|
||||
@click="handleAbnormal(scope.row)">查看异常</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)"
|
||||
v-if="showControl">修正</el-button>
|
||||
<!-- <el-button size="mini" type="text" icon="el-icon-time" @click="handleLog(scope.row)"
|
||||
v-if="showWareLog">吞吐记录</el-button> -->
|
||||
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-if="showControl">删除</el-button> -->
|
||||
<el-button size="mini" type="text" icon="el-icon-search" @click="handleTrace(scope.row)">追溯</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -396,10 +408,32 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="异常信息" :visible.sync="abnormalOpen" width="90%" append-to-body>
|
||||
<abnormal-list :coil-id="currentCoilId"></abnormal-list>
|
||||
<el-dialog title="生产时间修正" :visible.sync="productionTimeFormVisible" width="500px" append-to-body>
|
||||
<el-form ref="productionTimeForm" :model="productionTimeForm" :rules="productionTimeFormRules"
|
||||
label-width="100px">
|
||||
<el-form-item label="生产开始时间" prop="productionStartTime">
|
||||
<el-date-picker v-model="productionTimeForm.productionStartTime" type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择生产时间" @change="(value) => { productionTimeForm.productionStartTime = value; calculateProductionDuration(); }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产结束时间" prop="productionEndTime">
|
||||
<el-date-picker v-model="productionTimeForm.productionEndTime" type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择生产时间" @change="(value) => { productionTimeForm.productionEndTime = value; calculateProductionDuration(); }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产耗时" prop="productionDuration">
|
||||
<!-- <div>{{ productionTimeForm.formattedDuration }}</div> -->
|
||||
<el-input v-model="productionTimeForm.formattedDuration" placeholder="自动计算" disabled />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitProductionTimeForm">确 定</el-button>
|
||||
<el-button @click="productionTimeFormVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-dialog title="异常信息" :visible.sync="abnormalOpen" width="90%" append-to-body> -->
|
||||
<abnormal-list v-if="showAbnormal && currentCoilId" :coil-id="currentCoilId"></abnormal-list>
|
||||
<!-- </el-dialog> -->
|
||||
|
||||
<!-- 吞吐记录 -->
|
||||
<!-- <el-dialog v-if="showWareLog" title="吞吐记录" :visible.sync="logOpen" width="90%" append-to-body> -->
|
||||
<log-table v-if="showWareLog && currentCoilId" :coil-id="currentCoilId"></log-table>
|
||||
@@ -553,7 +587,17 @@ export default {
|
||||
showNewExport: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
// 展示宽度快捷编辑
|
||||
showWidthEdit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 展示生产时间快捷编辑
|
||||
showProductionTimeEdit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -724,6 +768,18 @@ export default {
|
||||
currentCoilId: '',
|
||||
userList: [],
|
||||
logOpen: false,
|
||||
productionTimeForm: {
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
formattedDuration: '',
|
||||
productionDuration: 0,
|
||||
},
|
||||
productionTimeFormRules: {
|
||||
productionTime: [
|
||||
{ required: true, message: "生产时间不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
productionTimeFormVisible: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -759,6 +815,88 @@ export default {
|
||||
this.userList = res.rows || [];
|
||||
});
|
||||
},
|
||||
handleProductionTimeEdit(row) {
|
||||
// 创建一个新对象,避免直接引用row
|
||||
this.productionTimeForm = { ...row };
|
||||
this.productionTimeFormVisible = true;
|
||||
// 初始化时计算一次
|
||||
this.calculateProductionDuration();
|
||||
},
|
||||
// 格式化毫秒值为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() {
|
||||
const { productionStartTime, productionEndTime } = this.productionTimeForm;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
this.$set(this.productionTimeForm, 'productionDuration', '');
|
||||
this.$set(this.productionTimeForm, 'formattedDuration', '');
|
||||
} else {
|
||||
const durationMs = end - start;
|
||||
const durationMinutes = Math.round(durationMs / (1000 * 60));
|
||||
this.$set(this.productionTimeForm, 'productionDuration', durationMinutes);
|
||||
// 同时保存格式化后的显示值
|
||||
this.$set(this.productionTimeForm, 'formattedDuration', this.formatDuration(durationMinutes * 60 * 1000));
|
||||
}
|
||||
} else {
|
||||
this.$set(this.productionTimeForm, 'productionDuration', '');
|
||||
this.$set(this.productionTimeForm, 'formattedDuration', '');
|
||||
}
|
||||
},
|
||||
// 处理生产时间提交
|
||||
submitProductionTimeForm() {
|
||||
this.$refs.productionTimeForm.validate((valid) => {
|
||||
if (valid) {
|
||||
// 再次验证时间逻辑
|
||||
const { productionStartTime, productionEndTime } = this.productionTimeForm;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.buttonLoading = true;
|
||||
updateMaterialCoilSimple(this.productionTimeForm).then(res => {
|
||||
this.buttonLoading = false;
|
||||
this.$message({
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
});
|
||||
this.productionTimeFormVisible = false;
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
handleNextWarehouseChange(row) {
|
||||
if (!this.editNext) {
|
||||
return;
|
||||
@@ -777,37 +915,13 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
handleBusinessPurposeChange(row) {
|
||||
if (!this.showBusinessPurpose) {
|
||||
return;
|
||||
}
|
||||
// 处理行数据变化
|
||||
handleRowChange(row) {
|
||||
updateMaterialCoilSimple(row).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message({
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg || '更新失败',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
handleRelatedToOrderChange(row) {
|
||||
updateMaterialCoilSimple(row).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message({
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg || '更新失败',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
this.$message({
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
});
|
||||
})
|
||||
},
|
||||
// 打印标签
|
||||
|
||||
@@ -422,6 +422,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" prop="createBy"></el-table-column>
|
||||
<el-table-column label="操作人" prop="operatorName"></el-table-column>
|
||||
<el-table-column label="开始时间" prop="createTime"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.actionStatus === 2" :loading="buttonLoading" icon="el-icon-delete"
|
||||
@@ -446,7 +447,11 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度坐标" prop="lengthCoord">
|
||||
<el-input v-model="exceptionForm.lengthCoord" placeholder="请输入长度坐标" />
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<el-input v-model="exceptionForm.startPosition" placeholder="请输入开始位置" />
|
||||
-
|
||||
<el-input v-model="exceptionForm.endPosition" placeholder="请输入结束位置" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="缺陷代码" prop="defectCode">
|
||||
<el-radio-group v-model="exceptionForm.defectCode">
|
||||
@@ -557,6 +562,8 @@ export default {
|
||||
coilId: null,
|
||||
position: null,
|
||||
lengthCoord: null,
|
||||
startPosition: 0,
|
||||
endPosition: 0,
|
||||
defectCode: null,
|
||||
degree: null,
|
||||
remark: null
|
||||
@@ -975,7 +982,10 @@ export default {
|
||||
this.exceptionDialogVisible = true
|
||||
},
|
||||
confirmException() {
|
||||
addCoilAbnormal(this.exceptionForm).then(response => {
|
||||
addCoilAbnormal({
|
||||
...this.exceptionForm,
|
||||
length: this.exceptionForm.endPosition - this.exceptionForm.startPosition,
|
||||
}).then(response => {
|
||||
this.$message.success('异常记录添加成功')
|
||||
this.cancelException();
|
||||
// 重置表单
|
||||
@@ -1033,7 +1043,9 @@ export default {
|
||||
this.exceptionForm = {
|
||||
coilId: null,
|
||||
position: null,
|
||||
lengthCoord: null,
|
||||
lengthCoord: 0,
|
||||
startPosition: 0,
|
||||
endPosition: 0,
|
||||
defectCode: null,
|
||||
degree: null,
|
||||
remark: null
|
||||
|
||||
@@ -149,6 +149,15 @@
|
||||
<el-form-item label="镀层种类" prop="coatingType">
|
||||
<MemoInput storageKey="coatingType" v-model="splitForm.coatingType" placeholder="请输入镀层种类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产开始时间" prop="productionStartTime">
|
||||
<TimeInput v-model="splitForm.productionStartTime" @input="calculateProductionDuration" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产结束时间" prop="productionEndTime">
|
||||
<TimeInput v-model="splitForm.productionEndTime" @input="calculateProductionDuration" :show-now-button="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产耗时" prop="productionDuration">
|
||||
<el-input v-model="splitForm.formattedDuration" placeholder="自动计算" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="splitForm.remark" placeholder="请输入备注" type="textarea" />
|
||||
</el-form-item>
|
||||
@@ -187,6 +196,9 @@
|
||||
m</el-descriptions-item>
|
||||
<el-descriptions-item label="调制度">{{ selectedSplitItem.temperGrade || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="镀层种类">{{ selectedSplitItem.coatingType || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产开始时间">{{ selectedSplitItem.productionStartTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产结束时间">{{ selectedSplitItem.productionEndTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产耗时">{{ selectedSplitItem.formattedDuration || (selectedSplitItem.productionDuration ? selectedSplitItem.productionDuration + ' 分钟' : '-') }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ selectedSplitItem.remark || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
@@ -208,6 +220,7 @@ import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
import TimeInput from "@/components/TimeInput";
|
||||
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
|
||||
|
||||
export default {
|
||||
@@ -231,6 +244,7 @@ export default {
|
||||
RawMaterialSelect,
|
||||
WarehouseSelect,
|
||||
ActualWarehouseSelect,
|
||||
TimeInput,
|
||||
},
|
||||
dicts: ['coil_quality_status'],
|
||||
data() {
|
||||
@@ -264,6 +278,10 @@ export default {
|
||||
temperGrade: '',
|
||||
coatingType: '',
|
||||
remark: '',
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
},
|
||||
// 已分条钢卷列表
|
||||
splitList: [],
|
||||
@@ -443,6 +461,10 @@ export default {
|
||||
temperGrade: '',
|
||||
coatingType: '',
|
||||
remark: '',
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
parentCoilId: this.coilId,
|
||||
}
|
||||
},
|
||||
@@ -547,6 +569,49 @@ 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() {
|
||||
const { productionStartTime, productionEndTime } = this.splitForm;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
this.$set(this.splitForm, 'productionDuration', '');
|
||||
this.$set(this.splitForm, 'formattedDuration', '');
|
||||
} else {
|
||||
const durationMs = end - start;
|
||||
const durationMinutes = Math.round(durationMs / (1000 * 60));
|
||||
this.$set(this.splitForm, 'productionDuration', durationMinutes);
|
||||
this.$set(this.splitForm, 'formattedDuration', this.formatDuration(durationMinutes * 60 * 1000));
|
||||
}
|
||||
} else {
|
||||
this.$set(this.splitForm, 'productionDuration', '');
|
||||
this.$set(this.splitForm, 'formattedDuration', '');
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -218,6 +218,15 @@
|
||||
<ActualWarehouseSelect v-model="item.actualWarehouseId" placeholder="请选择真实库区" block
|
||||
:disabled="readonly" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="生产开始时间">
|
||||
<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" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生产耗时">
|
||||
<el-input v-model="item.formattedDuration" placeholder="自动计算" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="item.remark" placeholder="请输入备注" :disabled="readonly" />
|
||||
</el-form-item>
|
||||
@@ -238,6 +247,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
|
||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||
import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
import TimeInput from "@/components/TimeInput";
|
||||
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
|
||||
|
||||
export default {
|
||||
@@ -247,6 +257,7 @@ export default {
|
||||
RawMaterialSelect,
|
||||
ProductSelect,
|
||||
WarehouseSelect,
|
||||
TimeInput,
|
||||
},
|
||||
dicts: ['coil_quality_status'],
|
||||
data() {
|
||||
@@ -289,6 +300,10 @@ export default {
|
||||
coatingType: '',
|
||||
actualLength: undefined,
|
||||
actualWidth: undefined,
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
}
|
||||
],
|
||||
loading: false,
|
||||
@@ -475,6 +490,10 @@ export default {
|
||||
coatingType: '',
|
||||
actualLength: undefined,
|
||||
actualWidth: undefined,
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
});
|
||||
},
|
||||
|
||||
@@ -612,6 +631,51 @@ export default {
|
||||
// 不再预加载物品列表,改为实时搜索
|
||||
|
||||
this.$message.success('已复制到所有子卷');
|
||||
},
|
||||
// 格式化毫秒值为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();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
this.$set(item, 'productionDuration', '');
|
||||
this.$set(item, 'formattedDuration', '');
|
||||
} else {
|
||||
const durationMs = end - start;
|
||||
const durationMinutes = Math.round(durationMs / (1000 * 60));
|
||||
this.$set(item, 'productionDuration', durationMinutes);
|
||||
this.$set(item, 'formattedDuration', this.formatDuration(durationMinutes * 60 * 1000));
|
||||
}
|
||||
} else {
|
||||
this.$set(item, 'productionDuration', '');
|
||||
this.$set(item, 'formattedDuration', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -192,6 +192,18 @@
|
||||
<ActualWarehouseSelect :clearInput="false" clearable v-model="updateForm.actualWarehouseId" placeholder="请选择真实库区" block />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生产开始时间" prop="productionStartTime">
|
||||
<TimeInput v-model="updateForm.productionStartTime" @input="calculateProductionDuration" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生产结束时间" prop="productionEndTime">
|
||||
<TimeInput v-model="updateForm.productionEndTime" @input="calculateProductionDuration" :show-now-button="true" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生产耗时" prop="productionDuration">
|
||||
<el-input v-model="updateForm.formattedDuration" placeholder="自动计算" disabled />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="updateForm.remark" type="textarea" :rows="4" placeholder="请输入备注信息(非必填)" maxlength="500"
|
||||
show-word-limit />
|
||||
@@ -237,6 +249,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
|
||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||
import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
import TimeInput from "@/components/TimeInput";
|
||||
import { generateCoilNoPrefix } from "@/utils/coil/coilNo";
|
||||
|
||||
export default {
|
||||
@@ -246,6 +259,7 @@ export default {
|
||||
RawMaterialSelect,
|
||||
ProductSelect,
|
||||
WarehouseSelect,
|
||||
TimeInput,
|
||||
},
|
||||
dicts: ['coil_quality_status'],
|
||||
data() {
|
||||
@@ -292,6 +306,10 @@ export default {
|
||||
coatingType: '',
|
||||
actualLength: undefined,
|
||||
actualWidth: undefined,
|
||||
productionStartTime: '',
|
||||
productionEndTime: '',
|
||||
productionDuration: '',
|
||||
formattedDuration: '',
|
||||
},
|
||||
rules: {
|
||||
currentCoilNo: [
|
||||
@@ -556,6 +574,18 @@ export default {
|
||||
nextWarehouseName: this.getWarehouseName(data.warehouseId),
|
||||
};
|
||||
|
||||
// 填充时间相关字段
|
||||
if (data.productionStartTime) {
|
||||
this.updateForm.productionStartTime = data.productionStartTime;
|
||||
}
|
||||
if (data.productionEndTime) {
|
||||
this.updateForm.productionEndTime = data.productionEndTime;
|
||||
}
|
||||
if (data.productionDuration) {
|
||||
this.updateForm.productionDuration = data.productionDuration;
|
||||
this.updateForm.formattedDuration = this.formatDuration(data.productionDuration);
|
||||
}
|
||||
|
||||
// 不再预加载物品列表,改为实时搜索
|
||||
|
||||
// 加载变更历史
|
||||
@@ -751,6 +781,20 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证时间逻辑
|
||||
const { productionStartTime, productionEndTime } = this.updateForm;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const loadingInstance = this.$loading({
|
||||
lock: true,
|
||||
text: '正在更新钢卷信息,请稍后...',
|
||||
@@ -796,6 +840,50 @@ 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() {
|
||||
const { productionStartTime, productionEndTime } = this.updateForm;
|
||||
if (productionStartTime && productionEndTime) {
|
||||
const start = new Date(productionStartTime).getTime();
|
||||
const end = new Date(productionEndTime).getTime();
|
||||
if (end < start) {
|
||||
this.$message({
|
||||
message: '结束时间不能早于开始时间',
|
||||
type: 'error',
|
||||
});
|
||||
this.updateForm.productionDuration = '';
|
||||
this.updateForm.formattedDuration = '';
|
||||
} else {
|
||||
const durationMs = end - start;
|
||||
const durationMinutes = Math.round(durationMs / (1000 * 60));
|
||||
this.updateForm.productionDuration = durationMinutes;
|
||||
this.updateForm.formattedDuration = this.formatDuration(durationMinutes * 60 * 1000);
|
||||
}
|
||||
} else {
|
||||
this.updateForm.productionDuration = '';
|
||||
this.updateForm.formattedDuration = '';
|
||||
}
|
||||
},
|
||||
// 取消操作
|
||||
handleCancel() {
|
||||
this.$router.back();
|
||||
@@ -980,6 +1068,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 表单样式优化 */
|
||||
.form-card {
|
||||
::v-deep .el-input-number {
|
||||
|
||||
27
klp-ui/src/views/wms/coil/views/base/timeEdit.vue
Normal file
27
klp-ui/src/views/wms/coil/views/base/timeEdit.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<BasePage :qrcode="qrcode" :querys="querys" :labelType="labelType" :hideWarehouseQuery="hideWarehouseQuery"
|
||||
:hideType="hideType" :showControl="showControl" :showProductionTimeEdit="showProductionTimeEdit" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BasePage from '../../panels/base.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BasePage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qrcode: false,
|
||||
querys: {
|
||||
// dataType: 1,
|
||||
},
|
||||
hideWarehouseQuery: true,
|
||||
showProductionTimeEdit: true,
|
||||
showControl: false,
|
||||
labelType: '2',
|
||||
hideType: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
27
klp-ui/src/views/wms/coil/views/base/widthEdit.vue
Normal file
27
klp-ui/src/views/wms/coil/views/base/widthEdit.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<BasePage :qrcode="qrcode" :querys="querys" :labelType="labelType" :hideWarehouseQuery="hideWarehouseQuery"
|
||||
:hideType="hideType" :showControl="showControl" :showWidthEdit="showWidthEdit" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BasePage from '../../panels/base.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BasePage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qrcode: false,
|
||||
querys: {
|
||||
// dataType: 1,
|
||||
},
|
||||
hideWarehouseQuery: true,
|
||||
showWidthEdit: true,
|
||||
showControl: false,
|
||||
labelType: '2',
|
||||
hideType: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -10,7 +10,6 @@
|
||||
/>
|
||||
<el-button icon="el-icon-plus" @click="handleAdd"></el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<el-tree
|
||||
v-loading="planLoading"
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
<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-view"
|
||||
@click.stop="handlePrint(scope.row)">打印发货单</el-button>
|
||||
@click.stop="handlePrint(scope.row, 0)">打印发货单</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-view"
|
||||
@click.stop="handlePrintSimple(scope.row)">简单打印</el-button>
|
||||
@click.stop="handlePrint(scope.row, 1)">简单打印</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-copy"
|
||||
@click.stop="handleCopy(scope.row)">复制新增</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" :disabled="scope.row.status === 1"
|
||||
@@ -100,6 +100,12 @@
|
||||
<!-- 添加或修改发货单对话框 -->
|
||||
<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="planId">
|
||||
<!-- <PlanSelector v-model="form.planId" /> -->
|
||||
<el-select v-model="form.planId" placeholder="请选择发货计划" filterable>
|
||||
<el-option v-for="plan in planListOption" :key="plan.planId" :label="plan.planName" :value="plan.planId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货单名称" prop="waybillName">
|
||||
<el-input v-model="form.waybillName" placeholder="请输入发货单名称" />
|
||||
</el-form-item>
|
||||
@@ -147,6 +153,7 @@
|
||||
<script>
|
||||
import { listDeliveryWaybill, getDeliveryWaybill, delDeliveryWaybill, addDeliveryWaybill, updateDeliveryWaybill, updateDeliveryWaybillStatus } from "@/api/wms/deliveryWaybill";
|
||||
import { listSelectableCoils } from "@/api/wms/deliveryPlan"; // 导入发货计划API
|
||||
import { listDeliveryPlan } from "@/api/wms/deliveryPlan";
|
||||
import { listCoilByIds } from "@/api/wms/coil";
|
||||
import { listDeliveryWaybillDetail } from "@/api/wms/deliveryWaybillDetail";
|
||||
import MemoInput from "@/components/MemoInput";
|
||||
@@ -154,7 +161,7 @@ import DeliveryWaybillDetail from "../components/detailTable.vue";
|
||||
import WayBill from "../components/wayBill.vue";
|
||||
import PlanList from "../components/planList.vue";
|
||||
import WayBill2 from "../components/wayBill2.vue";
|
||||
|
||||
import PlanSelector from "../components/planSelector.vue";
|
||||
|
||||
export default {
|
||||
name: "DeliveryWaybill",
|
||||
@@ -163,7 +170,8 @@ export default {
|
||||
DeliveryWaybillDetail,
|
||||
WayBill,
|
||||
PlanList,
|
||||
WayBill2
|
||||
WayBill2,
|
||||
PlanSelector
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -194,6 +202,8 @@ export default {
|
||||
printType: 0,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 发货计划列表
|
||||
planListOption: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -228,6 +238,7 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadPlanList();
|
||||
this.getList();
|
||||
},
|
||||
computed: {
|
||||
@@ -242,6 +253,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
/** 查询发货单列表 */
|
||||
loadPlanList() {
|
||||
listDeliveryPlan({ pageSize: 100, pageNum: 1, planType: 0 }).then(response => {
|
||||
this.planListOption = response.rows || [];
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 确保查询参数包含planId
|
||||
@@ -430,9 +446,9 @@ export default {
|
||||
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 打印发货单 */
|
||||
handlePrint(row) {
|
||||
handlePrint(row, printType) {
|
||||
this.loading = true;
|
||||
this.printType = 0;
|
||||
this.printType = printType || 0;
|
||||
// 获取发货单明细
|
||||
listDeliveryWaybillDetail({
|
||||
waybillId: row.waybillId,
|
||||
@@ -464,7 +480,7 @@ export default {
|
||||
const actualWahouseNames = [...new Set(response.rows.filter(item => Boolean(item.actualWarehouseName)).map(item => item.actualWarehouseName.slice(0, 3)))].join(';');
|
||||
this.currentWaybill = {
|
||||
...row,
|
||||
pickupLocation: actualWahouseNames || '',
|
||||
pickupLocation: (actualWahouseNames || '') + ';共' + this.currentWaybillDetails.length + '卷,合计' + this.currentWaybillDetails.reduce((acc, item) => acc + parseFloat(item.weight), 0).toFixed(3) + '吨',
|
||||
};
|
||||
this.currentWaybillDetails = this.currentWaybillDetails.map(item => {
|
||||
const actualWarehouseName = response.rows.find(detail => detail.coilId === item.coilId)?.actualWarehouseName || '';
|
||||
@@ -487,64 +503,6 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 打印发货单 */
|
||||
handlePrintSimple(row) {
|
||||
this.loading = true;
|
||||
this.printType = 1;
|
||||
// 获取发货单明细
|
||||
listDeliveryWaybillDetail({
|
||||
waybillId: row.waybillId,
|
||||
pageNum: 1,
|
||||
pageSize: 1000 // 获取所有明细
|
||||
}).then(response => {
|
||||
// 处理字段映射,确保与wayBill组件使用的字段名一致
|
||||
this.currentWaybillDetails = response.rows.map(item => ({
|
||||
coilId: item.coilId,
|
||||
productName: item.productName,
|
||||
edgeType: item.edgeType,
|
||||
packageType: item.packaging, // 映射packaging到packageType
|
||||
settlementType: item.settlementType,
|
||||
rawMaterialFactory: item.rawMaterialFactory,
|
||||
coilNumber: item.coilNo, // 映射coilNo到coilNumber
|
||||
specification: item.specification,
|
||||
material: item.material,
|
||||
quantity: item.quantity,
|
||||
weight: item.weight,
|
||||
unitPrice: item.unitPrice || '',
|
||||
// 单价为空时,显示为空字符串
|
||||
remark: item.remark
|
||||
}));
|
||||
const coils = this.currentWaybillDetails.map(item => item.coilId).join(',');
|
||||
if (coils) {
|
||||
listCoilByIds(coils).then(response => {
|
||||
// 取前三位, 然后去抽后用;连接
|
||||
// 设置当前发货单
|
||||
const actualWahouseNames = [...new Set(response.rows.filter(item => Boolean(item.actualWarehouseName)).map(item => item.actualWarehouseName.slice(0, 3)))].join(';');
|
||||
this.currentWaybill = {
|
||||
...row,
|
||||
pickupLocation: actualWahouseNames || '',
|
||||
};
|
||||
this.currentWaybillDetails = this.currentWaybillDetails.map(item => {
|
||||
const actualWarehouseName = response.rows.find(detail => detail.coilId === item.coilId)?.actualWarehouseName || '';
|
||||
return {
|
||||
...item,
|
||||
actualWarehouseName: actualWarehouseName,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
this.currentWaybill = {
|
||||
...row,
|
||||
};
|
||||
this.printDialogVisible = true;
|
||||
this.loading = false;
|
||||
|
||||
}).catch(error => {
|
||||
console.error('获取发货单明细失败:', error);
|
||||
this.$modal.msgError('获取发货单明细失败');
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
297
klp-ui/src/views/wms/report/merge/index.vue
Normal file
297
klp-ui/src/views/wms/report/merge/index.vue
Normal file
@@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading">
|
||||
<el-row>
|
||||
<el-form label-width="80px" inline>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker style="width: 200px;" v-model="queryParams.startTime" type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择开始时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker style="width: 200px;" v-model="queryParams.endTime" type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择结束时间"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||
<el-input style="width: 200px; display: inline-block;" v-model="queryParams.enterCoilNo"
|
||||
placeholder="请输入入场钢卷号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="itemSpecification">
|
||||
<memo-input style="width: 200px;" v-model="queryParams.itemSpecification" storageKey="coilSpec"
|
||||
placeholder="请选择规格" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="材质" prop="itemMaterial">
|
||||
<muti-select style="width: 200px;" v-model="queryParams.itemMaterial" :options="dict.type.coil_material"
|
||||
placeholder="请选择材质" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="itemManufacturer">
|
||||
<muti-select style="width: 200px;" v-model="queryParams.itemManufacturer"
|
||||
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getList">查询</el-button>
|
||||
<el-button type="primary" @click="exportData">导出产出钢卷</el-button>
|
||||
<el-button type="primary" @click="exportLossData">导出消耗钢卷</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<el-descriptions title="统计信息" :column="3" border>
|
||||
<el-descriptions-item label="产出数量">{{ summary.outCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="产出总重">{{ summary.outTotalWeight }}t</el-descriptions-item>
|
||||
<el-descriptions-item label="产出均重">{{ summary.outAvgWeight }}t</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="消耗数量">{{ summary.lossCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="消耗总重">{{ summary.lossTotalWeight }}t</el-descriptions-item>
|
||||
<el-descriptions-item label="消耗均重">{{ summary.lossAvgWeight }}t</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="合计数量">{{ summary.totalCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="合计总重">{{ summary.totalWeight }}t</el-descriptions-item>
|
||||
<el-descriptions-item label="合计均重">{{ summary.totalAvgWeight }}t</el-descriptions-item>
|
||||
|
||||
<!-- 成品率 -->
|
||||
<el-descriptions-item label="成品率">{{ summary.passRate }}</el-descriptions-item>
|
||||
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
|
||||
<!-- 异常率 -->
|
||||
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions title="明细信息" :column="3" border>
|
||||
</el-descriptions>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="投入钢卷" name="loss">
|
||||
<el-table :data="lossList" border height="calc(100vh - 320px)">
|
||||
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
|
||||
<template slot-scope="scope">
|
||||
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
|
||||
<template slot-scope="scope">
|
||||
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||
<!-- <el-table-column label="实际库区" align="center" prop="actualWarehouseName" /> -->
|
||||
<el-table-column label="产品类型" align="center" width="250">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
|
||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="重量 (吨)" align="center" prop="netWeight" />
|
||||
<el-table-column label="长度 (米)" align="center" prop="length" />
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="产出钢卷" name="output">
|
||||
<el-table :data="outList" border height="calc(100vh - 320px)">
|
||||
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
|
||||
<template slot-scope="scope">
|
||||
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
|
||||
<template slot-scope="scope">
|
||||
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
|
||||
<el-table-column label="产品类型" align="center" width="250">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
|
||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="重量 (吨)" align="center" prop="netWeight" />
|
||||
<el-table-column label="长度 (米)" align="center" prop="length" />
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="出库状态" align="center" prop="status">
|
||||
<!-- 0在库,1已出库 -->
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.status === 0 ? '在库' : '已出库' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCoilWithIds } from "@/api/wms/coil";
|
||||
import {
|
||||
listPendingAction,
|
||||
} from '@/api/wms/pendingAction';
|
||||
import MemoInput from "@/components/MemoInput";
|
||||
import MutiSelect from "@/components/MutiSelect";
|
||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||
import { calcSummary } from "@/views/wms/report/js/calc";
|
||||
|
||||
export default {
|
||||
name: 'MergeTemplate',
|
||||
props: {
|
||||
actionType: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MemoInput,
|
||||
MutiSelect,
|
||||
ProductInfo,
|
||||
RawMaterialInfo,
|
||||
CoilNo,
|
||||
},
|
||||
dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'],
|
||||
data() {
|
||||
// 工具函数:个位数补零
|
||||
const addZero = (num) => num.toString().padStart(2, '0')
|
||||
|
||||
// 获取当前日期(默认选中当天)
|
||||
const now = new Date()
|
||||
const currentDate = `${now.getFullYear()}-${addZero(now.getMonth() + 1)}`
|
||||
|
||||
/**
|
||||
* 生成指定日期/月份的时间范围字符串
|
||||
* @param {string} dateStr - 支持格式:yyyy-MM(月份) 或 yyyy-MM-dd(具体日期)
|
||||
* @returns {object} 包含start(开始时间)和end(结束时间)的对象
|
||||
*/
|
||||
const getDayTimeRange = (dateStr) => {
|
||||
// 先校验输入格式是否合法
|
||||
const monthPattern = /^\d{4}-\d{2}$/; // yyyy-MM 正则
|
||||
const dayPattern = /^\d{4}-\d{2}-\d{2}$/; // yyyy-MM-dd 正则
|
||||
|
||||
if (!monthPattern.test(dateStr) && !dayPattern.test(dateStr)) {
|
||||
throw new Error('输入格式错误,请传入 yyyy-MM 或 yyyy-MM-dd 格式的字符串');
|
||||
}
|
||||
|
||||
let startDate, endDate;
|
||||
|
||||
if (monthPattern.test(dateStr)) {
|
||||
// 处理 yyyy-MM 格式:获取本月第一天和最后一天
|
||||
const [year, month] = dateStr.split('-').map(Number);
|
||||
// 月份是0基的(0=1月,1=2月...),所以要减1
|
||||
// 第一天:yyyy-MM-01
|
||||
startDate = `${dateStr}-01`;
|
||||
// 最后一天:通过 new Date(year, month, 0) 计算(month是原始月份,比如2代表2月,传2则取3月0日=2月最后一天)
|
||||
const lastDayOfMonth = new Date(year, month, 0).getDate();
|
||||
endDate = `${dateStr}-${lastDayOfMonth.toString().padStart(2, '0')}`;
|
||||
} else {
|
||||
// 处理 yyyy-MM-dd 格式:直接使用传入的日期
|
||||
startDate = dateStr;
|
||||
endDate = dateStr;
|
||||
}
|
||||
|
||||
// 拼接时间部分
|
||||
return {
|
||||
start: `${startDate} 00:00:00`,
|
||||
end: `${endDate} 23:59:59`
|
||||
};
|
||||
};
|
||||
|
||||
const { start, end } = getDayTimeRange(currentDate)
|
||||
return {
|
||||
lossList: [],
|
||||
outList: [],
|
||||
activeTab: 'loss',
|
||||
loading: false,
|
||||
queryParams: {
|
||||
startTime: start,
|
||||
endTime: end,
|
||||
enterCoilNo: '',
|
||||
currentCoilNo: '',
|
||||
warehouseId: '',
|
||||
itemName: '',
|
||||
itemSpecification: '',
|
||||
itemMaterial: '',
|
||||
itemManufacturer: '',
|
||||
pageSize: 9999,
|
||||
pageNum: 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
summary() {
|
||||
return calcSummary(this.outList, this.lossList)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.handleQuery()
|
||||
},
|
||||
methods: {
|
||||
handleQuery() {
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
this.loading = true;
|
||||
const res1 = await listPendingAction({ ...this.queryParams, actionType: 201, actionStatus: 2 });
|
||||
const res2 = await listPendingAction({ ...this.queryParams, actionType: 202, actionStatus: 2 });
|
||||
|
||||
const res3 = await listPendingAction({ ...this.queryParams, actionType: 203, actionStatus: 2 });
|
||||
const res4 = await listPendingAction({ ...this.queryParams, actionType: 204, actionStatus: 2 });
|
||||
const res5 = await listPendingAction({ ...this.queryParams, actionType: 205, actionStatus: 2 });
|
||||
const res6 = await listPendingAction({ ...this.queryParams, actionType: 206, actionStatus: 2 });
|
||||
|
||||
const res = res1.rows.concat(res2.rows, res3.rows, res4.rows, res5.rows, res6.rows);
|
||||
// 获取两层数据
|
||||
const lossIds = res.map(item => item.coilId);
|
||||
// 使用new Set去重
|
||||
const outIds = [...new Set(res.map(item => item.processedCoilIds))];
|
||||
|
||||
if (lossIds.length === 0 || outIds.length === 0) {
|
||||
this.$message({
|
||||
message: '查询结果为空',
|
||||
type: 'warning'
|
||||
})
|
||||
this.loading = false;
|
||||
return
|
||||
}
|
||||
|
||||
const [lossRes, outRes] = await Promise.all([
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '' }),
|
||||
listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '' }),
|
||||
]);
|
||||
this.lossList = lossRes.rows;
|
||||
this.outList = outRes.rows;
|
||||
this.loading = false;
|
||||
},
|
||||
// 导出
|
||||
exportData() {
|
||||
if (this.outList.length === 0) {
|
||||
this.$message.warning('暂无数据可导出')
|
||||
return
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.outList.map(item => item.coilId).join(',')
|
||||
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
exportLossData() {
|
||||
if (this.lossList.length === 0) {
|
||||
this.$message.warning('暂无数据可导出')
|
||||
return
|
||||
}
|
||||
this.download('wms/materialCoil/export', {
|
||||
coilIds: this.lossList.map(item => item.coilId).join(',')
|
||||
}, `materialCoil_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
Reference in New Issue
Block a user