index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="normal-card" style="padding-top:0">
  3. <el-tabs v-model="activeName">
  4. <el-tab-pane label="营销物料" name="营销物料"></el-tab-pane>
  5. <el-tab-pane label="我的收藏" name="我的收藏"></el-tab-pane>
  6. </el-tabs>
  7. <!--营销物料-->
  8. <div v-if="activeName == '营销物料'">
  9. <!--面包屑-->
  10. <div class="header-panl">
  11. <bread-crumbs :tempFileData="tempFileData" @BreadCrumbsChange="BreadCrumbsChange"></bread-crumbs>
  12. <div style="display:flex">
  13. <search style="height:32px" @searchActive="searchActive" @clearData="clearData" ref="search"></search>
  14. <!--切换最热最新-->
  15. <hot-new-control style="height:32px;line-height:32px" @sortTypeChange="sortTypeChange" v-if="tool.checkAuth($route.name, 'read')"></hot-new-control>
  16. </div>
  17. </div>
  18. <div class="content">
  19. <!--文件展示-->
  20. <file-list :fileData="fileData" @upFileData="upFileData" @statusChange="statusChange" :isCollect="true"
  21. v-if="tool.checkAuth($route.name, 'read')">
  22. </file-list>
  23. <pagination :total="total" :pageSize="params.content.pageSize" :currentPage="params.content.pageNumber"
  24. @pageChange="pageChange">
  25. </pagination>
  26. </div>
  27. </div>
  28. <admag v-if="activeName == '我的收藏'"/>
  29. </div>
  30. </template>
  31. <script>
  32. import FileList from '@/SManagement/archives/components/FileList'
  33. import SelectPanl from '@/SManagement/submitedit_one/components/SelectPanl'
  34. import HotNewControl from '@/components/hot-new-control/HotNewControl'
  35. import search from '@/components/search/index'
  36. import BreadCrumbs from '@/components/bread-crumbs/BreadCrumbs'
  37. import Pagination from '@/components/pagination/Pagination'
  38. import admag from '../archivesmag/index'
  39. export default {
  40. name: 'index',
  41. data() {
  42. return {
  43. params: {
  44. "accesstoken": "14fed62faa62714a6a1e2ebe2d3997e3",
  45. "classname": "saletool.salematerial.salematerial",
  46. "method": "selectList",
  47. "content": {
  48. "nocache": true,
  49. "pageNumber": 1,
  50. "pageSize": 25,
  51. "parentid": 0,
  52. "where": {
  53. "condition": "",
  54. }
  55. }
  56. },
  57. /**
  58. * data:存放临时文件数据
  59. * @param filename : 文件夹名
  60. * @param data : 文件夹id
  61. */
  62. tempFileData: [{
  63. filename: '文件',
  64. id: null,
  65. }],
  66. fileData: [],
  67. //当前所在文件夹位置
  68. currentFileIndex: 0,
  69. //文件信息面板是否显示
  70. isFileInfoPanlShow: true,
  71. total: 0,
  72. sort: "",
  73. activeName:'营销物料'
  74. };
  75. },
  76. components: {
  77. SelectPanl,
  78. search,
  79. FileList,
  80. HotNewControl,
  81. BreadCrumbs,
  82. Pagination,
  83. admag
  84. },
  85. computed: {
  86. },
  87. watch: {
  88. activeName(val) {
  89. val == '营销物料' && this.getFileList()
  90. }
  91. },
  92. created() {
  93. this.getFileList()
  94. this.tempFileData[0].id = 1
  95. },
  96. methods: {
  97. //获取文件数据 //salematerialfolderid
  98. async getFileList() {
  99. console.log(this.params)
  100. this.params.content.parentid = JSON.parse(sessionStorage.getItem("folderid")).salematerialfolderid
  101. let res = await this.$api.requested(this.params)
  102. this.total = res.total
  103. this.params.content.sort = res.sort
  104. this.fileData = this.fileType.fileList(res.data)
  105. },
  106. pageChange(n) {
  107. this.params.content.pageNumber = n
  108. this.getFileList()
  109. },
  110. searchActive(txt) {
  111. this.params.content.where.condition = txt
  112. this.getFileList()
  113. },
  114. clearData() {
  115. this.params.content.where.condition = ''
  116. this.getFileList()
  117. },
  118. //监听文件夹单击事件
  119. upFileData(parentid, name, id) {
  120. this.params.content.parentid = id
  121. this.currentFileIndex = id
  122. this.tempFileData[this.tempFileData.length - 1].id = parentid
  123. this.getFileList()
  124. this.tempFileData.push({
  125. filename: name,
  126. id: id
  127. })
  128. },
  129. //面包屑发出的事件
  130. BreadCrumbsChange(index) {
  131. if (this.tempFileData.length <= 1) return
  132. this.params.content.parentid = index
  133. this.tempFileData.splice(this.tempFileData.indexOf(this.tempFileData.find(item => item.id == index)) + 1)
  134. this.params.content.pageNumber = 1
  135. this.$refs.search.clearData()
  136. this.getFileList()
  137. },
  138. //修改收藏状态
  139. statusChange(id, item) {
  140. this.params.content.parentid = item.parentid
  141. this.getFileList()
  142. },
  143. //监听最热组件变化
  144. sortTypeChange(name) {
  145. for (let i = 0; i < this.params.content.sort.length; i++) {
  146. this.params.content.sort[i].sorted = this.params.content.sort[i].sortname == name ? 1 : 0
  147. }
  148. this.getFileList()
  149. this.currentFileIndex = 0
  150. },
  151. }
  152. }
  153. </script>
  154. <style scoped>
  155. .normal-card {
  156. -webkit-user-select: none;
  157. -moz-user-select: none;
  158. -ms-user-select: none;
  159. user-select: none;
  160. min-height: 100%;
  161. position: relative;
  162. }
  163. .normal-card .el-breadcrumb {
  164. margin-bottom: 34px;
  165. }
  166. .normal-card .header-panl {
  167. display: flex;
  168. justify-content: space-between;
  169. height: 32px;
  170. }
  171. .normal-card .header-panl .el-dropdown-link {
  172. display: flex;
  173. }
  174. .normal-card .header-panl .el-dropdown .el-dropdown-link .select {
  175. margin-left: 8px;
  176. }
  177. .normal-card .content {
  178. position: relative;
  179. padding-bottom: 30px;
  180. min-height: calc(100vh - 270px);
  181. }
  182. .normal-card .content .el-pagination {
  183. position: absolute;
  184. bottom: 0;
  185. right: 16px;
  186. margin-bottom: 0;
  187. }
  188. </style>