质量报表添加日期缓存

This commit is contained in:
2024-07-02 13:24:47 +08:00
parent 14e5a8e85b
commit 678fa7d902

View File

@@ -4,11 +4,11 @@
<div> <div>
<el-form :model="search" inline size="mini" label-width="80px"> <el-form :model="search" inline size="mini" label-width="80px">
<el-form-item label="开始日期"> <el-form-item label="开始日期">
<el-date-picker :style="{ width: inputWidth }" v-model="search.starttime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions"> <el-date-picker :clearable="false" :style="{ width: inputWidth }" v-model="search.starttime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="结束日期"> <el-form-item label="结束日期">
<el-date-picker :style="{ width: inputWidth }" v-model="search.endtime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions"> <el-date-picker :clearable="false" :style="{ width: inputWidth }" v-model="search.endtime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="工单号"> <el-form-item label="工单号">
@@ -189,7 +189,7 @@
downloadStatisticsTableExcel downloadStatisticsTableExcel
} from '@/api/qualityManagement/qualityStatistics_V2' } from '@/api/qualityManagement/qualityStatistics_V2'
export default { export default {
name: 'qualityStatistics', name: 'QualityStatistics',
data() { data() {
return { return {
inputWidth: '180px', inputWidth: '180px',
@@ -219,8 +219,8 @@
}, ], }, ],
}, },
search: { search: {
starttime: new Date(new Date(new Date().toLocaleDateString()).getTime()), starttime: null,
endtime: new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1), endtime: null,
team: null, team: null,
workorderid: null, workorderid: null,
partnumber: null, partnumber: null,
@@ -284,11 +284,52 @@
}, },
} }
}, },
watch: {
'search.starttime'(newValue, oldValue) {
if (newValue != null && newValue != oldValue) {
try {
window.sessionStorage.setItem('QualityStatisticsStartTime', JSON.stringify(newValue))
} catch (err) {
}
}
},
'search.endtime'(newValue, oldValue) {
if (newValue != null && newValue != oldValue) {
try {
window.sessionStorage.setItem('QualityStatisticsEndTime', JSON.stringify(newValue))
} catch (err) {
}
}
}
},
mounted() { mounted() {
this.getList() this.getList()
}, },
created() {}, created() {
this.init();
},
methods: { methods: {
init() {
const QualityStatisticsStartTime = JSON.parse(window.sessionStorage.getItem("QualityStatisticsStartTime"));
const QualityStatisticsEndTime = JSON.parse(window.sessionStorage.getItem("QualityStatisticsEndTime"));
if (this.search.starttime == null) {
if (QualityStatisticsStartTime) {
this.search.starttime = QualityStatisticsStartTime;
} else {
this.search.starttime = this.$dayjs().startOf('day').toDate();
}
}
if (this.search.endtime == null) {
if (QualityStatisticsEndTime) {
this.search.endtime = QualityStatisticsEndTime;
} else {
this.search.endtime = this.$dayjs().endOf('day').toDate();
}
}
},
//todo 设置表合并行 //todo 设置表合并行
mergeTable(num) { mergeTable(num) {
this.mergeCells = [] this.mergeCells = []
@@ -455,13 +496,13 @@
$table.resetColumn(); $table.resetColumn();
this.resetMergeTable(); this.resetMergeTable();
}, },
resetMergeTable(){ resetMergeTable() {
if(this.search.reportType === 3){ if (this.search.reportType === 3) {
this.mergeTable(2); this.mergeTable(2);
}else{ } else {
this.mergeTable(3); this.mergeTable(3);
} }
}, },
// 删除数据 // 删除数据
removeData(row) { removeData(row) {