|
@ -2,11 +2,12 @@ |
|
|
<ElForm :style="getStyle()" :model="modelFormData" :label-width="labelWidth" class="FormConfig" ref="ElFormRef" |
|
|
<ElForm :style="getStyle()" :model="modelFormData" :label-width="labelWidth" class="FormConfig" ref="ElFormRef" |
|
|
size="mini"> |
|
|
size="mini"> |
|
|
<template v-for="(item, index) in formList"> |
|
|
<template v-for="(item, index) in formList"> |
|
|
<ElFormItem class="formItem" :rules="getRules(item)" v-if="formItemVisible(item)" :key="`${item.key}|${index}`" |
|
|
<ElFormItem :class="item.required?'formItem formSelfReauired':'formItem'" :rules="getRules(item)" v-if="formItemVisible(item)" :key="`${item.key}|${index}`" |
|
|
:label="item.label" :style="gridStyle(item, index)" |
|
|
:label="item.label" :style="gridStyle(item, index)" |
|
|
:prop="item.type !== 'MultipleLabelItem' ? item.key : void 0" :required="item.required"> |
|
|
:prop="item.type !== 'MultipleLabelItem' ? item.key : void 0"> |
|
|
<slot :name="item.key" :data="item" :formData="modelFormData"> |
|
|
<slot :name="item.key" :data="item" :formData="modelFormData"> |
|
|
<ProxyCom :value="getValue(item)" :item="item" @update:value="(data) => updateValue(item, data)" /> |
|
|
<ProxyCom :value="getValue(item)" :item="item" @update:value="(data) => updateValue(item, data)" /> |
|
|
|
|
|
|
|
|
<!-- <component :is="getComponent(item.type)" v-bind="getBindData(item)" v-model="modelFormData[item.key]" |
|
|
<!-- <component :is="getComponent(item.type)" v-bind="getBindData(item)" v-model="modelFormData[item.key]" |
|
|
v-on="resolveListeners(item.ons)" /> --> |
|
|
v-on="resolveListeners(item.ons)" /> --> |
|
|
</slot> |
|
|
</slot> |
|
@ -237,14 +238,14 @@ export default { |
|
|
`${item.options?.placeholder || `${item.label}不能为空`}` |
|
|
`${item.options?.placeholder || `${item.label}不能为空`}` |
|
|
) |
|
|
) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const err = ruleMatch(value); |
|
|
const err = ruleMatch(value); |
|
|
|
|
|
|
|
|
if (err) return callback(err); |
|
|
if (err) return callback(err); |
|
|
|
|
|
|
|
|
callback(); |
|
|
callback(); |
|
|
}, |
|
|
}, |
|
|
trigger: ["blur", "change"], |
|
|
trigger: [], |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
else if (item.rules?.length) |
|
|
else if (item.rules?.length) |
|
@ -261,7 +262,7 @@ export default { |
|
|
|
|
|
|
|
|
callback(); |
|
|
callback(); |
|
|
}, |
|
|
}, |
|
|
trigger: ["blur", "change"], |
|
|
trigger: [], |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
}, |
|
|
}, |
|
@ -278,6 +279,11 @@ export default { |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
|
|
|
::v-deep .formSelfReauired .el-form-item__label::before{ |
|
|
|
|
|
content: "*"; |
|
|
|
|
|
color: #ff4949; |
|
|
|
|
|
margin-right: 4px; |
|
|
|
|
|
} |
|
|
.list-item { |
|
|
.list-item { |
|
|
display: inline-block; |
|
|
display: inline-block; |
|
|
margin-right: 10px; |
|
|
margin-right: 10px; |
|
|