screenSbxjdxqk.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div class="screen-common-wrap">
  3. <a-table
  4. v-if="dataSource.length > 0"
  5. ref="table"
  6. size="middle"
  7. bordered
  8. row-key="id"
  9. :columns="columns"
  10. :data-source="dataSource"
  11. :pagination="false"
  12. :loading="loading"
  13. @change="handleTableChange"
  14. >
  15. <div slot="dxs" class="dx-render" slot-scope="value" style="">
  16. <div class="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. // 查询条件
  41. queryParam: {},
  42. treeData: [],
  43. // 表头
  44. columns: columns(this),
  45. url: {
  46. list: `/show/sbxj/total/${dayjs().format('M')}`,
  47. delete: '/business/catenary/bus/jcb/fdfxjyq/',
  48. tree: '/system/dept/treeSelect',
  49. exportXlsUrl: '/business/catenary/bus/jcb/fdfxjyq/export'
  50. }
  51. }
  52. },
  53. created() {
  54. this.getData()
  55. window['tis'] = this
  56. },
  57. methods: {
  58. getData() {
  59. this.columns[this.columns.length - 1].title = dayjs().format('M') + '月'
  60. getAction(this.url.list).then((res) => {
  61. const basicDataSource = res.data || []
  62. const typeArr = []
  63. basicDataSource.forEach(itemRow => {
  64. const find = typeArr
  65. .find(typeItem => typeItem.deptName === itemRow.deptName && typeItem.teamName === itemRow.teamName)
  66. if (!find) {
  67. const newTypeItem = {
  68. deptName: itemRow.deptName,
  69. teamName: itemRow.teamName,
  70. children: [itemRow]
  71. }
  72. typeArr.push(newTypeItem)
  73. } else {
  74. find.children.push(itemRow)
  75. }
  76. })
  77. const newList = typeArr.reduce((arr, cur) => {
  78. arr = arr.concat(cur.children)
  79. return arr
  80. }, [])
  81. this.dataSource = newList || []
  82. window['dataSource'] = this.dataSource;
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. .screen-common-wrap {
  90. ::v-deep {
  91. tbody {
  92. td {
  93. position: relative;
  94. .dx-render {
  95. width: 100%;
  96. height: 100%;
  97. position: absolute;
  98. left: 0;
  99. top: 0;
  100. display: flex;
  101. align-items: center;
  102. justify-content: center;
  103. .value {
  104. width: 100%;
  105. height: 100%;
  106. position: absolute;
  107. left: 0;
  108. top: 0;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. z-index: 1;
  113. }
  114. .bg {
  115. width: 100%;
  116. height: 100%;
  117. background-image: linear-gradient(to right, orange 50%, rgb(255, 238, 205) 99.99%);
  118. position: absolute;
  119. z-index: 0;
  120. top: 0;
  121. left: 0
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. </style>