1.移除查询二 日期范围必填校验
main^2
liuhr 12 months ago
parent 0b7ca5b764
commit cfeb7c1b6f

@ -23,9 +23,8 @@
</div>
<!-- 搜索条件 -->
<div class="col-xl-2 col-lg-2 col-sm-3">
<q-input dense label="日期范围" ref="rangDateRef" readonly outlined v-model="rangDateText" :rules="[
(val: string) => (val !== null && val !== '' && val !== undefined) || '请选择日期范围',
]">
<!-- :rules="[ (val: string) => (val !== null && val !== '' && val !== undefined) || '请选择日期范围']" -->
<q-input dense label="日期范围" ref="rangDateRef" readonly outlined v-model="rangDateText">
<template v-slot:append>
<q-icon name="event" class="cursor-pointer">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
@ -169,7 +168,7 @@ const onRequest = (props: any) => {
const pagination = ref(new Pagination(new EquipmentRecord()));
const getPage = () => {
rangDateRef.value.resetValidation();
// rangDateRef.value.resetValidation();
if (rangeDate.value) {
pagination.value.data.begTime = rangeDate.value.from + ' 00:00:00';
pagination.value.data.endTime = rangeDate.value.to + ' 23:59:59';
@ -233,78 +232,78 @@ const rangeDateUpdate = (value: any, reason: any, details) => {
// Excel
const equipmentNoTimeRecord = ref();
const exportTable = () => {
rangDateRef.value.validate();
if (!rangDateRef.value.hasError) {
//rangDateRef.value.validate();
//if (!rangDateRef.value.hasError) {
if (rangeDate.value) {
let begTime = rangeDate.value.from + ' 00:00:00';
let endTime = rangeDate.value.to + ' 23:59:59';
const diff = date.getDateDiff(new Date(endTime), new Date(begTime), 'days') //
// 30
if (diff > 30) {
Notify.create({
position: 'top',
message: '日期范围不能大于30天',
icon: 'feedback',
color: 'negative',
})
return
}
equipmentNoTimeRecord.value = new EquipmentNoTimeRecord();
equipmentNoTimeRecord.value.begTime = begTime;
equipmentNoTimeRecord.value.endTime = endTime;
}
if (rangeDate.value) {
let begTime = rangeDate.value.from + ' 00:00:00';
let endTime = rangeDate.value.to + ' 23:59:59';
// const diff = date.getDateDiff(new Date(endTime), new Date(begTime), 'days') //
// 30
// if (diff > 30) {
// Notify.create({
// position: 'top',
// message: '30',
// icon: 'feedback',
// color: 'negative',
// })
// return
// }
equipmentNoTimeRecord.value = new EquipmentNoTimeRecord();
equipmentNoTimeRecord.value.begTime = begTime;
equipmentNoTimeRecord.value.endTime = endTime;
}
Dialog.create({
title: '系统提示',
message: '是否导出?',
class: 'text-h7 text-weight-bold',
cancel: true,
persistent: true
}).onOk(() => {
Loading.show({
spinner: QSpinnerIos,
message: '正在导出,请稍等...',
boxClass: 'bg-grey-2 text-grey-9',
spinnerColor: 'primary'
});
Dialog.create({
title: '系统提示',
message: '是否导出?',
class: 'text-h7 text-weight-bold',
cancel: true,
persistent: true
}).onOk(() => {
Loading.show({
spinner: QSpinnerIos,
message: '正在导出,请稍等...',
boxClass: 'bg-grey-2 text-grey-9',
spinnerColor: 'primary'
});
// var d = new Date(); //
// var monthStart = date.formatDate(new Date(d.getFullYear(), d.getMonth(), 1), 'YYYY-MM-DD'); //
// var monthEnd = date.formatDate(new Date(d.getFullYear(), d.getMonth() + 1, 0), 'YYYY-MM-DD'); // 23:59:5
// var d = new Date(); //
// var monthStart = date.formatDate(new Date(d.getFullYear(), d.getMonth(), 1), 'YYYY-MM-DD'); //
// var monthEnd = date.formatDate(new Date(d.getFullYear(), d.getMonth() + 1, 0), 'YYYY-MM-DD'); // 23:59:5
let tableData = [
['序号', '设备编码', '设备名称', '设备类型', '开炉次数', '总运行时长(小时)', '总报警时长(小时)', '总待机时长(小时)']//
] //
let tableData = [
['序号', '设备编码', '设备名称', '设备类型', '开炉次数', '总运行时长(小时)', '总报警时长(小时)', '总待机时长(小时)']//
] //
equipmentRecordApi.getEquipmentRecordTotalList(equipmentNoTimeRecord.value).then((res: any) => {
equipmentRecordApi.getEquipmentRecordTotalList(equipmentNoTimeRecord.value).then((res: any) => {
res.forEach((item: any, index: any) => {
console.log(item, item.name)
let rowData = []
//
rowData = [
index + 1,
item.equipmentCode,
item.equipmentName,
item.equipmentType,
item.furnaceNum,
item.totalRunningTime,
item.totalAlarmTime,
item.totalStopTime
]
tableData.push(rowData)
})
let workSheet = XLSX.utils.aoa_to_sheet(tableData);
let bookNew = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(bookNew, workSheet, 'Sheet1') // 簿
let name = '导出数据' + '.xlsx'
XLSX.writeFile(bookNew, name) //
}).finally(() => {
Loading.hide();
});
}).onCancel(() => { })
}
res.forEach((item: any, index: any) => {
console.log(item, item.name)
let rowData = []
//
rowData = [
index + 1,
item.equipmentCode,
item.equipmentName,
item.equipmentType,
item.furnaceNum,
item.totalRunningTime,
item.totalAlarmTime,
item.totalStopTime
]
tableData.push(rowData)
})
let workSheet = XLSX.utils.aoa_to_sheet(tableData);
let bookNew = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(bookNew, workSheet, 'Sheet1') // 簿
let name = '导出数据' + '.xlsx'
XLSX.writeFile(bookNew, name) //
}).finally(() => {
Loading.hide();
});
}).onCancel(() => { })
// }
}
</script>

Loading…
Cancel
Save