界面优化
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="name">
|
||||
<el-form-item label="区域名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -36,9 +36,8 @@
|
||||
<el-table-column label="物料图片" align="center" prop="images" >
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style=""
|
||||
:src="scope.row.images.split(',')[0]"
|
||||
:preview-src-list="scope.row.images.split(',')">
|
||||
v-if="scope.row.images[0] != null"
|
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -192,6 +191,7 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateCrop(this.form).then(response => {
|
||||
@@ -209,6 +209,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imagesType = typeof(this.form.images);
|
||||
if (imagesType == "string") {
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined || this.form.images =="") {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
|
||||
@@ -40,8 +40,9 @@
|
||||
<el-table-column label="讨论内容" align="center" prop="content" />
|
||||
<el-table-column label="事件图片" align="center" prop="images">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="" :src="scope.row.images.split(',')[0]"
|
||||
:preview-src-list="scope.row.images.split(',')">
|
||||
<el-image
|
||||
v-if="scope.row.images[0] != null"
|
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -254,6 +255,7 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateDiscuss(this.form).then(response => {
|
||||
@@ -271,6 +273,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imagesType = typeof(this.form.images);
|
||||
if (imagesType == "string") {
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined || this.form.images =="") {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
|
||||
@@ -38,14 +38,26 @@
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" stripe :data="list">
|
||||
<el-table-column label="事件ID" align="center" prop="id" />
|
||||
<el-table-column label="项目名" align="center" prop="projectId" />
|
||||
<el-table-column label="任务名" align="center" prop="taskId" />
|
||||
<el-table-column label="项目名" align="center" prop="projectId">
|
||||
<template slot-scope="scope">
|
||||
<span>{{projectList.find(p => p.id == scope.row.projectId).name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="任务名" align="center" prop="taskId" /> -->
|
||||
|
||||
<el-table-column label="任务类型及内容" align="center" prop="taskId">
|
||||
<template slot-scope="scope">
|
||||
<span>{{taskConvert(scope.row.taskId)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="事件名" align="center" prop="name" />
|
||||
<el-table-column label="事件内容" align="center" prop="content" />
|
||||
<el-table-column label="事件图片" align="center" prop="images">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="" :src="scope.row.images.split(',')[0]"
|
||||
:preview-src-list="scope.row.images.split(',')">
|
||||
<el-image
|
||||
v-if="scope.row.images[0] != null"
|
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -70,7 +82,6 @@
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
<el-form-item label="项目" prop="projectId">
|
||||
<el-select v-model="form.projectId" placeholder="请选择项目">
|
||||
<el-option
|
||||
@@ -81,7 +92,6 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="任务" prop="projectId">
|
||||
<el-select v-model="form.taskId" placeholder="请选择任务">
|
||||
<el-option
|
||||
@@ -92,7 +102,6 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="事件名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
@@ -117,7 +126,7 @@ import ImageUpload from '@/components/ImageUpload';
|
||||
import Editor from '@/components/Editor';
|
||||
import { getProjectPage } from "@/api/farm/project";
|
||||
import { getTaskPage } from "@/api/farm/task";
|
||||
|
||||
import {getTaskCatePage} from "@/api/farm/taskCate";
|
||||
|
||||
export default {
|
||||
name: "Event",
|
||||
@@ -163,18 +172,33 @@ export default {
|
||||
projectList:[],
|
||||
projectId:'',
|
||||
taskId:'',
|
||||
taskCateList:[]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getProject();
|
||||
this.getTaskCate();
|
||||
},
|
||||
methods: {
|
||||
taskConvert(task){
|
||||
let taskArr = this.taskList.filter(t => t.id == task)[0];
|
||||
let taskTypeName = "";
|
||||
let taskName = "";
|
||||
this.taskCateList.forEach(cate =>{
|
||||
if (cate.id == taskArr.taskCateId) {
|
||||
taskTypeName = cate.name;
|
||||
}
|
||||
if (cate.id == taskArr.taskCateName) {
|
||||
taskName = cate.name;
|
||||
}
|
||||
})
|
||||
return taskTypeName + "/" +taskName;
|
||||
},
|
||||
/*获取项目列表*/
|
||||
getProject(){
|
||||
getProjectPage({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
pageSize: 100,
|
||||
}).then(res=>{
|
||||
this.projectList = res.data.list;
|
||||
this.getTask();
|
||||
@@ -184,13 +208,20 @@ export default {
|
||||
getTask(){
|
||||
getTaskPage({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
pageSize: 100,
|
||||
}).then(res=>{
|
||||
this.taskList = res.data.list;
|
||||
this.getList();
|
||||
})
|
||||
},
|
||||
getTaskCate(){
|
||||
getTaskCatePage({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
}).then(res =>{
|
||||
this.taskCateList = res.data.list;
|
||||
})
|
||||
},
|
||||
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
@@ -201,20 +232,20 @@ export default {
|
||||
// 执行查询
|
||||
getEventPage(params).then(response => {
|
||||
|
||||
//循环遍历List
|
||||
response.data.list.forEach(eve => {
|
||||
//循环对比 project
|
||||
this.projectList.forEach(project =>{
|
||||
if(project.id == eve.projectId){
|
||||
eve.projectId = project.name;
|
||||
}
|
||||
});
|
||||
this.taskList.forEach(task =>{
|
||||
if (task.id == eve.taskId) {
|
||||
eve.taskId = task.name;
|
||||
}
|
||||
})
|
||||
});
|
||||
// //循环遍历List
|
||||
// response.data.list.forEach(eve => {
|
||||
// //循环对比 project
|
||||
// this.projectList.forEach(project =>{
|
||||
// if(project.id == eve.projectId){
|
||||
// eve.projectId = project.name;
|
||||
// }
|
||||
// });
|
||||
// this.taskList.forEach(task =>{
|
||||
// if (task.id == eve.taskId) {
|
||||
// eve.taskId = task.name;
|
||||
// }
|
||||
// })
|
||||
// });
|
||||
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
@@ -297,6 +328,7 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateEvent(this.form).then(response => {
|
||||
@@ -314,6 +346,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imagesType = typeof(this.form.images);
|
||||
if (imagesType == "string") {
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined || this.form.images =="") {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
<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="areas"/> -->
|
||||
<el-table-column label="区域名" align="center" prop="areas" width="80" >
|
||||
<template slot-scope="scope">
|
||||
<span>{{areasConvert(scope.row.areas)}}</span>
|
||||
@@ -66,19 +65,16 @@
|
||||
<span> {{cropList.find(t=>t.id == scope.row.cropId ).name}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="项目成员" align="center" prop="members"/> -->
|
||||
|
||||
<el-table-column label="项目成员" align="center" prop="members">
|
||||
<template slot-scope="scope">
|
||||
<span>{{membersConvert(scope.row.members)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="图片" align="center" prop="images">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="" :src="scope.row.images.split(',')[0]"
|
||||
:preview-src-list="scope.row.images.split(',')">
|
||||
<el-image
|
||||
v-if="scope.row.images[0] != null"
|
||||
:src="scope.row.images[0]" :preview-src-list="scope.row.images">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -376,7 +372,7 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateProject(this.form).then(response => {
|
||||
@@ -394,6 +390,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imagesType = typeof(this.form.images);
|
||||
if (imagesType == "string") {
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined || this.form.images =="") {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
|
||||
@@ -61,9 +61,7 @@
|
||||
<el-table-column label="图片" align="center" prop="images" >
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style=""
|
||||
:src="scope.row.images.split(',')[0]"
|
||||
:preview-src-list="scope.row.images.split(',')">
|
||||
v-if="scope.row.images[0] != null" :src="scope.row.images[0]" :preview-src-list="scope.row.images">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -119,10 +117,10 @@
|
||||
<imageUpload v-model="form.images"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期开始:" prop="validityStartTime">
|
||||
<el-date-picker clearable v-model="form.validityStartTime" type="date" value-format="timestamp" placeholder="选择" />
|
||||
<el-date-picker clearable v-model="form.validityStartTime" type="datetime" value-format="timestamp" placeholder="选择" />
|
||||
</el-form-item>
|
||||
<el-form-item label="有效期结束:" prop="validityEndTime">
|
||||
<el-date-picker clearable v-model="form.validityEndTime" type="date" value-format="timestamp" placeholder="选择" />
|
||||
<el-date-picker clearable v-model="form.validityEndTime" type="datetime" value-format="timestamp" placeholder="选择" />
|
||||
</el-form-item>
|
||||
<el-form-item label="唯一占用:" prop="solo">
|
||||
<el-radio-group v-model="form.solo">
|
||||
@@ -184,6 +182,10 @@ export default {
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
resourceType: [{ required: true, message: "资源类型不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "资源名称不能为空", trigger: "blur" }],
|
||||
validityStartTime: [{ required: true, message: "有效期开始不能为空", trigger: "blur" }],
|
||||
validityEndTime: [{ required: true, message: "有效期结束不能为空", trigger: "blur" }],
|
||||
},
|
||||
resourceTypeList:[]
|
||||
};
|
||||
@@ -193,7 +195,6 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
@@ -269,10 +270,12 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
console.log("农场资源提交信息", this.form);
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateResource(this.form).then(response => {
|
||||
@@ -290,6 +293,21 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined) {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
|
||||
@@ -298,7 +298,6 @@ export default {
|
||||
|
||||
cateOneList: [],
|
||||
cateTwoList: [],
|
||||
formR: {},
|
||||
|
||||
areasList: [],
|
||||
assemAreaList: [],
|
||||
@@ -318,6 +317,7 @@ export default {
|
||||
methods: {
|
||||
executorPersonConvert(executorPerson){
|
||||
let executorPersonName = "";
|
||||
if (executorPerson != null) {
|
||||
executorPerson.forEach(person => {
|
||||
this.cpUserList.forEach( user => {
|
||||
if (person == user.id) {
|
||||
@@ -325,6 +325,7 @@ export default {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
return executorPersonName;
|
||||
},
|
||||
areaConvert(area){
|
||||
@@ -339,7 +340,6 @@ export default {
|
||||
})
|
||||
return areaMsg;
|
||||
}
|
||||
|
||||
},
|
||||
resouceConvert(resources){
|
||||
let resouceMsg = "";
|
||||
@@ -442,16 +442,6 @@ export default {
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
// 执行查询
|
||||
getTaskPage(params).then(response => {
|
||||
//1 循环list
|
||||
response.data.list.forEach(element => {
|
||||
if (element.images != null) {
|
||||
//有图片转json
|
||||
element.images = JSON.parse(element.images);
|
||||
} else {
|
||||
//无图片给个空
|
||||
element.images = [];
|
||||
}
|
||||
});
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
@@ -468,13 +458,6 @@ export default {
|
||||
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 = [];
|
||||
}
|
||||
});
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
@@ -535,10 +518,6 @@ export default {
|
||||
const id = row.id;
|
||||
getTask(id).then(response => {
|
||||
this.form = response.data;
|
||||
if (response.data.images != null) {
|
||||
let imagesArr = JSON.parse(response.data.images);
|
||||
this.form.images = imagesArr;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改农场任务";
|
||||
});
|
||||
@@ -550,15 +529,8 @@ export default {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
//图片转json
|
||||
let im = this.form.images;
|
||||
this.form.images = JSON.stringify("");
|
||||
if (im) {
|
||||
//不为空
|
||||
let imgArr = im.split(",")
|
||||
this.form.images = JSON.stringify(imgArr);
|
||||
}
|
||||
|
||||
this.judgePictureExists();
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateTask(this.form).then(response => {
|
||||
@@ -576,6 +548,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/*判断图片是否存在*/
|
||||
judgePictureExists(){
|
||||
if (this.form.id != null) {
|
||||
if (this.form.images == "") {
|
||||
this.form.images = [];
|
||||
}else{
|
||||
let imagesType = typeof(this.form.images);
|
||||
if (imagesType == "string") {
|
||||
let imgArr = this.form.images.split(",")
|
||||
this.form.images = imgArr;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.form.images == undefined || this.form.images =="") {
|
||||
this.form.images = [];
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
@@ -643,7 +633,7 @@ export default {
|
||||
changeProject(row) {
|
||||
this.form.areas = null;
|
||||
this.assemArea();
|
||||
let projectArea = JSON.parse(this.projectList.filter(project => project.id == row)[0].areas);
|
||||
let projectArea = this.projectList.filter(project => project.id == row)[0].areas;
|
||||
let filterArr = [];
|
||||
this.assemAreaList.forEach(t => {
|
||||
projectArea.forEach(a => {
|
||||
|
||||
Reference in New Issue
Block a user