Browse Source

注释,资源相关代码

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

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

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

Loading…
Cancel
Save