|
|
@ -12,7 +12,7 @@
|
|
|
|
<slot name="formHeader"></slot>
|
|
|
|
<slot name="formHeader"></slot>
|
|
|
|
<template v-for="schema in getSchema" :key="schema.field">
|
|
|
|
<template v-for="schema in getSchema" :key="schema.field">
|
|
|
|
<FormItem
|
|
|
|
<FormItem
|
|
|
|
v-show="(schema.isEdit == 2 || schema.component == 'Divider' || schema.component == 'InputTextArea') && schema.show !== false"
|
|
|
|
v-if="schema.isEdit != 1 || schema.component == 'Divider' || schema.component == 'InputTextArea'"
|
|
|
|
:is-advanced="fieldsIsAdvancedMap[schema.field]"
|
|
|
|
:is-advanced="fieldsIsAdvancedMap[schema.field]"
|
|
|
|
:table-action="tableAction"
|
|
|
|
:table-action="tableAction"
|
|
|
|
:form-action-type="formActionType"
|
|
|
|
:form-action-type="formActionType"
|
|
|
@ -27,7 +27,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</FormItem>
|
|
|
|
</FormItem>
|
|
|
|
<!-- 只读 -->
|
|
|
|
<!-- 只读 -->
|
|
|
|
<a-col :span="schema?.colProps?.span || 24" v-show="schema.show !== false && schema.isEdit == 1 && schema.component != 'Divider' && schema.component != 'InputTextArea'">
|
|
|
|
<a-col :span="schema?.colProps?.span || 24" v-if="schema.show !== false && schema.isEdit == 1 && schema.component != 'Divider' && schema.component != 'InputTextArea'">
|
|
|
|
<div class="ds-form-onlyread">
|
|
|
|
<div class="ds-form-onlyread">
|
|
|
|
<span class="label">{{ schema.label }}:</span> {{ formModel[schema.field] || '-' }}
|
|
|
|
<span class="label">{{ schema.label }}:</span> {{ formModel[schema.field] || '-' }}
|
|
|
|
<span v-if="!schema.dynamicDisabled" class="iconfont icon-bianji1" @click="editFormItem(schema)"></span>
|
|
|
|
<span v-if="!schema.dynamicDisabled" class="iconfont icon-bianji1" @click="editFormItem(schema)"></span>
|
|
|
@ -125,23 +125,17 @@
|
|
|
|
...rowProps,
|
|
|
|
...rowProps,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const getBindValue = computed(
|
|
|
|
const getBindValue = computed(
|
|
|
|
() => ({ ...attrs, ...props, ...unref(getProps) } as Recordable),
|
|
|
|
() => ({ ...attrs, ...props, ...unref(getProps) } as Recordable),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
// 每个表单只执行一次isEdit
|
|
|
|
|
|
|
|
let editFlag = false
|
|
|
|
|
|
|
|
const getSchema = computed((): FormSchema[] => {
|
|
|
|
const getSchema = computed((): FormSchema[] => {
|
|
|
|
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any)
|
|
|
|
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any)
|
|
|
|
const isReadonly = unref(propsRef).readonly
|
|
|
|
const isReadonly = unref(propsRef).readonly
|
|
|
|
for (const schema of schemas) {
|
|
|
|
for (const schema of schemas) {
|
|
|
|
if (!editFlag) {
|
|
|
|
// 如果表单包含只读属性。处理每个item增加是否可编辑
|
|
|
|
// 如果表单包含只读属性。处理每个item增加是否可编辑 (只读1)(可编辑2)
|
|
|
|
if (isReadonly && !schema.isEdit) schema['isEdit'] = 1
|
|
|
|
if (isReadonly) {
|
|
|
|
|
|
|
|
schema['isEdit'] = 1
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
schema['isEdit'] = 2
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const { defaultValue, component, isHandleDateDefaultValue = true } = schema
|
|
|
|
const { defaultValue, component, isHandleDateDefaultValue = true } = schema
|
|
|
|
// handle date type
|
|
|
|
// handle date type
|
|
|
|
if (isHandleDateDefaultValue && defaultValue && dateItemType.includes(component)) {
|
|
|
|
if (isHandleDateDefaultValue && defaultValue && dateItemType.includes(component)) {
|
|
|
@ -156,9 +150,6 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (schemas.length) {
|
|
|
|
|
|
|
|
editFlag = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (unref(getProps).showAdvancedButton) {
|
|
|
|
if (unref(getProps).showAdvancedButton) {
|
|
|
|
return cloneDeep(
|
|
|
|
return cloneDeep(
|
|
|
|
schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[],
|
|
|
|
schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[],
|
|
|
|