diff --git a/src/views/article/subject/article.vue b/src/views/article/subject/article.vue index 2b31234..fcc692e 100644 --- a/src/views/article/subject/article.vue +++ b/src/views/article/subject/article.vue @@ -1,158 +1,159 @@ @@ -183,7 +184,6 @@ export default { special_id: undefined, }, subject: [], - uploadAction: process.env.VUE_APP_BASE_API + "/files/uploadFile", temp: { id: undefined, special_id: undefined, @@ -195,15 +195,11 @@ export default { update: "编辑", create: "添加", }, - rules: { - // title: [ - // { required: true, message: "title is required", trigger: "blur" }, - // ], - }, - downloadLoading: false, + defaultProps: {}, searchArticleLoading: false, articles: [], - validation: true, + special_title: "", + article_title: "", }; }, created() { @@ -221,10 +217,26 @@ export default { }, }, methods: { + // 点击树形结构 + handleNodeClick(data) { + this.listQuery.special_id = data.id; + this.defaultProps = data; + this.getList(); + }, + // 获取专题列表 getSubjectList() { this.listLoading = true; listSubject(this.listQuery).then((response) => { - this.subject = response.data; + response.data.forEach((i) => { + this.subject.push({ + label: i.title, + id: i.special_id, + }); + }); + this.subject.unshift({ + label: "全部", + id: "", + }); }); }, getList() { @@ -236,7 +248,7 @@ export default { // Just to simulate the time of the request setTimeout(() => { this.listLoading = false; - }, 1.5 * 1000); + }, 600); }); }, handleFilter() { @@ -260,12 +272,19 @@ export default { submitForm() { if (this.dialogStatus == "create") { this.createData(); - } else if (this.dialogStatus == "update") { - this.updateData(); } }, handleCreate() { + if (!this.defaultProps.id) { + this.$message({ + message: "请选择专题(全部除外)", + type: "warning", + }); + return; + } this.resetTemp(); + this.temp.special_id = this.defaultProps.id; + this.special_title = this.defaultProps.label; this.dialogStatus = "create"; this.dialogFormVisible = true; }, @@ -285,7 +304,7 @@ export default { // }) }, async handleDelete({ article_title, article_id, special_id }) { - let confirm = this.$confirm( + let confirm = await this.$confirm( '是否确认删除名称为"' + article_title + '"的数据项?', "警告", { @@ -294,7 +313,6 @@ export default { type: "warning", } ); - console.log(1); let r = await delSubjectArticle({ article_id, special_id }); if (r.code === 200) { this.$message({ @@ -341,6 +359,8 @@ export default {