deptRankSwiper.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div>
  3. <div class="swiperBg" v-loading="loading || deptNameLoad">
  4. <el-row type="flex" justify="center">
  5. <el-col :xs="22" :sm="22" :md="24" :lg="12" :xl="10">
  6. <div class="title" v-if="type == 1">最新的积分事件<p>最后更新时间:{{lastTime}}</p></div>
  7. <div class="title" v-if="type == 2">{{deptName}}{{month}}积分排名<p>最后更新时间:{{lastTime}}</p></div>
  8. <marquee style="height: calc(100vh - 106px);" scrollamount="2" scrolldelay="1" align="middle" behavior="scroll" direction="up">
  9. <div v-show="type == 2">
  10. <el-row v-for="(item,index) in list" :key="index" class="row">
  11. <el-col class="list_name" :span="4">{{item.rank}}</el-col>
  12. <el-col :span="10">{{item.employee_name}}</el-col>
  13. <el-col class="point" :span="10">{{item.point}}分</el-col>
  14. </el-row>
  15. </div>
  16. <div v-show="type == 1">
  17. <el-row v-for="(item,index) in list" :key="index" class="row">
  18. <el-col :span="4">
  19. <center>
  20. <userImage :id="item.employee_id" :user_name="item.employee_name" :img_url="item.employee_img_url" fontSize="1.8" width="80px" height="80px"></userImage>
  21. </center>
  22. </el-col>
  23. <el-col :span="20">
  24. <p class="integralPersonnel">
  25. <el-row>
  26. <el-col :span="8">{{item.employee_name}}</el-col>
  27. <el-col :span="16">
  28. <span style="margin-left: 30px;" :class="item.point>0?'color_red':'color_green'">{{item.point>0?'+'+item.point:item.point}}分</span>
  29. </el-col>
  30. </el-row>
  31. </p>
  32. <p class="integralDetails">{{item.remark}}</p>
  33. </el-col>
  34. </el-row>
  35. </div>
  36. </marquee>
  37. </el-col>
  38. </el-row>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import moment from 'moment'
  44. // type 1为积分事件 2为部门排行
  45. export default {
  46. name: "deptRankSwiper",
  47. data() {
  48. return {
  49. loading: false,
  50. deptNameLoad: false,
  51. list: [],
  52. formData:{},
  53. type: 0,
  54. month: null,
  55. deptName: null,
  56. lastTime: null
  57. }
  58. },
  59. methods: {
  60. getData(){
  61. let self = this
  62. self.loading = true
  63. let data = this.formData
  64. delete data.type
  65. var url=self.type == 1? '/api/integral/statistics/integral' : '/api/integral/statistics/ranking';
  66. var str=self.type == 1? 'plain':'v2'
  67. self.$axios('get',url,data,str).then((res) => {
  68. if (res.data.code == 1) {
  69. self.lastTime = this.$moment().format('YYYY-MM-DD HH:mm:ss')
  70. self.list = res.data.data.list
  71. }else{
  72. self.$message.error(res.data.data.msg)
  73. }
  74. }).finally(()=>{
  75. self.loading = false
  76. })
  77. },
  78. getDeptName(id){
  79. let self = this
  80. if (id !== '0') {
  81. self.deptNameLoad = true
  82. self.$axios("get",'/api/department/info',{id: id}).then((res) => {
  83. if (res.data.code == 1) {
  84. self.deptName = res.data.data.name
  85. }else{
  86. self.$message.error(res.data.data.msg)
  87. }
  88. }).finally(()=>{
  89. self.deptNameLoad = false
  90. })
  91. }else{
  92. self.deptName = '全公司'
  93. }
  94. }
  95. },
  96. mounted() {
  97. this.formData = this.$route.query
  98. this.type = this.$route.query.type
  99. this.$route.query.month?this.month = moment(this.$route.query.month).format('YYYY年MM月'):''
  100. this.$route.query.dept_name? this.deptName=this.$route.query.dept_name:''
  101. this.getData()
  102. setInterval(() => {
  103. this.getData()
  104. }, parseInt(Math.random()*(1800000-1200000+1)+1200000,10));
  105. },
  106. created() {},
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .swiperBg{
  111. background-color: black;
  112. color: #fff;
  113. position: fixed;
  114. left: 0;
  115. right: 0;
  116. bottom: 0;
  117. top:0;
  118. font-size: 3rem;
  119. .title{
  120. font-size: 40px;
  121. text-align: center;
  122. margin: 20px 0;
  123. p{
  124. font-size: 16px;
  125. }
  126. }
  127. .row{
  128. margin-bottom: .6em;
  129. .el-col-10{
  130. overflow: hidden;
  131. white-space: nowrap;
  132. text-overflow: ellipsis;
  133. }
  134. .list_name{
  135. text-align: center;
  136. }
  137. .point{
  138. text-align: center;
  139. }
  140. .integralDetails{
  141. font-size: .6em;
  142. margin: 0;
  143. display: -webkit-box;
  144. text-overflow: ellipsis;
  145. overflow : hidden;
  146. -webkit-line-clamp: 2;
  147. -webkit-box-orient: vertical;
  148. }
  149. .integralPersonnel{
  150. font-size: .8em;
  151. margin: 0;
  152. margin-bottom: 15px;
  153. }
  154. }
  155. }
  156. .color_red{
  157. color: red;
  158. }
  159. .color_green{
  160. color:green
  161. }
  162. </style>