fix : dashboardTemplate 增加验证

This commit is contained in:
likexuan
2022-11-23 14:10:17 +08:00
parent e8ff90303c
commit 0e315c5895
2 changed files with 24 additions and 4 deletions

View File

@@ -47,7 +47,7 @@
></v-selectpage> ></v-selectpage>
</el-form-item> --> </el-form-item> -->
<!-- DashboardTemplate --> <!-- DashboardTemplate -->
<el-form-item :label="$t('model.dashboardtemplate')" prop="DashboardTemplate"> <el-form-item :label="$t('model.dashboardtemplate')" prop="panelId" ref="dashboardTemplate">
<v-selectpage <v-selectpage
:data="dashboardList" :data="dashboardList"
:tb-columns="DashboardSearchShowFields" :tb-columns="DashboardSearchShowFields"
@@ -57,7 +57,7 @@
:language="language" :language="language"
title="DashboardSearch" title="DashboardSearch"
key-field="id" key-field="id"
:width="640" :width="634"
v-model="editModel.panelId" v-model="editModel.panelId"
show-field="name" show-field="name"
class="form-control" class="form-control"
@@ -148,6 +148,9 @@ export default {
], ],
sysObjectId: [ sysObjectId: [
{ validator: sysObjectIdInput, trigger: 'blur' } { validator: sysObjectIdInput, trigger: 'blur' }
],
panelId: [
{ required: true, message: this.$t('validate.required'), trigger: ['blur', 'change'] }
] ]
} }
} }
@@ -161,6 +164,13 @@ export default {
this.editModel = JSON.parse(JSON.stringify(n)) this.editModel = JSON.parse(JSON.stringify(n))
this.editModel.panelId = n.panelId ? n.panelId + '' : '' this.editModel.panelId = n.panelId ? n.panelId + '' : ''
} }
},
'editModel.panelId': {
handler (n) {
if (n) {
this.$refs.dashboardTemplate.$emit('el.form.change')
}
}
} }
}, },
created () { created () {

View File

@@ -61,7 +61,7 @@
></el-autocomplete> ></el-autocomplete>
</el-form-item> </el-form-item>
<!-- DashboardTemplate --> <!-- DashboardTemplate -->
<el-form-item :label="$t('model.dashboardtemplate')" prop="DashboardTemplate"> <el-form-item :label="$t('model.dashboardtemplate')" prop="panelId" ref="dashboardTemplate">
<v-selectpage <v-selectpage
:data="dashboardList" :data="dashboardList"
:tb-columns="DashboardSearchShowFields" :tb-columns="DashboardSearchShowFields"
@@ -71,7 +71,7 @@
:language="language" :language="language"
title="DashboardSearch" title="DashboardSearch"
key-field="id" key-field="id"
:width="640" :width="634"
v-model="editModule.panelId" v-model="editModule.panelId"
show-field="name" show-field="name"
class="form-control" class="form-control"
@@ -800,6 +800,9 @@ export default {
], ],
timeout: [ timeout: [
{ validator: nzNumber, trigger: 'blur' } { validator: nzNumber, trigger: 'blur' }
],
panelId: [
{ required: true, message: this.$t('validate.required'), trigger: ['blur', 'change'] }
] ]
}, },
projectList: [], projectList: [],
@@ -1684,6 +1687,13 @@ export default {
this.configsCopyValue = JSON.stringify(params, null, 2) this.configsCopyValue = JSON.stringify(params, null, 2)
} }
} }
},
'editModule.panelId': {
handler (n) {
if (n) {
this.$refs.dashboardTemplate.$emit('el.form.change')
}
}
} }
} }
} }