ElectionMethod.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <!--事项选票-->
  3. <div class="matterVote">
  4. <div class="voteTable">
  5. <!-- 表决Title-->
  6. <div class="matterTitle">
  7. <span>{{ mylocale=='zh'?'事项表决':'Vote' }}</span>
  8. </div>
  9. <div class="matterContent">
  10. <el-row :gutter="20">
  11. <el-col :span="2"><div class="grid-content bg-purple">{{ mylocale=='zh'?'序号':'No. ' }}</div></el-col>
  12. <el-col :span="17"><div class="grid-content bg-purple">{{ mylocale=='zh'?'标题':'Content' }}</div></el-col>
  13. <el-col :span="5"><div class="grid-content bg-purple">{{ mylocale=='zh'?'意见':'opinion' }}</div></el-col>
  14. </el-row>
  15. <div class="voteMessage">
  16. <el-row :gutter="20">
  17. <el-col :span="2"><div class="grid-content bg-purples">1</div></el-col>
  18. <el-col :span="17"><div class="grid-content bg-purples bg-title">{{meetingContent.title}}</div></el-col>
  19. <el-col :span="5">
  20. <div class="grid-content bg-purples">
  21. <!-- 投票按钮 -->
  22. <div class="voteBtn" v-if="meetingContent.voted === false">
  23. <el-button size="small" type="info" @click="statistical(meetingContent,'0')" :class="activeIndex.a0.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'赞成':'Approve'}}</el-button>
  24. <el-button size="small" type="info" @click="statistical(meetingContent,'1')" :class="activeIndex.a1.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'反对':'Oppose' }}</el-button>
  25. <el-button size="small" type="info" @click="statistical(meetingContent,'2')" :class="activeIndex.a2.indexOf(meetingContent.id) != -1 ?'active':''">{{ mylocale=='zh'?'弃权':'waiver' }}</el-button>
  26. </div>
  27. <div class="voteBtn" v-if="meetingContent.voted === true">
  28. {{$t('common.AreadyVote')}}
  29. </div>
  30. </div>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. <!-- 事项投票内容展示-->
  35. <el-dialog
  36. :title="'投票内容'"
  37. :visible.sync="dialogVisible"
  38. width="50%">
  39. <div v-html="showIntroduction"></div>
  40. </el-dialog>
  41. </div>
  42. <!-- ==================== -->
  43. <div class="submitVote" v-if="meetingContent.voted !== true">
  44. <!-- <el-button class="voteSty" type="danger" @click="statistical('','4')">{{ mylocale=='zh'?'全部赞成':'Approve All'}}</el-button> -->
  45. <el-button type="primary" @click="submitVote" style="padding:0">{{ mylocale=='zh'?'提交投票':'Submit to vote'}}</el-button>
  46. </div>
  47. <!-- 进入下一页的探窗 -->
  48. <el-dialog
  49. :show-close="false"
  50. :visible.sync="OverFlag"
  51. :close-on-click-modal="false"
  52. width="700px">
  53. <div class="category-body submit-success">
  54. <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>
  55. <p style="text-align:center">
  56. <!-- <el-button style="background: #2c558a; color: #fff" @click="toView('home')">{{$i18n.locale=='en'? 'Back Home': '返回首页'}}</el-button> -->
  57. <el-button type="primary" @click="Iknow">{{$i18n.locale=='en'? 'Confirm': '确定'}}</el-button>
  58. </p>
  59. </div>
  60. </el-dialog>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import {getMeetingGeidcoMatters,saveOrUpdateMatter,getCouncilVoteSituation} from "@/api/vote/council";
  66. import { getDicts } from "@/api/dict";
  67. import Base from "@/views/base/Base";
  68. // import vote from "../AddFeatures/vote/vote";
  69. export default {
  70. name:'MatterVote',
  71. extends: Base,
  72. props:[
  73. // 'vote',
  74. // 'showLink'
  75. ],
  76. data () {
  77. return {
  78. mylocale:this.$i18n.locale,
  79. // positionDic:'',
  80. // candidateList:[],
  81. num:0,
  82. meetingContent:'',
  83. allVoteList:new Map(),
  84. endVote:[],
  85. mattersList:[],
  86. activeIndex:{
  87. a0:[],
  88. a1:[],
  89. a2:[]
  90. },
  91. votedLeader:'',
  92. votedMatter:'',
  93. dialogVisible:false,
  94. showIntroduction:'',
  95. // showLink:'',
  96. isRefresh:'',
  97. trueVote:[],
  98. falseVote:[],
  99. flalseLength:'',
  100. meetingGeidcoMatterNumDetail:[],
  101. OverFlag:false,
  102. }
  103. },
  104. mounted() {
  105. // this.getDictsList();
  106. this.getMatters();
  107. console.log('啪啪啪啪啪啪铺铺铺铺铺',this.mylocale)
  108. },
  109. destroyed(){
  110. clearInterval(this.isRefresh)
  111. },
  112. methods:{
  113. //将投票结果统计到数组
  114. statistical(item,sta){
  115. // let matterId = item.id;
  116. let arr0 = this.activeIndex.a0
  117. let arr1 = this.activeIndex.a1
  118. let arr2 = this.activeIndex.a2
  119. if(sta=='0'){
  120. if(arr0.indexOf(item.id)==-1) arr0.push(item.id)
  121. if(arr1.indexOf(item.id)!=-1) arr1 = arr1.filter(ele=>{return ele!=item.id})
  122. if(arr2.indexOf(item.id)!=-1) arr2 = arr2.filter(ele=>{return ele!=item.id})
  123. this.activeIndex.a0 = arr0
  124. this.activeIndex.a1 = arr1
  125. this.activeIndex.a2 = arr2
  126. this.meetingGeidcoMatterNumDetail=[]
  127. this.meetingGeidcoMatterNumDetail.push({
  128. matterId:item.id,
  129. type:sta
  130. })
  131. }
  132. if(sta=='1'){
  133. if(arr0.indexOf(item.id)!=-1) arr0 = arr0.filter(ele=>{return ele!=item.id})
  134. if(arr1.indexOf(item .id)==-1) arr1.push(item.id)
  135. if(arr2.indexOf(item.id)!=-1) arr2 = arr2.filter(ele=>{return ele!=item.id})
  136. this.activeIndex.a0 = arr0
  137. this.activeIndex.a1 = arr1
  138. this.activeIndex.a2 = arr2
  139. this.meetingGeidcoMatterNumDetail=[]
  140. this.meetingGeidcoMatterNumDetail.push({
  141. matterId:item.id,
  142. type:sta
  143. })
  144. }
  145. if(sta=='2'){
  146. if(arr0.indexOf(item.id)!=-1) arr0 = arr0.filter(ele=>{return ele!=item.id})
  147. if(arr1.indexOf(item.id)!=-1) arr1 = arr1.filter(ele=>{return ele!=item.id})
  148. if(arr2.indexOf(item.id)==-1) arr2.push(item.id)
  149. this.activeIndex.a0 = arr0
  150. this.activeIndex.a1 = arr1
  151. this.activeIndex.a2 = arr2
  152. this.meetingGeidcoMatterNumDetail=[]
  153. this.meetingGeidcoMatterNumDetail.push({
  154. matterId:item.id,
  155. type:sta
  156. })
  157. }
  158. },
  159. // 获取事项列表信息
  160. getMatters(){
  161. // getMeetingGeidcoMatters().then((res)=>{
  162. // this.meetingContent = res.data.meetingGeidcoMatters
  163. // })
  164. this.meetingContent = [];
  165. this.trueVote = [];
  166. this.falseVote = [];
  167. let params = {
  168. language: this.mylocale
  169. }
  170. getMeetingGeidcoMatters(params).then((res)=>{
  171. this.meetingContent = res.data.meetingGeidcoMatters[1];
  172. if( this.mylocale =='en'){
  173. this.meetingContent.title = this.meetingContent.titleEn
  174. this.meetingContent.introduction = this.meetingContent.introductionEn;
  175. }
  176. this.$emit('pushFlag',this.meetingContent.voted);
  177. this.statistical(this.meetingContent,'0')
  178. // if(this.meetingContent.voted == true){
  179. // this.trueVote.push(position)
  180. // }else {
  181. // this.falseVote.push(position)
  182. // }
  183. //============================================================
  184. // this.mattersList.forEach((position)=>{
  185. // if( this.mylocale =='en'){
  186. // position.title = position.titleEn
  187. // position.introduction = position.introductionEn;
  188. // }
  189. // if(position.voted == true){
  190. // this.trueVote.push(position)
  191. // }else {
  192. // this.falseVote.push(position)
  193. // }
  194. // this.meetingContent.push(position)
  195. // });
  196. this.flalseLength = this.falseVote.length;
  197. })
  198. },
  199. // test(){
  200. // this.submitHandler((token) => {
  201. // saveOrUpdateMatter(JSON.stringify(this.meetingGeidcoMatterNumDetail), token).then(result => {
  202. // //提示投票成功(提示信息要区分中英文)
  203. // }).catch((error) => {
  204. // // 此处你的业务代码
  205. // // this.resetToken();
  206. // });
  207. // });
  208. // },
  209. //提交投票结果
  210. submitVote(){
  211. // this.OverFlag = true;
  212. this.submitHandler((token) => {
  213. saveOrUpdateMatter(JSON.stringify(this.meetingGeidcoMatterNumDetail), token).then(res => {
  214. //提示投票成功(提示信息要区分中英文)
  215. if(res.status=="200") {
  216. // let msgTxt =this.$i18n.locale == 'en' ? 'Submitted successfully. Thank you for your feedback' : '投票成功';
  217. // this.$message({
  218. // message: msgTxt,
  219. // type: 'success',
  220. // });
  221. this.OverFlag = true;
  222. this.resetToken();
  223. }
  224. //重新查询
  225. this.refreshMatter()
  226. }).catch((error) => {
  227. // 此处你的业务代码
  228. this.resetToken();
  229. });
  230. });
  231. },
  232. // 查询投票状态
  233. getVoteState(){
  234. const that = this;
  235. getCouncilVoteSituation().then((res)=>{
  236. let sta = res.data.councilVoteSituation;
  237. this.votedLeader=sta.votedLeader;
  238. this.votedMatter=sta.votedMatter
  239. // this.showLink = sta.showCouncilLiveingLink;
  240. this.refreshPage()
  241. })
  242. },
  243. // 事项详情弹窗
  244. dialogVisibleChange(item){
  245. this.dialogVisible = true;
  246. this.showIntroduction = item.introduction
  247. console.log('1234321232123')
  248. },
  249. // 刷新按钮事件
  250. refreshMatter(){
  251. this.getMatters()
  252. },
  253. Iknow(){
  254. this.$emit('getVotepage',2)
  255. this.OverFlag = false
  256. }
  257. }
  258. }
  259. </script>
  260. <style scoped>
  261. .matterVote{
  262. margin: auto;
  263. padding: 0;
  264. width: 90%;
  265. background: #fff;
  266. }
  267. .voteTable{
  268. width: 100%;
  269. padding: 42px 0 0px 0;
  270. /* background:#F0F3F7 url("../../assets/img/electionBallot/DirectorVotes/1.png") repeat; */
  271. }
  272. .matterTitle{
  273. width: 1200px;
  274. margin: auto;
  275. height: 45px;
  276. text-align: center;
  277. font-size: 28px;
  278. font-weight: 600;
  279. color: #666666;
  280. }
  281. .el-row {
  282. margin-bottom: 20px;
  283. text-align: center;
  284. line-height: 42px;
  285. }
  286. .el-col {
  287. border-radius: 4px;
  288. }
  289. .bg-purple-dark {
  290. background: #99a9bf;
  291. }
  292. .bg-purple {
  293. background: #d3dce6;
  294. font-size: 18px;
  295. }
  296. .bg-purples {
  297. background: #fff;
  298. font-size: 16px;
  299. }
  300. .bg-title{
  301. text-align: left;
  302. padding-left:10px
  303. }
  304. .bg-purple-light {
  305. background: #e5e9f2;
  306. }
  307. .grid-content {
  308. height: 42px;
  309. border-radius: 4px;
  310. min-height: 36px;
  311. }
  312. .row-bg {
  313. padding: 10px 0;
  314. background-color: #f9fafc;
  315. }
  316. .matterContent{
  317. width: 1200px;
  318. margin:20px auto;
  319. }
  320. .voteMessage{
  321. /*width: 100%;*/
  322. height: 65px;
  323. line-height: 65px;
  324. /* padding: 0 20px; */
  325. border-radius: 8px;
  326. background: #fff;
  327. /* margin-bottom: 15px; */
  328. position: relative;
  329. cursor: pointer;
  330. }
  331. /*.moreMessage{*/
  332. /* display: none;*/
  333. /*}*/
  334. /*.voteMessage:hover .moreMessage{*/
  335. /* display: block;*/
  336. /* padding: 30px;*/
  337. /* background: #ffffff;*/
  338. /* box-shadow: 0px 2px 10px 0px rgba(167, 167, 167, 0.5);*/
  339. /* width:60%;*/
  340. /* line-height: 40px;*/
  341. /* position: absolute;*/
  342. /* border-radius: 6px;*/
  343. /* left:-10%;*/
  344. /* top: 60px;*/
  345. /* z-index: 999;*/
  346. /* overflow: scroll;*/
  347. /* max-height:300px;*/
  348. /*}*/
  349. .message{
  350. width: 75%;
  351. overflow: hidden;
  352. text-overflow: ellipsis;
  353. white-space: nowrap;
  354. display: inline-block;
  355. float: left;
  356. }
  357. .voteBtn{
  358. float: right;
  359. display: inline-block;
  360. text-align: center;
  361. height: 100%;
  362. width: 100%;
  363. }
  364. .voteBtn > .el-button{
  365. border-radius: 6px;
  366. }
  367. .submitVote{
  368. height: 100px;
  369. line-height: 100px;
  370. text-align: center;
  371. }
  372. .submitVote > .el-button{
  373. width: 150px;
  374. height: 50px;
  375. border-radius: 5px;
  376. font-size: 20px;
  377. }
  378. .submitVote .el-button:nth-child(1){
  379. background-color: #6dd400;
  380. }
  381. .submitVote .el-button:nth-child(2){
  382. background-color: #6f9fe8;
  383. }
  384. .el-button{
  385. border: none;
  386. /* padding: 0; */
  387. }
  388. .active{
  389. background: #6dd400;
  390. border: none;
  391. }
  392. .refreshBtn{
  393. float: right;
  394. height: 30px;
  395. margin-top: 10px;
  396. padding: 5px 5px;
  397. border-radius: 5px;
  398. background: #409EFF;
  399. border: none;
  400. color: #ffffff;
  401. cursor: pointer;
  402. }
  403. .notActive{
  404. background: #A6A9AD;
  405. }
  406. </style>