index.vue
2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<script lang="ts" setup>
import { formSchema, SchemaFiled } from './config';
import { useForm } from '/@/components/Form';
import { useModalInner } from '/@/components/Modal';
import { useGridLayout } from '/@/hooks/component/useGridLayout';
import { ColEx } from '/@/components/Form/src/types';
import { BasicForm } from '/@/components/Form';
import { BasicModal } from '/@/components/Modal';
import { nextTick } from 'vue';
import { useApp } from '../../hooks/useApp';
import { useI18n } from '/@/hooks/web/useI18n';
const emit = defineEmits(['register', 'getAlarmForm', 'getHistoryForm']);
// const emit = defineEmits<{
// (event: 'getAlarmForm', data: WidgetDataType): void;
// }>();
// const fontId = ref('');
const { t } = useI18n();
const [registerModal, { closeModal }] = useModalInner(async () => {});
const { getIsAppPage } = useApp();
const [register, method] = useForm({
schemas: formSchema(),
baseColProps: useGridLayout(1) as unknown as ColEx,
showSubmitButton: false,
showResetButton: false,
rowProps: {
gutter: 10,
},
labelWidth: 150,
fieldMapToTime: [
[SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS], 'YYYY-MM-DD HH:ss:mm'],
],
});
const handleCancel = () => {
// destory()
};
const handleSubmit = async () => {
const values = method.getFieldsValue();
// if (unref(fontId) == 'StatisticsComponent7') {
// emit('getHistoryForm', values);
// } else {
// }
emit('getAlarmForm', values);
await nextTick();
closeModal();
};
</script>
<template>
<BasicModal
@register="registerModal"
@cancel="handleCancel"
@ok="handleSubmit"
:destroy-on-close="true"
:show-ok-btn="true"
:width="getIsAppPage ? '80%' : '40%'"
:title="t('visual.board.historyTrendsText')"
>
<section
class="flex flex-col p-4 h-full w-full min-w-7/10"
style="color: #f0f2f5; background-color: #f0f2f5"
>
<section class="bg-white my-3 p-2">
<BasicForm @register="register" />
</section>
</section>
</BasicModal>
</template>
<style scoped></style>