Browse Source

fix:补充文件授权,查阅逻辑

liujiayin 3 years ago
parent
commit
77a5aa0626

+ 34 - 35
src/views/infosManage/externalFiles/externalFiles.vue

@@ -52,6 +52,8 @@
 import ActionUtils from '@/utils/action'
 import { getFileType, getFileByUserId } from '@/api/permission/file'
 import IbpsAttachment from '@/business/platform/file/attachment/selector'
+import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
+
 export default {
   components: {
     'ibps-attachment': IbpsAttachment
@@ -97,10 +99,10 @@ export default {
         // 表格字段配置
         columns: [
           // { prop: 'zi_duan_yi_', label: '部门' },
-          { prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom',width:150 },
+          { prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom', width: 150 },
           { prop: 'wen_jian_ming_che', label: '文件名称' },
-          { prop: 'ban_ben_hao_', label: '版本号',width:150 },
-          { prop: 'fa_bu_ri_qi_', label: '发布日期' ,width:150},
+          { prop: 'ban_ben_hao_', label: '版本号', width: 150 },
+          { prop: 'fa_bu_ri_qi_', label: '发布日期', width: 150, sortable: 'custom' },
           { prop: 'wen_jian_id_', label: '查阅', slotName: "wenjinachayue" }
         ]
       },
@@ -130,45 +132,21 @@ export default {
     },
     loadNode() {
       this.loading = true
-      // getFileType("外部文件").then(res => {
-      //     this.loading = false
-      //     for (let i in res.variables.data) {
-      //         let data = {}
-      //         data["id"] = i
-      //         data["label"] = res.variables.data[i]
-      //         this.typeData.push(data)
-      //     }
-      // }).catch(res => {
-      //     this.loading = false
-      // })
     },
     refreshData() {
       this.tableData = []
-      getFileByUserId(this.getSearcFormData()).then(res => {
-        this.tableData = res.variables.data
-      }).catch(res => {
-        this.loading = false
-        this.tableData = []
-      })
+      this.getDatas(this.getSearcFormData())
     },
 
     handleNodeClick(data) {
+      this.oldorgId = data
       this.show = 'detail'
       if (this.oldorgId == data.id) {
         return
       } else {
-        getFileByUserId({
-          deptName: "",
-          fileCode: "",
-          fileName: "",
-          fileType: data.label,
-          userId: this.$store.getters.userInfo.employee.id
-        }).then(res => {
-          this.oldorgId = data.id
-          this.tableData = res.variables.data
-        }).catch(res => {
-          this.loading = false
-          this.tableData = []
+        this.getDatas({
+          fileType: this.typeData[data.id].label,
+          sorts: { 'wen_jian_bian_hao': 'desc' }
         })
       }
     },
@@ -178,8 +156,7 @@ export default {
      */
     getSearcFormData() {
       const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-      params['fileType'] = this.typeData[this.oldorgId].label
-      params['userId'] = this.$store.getters.userInfo.employee.id
+      params['fileType'] = this.typeData[this.oldorgId.id].label
       params['sorts'] = this.sorts
       return params
     },
@@ -200,7 +177,29 @@ export default {
     */
     handleSortChange(sort) {
       ActionUtils.setSorts(this.sorts, sort)
-      getFileByUserId(this.getSearcFormData()).then(res => {
+      this.getDatas(this.getSearcFormData())
+    },
+    getDatas(sorts) {
+      this.tableData = []
+      let wheres = ''
+      if (sorts.fileCode) {
+        wheres = wheres + ` and wen_jian_bian_hao like '%${sorts.fileCode}%'`
+      }
+
+      if (sorts.fileType) {
+        wheres = wheres + ` and wai_bu_wen_jian_l = '${sorts.fileType}'`
+      }
+      if (sorts.fileName) {
+        wheres = wheres + ` and wen_jian_ming_che like '%${sorts.fileName}%'`
+      }
+      if (sorts.sorts) {
+        if (JSON.stringify(sorts.sorts) !== "{}") {
+          wheres = wheres + ` order by  ${Object.keys(sorts.sorts)}  ${Object.values(sorts.sorts)}`
+        }
+      }
+
+      let sql = `select *FROM t_wjgl WHERE wen_jian_zhuang_t = '已发放' AND yi_gai_zuo_fei_='否' ${wheres} `
+      curdPost('sql', sql).then(res => {
         this.tableData = res.variables.data
       }).catch(res => {
         this.loading = false

+ 56 - 42
src/views/infosManage/internalFiles/internalFiles.vue

@@ -52,6 +52,8 @@
 import ActionUtils from '@/utils/action'
 import { getFileType, getFileByUserId } from '@/api/permission/file'
 import IbpsAttachment from '@/business/platform/file/attachment/selector'
+import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
+
 export default {
   components: {
     'ibps-attachment': IbpsAttachment
@@ -69,13 +71,13 @@ export default {
       typeData: [
         { id: '0', label: '质量管理手册(QM)' },
         { id: '1', label: '程序文件(QP)' },
-        { id: '2', label: '[限] 生物安全手册(SWAQ)' },
-        { id: '3', label: '[限] 行政管理制度(ZD)' },
-        { id: '4', label: '[限] 检测类(JC-SOP)' },
-        { id: '5', label: '[限] 仪器设备类(YQ-SOP)' },
-        { id: '6', label: '[限] 期间核查类(HC-SOP)' },
-        { id: '7', label: '[限] 环境设施类(HJ-SOP)' },
-        { id: '8', label: '[限] 质量或技术管理类(ZQ-SOP)' },
+        { id: '2', label: '生物安全手册(SWAQ)' },
+        { id: '3', label: '行政管理制度(ZD)' },
+        { id: '4', label: '检测类(JC-SOP)' },
+        { id: '5', label: '仪器设备类(YQ-SOP)' },
+        { id: '6', label: '期间核查类(HC-SOP)' },
+        { id: '7', label: '环境设施类(HJ-SOP)' },
+        { id: '8', label: '[限] 技术管理类(ZQ-SOP)' },
         { id: '9', label: '技术记录表(FQ)' },
         { id: '10', label: '管理记录表(FQ)' }
       ],
@@ -88,7 +90,7 @@ export default {
         { id: '5', label: '仪器设备类(YQ-SOP)' },
         { id: '6', label: '期间核查类(HC-SOP)' },
         { id: '7', label: '环境设施类(HJ-SOP)' },
-        { id: '8', label: '质量或技术管理类(ZQ-SOP)' },
+        { id: '8', label: '技术管理类(ZQ-SOP)' },
         { id: '9', label: '技术记录表(FQ)' },
         { id: '10', label: '管理记录表(FQ)' }
       ],
@@ -117,10 +119,10 @@ export default {
         // 表格字段配置
         columns: [
           // { prop: 'zi_duan_yi_', label: '部门' },
-          { prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom',width:150 },
+          { prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom', width: 150 },
           { prop: 'wen_jian_ming_che', label: '文件名称' },
-          { prop: 'ban_ben_hao_', label: '版本号',width:150 },
-          { prop: 'fa_bu_ri_qi_', label: '发布日期',width:150 },
+          { prop: 'ban_ben_hao_', label: '版本号', width: 150 },
+          { prop: 'fa_bu_ri_qi_', label: '发布日期', width: 150, sortable: 'custom' },
           { prop: 'wen_jian_id_', label: '查阅', slotName: "wenjinachayue" }
         ]
       },
@@ -150,45 +152,62 @@ export default {
     },
     loadNode() {
       this.loading = true
-      // getFileType("内部文件").then(res => {
-      //     this.loading = false
-      //     for (let i in res.variables.data) {
-      //         let data = {}
-      //         data["id"] = i
-      //         data["label"] = res.variables.data[i]
-      //         this.typeData.push(data)
-      //     }
-      // }).catch(res => {
-      //     this.loading = false
-      // })
     },
-    refreshData() {
+    getDatas(sorts) {
       this.tableData = []
-      getFileByUserId(this.getSearcFormData()).then(res => {
+      let sql = ''
+      let wheres = ''
+      if (sorts.fileCode) {
+        wheres = wheres + ` and wen_jian_bian_hao like '%${sorts.fileCode}%'`
+      }
+
+      if (sorts.fileType) {
+        wheres = wheres + ` and wen_jian_lie_xing = '${sorts.fileType}'`
+      }
+
+      if (sorts.fileType == '技术管理类(ZQ-SOP)') {
+        if (sorts.fileName) {
+          wheres = wheres + ` and wj.wen_jian_ming_che like '%${sorts.fileName}%'`
+        }
+        if (sorts.sorts) {
+          if (JSON.stringify(sorts.sorts) !== "{}") {
+            wheres = wheres + ` order by  ${Object.keys(sorts.sorts)}  ${Object.values(sorts.sorts)}`
+          }
+        }
+        sql = `select wj.*,qx.yong_hu_id_ from t_wjcysqb qx left join t_wjgl wj ON qx.wen_jian_id_ = wj.id_ where qx.yong_hu_id_ = ${sorts.userId} ${wheres} `
+      } else {
+        if (sorts.fileName) {
+          wheres = wheres + ` and wen_jian_ming_che like '%${sorts.fileName}%'`
+        }
+        if (sorts.sorts) {
+          if (JSON.stringify(sorts.sorts) !== "{}") {
+            wheres = wheres + ` order by  ${Object.keys(sorts.sorts)}  ${Object.values(sorts.sorts)}`
+          }
+        }
+        sql = `select *FROM t_wjgl WHERE wen_jian_zhuang_t = '已发放' AND yi_gai_zuo_fei_='否' ${wheres} `
+      }
+      curdPost('sql', sql).then(res => {
         this.tableData = res.variables.data
       }).catch(res => {
         this.loading = false
         this.tableData = []
       })
     },
+    refreshData() {
+      this.tableData = []
+      this.getDatas(this.getSearcFormData())
+    },
 
     handleNodeClick(data) {
+      this.oldorgId = data
       this.show = 'detail'
       if (this.oldorgId == data.id) {
         return
       } else {
-        getFileByUserId({
-          deptName: "",
-          fileCode: "",
-          fileName: "",
+        this.getDatas({
           fileType: this.paramsTypeData[data.id].label,
-          userId: this.$store.getters.userInfo.employee.id
-        }).then(res => {
-          this.oldorgId = data.id
-          this.tableData = res.variables.data
-        }).catch(res => {
-          this.loading = false
-          this.tableData = []
+          userId: this.$store.getters.userInfo.employee.id,
+          sorts: { 'wen_jian_bian_hao': 'desc' }
         })
       }
     },
@@ -198,7 +217,7 @@ export default {
      */
     getSearcFormData() {
       const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-      params['fileType'] = this.paramsTypeData[this.oldorgId].label
+      params['fileType'] = this.paramsTypeData[this.oldorgId.id].label
       params['userId'] = this.$store.getters.userInfo.employee.id
       params['sorts'] = this.sorts
       return params
@@ -220,12 +239,7 @@ export default {
     */
     handleSortChange(sort) {
       ActionUtils.setSorts(this.sorts, sort)
-      getFileByUserId(this.getSearcFormData()).then(res => {
-        this.tableData = res.variables.data
-      }).catch(res => {
-        this.loading = false
-        this.tableData = []
-      })
+      this.getDatas(this.getSearcFormData())
     },
   },
   watch: {

+ 9 - 3
src/views/permissions/details/fileEchart.vue

@@ -77,7 +77,7 @@ export default {
         wai_bu_wen_jian_l waiLeiXing
         FROM t_wjgl
         WHERE wen_jian_lie_xing IN(
-            '生物安全手册(SWAQ)','行政管理制度(ZD)','检测类(JC-SOP)','仪器设备类(YQ-SOP)','期间核查类(HC-SOP)','环境设施类(HJ-SOP)','质量或技术管理类(ZQ-SOP)'
+           '技术管理类(ZQ-SOP)'
             )
         AND id_ NOT IN (  SELECT wen_jian_id_ id_  FROM t_wjcysqb WHERE  yong_hu_id_= '${id}' ) order by wai_bu_wen_jian_l,wen_jian_lie_xing asc`
       curdPost('sql', noPerSql).then(res => {
@@ -93,7 +93,12 @@ export default {
         }
       }).catch(res => {
       })
-      let hadPer = `select qx.*,wj.wen_jian_lie_xing,wj.wai_bu_wen_jian_l  FROM 
+      let hadPer = `select qx.yong_hu_id_,
+      wj.id_ as wenJianId,
+      wj.wen_jian_ming_che as wenJianMingChe,
+      wj.wen_jian_lie_xing as neiLeiXing,
+      wj.wai_bu_wen_jian_l as waiLeiXing  
+      FROM 
       t_wjcysqb qx LEFT JOIN t_wjgl wj ON qx.wen_jian_id_ = wj.id_ WHERE qx.yong_hu_id_= '${id}' order by wj.wai_bu_wen_jian_l,wj.wen_jian_lie_xing asc
         `
       curdPost('sql', hadPer).then(res => {
@@ -102,7 +107,8 @@ export default {
           let filterFile = {}
           filterFile["key"] = i.wenJianId
           filterFile["label"] = i.wenJianMingChe
-          filterFile["yongHuId"] = id
+          filterFile["type"] = i.neiLeiXing ? i.neiLeiXing : i.waiLeiXing
+          filterFile["yongHuId"] = i.yong_hu_id_
           this.permissionFiles.push(filterFile)
           this.permissionFilesKey.push(i.wenJianId)
           this.allFiles.push(filterFile)