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