index.vue 3.9 KB

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