cfort 1 год назад
Родитель
Сommit
66550bcfa7
1 измененных файлов с 23 добавлено и 10 удалено
  1. 23 10
      src/views/infosManage/fileIE.vue

+ 23 - 10
src/views/infosManage/fileIE.vue

@@ -252,7 +252,7 @@ export default {
             sorts: {},
             sqlWhere: {},
             searchWhere: {},
-            pageKey: '',
+            pageKey: 'record', // file-受控文件查阅 recoed-纸质运行记录 recordUpload-纸质运行记录上传
             dialogFormVisible: false,
             defId: '',
             addDataCont: {},
@@ -293,18 +293,21 @@ export default {
         }
     },
     created () {
-        this.pageKey = this.$route.name
-        this.categoryKey = this.pageKey === 'nbwj' ? 'FILE_TYPE' : 'FLOW_TYPE'
+        const { defaultUrl } = this.$route.meta || {}
+        const { pageKey } = this.parseUrl(defaultUrl) || {}
+        this.pageKey = pageKey
+        console.log(pageKey)
+        this.categoryKey = this.pageKey === 'file' ? 'FILE_TYPE' : 'FLOW_TYPE'
         this.userId = this.$store.getters.userInfo.employee.id
         const roleList = this.$store.getters.userInfo.role
         // 系统管理角色添加删除按钮
         const hasRole = roleList.some((item) => item.name === '系统管理角色')
-        if (this.pageKey === 'wjkzgl-ywyxjlsc' || this.pageKey === 'ywtxyxjl') {
+        if (this.pageKey === 'recordUpload' || this.pageKey === 'record') {
             // 系统管理角色不做分类过滤
             this.listConfig.toolbars.push({ key: 'remove' })
             this.selection = true
         }
-        if (this.pageKey === 'nbwj') {
+        if (this.pageKey === 'file') {
             this.listConfig.searchForm.forms = [
                 { prop: 'wen_jian_bian_hao', label: '文件编号' },
                 { prop: 'wen_jian_ming_che', label: '文件名称' }
@@ -339,7 +342,7 @@ export default {
                 }
             ]
         }
-        if (this.pageKey === 'wjkzgl-ywyxjlsc' || this.pageKey === 'ywtxyxjl') {
+        if (this.pageKey === 'recordUpload' || this.pageKey === 'record') {
             this.listConfig.searchForm.forms = [
                 {
                     prop: 'nian_du_',
@@ -384,6 +387,16 @@ export default {
         }
     },
     methods: {
+        parseUrl (url) {
+            // 处理URL可能包含的前导/尾随斜杠和空格
+            url = (url || '').trim().replace(/^\/|\/$/g, '')
+            // 分割路径和查询部分
+            const [pathPart, queryPart] = url.split('?')
+
+            const queryParams = new URLSearchParams(queryPart || '')
+            const params = Object.fromEntries(queryParams)
+            return params
+        },
         editClose (visible) {
             this.editDialogVisible = visible
             this.refreshData()
@@ -477,7 +490,7 @@ export default {
             }
             // fileType存放文件的id和有孩子的id
             if (fileType) {
-                if (this.pageKey === 'nbwj') {
+                if (this.pageKey === 'file') {
                     if (comAuthority.length !== 0) {
                         wheres1 =
                             wheres1 +
@@ -594,7 +607,7 @@ export default {
             const sqlArr = [comSql, buMenSql, authoritySql]
             let oldRecordSql = ''
             const buMenWhere = []
-            if (this.pageKey !== 'nbwj') {
+            if (this.pageKey !== 'file') {
                 if (this.$store.getters.deptList.length !== 0) {
                     // eslint-disable-next-line no-redeclare
                     if (this.pos) {
@@ -633,7 +646,7 @@ export default {
             const fileSearchSql = needSelType.join('union all')
             // ` order by  ${sorts.sortBy}  ${sorts.order === 'ascending' ? 'asc' : 'desc'}`
             const sql =
-                this.pageKey === 'nbwj'
+                this.pageKey === 'file'
                     ? `select sq.id,sq.cy_id_,sq.sc_id_,sq.shu_ju_lai_yuan_,sq.file_info_,sq.wen_jian_xi_lei_,sq.wen_jian_bian_hao,sq.wen_jian_ming_che,sq.ban_ben_,sq.ext_,sq.file_path_,COALESCE(wjxz.gai_zhang_fu_jian,sq.fu_jian_) AS fu_jian_,sq.fa_fang_shi_jian_,sq.cha_yue_jie_zhi_s from (${fileSearchSql}) sq LEFT JOIN t_wjxzxdjlb wjxz ON sq.shu_ju_lai_yuan_ = wjxz.id_ ORDER BY sq.wen_jian_bian_hao ${ascDesc},sq.wen_jian_ming_che DESC`
                     : oldRecordSql
             // console.log(sql, 'sssssssssssssssssss')
@@ -715,7 +728,7 @@ export default {
             }
             // 判断是否存在下级菜单
             const noHadNext = !nodeData.children || !nodeData.children.length
-            if (noHadNext && this.pageKey === 'wjkzgl-ywyxjlsc') {
+            if (noHadNext && this.pageKey === 'recordUpload') {
                 const chongfu = this.listConfig.toolbars.filter((el) => {
                     return el.key === 'add'
                 })