|
@@ -1,46 +1,139 @@
|
|
|
-<!--
|
|
|
|
|
- * @Author: liuJie
|
|
|
|
|
- * @Date: 2026-01-25 22:08:04
|
|
|
|
|
- * @LastEditors: liuJie
|
|
|
|
|
- * @LastEditTime: 2026-01-25 23:04:14
|
|
|
|
|
- * @Describe: code设置器
|
|
|
|
|
--->
|
|
|
|
|
-<script lang="ts" setup>
|
|
|
|
|
-import { ElDrawer, ElButton } from 'element-plus';
|
|
|
|
|
-import { Icon } from '@iconify/vue';
|
|
|
|
|
-const props = withDefaults(
|
|
|
|
|
- defineProps<{
|
|
|
|
|
- data: any,
|
|
|
|
|
- visible: boolean,
|
|
|
|
|
- }>(),
|
|
|
|
|
- {
|
|
|
|
|
- visible: false,
|
|
|
|
|
- data: {}
|
|
|
|
|
- }
|
|
|
|
|
-);
|
|
|
|
|
-const emit = defineEmits<{
|
|
|
|
|
- 'update:visible': [value: boolean]
|
|
|
|
|
-}>()
|
|
|
|
|
-</script>
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <div class='content'>
|
|
|
|
|
- <ElDrawer :model-value="visible" :show-close="false" size="25%" @close="emit('update:visible', false)">
|
|
|
|
|
|
|
+ <div class=" bg-black bg-opacity-50 flex items-center justify-center">
|
|
|
|
|
+ <div class="bg-white w-full max-w-4xl max-h-[90vh] flex flex-col">
|
|
|
|
|
+ <!-- Header -->
|
|
|
|
|
+ <div class="flex items-start justify-between border-b border-gray-200">
|
|
|
|
|
+ <div class="flex items-center gap-3">
|
|
|
|
|
+ <div class="w-8 h-8 bg-blue-100 rounded-lg flex items-center justify-center">
|
|
|
|
|
+ <Icon icon="lucide:code-2" :height="20" :width="20" class="text-blue-600" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <h2 class="text-lg font-semibold text-gray-900 m-0">代码执行</h2>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
|
|
+ <button @click="emit('update:visible', false)"
|
|
|
|
|
+ class="px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 focus:outline-none rounded-lg flex items-center gap-2">
|
|
|
|
|
+ <Icon icon="lucide:play" :height="16" :width="16" />
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button class="p-2 hover:bg-gray-100 rounded-lg focus:outline-none">
|
|
|
|
|
+ <Icon icon="lucide:more-horizontal" :height="18" :width="18" class="text-gray-600" />
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button @click="handleClose" class="p-2 hover:bg-gray-100 rounded-lg focus:outline-none">
|
|
|
|
|
+ <Icon icon="lucide:x" :height="18" :width="18" class="text-gray-600" />
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <input v-model="nodeName" type="text" placeholder="添加描述..."
|
|
|
|
|
+ class="text-sm text-gray-500 border-none outline-none focus:ring-0 p-0 mt-0.5 w-full" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- Tab 导航-->
|
|
|
|
|
+ <div class="mt-2">
|
|
|
|
|
+ <TabGroup v-model="activeTab" :tabs="tabs" />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <template #header>
|
|
|
|
|
- <h4>代码执行</h4>
|
|
|
|
|
- <Icon icon="lucide:x" height="24" width="24"></Icon>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <!-- Content -->
|
|
|
|
|
+ <div class=" overflow-auto pt-4 pb-20">
|
|
|
|
|
+ <div v-show="activeTab === 'settings'" class="space-y-6">
|
|
|
|
|
+ <!-- 输入变量 -->
|
|
|
|
|
+ <InputVariables v-model="formData.inputVariables" />
|
|
|
|
|
|
|
|
- <!-- Drawer content -->
|
|
|
|
|
- This is drawer content.
|
|
|
|
|
|
|
+ <!-- 代码编辑器 -->
|
|
|
|
|
+ <CodeEditor v-model="formData.code" v-model:language="formData.language" />
|
|
|
|
|
|
|
|
- <!-- <template #footer>
|
|
|
|
|
- <ElButton type="success" size="large" class="w-full" @click="emit('update:visible', false)">
|
|
|
|
|
- 运行
|
|
|
|
|
- </ElButton>
|
|
|
|
|
- </template> -->
|
|
|
|
|
|
|
+ <!-- 输出变量 -->
|
|
|
|
|
+ <OutputVariables v-model="formData.outputVariables" />
|
|
|
|
|
|
|
|
- </ElDrawer>
|
|
|
|
|
|
|
+ <!-- 测试配置 -->
|
|
|
|
|
+ <TestConfig v-model="formData.testConfig" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div v-show="activeTab === 'lastRun'" class="space-y-4">
|
|
|
|
|
+ <div class="text-center py-12 text-gray-400">
|
|
|
|
|
+ <Icon icon="lucide:clock" :height="48" :width="48" class="mx-auto mb-3 text-gray-300" />
|
|
|
|
|
+ <p class="text-sm">暂无运行记录</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
-<style lang="scss" scoped></style>
|
|
|
|
|
|
|
+
|
|
|
|
|
+<script setup lang="ts">
|
|
|
|
|
+import { ref, reactive } from 'vue'
|
|
|
|
|
+import { Icon } from '@iconify/vue'
|
|
|
|
|
+import TabGroup from '@/components/SetterCommon/Code/TabGroup.vue'
|
|
|
|
|
+import InputVariables from '@/components/SetterCommon/Code/InputVariables.vue'
|
|
|
|
|
+import CodeEditor from '@/components/SetterCommon/Code/CodeEditor.vue'
|
|
|
|
|
+import OutputVariables from '@/components/SetterCommon/Code/OutputVariables.vue'
|
|
|
|
|
+import TestConfig from '@/components/SetterCommon/Code/TestConfig.vue'
|
|
|
|
|
+interface Variable {
|
|
|
|
|
+ id: string
|
|
|
|
|
+ name: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+interface OutputVariable {
|
|
|
|
|
+ id: string
|
|
|
|
|
+ name: string
|
|
|
|
|
+ type: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+interface TestConfigData {
|
|
|
|
|
+ retryEnabled: boolean
|
|
|
|
|
+ errorHandling: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const props = withDefaults(defineProps<{
|
|
|
|
|
+ visible: boolean
|
|
|
|
|
+}>(), {
|
|
|
|
|
+ visible: false
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const emit = defineEmits<{
|
|
|
|
|
+ 'update:visible': [value: boolean]
|
|
|
|
|
+}>()
|
|
|
|
|
+
|
|
|
|
|
+const nodeName = ref('代码执行')
|
|
|
|
|
+const activeTab = ref('settings')
|
|
|
|
|
+
|
|
|
|
|
+const tabs = [
|
|
|
|
|
+ { label: '设置', value: 'settings' },
|
|
|
|
|
+ { label: '上次运行', value: 'lastRun' }
|
|
|
|
|
+]
|
|
|
|
|
+
|
|
|
|
|
+const formData = reactive({
|
|
|
|
|
+ // 输入变量
|
|
|
|
|
+ inputVariables: [
|
|
|
|
|
+ { id: 'var_1', name: 'arg1' },
|
|
|
|
|
+ { id: 'var_2', name: 'arg2' }
|
|
|
|
|
+ ] as Variable[],
|
|
|
|
|
+ // 代码内容
|
|
|
|
|
+ code: `function main(arg1, arg2) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ "result": arg1 + arg2,
|
|
|
|
|
+ }`,
|
|
|
|
|
+ // 编程语言
|
|
|
|
|
+ language: 'JavaScript',
|
|
|
|
|
+ // 输出变量
|
|
|
|
|
+ outputVariables: [
|
|
|
|
|
+ { id: 'output_1', name: 'result', type: 'String' }
|
|
|
|
|
+ ] as OutputVariable[],
|
|
|
|
|
+ // 测试配置
|
|
|
|
|
+ testConfig: {
|
|
|
|
|
+ retryEnabled: false,
|
|
|
|
|
+ errorHandling: 'none'
|
|
|
|
|
+ } as TestConfigData
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const handleClose = () => {
|
|
|
|
|
+ emit('update:visible', false)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleTest = () => {
|
|
|
|
|
+ console.log('Testing code execution...', formData)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+</script>
|