diff --git a/src/views/modules/content/psychologicalForum-add-or-update.vue b/src/views/modules/content/psychologicalForum-add-or-update.vue index 6092ca1..b45477d 100644 --- a/src/views/modules/content/psychologicalForum-add-or-update.vue +++ b/src/views/modules/content/psychologicalForum-add-or-update.vue @@ -23,6 +23,17 @@ :rows="3" > + + + + + + @@ -42,14 +53,19 @@ export default { visible: false, dialogImageUrl: "", dialogVisible: false, + typeList: [], dataForm: { id: null, title: '', - url: '' + url: '', + type: '' }, dataRule: { + type: [ + { required: true, message: "分类不能为空", trigger: "change" } + ], url: [ - { required: true, message: "链接地址不能为空", trigger: "blur" } + { required: true, message: "链接地址不能为空", trigger: "change" } ] }, urlList: { @@ -60,12 +76,31 @@ export default { }; }, methods: { + getTypeList() { + this.$http({ + url: this.$http.adornUrl("/book/sysdictdata/selectByType/psycheForumLabel"), + method: "get" + }).then(({ data }) => { + if (data && data.code === 0) { + this.typeList = data.dataList || []; + } else { + this.typeList = []; + } + }); + }, init(row) { + this.getTypeList(); this.dataForm = { id: row && row.id || null, - url: row && row.url || '' + url: row && row.url || '', + type: row && row.type != null ? String(row.type) : '' }; this.visible = true; + this.$nextTick(() => { + if (this.$refs["dataForm"]) { + this.$refs["dataForm"].clearValidate(); + } + }); }, // 表单提交 dataFormSubmit() { @@ -101,6 +136,9 @@ export default { }); }, handlereset() { + if (this.$refs["dataForm"]) { + this.$refs["dataForm"].clearValidate(); + } this.visible = false; } } diff --git a/src/views/modules/content/psychologicalForum.vue b/src/views/modules/content/psychologicalForum.vue index ed39139..9eb2656 100644 --- a/src/views/modules/content/psychologicalForum.vue +++ b/src/views/modules/content/psychologicalForum.vue @@ -5,6 +5,17 @@ :model="dataForm" @keyup.enter.native="getDataList()" > + + + + + + + + { + if (data && data.code === 0) { + this.typeList = data.dataList || []; + } else { + this.typeList = []; + } + }); + }, + typeFormatter(row) { + const current = this.typeList.find( + item => item.dictType === row.type || String(item.dictType) === String(row.type) + ); + return current ? current.dictValue : row.type; + }, // 获取数据列表 getDataList() { console.log("this.selectQueryApp at line 195:", this.selectQueryApp);