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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<template>
<div class="step2">
<div style="margin-top: 20px;margin-bottom: 20px;margin-left: 10px;display: flex">
配置模式 <Select
class="selectCss"
v-model:value="optionValue1"
show-search
placeholder="input search text"
:options="options1"
@search="handleSearch"
/>
<div style="margin-left: 20px" v-if="optionValue1 == '脚本模式'">
脚本语言 <Select
class="selectCss"
v-model:value="optionValue3"
show-search
placeholder="input search text"
:options="options3"
@search="handleSearch"
/>
</div>
<a-button style="margin-left: 20px" type="primary" @click="mappingButton" v-if="optionValue1 != '脚本模式'">一键映射</a-button>
</div>
<div v-if="optionValue1 != '脚本模式'">
<div style="font-size: 16px;font-weight: bold;margin-top: 20px;margin-bottom: 20px;margin-left: 10px">
开放入参定义
</div>
<div style="margin-top: 20px;margin-bottom: 20px;margin-left: 10px">
参数配置方式 <Select
class="selectCss"
v-model:value="optionValue2"
show-search
placeholder="input search text"
:options="options2"
@search="handleSearch"
/>
</div>
<div style="display: flex;margin-top: 20px;margin-bottom: 20px;margin-left: 10px" v-if="optionValue2 === '自动解析'">
<div style="font-size: 16px">json</div>
<Textarea rows="4" style="width: 35%" :value="json"/>
<a-button type="primary" style="margin-top: 5%;margin-left: 10px" @click="typeManageButton">解析</a-button>
</div>
<BasicTable @register="registerTable1">
<template #toolbar>
<a-button type="primary" @click="typeManageButton">导入原始入参</a-button>
<a-button type="primary" @click="typeManageButton">添加参数</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'ant-design:delete-outlined',
// label: '删除',
color: 'error',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: deleteButton.bind(null, record),
},
},
]"
/>
</template>
</template>
</BasicTable>
<div v-if="show">
<BasicTable @register="registerTable2">
<template #toolbar>
<a-button type="primary" @click="typeManageButton">自动映射</a-button>
</template>
</BasicTable>
</div>
</div>
<div v-if="optionValue1 == '脚本模式'">
<CodeEditor v-model:value="sql"/>
</div>
<div style="display: flex;justify-content: flex-end;margin-top: 20px">
<a-button style="margin-right: 20px" type="primary" @click="customResetFunc">上一步</a-button>
<a-button style="margin-right: 10px" type="primary" @click="customSubmitFunc">下一步</a-button>
</div>
</div>
</template>
<script lang="ts" setup>
import { BasicForm, useForm } from '@/components/Form';
import { Description } from '@/components/Description';
import { useMessage } from '@/hooks/web/useMessage';
import { step2TableData1,step2TableData2,step1SQLData } from './apiData';
import { ref, reactive, onMounted } from 'vue';
import { Select,Textarea } from 'ant-design-vue';
import CodeEditor from "@/components/CodeEditor/src/CodeEditor.vue";
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { columns,step2TableColumns1,step2TableColumns2 } from './api.data';
const { createMessage } = useMessage();
const emit = defineEmits(['next']);
const optionValue1 = ref('')
const optionValue2 = ref('')
const optionValue3 = ref('')
const options1 = ref([
{
label: '映射规则',
value: '映射规则'
},
{
label: '脚本模式',
value: '脚本模式'
},
])
const options2 = ref([
{
label: '自动解析',
value: '自动解析'
},
{
label: '手动添加',
value: '手动添加'
},
])
const options3 = ref([
{
label: 'JAVA',
value: 'JAVA'
},
{
label: 'Groovy',
value: 'Groovy'
},
])
const sql = ref(step1SQLData[0].sql);
const show = ref(false)
const json = ref('{ "category": "SERVICE", "page": 1, "size": 10, "searchText": "", "uuid": "5B86749FD7CFB3CFF8100794FE15D3E", "sortRules": [], "filterRules": [], "timeRangeFilters": [], "fieldFuzzySearch": [], "childrenRequest": null, "catalogFlag": false }')
const [registerTable1] = useTable({
title: '',
api: async (params) => {
var data = [];
const response = {
pageNu: "1",
pageSize: "10",
pages: "1",
total: step2TableData1.length,
code:'',
message:'',
data: [],
};
//过滤data中的数据,取出等于params.deptId的数据
return { ...response,data: step2TableData1 };
},
columns:step2TableColumns1,
useSearchForm: false,
showTableSetting: false,
showIndexColumn:false,
bordered: true,
scroll: { y: 300 },
actionColumn: {
width: 100,
title: '操作',
dataIndex: 'action',
},
});
const [registerTable2] = useTable({
title: '入参映射',
api: async (params) => {
var data = [];
const response = {
pageNu: "1",
pageSize: "10",
pages: "1",
total: step2TableData2.length,
code:'',
message:'',
data: [],
};
//过滤data中的数据,取出等于params.deptId的数据
return { ...response,data: step2TableData2 };
},
columns:step2TableColumns2,
useSearchForm: false,
showTableSetting: false,
showIndexColumn:false,
bordered: true,
scroll: { y: 300 },
});
/**删除按钮*/
function deleteButton() {
createMessage.success('删除成功!');
}
function customSubmitFunc() {
try {
emit('next', '');
} catch (error) {
}
}
function customResetFunc() {
emit('prev');
}
/**一键映射 按钮*/
function mappingButton() {
show.value = true
}
/**初始化*/
onMounted(() => {
optionValue1.value = '映射规则'
optionValue2.value = '手动添加'
optionValue3.value = 'JAVA'
});
</script>
<style lang="less" scoped>
.selectCss{
::v-deep(.ant-select-selector){
width:200px!important;
}
}
</style>