refactor(mes/wms): 优化多处日期处理与表格列展示
1. 移除磨工页面字典表格的"值"列 2. 修复TimeInput组件日期格式化逻辑,补全月份日期补零处理 3. 为卷料录入页面添加日期格式化方法,替换直接赋值逻辑并新增生产时长计算
This commit is contained in:
@@ -48,7 +48,10 @@ export default {
|
||||
}
|
||||
const date = new Date(dateTimeStr);
|
||||
if (!isNaN(date.getTime())) {
|
||||
this.dateValue = date.toISOString().split('T')[0];
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
this.dateValue = `${year}-${month}-${day}`;
|
||||
this.hourValue = date.getHours();
|
||||
this.minuteValue = date.getMinutes();
|
||||
}
|
||||
|
||||
@@ -342,7 +342,6 @@
|
||||
</div>
|
||||
<el-table :data="operatorDictList" v-loading="operatorDictLoading" size="small" border style="width:100%">
|
||||
<el-table-column label="姓名" prop="dictLabel" align="center" />
|
||||
<el-table-column label="值" prop="dictValue" align="center" />
|
||||
<el-table-column label="状态" align="center" width="100">
|
||||
<template slot-scope="{row}">
|
||||
<el-tag :type="row.status === '0' ? 'success' : 'danger'" size="mini">
|
||||
|
||||
@@ -179,14 +179,14 @@
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="参考长度(m)" prop="length">
|
||||
<el-input-number :controls="false" v-model="updateForm.length" placeholder="请输入参考长度" type="number"
|
||||
:step="0.001">
|
||||
<template slot="append">米</template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
@@ -641,8 +641,9 @@ export default {
|
||||
if (data.exit_thick != null) this.$set(this.updateForm, 'actualThickness', parseFloat(data.exit_thick))
|
||||
if (data.exit_width != null) this.$set(this.updateForm, 'actualWidth', parseFloat(data.exit_width))
|
||||
|
||||
if (data.start_date) this.$set(this.updateForm, 'productionStartTime', data.start_date)
|
||||
if (data.end_date) this.$set(this.updateForm, 'productionEndTime', data.date)
|
||||
if (data.start_date) this.$set(this.updateForm, 'productionStartTime', this.formatDateTime(data.start_date))
|
||||
if (data.end_date) this.$set(this.updateForm, 'productionEndTime', this.formatDateTime(data.end_date))
|
||||
if (data.start_date || data.end_date) this.calculateProductionDuration()
|
||||
|
||||
const query = {
|
||||
specification: data.exit_thick ? `${data.exit_thick}*${data.exit_width}` : '',
|
||||
@@ -898,6 +899,18 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
// 格式化日期为 yyyy-MM-dd HH:mm:ss
|
||||
formatDateTime(dateStr) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
const hours = String(d.getHours()).padStart(2, '0')
|
||||
const minutes = String(d.getMinutes()).padStart(2, '0')
|
||||
const seconds = String(d.getSeconds()).padStart(2, '0')
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||
},
|
||||
// 格式化毫秒值为xx天xx小时xx分钟
|
||||
formatDuration(milliseconds) {
|
||||
if (!milliseconds || milliseconds < 0) return '';
|
||||
|
||||
Reference in New Issue
Block a user