edbDetailData.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="edb-detail-data-wrap">
  3. <el-table
  4. :data="tableData"
  5. class="firstColumTable" border>
  6. <el-table-column
  7. v-for="item in tableColumsOne"
  8. :key="item.label"
  9. :width="item.widthsty"
  10. :min-width="item.minwidthsty"
  11. align="center">
  12. <template slot="header" slot-scope="scope">
  13. <div class="chartEn-mark" style="top: -10px;" v-show="scope.$index ==0 && tableData[0] && tableData[0].IsEnEdb" >En</div>
  14. <span>{{item.label}}</span>
  15. </template>
  16. <template slot-scope="scope">
  17. <span v-show="currentLang=='ch'">{{ scope.row[item.key] }}</span>
  18. <span v-show="currentLang=='en'">{{scope.row[item.enKey||item.key] || scope.row[item.key]}}</span>
  19. </template>
  20. </el-table-column>
  21. </el-table>
  22. <el-table
  23. :data="tableData"
  24. style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);"
  25. border>
  26. <el-table-column
  27. v-for="item in tableColumsTwo"
  28. :key="item.label"
  29. :label="item.label"
  30. :width="item.widthsty"
  31. :min-width="item.minwidthsty"
  32. align="center"
  33. >
  34. <template #header>
  35. <span>{{ item.label }}</span>
  36. </template>
  37. <template slot-scope="scope">
  38. <span v-if="item.key==='NoUpdate'">{{scope.row[item.key]?'暂停':'启用'}}</span>
  39. <span v-else>{{ scope.row[item.key] }}</span>
  40. </template>
  41. </el-table-column>
  42. <div slot="empty" style="padding: 50px 0 320px;">
  43. <tableNoData :text="defaultWarn"/>
  44. </div>
  45. </el-table>
  46. <ul
  47. class="value-ul"
  48. ref="valueUl"
  49. @scroll="scrollHandle"
  50. v-show="dataList.length">
  51. <li
  52. class="value-item"
  53. v-for="item in dataList"
  54. :key="item.EdbDataId"
  55. >
  56. <span class="value-label">
  57. <span style="position: relative;">
  58. <i class="new-tag" v-if="tableData[0].LatestDate===item.DataTime"></i>
  59. {{item.DataTime}}
  60. </span>
  61. </span>
  62. <span :class="['value-label',{'predict-act': tableData[0].DataInsertConfig.Date===item.DataTime}]" style="min-width:200px;text-align:center;">
  63. <span :class="['value-style',{'predict-act': tableData[0].DataInsertConfig.Date===item.DataTime}]">{{item.Value}}</span>
  64. </span>
  65. </li>
  66. <li class="nodata value-item" v-if="!dataList.length">暂无数据</li>
  67. </ul>
  68. </div>
  69. </template>
  70. <script>
  71. export default {
  72. props:{
  73. currentLang:{
  74. type:String,
  75. default:'ch'
  76. },
  77. tableData:{
  78. type:Array,
  79. default:()=>{return []}
  80. },
  81. tableColumsOne:{
  82. type:Array,
  83. default:()=>{return []}
  84. },
  85. tableColumsTwo:{
  86. type:Array,
  87. default:()=>{return []}
  88. },
  89. defaultWarn:{
  90. type:String,
  91. default:'暂无数据'
  92. },
  93. dataList:{
  94. type:Array,
  95. default:()=>{return []}
  96. },
  97. haveMore:{
  98. type:Boolean,
  99. default:false
  100. }
  101. },
  102. data() {
  103. return {
  104. };
  105. },
  106. methods: {
  107. /* 数值滚动加载 */
  108. scrollHandle: _.throttle(function() {
  109. let scrollTop = this.$refs.valueUl.scrollTop;
  110. let clientHeight = this.$refs.valueUl.clientHeight;
  111. let scrollHeight = this.$refs.valueUl.scrollHeight;
  112. if(scrollTop===0) return
  113. if(scrollTop + clientHeight >= scrollHeight-10 && this.haveMore){
  114. this.$emit('getNextData')
  115. }
  116. },200),
  117. },
  118. };
  119. </script>
  120. <style lang="scss">
  121. .edb-detail-data-wrap{
  122. .el-table--enable-row-transition .el-table__body td{
  123. background: #fff !important;
  124. }
  125. .el-table td, .el-table th.is-leaf {
  126. background: #F2F6FA !important;
  127. }
  128. }
  129. </style>
  130. <style scoped lang="scss">
  131. .edb-detail-data-wrap{
  132. display: flex;
  133. flex-direction: column;
  134. height: 100%;
  135. .firstColumTable{
  136. box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);
  137. }
  138. .el-table{
  139. flex: none;
  140. }
  141. .value-ul{
  142. /* flex: 1;
  143. overflow-y: auto; */
  144. overflow-y: auto;
  145. }
  146. }
  147. </style>