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

Loading…
Cancel
Save