From e8377ebeabf09c9a8d3397274b03dc02945c8dc7 Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期四, 28 八月 2025 14:23:54 +0800 Subject: [PATCH] 导出时间 --- manager/src/views/prize-grant-record/index.vue | 71 +++++++++++++++++++++++++++++------ 1 files changed, 58 insertions(+), 13 deletions(-) diff --git a/manager/src/views/prize-grant-record/index.vue b/manager/src/views/prize-grant-record/index.vue index 505710b..cd2a438 100644 --- a/manager/src/views/prize-grant-record/index.vue +++ b/manager/src/views/prize-grant-record/index.vue @@ -30,7 +30,7 @@ style="width: 180px" /> </FormItem> - <FormItem label="涓鐘舵��" prop="beginTime"> + <FormItem label="涓鐘舵��" prop="grantStatus"> <Select v-model="searchForm.grantStatus" placeholder="璇烽�夋嫨涓鐘舵��" @@ -48,7 +48,16 @@ </Option> </Select> </FormItem> - + <FormItem label="鎶ュ悕寮�濮嬫椂闂�" prop="time"> + <DatePicker + v-model="time" + type="datetimerange" + placeholder="閫夋嫨寮�濮嬫椂闂�" + style="width: 180px" + @on-clear="handleSearch" + @on-change="handleSearch" + ></DatePicker> + </FormItem> <Button @click="handleSearch" type="primary" @@ -179,6 +188,7 @@ modelShow:false, modelTitle:'', loading:false, + time:[], columns:[ { title: '鐢ㄦ埛鏄电О', @@ -212,6 +222,16 @@ } }, { + title: '鎶藉鏃堕棿', + key: 'createTime', + minWidth: 100, + render: (h, params) => { + return h('div', [ + h('div', `${this.formatDate(params.row.createTime,'YYYY-MM-DD HH:mm:ss')}`), + ]) + } + }, + { title: '鎿嶄綔', slot: 'action', width: 280, @@ -226,7 +246,9 @@ pageNumber:1, nickName:'', activityName:'', - grantStatus:'' + grantStatus:'', + startTime:'', + endTime:'' }, typeSelect:[ {id: 1, value: 'SUCCESS', label: '鍙戞斁鎴愬姛'}, @@ -245,6 +267,28 @@ this.init(); }, methods: { + formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') { + if (!date) return ''; + + const d = new Date(date); + if (isNaN(d.getTime())) return ''; + + const padZero = (num) => String(num).padStart(2, '0'); // 鏇村彲闈犵殑琛ラ浂鏂规硶 + + const year = d.getFullYear(); + const month = padZero(d.getMonth() + 1); // 鏈堜唤 0-11 鈫� +1 + const day = padZero(d.getDate()); + const hours = padZero(d.getHours()); + const minutes = padZero(d.getMinutes()); + const seconds = padZero(d.getSeconds()); + return format + .replace('YYYY', year) + .replace('MM', month) + .replace('DD', day) + .replace('HH', hours) + .replace('mm', minutes) + .replace('ss', seconds); + }, queryExport(){ queryExport(this.searchForm).then(res =>{ const blob = new Blob([res], { @@ -279,6 +323,9 @@ resetSearch(){ this.$refs.searchForm.resetFields() this.searchForm.pageNumber = 1 + this.searchForm.startTime = ''; + this.searchForm.endTime = ''; + this.time =[]; this.getPage() }, infoModelClose(){ @@ -305,11 +352,8 @@ }, handleSearch(type,value){ - if (type === 'beginTime') { - this.searchForm.beginTime = value - } else if (type === 'endTime') { - this.searchForm.endTime = value - } + this.searchForm.startTime = this.formatDate(this.time[0]); + this.searchForm.endTime = this.formatDate(this.time[1]); this.getPage() }, @@ -317,14 +361,15 @@ init() { this.getPage() }, - changePage(){ + changePage(page){ + this.searchForm.pageNumber = page + this.getPage() + }, + changePageSize(pageSize){ this.searchForm.pageNumber = 1 this.searchForm.pageSize = pageSize this.getPage() - }, - changePageSize(){ - this.searchForm.pageNumber = page - this.getPage() + }, }, -- Gitblit v1.8.0