lookDocumentListDialog.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!--
  2. 查看多个文档
  3. import lookDocumentListDialog from '@/components/lookDocumentDialog/lookDocumentListDialog.vue'
  4. components: {
  5. lookDocumentListDialog
  6. },
  7. <lookDocumentListDialog v-if="lookDocumentListType" :propsLookDocumentListData="propsLookDocumentListData"></lookDocumentListDialog>
  8. //查看多个文档
  9. lookDocumentListButton(type){
  10. if(type==1){
  11. this.$set(this,'propsLookDocumentListData',{
  12. title:"查看附件",
  13. list:this.addForm.data7
  14. });
  15. this.$set(this,'lookDocumentListType',true);
  16. }else{
  17. this.$set(this,'lookDocumentListType',false);
  18. }
  19. },
  20. -->
  21. <template>
  22. <el-dialog class="lookDocumentListDialog" :title="lookDocumentListTitle"
  23. :visible.sync="lookDocumentListType" v-if="lookDocumentListType"
  24. @close="outLook"
  25. width="1300px" height="700" append-to-body>
  26. <div class="lookDocumentListDialog-page">
  27. <div class="left-box">
  28. <div class="left-title-box">
  29. <img src="@/assets/ZDimages/safetyCheck/icon_dr_wj.png">
  30. <p>材料附件</p>
  31. <p class="button-p" @click="allDownloadButton">全部下载</p>
  32. </div>
  33. <div class="left-for-box scrollbar-box">
  34. <p class="left-for-p" v-for="(iframeItem,iframeIndex) in lookDocumentList" :key="iframeIndex"
  35. @click="lookDocumentListCheck(iframeIndex)"
  36. :class="lookDocumentListIndex == iframeIndex?'check-p':''">{{iframeItem.name}}</p>
  37. </div>
  38. </div>
  39. <div class="center-border"></div>
  40. <div class="right-box">
  41. <iframe
  42. v-if="lookDocumentSrc"
  43. class="iframe"
  44. :src="lookDocumentSrc" scrolling="auto" frameborder="0">
  45. </iframe>
  46. <p class="positionButton" @click="goPage">全屏</p>
  47. </div>
  48. </div>
  49. <div slot="footer" class="dialog-footer dialog-footer-box" style="display: flex">
  50. <p class="dialog-footer-button-null"></p>
  51. <p class="dialog-footer-button-info" @click="outLook">取消</p>
  52. <p class="dialog-footer-button-primary" @click="downloadButton">下载</p>
  53. <p class="dialog-footer-button-null"></p>
  54. </div>
  55. </el-dialog>
  56. </template>
  57. <script>
  58. export default {
  59. name: 'lookDocumentListDialog',
  60. props:{
  61. propsLookDocumentListData:{},
  62. },
  63. data(){
  64. return{
  65. lookDocumentListType:true,
  66. lookDocumentListTitle:"",
  67. lookDocumentList:[],
  68. lookDocumentSrc:"",
  69. lookDocumentListIndex:0,
  70. }
  71. },
  72. created(){
  73. this.$set(this,'lookDocumentListTitle',this.propsLookDocumentListData.title);
  74. this.$set(this,'lookDocumentList',this.propsLookDocumentListData.list);
  75. this.$set(this,'lookDocumentSrc',this.urlJudge(this.propsLookDocumentListData.list[0].url));
  76. },
  77. mounted(){
  78. },
  79. methods:{
  80. //全部下载
  81. allDownloadButton(){
  82. let self = this;
  83. for(let i=0;i<self.lookDocumentList.length;i++){
  84. this.downloadUrl(this.lookDocumentList[i].url,this.lookDocumentList[i].name)
  85. }
  86. },
  87. // 切换按钮
  88. lookDocumentListCheck(val){
  89. console.log(val)
  90. this.$set(this,'lookDocumentListIndex',val);
  91. this.$set(this,'lookDocumentSrc',this.urlJudge(this.lookDocumentList[val].url));
  92. },
  93. // 返回按钮
  94. outLook(){
  95. this.$parent.lookDocumentListButton(2)
  96. },
  97. // 下载按钮
  98. downloadButton(){
  99. this.downloadUrl(this.lookDocumentList[this.lookDocumentListIndex].url,this.lookDocumentList[this.lookDocumentListIndex].name)
  100. },
  101. //打开新窗口
  102. goPage(){
  103. window.open(this.lookDocumentSrc)
  104. },
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .lookDocumentListDialog{
  110. .lookDocumentListDialog-page{
  111. display: flex;
  112. flex:1;
  113. height:645px;
  114. overflow: hidden;
  115. padding:0 50px;
  116. .left-box{
  117. display: flex;
  118. flex-direction: column;
  119. overflow: hidden;
  120. width:265px;
  121. .left-title-box{
  122. padding-bottom:20px;
  123. display: flex;
  124. width:230px;
  125. border-bottom:1px dashed #D8D8D8;
  126. img{
  127. width:16px;
  128. height:13px;
  129. margin:13px 15px 13px 0;
  130. }
  131. p:nth-child(2){
  132. flex:1;
  133. line-height:40px;
  134. font-size:16px;
  135. color:#0183FA;
  136. }
  137. .button-p{
  138. padding:0 10px;
  139. margin-top:5px;
  140. height:30px;
  141. line-height:30px;
  142. font-size:14px;
  143. color:#0183FA;
  144. border:1px solid #0183FA;
  145. border-radius:4px;
  146. cursor: pointer;
  147. }
  148. .button-p:hover{
  149. color:#fff;
  150. border:1px solid #0183FA;
  151. background-color: #0183FA;
  152. }
  153. }
  154. .left-for-box{
  155. flex:1;
  156. .left-for-p{
  157. padding:0 10px;
  158. width:230px;
  159. line-height:40px;
  160. margin-top:10px;
  161. font-size:16px;
  162. color:#333;
  163. display:block;
  164. overflow:hidden;
  165. text-overflow:ellipsis;
  166. white-space:nowrap;
  167. cursor: pointer;
  168. }
  169. .check-p{
  170. background-color:rgba(1,131,250,0.2);
  171. color:#0183FA;
  172. }
  173. }
  174. }
  175. .center-border{
  176. border-right:1px dashed #D8D8D8;
  177. }
  178. .right-box{
  179. flex:1;
  180. display: flex;
  181. margin-left:57px;
  182. position: relative;
  183. .positionButton{
  184. position: absolute;
  185. top:15px;
  186. right: 35px;
  187. border:1px solid #0183fa;
  188. border-radius:4px;
  189. line-height:30px;
  190. width:60px;
  191. text-align: center;
  192. cursor: pointer;
  193. color:#0183fa;
  194. background-color: #fff;
  195. }
  196. .iframe{
  197. flex:1;
  198. }
  199. }
  200. .out-button{
  201. width:60px;
  202. line-height:30px;
  203. color:#999;
  204. background-color: #dedede;
  205. border-radius:4px;
  206. text-align: center;
  207. cursor: pointer;
  208. position: absolute;
  209. top:17px;
  210. right:17px;
  211. z-index:99999;
  212. }
  213. }
  214. }
  215. </style>