Browse Source

项目管理搜索条件

master
小久哥 3 years ago
parent
commit
2e8f8fd196
  1. 9
      src/api/farm/project.js
  2. 56
      src/views/farm/project/index.vue

9
src/api/farm/project.js

@ -43,6 +43,15 @@ export function getProjectPage(query) {
})
}
// 搜索条件获得农场项目分页
export function getProjectSearchPage(query) {
return request({
url: '/farm/project/pageSearch',
method: 'get',
params: query
})
}
// 导出农场项目 Excel
export function exportProjectExcel(query) {
return request({

56
src/views/farm/project/index.vue

@ -10,14 +10,15 @@
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="资源" prop="resource">
<el-select v-model="queryParams.resource" placeholder="请选择" clearable size="small">
<el-option v-for="item in resourceList" :label="item.name" :value="item.id" :key="item.id" />
</el-select>
</el-form-item> -->
<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-input v-model="queryParams.resources" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="优先级" prop="weight">
<el-input v-model="queryParams.weight" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</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="结束日期" />
@ -26,9 +27,6 @@
<el-date-picker v-model="dateRangePlanEndTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<el-form-item label="优先级" prop="weight">
<el-input v-model="queryParams.weight" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
@ -57,9 +55,7 @@
<el-table-column label="ID" align="center" prop="id" />
<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 style="" :src="scope.row.images.split(',')[0]"
@ -67,7 +63,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>
@ -106,7 +101,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
@ -118,7 +112,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="项目图片">
<imageUpload v-model="form.images"/>
</el-form-item>
@ -141,7 +134,7 @@
</template>
<script>
import { createProject, updateProject, deleteProject, getProject, getProjectPage, exportProjectExcel } from "@/api/farm/project";
import { createProject, updateProject, deleteProject, getProject, getProjectPage, exportProjectExcel, getProjectSearchPage } from "@/api/farm/project";
import ImageUpload from '@/components/ImageUpload';
import Editor from '@/components/Editor';
import { getResourcePage } from "@/api/farm/resource";
@ -238,6 +231,34 @@ export default {
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');
//
getProjectSearchPage(params).then(response =>{
response.data.list.forEach(element => {
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() {
@ -261,7 +282,8 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
this.getSearchList();
// this.getList();
},
/** 重置按钮操作 */
resetQuery() {
@ -269,7 +291,9 @@ export default {
this.dateRangePlanEndTime = [];
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
// this.handleQuery();
this.queryParams.pageNo = 1;
this.getList();
},
/** 新增按钮操作 */
handleAdd() {

Loading…
Cancel
Save