ImportETAChart.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="import-eta-chart-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="true">
  3. <el-checkbox
  4. class="onlyshowme-box"
  5. v-model="isShowMe"
  6. @change="handleIsShowMeChange"
  7. >只看我的</el-checkbox>
  8. <draggable
  9. :list="list"
  10. :group="{ name: 'component', pull: 'clone', put: false }"
  11. class="chart-list-box"
  12. animation="300"
  13. :sort="false"
  14. tag="div"
  15. >
  16. <div class="chart-item" :comp-data="getCompData(item)" v-for="item in list" :key="item.UniqueCode">
  17. <div class="title">{{item.ChartName}}</div>
  18. <div class="img" :style="'backgroundImage:url('+item.ChartImage+')'"></div>
  19. </div>
  20. </draggable>
  21. <tableNoData text="暂无图表" size="mini" v-if="list.length===0"/>
  22. </div>
  23. </template>
  24. <script>
  25. import { dataBaseInterface } from "@/api/api.js";
  26. export default {
  27. data() {
  28. return {
  29. isShowMe:false,
  30. page:1,
  31. pageSize:20,
  32. list:[],
  33. finished:false,
  34. keyword:'',
  35. loading:false
  36. }
  37. },
  38. created() {
  39. this.getETAChartList()
  40. },
  41. methods: {
  42. // 生产随机id
  43. getCompId(type){
  44. return type+new Date().getTime()
  45. },
  46. getCompData(item){
  47. const LINK_CHART_URL = this.$setting.dynamicOutLinks.ChartViewUrl+'/chartshow';
  48. const obj={
  49. compId:3,
  50. compType:'chart',
  51. content:`${LINK_CHART_URL}?code=${item.UniqueCode}`
  52. }
  53. return JSON.stringify(obj)
  54. },
  55. async getETAChartList(){
  56. this.loading=true
  57. const res=await dataBaseInterface.chartSearchByEs({
  58. Keyword: this.keyword || "",
  59. CurrentIndex: this.page,
  60. PageSize: this.pageSize,
  61. IsShowMe: this.isShowMe,
  62. })
  63. this.loading=false
  64. if(res.Ret===200){
  65. const arr=res.Data.List || []
  66. this.list=[...this.list,...arr]
  67. this.finished=res.Data.Paging.IsEnd
  68. }
  69. },
  70. handleIsShowMeChange(){
  71. this.page=1
  72. this.finished=false
  73. this.list=[]
  74. this.getETAChartList()
  75. },
  76. handleLoadMore(){
  77. if(this.finished||this.loading) return
  78. this.page++
  79. this.getETAChartList()
  80. },
  81. handleSearch(key){
  82. this.page=1
  83. this.finished=false
  84. this.list=[]
  85. this.keyword=key
  86. this.getETAChartList()
  87. }
  88. },
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. div{
  93. box-sizing: border-box;
  94. }
  95. .import-eta-chart-wrap{
  96. height: 100%;
  97. width: 100%;
  98. position: relative;
  99. overflow-y: auto;
  100. overflow-x: hidden;
  101. padding-top: 20px;
  102. .onlyshowme-box{
  103. display: block;
  104. position: sticky;
  105. top: -20px;
  106. padding: 20px 0;
  107. background-color: #FFF;
  108. }
  109. .chart-list-box{
  110. display: flex;
  111. flex-wrap: wrap;
  112. gap: 20px;
  113. .chart-item{
  114. cursor: move;
  115. padding: 0 10px;
  116. width: 250px;
  117. border-radius: 4px;
  118. border: 1px solid var(--gary-gy-5-line, #C8CDD9);
  119. background: var(--gary-gy-white, #FFF);
  120. .title{
  121. padding: 10px 0;
  122. text-align: center;
  123. border-bottom: 1px solid #C8CDD9;
  124. overflow: hidden;
  125. white-space: nowrap;
  126. text-overflow: ellipsis;
  127. }
  128. .img{
  129. width: 100%;
  130. height: 197px;
  131. background-size: cover;
  132. background-position: center;
  133. background-repeat: no-repeat;
  134. }
  135. }
  136. }
  137. }
  138. </style>