|
@@ -58,6 +58,14 @@ |
|
@@ -58,6 +58,14 @@ |
58
|
<a-form-item label="脚本内容" :name="ifAdd ? 'convertJs' : 'script'">
|
58
|
<a-form-item label="脚本内容" :name="ifAdd ? 'convertJs' : 'script'">
|
59
|
<Card title="脚本内容" :bodyStyle="{ padding: 0, height: '280px' }">
|
59
|
<Card title="脚本内容" :bodyStyle="{ padding: 0, height: '280px' }">
|
60
|
<template #extra>
|
60
|
<template #extra>
|
|
|
61
|
+ <Button
|
|
|
62
|
+ v-show="ifAdd && !view"
|
|
|
63
|
+ @click="onHandleTestExample(scriptForm.scriptType)"
|
|
|
64
|
+ style="position: relative; top: -4rem; right: -6.6rem"
|
|
|
65
|
+ type="primary"
|
|
|
66
|
+ >
|
|
|
67
|
+ 测试用例</Button
|
|
|
68
|
+ >
|
61
|
<a-button @click="handleFormat" size="small">格式化</a-button>
|
69
|
<a-button @click="handleFormat" size="small">格式化</a-button>
|
62
|
<Tooltip
|
70
|
<Tooltip
|
63
|
v-if="scriptForm.scriptType !== 'TRANSPORT_TCP_UP'"
|
71
|
v-if="scriptForm.scriptType !== 'TRANSPORT_TCP_UP'"
|
|
@@ -115,7 +123,13 @@ |
|
@@ -115,7 +123,13 @@ |
115
|
import { useMessage } from '/@/hooks/web/useMessage';
|
123
|
import { useMessage } from '/@/hooks/web/useMessage';
|
116
|
import { findDictItemByCode } from '/@/api/system/dict';
|
124
|
import { findDictItemByCode } from '/@/api/system/dict';
|
117
|
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
|
125
|
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
|
118
|
- import { defaultAuthTitle, defaultUpTitle, defaultScriptTypeContent } from './config.data';
|
126
|
+ import {
|
|
|
127
|
+ defaultAuthTitle,
|
|
|
128
|
+ defaultUpTitle,
|
|
|
129
|
+ defaultScriptTypeContent,
|
|
|
130
|
+ defaultTestUpExample,
|
|
|
131
|
+ defaultTestAuthExample,
|
|
|
132
|
+ } from './config.data';
|
119
|
import { useAppStore } from '/@/store/modules/app';
|
133
|
import { useAppStore } from '/@/store/modules/app';
|
120
|
import TestScriptModal from './TestScriptModal.vue';
|
134
|
import TestScriptModal from './TestScriptModal.vue';
|
121
|
import { useModal } from '/@/components/Modal';
|
135
|
import { useModal } from '/@/components/Modal';
|
|
@@ -207,6 +221,15 @@ |
|
@@ -207,6 +221,15 @@ |
207
|
aceEditor.value.setValue(defaultScriptTypeContent[type]);
|
221
|
aceEditor.value.setValue(defaultScriptTypeContent[type]);
|
208
|
};
|
222
|
};
|
209
|
|
223
|
|
|
|
224
|
+ const onHandleTestExample = (example) => {
|
|
|
225
|
+ if (example === 'TRANSPORT_TCP_UP') {
|
|
|
226
|
+ aceEditor.value?.setValue(defaultTestUpExample);
|
|
|
227
|
+ } else {
|
|
|
228
|
+ aceEditor.value?.setValue(defaultTestAuthExample);
|
|
|
229
|
+ }
|
|
|
230
|
+ handleFormat();
|
|
|
231
|
+ };
|
|
|
232
|
+
|
210
|
const handleCopy = () => {
|
233
|
const handleCopy = () => {
|
211
|
const valueRef = aceEditor.value.getValue();
|
234
|
const valueRef = aceEditor.value.getValue();
|
212
|
const value = unref(valueRef);
|
235
|
const value = unref(valueRef);
|
|
@@ -303,10 +326,12 @@ |
|
@@ -303,10 +326,12 @@ |
303
|
const [registerModal, { openModal }] = useModal();
|
326
|
const [registerModal, { openModal }] = useModal();
|
304
|
|
327
|
|
305
|
const onHandleClick = (o) => {
|
328
|
const onHandleClick = (o) => {
|
|
|
329
|
+ const getTestContent = aceEditor.value?.getValue();
|
306
|
openModal(true, {
|
330
|
openModal(true, {
|
307
|
isAuth: '',
|
331
|
isAuth: '',
|
308
|
- isUpdate: false,
|
332
|
+ isUpdate: o,
|
309
|
record: o === 'add' ? null : getRecordId.value,
|
333
|
record: o === 'add' ? null : getRecordId.value,
|
|
|
334
|
+ testContent: getTestContent,
|
310
|
isTest: true,
|
335
|
isTest: true,
|
311
|
isText: 'test',
|
336
|
isText: 'test',
|
312
|
isTitle: 'test',
|
337
|
isTitle: 'test',
|