123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- <template>
- <!--事项选票-->
- <div class="matterVote">
- <div class="voteTable">
- <!-- 表决Title-->
- <div class="matterTitle">
- <span>{{ mylocale=='zh'?'事项表决':'Vote' }}</span>
- </div>
- <div class="matterContent">
- <el-row :gutter="20">
- <el-col :span="2"><div class="grid-content bg-purple">{{ mylocale=='zh'?'序号':'No. ' }}</div></el-col>
- <el-col :span="17"><div class="grid-content bg-purple">{{ mylocale=='zh'?'标题':'Content' }}</div></el-col>
- <el-col :span="5"><div class="grid-content bg-purple">{{ mylocale=='zh'?'意见':'opinion' }}</div></el-col>
- </el-row>
- <div class="voteMessage">
- <el-row :gutter="20">
- <el-col :span="2"><div class="grid-content bg-purples">1</div></el-col>
- <el-col :span="17"><div class="grid-content bg-purples bg-title">{{meetingContent.title}}</div></el-col>
- <el-col :span="5">
- <div class="grid-content bg-purples">
- <!-- 投票按钮 -->
- <div class="voteBtn" v-if="meetingContent.voted === false">
- <el-button size="small" type="info" @click="statistical(meetingContent,'0')" :class="activeIndex.a0.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'赞成':'Approve'}}</el-button>
- <el-button size="small" type="info" @click="statistical(meetingContent,'1')" :class="activeIndex.a1.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'反对':'Oppose' }}</el-button>
- <el-button size="small" type="info" @click="statistical(meetingContent,'2')" :class="activeIndex.a2.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'弃权':'waiver' }}</el-button>
- </div>
- <div class="voteBtn" v-if="meetingContent.voted === true">
- {{$t('common.AreadyVote')}}
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- <!-- 事项投票内容展示-->
- <el-dialog
- :title="'投票内容'"
- :visible.sync="dialogVisible"
- width="50%">
- <div v-html="showIntroduction"></div>
- </el-dialog>
- </div>
- <!-- ==================== -->
- <div class="submitVote" v-if="meetingContent.voted !== true">
- <!-- <el-button class="voteSty" type="danger" @click="statistical('','4')">{{ mylocale=='zh'?'全部赞成':'Approve All'}}</el-button> -->
- <el-button type="primary" @click="submitVote" style="padding:0">{{ mylocale=='zh'?'提交投票':'Submit to vote'}}</el-button>
- </div>
- <!-- 进入下一页的探窗 -->
- <el-dialog
- :show-close="false"
- :visible.sync="OverFlag"
- :close-on-click-modal="false"
- width="700px">
- <div class="category-body submit-success">
- <p style="font-size: 24px; color: #666; margin-bottom: 20px;text-align:center">{{$i18n.locale=='en'? 'The vote was successful.Click Confirm to go to the next page': '投票成功,点击确定进入下一页.'}}</p>
- <p style="text-align:center">
- <!-- <el-button style="background: #2c558a; color: #fff" @click="toView('home')">{{$i18n.locale=='en'? 'Back Home': '返回首页'}}</el-button> -->
- <el-button type="primary" @click="Iknow">{{$i18n.locale=='en'? 'Confirm': '确定'}}</el-button>
- </p>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import {getMeetingGeidcoMatters,saveOrUpdateMatter,getCouncilVoteSituation} from "@/api/vote/council";
- import { getDicts } from "@/api/dict";
- import Base from "@/views/base/Base";
- // import vote from "../AddFeatures/vote/vote";
- export default {
- name:'MatterVote',
- extends: Base,
- props:[
- // 'vote',
- // 'showLink'
- ],
- data () {
- return {
- mylocale:this.$i18n.locale,
- // positionDic:'',
- // candidateList:[],
- num:0,
- meetingContent:'',
- allVoteList:new Map(),
- endVote:[],
- mattersList:[],
- activeIndex:{
- a0:[],
- a1:[],
- a2:[]
- },
- votedLeader:'',
- votedMatter:'',
- dialogVisible:false,
- showIntroduction:'',
- // showLink:'',
- isRefresh:'',
- trueVote:[],
- falseVote:[],
- flalseLength:'',
- meetingGeidcoMatterNumDetail:[],
- OverFlag:false,
- }
- },
- mounted() {
- // this.getDictsList();
- this.getMatters();
- console.log('啪啪啪啪啪啪铺铺铺铺铺',this.mylocale)
- },
- destroyed(){
- clearInterval(this.isRefresh)
- },
- methods:{
- //将投票结果统计到数组
- statistical(item,sta){
- // let matterId = item.id;
- let arr0 = this.activeIndex.a0
- let arr1 = this.activeIndex.a1
- let arr2 = this.activeIndex.a2
- if(sta=='0'){
- if(arr0.indexOf(item.id)==-1) arr0.push(item.id)
- if(arr1.indexOf(item.id)!=-1) arr1 = arr1.filter(ele=>{return ele!=item.id})
- if(arr2.indexOf(item.id)!=-1) arr2 = arr2.filter(ele=>{return ele!=item.id})
- this.activeIndex.a0 = arr0
- this.activeIndex.a1 = arr1
- this.activeIndex.a2 = arr2
- this.meetingGeidcoMatterNumDetail=[]
- this.meetingGeidcoMatterNumDetail.push({
- matterId:item.id,
- type:sta
- })
- }
- if(sta=='1'){
- if(arr0.indexOf(item.id)!=-1) arr0 = arr0.filter(ele=>{return ele!=item.id})
- if(arr1.indexOf(item .id)==-1) arr1.push(item.id)
- if(arr2.indexOf(item.id)!=-1) arr2 = arr2.filter(ele=>{return ele!=item.id})
- this.activeIndex.a0 = arr0
- this.activeIndex.a1 = arr1
- this.activeIndex.a2 = arr2
- this.meetingGeidcoMatterNumDetail=[]
- this.meetingGeidcoMatterNumDetail.push({
- matterId:item.id,
- type:sta
- })
- }
- if(sta=='2'){
- if(arr0.indexOf(item.id)!=-1) arr0 = arr0.filter(ele=>{return ele!=item.id})
- if(arr1.indexOf(item.id)!=-1) arr1 = arr1.filter(ele=>{return ele!=item.id})
- if(arr2.indexOf(item.id)==-1) arr2.push(item.id)
- this.activeIndex.a0 = arr0
- this.activeIndex.a1 = arr1
- this.activeIndex.a2 = arr2
- this.meetingGeidcoMatterNumDetail=[]
- this.meetingGeidcoMatterNumDetail.push({
- matterId:item.id,
- type:sta
- })
- }
- },
- // 获取事项列表信息
- getMatters(){
- // getMeetingGeidcoMatters().then((res)=>{
- // this.meetingContent = res.data.meetingGeidcoMatters
- // })
- this.meetingContent = [];
- this.trueVote = [];
- this.falseVote = [];
- let params = {
- language: this.mylocale
- }
- getMeetingGeidcoMatters(params).then((res)=>{
- this.meetingContent = res.data.meetingGeidcoMatters[2];
- if( this.mylocale =='en'){
- this.meetingContent.title = this.meetingContent.titleEn
- this.meetingContent.introduction = this.meetingContent.introductionEn;
- }
- this.$emit('pushFlag',this.meetingContent.voted);
- this.statistical(this.meetingContent,'0');
- // if(this.meetingContent.voted == true){
- // this.trueVote.push(position)
- // }else {
- // this.falseVote.push(position)
- // }
- //============================================================
- // this.mattersList.forEach((position)=>{
- // if( this.mylocale =='en'){
- // position.title = position.titleEn
- // position.introduction = position.introductionEn;
- // }
- // if(position.voted == true){
- // this.trueVote.push(position)
- // }else {
- // this.falseVote.push(position)
- // }
- // this.meetingContent.push(position)
- // });
- this.flalseLength = this.falseVote.length;
- })
- },
- // test(){
- // this.submitHandler((token) => {
- // saveOrUpdateMatter(JSON.stringify(this.meetingGeidcoMatterNumDetail), token).then(result => {
- // //提示投票成功(提示信息要区分中英文)
-
- // }).catch((error) => {
- // // 此处你的业务代码
- // // this.resetToken();
- // });
- // });
- // },
- //提交投票结果
- submitVote(){
- // this.OverFlag = true;
- this.submitHandler((token) => {
- saveOrUpdateMatter(JSON.stringify(this.meetingGeidcoMatterNumDetail), token).then(res => {
- //提示投票成功(提示信息要区分中英文)
- if(res.status=="200") {
- // let msgTxt =this.$i18n.locale == 'en' ? 'Submitted successfully. Thank you for your feedback' : '投票成功';
- // this.$message({
- // message: msgTxt,
- // type: 'success',
- // });
- this.OverFlag = true;
- this.resetToken();
- }
- //重新查询
- this.refreshMatter()
- }).catch((error) => {
- // 此处你的业务代码
- this.resetToken();
- });
- });
- },
- // 查询投票状态
- getVoteState(){
- const that = this;
- getCouncilVoteSituation().then((res)=>{
- let sta = res.data.councilVoteSituation;
- this.votedLeader=sta.votedLeader;
- this.votedMatter=sta.votedMatter
- // this.showLink = sta.showCouncilLiveingLink;
- this.refreshPage()
- })
- },
- // 事项详情弹窗
- dialogVisibleChange(item){
- this.dialogVisible = true;
- this.showIntroduction = item.introduction
- console.log('1234321232123')
- },
- // 刷新按钮事件
- refreshMatter(){
- this.getMatters()
- },
- Iknow(){
- this.$emit('getVotepage',3)
- this.OverFlag = false
- }
-
- }
- }
- </script>
- <style scoped>
- .matterVote{
- margin: auto;
- padding: 0;
- width: 90%;
- background: #fff;
- }
- .voteTable{
- width: 100%;
- padding: 42px 0 0px 0;
- /* background:#F0F3F7 url("../../assets/img/electionBallot/DirectorVotes/1.png") repeat; */
- }
- .matterTitle{
- width: 1200px;
- margin: auto;
- height: 45px;
- text-align: center;
- font-size: 28px;
- font-weight: 600;
- color: #666666;
- }
- .el-row {
- margin-bottom: 20px;
- text-align: center;
- line-height: 42px;
- }
- .el-col {
- border-radius: 4px;
- }
- .bg-purple-dark {
- background: #99a9bf;
- }
- .bg-purple {
- background: #d3dce6;
- font-size: 18px;
- }
- .bg-purples {
- background: #fff;
- font-size: 16px;
- }
- .bg-title{
- text-align: left;
- padding-left:10px
- }
- .bg-purple-light {
- background: #e5e9f2;
- }
- .grid-content {
- height: 42px;
- border-radius: 4px;
- min-height: 36px;
- }
- .row-bg {
- padding: 10px 0;
- background-color: #f9fafc;
- }
- .matterContent{
- width: 1200px;
- margin:20px auto;
- }
- .voteMessage{
- /*width: 100%;*/
- height: 65px;
- line-height: 65px;
- /* padding: 0 20px; */
- border-radius: 8px;
- background: #fff;
- /* margin-bottom: 15px; */
- position: relative;
- cursor: pointer;
- }
- /*.moreMessage{*/
- /* display: none;*/
- /*}*/
- /*.voteMessage:hover .moreMessage{*/
- /* display: block;*/
- /* padding: 30px;*/
- /* background: #ffffff;*/
- /* box-shadow: 0px 2px 10px 0px rgba(167, 167, 167, 0.5);*/
- /* width:60%;*/
- /* line-height: 40px;*/
- /* position: absolute;*/
- /* border-radius: 6px;*/
- /* left:-10%;*/
- /* top: 60px;*/
- /* z-index: 999;*/
- /* overflow: scroll;*/
- /* max-height:300px;*/
- /*}*/
- .message{
- width: 75%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- display: inline-block;
- float: left;
- }
- .voteBtn{
- float: right;
- display: inline-block;
- text-align: center;
- height: 100%;
- width: 100%;
- }
- .voteBtn > .el-button{
- border-radius: 6px;
- }
- .submitVote{
- height: 100px;
- line-height: 100px;
- text-align: center;
- }
- .submitVote > .el-button{
- width: 150px;
- height: 50px;
- border-radius: 5px;
- font-size: 20px;
- }
- .submitVote .el-button:nth-child(1){
- background-color: #6dd400;
- }
- .submitVote .el-button:nth-child(2){
- background-color: #6f9fe8;
- }
- .el-button{
- border: none;
- /* padding: 0; */
- }
- .active{
- background: #6dd400;
- border: none;
- }
- .refreshBtn{
- float: right;
- height: 30px;
- margin-top: 10px;
- padding: 5px 5px;
- border-radius: 5px;
- background: #409EFF;
- border: none;
- color: #ffffff;
- cursor: pointer;
- }
- .notActive{
- background: #A6A9AD;
- }
- </style>
|