ChartTable.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="app-table">
  3. <div class="table">
  4. <el-table
  5. :key="tableObj.tableKey"
  6. v-loading="tableObj.listLoading"
  7. element-loading-text="给我一点时间"
  8. :data="tableObj.list"
  9. border
  10. fit
  11. highlight-current-row
  12. style="width: 100%;"
  13. :row-style="rowStyle"
  14. :cell-style="cellStyle"
  15. class="elTable table-fixed"
  16. >
  17. <el-table-column label="序号" align="center" type="index" width="50px">
  18. <template slot-scope="scope">
  19. <span v-if="tableObj.pageNum">{{ scope.$index + (tableObj.pageNum-1) * tableObj.pageSize + 1 }}</span>
  20. <span v-else>1</span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="分日日期/维度" min-width="130px" align="center">
  24. <template slot-scope="scope">
  25. <span>{{ scope.row.date }}</span>
  26. </template>
  27. </el-table-column>
  28. <!-- <el-table-column label="混料数据" min-width="130px" align="center">
  29. <el-table-column label="理论重量" min-width="130px" align="center">
  30. <template slot-scope="scope">
  31. <span>{{ scope.row.drivercode }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="实际重量" min-width="130px" align="center">
  35. <template slot-scope="scope">
  36. <span>{{ scope.row.drivercode }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="误差值" min-width="130px" align="center">
  40. <template slot-scope="scope">
  41. <span>{{ scope.row.drivercode }}</span>
  42. </template>
  43. </el-table-column>
  44. </el-table-column> -->
  45. <el-table-column :label="item.label" min-width="130px" align="center" v-for=" (item,index) in tableHead">
  46. <el-table-column :label="items.label" :property="item.value" min-width="130px" align="center" v-for=" (items,indexs) in item.children">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row[items.value] }}</span>
  49. </template>
  50. </el-table-column>
  51. </el-table-column>
  52. </el-table>
  53. <pagination v-show="tableObj.total>0" :total="tableObj.total" :page.sync="tableObj.getDataParameters.offset" :limit.sync="tableObj.getDataParameters.pagecount" @pagination="getList" />
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import { GetDataByName } from '@/api/common'
  59. import draggable from 'vuedraggable'
  60. import Cookies from 'js-cookie'
  61. import { parseTime } from '@/utils/index.js'
  62. import Pagination from '@/components/Pagination'
  63. export default {
  64. name: 'ChartTable',
  65. components: { Pagination },
  66. props: {
  67. },
  68. data() {
  69. return {
  70. tableHead:[
  71. {
  72. value: 'txt1',label: '混料数据',
  73. children: [
  74. { value: 'txt11', label: '理论重量-合计'},
  75. { value: 'txt12', label: '理论重量-平均'},
  76. { value: 'txt13', label: '理论重量-最大值'},
  77. ]
  78. },
  79. {
  80. value: 'txt2',label: '撒料数据',
  81. children: [
  82. { value: 'txt21', label: '理论重量-合计'},
  83. { value: 'txt22', label: '理论重量-平均'},
  84. { value: 'txt23', label: '理论重量-最大值'},
  85. ]
  86. }
  87. ],
  88. tableObj: {
  89. getDataParameters: {
  90. name: 'getDriverList',
  91. page: 1,
  92. offset: 1,
  93. pagecount: parseInt(Cookies.get('pageCount')),
  94. returntype: 'Map',
  95. parammaps: {
  96. pastureid: Cookies.get('pastureid'),
  97. dateType:'',
  98. type: '',
  99. dimension: '',
  100. mixture: [],
  101. spread: [],
  102. }
  103. },
  104. tableKey: 0,
  105. list: [
  106. { id:1,date:1212,txt11:11,txt12:12,txt13:13,txt21:21,txt22:22,txt23:23,},
  107. { id:1,date:1212,txt11:11,txt12:12,txt13:13,txt21:21,txt22:22,txt23:23,},
  108. { id:1,date:1212,txt11:11,txt12:12,txt13:13,txt21:21,txt22:22,txt23:23,}
  109. ],
  110. total: 0,
  111. listLoading: false,
  112. temp: {}
  113. },
  114. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  115. cellStyle: { padding: 0 + 'px' }
  116. }
  117. },
  118. created() {
  119. this.getList()
  120. },
  121. methods: {
  122. getList() {
  123. //this.tableObj.listLoading = true
  124. // GetDataByName(this.tableObj.getdataListParm).then(response => {
  125. // console.log('table数据', response.data.list)
  126. // if (response.data.list !== null) {
  127. // this.tableObj.list = response.data.list
  128. // this.tableObj.pageNum = response.data.pageNum
  129. // this.tableObj.pageSize = response.data.pageSize
  130. // this.tableObj.total = response.data.total
  131. // } else {
  132. // this.tableObj.list = []
  133. // }
  134. // setTimeout(() => {
  135. // this.tableObj.listLoading = false
  136. // }, 100)
  137. // })
  138. this.tableObj.listLoading = false
  139. },
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .search{margin-bottom: 10px;}
  145. </style>