[add] 参数模板必填细节

This commit is contained in:
zhaomeijing
2022-05-13 10:34:52 +08:00
parent fcb3a4d580
commit 3bb083fd36
2 changed files with 33 additions and 19 deletions
@@ -109,6 +109,12 @@ export default {
], ],
description:[ description:[
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' }, { min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
],
state: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('status'), trigger: 'change' },
],
region: [
{ required: true, message: this.$t('PleaseSelect')+this.$t('zoneOfApplication'), trigger: 'change' },
] ]
}, },
disabled: false, disabled: false,
@@ -92,14 +92,18 @@
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm"> <a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="24"> <a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('templateName')">{{$t('templateName')}}</span>
</div>
<a-form-model-item class="itemModel" prop="paramsTemplateName"> <a-form-model-item class="itemModel" prop="paramsTemplateName">
<span class="title-text-text"
:title="$t('templateName')">{{$t('templateName')}}
</span>
<a-input class="box-input add-input" <a-input class="box-input add-input"
v-model="paramsTemplateName" v-model="formInline.paramsTemplateName"
:placeholder="$t('PleaseEnter')+$t('templateName')"/> :placeholder="$t('PleaseEnter')+$t('templateName')"/>
</a-form-model-item> </a-form-model-item>
</div>
</a-col> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
@@ -131,7 +135,11 @@ export default {
selectedRowKeys: [], selectedRowKeys: [],
selectedRowKeysArray: '', selectedRowKeysArray: '',
formInline: {}, formInline: {},
rules: {}, rules: {
paramsTemplateName:[
{ required: true, message: this.$t('PleaseEnter')+this.$t('templateName'), trigger: 'change' },
],
},
visible: false, visible: false,
dataSource: [], dataSource: [],
confirmLoading: false, confirmLoading: false,
@@ -203,20 +211,19 @@ export default {
this.areaVisible=false this.areaVisible=false
}, },
handleSubmit() { handleSubmit() {
if(this.paramsTemplateName.trim() === '') { this.$refs.ruleForm.validate(valid => {
this.$message.warning(this.$t('templateName') + this.$t('cannotEmpty')) if (valid) {
} else { getAction(this.url.copy + `?id=${this.selectedRowKeys[0]}&paramsTemplateName=${this.formInline.paramsTemplateName}`, {}).then((res) => {
getAction(this.url.copy + `?id=${this.selectedRowKeys[0]}&paramsTemplateName=${this.paramsTemplateName}`, {}).then((res) => { if (res.success) {
if (res.success) { this.areaVisible = false
this.areaVisible=false this.$message.success(res.message)
this.$message.success(res.message) this.getList()
this.getList() } else {
} else { this.$message.warning(res.message)
this.$message.warning(res.message) }
} })
}) }
} })
console.log(this.paramsTemplateName,'this.paramsTemplateName')
}, },
handleToggleSearch() { handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus this.toggleSearchStatus = !this.toggleSearchStatus
@@ -237,6 +244,7 @@ export default {
this.$message.warning(this.$t('pleaseSelectData')) this.$message.warning(this.$t('pleaseSelectData'))
} else { } else {
this.areaVisible=true this.areaVisible=true
this.formInline = {}
} }
}, },
hideModal(){ hideModal(){