Browse Source

资料归集,记住当前选中分类

MaiXinRong 2 years ago
parent
commit
6441c66ccb

+ 0 - 1
app/controller/file_controller.js

@@ -262,7 +262,6 @@ module.exports = app => {
         async loadRelaFiles(ctx) {
             try {
                 const data = JSON.parse(ctx.request.body.data);
-                console.log(data);
                 if (!data.type) throw '参数错误';
 
                 let files;

+ 3 - 1
app/controller/sub_proj_controller.js

@@ -139,7 +139,9 @@ module.exports = app => {
             try {
                 const data = JSON.parse(ctx.request.body.data);
                 if (!data.id || !data.rela_tender) throw '参数有误';
-                const permission = await ctx.service.subProjPermission.getSubProjectUserPermission(data.id, ctx.session.sessionUser.accountId);
+                const permission = ctx.session.sessionUser.is_admin
+                    ? ctx.service.subProjPermission.adminPermission
+                    : await ctx.service.subProjPermission.getSubProjectUserPermission(data.id, ctx.session.sessionUser.accountId);
                 if (!permission || permission.manage_permission.indexOf(ctx.service.subProjPermission.PermissionConst.manage.rela.value) < 0) throw '您无权进行该操作';
                 const result = await ctx.service.subProject.setRelaTender({ id: data.id, rela_tender: data.rela_tender });
                 ctx.body = { err: 0, msg: '', data: { update: [result] } };

+ 8 - 0
app/public/js/file_detail.js

@@ -16,6 +16,7 @@ $(document).ready(function() {
             this.expandKey = 'filing-' + window.location.pathname.split('/')[2];
             const cache = getLocalCache(this.expandKey);
             this.expandCache = cache ? cache.split(',') : [];
+            this.curFilingKey = 'cur-filing-' + window.location.pathname.split('/')[2];
         }
         analysisFiling(data) {
             const self = this;
@@ -44,6 +45,12 @@ $(document).ready(function() {
                 return result;
             });
             this.filingTree = $.fn.zTree.init($('#filing'), this.setting, sortNodes);
+            const curCache = getLocalCache(this.curFilingKey);
+            const curNode = curCache ? this.filingTree.getNodeByParam('id', curCache) : null;
+            if (curNode){
+                this.filingTree.selectNode(curNode);
+                filingObj.setCurFiling(curNode);
+            }
         }
         _getFileHtml(file) {
             const html = [];
@@ -240,6 +247,7 @@ $(document).ready(function() {
             } else {
                 $('#rela-file-btn').hide();
             }
+            setLocalCache(this.curFilingKey, filingObj.curFiling.id);
         }
         prePage() {
             if (this.curPage === 1) return;

+ 1 - 1
app/service/sub_proj_permission.js

@@ -28,7 +28,7 @@ module.exports = app => {
                 },
                 file: {
                     view: { title: '查看', value: 1 },
-                    upload: { title: '上传文件', value: 2 },
+                    upload: { title: '上传/引用', value: 2 },
                     filing: { title: '文件类别编辑', value: 3 },
                 },
                 manage: {

+ 1 - 1
app/view/sub_proj/modal.ejs

@@ -162,7 +162,7 @@
                             <th>查看</th>
                             <th>编辑</th>
                             <th>查看</th>
-                            <th>导入</th>
+                            <th>上传/引用</th>
                             <th>编辑分类</th>
                         </tr>
                         </thead>