Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ui/src/components/COMPONENT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,7 @@ const formValue = ref<DynamicFormRecord>({})
</template>
```

公开入口包含 `MkDynamicsForm`、`MkDynamicsFormConstructor`、`dynamicFormTypeOptions`、
`visibilityCompareOptions` 和组件专用类型。`FormItem.vue`、`items/`、`constructor/items/` 与
公开入口包含 `MkDynamicsForm`、`MkDynamicsFormConstructor`、`dynamicFormTypeOptions` 和组件专用类型。`FormItem.vue`、`items/`、`constructor/items/` 与
`constructor/visibility/` 均为内部实现,业务代码不应深层导入。

`MkDynamicsForm` 的主要 Props 为 `modelValue`、`renderData`、`otherParams`、`view`、
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/mk-dynamics-form/constructor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { onMounted, ref, nextTick } from 'vue'
import { dynamicFormTypeOptions} from '@/components/mk-dynamics-form/constant'
import VisibilityConstructor from './visibility/index.vue'
import BasicInfoConstructor from './BasicInfoConstructor.vue'
import { type LeftOptions } from './type.ts'
import { type LeftOptions } from '../type.ts'

// $attrs(label-position 等)显式透传给 BasicInfoConstructor 的 el-form
defineOptions({ inheritAttrs: false })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, ref, inject } from 'vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
import JsonInput from '@/components/mk-dynamics-form/items/JsonInput.vue'
const props = defineProps<{
modelValue: MkDynamicFormValue
Expand Down Expand Up @@ -138,12 +137,12 @@ onMounted(() => {
prop="default_value"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.default_value"
v-model="formValue.option_list"
/>
</el-form-item>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, inject } from 'vue'
import MultiRow from '@/components/mk-dynamics-form/items/MultiRow.vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
import type { FormField } from '@/components/mk-dynamics-form/type'
const getModel = inject('getModel') as MkDynamicFormValue

Expand Down Expand Up @@ -144,9 +144,9 @@ onMounted(() => {
prop="option_list"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.option_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, inject } from 'vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
const getModel = inject('getModel') as MkDynamicFormValue

const assignment_method_option_list = computed(() => {
Expand Down Expand Up @@ -141,9 +140,9 @@ onMounted(() => {
prop="option_list"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.option_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, inject } from 'vue'
import RadioCard from '@/components/mk-dynamics-form/items/radio/RadioCard.vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
const getModel = inject('getModel') as MkDynamicFormValue

const assignment_method_option_list = computed(() => {
Expand Down Expand Up @@ -143,9 +142,9 @@ onMounted(() => {
prop="option_list"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.option_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, inject } from 'vue'
import RadioRow from '@/components/mk-dynamics-form/items/radio/RadioRow.vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
import type { FormField } from '@/components/mk-dynamics-form/type'
const getModel = inject('getModel') as MkDynamicFormValue
const getModel = inject('getModel') as any

const assignment_method_option_list = computed(() => {
const option_list = [
Expand All @@ -30,7 +29,7 @@ const model = computed(() => {
}
})
const props = defineProps<{
modelValue: MkDynamicFormValue
modelValue: any
}>()
const emit = defineEmits(['update:modelValue'])
const formValue = computed({
Expand All @@ -44,11 +43,7 @@ const formValue = computed({

const default_ref_variables_value_rule = {
required: true,
validator: (
rule: MkDynamicFormValue,
value: MkDynamicFormValue,
callback: MkDynamicFormValue,
) => {
validator: (rule: any, value: any, callback: any) => {
if (!(Array.isArray(value) && value.length > 1)) {
callback('引用变量必填')
}
Expand Down Expand Up @@ -144,9 +139,9 @@ onMounted(() => {
prop="option_list"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.option_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { computed, onMounted, inject } from 'vue'
import VariableCascader from '../VariableCascader.vue'
import NodeCascader from '@/workflow-canvas/core/NodeCascader.vue'
const getModel = inject('getModel') as MkDynamicFormValue

const assignment_method_option_list = computed(() => {
Expand Down Expand Up @@ -142,9 +142,9 @@ onMounted(() => {
prop="option_list"
:rules="[default_ref_variables_value_rule]"
>
<VariableCascader
<NodeCascader
ref="nodeCascaderRef"
:variable-source="model"
:nodeModel="model"
class="w-full"
placeholder="请选择变量"
v-model="formValue.option_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { visibilityCompareOptions } from '../../enums'
import { compareList } from '@/workflow-canvas/config/constants'
import FieldSelector from './FieldSelector.vue'
import { inferFieldType, getAllowedOps, getFieldConfig } from './index'
import type { LeftOptions } from '../type'
Expand All @@ -26,7 +25,7 @@ function onFieldChange() {
const isTreeMultiple = fieldType === 'TreeSelect' && fieldConfig?.attrs?.multiple
const allowed = isTreeMultiple ? ['contain', 'not_contain'] : getAllowedOps(fieldType)

condition.value._ops = visibilityCompareOptions.filter((op) => allowed.includes(op.value))
condition.value._ops = compareList.filter((op) => allowed.includes(op.value))
condition.value._fieldType = fieldType
condition.value._options = fieldConfig?.option_list ?? []
condition.value._treeData = fieldConfig?.attrs?.data ?? []
Expand Down Expand Up @@ -64,7 +63,7 @@ function onFieldChange() {
placeholder="请选择比较方式"
>
<el-option
v-for="op in condition._ops || visibilityCompareOptions"
v-for="op in condition._ops || compareList"
:key="op.value"
:label="op.label"
:value="op.value"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script setup lang="ts">
import type { MkDynamicFormValue } from '../../type'
import { ref, onMounted } from 'vue'
import { randomId } from '@/utils/common'
import type { VisibilityRules } from '../../type'
import { inferFieldType, getAllowedOps, getFieldConfig } from './index'
import { visibilityCompareOptions } from '../../enums'
import { compareList } from '@/workflow-canvas/config/constants'
import ConditionRow from './ConditionRow.vue'
import type { LeftOptions } from '../type'

Expand Down Expand Up @@ -100,7 +99,7 @@ function render(rules: VisibilityRules | null) {
const fieldConfig = getFieldConfig(cond.field, props.leftOptions)
const isTreeMultiple = fieldType === 'TreeSelect' && fieldConfig?.attrs?.multiple
const allowed = isTreeMultiple ? ['contain', 'not_contain'] : getAllowedOps(fieldType)
cond._ops = visibilityCompareOptions.filter((op) => allowed.includes(op.value))
cond._ops = compareList.filter((op) => allowed.includes(op.value))
cond._fieldType = fieldType
cond._options = fieldConfig?.option_list ?? []
cond._treeData = fieldConfig?.attrs?.data ?? []
Expand Down
Loading