From aadd0a5f031a3d2d959634e710a0d5edf298f5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com> Date: Wed, 20 Apr 2022 15:05:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=9C=E5=9C=BA=E4=BB=BB=E5=8A=A1=E8=AE=A8?= =?UTF-8?q?=E8=AE=BAUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/farm/discuss/index.vue | 89 +++++++++++++++++++++++++++----- src/views/farm/event/index.vue | 5 +- 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/src/views/farm/discuss/index.vue b/src/views/farm/discuss/index.vue index f556265..a13cbc5 100644 --- a/src/views/farm/discuss/index.vue +++ b/src/views/farm/discuss/index.vue @@ -34,12 +34,18 @@ - - - - - - + + + + + + + + @@ -60,16 +66,30 @@ - - + + + + + - - + + + + + - + - + @@ -85,6 +105,9 @@ import { createDiscuss, updateDiscuss, deleteDiscuss, getDiscuss, getDiscussPage, exportDiscussExcel } from "@/api/farm/discuss"; import ImageUpload from '@/components/ImageUpload'; import Editor from '@/components/Editor'; +import { getProjectPage } from "@/api/farm/project"; +import { getTaskPage } from "@/api/farm/task"; + export default { name: "Discuss", @@ -124,13 +147,38 @@ export default { rules: { projectId: [{ required: true, message: "不能为空", trigger: "blur" }], taskId: [{ required: true, message: "不能为空", trigger: "blur" }], - } + }, + projectList:[], + taskList:[], }; }, + created() { - this.getList(); + this.getProject(); }, methods: { + /*获取项目列表*/ + getProject(){ + getProjectPage({ + pageNo: 1, + pageSize: 10, + name: null, + }).then(res=>{ + this.projectList = res.data.list; + this.getTask(); + }) + }, + /*获取任务列表*/ + getTask(){ + getTaskPage({ + pageNo: 1, + pageSize: 10, + name: null, + }).then(res=>{ + this.taskList = res.data.list; + this.getList(); + }) + }, /** 查询列表 */ getList() { this.loading = true; @@ -139,6 +187,19 @@ export default { this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); // 执行查询 getDiscussPage(params).then(response => { + response.data.list.forEach(discuss => { + this.projectList.forEach(project => { + if (project.id == discuss.projectId) { + discuss.projectId = project.name; + } + }); + this.taskList.forEach(task =>{ + if (task.id == discuss.taskId) { + discuss.taskId = task.name; + } + }) + }); + this.list = response.data.list; this.total = response.data.total; this.loading = false; diff --git a/src/views/farm/event/index.vue b/src/views/farm/event/index.vue index 1cd167b..0ff6412 100644 --- a/src/views/farm/event/index.vue +++ b/src/views/farm/event/index.vue @@ -167,9 +167,6 @@ export default { }, created() { this.getProject(); - this.getTask(); - this.getList(); - }, methods: { /*获取项目列表*/ @@ -180,6 +177,7 @@ export default { name: null, }).then(res=>{ this.projectList = res.data.list; + this.getTask(); }) }, /*获取任务列表*/ @@ -190,6 +188,7 @@ export default { name: null, }).then(res=>{ this.taskList = res.data.list; + this.getList(); }) },