fix: 修复工作流接口传参历史数据兼容
This commit is contained in:
parent
fc337cf6ef
commit
2272e0b1cf
@ -17,7 +17,7 @@
|
|||||||
<el-input v-model="form_data.tooltip" placeholder="请输入参数提示说明" />
|
<el-input v-model="form_data.tooltip" placeholder="请输入参数提示说明" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否必填" :required="true" prop="required" :rules="rules.required">
|
<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>
|
||||||
<el-form-item label="组件类型" :required="true" prop="input_type" :rules="rules.input_type">
|
<el-form-item label="组件类型" :required="true" prop="input_type" :rules="rules.input_type">
|
||||||
<el-select v-model="form_data.input_type" placeholder="请选择组件类型">
|
<el-select v-model="form_data.input_type" placeholder="请选择组件类型">
|
||||||
@ -106,7 +106,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const rander = (data: any) => {
|
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.field = data.field
|
||||||
form_data.value.input_type = data.input_type + 'Constructor'
|
form_data.value.input_type = data.input_type + 'Constructor'
|
||||||
if (data.label && data.label.input_type === 'TooltipLabel') {
|
if (data.label && data.label.input_type === 'TooltipLabel') {
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
append-to-body
|
append-to-body
|
||||||
>
|
>
|
||||||
<DynamicsFormConstructor
|
<DynamicsFormConstructor
|
||||||
v-model="currentItem"
|
v-model="currentRow"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
require-asterisk-position="right"
|
require-asterisk-position="right"
|
||||||
:input_type_list="inputTypeList"
|
:input_type_list="inputTypeList"
|
||||||
@ -25,17 +25,89 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import DynamicsFormConstructor from '@/components/dynamics-form/constructor/index.vue'
|
import DynamicsFormConstructor from '@/components/dynamics-form/constructor/index.vue'
|
||||||
import type { FormField } from '@/components/dynamics-form/type'
|
import type { FormField } from '@/components/dynamics-form/type'
|
||||||
|
import _ from 'lodash'
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
const DynamicsFormConstructorRef = ref()
|
const DynamicsFormConstructorRef = ref()
|
||||||
const loading = ref<boolean>(false)
|
const loading = ref<boolean>(false)
|
||||||
const isEdit = ref(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 currentIndex = ref(null)
|
||||||
const inputTypeList = ref([
|
const inputTypeList = ref([
|
||||||
{ label: '文本框', value: 'TextInputConstructor' },
|
{ label: '文本框', value: 'TextInputConstructor' },
|
||||||
@ -45,7 +117,6 @@ const inputTypeList = ref([
|
|||||||
|
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
|
|
||||||
|
|
||||||
const open = (row: any, index: any) => {
|
const open = (row: any, index: any) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
|
|
||||||
@ -53,51 +124,6 @@ const open = (row: any, index: any) => {
|
|||||||
isEdit.value = true
|
isEdit.value = true
|
||||||
currentItem.value = cloneDeep(row)
|
currentItem.value = cloneDeep(row)
|
||||||
currentIndex.value = index
|
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 })
|
defineExpose({ open, close })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
@submitDialog="submitDialog"
|
@submitDialog="submitDialog"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<UserInputFieldTable ref="UserInputFieldTableFef" :node-model="nodeModel" />
|
<UserInputFieldTable ref="UserInputFieldTableFef" :node-model="nodeModel" />
|
||||||
<ApiInputFieldTable ref="ApiInputFieldTableFef" :node-model="nodeModel" />
|
<ApiInputFieldTable ref="ApiInputFieldTableFef" :node-model="nodeModel" />
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<template #label>
|
<template #label>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
></span>
|
></span>
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
||||||
>公用
|
>公用
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
||||||
@ -113,8 +113,8 @@
|
|||||||
></span>
|
></span>
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<span class="danger">{{
|
<span class="danger">{{
|
||||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
<el-icon class="check-icon" v-if="item.id === form_data.stt_model_id">
|
||||||
<Check />
|
<Check />
|
||||||
@ -174,7 +174,7 @@
|
|||||||
></span>
|
></span>
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
<el-tag v-if="item.permission_type === 'PUBLIC'" type="info" class="info-tag ml-8"
|
||||||
>公用
|
>公用
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
||||||
@ -197,8 +197,8 @@
|
|||||||
></span>
|
></span>
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<span class="danger">{{
|
<span class="danger">{{
|
||||||
$t('views.application.applicationForm.form.aiModel.unavailable')
|
$t('views.application.applicationForm.form.aiModel.unavailable')
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
<el-icon class="check-icon" v-if="item.id === form_data.tts_model_id">
|
||||||
<Check />
|
<Check />
|
||||||
@ -208,9 +208,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
|
||||||
</NodeContainer>
|
</NodeContainer>
|
||||||
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { app } from '@/main'
|
import { app } from '@/main'
|
||||||
@ -313,7 +312,6 @@ function getTTSModel() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const openTTSParamSettingDialog = () => {
|
const openTTSParamSettingDialog = () => {
|
||||||
const model_id = form_data.value.tts_model_id
|
const model_id = form_data.value.tts_model_id
|
||||||
if (!model_id) {
|
if (!model_id) {
|
||||||
@ -327,7 +325,6 @@ const refreshTTSForm = (data: any) => {
|
|||||||
form_data.value.tts_model_params_setting = data
|
form_data.value.tts_model_params_setting = data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
set(props.nodeModel, 'validate', validate)
|
set(props.nodeModel, 'validate', validate)
|
||||||
if (!props.nodeModel.properties.node_data.tts_type) {
|
if (!props.nodeModel.properties.node_data.tts_type) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user