Просмотр исходного кода

Merge branch 'master' of http://119.23.210.103:3000/wy/zdqy_firm_former

shenqilong 1 год назад
Родитель
Сommit
940e66e705

+ 14 - 0
src/api/platform/file/attachment.js

@@ -110,6 +110,19 @@ export function download (params) {
         params: params
     })
 }
+/**
+ * 打包下载文件
+ * @param {*} params
+ */
+export function downloadZip (params) {
+    return request({
+        url: SYSTEM_URL() + '/file/downloadZip',
+        method: 'get',
+        isLoading: true,
+        responseType: 'arraybuffer',
+        params: params
+    })
+}
 /**
  * 根据文件id获取文件流
  * @param {*} params
@@ -196,3 +209,4 @@ export function snapshoot (params) {
         params: params
     })
 }
+

+ 28 - 2
src/business/platform/file/utils/index.js

@@ -1,9 +1,9 @@
-import { download } from '@/api/platform/file/attachment'
+import { download, downloadZip } from '@/api/platform/file/attachment'
 import Utils from '@/utils/util'
 import ActionUtils from '@/utils/action'
 import { Loading } from 'element-ui'
 
-export function downloadFile (file) {
+export const downloadFile = (file) => {
     const loadingInstance = Loading.service({
         lock: true,
         text: '下载中..'
@@ -23,3 +23,29 @@ export function downloadFile (file) {
         loadingInstance.close()
     })
 }
+
+export const downloadFileByZip = (ids) => {
+    const loadingInstance = Loading.service({
+        lock: true,
+        text: '下载中..'
+    })
+    downloadZip({
+        attachmentIds: ids
+    }).then(response => {
+        loadingInstance.close()
+        if (!response) {
+            return
+        }
+        ActionUtils.exportFile(
+            response.data,
+            '批量下载文件.zip'
+        )
+    }).catch(() => {
+        loadingInstance.close()
+    })
+}
+
+export default {
+    downloadFile,
+    downloadFileByZip
+}

+ 1 - 1
src/store/modules/ibps/modules/user.js

@@ -183,7 +183,7 @@ export default {
          */
         getUserList ({ state, dispatch }, { first, second }) {
             const params = second ? `'%${second}%' or entity.id_ = '${first}'` : first ? `'%${first}%'` : '%%'
-            const sql = `select users.id_ as userId, users.name_ as userName, ifnull(users.mobile_, '') as phone, ifnull(group_concat(distinct positions.id_ order by positions.id_ separator ','), '') as positionId, ifnull(group_concat(distinct positions.name_ order by positions.id_ separator ','), '') as positions, ifnull(group_concat(distinct roles.id_ order by roles.role_note_ asc separator ','), '') as roleId, ifnull(group_concat(distinct roles.name_ order by roles.role_note_ asc separator ','), '') as roles, (select ifnull(people.qian_zi_tu_wen_, '') from t_ryjbqk as people where people.parent_id_ = users.id_ order by create_time_ desc limit 1) as signatureId, (select ifnull(files.file_name_, '') from ibps_file_attachment as files where files.id_ = signatureId) as signatureName from ibps_party_employee as users left join (select ur.user_id_, r.role_note_, group_concat(distinct r.id_ order by r.id_ separator ',') as id_, group_concat(distinct r.name_ order by r.id_ separator ',') as name_ from ibps_party_user_role as ur join ibps_party_role as r on ur.role_id_ = r.id_ group by ur.user_id_) as roles on users.id_ = roles.user_id_ left join ibps_party_entity as positions on find_in_set(positions.id_, users.positions_) where exists (select 1 from ibps_party_entity as entity where find_in_set(entity.id_, users.positions_) and (entity.path_ like ${params})) group by users.id_`
+            const sql = `select users.id_ as userId, users.name_ as userName, ifnull(users.mobile_, '') as phone, ifnull(group_concat(distinct positions.id_ order by positions.id_ separator ','), '') as positionId, ifnull(group_concat(distinct positions.name_ order by positions.id_ separator ','), '') as positions, ifnull(group_concat(distinct roles.id_ order by roles.role_note_ asc separator ','), '') as roleId, ifnull(group_concat(distinct roles.name_ order by roles.role_note_ asc separator ','), '') as roles, (select ifnull(people.qian_zi_tu_wen_, '') from t_ryjbqk as people where people.parent_id_ = users.id_ order by create_time_ desc limit 1) as signatureId, (select ifnull(files.file_name_, '') from ibps_file_attachment as files where files.id_ = signatureId) as signatureName from ibps_party_employee as users left join (select ur.user_id_, r.role_note_, group_concat(distinct r.id_ order by r.id_ separator ',') as id_, group_concat(distinct r.name_ order by r.id_ separator ',') as name_ from ibps_party_user_role as ur join ibps_party_role as r on ur.role_id_ = r.id_ group by ur.user_id_) as roles on users.id_ = roles.user_id_ left join ibps_party_entity as positions on find_in_set(positions.id_, users.positions_) where exists (select 1 from ibps_party_entity as entity where find_in_set(entity.id_, users.positions_) and (entity.path_ like ${params})) and users.status_ = 'actived' group by users.id_`
             common.request('sql', sql).then(res => {
                 const { data = [] } = res.variables || {}
                 dispatch('ibps/param/setUserList', data, {

+ 11 - 1
src/views/platform/file/attachment/list.vue

@@ -57,7 +57,7 @@
 
 <script>
 import { queryPageList, deleteFile } from '@/api/platform/file/attachment'
-import { downloadFile } from '@/business/platform/file/utils'
+import { downloadFile, downloadFileByZip } from '@/business/platform/file/utils'
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
 import IbpsUploader from '@/business/platform/file/uploader'
@@ -125,6 +125,11 @@ export default {
                         label: '上传',
                         icon: 'ibps-icon-upload'
                     },
+                    {
+                        key: 'downloadZip',
+                        label: '批量下载',
+                        icon: 'ibps-icon-download'
+                    },
                     {
                         key: 'remove'
                     }
@@ -295,6 +300,11 @@ export default {
                 case 'download': // 下载
                     this.handleDownload(data)
                     break
+                case 'downloadZip': // 批量下载
+                    ActionUtils.selectedMultiRecord(selection).then((id) => {
+                        downloadFileByZip(id)
+                    })
+                    break
                 case 'remove': // 删除
                     ActionUtils.removeRecord(selection).then((ids) => {
                         this.handleRemove(ids)

+ 4 - 1
src/views/platform/org/role/list.vue

@@ -152,7 +152,10 @@ export default {
                     }, {
                         key: 'assignResource',
                         label: '资源分配',
-                        icon: 'ibps-icon-dashboard'
+                        icon: 'ibps-icon-dashboard',
+                        hidden () {
+                            return !isSuper
+                        }
                     }, {
                         key: 'appAssignResource',
                         label: 'App资源分配',