This commit is contained in:
yanran200730
2021-12-23 16:10:20 +08:00
parent 3b3a728b7d
commit f48f191273

View File

@@ -33,13 +33,13 @@
height="580px"
title="文章分类"
@close="onClose"
@onConfirm="isShowAdd = false">
@onConfirm="onConfirm(false)">
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
<el-form-item label="分类名称" style="width: 500px;" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]">
<div class="catewrapper">
<el-input size="small" style="width: 300px;" placeholder="请输入分类名称" v-model="form.categoryName">
</el-input>
<el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" @click="onConfirm">添加</el-button>
<el-button style="margin-left: 20px;" size="small" type="primary" icon="iconfont iconAdd" v-if="!id" @click="onConfirm(true)">添加</el-button>
</div>
</el-form-item>
</el-form>
@@ -166,7 +166,13 @@
})
},
onConfirm () {
onConfirm (flag) {
if (!flag && !this.id) {
this.isShowAdd = false
return false
}
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appcontentmodulecategory/addOrUpdate`, {
@@ -175,14 +181,14 @@
}).then(res => {
if (res.code == 0) {
this.$message.success('提交成功')
this.getList()
this.getCateList()
if (this.id) {
this.id = ''
this.form.categoryName = ''
return false
}
this.getList()
this.getCateList()
}
})
}