|
@@ -7,90 +7,117 @@ |
|
@@ -7,90 +7,117 @@ |
7
|
</template>
|
7
|
</template>
|
8
|
|
8
|
|
9
|
<template v-for="(item, index) in conditionScreeningList" :key="item">
|
9
|
<template v-for="(item, index) in conditionScreeningList" :key="item">
|
10
|
- <ConditionScreeningForm :conditionScreeningList="conditionScreeningList" :ref="refItem.conditionScreeningRefs"
|
|
|
11
|
- :index="index" @deleteConditionForm="deleteConditionForm" />
|
10
|
+ <ConditionScreeningForm
|
|
|
11
|
+ :conditionScreeningList="conditionScreeningList"
|
|
|
12
|
+ :ref="refItem.conditionScreeningRefs"
|
|
|
13
|
+ :index="index"
|
|
|
14
|
+ @deleteConditionForm="deleteConditionForm"
|
|
|
15
|
+ />
|
12
|
</template>
|
16
|
</template>
|
13
|
</CollapseContainer>
|
17
|
</CollapseContainer>
|
14
|
|
18
|
|
15
|
<div class="flex justify-between">
|
19
|
<div class="flex justify-between">
|
16
|
- <a-button :disabled="isViewDisabledBtn=='isView'?true:false" type="primary" class="mt-4 ml-2"
|
|
|
17
|
- @click="addConditionForm">新增条件筛选</a-button>
|
|
|
18
|
- <a-button :disabled="isViewDisabledBtn=='isView'?true:false" type="primary" class="mt-4 mr-2" @click="preView"
|
|
|
19
|
- v-if="isPreview">保存</a-button>
|
20
|
+ <a-button
|
|
|
21
|
+ :disabled="isViewDisabledBtn == 'isView' ? true : false"
|
|
|
22
|
+ type="primary"
|
|
|
23
|
+ class="mt-4 ml-2"
|
|
|
24
|
+ @click="addConditionForm"
|
|
|
25
|
+ >新增条件筛选</a-button
|
|
|
26
|
+ >
|
|
|
27
|
+ <a-button
|
|
|
28
|
+ :disabled="isViewDisabledBtn == 'isView' ? true : false"
|
|
|
29
|
+ type="primary"
|
|
|
30
|
+ class="mt-4 mr-2"
|
|
|
31
|
+ @click="preView"
|
|
|
32
|
+ v-if="isPreview"
|
|
|
33
|
+ >保存</a-button
|
|
|
34
|
+ >
|
20
|
</div>
|
35
|
</div>
|
21
|
</div>
|
36
|
</div>
|
22
|
</template>
|
37
|
</template>
|
23
|
|
38
|
|
24
|
<script lang="ts" setup>
|
39
|
<script lang="ts" setup>
|
25
|
-import { unref, ref } from 'vue';
|
|
|
26
|
-import ConditionScreeningForm from './ConditionScreeningForm.vue';
|
|
|
27
|
-import { conditionPreView } from '../config/formatData.ts';
|
|
|
28
|
-import { CollapseContainer } from '/@/components/Container/index';
|
|
|
29
|
-import RichText from './RichText.vue';
|
|
|
30
|
-const props = defineProps({
|
|
|
31
|
- childGetFieldsValue: {
|
|
|
32
|
- type: Function,
|
|
|
33
|
- required: true,
|
|
|
34
|
- },
|
|
|
35
|
-});
|
|
|
36
|
-const refItem = {
|
|
|
37
|
- conditionScreeningRefs: ref([]),
|
|
|
38
|
-};
|
|
|
39
|
-const isViewDisabledBtn = window.localStorage.getItem('isViewDisabledBtn')
|
|
|
40
|
-const isPreview = ref(true);
|
|
|
41
|
-const collapseContainerRef = ref();
|
|
|
42
|
-const conditionScreeningList = ref([Date.now()]);
|
|
|
43
|
-const addConditionForm = () => {
|
|
|
44
|
- if (!unref(isPreview)) {
|
|
|
45
|
- collapseContainerRef.value.handleExpand();
|
|
|
46
|
- }
|
|
|
47
|
- unref(conditionScreeningList).push(Date.now());
|
|
|
48
|
- const lastIndex = refItem.conditionScreeningRefs.value.length - 1;
|
|
|
49
|
- refItem.conditionScreeningRefs.value[lastIndex]?.appendSchemaByField(
|
|
|
50
|
- {
|
|
|
51
|
- field: 'AND',
|
|
|
52
|
- label: '和',
|
|
|
53
|
- component: 'Input',
|
|
|
54
|
- slot: 'and',
|
|
|
55
|
- // labelWidth: 50,
|
|
|
56
|
- colProps: { span: 3 },
|
40
|
+ import { unref, ref } from 'vue';
|
|
|
41
|
+ import ConditionScreeningForm from './ConditionScreeningForm.vue';
|
|
|
42
|
+ import { conditionPreView } from '../config/formatData.ts';
|
|
|
43
|
+ import { CollapseContainer } from '/@/components/Container/index';
|
|
|
44
|
+ import RichText from './RichText.vue';
|
|
|
45
|
+ const props = defineProps({
|
|
|
46
|
+ childGetFieldsValue: {
|
|
|
47
|
+ type: Function,
|
|
|
48
|
+ required: true,
|
57
|
},
|
49
|
},
|
58
|
- 'value'
|
|
|
59
|
- );
|
|
|
60
|
-};
|
|
|
61
|
-const handleExpand = (show) => {
|
|
|
62
|
- isPreview.value = show;
|
|
|
63
|
-};
|
50
|
+ });
|
|
|
51
|
+ const refItem = {
|
|
|
52
|
+ conditionScreeningRefs: ref([]),
|
|
|
53
|
+ };
|
|
|
54
|
+ const isViewDisabledBtn = window.localStorage.getItem('isViewDisabledBtn');
|
|
|
55
|
+ const isPreview = ref(true);
|
|
|
56
|
+ const collapseContainerRef = ref();
|
|
|
57
|
+ const conditionScreeningList = ref([Date.now()]);
|
|
|
58
|
+ const addConditionForm = () => {
|
|
|
59
|
+ if (!unref(isPreview)) {
|
|
|
60
|
+ collapseContainerRef.value.handleExpand();
|
|
|
61
|
+ }
|
|
|
62
|
+ unref(conditionScreeningList).push(Date.now());
|
|
|
63
|
+ const lastIndex = refItem.conditionScreeningRefs.value.length - 1;
|
|
|
64
|
+ refItem.conditionScreeningRefs.value[lastIndex]?.appendSchemaByField(
|
|
|
65
|
+ {
|
|
|
66
|
+ field: 'AND',
|
|
|
67
|
+ label: '和',
|
|
|
68
|
+ component: 'Input',
|
|
|
69
|
+ slot: 'and',
|
|
|
70
|
+ // labelWidth: 50,
|
|
|
71
|
+ colProps: { span: 3 },
|
|
|
72
|
+ },
|
|
|
73
|
+ 'value'
|
|
|
74
|
+ );
|
|
|
75
|
+ };
|
|
|
76
|
+ const handleExpand = (show) => {
|
|
|
77
|
+ isPreview.value = show;
|
|
|
78
|
+ };
|
64
|
|
79
|
|
65
|
-const otherAttribute = ref([]);
|
|
|
66
|
-// 预览条件筛选结果
|
|
|
67
|
-const preView = async () => {
|
|
|
68
|
- const attributes = [];
|
|
|
69
|
- const fieldsValue = props.childGetFieldsValue();
|
|
|
70
|
- for (let i = 0; i < unref(refItem.conditionScreeningRefs).length; i++) {
|
|
|
71
|
- const valid = await unref(refItem.conditionScreeningRefs)[i].validate();
|
|
|
72
|
- if (!valid) return;
|
|
|
73
|
- attributes.push({
|
|
|
74
|
- ...unref(refItem.conditionScreeningRefs)[i].getFieldsValue(),
|
|
|
75
|
- attribute: fieldsValue.type2,
|
|
|
76
|
- });
|
|
|
77
|
- }
|
|
|
78
|
- otherAttribute.value = conditionPreView(attributes, fieldsValue.operationType);
|
|
|
79
|
- collapseContainerRef.value.handleExpand();
|
|
|
80
|
-};
|
80
|
+ const otherAttribute = ref([]);
|
|
|
81
|
+ // 预览条件筛选结果
|
|
|
82
|
+ const preView = async () => {
|
|
|
83
|
+ const attributes = [];
|
|
|
84
|
+ const fieldsValue = props.childGetFieldsValue();
|
|
|
85
|
+ for (let i = 0; i < unref(refItem.conditionScreeningRefs).length; i++) {
|
|
|
86
|
+ const valid = await unref(refItem.conditionScreeningRefs)[i].validate();
|
|
|
87
|
+ if (!valid) return;
|
|
|
88
|
+ attributes.push({
|
|
|
89
|
+ ...unref(refItem.conditionScreeningRefs)[i].getFieldsValue(),
|
|
|
90
|
+ attribute: fieldsValue.type2,
|
|
|
91
|
+ });
|
|
|
92
|
+ }
|
|
|
93
|
+ otherAttribute.value = conditionPreView(attributes, fieldsValue.operationType);
|
|
|
94
|
+ // collapseContainerRef.value.handleExpand();
|
|
|
95
|
+ collapseContainerRef.value.show = true;
|
|
|
96
|
+ };
|
81
|
|
97
|
|
82
|
-const resetFilter = () => {
|
|
|
83
|
- otherAttribute.value = [];
|
|
|
84
|
-};
|
|
|
85
|
-const deleteConditionForm = (index) => {
|
|
|
86
|
- unref(conditionScreeningList).splice(index, 1);
|
|
|
87
|
- const lastIndex = refItem.conditionScreeningRefs.value.length - 2;
|
|
|
88
|
- refItem.conditionScreeningRefs.value[lastIndex]?.removeSchemaByFiled('AND');
|
|
|
89
|
-};
|
98
|
+ //ft add 表单数据置空
|
|
|
99
|
+ const resetConditionScreenForm = () => {
|
|
|
100
|
+ // conditionScreeningList.value = [];
|
|
|
101
|
+ resetFilter();
|
|
|
102
|
+ for (let i = 0; i < unref(refItem.conditionScreeningRefs).length; i++) {
|
|
|
103
|
+ unref(refItem.conditionScreeningRefs)[i]?.resetConditionScreenForm();
|
|
|
104
|
+ }
|
|
|
105
|
+ };
|
|
|
106
|
+ //ft add 表单数据置空
|
90
|
|
107
|
|
91
|
-defineExpose({
|
|
|
92
|
- refItem,
|
|
|
93
|
- conditionScreeningList,
|
|
|
94
|
- otherAttribute,
|
|
|
95
|
-});
|
108
|
+ const resetFilter = () => {
|
|
|
109
|
+ otherAttribute.value = [];
|
|
|
110
|
+ };
|
|
|
111
|
+ const deleteConditionForm = (index) => {
|
|
|
112
|
+ unref(conditionScreeningList).splice(index, 1);
|
|
|
113
|
+ const lastIndex = refItem.conditionScreeningRefs.value.length - 2;
|
|
|
114
|
+ refItem.conditionScreeningRefs.value[lastIndex]?.removeSchemaByFiled('AND');
|
|
|
115
|
+ };
|
|
|
116
|
+
|
|
|
117
|
+ defineExpose({
|
|
|
118
|
+ refItem,
|
|
|
119
|
+ conditionScreeningList,
|
|
|
120
|
+ otherAttribute,
|
|
|
121
|
+ resetConditionScreenForm,
|
|
|
122
|
+ });
|
96
|
</script> |
123
|
</script> |