|
|
@@ -55,7 +55,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, ref } from 'vue';
|
|
|
+import { onMounted, onUnmounted, ref } from 'vue';
|
|
|
import { BasicTable, useTable } from '/@/components/Table';
|
|
|
import { Tabs, TabPane } from 'ant-design-vue';
|
|
|
import MiniBoard from '/@/components/Configurable/detail/MiniBoard.vue';
|
|
|
@@ -73,6 +73,7 @@ import formConfig from '/@/components/Form/src/jeecg/components/formCard/formCon
|
|
|
import JPopup from '/@/components/Form/src/jeecg/components/JPopup.vue';
|
|
|
// 引入模拟数据
|
|
|
import { columns, historyColumns, searchFormSchema } from './airLeakStatus.data';
|
|
|
+import dayjs from 'dayjs';
|
|
|
|
|
|
// 激活的Tab页签
|
|
|
const activeTab = ref('realtime');
|
|
|
@@ -96,8 +97,8 @@ const alarmFiled = ref('');
|
|
|
const historyData = ref([]);
|
|
|
const lawDeptOptions = ref([]);
|
|
|
// 注册实时数据表格
|
|
|
-const [registerTable] = useTable({
|
|
|
- dataSource: minesData,
|
|
|
+const [registerTable, { reload }] = useTable({
|
|
|
+ dataSource: ref([]),
|
|
|
title: '密闭漏风状态判定',
|
|
|
api: getProvinceAlarm,
|
|
|
columns,
|
|
|
@@ -139,22 +140,24 @@ const [registerHistoryTable] = useTable({
|
|
|
label: '开始时间',
|
|
|
field: 'startTime',
|
|
|
component: 'DatePicker',
|
|
|
+ defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
componentProps: {
|
|
|
showTime: true,
|
|
|
- // valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
placeholder: '请选择开始时间',
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
},
|
|
|
- colProps: { span: 6 }, // 占比可根据布局调整
|
|
|
+ colProps: { span: 6 },
|
|
|
rules: [{ required: true, message: '请选择开始时间' }],
|
|
|
},
|
|
|
{
|
|
|
label: '结束时间',
|
|
|
field: 'endTime',
|
|
|
component: 'DatePicker',
|
|
|
+ defaultValue: dayjs(),
|
|
|
componentProps: {
|
|
|
showTime: true,
|
|
|
- // valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
placeholder: '请选择结束时间',
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
},
|
|
|
colProps: { span: 6 },
|
|
|
rules: [{ required: true, message: '请选择结束时间' }],
|
|
|
@@ -225,7 +228,11 @@ const [registerHistoryTable] = useTable({
|
|
|
// 弹窗引用
|
|
|
const realtimeModalRef = ref(null);
|
|
|
const historyModalRef = ref(null);
|
|
|
-
|
|
|
+// 定时器
|
|
|
+let timer: IntervalHandle;
|
|
|
+const fetchTableData = async () => {
|
|
|
+ await reload();
|
|
|
+};
|
|
|
// 打开弹窗方法(区分实时/历史)
|
|
|
const openModal = (record, type) => {
|
|
|
if (type === 'realtime') {
|
|
|
@@ -243,17 +250,6 @@ const openModal = (record, type) => {
|
|
|
historyModalRef.value?.showModal(record);
|
|
|
}
|
|
|
};
|
|
|
-// async function fetchAlarmData(id) {
|
|
|
-// const params = {
|
|
|
-// // 填写所需参数
|
|
|
-// alarmType: 'leakageAlarm',
|
|
|
-// mineCodeList: id,
|
|
|
-// pageNo: 1,
|
|
|
-// pageSize: 50,
|
|
|
-// };
|
|
|
-// const result = await getProvinceAlarm(params);
|
|
|
-// minesData.value = result.records;
|
|
|
-// }
|
|
|
async function getAlarmTotalData() {
|
|
|
const params = {
|
|
|
alarmType: 'leakageAlarm',
|
|
|
@@ -320,6 +316,14 @@ onMounted(() => {
|
|
|
getMineDataList();
|
|
|
getEnfMineData();
|
|
|
getAlarmTotalData();
|
|
|
+ timer = setInterval(() => {
|
|
|
+ fetchTableData();
|
|
|
+ }, 5000);
|
|
|
+});
|
|
|
+onUnmounted(() => {
|
|
|
+ if (timer) {
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
});
|
|
|
</script>
|
|
|
|