Browse Source

测试反馈问题

MaiXinRong 2 years ago
parent
commit
0a7e608bba

+ 1 - 0
app/controller/sub_proj_controller.js

@@ -153,6 +153,7 @@ module.exports = app => {
                 await ctx.service.subProjPermission.savePermission(data.id, data.member);
                 ctx.body = { err: 0, msg: '', data: '' };
             } catch (err) {
+                console.log(err);
                 ctx.log(err);
                 ctx.ajaxErrorBody(err, '保存数据失败');
             }

+ 5 - 5
app/public/js/sub_project.js

@@ -234,7 +234,7 @@ $(document).ready(function() {
     });
     $('#edit-project-ok').click(function() {
         const nameObj = $('#edit-project-name');
-        const name = name.val();
+        const name = nameObj.val();
         if (!name || name.length > 100) return;
         postData('/subproj/save', { id: nameObj.attr('tree_id'), name }, function(result) {
             projectTreeObj.refreshRow(result);
@@ -335,7 +335,7 @@ $(document).ready(function() {
                         <label class="custom-control-label" for="budgetview${mem.uid}"></label></div></td>`);
             const editBudget = mem.budget_permission.indexOf(permissionConst.budget.edit.value) >= 0;
             html.push(`<td><div class="custom-control custom-checkbox mb-2">
-                        <input type="checkbox" ptype="budgetEdit" sptype="edit" id="budgetedit${mem.uid}" uid="${mem.uid}" class="custom-control-input" ${(editBudget ? 'checked' : '')}>
+                        <input type="checkbox" ptype="budget" sptype="edit" id="budgetedit${mem.uid}" uid="${mem.uid}" class="custom-control-input" ${(editBudget ? 'checked' : '')}>
                         <label class="custom-control-label" for="budgetedit${mem.uid}"></label></div></td>`);
             // 电子文档
 
@@ -413,9 +413,9 @@ $(document).ready(function() {
             if (pType === 'budget' && spType === 'view') {
                 mem.budget_permission.push(parseInt(permissionConst.budget.view.value));
             } else if (pType === 'budget' && spType === 'edit') {
-                mem.budget_permission.push(parseInt(permissionConst.budget.view.value));
+                mem.budget_permission.push(parseInt(permissionConst.budget.edit.value));
                 if (mem.budget_permission.indexOf(permissionConst.budget.view.value) < 0) {
-                    mem.budget_permission.push(parseInt(permissionConst.budget.edit.value));
+                    mem.budget_permission.push(parseInt(permissionConst.budget.view.value));
                     $(`#budgetview${id}`)[0].checked = true;
                 }
             } else if (pType === 'file' && spType === 'view') {
@@ -427,7 +427,7 @@ $(document).ready(function() {
                     $(`#fileview${id}`)[0].checked = true;
                 }
             } else if (pType === 'file' && spType === 'edit') {
-                mem.file_permission.push(parseInt(permissionConst.file.view.value));
+                mem.file_permission.push(parseInt(permissionConst.file.edit.value));
                 if (mem.file_permission.indexOf(permissionConst.file.view.value) < 0) {
                     mem.file_permission.push(parseInt(permissionConst.file.view.value));
                     $(`#fileview${id}`)[0].checked = true;

+ 1 - 1
app/service/sub_proj_permission.js

@@ -47,7 +47,7 @@ module.exports = app => {
         }
 
         async showSubTab(uid, type) {
-            const sql = `SELECT count(*) FROM ${this.tableName} WHERE ${type}_permission <> '' AND uid = ?`;
+            const sql = `SELECT count(*) as count FROM ${this.tableName} WHERE ${type}_permission <> '' AND uid = ?`;
             const result = await this.db.queryOne(sql, [uid]);
             return result.count;
         }