|
|
|
@ -52,6 +52,13 @@
|
|
|
|
|
<span> {{projectList.find(t=>t.id == scope.row.projectId ).name}} </span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="负责人" align="center" prop="mainPerson" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span> {{cpUserList.find(t=>t.id == scope.row.mainPerson ).name}} </span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="执行人" align="center" prop="executorPerson"/> |
|
|
|
|
|
|
|
|
|
<el-table-column label="作物名" align="center" prop="cropName" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span> {{cropList.find(t=>t.id == scope.row.cropId ).name}} </span> |
|
|
|
@ -61,6 +68,8 @@
|
|
|
|
|
<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="workingHours" /> |
|
|
|
|
|
|
|
|
|
<el-table-column label="图片" align="center" prop="images" > |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-image |
|
|
|
@ -104,7 +113,7 @@
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|
|
|
|
|
|
|
|
|
<el-form-item label="项目选择"> |
|
|
|
|
<el-form-item label="项目选择" prop="projectId"> |
|
|
|
|
<el-select v-model="form.projectId" placeholder="请选择"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in projectList" |
|
|
|
@ -116,7 +125,31 @@
|
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="作物选择"> |
|
|
|
|
<el-form-item label="负责人" prop="mainPerson"> |
|
|
|
|
<el-select v-model="form.mainPerson" placeholder="请选择"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in cpUserList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
{{item.name}} |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="执行人" prop="executorPerson"> |
|
|
|
|
<el-select v-model="executorPerson" multiple placeholder="请选择" > |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in cpUserList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
{{item.name}} |
|
|
|
|
</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 cropList" |
|
|
|
@ -128,32 +161,34 @@
|
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="作物数量"> |
|
|
|
|
<el-form-item label="作物数量" prop="cropNum"> |
|
|
|
|
<el-input v-model="form.cropNum" placeholder="请输入"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="任务名" prop="name"> |
|
|
|
|
<el-input v-model="form.name" placeholder="请输入" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="任务内容"> |
|
|
|
|
<el-form-item label="任务内容" prop="content"> |
|
|
|
|
<editor v-model="form.content" :min-height="192"/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<!-- <el-form-item label="资源选择"> |
|
|
|
|
<el-select v-model="selectResourceList" multiple placeholder="请选择" @change="changeResource"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in resourceList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
{{item.name}} |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="资源选择"> |
|
|
|
|
<el-cascader :options="twoList" :props="props" clearable v-model="form.resources"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<div v-for="(item,index) in resourceTypeList" :key="index"> |
|
|
|
|
<el-form-item label="资源选择"> |
|
|
|
|
<el-cascader |
|
|
|
|
:options="twoList" |
|
|
|
|
:props="props" |
|
|
|
|
collapse-tags |
|
|
|
|
clearable |
|
|
|
|
v-model="form.resources"> |
|
|
|
|
</el-cascader> |
|
|
|
|
<el-button @click="addR(index)">添加</el-button> |
|
|
|
|
<el-button @click="delR(index)">删除</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-form-item label="工时" prop="workingHours"> |
|
|
|
|
<el-input v-model="form.workingHours" placeholder="请输入工时" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="任务图片"> |
|
|
|
|
<imageUpload v-model="form.images"/> |
|
|
|
@ -184,6 +219,7 @@ import { getResourcePage } from "@/api/farm/resource";
|
|
|
|
|
import { getProjectPage} from "@/api/farm/project"; |
|
|
|
|
import { getCropPage} from "@/api/farm/crop"; |
|
|
|
|
import { getResourceTypePage} from "@/api/farm/resourceType"; |
|
|
|
|
import { getCpUserPage} from "@/api/system/cpUser" |
|
|
|
|
import { values } from 'min-dash'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
@ -222,12 +258,24 @@ export default {
|
|
|
|
|
weight: null, |
|
|
|
|
projectId: null, |
|
|
|
|
cropId: null, |
|
|
|
|
cropNum: null |
|
|
|
|
cropNum: null, |
|
|
|
|
workingHours: null |
|
|
|
|
}, |
|
|
|
|
// 表单参数 |
|
|
|
|
form: {}, |
|
|
|
|
// 表单校验 |
|
|
|
|
rules: { |
|
|
|
|
projectId: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
mainPerson: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
executorPerson: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
cropId: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
cropNum: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
name: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
content: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
workingHours: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
planStartTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
planEndTime: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
weight: [{ required: true, message: "不能为空", trigger: "blur" }], |
|
|
|
|
}, |
|
|
|
|
resourceList:[], |
|
|
|
|
selectResourceList:[], |
|
|
|
@ -238,7 +286,13 @@ export default {
|
|
|
|
|
selectResourceTypeList:[], |
|
|
|
|
|
|
|
|
|
twoList:[], |
|
|
|
|
props: { multiple: true } |
|
|
|
|
props: { multiple: true }, |
|
|
|
|
|
|
|
|
|
selectRList:[], |
|
|
|
|
|
|
|
|
|
cpUserList:[], |
|
|
|
|
selectExecutorPerson:[], |
|
|
|
|
executorPerson:[] |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
@ -246,9 +300,18 @@ export default {
|
|
|
|
|
this.getResource(); |
|
|
|
|
this.getResourceTypeList(); |
|
|
|
|
this.getProjectList(); |
|
|
|
|
this.getCpUserList(); |
|
|
|
|
this.getCropList(); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getCpUserList(){ |
|
|
|
|
getCpUserPage({ |
|
|
|
|
pageNo: 1, |
|
|
|
|
pageSize: 100 |
|
|
|
|
}).then(res=>{ |
|
|
|
|
this.cpUserList = res.data.list; |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getCropList(){ |
|
|
|
|
getCropPage({ |
|
|
|
|
pageNo: 1, |
|
|
|
@ -294,6 +357,7 @@ export default {
|
|
|
|
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); |
|
|
|
|
// 执行查询 |
|
|
|
|
getTaskPage(params).then(response => { |
|
|
|
|
|
|
|
|
|
//1 循环list |
|
|
|
|
response.data.list.forEach(element => { |
|
|
|
|
if(element.images != null){ |
|
|
|
@ -316,6 +380,18 @@ export default {
|
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
element.resources = resourceName; |
|
|
|
|
|
|
|
|
|
element.executorPerson = JSON.parse(element.executorPerson); |
|
|
|
|
let executorName = ''; |
|
|
|
|
element.executorPerson.forEach((exe)=>{ |
|
|
|
|
this.cpUserList.forEach((cp)=>{ |
|
|
|
|
if(exe == cp.id){ |
|
|
|
|
executorName += (cp.name +"、\n"); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
element.executorPerson = executorName; |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this.list = response.data.list; |
|
|
|
|
this.total = response.data.total; |
|
|
|
@ -375,8 +451,13 @@ export default {
|
|
|
|
|
weight: undefined, |
|
|
|
|
projectName: undefined, |
|
|
|
|
cropId: undefined, |
|
|
|
|
cropNum: undefined |
|
|
|
|
cropNum: undefined, |
|
|
|
|
mainPerson: undefined, |
|
|
|
|
executorPerson: undefined, |
|
|
|
|
workingHours: undefined |
|
|
|
|
}; |
|
|
|
|
this.executorPerson = undefined, |
|
|
|
|
|
|
|
|
|
this.resetForm("form"); |
|
|
|
|
}, |
|
|
|
|
/** 搜索按钮操作 */ |
|
|
|
@ -415,6 +496,11 @@ export default {
|
|
|
|
|
let imagesArr = JSON.parse(response.data.images); |
|
|
|
|
this.form.images = imagesArr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(response.data.executorPerson != null){ |
|
|
|
|
let executorArr = JSON.parse(response.data.executorPerson); |
|
|
|
|
this.form.executorPerson = executorArr; |
|
|
|
|
} |
|
|
|
|
this.open = true; |
|
|
|
|
this.title = "修改农场任务"; |
|
|
|
|
}); |
|
|
|
@ -427,11 +513,7 @@ export default {
|
|
|
|
|
} |
|
|
|
|
//资源转json |
|
|
|
|
this.form.resources = JSON.stringify(this.selectResourceList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(this.form); |
|
|
|
|
console.log(1111,this.form.resources); |
|
|
|
|
|
|
|
|
|
this.form.executorPerson = JSON.stringify(this.executorPerson); |
|
|
|
|
//图片转json |
|
|
|
|
let im = this.form.images; |
|
|
|
|
this.form.images = JSON.stringify(""); |
|
|
|
@ -452,6 +534,7 @@ export default {
|
|
|
|
|
} |
|
|
|
|
// 添加的提交 |
|
|
|
|
createTask(this.form).then(response => { |
|
|
|
|
this.form.executorPerson = JSON.stringify(this.form.executorPerson); |
|
|
|
|
this.$modal.msgSuccess("新增成功"); |
|
|
|
|
this.open = false; |
|
|
|
|
this.getList(); |
|
|
|
@ -498,6 +581,12 @@ export default {
|
|
|
|
|
firstList.push({value: type.id, label : type.name, children: secondList}); |
|
|
|
|
}) |
|
|
|
|
this.twoList = firstList; |
|
|
|
|
}, |
|
|
|
|
addR(row){ |
|
|
|
|
console.log("添加", row); |
|
|
|
|
}, |
|
|
|
|
delR(row){ |
|
|
|
|
console.log("删除", row); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|