|
|
|
@ -112,11 +112,11 @@
|
|
|
|
|
<span>{{scope.row.mainPersonName}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="执行人" align="center" prop="executorPerson" width="80" > |
|
|
|
|
<!-- <el-table-column label="执行人" align="center" prop="executorPerson" width="80" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{executorPersonConvert(scope.row.executorNameList)}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table-column> --> |
|
|
|
|
<el-table-column label="区域" align="center" prop="areas" width="180" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{areaConvert(scope.row.areaNameList)}}</span> |
|
|
|
@ -127,7 +127,7 @@
|
|
|
|
|
<span> {{scope.row.cropName}} </span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="作物数量" align="center" prop="cropNum" /> |
|
|
|
|
<!-- <el-table-column label="作物数量" align="center" prop="cropNum" /> --> |
|
|
|
|
<el-table-column label="任务名" align="center" prop="taskCateId"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span> {{scope.row.taskName}} </span> |
|
|
|
@ -142,8 +142,8 @@
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{resouceConvert(scope.row.taskResourceList)}}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="工时" align="center" prop="workingHours" /> |
|
|
|
|
</el-table-column> --> |
|
|
|
|
<!-- <el-table-column label="工时" align="center" prop="workingHours" /> |
|
|
|
|
<el-table-column label="图片" align="center" prop="images"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-image v-if="scope.row.images != null && scope.row.images[0] != null" style="" :src="scope.row.images[0]" |
|
|
|
@ -151,16 +151,16 @@
|
|
|
|
|
</el-image> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="开始时间" align="center" prop="planStartTime" width="180"> |
|
|
|
|
<el-table-column label="预计执行时间" align="center" prop="planStartTime" width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ parseTime(scope.row.planStartTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="截止时间" align="center" prop="planEndTime" width="180"> |
|
|
|
|
<!-- <el-table-column label="截止时间" align="center" prop="planEndTime" width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ parseTime(scope.row.planEndTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table-column> --> |
|
|
|
|
<el-table-column label="优先级" align="center" prop="weight" /> |
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
@ -190,6 +190,14 @@
|
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="作物选择" prop="cropId"> |
|
|
|
|
<el-select v-model="form.cropId" placeholder="请选择"> |
|
|
|
|
<el-option v-for="item in selectCropList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
|
{{ item.name }} |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="负责人" prop="mainPerson"> |
|
|
|
|
<el-select v-model="form.mainPerson" filterable placeholder="请先选择项目"> |
|
|
|
|
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
@ -197,27 +205,21 @@
|
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="执行人" prop="executorPerson"> |
|
|
|
|
<!-- <el-form-item label="执行人" prop="executorPerson"> |
|
|
|
|
<el-select v-model="form.executorPerson" filterable multiple placeholder="请先选择项目"> |
|
|
|
|
<el-option v-for="item in selectCpUserList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
|
{{ item.name }} |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<el-form-item label="区域选择" prop="assemAreaList"> |
|
|
|
|
<el-cascader :options="assemAreaList" :props="props" emitPath clearable ref="chooseA" v-model="form.areas"> |
|
|
|
|
</el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="作物选择" prop="cropId"> |
|
|
|
|
<el-select v-model="form.cropId" placeholder="请选择"> |
|
|
|
|
<el-option v-for="item in selectCropList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
|
{{ item.name }} |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="作物数量" prop="cropNum"> |
|
|
|
|
|
|
|
|
|
<!-- <el-form-item label="作物数量" prop="cropNum"> |
|
|
|
|
<el-input v-model="form.cropNum" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<el-form-item label="任务类型" prop="taskCateId"> |
|
|
|
|
<el-select v-model="form.taskCateId" placeholder="请选择" @change="changeCateOne"> |
|
|
|
|
<el-option v-for="item in cateOneList" :key="item.id" :label="item.name" :value="item.id"> |
|
|
|
@ -237,22 +239,23 @@
|
|
|
|
|
<el-cascader :options="twoList" clearable v-model="item.resourceId" @change="(obj)=>ziyuanxuanze(item,index,obj)"> |
|
|
|
|
</el-cascader> |
|
|
|
|
<el-input v-model="item.num"/> |
|
|
|
|
<el-button @click="deleteResource(item)">删除</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="工时" prop="workingHours"> |
|
|
|
|
<!-- <el-form-item label="工时" prop="workingHours"> |
|
|
|
|
<el-input v-model="form.workingHours" placeholder="请输入工时" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
|
|
|
|
|
<el-form-item label="任务图片"> |
|
|
|
|
<imageUpload v-model="form.images" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="任务开始时间" prop="planStartTime"> |
|
|
|
|
<el-form-item label="预计执行时间" prop="planStartTime"> |
|
|
|
|
<el-date-picker clearable v-model="form.planStartTime" type="datetime" value-format="timestamp" |
|
|
|
|
placeholder="选择" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="任务结束时间" prop="planEndTime"> |
|
|
|
|
<!-- <el-form-item label="任务结束时间" prop="planEndTime"> |
|
|
|
|
<el-date-picker clearable v-model="form.planEndTime" type="datetime" value-format="timestamp" |
|
|
|
|
placeholder="选择" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<el-form-item label="优先级" prop="weight"> |
|
|
|
|
<el-input v-model="form.weight" placeholder="请输入优先级" /> |
|
|
|
|
</el-form-item> |
|
|
|
@ -286,6 +289,7 @@ import { getCpUserPage } from "@/api/system/cpUser";
|
|
|
|
|
import { getAreaPage } from "@/api/farm/area"; |
|
|
|
|
|
|
|
|
|
import { values } from 'min-dash'; |
|
|
|
|
import { ifStatement } from "@babel/types"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "Task", |
|
|
|
@ -425,6 +429,10 @@ export default {
|
|
|
|
|
let resourceTmp = {reource:0,num:1} |
|
|
|
|
this.form.resources = this.form.resources.concat(resourceTmp) |
|
|
|
|
}, |
|
|
|
|
deleteResource(item){ |
|
|
|
|
console.log(this.form.resources); |
|
|
|
|
this.form.resources = this.form.resources.filter(res => res!=item) |
|
|
|
|
}, |
|
|
|
|
getAreasList() { |
|
|
|
|
getAreaPage({ |
|
|
|
|
pageNo: 1, |
|
|
|
@ -503,7 +511,7 @@ export default {
|
|
|
|
|
/** 查询任务列表 */ |
|
|
|
|
getList() { |
|
|
|
|
this.loading = true; |
|
|
|
|
this.assemArea(); |
|
|
|
|
// this.assemArea(); |
|
|
|
|
// 处理查询参数 |
|
|
|
|
let params = { ...this.queryParams }; |
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangePlanStartTime, 'planStartTime'); |
|
|
|
@ -579,7 +587,7 @@ export default {
|
|
|
|
|
this.startMethod(); |
|
|
|
|
this.reset(); |
|
|
|
|
this.twoRescoure(); |
|
|
|
|
this.assemArea(); |
|
|
|
|
// this.assemArea(); |
|
|
|
|
this.resourceNumberList = []; |
|
|
|
|
this.open = true; |
|
|
|
|
this.title = "添加农场任务"; |
|
|
|
@ -588,7 +596,7 @@ export default {
|
|
|
|
|
handleUpdate(row) { |
|
|
|
|
this.startMethod(); |
|
|
|
|
this.reset(); |
|
|
|
|
this.assemArea(); |
|
|
|
|
// this.assemArea(); |
|
|
|
|
const id = row.id; |
|
|
|
|
getTask(id).then(response => { |
|
|
|
|
this.form = response.data; |
|
|
|
@ -596,6 +604,7 @@ export default {
|
|
|
|
|
this.title = "修改农场任务"; |
|
|
|
|
let project = this.projectList.filter(project => project.id == response.data.projectId)[0]; |
|
|
|
|
this.changeCpUser(project); |
|
|
|
|
this.showAreaByProject(project); |
|
|
|
|
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
@ -689,49 +698,47 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assemArea() { |
|
|
|
|
let parentLsit = this.areasList.filter(t => t.parentId == 0); |
|
|
|
|
let sonList = this.areasList.filter(s => s.parentId != 0); |
|
|
|
|
|
|
|
|
|
let firstList = []; |
|
|
|
|
parentLsit.forEach(p => { |
|
|
|
|
this.areasParentList.push(p); |
|
|
|
|
let secondList = []; |
|
|
|
|
sonList.forEach(s => { |
|
|
|
|
if (p.id == s.parentId) { |
|
|
|
|
this.areasSonList.push(s); |
|
|
|
|
secondList.push({ value: s.id, label: s.name }); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
firstList.push({ value: p.id, label: p.name, children: secondList }) |
|
|
|
|
}) |
|
|
|
|
this.assemAreaList = firstList; |
|
|
|
|
}, |
|
|
|
|
// assemArea() { |
|
|
|
|
// let parentLsit = this.areasList.filter(t => t.parentId == 0); |
|
|
|
|
// let sonList = this.areasList.filter(s => s.parentId != 0); |
|
|
|
|
// let firstList = []; |
|
|
|
|
// parentLsit.forEach(p => { |
|
|
|
|
// this.areasParentList.push(p); |
|
|
|
|
// let secondList = []; |
|
|
|
|
// sonList.forEach(s => { |
|
|
|
|
// if (p.id == s.parentId) { |
|
|
|
|
// let three = this.areasList.filter(t => t.parentId == s.id); |
|
|
|
|
// if(three.length == 0){ |
|
|
|
|
// secondList.push({ value: s.id, label: s.name }); |
|
|
|
|
// }else{ |
|
|
|
|
// let threeList = []; |
|
|
|
|
// three.forEach(three =>{ |
|
|
|
|
// threeList.push({value:three.id, label:three.name}); |
|
|
|
|
// }) |
|
|
|
|
// secondList.push({value:s.id, label:s.name, children:threeList}); |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// firstList.push({ value: p.id, label: p.name, children: secondList }) |
|
|
|
|
// }) |
|
|
|
|
// this.assemAreaList = firstList; |
|
|
|
|
// }, |
|
|
|
|
changeProject(row) { |
|
|
|
|
this.form.areas = null; |
|
|
|
|
this.assemArea(); |
|
|
|
|
let project = this.projectList.filter(project => project.id == row)[0]; |
|
|
|
|
let projectArea = project.areas; |
|
|
|
|
let filterArr = []; |
|
|
|
|
this.assemAreaList.forEach(t => { |
|
|
|
|
projectArea.forEach(a => { |
|
|
|
|
if (a == t.value) { |
|
|
|
|
filterArr.push(t); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.assemAreaList = filterArr; |
|
|
|
|
|
|
|
|
|
//根据项目 自动展示作物 |
|
|
|
|
this.form.cropId = null; |
|
|
|
|
this.selectCropList = this.cropList.filter(crop => crop.id == project.cropId); |
|
|
|
|
|
|
|
|
|
//根据项目 展示区域 |
|
|
|
|
this.form.areas = null; |
|
|
|
|
this.showAreaByProject(project); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//清楚 可选成员数量 |
|
|
|
|
this.selectCpUserList = []; |
|
|
|
|
this.form.mainPerson = null; |
|
|
|
|
this.form.executorPerson = null; |
|
|
|
|
this.changeCpUser(project); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
changeCpUser(project){ |
|
|
|
|
project.members.forEach(member =>{ |
|
|
|
@ -741,6 +748,56 @@ export default {
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
showAreaByProject(project){ |
|
|
|
|
//根据项目 展示可选区域 |
|
|
|
|
let first = []; |
|
|
|
|
let second =[]; |
|
|
|
|
let third =[]; |
|
|
|
|
this.areasList.forEach(ar =>{ |
|
|
|
|
project.areas.forEach(sel =>{ |
|
|
|
|
if(ar.id == sel){ |
|
|
|
|
if(ar.parentId != 0){ |
|
|
|
|
let parentAr = this.areasList.filter(item => item.id == ar.parentId)[0]; |
|
|
|
|
let thi = this.areasList.filter(item => item.id == sel)[0] |
|
|
|
|
if(parentAr.parentId != 0){ |
|
|
|
|
let ppA = this.areasList.filter(item => item.id == parentAr.parentId)[0]; |
|
|
|
|
first.push(ppA); |
|
|
|
|
second.push(parentAr); |
|
|
|
|
third.push(thi); |
|
|
|
|
}else{ |
|
|
|
|
first.push(parentAr); |
|
|
|
|
second.push(thi); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
let setFirst = new Set(first); |
|
|
|
|
let setSecond = new Set(second); |
|
|
|
|
|
|
|
|
|
let oneList = []; |
|
|
|
|
setFirst.forEach(fi =>{ |
|
|
|
|
let twoList = []; |
|
|
|
|
setSecond.forEach(se =>{ |
|
|
|
|
if(se.parentId == fi.id){ |
|
|
|
|
let threeList = []; |
|
|
|
|
third.forEach(th =>{ |
|
|
|
|
if(th.parentId == se.id){ |
|
|
|
|
threeList.push({value:th.id, label:th.name}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if(threeList.length != 0){ |
|
|
|
|
twoList.push({value:se.id, label:se.name, children:threeList}); |
|
|
|
|
}else{ |
|
|
|
|
twoList.push({value:se.id, label:se.name}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
oneList.push({value:fi.id, label:fi.name, children:twoList}); |
|
|
|
|
}) |
|
|
|
|
this.assemAreaList = oneList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|