Browse Source

tableform组件修改

master
陈薪名 1 year ago
parent
commit
587ab3a272
  1. 23
      src/components/TableForm/src/TableForm.vue

23
src/components/TableForm/src/TableForm.vue

@ -48,11 +48,12 @@
:sortable="headerItem?.tableForm?.sortable || ''" :sortable="headerItem?.tableForm?.sortable || ''"
:width="headerItem?.tableForm?.width || '200'" :width="headerItem?.tableForm?.width || '200'"
:min-width="headerItem?.tableForm?.minWidth || 'auto'"> :min-width="headerItem?.tableForm?.minWidth || 'auto'">
<el-form ref="TableBaseForm_Ref" <el-form
:model="row" ref="TableBaseForm_Ref"
style="width: 100%;" :model="row"
:rules="tableFormRules" style="width: 100%;"
:class="tableFormRules ? '' : 'noRulesForm'"> :rules="tableFormRules"
:class="tableFormRules ? '' : 'noRulesForm'">
<!-- 字符串输入框 --> <!-- 字符串输入框 -->
<el-form-item <el-form-item
v-if="!headerItem?.tableForm?.type || headerItem?.tableForm?.type == 'InputString'" v-if="!headerItem?.tableForm?.type || headerItem?.tableForm?.type == 'InputString'"
@ -357,20 +358,23 @@ const itemIsDisabled = (colum, row) => {
return Boolean(colum.tableForm?.disabled) || Boolean(row.disabled) || Boolean(row['disabled_' + colum.field]) return Boolean(colum.tableForm?.disabled) || Boolean(row.disabled) || Boolean(row['disabled_' + colum.field])
} }
// const { t } = useI18n() //
// const message = useMessage() //
const TableBaseComponents_Ref = ref() const TableBaseComponents_Ref = ref()
const TableBaseForm_Ref = ref() const TableBaseForm_Ref = ref()
/** /**
* 验证表单是否符合rules * 验证表单是否符合rules
* @param {*} success 如果验证成功走的方法 * @param {*} success 如果验证成功走的方法
* @param {*} error 如果验证不成功走的方法 * @param {*} error 如果验证不成功走的方法
*/ */
const validateForm = async () => { const validateForm = () => {
let _lists = TableBaseForm_Ref.value.map(v => v.validate()) let _lists = TableBaseForm_Ref.value?.map(v => v.validate())
return Promise.all(_lists).then(res => { return Promise.all(_lists).then(() => {
return true return true
}).catch(err => { }).catch(() => {
return false return false
}) })
} }
@ -389,6 +393,7 @@ const inpuFocus = (headerItem)=>{
emit('inpuFocus') emit('inpuFocus')
} }
} }
// setup // setup
defineExpose({ defineExpose({
TableBaseComponents_Ref, TableBaseComponents_Ref,

Loading…
Cancel
Save