|
|
|
@ -38,14 +38,26 @@
|
|
|
|
|
<!-- 列表 --> |
|
|
|
|
<el-table v-loading="loading" stripe :data="list"> |
|
|
|
|
<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="projectId"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{projectList.find(p => p.id == scope.row.projectId).name}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<!-- <el-table-column label="任务名" align="center" prop="taskId" /> --> |
|
|
|
|
|
|
|
|
|
<el-table-column label="任务类型及内容" align="center" prop="taskId"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{taskConvert(scope.row.taskId)}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
<el-table-column label="事件名" align="center" prop="name" /> |
|
|
|
|
<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 |
|
|
|
|
v-if="scope.row.images[0] != null" |
|
|
|
|
:src="scope.row.images[0]" :preview-src-list="scope.row.images"> |
|
|
|
|
</el-image> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -70,7 +82,6 @@
|
|
|
|
|
<!-- 对话框(添加 / 修改) --> |
|
|
|
|
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|
|
|
|
|
|
|
|
|
<el-form-item label="项目" prop="projectId"> |
|
|
|
|
<el-select v-model="form.projectId" placeholder="请选择项目"> |
|
|
|
|
<el-option |
|
|
|
@ -81,7 +92,6 @@
|
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="任务" prop="projectId"> |
|
|
|
|
<el-select v-model="form.taskId" placeholder="请选择任务"> |
|
|
|
|
<el-option |
|
|
|
@ -92,7 +102,6 @@
|
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="事件名" prop="name"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
@ -117,7 +126,7 @@ import ImageUpload from '@/components/ImageUpload';
|
|
|
|
|
import Editor from '@/components/Editor'; |
|
|
|
|
import { getProjectPage } from "@/api/farm/project"; |
|
|
|
|
import { getTaskPage } from "@/api/farm/task"; |
|
|
|
|
|
|
|
|
|
import {getTaskCatePage} from "@/api/farm/taskCate"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "Event", |
|
|
|
@ -163,18 +172,33 @@ export default {
|
|
|
|
|
projectList:[], |
|
|
|
|
projectId:'', |
|
|
|
|
taskId:'', |
|
|
|
|
taskCateList:[] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.getProject(); |
|
|
|
|
this.getTaskCate(); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
taskConvert(task){ |
|
|
|
|
let taskArr = this.taskList.filter(t => t.id == task)[0]; |
|
|
|
|
let taskTypeName = ""; |
|
|
|
|
let taskName = ""; |
|
|
|
|
this.taskCateList.forEach(cate =>{ |
|
|
|
|
if (cate.id == taskArr.taskCateId) { |
|
|
|
|
taskTypeName = cate.name; |
|
|
|
|
} |
|
|
|
|
if (cate.id == taskArr.taskCateName) { |
|
|
|
|
taskName = cate.name; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
return taskTypeName + "/" +taskName; |
|
|
|
|
}, |
|
|
|
|
/*获取项目列表*/ |
|
|
|
|
getProject(){ |
|
|
|
|
getProjectPage({ |
|
|
|
|
pageNo: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
name: null, |
|
|
|
|
pageSize: 100, |
|
|
|
|
}).then(res=>{ |
|
|
|
|
this.projectList = res.data.list; |
|
|
|
|
this.getTask(); |
|
|
|
@ -184,13 +208,20 @@ export default {
|
|
|
|
|
getTask(){ |
|
|
|
|
getTaskPage({ |
|
|
|
|
pageNo: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
name: null, |
|
|
|
|
pageSize: 100, |
|
|
|
|
}).then(res=>{ |
|
|
|
|
this.taskList = res.data.list; |
|
|
|
|
this.getList(); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getTaskCate(){ |
|
|
|
|
getTaskCatePage({ |
|
|
|
|
pageNo: 1, |
|
|
|
|
pageSize: 100, |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.taskCateList = res.data.list; |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** 查询列表 */ |
|
|
|
|
getList() { |
|
|
|
@ -201,20 +232,20 @@ export default {
|
|
|
|
|
// 执行查询 |
|
|
|
|
getEventPage(params).then(response => { |
|
|
|
|
|
|
|
|
|
//循环遍历List |
|
|
|
|
response.data.list.forEach(eve => { |
|
|
|
|
//循环对比 project |
|
|
|
|
this.projectList.forEach(project =>{ |
|
|
|
|
if(project.id == eve.projectId){ |
|
|
|
|
eve.projectId = project.name; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.taskList.forEach(task =>{ |
|
|
|
|
if (task.id == eve.taskId) { |
|
|
|
|
eve.taskId = task.name; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
// //循环遍历List |
|
|
|
|
// response.data.list.forEach(eve => { |
|
|
|
|
// //循环对比 project |
|
|
|
|
// this.projectList.forEach(project =>{ |
|
|
|
|
// if(project.id == eve.projectId){ |
|
|
|
|
// eve.projectId = project.name; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// this.taskList.forEach(task =>{ |
|
|
|
|
// if (task.id == eve.taskId) { |
|
|
|
|
// eve.taskId = task.name; |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.total = response.data.total; |
|
|
|
@ -297,6 +328,7 @@ export default {
|
|
|
|
|
if (!valid) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.judgePictureExists(); |
|
|
|
|
// 修改的提交 |
|
|
|
|
if (this.form.id != null) { |
|
|
|
|
updateEvent(this.form).then(response => { |
|
|
|
@ -314,6 +346,24 @@ export default {
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
/*判断图片是否存在*/ |
|
|
|
|
judgePictureExists(){ |
|
|
|
|
if (this.form.id != null) { |
|
|
|
|
if (this.form.images == "") { |
|
|
|
|
this.form.images = []; |
|
|
|
|
}else{ |
|
|
|
|
let imagesType = typeof(this.form.images); |
|
|
|
|
if (imagesType == "string") { |
|
|
|
|
let imgArr = this.form.images.split(",") |
|
|
|
|
this.form.images = imgArr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.form.images == undefined || this.form.images =="") { |
|
|
|
|
this.form.images = []; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
|
handleDelete(row) { |
|
|
|
|
const id = row.id; |
|
|
|
|