ETASheet.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="eta-sheet-wrap">
  3. <div class="top-box">
  4. <span>ETA表格</span>
  5. <el-input
  6. class="search-box"
  7. placeholder="表格名称"
  8. v-model="keyword"
  9. size="medium"
  10. prefix-icon="el-icon-search"
  11. @input="handleSearch"
  12. />
  13. </div>
  14. <div class="main-box">
  15. <div class="list-wrap" v-infinite-scroll="handleLoadMore" :infinite-scroll-immediate="true">
  16. <draggable
  17. :list="list"
  18. :group="{ name: 'component', pull: 'clone', put: false }"
  19. class="sheet-list-box"
  20. animation="300"
  21. :sort="false"
  22. tag="div"
  23. >
  24. <div class="sheet-item" :comp-data="getCompData(item)" v-for="item in list" :key="item.ExcelInfoId">
  25. <div class="title">{{item.ExcelName}}</div>
  26. <div class="img" :style="'backgroundImage:url('+item.ExcelImage+')'"></div>
  27. </div>
  28. </draggable>
  29. <tableNoData text="暂无数据" size="mini" v-if="list.length===0"/>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import * as sheetInterface from "@/api/modules/sheetApi.js";
  36. export default {
  37. data() {
  38. return {
  39. keyword:'',
  40. list:[],
  41. page:1,
  42. pageSize:20,
  43. finished:false,
  44. loading:false
  45. }
  46. },
  47. created(){
  48. this.getSheetList()
  49. },
  50. methods: {
  51. // 生产随机id
  52. getCompId(type){
  53. return type+new Date().getTime()
  54. },
  55. getCompData(item){
  56. const LINK_URL = this.$setting.dynamicOutLinks.ChartViewUrl+'/sheetshow';
  57. // console.log(LINK_URL);
  58. const obj={
  59. compId:4,
  60. compType:'sheet',
  61. content:`${LINK_URL}?code=${item.UniqueCode}&fromScene=1`
  62. }
  63. return JSON.stringify(obj)
  64. },
  65. handleSearch(){
  66. this.list=[]
  67. this.page=1
  68. this.finished=false
  69. this.getSheetList()
  70. },
  71. getSheetList() {
  72. this.loading=true
  73. sheetInterface.sheetList({
  74. Keyword: this.keyword,
  75. CurrentIndex: this.page,
  76. PageSize: this.pageSize,
  77. }).then((res) => {
  78. this.loading=false
  79. if (res.Ret !== 200) return;
  80. const arr = res.Data.List || [];
  81. this.list =
  82. this.page === 1
  83. ? arr
  84. : [...this.list, ...arr];
  85. this.finished = res.Data.Paging.IsEnd;
  86. });
  87. },
  88. handleLoadMore(){
  89. if(this.finished||this.loading) return
  90. this.page++
  91. this.getSheetList()
  92. }
  93. },
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. div{
  98. box-sizing: border-box;
  99. }
  100. .eta-sheet-wrap{
  101. .top-box{
  102. display: flex;
  103. justify-content: space-between;
  104. .search-box{
  105. width: 330px;
  106. }
  107. }
  108. .main-box{
  109. margin-top: 30px;
  110. height: calc(100vh - 180px);
  111. border-radius: 4px;
  112. border: 1px solid var(--gary-gy-5-line, #C8CDD9);
  113. background: #FFF;
  114. padding: 20px;
  115. display: flex;
  116. flex-direction: column;
  117. .list-wrap{
  118. flex: 1;
  119. overflow-y: auto;
  120. }
  121. .sheet-list-box{
  122. display: flex;
  123. flex-wrap: wrap;
  124. gap: 20px;
  125. .sheet-item{
  126. cursor: move;
  127. padding: 0 10px 10px 10px;
  128. width: 250px;
  129. border-radius: 4px;
  130. border: 1px solid var(--gary-gy-5-line, #C8CDD9);
  131. background: var(--gary-gy-white, #FFF);
  132. .title{
  133. padding: 10px 0;
  134. text-align: center;
  135. border-bottom: 1px solid #C8CDD9;
  136. overflow: hidden;
  137. white-space: nowrap;
  138. text-overflow: ellipsis;
  139. }
  140. .img{
  141. width: 100%;
  142. height: 197px;
  143. background-size: contain;
  144. background-position: center;
  145. background-repeat: no-repeat;
  146. }
  147. }
  148. }
  149. }
  150. }
  151. </style>