|
@ -100,13 +100,13 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row> |
|
|
|
|
|
|
|
|
<!-- <el-row> |
|
|
<el-col :span="12" v-if="form.voteType == 2"> |
|
|
<el-col :span="12" v-if="form.voteType == 2"> |
|
|
<el-form-item label="多选选几项" prop="itemLimit"> |
|
|
<el-form-item label="多选选几项" prop="itemLimit"> |
|
|
<el-input-number v-model="form.itemLimit" :min="1" /> |
|
|
<el-input-number v-model="form.itemLimit" :min="1" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
</el-row> --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-row> |
|
|
<el-row> |
|
@ -126,7 +126,37 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<el-row v-for="(item, index) in options" :key="index"> |
|
|
|
|
|
|
|
|
<div class="ul" v-if="form.voteType == 3"> |
|
|
|
|
|
<div v-for="(item, index) in form.voteMultipleInfoList" :key="index" class="li"> |
|
|
|
|
|
<el-form-item label="议题" prop="startTime"> |
|
|
|
|
|
<el-input v-model="item.voteName" placeholder="请填议题内容" /> |
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleItemAddVoteType3(1, item, index)" |
|
|
|
|
|
v-if="index == form.voteMultipleInfoList.length - 1">增加议题</el-button> |
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-minus" @click="handleItemAddVoteType3(0, item, index)" |
|
|
|
|
|
v-else>删除议题</el-button> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex subOptions" v-for="(item2, index2) in item.voteItemList" :key="index2"> |
|
|
|
|
|
<div class="selectIndex">投票选项 {{ index2 + 1 }}</div> |
|
|
|
|
|
<div class="item_row flex"> |
|
|
|
|
|
<el-input v-model="form.voteMultipleInfoList[index].voteItemList[index2]" placeholder="请填议题内容" |
|
|
|
|
|
style="margin: 0 10px;" :key="index2" /> |
|
|
|
|
|
<!-- <el-input v-model="item2" placeholder="请填议题内容" style="margin: 0 10px;" /> --> |
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-plus" |
|
|
|
|
|
@click="handleItemNameVoteType3(1, item.voteItemList, index2)" |
|
|
|
|
|
v-if="index2 == item.voteItemList.length - 1">增加选项</el-button> |
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-minus" |
|
|
|
|
|
@click="handleItemNameVoteType3(0, item.voteItemList, index2)" v-else>删除选项</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-row v-for="(item, index) in options" :key="index" v-else> |
|
|
<el-form-item :label="'选项' + (parseInt(index) + 1)" prop="itemName"> |
|
|
<el-form-item :label="'选项' + (parseInt(index) + 1)" prop="itemName"> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-input v-model="options[index].value" placeholder="请填写选项内容" /> |
|
|
<el-input v-model="options[index].value" placeholder="请填写选项内容" /> |
|
@ -182,7 +212,7 @@ |
|
|
<div class="btndaocho"> <el-button type="primary" @click="handleExport" size="mini">导出</el-button></div> |
|
|
<div class="btndaocho"> <el-button type="primary" @click="handleExport" size="mini">导出</el-button></div> |
|
|
<el-form ref="form" :model="form" label-width="90px"> |
|
|
<el-form ref="form" :model="form" label-width="90px"> |
|
|
<el-divider content-position="left">投票说明</el-divider> |
|
|
<el-divider content-position="left">投票说明</el-divider> |
|
|
<div style="background-color: #e5e9f2;height: 300px"> |
|
|
|
|
|
|
|
|
<div style="background-color: #e5e9f2;height: 300px; overflow-y: auto;"> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="8"> |
|
|
<el-col :span="8"> |
|
|
<h2><span>{{ form.voteName }}</span></h2> |
|
|
<h2><span>{{ form.voteName }}</span></h2> |
|
@ -207,7 +237,21 @@ |
|
|
|
|
|
|
|
|
<el-divider content-position="left">投票结果</el-divider> |
|
|
<el-divider content-position="left">投票结果</el-divider> |
|
|
|
|
|
|
|
|
<el-row :gutter="20" v-for="(item, index) in form.voteResultVO" :key="index"> |
|
|
|
|
|
|
|
|
<div class="type3" v-if="form.voteType == 3"> |
|
|
|
|
|
<div class="ul2"> |
|
|
|
|
|
<div class="li2" v-for="(item, index) in form.voteMultipleItemInfoRespList" :key="index"> |
|
|
|
|
|
<div class="name" style="font-size: 18px;color: #333;font-weight: 600;margin-left: 30px;"> {{ item.voteName }} </div> |
|
|
|
|
|
<div class="flex row" v-for="(item2,index2) in item.voteMultipleResultList" :key="index2"> |
|
|
|
|
|
<div class="lab" style="width: 100px; text-align: right;"> {{ item2.itemName }}</div> |
|
|
|
|
|
<el-progress :percentage="item2.itemRate" style="width: 400px; margin: 0 20px;"/> |
|
|
|
|
|
<!-- <el-progress :text-inside="true" :stroke-width="24" :percentage="item2.itemRate * 100" text-color="white"></el-progress> --> |
|
|
|
|
|
<h3>{{ item2.itemCount }}人</h3> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="20" v-for="(item, index) in form.voteResultVO" :key="index" v-else> |
|
|
<el-form-item :label="index + 1 + ''" prop="itemName"> |
|
|
<el-form-item :label="index + 1 + ''" prop="itemName"> |
|
|
<el-col :span="16"> |
|
|
<el-col :span="16"> |
|
|
{{ item.itemName }} <span v-if="item.itemCount * 1 > 0">(已投)</span> |
|
|
{{ item.itemName }} <span v-if="item.itemCount * 1 > 0">(已投)</span> |
|
@ -284,6 +328,22 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
testArr: [ |
|
|
|
|
|
{ |
|
|
|
|
|
name: '测试标题', subOption: [ |
|
|
|
|
|
{ name: '选项一', isCheck: 1 }, |
|
|
|
|
|
{ name: '选项一', isCheck: 0 }, |
|
|
|
|
|
{ name: '选项一', isCheck: 0 }, |
|
|
|
|
|
] |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
name: '测试标题二', subOption: [ |
|
|
|
|
|
{ name: '选项二', isCheck: 1 }, |
|
|
|
|
|
{ name: '选项二', isCheck: 0 }, |
|
|
|
|
|
{ name: '选项二', isCheck: 0 }, |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
], |
|
|
tableData: [{ |
|
|
tableData: [{ |
|
|
date: '投票人员', |
|
|
date: '投票人员', |
|
|
name: 'Tom', |
|
|
name: 'Tom', |
|
@ -314,7 +374,7 @@ export default { |
|
|
voteName: undefined, |
|
|
voteName: undefined, |
|
|
}, |
|
|
}, |
|
|
// 表单参数 |
|
|
// 表单参数 |
|
|
form: { attachmentList: [] }, |
|
|
|
|
|
|
|
|
form: { attachmentList: [], voteMultipleInfoList: [] }, |
|
|
//标题 |
|
|
//标题 |
|
|
title: null, |
|
|
title: null, |
|
|
// 表单校验 |
|
|
// 表单校验 |
|
@ -369,7 +429,7 @@ export default { |
|
|
this.exportLoading = true; |
|
|
this.exportLoading = true; |
|
|
return exportVoteResults({ id: this.form.id }); |
|
|
return exportVoteResults({ id: this.form.id }); |
|
|
}).then(response => { |
|
|
}).then(response => { |
|
|
this.$download.excel(response, '投票结果.xls'); |
|
|
|
|
|
|
|
|
this.$download.excel(response, '投票结果.pdf'); |
|
|
this.exportLoading = false; |
|
|
this.exportLoading = false; |
|
|
}).catch(() => { }); |
|
|
}).catch(() => { }); |
|
|
}, |
|
|
}, |
|
@ -424,6 +484,15 @@ export default { |
|
|
this.title = "添加投票" |
|
|
this.title = "添加投票" |
|
|
//获取投票范围 |
|
|
//获取投票范围 |
|
|
this.loadingTextVote = true; |
|
|
this.loadingTextVote = true; |
|
|
|
|
|
this.form = { |
|
|
|
|
|
voteMultipleInfoList: [ |
|
|
|
|
|
{ |
|
|
|
|
|
"voteName": "", |
|
|
|
|
|
"voteItemList": [''] |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.getDataChangTree(); |
|
|
this.getDataChangTree(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -463,7 +532,27 @@ export default { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
// 复选增加删除选项 |
|
|
|
|
|
handleItemAddVoteType3(type, item, index) { |
|
|
|
|
|
if (type) { |
|
|
|
|
|
let obj = Object.assign({}, item) |
|
|
|
|
|
obj.name = '' |
|
|
|
|
|
this.form.voteMultipleInfoList.push(obj) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.form.voteMultipleInfoList.splice(index, 1) |
|
|
|
|
|
// this.testArr = this.testArr.filter(item => item !== id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 选项添加删除 |
|
|
|
|
|
handleItemNameVoteType3(type, list, index) { |
|
|
|
|
|
if (type) { |
|
|
|
|
|
list.push('') |
|
|
|
|
|
} else { |
|
|
|
|
|
list.splice(index, 1) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
/** |
|
|
/** |
|
|
* 增加选项 |
|
|
* 增加选项 |
|
|
*/ |
|
|
*/ |
|
@ -480,8 +569,29 @@ export default { |
|
|
this.textVote = false; |
|
|
this.textVote = false; |
|
|
this.addVoteOpend = true; |
|
|
this.addVoteOpend = true; |
|
|
getVoteItem(row.id).then(res => { |
|
|
getVoteItem(row.id).then(res => { |
|
|
|
|
|
|
|
|
|
|
|
if (!res.data.voteMultipleItemInfoRespList) { |
|
|
|
|
|
res.data.voteMultipleInfoList = [ |
|
|
|
|
|
{ |
|
|
|
|
|
"voteName": "", |
|
|
|
|
|
"voteItemList": [''] |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}else { |
|
|
|
|
|
res.data.voteMultipleInfoList = res.data.voteMultipleItemInfoRespList.map(item=>{ |
|
|
|
|
|
|
|
|
|
|
|
let obj = { |
|
|
|
|
|
"voteName": item.voteName, |
|
|
|
|
|
voteItemList: item.voteMultipleResultList?item.voteMultipleResultList.map(item2=>item2.itemName):[''] |
|
|
|
|
|
} |
|
|
|
|
|
return obj |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
console.log(res.data.voteMultipleInfoList) |
|
|
|
|
|
} |
|
|
this.form = res.data; |
|
|
this.form = res.data; |
|
|
res.data.voteItemVO.forEach(item => { |
|
|
|
|
|
|
|
|
console.log(this.form) |
|
|
|
|
|
res.data.voteItemVO?.forEach(item => { |
|
|
this.options.push({ id: item.id, value: item.itemName }) |
|
|
this.options.push({ id: item.id, value: item.itemName }) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
@ -566,6 +676,16 @@ export default { |
|
|
margin-bottom: 0; |
|
|
margin-bottom: 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.flex { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.subOptions { |
|
|
|
|
|
padding: 5px 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.btndaocho { |
|
|
.btndaocho { |
|
|
display: flex; |
|
|
display: flex; |
|
|
justify-content: flex-end; |
|
|
justify-content: flex-end; |
|
|