EDBInfoChangeTable.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="edbinfo-table-wrap">
  3. <div>
  4. <img src="~@/assets/img/data_m/set_icon.png" alt="" style="cursor: pointer;float:right" @click="showSetTableCols=true">
  5. </div>
  6. <el-table
  7. v-loading="tableLoading"
  8. ref="tableIns"
  9. :data="tableData"
  10. border
  11. @sort-change="handleTableSortChange"
  12. >
  13. <el-table-column
  14. v-for="col in tableColOpts"
  15. :key="col.ColumnKey"
  16. :column-key="col.ColumnKey"
  17. :label="col.ColumnName"
  18. :prop="col.ColumnKey"
  19. :sortable="col.IsSort===1?'custom':false"
  20. align="center"
  21. :width="getColWidth(col.ColumnKey)"
  22. >
  23. <template slot="header" slot-scope="scope">
  24. <span>{{col.ColumnName}}</span>
  25. <el-tooltip
  26. effect="dark"
  27. :content="getTableHeadTips(col.ColumnKey)"
  28. placement="top-start"
  29. >
  30. <i class="el-icon-info" v-if="tipsKeysArr.includes(col.ColumnKey)"></i>
  31. </el-tooltip>
  32. </template>
  33. </el-table-column>
  34. <div slot="empty">
  35. <tableNoData text="暂无数据"/>
  36. </div>
  37. </el-table>
  38. <el-pagination
  39. layout="total,prev,pager,next,jumper"
  40. background
  41. @current-change="handleCurrentChange"
  42. :page-size="pageSize"
  43. @size-change="handleSizeChange"
  44. :total="total"
  45. style="float: right;margin-top:20px"
  46. />
  47. <!-- 自定义列表 -->
  48. <SetTableCols v-model="showSetTableCols" :ColumnType="4" @change="handleTableColChange"/>
  49. </div>
  50. </template>
  51. <script>
  52. import {apiDataSource} from '@/api/modules/dataSource'
  53. import SetTableCols from './SetTableCols.vue'
  54. export default {
  55. components:{SetTableCols},
  56. data() {
  57. return {
  58. tipsKeysArr:['EdbNameSource','EdbName','ErDataUpdateDate'],
  59. tableLoading:false,
  60. tableColOpts:[],
  61. tableData:[],
  62. pageSize:15,
  63. page:1,
  64. total:0,
  65. tableLoading:false,
  66. filterState:{
  67. dateVal:this.$moment().format('YYYY-MM-DD')||'',
  68. sortKey:'',
  69. sortType:'',
  70. },
  71. showSetTableCols:false,
  72. }
  73. },
  74. created() {
  75. this.getTableColOpts()
  76. },
  77. methods: {
  78. //获取表格数据
  79. getTableList(){
  80. this.tableLoading=true
  81. apiDataSource.GLEdbInfoTableList({
  82. CurrentIndex:this.page,
  83. PageSize:this.pageSize,
  84. SortParam:this.filterState.sortKey,
  85. SortType:this.filterState.sortType,
  86. CreateTime:this.filterState.dateVal,
  87. }).then(res=>{
  88. this.tableLoading=false
  89. if(res.Ret===200){
  90. const arr=res.Data.List||[]
  91. this.tableData=arr
  92. this.total=res.Data.Paging.Totals
  93. }
  94. })
  95. },
  96. handleCurrentChange(e){
  97. this.page=e
  98. this.getTableList()
  99. },
  100. // 筛选项刷新列表
  101. handleRefreshList(){
  102. this.page=1
  103. this.getTableList()
  104. },
  105. // 获取表格列配置项
  106. getTableColOpts(){
  107. this.tableColOpts=[]
  108. this.tableLoading=true
  109. apiDataSource.GLTableColOpts({ColumnType:4}).then(res=>{
  110. if(res.Ret===200){
  111. const arr=res.Data.List||[]
  112. this.tableColOpts=arr.filter(item=>item.IsShow===1)
  113. this.$nextTick(()=>{
  114. // this.$refs.tableIns.doLayout()
  115. this.tableLoading=false
  116. })
  117. this.getTableList()
  118. }
  119. })
  120. },
  121. handleTableColChange(){
  122. this.getTableColOpts()
  123. },
  124. handleShowSetTableCol(){
  125. this.showSetTableCols=true
  126. },
  127. // 排序
  128. handleTableSortChange({column, prop, order}){
  129. console.log(column, prop, order);
  130. this.filterState.sortKey=prop
  131. this.filterState.sortType=order==='descending'?'desc':order==='ascending'?'asc':''
  132. this.handleRefreshList()
  133. },
  134. // table说明文案
  135. getTableHeadTips(key){
  136. const tipsMap={
  137. EdbNameSource:'指标在数据源的全称',
  138. EdbName:'指标在ETA指标库保存的指标名称',
  139. ErDataUpdateDate:'指标数据发生变化的最早日期',
  140. }
  141. return tipsMap[key]
  142. },
  143. // 设置列的宽度
  144. getColWidth(key){
  145. const widthMap={
  146. EdbName:'150px',
  147. DataUpdateTime:'150px',
  148. ErDataUpdateDate:'200px',
  149. StartDate:'150px',
  150. LatestDate:'150px',
  151. CreateTime:'150px',
  152. EdbNameSource:'150px'
  153. }
  154. return widthMap[key]
  155. }
  156. },
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .edbinfo-table-wrap{
  161. .top-wrap{
  162. display: flex;
  163. justify-content: flex-end;
  164. margin-bottom: 30px;
  165. .set-icon{
  166. width: 40px;
  167. cursor: pointer;
  168. }
  169. }
  170. }
  171. </style>