Explorar el Código

[update] 控制润乾报表下载打印权限

cfort hace 2 años
padre
commit
81522daddd

+ 108 - 94
src/assets/styles/components/toolbar.scss

@@ -1,104 +1,118 @@
-
 .ibps-toolbar {
-  .el-button+.el-button {
-    margin-left: 5px;
-  }
-  .toolbar-box {
-    padding: 3px;
-    border: 1px solid #ebeef5;
-	float: left;
-  }
-  .buttons {
-    padding: 0;
-    margin-left: 10px;
-    margin-bottom: 5px;
-    float: left;
-  }
-  .tools {
-    padding: 0;
-    padding-right: 5px;
-    float: right;
-  }
-  .header {
-    padding: 5px 0px;
-    background-color: #FFFFFF;
-    border: 1px solid #ebeef5;
-    height: 45px;
-    .tools>a {
-      display: inline-block;
-      font-size: 14px;
-      line-height: 24px;
-      text-decoration: none;
-      color: #d7d7d7;
-      margin-right: 5px;
-      margin-top: 5px;
-    }
-  }
-
-  .search-label:not(.button-div) {
-    display: inline-block;
-    margin-bottom: -5px;
-    margin-right: 5px;
-    font-weight: bold;
-    width: 80px;
-    text-align: right;
-    line-height: 20px;
-    overflow: hidden;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    font-size: 13px;
-    color: #939596;
-  }
-  .inline {
-    display: inline-block;
-  }
-  .clear {
-    clear: both;
-  }
-  
-  &--medium {
-    .header {
-      height: 40px;
+    .el-button+.el-button {
+        margin-left: 5px;
     }
-  }
-  &--small {
-    .header {
-      height: 35px;
+    .toolbar-box {
+        padding: 3px;
+        border: 1px solid #ebeef5;
+        float: left;
+    }
+    .buttons {
+        padding: 0;
+        margin-left: 10px;
+        margin-bottom: 5px;
+        float: left;
+    }
+    .tools {
+        padding: 0;
+        padding-right: 5px;
+        float: right;
     }
-  }
-  &--mini {
     .header {
-      height: 30px;
+        padding: 5px 0px;
+        background-color: #FFFFFF;
+        border: 1px solid #ebeef5;
+        height: 45px;
+
+        .tools>a {
+            display: inline-block;
+            font-size: 14px;
+            line-height: 24px;
+            text-decoration: none;
+            color: #d7d7d7;
+            margin-right: 5px;
+            margin-top: 5px;
+        }
+    }
+    .search-label:not(.button-div) {
+        display: inline-block;
+        margin-bottom: -5px;
+        margin-right: 5px;
+        font-weight: bold;
+        width: 80px;
+        text-align: right;
+        line-height: 20px;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        font-size: 13px;
+        color: #939596;
+    }
+    .inline {
+        display: inline-block;
+    }
+    .clear {
+        clear: both;
+    }
+    &--medium {
+        .header {
+            height: 40px;
+        }
+    }
+    &--small {
+        .header {
+            height: 35px;
+        }
+    }
+    &--mini {
+        .header {
+            height: 30px;
+        }
     }
-  }
 }
 
-.ibps-dialog-91{
-	.el-dialog__body{
-	    height:  calc(100vh) !important;
-	    margin: -9px !important;
-	    padding: 0;
-			
-	}
-	.el-dialog__header{
-	  padding: 0px;
-	}
-	.el-dialog__headerbtn i {
-	 font-size: 28px;
-	 font-weight: bold;
-	 background-color: #FFFFFF;
-	 border-radius: 8px;
-	 margin-top: -8px;
-	}
+.ibps-dialog-91, .js-custom-dialog {
+    .el-dialog__body {
+        height: calc(100vh) !important;
+        margin: -9px !important;
+        padding: 0;
+
+    }
+    .el-dialog__header {
+        padding: 0px;
+    }
+    .el-dialog__headerbtn i {
+        font-size: 28px;
+        font-weight: bold;
+        background-color: #FFFFFF;
+        border-radius: 8px;
+        margin-top: -8px;
+    }
+}
+.btn-cover, .js-custom-dialog {
+    height: calc(94vh) !important;
+    .el-dialog__body {
+        overflow: hidden;
+    }
+    .toolbar-cover {
+        background: rgba(255, 255, 255, 0);
+        position: absolute;
+        top: 0;
+        right: 50px;
+        width: 80px;
+        height: 45px;
+        z-index: 99;
+    }
 }
+
 .ibps-actions {
-  .action-icon + .action-icon{
-   margin-left: 2px;
- }
- .el-button+.el-button{
-     margin-left: 5px;
- }
- .el-dropdown{
-   margin:0 5px;
- }
+    .action-icon+.action-icon {
+        margin-left: 2px;
+    }
+    .el-button+.el-button {
+        margin-left: 5px;
+    }
+    .el-dropdown {
+        margin: 0 5px;
+    }
 }

+ 28 - 11
src/business/platform/form/utils/custom/preview.js

@@ -1,16 +1,16 @@
 import dialog from '@/utils/dialog'
 import Pdfh5 from 'pdfh5'
 import 'pdfh5/css/pdfh5.css'
-import { snapshoot } from '@/api/platform/file/attachment' // 印章,快照
-import { download } from '@/api/platform/file/attachment'
+import { snapshoot, download } from '@/api/platform/file/attachment' // 印章,快照
 import ActionUtils from '@/utils/action'
+import store from '@/store'
 
 export const preview = (tableForm, url) => {
-    var flag = true
+    let isMobile = false
     if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
-        flag = false
+        isMobile = true
     }
-    if (flag) {
+    if (!isMobile) {
         dialog(
             {
                 data () {
@@ -26,13 +26,30 @@ export const preview = (tableForm, url) => {
                 dialog: {
                     appendToBody: true,
                     width: '90%',
-                    top: '1vh',
+                    top: '3vh',
                     center: true,
                     title: '',
-                    'custom-class': 'ibps-dialog-91'
-                }
-            }, (tpl) => {
+                    showClose: true,
+                    closeOnClickModal: false,
+                    'custom-class': 'ibps-dialog-91 btn-cover'
+                },
+            },
+            (tpl) => {
                 tableForm.dialogTemplate = tpl
+                const { role } = store.getters.userInfo || {}
+                // 系统管理角色、检验科主任、检验科副主任、文件管理员、技术负责人、质量负责人可下载打印
+                const hasRole = role.some(item => ['xtgljs', 'syszr', 'jykfzr', 'wjgly', 'jsfzr', 'zlfzr'].includes(item.alias))
+                if (hasRole) {
+                    return
+                }
+                setTimeout(() => {
+                    const toolbarCover = document.createElement('div')
+                    toolbarCover.classList.add('toolbar-cover')
+                    toolbarCover.addEventListener('click', () => {
+                        confirm('无权操作,请联系管理员开放相关权限!', '提示')
+                    })
+                    document.querySelector('.btn-cover').children[1].appendChild(toolbarCover)
+                }, 1000)
             }
         ).catch((_this) => {
             _this.visible = false
@@ -94,7 +111,7 @@ export const preview = (tableForm, url) => {
                         tableForm.dialogTemplate = null
                         this.visible = false
                     },
-                    download () {
+                    downloadFile () {
                         ActionUtils.exportFile(this.url, `${this.name}.pdf`)
                     }
                 },
@@ -102,7 +119,7 @@ export const preview = (tableForm, url) => {
                 `<div style="height:100%">
                     <div id="demo"></div>
                     <div style="position:absolute;right: 17px;top: 15px;" >
-                        <i class="el-icon-download" style="font-size: 24px;margin-right:15px" @click="download"></i>
+                        <i class="el-icon-download" style="font-size: 24px;margin-right:15px" @click="downloadFile"></i>
                         <i class="el-icon-close" style="font-size: 24px;" @click="close"></i>
                     </div>
                 </div>`

+ 1 - 1
src/components/ibps-file-viewer/index.vue

@@ -125,7 +125,7 @@
                 return PopupManager.getZIndex()
             },
             loadViewer() {
-                var flag = true;
+                var flag = true
                 if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
                     flag = false
                 }

+ 1 - 21
src/components/ibps-link/dialog.vue

@@ -4,7 +4,7 @@
     :visible.sync="dialogVisible"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
-    :top="dialogTop||'1vh'"
+    :top="dialogTop||'3vh'"
     :width="dialogWidth||'90%'"
     class="js-custom-dialog"
     append-to-body
@@ -89,23 +89,3 @@ export default {
   }
 }
 </script>
-<style lang="scss" >
-.js-custom-dialog{
-  .el-dialog__body{
-      height:  calc(100vh) !important;
-      margin: -9px !important;
-      padding: 0;
-	  overflow: hidden;
-  }
-  .el-dialog__header{
-    padding: 0px;
-  }
-  .el-dialog__headerbtn i {
-   font-size: 28px;
-   font-weight: bold;
-   background-color: #FFFFFF;
-   border-radius: 8px;
-   margin-top: -8px;
-  }
-}
-</style>