yudao-dev/src/views/Environmental/Envi-yure-log.vue
2025-02-24 14:07:38 +08:00

122 lines
2.6 KiB
Vue

<!--
* @Author: zwq
* @Date: 2024-11-13 14:01:16
* @LastEditors: zwq
* @LastEditTime: 2025-02-21 14:32:08
* @Description:
-->
<template>
<div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH" />
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import { yurepage } from '@/api/environmental/environmentalLog';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recordTime',
label: '记录时间',
filter: parseTime,
},
{
prop: 'remark',
label: '备注',
},
{
prop: 'usingQuantity',
label: '发电量',
filter: (val) => (val != null ? Number(val).toFixed(3) : '-'),
},
];
export default {
name: '',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: yurepage,
},
formConfig: [
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
width: 350,
param: 'searchTime',
clearable: false,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
tableProps,
tableData: [],
};
},
components: {},
created() {
const end = new Date();
const start = new Date();
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.$nextTick(() => {
this.$refs.searchBarForm.formInline.searchTime = [
this.listQuery.startTime,
this.listQuery.endTime,
];
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 20;
this.listQuery.statisticType = 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime ? val.searchTime[1] : null;
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style lang="scss"></style>