Browse Source

农场任务搜索页面

master
小久哥 3 years ago
parent
commit
1b6f8f0ed9
  1. 21
      src/api/farm/task.js
  2. 55
      src/views/farm/task/index.vue

21
src/api/farm/task.js

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 创建农场项目
// 创建农场任务
export function createTask(data) {
return request({
url: '/farm/task/create',
@ -9,7 +9,7 @@ export function createTask(data) {
})
}
// 更新农场项目
// 更新农场任务
export function updateTask(data) {
return request({
url: '/farm/task/update',
@ -18,7 +18,7 @@ export function updateTask(data) {
})
}
// 删除农场项目
// 删除农场任务
export function deleteTask(id) {
return request({
url: '/farm/task/delete?id=' + id,
@ -26,7 +26,7 @@ export function deleteTask(id) {
})
}
// 获得农场项目
// 获得农场任务
export function getTask(id) {
return request({
url: '/farm/task/get?id=' + id,
@ -34,7 +34,7 @@ export function getTask(id) {
})
}
// 获得农场项目分页
// 获得农场任务分页
export function getTaskPage(query) {
return request({
url: '/farm/task/page',
@ -43,7 +43,16 @@ export function getTaskPage(query) {
})
}
// 导出农场项目 Excel
// 条件搜索获得农场任务分页
export function getTaskSearchPage(query) {
return request({
url: '/farm/task/pageSearch',
method: 'get',
params: query
})
}
// 导出农场任务 Excel
export function exportTaskExcel(query) {
return request({
url: '/farm/task/export-excel',

55
src/views/farm/task/index.vue

@ -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 listresource
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() {

Loading…
Cancel
Save