index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div class="file1" v-if="fileData">
  3. <div class="item-file" :style="[{width:(!itemStyle.itemWidth ? '100%' : itemStyle.itemWidth + 'px')},{'margin-right':itemStyle.margin + 'px'}]" v-for="(item,index) in fileData" :key="index">
  4. <div class="left">
  5. <div class="icon" :style="{width:itemStyle.img.width+'px',height:itemStyle.img.height+'px',}">
  6. <img :src="item.cover" alt />
  7. </div>
  8. <div class="text">
  9. <p>{{item.document}}</p>
  10. <p>{{item.createdate}}</p>
  11. </div>
  12. </div>
  13. <div class="right">
  14. <p class="see" @click="seeClick(item)" v-if="tool.checkAuth($route.name,'read')">预览</p>
  15. <p @click="deleteFile(item)" v-if="isDelete && tool.checkAuth($route.name,'delete')" class="delete">删除</p>
  16. <button @click="downLoad(item)" v-if="isDownLoad && tool.checkAuth($route.name,'download')">下载</button>
  17. <!-- v-if="tool.checkAuth($route.path,'aaaa') && isDownLoad" -->
  18. </div>
  19. </div>
  20. <see-File ref="seeFile" :fileData="seeFile"></see-File>
  21. </div>
  22. </template>
  23. <script>
  24. import SeeFile from '@/components/file-block/components/SeeFile'
  25. import removeFile from '@/utils/removeFile'
  26. export default {
  27. name: 'index',
  28. data () {
  29. return {
  30. seeFile: '',
  31. isSeeFileShow:false
  32. };
  33. },
  34. props: {
  35. isDownLoad: Boolean,
  36. itemStyle: Object,
  37. isDelete:Boolean,
  38. fileData: {
  39. default() {
  40. return []
  41. }
  42. },
  43. sat_noticeid:''
  44. },
  45. components: {
  46. SeeFile,
  47. },
  48. computed: {
  49. },
  50. watch: {
  51. },
  52. created() {
  53. },
  54. methods: {
  55. deleteFile(item) {
  56. let temp = item
  57. removeFile.removeFileList([item]).then(res => {
  58. if(res == 1) {
  59. this.$notify({
  60. title:'提示',
  61. message:'删除成功',
  62. type:'success'
  63. })
  64. this.$emit('deleteSuccess',temp)
  65. } else {
  66. this.$notify({
  67. title:'提示',
  68. message:'删除失败',
  69. type:'error'
  70. })
  71. }
  72. })
  73. },
  74. //预览
  75. seeClick(item) {
  76. if(item.fileType == 'image' || item.fileType == 'pdf' || item.fileType == 'video') {
  77. this.seeFile = item
  78. this.$refs.seeFile.dialogVisible = true
  79. } else {
  80. this.$notify({
  81. title:'提示',
  82. message:'该文件暂不支持',
  83. type:'warning'
  84. })
  85. }
  86. },
  87. downLoad(item) {
  88. if(this.sat_noticeid) {
  89. this.$api.requested({
  90. "classname": "saletool.notice.notice",
  91. "method": "updateDownloadRecord",
  92. "content": {
  93. "sat_noticeid":this.sat_noticeid
  94. }
  95. }).then(res => {
  96. })
  97. }
  98. window.open(item.url,'_self')
  99. }
  100. },
  101. };
  102. </script>
  103. <style scoped>
  104. *{
  105. box-sizing: border-box;
  106. }
  107. .file1 {
  108. display: flex;
  109. flex-wrap: wrap;
  110. }
  111. .item-file {
  112. width: 334px;
  113. background: #ffffff;
  114. border-radius: 4px 4px 4px 4px;
  115. border: 1px solid #cccccc;
  116. margin: 0 0 10px 0;
  117. padding: 12px 16px;
  118. display: flex;
  119. justify-content: space-between;
  120. }
  121. .item-file .left {
  122. display: flex;
  123. align-items: center;
  124. }
  125. .item-file .left .icon {
  126. width: 29px;
  127. height: 29px;
  128. margin-right: 16px;
  129. }
  130. .item-file .left .icon img {
  131. width: 100%;
  132. height: 100%;
  133. }
  134. .item-file .left .text {
  135. height: 100%;
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: space-between;
  139. }
  140. .item-file .left .text p:first-child {
  141. font-size: 14px;
  142. font-family: PingFang SC-Bold, PingFang SC;
  143. font-weight: bold;
  144. color: #333333;
  145. line-height: 22px;
  146. overflow: hidden;
  147. text-overflow: ellipsis;
  148. white-space: nowrap;
  149. width: 160px;
  150. }
  151. .item-file .left .text p:last-child {
  152. font-size: 10px;
  153. font-family: PingFang SC-Regular, PingFang SC;
  154. font-weight: 400;
  155. color: #999999;
  156. line-height: 22px;
  157. }
  158. .item-file .right {
  159. display: flex;
  160. align-items: center;
  161. }
  162. .item-file .right .see {
  163. font-size: 14px;
  164. font-weight: 400;
  165. color: #3874f6;
  166. cursor: pointer;
  167. }
  168. .item-file .right .delete {
  169. font-size: 14px;
  170. font-weight: 400;
  171. color: #999999;
  172. margin-left: 40px;
  173. cursor: pointer;
  174. }
  175. .item-file .right button {
  176. width: 70px;
  177. height: 32px;
  178. background: #3874f6;
  179. border-radius: 52px;
  180. border: none;
  181. color: #ffffff;
  182. margin-left: 16px;
  183. cursor: pointer;
  184. }
  185. .no-file {
  186. display: flex;
  187. justify-content: space-around;
  188. width: 100%;
  189. margin-bottom: 10px;
  190. }
  191. .el-empty {
  192. height: 150px;
  193. transform: scale(70%);
  194. }
  195. /deep/.el-dialog__wrapper {
  196. z-index: 9999;
  197. }
  198. </style>