未验证 提交 0841ccac 编写于 作者: A Amy0104 提交者: GitHub

[Fix][UI Next][V1.0.0-Alpha] Fix the default items display error in SQOOP. (#9211)

上级 8d60e920
......@@ -32,8 +32,9 @@ export function renderRadio(item: IJsonItem, fields: { [field: string]: any }) {
return h(
NRadioGroup,
{
...props,
value: fields[field],
onUpdateValue: (value) => void (fields[field] = value)
onUpdateValue: (value: any) => void (fields[field] = value)
},
() =>
h(NSpace, null, () =>
......
......@@ -31,7 +31,7 @@ export default function getElementByJson(
const elements: IFormItem[] = []
for (const item of json) {
const mergedItem = isFunction(item) ? item() : item
const { name, value, field, validate, ...rest } = mergedItem
const { name, value, field, children, validate, ...rest } = mergedItem
if (value || value === 0) {
fields[field] = value
initialValues[field] = value
......@@ -41,7 +41,7 @@ export default function getElementByJson(
showLabel: !!name,
...omit(rest, ['type', 'props', 'options']),
label: name,
path: field,
path: !children ? field : '',
widget: () => getField(item, fields, rules),
span: toRef(mergedItem, 'span') as Ref<number>
}
......
......@@ -60,7 +60,7 @@ const Form = defineComponent({
{...formItemProps}
span={unref(span) === void 0 ? 24 : unref(span)}
path={path}
key={path}
key={path || String(Date.now() + Math.random())}
>
{h(widget)}
</NFormItemGi>
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { onMounted, ref, unref, Ref } from 'vue'
import { onMounted, ref, Ref } from 'vue'
import { queryDataSourceList } from '@/service/modules/data-source'
import { useI18n } from 'vue-i18n'
import type { IJsonItem, IDataBase } from '../types'
......@@ -52,7 +52,7 @@ export function useDatasource(
span: span,
options: [{ label: 'MYSQL', value: 'MYSQL' }],
validate: {
required: unref(span) !== 0
required: true
}
},
{
......
......@@ -33,7 +33,7 @@ export function useSourceType(
const columnSpan = ref(0)
const hiveSpan = ref(0)
const hdfsSpan = ref(0)
const datasourceSpan = ref(0)
const datasourceSpan = ref(12)
const resetSpan = () => {
mysqlSpan.value =
unCustomSpan.value && model.sourceType === 'MYSQL' ? 24 : 0
......@@ -94,7 +94,7 @@ export function useSourceType(
() => model.modelType,
(modelType: ModelType) => {
sourceTypes.value = getSourceTypesByModelType(modelType)
if (!sourceTypes.value.find((type) => model.sourceType === type.value)) {
if (!model.sourceType) {
model.sourceType = sourceTypes.value[0].value
}
}
......@@ -149,7 +149,12 @@ export function useSourceType(
label: 'SQL',
value: '1'
}
]
],
props: {
'on-update:value': (value: '0' | '1') => {
model.targetType = value === '0' ? 'HIVE' : 'HDFS'
}
}
},
{
type: 'input',
......
......@@ -26,8 +26,8 @@ export function useTargetType(
unCustomSpan: Ref<number>
): IJsonItem[] {
const { t } = useI18n()
const hiveSpan = ref(24)
const hdfsSpan = ref(0)
const hiveSpan = ref(0)
const hdfsSpan = ref(24)
const mysqlSpan = ref(0)
const dataSourceSpan = ref(0)
const updateSpan = ref(0)
......@@ -103,7 +103,7 @@ export function useTargetType(
() => [model.sourceType, model.srcQueryType],
([sourceType, srcQueryType]) => {
targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType)
if (!targetTypes.value.find((type) => model.targetType === type.value)) {
if (!model.targetType) {
model.targetType = targetTypes.value[0].value
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册