Browse Source

[Fix][UI Next]: Fix the missing delete button in the custom parameters component. (#8403)

3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
e023e09ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 45
      dolphinscheduler-ui-next/src/components/form/fields/custom-parameters.ts

45
dolphinscheduler-ui-next/src/components/form/fields/custom-parameters.ts

@ -15,11 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
import { defineComponent, h, renderSlot } from 'vue' import { defineComponent, h, unref, renderSlot } from 'vue'
import { useFormItem } from 'naive-ui/es/_mixins' import { useFormItem } from 'naive-ui/es/_mixins'
import { NFormItemGi, NSpace, NButton, NIcon, NGrid } from 'naive-ui' import { NFormItemGi, NSpace, NButton, NGrid, NGridItem } from 'naive-ui'
import { PlusCircleOutlined, DeleteOutlined } from '@vicons/antd' import { PlusOutlined, DeleteOutlined } from '@vicons/antd'
import { omit } from 'lodash'
import getField from './get-field' import getField from './get-field'
import { formatValidate } from '../utils' import { formatValidate } from '../utils'
import type { IJsonItem, FormItemRule } from '../types' import type { IJsonItem, FormItemRule } from '../types'
@ -43,13 +42,15 @@ const CustomParameters = defineComponent({
h( h(
NButton, NButton,
{ {
tertiary: true,
circle: true, circle: true,
size: 'small',
type: 'info', type: 'info',
disabled, disabled,
onClick: onAdd onClick: onAdd
}, },
() => h(NIcon, { size: 24 }, () => h(PlusCircleOutlined)) {
icon: () => h(PlusOutlined)
}
) )
] ]
} }
@ -76,9 +77,8 @@ export function renderCustomParameters(
NFormItemGi, NFormItemGi,
{ {
showLabel: false, showLabel: false,
...omit(item, ['field', 'type', 'props', 'options']),
path: `${field}[${i}].${child.field}`, path: `${field}[${i}].${child.field}`,
span: 6 span: unref(child.span)
}, },
() => getField(child, item) () => getField(child, item)
) )
@ -88,18 +88,27 @@ export function renderCustomParameters(
return h(NGrid, { xGap: 10 }, () => [ return h(NGrid, { xGap: 10 }, () => [
...getChild(item, i), ...getChild(item, i),
h( h(
NButton, NGridItem,
{ {
tertiary: true, span: 2
circle: true,
type: 'error',
disabled,
onClick: () => {
fields[field].splice(i, 1)
rules.splice(i, 1)
}
}, },
() => h(NIcon, { size: 24 }, () => h(DeleteOutlined)) () =>
h(
NButton,
{
circle: true,
type: 'error',
size: 'small',
disabled,
onClick: () => {
fields[field].splice(i, 1)
rules.splice(i, 1)
}
},
{
icon: () => h(DeleteOutlined)
}
)
) )
]) ])
}) })

Loading…
Cancel
Save