index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <el-row :gutter="12">
  4. <el-col :sm="24" :xs="24" :md="6" :xl="6" :lg="6" :style="{ marginBottom: '12px' }">
  5. <chart-card>
  6. <template #title>
  7. <span style="color: #1890ff;position: relative;">我的待办 <i :class="dashboardValue.count.upcoming > 0 ? 'myUpcoming' : null" class="dot"></i></span>
  8. </template>
  9. <template #total>
  10. <router-link to="/process/upcoming">{{ dashboardValue.count.upcoming }}</router-link>
  11. </template>
  12. <!-- <el-tooltip slot="action" class="item" effect="dark" content="指标说明" placement="top-start">
  13. <i class="el-icon-warning-outline" />
  14. </el-tooltip> -->
  15. </chart-card>
  16. </el-col>
  17. <el-col :sm="24" :xs="24" :md="6" :xl="6" :lg="6" :style="{ marginBottom: '12px' }">
  18. <chart-card title="工单总数" :total="dashboardValue.count.all">
  19. <!-- <el-tooltip slot="action" class="item" effect="dark" content="指标说明" placement="top-start">
  20. <i class="el-icon-warning-outline" />
  21. </el-tooltip> -->
  22. </chart-card>
  23. </el-col>
  24. <el-col :sm="24" :xs="24" :md="6" :xl="6" :lg="6" :style="{ marginBottom: '12px' }">
  25. <chart-card title="我创建的" :total="dashboardValue.count.my_create">
  26. <!-- <el-tooltip slot="action" class="item" effect="dark" content="指标说明" placement="top-start">
  27. <i class="el-icon-warning-outline" />
  28. </el-tooltip> -->
  29. </chart-card>
  30. </el-col>
  31. <el-col :sm="24" :xs="24" :md="6" :xl="6" :lg="6" :style="{ marginBottom: '12px' }">
  32. <chart-card title="我相关的" :total="dashboardValue.count.related">
  33. <!-- <el-tooltip slot="action" class="item" effect="dark" content="指标说明" placement="top-start">
  34. <i class="el-icon-warning-outline" />
  35. </el-tooltip> -->
  36. </chart-card>
  37. </el-col>
  38. </el-row>
  39. <el-card :bordered="false" :body-style="{padding: '5'}" :style="{ marginBottom: '12px', textAlign: 'center' }">
  40. <el-date-picker
  41. v-model="querys"
  42. type="daterange"
  43. align="right"
  44. unlink-panels
  45. range-separator="至"
  46. start-placeholder="开始日期"
  47. end-placeholder="结束日期"
  48. :picker-options="pickerOptions"
  49. @change="timeScreening"
  50. />
  51. </el-card>
  52. <el-card :bordered="false" :body-style="{padding: '0'}" :style="{ marginBottom: '12px' }">
  53. <div class="salesCard">
  54. <div>
  55. <h4 :style="{ marginBottom: '20px' }" style="margin-left: 20px;">提交工单统计</h4>
  56. <RangeSubmit :statistics-data="dashboardValue.submit" />
  57. </div>
  58. </div>
  59. </el-card>
  60. <el-row>
  61. <el-col :span="8">
  62. <el-card :bordered="false" :body-style="{padding: '0'}">
  63. <div class="salesCard leaderboard">
  64. <rank-list title="热门流程排行榜 Top 10" :list="dashboardValue.ranks" />
  65. </div>
  66. </el-card>
  67. </el-col>
  68. <el-col :span="8" style="padding-left: 12px;">
  69. <el-card :bordered="false" :body-style="{padding: '0'}">
  70. <div class="salesCard leaderboard">
  71. <HandleRank title="处理工单人员排行榜" :list="dashboardValue.handle" />
  72. </div>
  73. </el-card>
  74. </el-col>
  75. <el-col :span="8" style="padding-left: 12px;">
  76. <el-card :bordered="false" :body-style="{padding: '0'}">
  77. <div class="salesCard leaderboard">
  78. <HandlePeriod title="工单处理耗时排行榜" :list="dashboardValue.period" />
  79. </div>
  80. </el-card>
  81. </el-col>
  82. </el-row>
  83. </div>
  84. </template>
  85. <script>
  86. import ChartCard from './components/ChartCard'
  87. import RankList from './components/RankList/index'
  88. import RangeSubmit from './components/RangeSubmit'
  89. import HandleRank from './components/HandleRank'
  90. import HandlePeriod from './components/HandlePeriod'
  91. import { initNumberHtml } from '@/utils/costum'
  92. import { initData } from '@/api/dashboard'
  93. export default {
  94. name: 'DashboardAdmin',
  95. components: {
  96. ChartCard,
  97. RankList,
  98. RangeSubmit,
  99. HandleRank,
  100. HandlePeriod
  101. },
  102. data() {
  103. return {
  104. dashboardValue: {
  105. count: {}
  106. },
  107. rankList: [],
  108. submitData: [],
  109. querys: '',
  110. queryList: {},
  111. pickerOptions: {
  112. shortcuts: [{
  113. text: '最近一周',
  114. onClick(picker) {
  115. const end = new Date()
  116. const start = new Date()
  117. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  118. picker.$emit('pick', [start, end])
  119. }
  120. }, {
  121. text: '最近一个月',
  122. onClick(picker) {
  123. const end = new Date()
  124. const start = new Date()
  125. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  126. picker.$emit('pick', [start, end])
  127. }
  128. }, {
  129. text: '最近三个月',
  130. onClick(picker) {
  131. const end = new Date()
  132. const start = new Date()
  133. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  134. picker.$emit('pick', [start, end])
  135. }
  136. }]
  137. }
  138. }
  139. },
  140. created() {
  141. this.getInitData()
  142. },
  143. methods: {
  144. async getInitData() {
  145. await initData(this.queryList).then(response => {
  146. this.dashboardValue = response.data
  147. })
  148. // 添加我的代办显示数据
  149. if(this.dashboardValue.count.upcoming && this.dashboardValue.count.upcoming > 0) {
  150. initNumberHtml(this.dashboardValue.count.upcoming)
  151. }
  152. },
  153. timeScreening() {
  154. if (this.querys && this.querys.length > 1) {
  155. this.queryList.start_time = this.querys[0]
  156. this.queryList.end_time = this.querys[1]
  157. } else {
  158. this.queryList.start_time = null
  159. this.queryList.end_time = null
  160. }
  161. this.getInitData()
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .dashboard-editor-container {
  168. padding: 12px;
  169. background-color: rgb(240, 242, 245);
  170. position: relative;
  171. .github-corner {
  172. position: absolute;
  173. top: 0;
  174. border: 0;
  175. right: 0;
  176. }
  177. .chart-wrapper {
  178. background: #fff;
  179. padding: 16px 16px 0;
  180. margin-bottom: 32px;
  181. }
  182. }
  183. /deep/ .el-tabs__item{
  184. padding-left: 16px!important;
  185. height: 50px;
  186. line-height: 50px;
  187. }
  188. @media (max-width:1024px) {
  189. .chart-wrapper {
  190. padding: 8px;
  191. }
  192. }
  193. .leaderboard {
  194. height: 448px;
  195. overflow: auto;
  196. }
  197. .myUpcoming {
  198. animation: flash 2s ease infinite;
  199. position: absolute;
  200. display: inline-block;
  201. width: 8px;
  202. height: 8px;
  203. border-radius: 50%;
  204. background-color: red;
  205. }
  206. .dot {
  207. }
  208. @keyframes flash{
  209. from {
  210. opacity: 0;
  211. }
  212. to {
  213. opacity: 1;
  214. }
  215. }
  216. </style>