feat(心理论坛模块): 更新新增/修改弹窗表单,添加同步功能
- 修改弹窗标题为“修改”,并移除链接地址输入项 - 更新表单数据结构,确保只保留分类信息 - 添加同步按钮,替换新增按钮,优化用户操作流程 - 实现同步弹窗的显示逻辑,支持数据列表的刷新
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
width="1260px"
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
title="修改"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible"
|
||||
@close="handlereset"
|
||||
@@ -16,13 +16,6 @@
|
||||
ref="dataForm"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="链接地址" prop="url">
|
||||
<el-input
|
||||
v-model="dataForm.url"
|
||||
placeholder="链接地址"
|
||||
:rows="3"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="type">
|
||||
<el-select v-model="dataForm.type" placeholder="请选择分类" clearable>
|
||||
<el-option
|
||||
@@ -45,7 +38,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import global from "../../common/common.vue"; //引入共用组间
|
||||
import global from "../../common/common.vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -56,21 +49,15 @@ export default {
|
||||
typeList: [],
|
||||
dataForm: {
|
||||
id: null,
|
||||
title: '',
|
||||
url: '',
|
||||
type: ''
|
||||
type: ""
|
||||
},
|
||||
dataRule: {
|
||||
type: [
|
||||
{ required: true, message: "分类不能为空", trigger: "change" }
|
||||
],
|
||||
url: [
|
||||
{ required: true, message: "链接地址不能为空", trigger: "change" }
|
||||
]
|
||||
},
|
||||
urlList: {
|
||||
info: "/master/message/getMessageById",
|
||||
add: "/common/wxPublicAccount/addWxPublicAccountArticle",
|
||||
update: "/common/wxPublicAccount/updateWxPublicAccountArticle"
|
||||
}
|
||||
};
|
||||
@@ -92,8 +79,7 @@ export default {
|
||||
this.getTypeList();
|
||||
this.dataForm = {
|
||||
id: row && row.id || null,
|
||||
url: row && row.url || '',
|
||||
type: row && row.type != null ? String(row.type) : ''
|
||||
type: row && row.type != null ? String(row.type) : ""
|
||||
};
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
@@ -102,22 +88,24 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs["dataForm"].validate(valid => {
|
||||
if (valid) {
|
||||
// 这里应该是提交数据的逻辑
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
fullscreen: true
|
||||
});
|
||||
this.$http
|
||||
.request({
|
||||
url: this.dataForm.id ? this.$http.adornUrl(this.urlList.update) : this.$http.adornUrl(this.urlList.add),
|
||||
url: this.$http.adornUrl(this.urlList.update),
|
||||
method: "POST",
|
||||
data: this.dataForm,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(({ data }) => {
|
||||
loading.close();
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
@@ -131,6 +119,9 @@ export default {
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user