Files
klp-oa/klp-ui/src/components/TimeInput.vue
砂糖 d6e30d4d50 feat(报表): 新增综合报表模板及M卷统计功能
新增综合报表模板,支持按不同仓库类型展示统计信息。添加M卷处理功能,在统计中自动过滤并计算M卷数据。优化报表展示顺序,默认显示产出钢卷。修复异常率计算问题,完善统计信息展示。

新增仓库特定报表页面,包括镀铬、拉矫、脱脂、双机架、镀锌和酸连轧成品库报表。调整KLPTable组件支持高度设置,优化基础面板显示逻辑。

修复API请求超时问题,统一设置超时时间为10分钟。调整标签显示文本,优化用户体验。
2026-03-20 13:34:56 +08:00

86 lines
2.2 KiB
Vue

<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: true
}
},
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>