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
| import { computed, defineComponent, ref } from 'vue'
| import BaseDialog from '@/components/BaseDialog/index.vue'
| import DyForm from '@/components/DyForm/DyForm'
| import { ConditionType } from '../../core/enum'
| import { _t } from '@/libs/Language/Language'
|
| export default defineComponent({
| props: ['visible', 'options'],
| emits: ['confirm', 'update:visible'],
| setup(props, { emit }) {
| const formData = ref({})
| const formRef = ref()
| const visible = computed({
| get() {
| return props.visible
| },
| set(v) {
| emit('update:visible', v)
| },
| })
|
| const onConfirm = async () => {
| await formRef.value.validate()
| visible.value = false
| emit('confirm', { ...formData.value })
| }
| return () => {
| return (
| <BaseDialog
| width="400px"
| title={_t('条件类型')}
| v-model={visible.value}
| onClose={() => (visible.value = false)}
| onConfirm={onConfirm}
| >
| <DyForm
| ref={formRef}
| isLine={true}
| formItemProps={[
| {
| label: '条件类型',
| prop: ConditionType,
| el: 'select',
| options: props.options || [],
| rules: [
| {
| required: true,
| message: _t('请选择条件类型'),
| trigger: 'blur',
| },
| ],
| },
| ]}
| v-model:formData={formData.value}
| labelWidth="80px"
| ></DyForm>
| </BaseDialog>
| )
| }
| },
| })
|
|