Browse Source

农场任务讨论UI

master
小久哥 3 years ago
parent
commit
aadd0a5f03
  1. 89
      src/views/farm/discuss/index.vue
  2. 5
      src/views/farm/event/index.vue

89
src/views/farm/discuss/index.vue

@ -34,12 +34,18 @@
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="" align="center" prop="id" />
<el-table-column label="" align="center" prop="projectId" />
<el-table-column label="" align="center" prop="taskId" />
<el-table-column label="" align="center" prop="content" />
<el-table-column label="" align="center" prop="images" />
<el-table-column label="" align="center" prop="createTime" width="180">
<el-table-column label="讨论ID" align="center" prop="id" />
<el-table-column label="项目名" align="center" prop="projectId" />
<el-table-column label="任务名" align="center" prop="taskId" />
<el-table-column label="讨论内容" align="center" prop="content" />
<el-table-column label="事件图片" align="center" prop="images">
<template slot-scope="scope">
<el-image style="" :src="scope.row.images.split(',')[0]"
:preview-src-list="scope.row.images.split(',')">
</el-image>
</template>
</el-table-column>
<el-table-column label="发表时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -60,16 +66,30 @@
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入" />
<el-form-item label="项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择项目">
<el-option
v-for="item in projectList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="taskId">
<el-input v-model="form.taskId" placeholder="请输入" />
<el-form-item label="任务" prop="projectId">
<el-select v-model="form.taskId" placeholder="请选择任务">
<el-option
v-for="item in taskList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="">
<el-form-item label="讨论">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="">
<el-form-item label="讨论图片">
<imageUpload v-model="form.images"/>
</el-form-item>
</el-form>
@ -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;

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

Loading…
Cancel
Save