|
|
@ -2,11 +2,12 @@ |
|
|
|
<ElForm :style="getStyle()" :model="modelFormData" :label-width="labelWidth" class="FormConfig" ref="ElFormRef" |
|
|
|
size="mini"> |
|
|
|
<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)" |
|
|
|
: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"> |
|
|
|
<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]" |
|
|
|
v-on="resolveListeners(item.ons)" /> --> |
|
|
|
</slot> |
|
|
@ -237,14 +238,14 @@ export default { |
|
|
|
`${item.options?.placeholder || `${item.label}不能为空`}` |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const err = ruleMatch(value); |
|
|
|
|
|
|
|
if (err) return callback(err); |
|
|
|
|
|
|
|
callback(); |
|
|
|
}, |
|
|
|
trigger: ["blur", "change"], |
|
|
|
trigger: [], |
|
|
|
}, |
|
|
|
]; |
|
|
|
else if (item.rules?.length) |
|
|
@ -261,7 +262,7 @@ export default { |
|
|
|
|
|
|
|
callback(); |
|
|
|
}, |
|
|
|
trigger: ["blur", "change"], |
|
|
|
trigger: [], |
|
|
|
}, |
|
|
|
]; |
|
|
|
}, |
|
|
@ -278,6 +279,11 @@ export default { |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
::v-deep .formSelfReauired .el-form-item__label::before{ |
|
|
|
content: "*"; |
|
|
|
color: #ff4949; |
|
|
|
margin-right: 4px; |
|
|
|
} |
|
|
|
.list-item { |
|
|
|
display: inline-block; |
|
|
|
margin-right: 10px; |
|
|
|