<template>
	<el-dialog class="dxkq_dialog" :visible.sync="dialogVisible" top="10vh" width="70%" :before-close="handleClose">
        <br>
		<el-table :data="tableList" height="58vh">
			<el-table-column property="deviceid" label="检测设备"></el-table-column>
			<el-table-column property="value" label="监测值"></el-table-column>
			<el-table-column property="location" label="安装位置"></el-table-column>
			<el-table-column property="acquisitionTime" label="时间"></el-table-column>
		</el-table>
		<el-pagination layout="prev, pager, next" background :total="comm_total || 0" @current-change="currentChange"></el-pagination>
	</el-dialog>
</template>

<script>
import { environment } from '@/api/weikuangku'
import { getValueUnit, getCompanyCodes } from '@/utils'
export default {
	data() {
		return {
			dialogVisible: false,
			tableList: [],
			comm_total: 0,
			page_index: 0,
		}
	},

	methods: {
		handleClose() {
			this.dialogVisible = false
		},

		environmentData() {
			var componyName = this.$store.state.compony_info.name;
			var companycode = getCompanyCodes()[componyName];
			const params = {
				page: this.page_index,
				size: 10,
				sort: 'id,desc',
                item: '可燃气体',
				companycode:companycode,
			}
			environment(params).then(res => {
				let content = res.content
				this.tableList = content
				this.comm_total = res.totalElements
			})
		},

		currentChange(e) {
			this.page_index = e - 1
			this.environmentData()
		},
	},

	computed: {
		isDxkqDialog() {
			return this.$store.state.isDxkqDialog
		},
	},

	watch: {
		isDxkqDialog(e) {
			this.dialogVisible = true
            this.environmentData()
		},
	},
}
</script>

<style lang="scss">
.dxkq_dialog {
	.charts_div {
		margin-top: 2vh;
		height: 68vh;
	}

	// .el-dialog,
	// .el-pager li {
	// 	background-color: #040624;
	// }
}
</style>
