screenSbxjdxqk.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="screen-common-wrap" v-if="renderReady">
  3. <a-table
  4. ref="table"
  5. size="middle"
  6. bordered
  7. row-key="id"
  8. :columns="columns"
  9. :data-source="dataSource"
  10. :pagination="false"
  11. :loading="loading"
  12. @change="handleTableChange"
  13. >
  14. <div slot="dxs" class="dx-render" slot-scope="value" style="">
  15. <div class="value">
  16. {{ value }}%
  17. {{ value }}%
  18. </div>
  19. <div
  20. class="bg"
  21. :style="{'width': value+'%'}"
  22. />
  23. </div>
  24. </a-table>
  25. <!-- table区域-end -->
  26. <!-- 表单区域 -->
  27. </div>
  28. </template>
  29. <script>
  30. import {listMixin} from '@/mixin/listMixin'
  31. import columns from './indexColumns'
  32. import {getAction} from '@/api/request'
  33. import dayjs from 'dayjs'
  34. export default {
  35. name: 'ScreenSbxjdxqk',
  36. components: {},
  37. mixins: [listMixin],
  38. data() {
  39. return {
  40. renderReady: false,
  41. // 查询条件
  42. queryParam: {},
  43. treeData: [],
  44. // 表头
  45. columns: columns(this),
  46. url2: {
  47. list: `/show/sbxj/total/${dayjs().format('M')}`,
  48. delete: '/business/catenary/bus/jcb/fdfxjyq/',
  49. tree: '/system/dept/treeSelect',
  50. exportXlsUrl: '/business/catenary/bus/jcb/fdfxjyq/export'
  51. }
  52. }
  53. },
  54. mounted() {
  55. this.getData()
  56. window['tis'] = this
  57. },
  58. methods: {
  59. getData() {
  60. console.log('getData')
  61. this.renderReady = false;
  62. this.dataSource = [];
  63. this.columns[this.columns.length - 1].title = dayjs().format('M') + '月'
  64. getAction(this.url2.list).then((res) => {
  65. const basicDataSource = res.data || []
  66. const typeArr = []
  67. basicDataSource.forEach(itemRow => {
  68. const find = typeArr
  69. .find(typeItem => typeItem.teamName === itemRow.teamName)
  70. if (!find) {
  71. const newTypeItem = {
  72. teamName: itemRow.teamName,
  73. children: [itemRow]
  74. }
  75. typeArr.push(newTypeItem)
  76. } else {
  77. find.children.push(itemRow)
  78. }
  79. })
  80. window['typeArr'] = typeArr;
  81. const newList = typeArr.reduce((arr, cur) => {
  82. arr = arr.concat(cur.children)
  83. return arr
  84. }, [])
  85. this.dataSource = newList || []
  86. window['dataSource'] = this.dataSource;
  87. setTimeout(() => {
  88. this.renderReady = true;
  89. }, 300)
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .screen-common-wrap {
  97. ::v-deep {
  98. tbody {
  99. td {
  100. position: relative;
  101. .dx-render {
  102. width: 100%;
  103. height: 100%;
  104. position: absolute;
  105. left: 0;
  106. top: 0;
  107. display: flex;
  108. align-items: center;
  109. justify-content: center;
  110. .value {
  111. width: 100%;
  112. height: 100%;
  113. position: absolute;
  114. left: 0;
  115. top: 0;
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. z-index: 1;
  120. }
  121. .bg {
  122. width: 100%;
  123. height: 100%;
  124. background-image: linear-gradient(to right, orange 50%, rgb(255, 238, 205) 99.99%);
  125. position: absolute;
  126. z-index: 0;
  127. top: 0;
  128. left: 0
  129. }
  130. }
  131. }
  132. }
  133. }
  134. }
  135. </style>