mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
fix: 修复工作流接口传参历史数据兼容
This commit is contained in:
parent
fc337cf6ef
commit
2272e0b1cf
|
|
@ -17,7 +17,7 @@
|
|||
<el-input v-model="form_data.tooltip" placeholder="请输入参数提示说明" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否必填" :required="true" prop="required" :rules="rules.required">
|
||||
<el-switch v-model="form_data.required" />
|
||||
<el-switch v-model="form_data.required" :active-value="true" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="组件类型" :required="true" prop="input_type" :rules="rules.input_type">
|
||||
<el-select v-model="form_data.input_type" placeholder="请选择组件类型">
|
||||
|
|
@ -106,7 +106,7 @@ onMounted(() => {
|
|||
}
|
||||
})
|
||||
const rander = (data: any) => {
|
||||
form_data.value.required = data.required
|
||||
form_data.value.required = data.required ? data.required : false
|
||||
form_data.value.field = data.field
|
||||
form_data.value.input_type = data.input_type + 'Constructor'
|
||||
if (data.label && data.label.input_type === 'TooltipLabel') {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
append-to-body
|
||||
>
|
||||
<DynamicsFormConstructor
|
||||
v-model="currentItem"
|
||||
v-model="currentRow"
|
||||
label-position="top"
|
||||
require-asterisk-position="right"
|
||||
:input_type_list="inputTypeList"
|
||||
|
|
@ -25,17 +25,89 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import DynamicsFormConstructor from '@/components/dynamics-form/constructor/index.vue'
|
||||
import type { FormField } from '@/components/dynamics-form/type'
|
||||
|
||||
import _ from 'lodash'
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const DynamicsFormConstructorRef = ref()
|
||||
const loading = ref<boolean>(false)
|
||||
const isEdit = ref(false)
|
||||
const currentItem = ref<FormField>()
|
||||
const currentItem = ref<FormField | any>()
|
||||
const check_field = (field_list: Array<string>, obj: any) => {
|
||||
return field_list.every((field) => _.get(obj, field, undefined) !== undefined)
|
||||
}
|
||||
const currentRow = computed(() => {
|
||||
if (currentItem.value) {
|
||||
const row = currentItem.value
|
||||
switch (row.type) {
|
||||
case 'input':
|
||||
if (check_field(['field', 'input_type', 'label', 'required'], currentItem.value)) {
|
||||
return currentItem.value
|
||||
}
|
||||
return {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'TextInput',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required != undefined ? row.required : row.is_required
|
||||
}
|
||||
case 'select':
|
||||
if (
|
||||
check_field(
|
||||
['field', 'input_type', 'label', 'required', 'option_list'],
|
||||
currentItem.value
|
||||
)
|
||||
) {
|
||||
return currentItem.value
|
||||
}
|
||||
return {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'SingleSelect',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required != undefined ? row.required : row.is_required,
|
||||
option_list: row.optionList.map((o: any) => {
|
||||
return { key: o, value: o }
|
||||
})
|
||||
}
|
||||
|
||||
case 'date':
|
||||
if (
|
||||
check_field(
|
||||
[
|
||||
'field',
|
||||
'input_type',
|
||||
'label',
|
||||
'required',
|
||||
'attrs.format',
|
||||
'attrs.value-format',
|
||||
'attrs.type'
|
||||
],
|
||||
currentItem.value
|
||||
)
|
||||
) {
|
||||
return currentItem.value
|
||||
}
|
||||
return {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'DatePicker',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required != undefined ? row.required : row.is_required,
|
||||
attrs: {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
'value-format': 'YYYY-MM-DD HH:mm:ss',
|
||||
type: 'datetime'
|
||||
}
|
||||
}
|
||||
default:
|
||||
return currentItem.value
|
||||
}
|
||||
}
|
||||
})
|
||||
const currentIndex = ref(null)
|
||||
const inputTypeList = ref([
|
||||
{ label: '文本框', value: 'TextInputConstructor' },
|
||||
|
|
@ -45,7 +117,6 @@ const inputTypeList = ref([
|
|||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
||||
|
||||
const open = (row: any, index: any) => {
|
||||
dialogVisible.value = true
|
||||
|
||||
|
|
@ -53,51 +124,6 @@ const open = (row: any, index: any) => {
|
|||
isEdit.value = true
|
||||
currentItem.value = cloneDeep(row)
|
||||
currentIndex.value = index
|
||||
|
||||
// 新版本已经上线
|
||||
if (row.input_type) {
|
||||
return
|
||||
}
|
||||
// 旧版本数据兼容
|
||||
switch (row.type) {
|
||||
case 'input':
|
||||
currentItem.value = {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'TextInput',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required || row.is_required
|
||||
}
|
||||
break
|
||||
case 'select':
|
||||
currentItem.value = {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'SingleSelect',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required || row.is_required,
|
||||
option_list: row.optionList.map((o: any) => {
|
||||
return { key: o, value: o }
|
||||
})
|
||||
}
|
||||
break
|
||||
case 'date':
|
||||
currentItem.value = {
|
||||
field: row.field || row.variable,
|
||||
input_type: 'DatePicker',
|
||||
label: row.label || row.name,
|
||||
default_value: row.default_value,
|
||||
required: row.required || row.is_required,
|
||||
attrs: {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
'value-format': 'YYYY-MM-DD HH:mm:ss',
|
||||
type: 'datetime'
|
||||
}
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +145,6 @@ const submit = async () => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
defineExpose({ open, close })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
@submitDialog="submitDialog"
|
||||
/>
|
||||
</el-form-item>
|
||||
<UserInputFieldTable ref="UserInputFieldTableFef" :node-model="nodeModel" />
|
||||
<UserInputFieldTable ref="UserInputFieldTableFef" :node-model="nodeModel" />
|
||||
<ApiInputFieldTable ref="ApiInputFieldTableFef" :node-model="nodeModel" />
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
></span>
|
||||
<span>{{ item.name }}</span>
|
||||
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
||||
>公用
|
||||
>公用
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
||||
|
|
@ -113,8 +113,8 @@
|
|||
></span>
|
||||
<span>{{ item.name }}</span>
|
||||
<span class="danger">{{
|
||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||
}}</span>
|
||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
||||
<Check />
|
||||
|
|
@ -174,7 +174,7 @@
|
|||
></span>
|
||||
<span>{{ item.name }}</span>
|
||||
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
||||
>公用
|
||||
>公用
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
||||
|
|
@ -197,8 +197,8 @@
|
|||
></span>
|
||||
<span>{{ item.name }}</span>
|
||||
<span class="danger">{{
|
||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||
}}</span>
|
||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
||||
<Check />
|
||||
|
|
@ -208,9 +208,8 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
|
||||
</NodeContainer>
|
||||
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { app } from '@/main'
|
||||
|
|
@ -313,7 +312,6 @@ function getTTSModel() {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
const openTTSParamSettingDialog = () => {
|
||||
const model_id = form_data.value.tts_model_id
|
||||
if (!model_id) {
|
||||
|
|
@ -327,7 +325,6 @@ const refreshTTSForm = (data: any) => {
|
|||
form_data.value.tts_model_params_setting = data
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
set(props.nodeModel, 'validate', validate)
|
||||
if (!props.nodeModel.properties.node_data.tts_type) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue