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(); }) },