20250523-预约记录页面1.筛选加日期选择范围,2.前面列表加序号

This commit is contained in:
luoyu 2025-05-23 14:22:55 +08:00
parent b57bf57af5
commit c0b8ea896d

View File

@ -237,7 +237,9 @@ export default {
queryParam: { queryParam: {
status: '', status: '',
sort: '', sort: '',
name: '' name: '',
startDate: '',
endDate: ''
}, },
// //
columns: [ columns: [
@ -289,11 +291,18 @@ export default {
loadData: parameter => { loadData: parameter => {
// this.queryParam.name = this.$route.params.roomId // this.queryParam.name = this.$route.params.roomId
let chooseDate = this.queryParam.chooseDate let chooseDate = this.queryParam.chooseDate
if (chooseDate) { if (chooseDate && chooseDate.length === 2) {
// this.queryParam.startDate = chooseDate[0].format('YYYY-MM-DD')
this.queryParam.endDate = chooseDate[1].format('YYYY-MM-DD')
this.queryParam.filterDate = ''
} else if (chooseDate && chooseDate.length === 1) {
this.queryParam.filterDate = chooseDate[0].format('YYYY-MM-DD') this.queryParam.filterDate = chooseDate[0].format('YYYY-MM-DD')
this.queryParam.startDate = ''
this.queryParam.endDate = ''
} else { } else {
this.queryParam.filterDate = '' this.queryParam.filterDate = ''
this.queryParam.startDate = ''
this.queryParam.endDate = ''
} }
if (this.isAdmin) { if (this.isAdmin) {
this.queryParam.role = 5 this.queryParam.role = 5
@ -423,9 +432,30 @@ export default {
methods: { methods: {
onChangeTime(date, dateString) { onChangeTime(date, dateString) {
this.queryParam.chooseDate = date this.queryParam.chooseDate = date
if (date && date.length === 2) {
this.queryParam.startDate = date[0].format('YYYY-MM-DD')
this.queryParam.endDate = date[1].format('YYYY-MM-DD')
this.queryParam.filterDate = ''
} else if (date && date.length === 1) {
this.queryParam.filterDate = date[0].format('YYYY-MM-DD')
this.queryParam.startDate = ''
this.queryParam.endDate = ''
} else {
this.queryParam.filterDate = ''
this.queryParam.startDate = ''
this.queryParam.endDate = ''
}
}, },
reset() { reset() {
this.queryParam = { status: '' } this.queryParam = {
status: '',
sort: '',
name: '',
startDate: '',
endDate: '',
filterDate: ''
}
this.queryParam.chooseDate = null
this.$refs.table.refresh(true) this.$refs.table.refresh(true)
}, },
// //
@ -577,40 +607,61 @@ export default {
exportOrderList() { exportOrderList() {
let chooseDate = this.queryParam.chooseDate let chooseDate = this.queryParam.chooseDate
let filterDate = '' let filterDate = ''
if (chooseDate) { let startDate = ''
filterDate = chooseDate.format('YYYY-MM-DD') let endDate = ''
if (chooseDate && chooseDate.length === 2) {
startDate = chooseDate[0].format('YYYY-MM-DD')
endDate = chooseDate[1].format('YYYY-MM-DD')
} else if (chooseDate && chooseDate.length === 1) {
filterDate = chooseDate[0].format('YYYY-MM-DD')
} else { } else {
filterDate = ''
}
if (filterDate == '') {
this.$message.error('请选择会议预约时间') this.$message.error('请选择会议预约时间')
return return
} }
expMRByDate({ expMRByDate({
'filterDate': filterDate, 'filterDate': filterDate,
'startDate': startDate,
'endDate': endDate,
'userOrg': this.queryParam.userOrg, 'userOrg': this.queryParam.userOrg,
'title': this.queryParam.title, 'title': this.queryParam.title,
'status': this.queryParam.status 'status': this.queryParam.status
}).then(res => { }).then(res => {
this.exportExcel(chooseDate.format('YYYYMMDD') + '会议室预约记录', res) let fileName = ''
if (startDate && endDate) {
fileName = startDate + '至' + endDate + '会议室预约记录'
} else {
fileName = filterDate + '会议室预约记录'
}
this.exportExcel(fileName, res)
}) })
}, },
exportMonthOrder() { exportMonthOrder() {
let chooseDate = this.queryParam.chooseDate let chooseDate = this.queryParam.chooseDate
let filterDate = '' let filterDate = ''
if (chooseDate) { let startMonth = ''
filterDate = chooseDate.format('YYYY-MM') let endMonth = ''
} else {
filterDate = '' if (chooseDate && chooseDate.length === 2) {
startMonth = chooseDate[0].format('YYYY-MM')
endMonth = chooseDate[1].format('YYYY-MM')
if (startMonth !== endMonth) {
this.$message.error('月度汇总请选择同一个月的日期范围')
return
} }
if (filterDate == '') { filterDate = startMonth
} else if (chooseDate && chooseDate.length === 1) {
filterDate = chooseDate[0].format('YYYY-MM')
} else {
this.$message.error('请选择会议预约时间') this.$message.error('请选择会议预约时间')
return return
} }
expMRByMonth({ expMRByMonth({
'month': filterDate 'month': filterDate
}).then(res => { }).then(res => {
this.exportExcel(chooseDate.format('YYYYMM') + '月度会议汇总', res) this.exportExcel(filterDate + '月度会议汇总', res)
}) })
}, },
exportExcel(filename, res) { exportExcel(filename, res) {