Browse Source

1. 书签问题
2. 项目管理移动问题

MaiXinRong 1 year atrás
parent
commit
8d2351b349
3 changed files with 19 additions and 5 deletions
  1. 1 1
      app/controller/tender_controller.js
  2. 6 1
      app/public/js/sub_project.js
  3. 12 3
      db_script/audit_order.js

+ 1 - 1
app/controller/tender_controller.js

@@ -1152,7 +1152,7 @@ module.exports = app => {
             try {
                 const isValidTourist = ctx.tender.isTourist && ctx.tender.touristPermission.tag;
                 if (ctx.stage) {
-                    const isAuditor = ctx.stage.users.indexOf(this.ctx.session.sessionUser.accountId) >= 0;
+                    const isAuditor = ctx.stage.userIds.indexOf(this.ctx.session.sessionUser.accountId) >= 0;
                     if (!isAuditor && !isValidTourist) throw '您无权进行该操作';
                 } else if (ctx.revise) {
                     const isAuditor = ctx.revise.reviseUsers.indexOf(this.ctx.session.sessionUser.accountId) >= 0;

+ 6 - 1
app/public/js/sub_project.js

@@ -104,11 +104,16 @@ $(document).ready(function() {
                 }
             },
             dropTo: function() {
-                console.log(Utils.dragNode.name, Utils.dropNode.name);
                 if (!Utils.dropNode.is_folder) {
                     toastr.warning('请将文件夹或者项目拖动到目标文件夹下');
                     return;
                 }
+                const parents = ProjectTree.getAllParents(Utils.dropNode);
+                const existParent = parents.find(x => { return x.id === Utils.dragNode.id; });
+                if (existParent) {
+                    toastr.error('请勿将文件夹移动到子文件夹下');
+                    return;
+                }
                 const posterity = ProjectTree.getPosterity(Utils.dragNode);
                 const maxLevelFolder = posterity.reduce((prev, cur) => { return cur.is_folder ? Math.max(cur.tree_level, prev) : prev; }, Utils.dragNode.tree_level);
                 const resultMaxLevelFolder = Utils.dropNode.tree_level + maxLevelFolder - Utils.dragNode.tree_level + 1;

+ 12 - 3
db_script/audit_order.js

@@ -44,12 +44,21 @@ const updateStageTimes = async function (stage, times) {
     for (const ad of auditData) {
         if (ad.audit_order) {
             if (filterIds.indexOf(ad.aid) < 0) filterIds.push(ad.aid);
-        } else if (auditIds.indexOf(ad.aid) < 0) auditIds.push(ad.aid);
+        } else {
+            const auditId = auditIds.find(x => { return x.aid === ad.aid});
+            if (auditId) {
+                auditId.ids.push(ad.id);
+            } else {
+                auditIds.push({ aid: ad.aid, ids: [ad.id] });
+            }
+        }
     }
     if (auditIds.length === 0) return;
     if (filterIds.length > 0 && auditIds.length > 0) errorStageTimes.push({ tid: stage.tid, sid: stage.id, times });
     for (const [i, aid] of auditIds.entries()) {
-        await querySql('UPDATE zh_stage_audit SET audit_order = ? WHERE sid = ? AND times = ? AND aid = ?', [i+1, stage.id, times, aid]);
+        for (const id of aid.ids) {
+            await querySql('UPDATE zh_stage_audit SET audit_order = ? WHERE id = ?', [i+1, id]);
+        }
     }
 };
 
@@ -61,7 +70,7 @@ const updateStage = async function (stage) {
 
 const doCompleteTest = async function(id) {
     try {
-        const tender = await querySql('Select * From zh_tender where id = ?', [id]);
+        const tender = await querySql('Select * From zh_tender where id > ?', [id]);
         for (const t of tender) {
             console.log(`Update Tender ${t.name}(${t.id}):`);
             await updateShenpi(t);