质量报表添加日期缓存

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

View File

@@ -4,11 +4,11 @@
<div>
<el-form :model="search" inline size="mini" label-width="80px">
<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-form-item>
<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-form-item>
<el-form-item label="工单号">
@@ -189,7 +189,7 @@
downloadStatisticsTableExcel
} from '@/api/qualityManagement/qualityStatistics_V2'
export default {
name: 'qualityStatistics',
name: 'QualityStatistics',
data() {
return {
inputWidth: '180px',
@@ -219,8 +219,8 @@
}, ],
},
search: {
starttime: new Date(new Date(new Date().toLocaleDateString()).getTime()),
endtime: new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1),
starttime: null,
endtime: null,
team: null,
workorderid: 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() {
this.getList()
},
created() {},
created() {
this.init();
},
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 设置表合并行
mergeTable(num) {
this.mergeCells = []
@@ -455,13 +496,13 @@
$table.resetColumn();
this.resetMergeTable();
},
resetMergeTable(){
if(this.search.reportType === 3){
resetMergeTable() {
if (this.search.reportType === 3) {
this.mergeTable(2);
}else{
} else {
this.mergeTable(3);
}
},
// 删除数据
removeData(row) {