Procházet zdrojové kódy

受限文件查阅权限调整

lidie před 1 rokem
rodič
revize
4e55b884c7
1 změnil soubory, kde provedl 52 přidání a 13 odebrání
  1. 52 13
      src/views/infosManage/fileIE.vue

+ 52 - 13
src/views/infosManage/fileIE.vue

@@ -435,7 +435,11 @@ export default {
                     ascDesc = sorts.order === 'ascending' ? 'asc' : 'desc'
                 }
             }
-
+            const isSuper = this.$store.getters.isSuper
+            const roleLists = this.$store.getters.userInfo.role
+            const roleKey = ['wjgly']
+            const curRole = roleLists.map(i => i.alias)
+            const isPower = curRole.some(i => roleKey.includes(i))
             // 重复发放的文件,在权限表会存在重复的文件信息
             //   let fileSearchSql = `select  wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,qx.bian_zhi_shi_jian
             //    FROM (SELECT *FROM (SELECT * FROM t_wjcysqb  ORDER BY create_time_ DESC LIMIT 99999999) a GROUP BY a.yong_hu_id_,a.wen_jian_id_) qx LEFT JOIN t_wjxxb wj ON qx.wen_jian_id_=wj.wen_jian_fu_jian_ WHERE qx.yong_hu_id_='${this.userId}' AND qx.shou_quan_='1' ${wheres1} GROUP BY qx.yong_hu_id_,qx.wen_jian_id_`
@@ -463,19 +467,53 @@ export default {
             where wj.shi_fou_guo_shen_ in ('有效','使用') ${wheres2} `
             // 受限文件:结合查阅授权模块的截止时间
             // select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,concat(file.file_name_,'.',file.ext_,'(',file.total_bytes_,')') as file_info_,
-            const authoritySql = `select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,concat(file.file_name_,'.',file.ext_,'(',
-                 CASE
-                WHEN file.total_bytes_ >= 1024 * 1024 THEN CONCAT(ROUND(file.total_bytes_ / (1024.0 * 1024), 2), ' M')
-                WHEN file.total_bytes_ >= 1024 THEN CONCAT(ROUND(file.total_bytes_ / 1024.0, 2), ' K')
-                ELSE CONCAT(file.total_bytes_, 'B')
+
+            //     const authoritySql = `select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,concat(file.file_name_,'.',file.ext_,'(',
+            //          CASE
+            //         WHEN file.total_bytes_ >= 1024 * 1024 THEN CONCAT(ROUND(file.total_bytes_ / (1024.0 * 1024), 2), ' M')
+            //         WHEN file.total_bytes_ >= 1024 THEN CONCAT(ROUND(file.total_bytes_ / 1024.0, 2), ' K')
+            //         ELSE CONCAT(file.total_bytes_, 'B')
+            //     END
+            //     ,')') as file_info_,
+            //     wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,wj.fa_bu_shi_jian_ as fa_fang_shi_jian_,sq.cha_yue_jie_zhi_s  from
+            // t_wjxxb wj
+            // left join (select *from t_skwjcysqsqzb order by create_time_ desc limit 1) sq on wj.id_=sq.wen_jian_id_
+            // ${leftSql}
+            // WHERE wj.shi_fou_guo_shen_ ='有效'
+            // and (${isPower} or wj.quan_xian_xin_xi_ like '%${this.userId}%')  ${wheres3} `
+
+            const authoritySql = `select wj.id_ as id,cy.id_ as cy_id_,sc.id_ as sc_id_,
+            CONCAT(file.file_name_, '.', file.ext_, '(',
+            CASE
+               WHEN file.total_bytes_ >= 1024 * 1024 THEN CONCAT(ROUND(file.total_bytes_ / (1024.0 * 1024), 2), ' M')
+               WHEN file.total_bytes_ >= 1024 THEN CONCAT(ROUND(file.total_bytes_ / 1024.0, 2), ' K')
+               ELSE CONCAT(file.total_bytes_, 'B')
             END
-            ,')') as file_info_,
-            wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,wj.fa_bu_shi_jian_ as fa_fang_shi_jian_,sq.cha_yue_jie_zhi_s  from
-        t_wjxxb wj 
-        left join (select *from t_skwjcysqsqzb order by create_time_ desc limit 1) sq on wj.id_=sq.wen_jian_id_ 
-        ${leftSql}
-        WHERE wj.shi_fou_guo_shen_ ='有效' and ((sq.cha_yue_jie_zhi_s >DATE_FORMAT(NOW(), '%Y-%m-%d')) OR (sq.cha_yue_jie_zhi_s =DATE_FORMAT(NOW(), '%Y-%m-%d')))
-        and wj.quan_xian_xin_xi_ like '%${this.userId}%'  ${wheres3} `
+         , ')') as file_info_,wj.wen_jian_xi_lei_,wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,wj.wen_jian_fu_jian_ AS fu_jian_,wj.fa_bu_shi_jian_ as fa_fang_shi_jian_,sq.cha_yue_jie_zhi_s FROM t_wjxxb wj 
+         LEFT JOIN (SELECT * FROM t_skwjcysqsqzb ORDER BY create_time_ DESC LIMIT 1) sq ON wj.id_ = sq.wen_jian_id_ ${leftSql}
+         WHERE wj.shi_fou_guo_shen_ = '有效' AND (${isSuper} OR ${isPower}
+			OR EXISTS (
+			SELECT
+				1 
+			FROM
+				t_wjxdzb wjxdzb
+				JOIN t_wjxzxdjlb wjxzxdjlb ON wjxdzb.id_ = wjxzxdjlb.parent_id_
+				JOIN t_wjxxb wjxxb ON wjxxb.shu_ju_lai_yuan_ = wjxzxdjlb.id_ 
+			WHERE
+				wjxxb.id_ = wj.id_ 
+				AND CONCAT_WS(
+					',',
+				IF
+					( wjxdzb.bian_zhi_ren_ != '', wjxdzb.bian_zhi_ren_, NULL ),
+				IF
+					( wjxdzb.zhu_shen_he_ren_ != '', wjxdzb.zhu_shen_he_ren_, NULL ),
+				IF
+					( wjxdzb.zhu_shen_pi_ren_ != '', wjxdzb.zhu_shen_pi_ren_, NULL ) 
+				) LIKE '%${this.userId}%' 
+			) 
+		) 
+        ${wheres3}`
+
             const sqlArr = [comSql, buMenSql, authoritySql]
             let oldRecordSql = ''
             const buMenWhere = []
@@ -528,6 +566,7 @@ export default {
                 this.listData = []
             })
         },
+        //  and ((sq.cha_yue_jie_zhi_s >DATE_FORMAT(NOW(), '%Y-%m-%d')) OR (sq.cha_yue_jie_zhi_s =DATE_FORMAT(NOW(), '%Y-%m-%d')))
         refreshData () {
             this.listData = []
             this.getSearcFormData()