|
|
|
@ -6,17 +6,14 @@
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<div class="app-container"> |
|
|
|
|
|
|
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
|
|
|
|
<el-form-item label="任务名" prop="name"> |
|
|
|
|
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<!-- 暂时不知道怎么查 --> |
|
|
|
|
<!-- <el-form-item label="资源名" prop="resources"> |
|
|
|
|
<el-form-item label="资源名" prop="resources"> |
|
|
|
|
<el-input v-model="queryParams.resources" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="开始时间"> |
|
|
|
|
<el-date-picker v-model="dateRangePlanStartTime" style="width: 240px" value-format="yyyy-MM-dd" |
|
|
|
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> |
|
|
|
@ -53,8 +50,6 @@
|
|
|
|
|
<el-table-column label="任务名" align="center" prop="name" /> |
|
|
|
|
<el-table-column label="任务内容" align="center" prop="content" /> |
|
|
|
|
<el-table-column label="需要的资源" align="center" prop="resources" /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column label="图片" align="center" prop="images" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-image |
|
|
|
@ -65,7 +60,6 @@
|
|
|
|
|
</el-image> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
|
<el-table-column label="开始时间" align="center" prop="planStartTime" width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ parseTime(scope.row.planStartTime) }}</span> |
|
|
|
@ -104,8 +98,6 @@
|
|
|
|
|
<el-form-item label="任务内容"> |
|
|
|
|
<editor v-model="form.content" :min-height="192"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="资源选择"> |
|
|
|
|
<el-select v-model="selectResourceList" multiple placeholder="请选择"> |
|
|
|
|
<el-option |
|
|
|
@ -117,11 +109,9 @@
|
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="任务图片"> |
|
|
|
|
<imageUpload v-model="form.images"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="任务开始时间" prop="planStartTime"> |
|
|
|
|
<el-date-picker clearable v-model="form.planStartTime" type="date" value-format="timestamp" placeholder="选择" /> |
|
|
|
|
</el-form-item> |
|
|
|
@ -141,7 +131,7 @@
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { createTask, updateTask, deleteTask, getTask, getTaskPage, exportTaskExcel } from "@/api/farm/task"; |
|
|
|
|
import { createTask, updateTask, deleteTask, getTask, getTaskPage, getTaskSearchPage, exportTaskExcel } from "@/api/farm/task"; |
|
|
|
|
import ImageUpload from '@/components/ImageUpload'; |
|
|
|
|
import Editor from '@/components/Editor'; |
|
|
|
|
import { getResourcePage } from "@/api/farm/resource"; |
|
|
|
@ -224,7 +214,6 @@ export default {
|
|
|
|
|
//无图片给个空 |
|
|
|
|
element.images = []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//2 循环每个list对象的resource |
|
|
|
|
element.resources = JSON.parse(element.resources); |
|
|
|
|
let resourceName = ''; |
|
|
|
@ -238,14 +227,46 @@ export default {
|
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
element.resources = resourceName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.total = response.data.total; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
/** 搜索条件查询任务列表 */ |
|
|
|
|
getSearchList() { |
|
|
|
|
this.loading = true; |
|
|
|
|
// 处理查询参数 |
|
|
|
|
let params = {...this.queryParams}; |
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangePlanEndTime, 'planEndTime'); |
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
|
|
|
|
// 执行查询 |
|
|
|
|
getTaskSearchPage(params).then(response => { |
|
|
|
|
response.data.list.forEach(element => { |
|
|
|
|
if(element.images != null){ |
|
|
|
|
element.images = JSON.parse(element.images); |
|
|
|
|
}else{ |
|
|
|
|
element.images = []; |
|
|
|
|
} |
|
|
|
|
element.resources = JSON.parse(element.resources); |
|
|
|
|
let resourceName = ''; |
|
|
|
|
element.resources.forEach((inn) =>{ |
|
|
|
|
this.resourceList.forEach((resource) =>{ |
|
|
|
|
if(inn == resource.id){ |
|
|
|
|
resourceName += (resource.name + "、\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
element.resources = resourceName; |
|
|
|
|
}); |
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.total = response.data.total; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** 取消按钮 */ |
|
|
|
|
cancel() { |
|
|
|
|
this.open = false; |
|
|
|
@ -268,7 +289,7 @@ export default {
|
|
|
|
|
/** 搜索按钮操作 */ |
|
|
|
|
handleQuery() { |
|
|
|
|
this.queryParams.pageNo = 1; |
|
|
|
|
this.getList(); |
|
|
|
|
this.getSearchList(); |
|
|
|
|
}, |
|
|
|
|
/** 重置按钮操作 */ |
|
|
|
|
resetQuery() { |
|
|
|
|