ETAPriceChart.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="statistic-analysis-wrap">
  3. <div class="top-box">
  4. <div class="left-card">
  5. <span>商品价格曲线</span>
  6. </div>
  7. <div class="right">
  8. <el-input
  9. class="search-box"
  10. placeholder="图表名称"
  11. v-model="keyword"
  12. size="medium"
  13. prefix-icon="el-icon-search"
  14. @input="handleSearch"
  15. />
  16. </div>
  17. </div>
  18. <div class="main-box">
  19. <el-checkbox
  20. class="onlyshowme-box"
  21. v-model="isShowMe"
  22. @change="handleIsShowMeChange"
  23. >只看我的</el-checkbox>
  24. <div class="list-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="false">
  25. <draggable
  26. :list="list"
  27. :group="{ name: 'component', pull: 'clone', put: false }"
  28. class="chart-list-box"
  29. animation="300"
  30. :sort="false"
  31. tag="div"
  32. >
  33. <div class="chart-item" :comp-data="getCompData(item)" v-for="item in list" :key="item.UniqueCode">
  34. <div class="title">{{item.ChartName}}</div>
  35. <div class="img" :style="'backgroundImage:url('+item.ChartImage+')'"></div>
  36. </div>
  37. </draggable>
  38. <tableNoData text="暂无图表" size="mini" v-if="list.length===0&&finished"/>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import futuresInterface from "@/api/modules/futuresBaseApi";
  45. export default {
  46. data() {
  47. return {
  48. keyword:'',
  49. isShowMe:false,
  50. list:[],
  51. page:1,
  52. pageSize:20,
  53. finished:false
  54. }
  55. },
  56. created(){
  57. this.getChartList()
  58. },
  59. methods: {
  60. // 生产随机id
  61. getCompId(type){
  62. return type+new Date().getTime()
  63. },
  64. getCompData(item){
  65. const LINK_CHART_URL = this.$setting.dynamicOutLinks.ChartViewUrl+'/chartshow';
  66. const obj={
  67. compId:3,
  68. compType:'chart',
  69. content:`${LINK_CHART_URL}?code=${item.UniqueCode}`
  70. }
  71. return JSON.stringify(obj)
  72. },
  73. handleIsShowMeChange(){
  74. this.list=[]
  75. this.page=1
  76. this.finished=false
  77. this.getChartList()
  78. },
  79. handleSearch(){
  80. this.list=[]
  81. this.page=1
  82. this.finished=false
  83. this.getChartList()
  84. },
  85. /* 搜索图表分页 */
  86. async getChartList(word) {
  87. let params = {
  88. Keyword: this.keyword || "",
  89. CurrentIndex: this.page,
  90. PageSize: this.pageSize,
  91. IsShowMe: this.isShowMe,
  92. };
  93. let res = await futuresInterface.searchChart(params);
  94. if (res.Ret !== 200) return;
  95. const arr = res.Data.List || [];
  96. this.list =
  97. this.page === 1
  98. ? arr
  99. : [...this.list, ...arr];
  100. this.finished = res.Data.Paging.IsEnd;
  101. },
  102. handleLoadMore(){
  103. if(this.finished) return
  104. this.page++
  105. this.getChartList()
  106. }
  107. },
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. div{
  112. box-sizing: border-box;
  113. }
  114. .statistic-analysis-wrap{
  115. .top-box{
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. .right{
  120. .search-box{
  121. width: 330px;
  122. }
  123. }
  124. }
  125. .main-box{
  126. margin-top: 30px;
  127. height: calc(100vh - 180px);
  128. border-radius: 4px;
  129. border: 1px solid var(--gary-gy-5-line, #C8CDD9);
  130. background: #FFF;
  131. padding: 20px;
  132. display: flex;
  133. flex-direction: column;
  134. .list-wrap{
  135. flex: 1;
  136. overflow-y: auto;
  137. }
  138. }
  139. }
  140. .chart-list-box{
  141. display: flex;
  142. flex-wrap: wrap;
  143. gap: 20px;
  144. .chart-item{
  145. cursor: move;
  146. padding: 0 10px;
  147. width: 250px;
  148. border-radius: 4px;
  149. border: 1px solid var(--gary-gy-5-line, #C8CDD9);
  150. background: var(--gary-gy-white, #FFF);
  151. .title{
  152. padding: 10px 0;
  153. text-align: center;
  154. border-bottom: 1px solid #C8CDD9;
  155. overflow: hidden;
  156. white-space: nowrap;
  157. text-overflow: ellipsis;
  158. }
  159. .img{
  160. width: 100%;
  161. height: 197px;
  162. background-size: cover;
  163. background-position: center;
  164. }
  165. }
  166. }
  167. </style>