Browse Source

界面优化

master
小久哥 3 years ago
parent
commit
3c55a8a754
  1. 2
      src/views/farm/area/index.vue
  2. 24
      src/views/farm/crop/index.vue
  3. 24
      src/views/farm/discuss/index.vue
  4. 102
      src/views/farm/event/index.vue
  5. 32
      src/views/farm/project/index.vue
  6. 30
      src/views/farm/resource/index.vue
  7. 66
      src/views/farm/task/index.vue

2
src/views/farm/area/index.vue

@ -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>

24
src/views/farm/crop/index.vue

@ -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;

24
src/views/farm/discuss/index.vue

@ -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;

102
src/views/farm/event/index.vue

@ -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;

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

@ -55,10 +55,9 @@
<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>
<span>{{areasConvert(scope.row.areas)}}</span>
</template>
</el-table-column>
<el-table-column label="作物名" align="center" prop="cropId" >
@ -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;

30
src/views/farm/resource/index.vue

@ -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;

66
src/views/farm/task/index.vue

@ -298,7 +298,6 @@ export default {
cateOneList: [],
cateTwoList: [],
formR: {},
areasList: [],
assemAreaList: [],
@ -318,13 +317,15 @@ export default {
methods: {
executorPersonConvert(executorPerson){
let executorPersonName = "";
executorPerson.forEach(person => {
this.cpUserList.forEach( user => {
if (person == user.id) {
executorPersonName += user.name + "\n";
}
if (executorPerson != null) {
executorPerson.forEach(person => {
this.cpUserList.forEach( user => {
if (person == user.id) {
executorPersonName += user.name + "\n";
}
})
})
})
}
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 => {

Loading…
Cancel
Save