diff --git a/src/views/farm/project/index.vue b/src/views/farm/project/index.vue
index 91acbb9..21c443d 100644
--- a/src/views/farm/project/index.vue
+++ b/src/views/farm/project/index.vue
@@ -61,6 +61,8 @@
{{cropList.find(t=>t.id == scope.row.cropId ).name}}
+
+
-
+
-
+
-
-
+
+
{{item.name}}
+
+
+ {{item.name}}
+
+
+
@@ -151,6 +159,7 @@ import Editor from '@/components/Editor';
// import { getResourcePage } from "@/api/farm/resource";
import { getAreaPage} from "@/api/farm/area";
import { getCropPage} from "@/api/farm/crop";
+import { getCpUserPage} from "@/api/system/cpUser"
export default {
@@ -188,22 +197,34 @@ export default {
images: null,
weight: null,
areas: null,
- cropId: null
+ cropId: null,
+ members: null
},
// 表单参数
form: {},
// 表单校验
rules: {
+ name: [{ required: true, message: "不能为空", trigger: "blur" }],
+ content: [{ required: true, message: "不能为空", trigger: "blur" }],
+ selectAreasList: [{ required: true, message: "不能为空", trigger: "blur" }],
+ cropId: [{ required: true, message: "不能为空", trigger: "blur" }],
+ selectMembersList: [{ required: true, message: "不能为空", trigger: "blur" }],
+ planStartTime: [{ required: true, message: "不能为空", trigger: "blur" }],
+ planEndTime: [{ required: true, message: "不能为空", trigger: "blur" }],
+ weight: [{ required: true, message: "不能为空", trigger: "blur" }],
},
areasList:[],
selectAreasList:[],
- cropList:[]
+ cropList:[],
+ membersList:[],
+ selectMembersList:[]
};
},
created() {
this.getAreasList();
this.getCropList();
+ this.getCpUserList();
this.getList();
},
methods: {
@@ -223,6 +244,14 @@ export default {
this.areasList = res.data.list;
})
},
+ getCpUserList(){
+ getCpUserPage({
+ pageNo: 1,
+ pageSize: 100
+ }).then(res =>{
+ this.membersList = res.data.list;
+ })
+ },
/** 查询项目列表 */
getList() {
this.loading = true;
@@ -241,11 +270,26 @@ export default {
if(inn == ar.id){
areasName += (ar.name + "、\n");
}
- }
- )
+ })
})
element.areas = areasName;
+
+ element.members = JSON.parse(element.members);
+ if(element.members != null){
+ let memberName = '';
+ element.members.forEach((mem) =>{
+ this.membersList.forEach((sel) =>{
+ if(mem == sel.id){
+ memberName += (sel.name + "、\n");
+ }
+ })
+ })
+ element.members = memberName;
+ }
+
});
+
+
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
@@ -294,7 +338,8 @@ export default {
planEndTime: undefined,
weight: undefined,
areas: undefined,
- cropId:undefined
+ cropId:undefined,
+ members: undefined
};
this.resetForm("form");
},
@@ -315,6 +360,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
+ this.getCpUserList();
this.open = true;
this.title = "添加农场项目";
},
@@ -327,6 +373,11 @@ export default {
let areasArray = JSON.parse(response.data.areas);
this.form.areas = areasArray;
this.selectAreasList = areasArray;
+
+ let membersArray = JSON.parse(response.data.members);
+ this.form.members = membersArray;
+ this.selectMembersList = membersArray;
+
this.open = true;
this.title = "修改农场项目";
});
@@ -338,6 +389,8 @@ export default {
return;
}
this.form.areas = JSON.stringify(this.selectAreasList);
+ this.form.members = JSON.stringify(this.selectMembersList);
+
// 修改的提交
if (this.form.id != null) {
updateProject(this.form).then(response => {
@@ -350,6 +403,7 @@ export default {
// 添加的提交
createProject(this.form).then(response => {
this.form.areas = JSON.stringify(this.form.areas);
+ this.form.members = JSON.stringify(this.form.members);
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
diff --git a/src/views/farm/task/index.vue b/src/views/farm/task/index.vue
index 488f826..f8f6728 100644
--- a/src/views/farm/task/index.vue
+++ b/src/views/farm/task/index.vue
@@ -52,6 +52,13 @@
{{projectList.find(t=>t.id == scope.row.projectId ).name}}
+
+
+ {{cpUserList.find(t=>t.id == scope.row.mainPerson ).name}}
+
+
+
+
{{cropList.find(t=>t.id == scope.row.cropId ).name}}
@@ -61,6 +68,8 @@
+
+
-
+
-
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
+ 添加
+ 删除
+
+
+
+
+
@@ -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);
}
}
};