You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.5 KiB
78 lines
2.5 KiB
2 months ago
|
<script lang="ts" setup>
|
||
|
import { ref } from 'vue'
|
||
|
import moment from 'moment'
|
||
|
|
||
|
import { Card } from 'ant-design-vue'
|
||
|
import { formHistory } from '../exa.data'
|
||
|
import EXAHistoryLine from '../EXAHistoryLine.vue'
|
||
|
|
||
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
||
|
import { BasicForm, useForm } from '@/components/Form'
|
||
|
|
||
|
import { getExaHistorys } from '@/api/alert/exa'
|
||
|
|
||
|
const loading = ref(true)
|
||
|
|
||
|
const itemName = ref('')
|
||
|
|
||
|
const [registerForm, { getFieldsValue }] = useForm({
|
||
|
labelWidth: 100,
|
||
|
// baseColProps: { span: 24 },
|
||
|
schemas: formHistory,
|
||
|
showResetButton: false,
|
||
|
layout: 'horizontal',
|
||
|
model: { time: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')] },
|
||
|
fieldMapToTime: [
|
||
|
// data为时间组件在表单内的字段,startTime,endTime为转化后的开始时间于结束时间
|
||
|
['time', ['startTime', 'endTime'], 'YYYY-MM-DD HH:mm:ss'],
|
||
|
],
|
||
|
actionColOptions: { span: 2 },
|
||
|
})
|
||
|
const historyData = ref()
|
||
|
const legendName = ref<any[]>([])
|
||
|
|
||
|
const [registerHistoryModal, { setModalProps }] = useModalInner(async (data) => {
|
||
|
console.log(543)
|
||
|
setModalProps({ confirmLoading: false, showCancelBtn: false, showOkBtn: false })
|
||
|
itemName.value = data.record.itemName
|
||
|
legendName.value = []
|
||
|
legendName.value.push(`${data.record.descriptor}-${data.record.itemName}`)
|
||
|
handleSubmitR()
|
||
|
// 利用点号去获取历史数据,从而生成曲线
|
||
|
// setFieldsValue({ time: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')] })
|
||
|
// console.log(startTime, endTime, itemName)
|
||
|
// const historyData = getExaHistory({
|
||
|
// startTime,
|
||
|
// endTime,
|
||
|
// itemName: itemName.value,
|
||
|
// })
|
||
|
// isUpdate.value = !!data?.isUpdate
|
||
|
// if (unref(isUpdate)) {
|
||
|
// const res = await getUser(data.record.id)
|
||
|
// setFieldsValue({ ...res })
|
||
|
// }
|
||
|
})
|
||
|
|
||
|
async function handleSubmitR() {
|
||
|
const serachFormData = getFieldsValue()
|
||
|
loading.value = true
|
||
|
const exaHistoryReqVO = {
|
||
|
startTime: serachFormData.startTime,
|
||
|
endTime: serachFormData.endTime,
|
||
|
itemName: itemName.value,
|
||
|
}
|
||
|
historyData.value = await getExaHistorys(exaHistoryReqVO)
|
||
|
|
||
|
loading.value = false
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<BasicModal v-bind="$attrs" title="历史曲线" width="80%" @register="registerHistoryModal">
|
||
|
<BasicForm @register="registerForm" @submit="handleSubmitR" />
|
||
|
<Card :loading="loading">
|
||
|
<EXAHistoryLine :data="historyData" :name="legendName" height="500px" />
|
||
|
</Card>
|
||
|
</BasicModal>
|
||
|
</template>
|