dataAssociateChart.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="associate-chart">
  3. <div v-if="list.length===0&&finished" style="text-align:center;display:block" class="empty-list">
  4. <tableNoData :text="$t('EtaBasePage.no_quote_chart')"/>
  5. </div>
  6. <template v-else>
  7. <p style="position:relative;font-size:16px">共 {{chartTotal}} 张图表</p>
  8. <div
  9. class="chart-public-list"
  10. v-infinite-scroll="load"
  11. infinite-scroll-immediate="false"
  12. :infinite-scroll-disabled="finished"
  13. >
  14. <div class="chart-list-item-wrap">
  15. <div class="chart-list-item" v-for="chart in list" :key="chart.ChartInfoId">
  16. <div class="chart-item-top text_oneLine"><span class="text_oneLine">{{ chart.ChartName }}</span></div>
  17. <div class="chart-item-img" @click="detailShowHandle(chart)"
  18. :style="chart.ChartImage?{background: `no-repeat top/cover url('${chart.ChartImage}')`}:{}"></div>
  19. <div class="chart-item-bottom">
  20. <span>创建时间: {{ chart.CreateTime.slice(0,10) }}</span>
  21. <span class="join_txt" @click="addMychartHandle(chart)">
  22. <img :src="$icons.chart_join_ico"
  23. style="width: 13px; height: 12px; vertical-align: middle"/>
  24. 加入我的图库
  25. </span>
  26. </div>
  27. </div>
  28. </div>
  29. <!-- <el-col
  30. :span="6"
  31. style="margin-bottom: 20px; padding-right: 20px"
  32. v-for="chart in list"
  33. :key="chart.ChartInfoId"
  34. >
  35. <el-card class="public-chart-item">
  36. <div slot="header" class="item-top">
  37. <span class="text_oneLine">{{ chart.ChartName }}</span>
  38. </div>
  39. <img
  40. :src="chart.ChartImage"
  41. alt=""
  42. class="chart-img"
  43. @click="detailShowHandle(chart)"
  44. />
  45. <div class="item-bottom">
  46. <span>创建时间: {{ chart.CreateTime.slice(0,10) }}</span>
  47. <span
  48. class="join_txt"
  49. @click="addMychartHandle(chart)"
  50. >
  51. <img
  52. :src="$icons.chart_join_ico"
  53. alt=""
  54. style="width: 13px; height: 12px; vertical-align: middle"
  55. />
  56. 加入我的图库
  57. </span>
  58. </div>
  59. </el-card>
  60. </el-col> -->
  61. </div>
  62. </template>
  63. <!-- 加入我的图库弹窗 -->
  64. <addMyClassifyDia
  65. :isAddMyDialog="isAddMyChart"
  66. :add_id="add_chart_id"
  67. :add_ids="add_ids"
  68. @cancel="isAddMyChart = false"
  69. @addSuccess="addMySuccess"
  70. />
  71. <!-- 图表详情弹窗 -->
  72. <chart-detail
  73. ref="chartDetailRef"
  74. :isOpenDetail="isOpenDetail"
  75. :select_classify="select_classify"
  76. :chart_code="chart_code"
  77. :allChart="chartArrParams"
  78. :classifyUserId="0"
  79. @close="chartCallBack"
  80. @remove="removeCallBack"
  81. />
  82. </div>
  83. </template>
  84. <script>
  85. import { dataBaseInterface } from '@/api/api.js';
  86. import addMyClassifyDia from '../components/addMyClassifyDia';
  87. import chartDetail from '@/views/mychart_manage/components/chartDetailDia.vue';
  88. export default {
  89. components:{
  90. addMyClassifyDia,
  91. chartDetail
  92. },
  93. props:{
  94. edbInfoId:{
  95. type:Number
  96. }
  97. },
  98. watch: {
  99. 'edbInfoId':{
  100. handler(n){
  101. if(n){
  102. this.page=1
  103. this.list=[]
  104. this.finished=false
  105. this.chartTotal=0
  106. this.getChartList()
  107. }
  108. },
  109. immediate:true
  110. }
  111. },
  112. data() {
  113. return {
  114. list:[],
  115. page:1,
  116. pageSize:20,
  117. chartTotal:0,
  118. finished:false,
  119. // 加入我的
  120. isAddMyChart: false, //加入图库弹窗
  121. add_chart_id: 0, //要加入的图表
  122. add_ids:[],//加入时已有的分类
  123. // 显示详情弹窗
  124. chart_code:'',
  125. isOpenDetail:false,
  126. chartArrParams:[],
  127. select_classify:''
  128. }
  129. },
  130. methods: {
  131. async getChartList(){
  132. const res=await dataBaseInterface.edbRelationChartList({
  133. PageSize: this.pageSize,
  134. CurrentIndex: this.page,
  135. EdbInfoId:this.edbInfoId
  136. })
  137. if(res.Ret!==200) return
  138. this.list=res.Data?this.page==1?res.Data.List:[...this.list,...res.Data.List]:[]
  139. this.chartTotal=res.Data?res.Data.Paging.Totals : 0
  140. this.finished=res.Data?res.Data.Paging.IsEnd:true
  141. },
  142. load(){
  143. if(this.finished) return
  144. this.page++
  145. this.getChartList()
  146. },
  147. /* 加入我的图库 */
  148. addMychartHandle(item) {
  149. this.add_chart_id = item.ChartInfoId;
  150. //已有的分类ids
  151. this.add_ids = item.MyChartClassifyId ? item.MyChartClassifyId.split(',').map(item => Number(item)) : [];
  152. this.isAddMyChart = true;
  153. },
  154. /* 加入我的图库成功 */
  155. addMySuccess(params) {
  156. this.isAddMyChart = false;
  157. this.list.forEach(item => {
  158. if (item.ChartInfoId === this.add_chart_id) {
  159. item.IsAdd = true;
  160. item.MyChartId = params.MyChartInfoId;
  161. item.MyChartClassifyId = params.MyChartClassifyId
  162. }
  163. });
  164. if(this.isOpenDetail) this.$refs.chartDetailRef.getChartInfo();
  165. },
  166. //显示详情
  167. detailShowHandle({ UniqueCode }){
  168. this.chart_code = UniqueCode;
  169. // 获取当前列表中所有图 获取code
  170. this.chartArrParams = this.list.map(item => item.UniqueCode) ||[];
  171. this.isOpenDetail = true;
  172. },
  173. chartCallBack(){
  174. this.page=1
  175. this.list=[]
  176. this.getChartList()
  177. this.isOpenDetail = false;
  178. },
  179. removeCallBack(code){
  180. this.chartArrParams.splice(this.chartArrParams.findIndex(item => item === code), 1)
  181. }
  182. },
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .associate-chart{
  187. height: 100%;
  188. overflow: hidden;
  189. display: flex;
  190. flex-direction: column;
  191. }
  192. .empty-list{
  193. min-height: calc(100vh - 300px);
  194. background-color: #fff;
  195. margin-top: -30px;
  196. padding-top: 100px;
  197. }
  198. .chart-public-list{
  199. flex: 1;
  200. width: 100%;
  201. margin-top:20px;
  202. /* max-height: calc(100vh - 220px); */
  203. overflow-y: auto;
  204. .chart-list-item{
  205. width:23%;
  206. min-width: 235px;
  207. .join_txt {
  208. float: right;
  209. color: #409eff;
  210. cursor: pointer;
  211. }
  212. }
  213. }
  214. .public-chart-item {
  215. .item-top {
  216. display: flex;
  217. justify-content: space-between;
  218. align-items: center;
  219. font-size: 16px;
  220. font-weight: 600;
  221. }
  222. .chart-img {
  223. width: 100%;
  224. height: 230px;
  225. object-fit: fill !important;
  226. cursor: pointer;
  227. }
  228. .item-bottom {
  229. margin-top: 10px;
  230. display: flex;
  231. justify-content: space-between;
  232. font-size: 12px;
  233. color: #666;
  234. .collected {
  235. color: #f00;
  236. cursor: pointer;
  237. }
  238. .join_txt {
  239. color: #409eff;
  240. cursor: pointer;
  241. }
  242. }
  243. }
  244. </style>