<template>
	<!-- 位置信息管理 -->
	<div class="pricemoitorrecord">
		<a-card :bordered="false">
			<a-space class="search">
				<div class="silt-title">
					<span style="width: 70px; margin-right: 8px; text-align: right; display: block; line-height: 30px">{{
						'预警时间'
					}}</span>
					<a-range-picker
						style="width: 450px"
						v-model:value="startWarningTimeDEl"
						@change="changng"
						valueFormat="YYYY-MM-DD HH:mm:ss"
					/>
				</div>
				<div class="btnBox">
					<a-button type="primary" class="primarySele" @click="Search"> 查询 </a-button>
					<a-button class="snowy-buttom-left primarySele" @click="onReset"> 重置 </a-button>
				</div>
			</a-space>
		</a-card>

		<div class="list" style="margin-top: 10px">
			<a-table :dataSource="tableData" :pagination="pagination" :columns="tableColumns">
				<template #bodyCell="{ column, record }">
					<template v-if="column.dataIndex == 'equipmentType'">
						<div v-if="record.equipmentType == 1">消防水箱</div>
						<div v-if="record.equipmentType == 2">消防水池</div>
					</template>
				</template>
			</a-table>
		</div>
	</div>
</template>
<script setup>
	import business from '@/api/security/index.js'
	import { listPagination } from '@/hook/listlistPagination.js'

	import { reactive, ref } from 'vue'
	import { useRouter } from 'vue-router'
	import { defineComponent } from 'vue'
	const formRef = ref(null)
	const router = useRouter()
	const tableColumns = [
		{
			title: '序号',
			dataIndex: 'Index',
			align: 'center',
			width: '5%',
			customRender: ({ text, record, index }) => {
				return `${index + 1}`
			}
		},
		{ title: '库区名称', align: 'center', dataIndex: 'orgName' },
		{ title: '设备类型', align: 'center', dataIndex: 'equipmentType' },
		{ title: '用水状态', align: 'center', dataIndex: 'waterUsageStatus' },
		{ title: '实时液位', align: 'center', dataIndex: 'realTimeWaterLevel' },
		{ title: '预警液位', align: 'center', dataIndex: 'warningWaterLevel' },
		{ title: '预警时间', align: 'center', dataIndex: 'warningTime' }
	]

	const { DEl, change, tableData, onSearch, handlePageChange, pagination, SearchFormDel } = listPagination(
		{ startWarningTime: '' },
		business.XFSYGLedit,
		{},
		{ sortOrder: 'ASCEND' }
	) 

	const startWarningTimeDEl = ref([])
	const changng = (v) => {
		startWarningTimeDEl.value = v
	}
	const Search = () => {
		pagination.current = 1
		pagination.pageSize = 5
		onSearch({
			startWarningTime: startWarningTimeDEl.value[0] || '',
			endWarningTime: startWarningTimeDEl.value[1] || ''
		})
	}
	const onReset = () => {
		startWarningTimeDEl.value[0] = ''
		startWarningTimeDEl.value[1] = ''
		pagination.current = 1
		pagination.pageSize = 5
		onSearch()
	}
</script>
<style lang="less" scoped>
	.search {
		padding-top: 20px;
		padding-left: 50px;
		margin-bottom: 32px;
		.btnBox {
			width: 100%;
			display: inline-block;
			display: flex;
			justify-content: space-around;
			align-items: center;
			.primarySele {
				margin-left: 20px;
				margin-right: 20px;
			}
		}
	}
	.silt-title {
		display: flex;
	}
</style>
