Browse Source

注释,资源相关代码

master
zhanyunjiu 3 years ago
parent
commit
cd9b22729a
  1. 128
      src/views/farm/discuss/index.vue

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

@ -46,11 +46,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="讨论内容" align="center" prop="content" /> <el-table-column label="讨论内容" align="center" prop="content" />
<el-table-column label="需要的资源" align="center" prop="resources" width="180"> <!-- <el-table-column label="需要的资源" align="center" prop="resources" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{resouceConvert(scope.row.resources)}}</span> <span>{{resouceConvert(scope.row.resources)}}</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="事件图片" align="center" prop="images"> <el-table-column label="事件图片" align="center" prop="images">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
@ -130,13 +130,13 @@
placeholder="选择" /> placeholder="选择" />
</el-form-item> </el-form-item>
<el-button type="primary" @click="addResource">添加资源</el-button> <!-- <el-button type="primary" @click="addResource">添加资源</el-button>
<el-form-item label="资源选择" v-for="(item,index) in form.resources" :key="index"> <el-form-item label="资源选择" v-for="(item,index) in form.resources" :key="index">
<el-cascader :options="twoList" clearable v-model="item.resourceId" @change="(obj)=>ziyuanxuanze(item,index,obj)"> <el-cascader :options="twoList" clearable v-model="item.resourceId" @change="(obj)=>ziyuanxuanze(item,index,obj)">
</el-cascader> </el-cascader>
<el-input v-model="item.num"/> <el-input v-model="item.num"/>
<el-button @click="deleteResource(item)">删除</el-button> <el-button @click="deleteResource(item)">删除</el-button>
</el-form-item> </el-form-item> -->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -154,8 +154,8 @@ import Editor from '@/components/Editor';
import { getProjectPage } from "@/api/farm/project"; import { getProjectPage } from "@/api/farm/project";
import { getTaskPage } from "@/api/farm/task"; import { getTaskPage } from "@/api/farm/task";
import { getTaskCatePage } from "@/api/farm/taskCate"; import { getTaskCatePage } from "@/api/farm/taskCate";
import { getResourcePage } from "@/api/farm/resource"; // import { getResourcePage } from "@/api/farm/resource";
import { getResourceTypePage } from "@/api/farm/resourceType"; // import { getResourceTypePage } from "@/api/farm/resourceType";
import { getCpUserPage } from "@/api/system/cpUser"; import { getCpUserPage } from "@/api/system/cpUser";
export default { export default {
@ -189,7 +189,7 @@ export default {
taskId: null, taskId: null,
content: null, content: null,
images: null, images: null,
resources: null, // resources: null,
}, },
// //
form: { form: {
@ -205,9 +205,9 @@ export default {
selectTaskList:[], // selectTaskList:[], //
taskCateList:[], taskCateList:[],
resourceTypeList:[], // // resourceTypeList:[], //
resourceList:[], // // resourceList:[], //
twoList:[], // twoList:[],
cpUserList:[], //cpUser cpUserList:[], //cpUser
selectCpUserList:[] // selectCpUserList:[] //
@ -217,9 +217,9 @@ export default {
created() { created() {
this.getProject(); this.getProject();
this.getTaskCateList(); this.getTaskCateList();
this.getResourceTypeList(); // this.getResourceTypeList();
this.getResource(); // this.getResource();
this.twoRescoure(); // this.twoRescoure();
this.getCpUserList(); this.getCpUserList();
}, },
methods: { methods: {
@ -242,54 +242,54 @@ export default {
}) })
return executorPersonName; return executorPersonName;
}, },
twoRescoure() { // twoRescoure() {
let firstList = []; // let firstList = [];
this.resourceTypeList.forEach((type) => { // this.resourceTypeList.forEach((type) => {
let secondList = []; // let secondList = [];
this.resourceList.forEach((res) => { // this.resourceList.forEach((res) => {
if (res.resourceType == type.id) { // if (res.resourceType == type.id) {
secondList.push({ value: res.id, label: res.name }); // secondList.push({ value: res.id, label: res.name });
} // }
}) // })
firstList.push({ value: type.id, label: type.name, children: secondList }); // firstList.push({ value: type.id, label: type.name, children: secondList });
}) // })
this.twoList = firstList; // this.twoList = firstList;
}, // },
ziyuanxuanze(item,index,obj){ // ziyuanxuanze(item,index,obj){
this.form.resource[index].reource = obj[1]; // this.form.resource[index].reource = obj[1];
}, // },
addResource(){ // addResource(){
let resourceTmp = {reource:0,num:1} // let resourceTmp = {reource:0,num:1}
this.form.resources = this.form.resources.concat(resourceTmp); // this.form.resources = this.form.resources.concat(resourceTmp);
}, // },
deleteResource(item){ // deleteResource(item){
this.form.resources = this.form.resources.filter(res => res!=item) // this.form.resources = this.form.resources.filter(res => res!=item)
}, // },
resouceConvert(resources){ // resouceConvert(resources){
let resouceMsg = ""; // let resouceMsg = "";
resources.forEach(res =>{ // resources.forEach(res =>{
let typeName = this.resourceTypeList.filter(type => type.id == res.resourceId[0])[0].name; // let typeName = this.resourceTypeList.filter(type => type.id == res.resourceId[0])[0].name;
let name = this.resourceList.filter(name => name.id == res.resourceId[1])[0].name; // let name = this.resourceList.filter(name => name.id == res.resourceId[1])[0].name;
resouceMsg += typeName +"/" + name +":" + res.num +"\n"; // resouceMsg += typeName +"/" + name +":" + res.num +"\n";
}) // })
return resouceMsg; // return resouceMsg;
}, // },
getResourceTypeList() { // getResourceTypeList() {
getResourceTypePage({ // getResourceTypePage({
pageNo: 1, // pageNo: 1,
pageSize: 100 // pageSize: 100
}).then(res => { // }).then(res => {
this.resourceTypeList = res.data.list; // this.resourceTypeList = res.data.list;
}) // })
}, // },
getResource() { // getResource() {
getResourcePage({ // getResourcePage({
pageNo: 1, // pageNo: 1,
pageSize: 10, // pageSize: 10,
}).then(res => { // }).then(res => {
this.resourceList = res.data.list; // this.resourceList = res.data.list;
}) // })
}, // },
getTaskCateList() { getTaskCateList() {
getTaskCatePage({ getTaskCatePage({
pageNo: 1, pageNo: 1,
@ -360,7 +360,7 @@ export default {
taskId: undefined, taskId: undefined,
content: undefined, content: undefined,
images: undefined, images: undefined,
resources: [], // resources: [],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -378,14 +378,14 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.twoRescoure(); // this.twoRescoure();
this.open = true; this.open = true;
this.title = "添加农场任务讨论"; this.title = "添加农场任务讨论";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.twoRescoure(); // this.twoRescoure();
const id = row.id; const id = row.id;
getDiscuss(id).then(response => { getDiscuss(id).then(response => {
this.form = response.data; this.form = response.data;

Loading…
Cancel
Save