Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 years ago
parent
commit
b8c7ca06de

+ 35 - 0
app/controller/advance_controller.js

@@ -227,6 +227,41 @@ module.exports = app => {
         }
         }
 
 
         /**
         /**
+         * 删除期
+         * @param {*} ctx 全局上下文
+         */
+        async delete(ctx) {
+            try {
+                const data = JSON.parse(ctx.request.body.data);
+                const id = data && this.app._.toInteger(data.id);
+                if (isNaN(id) || id <= 0) {
+                    throw '参数错误';
+                }
+                const advance = await ctx.service.advance.getDataById(id);
+                if (!advance) {
+                    throw '参数错误';
+                }
+                // 检查权限等
+                if (advance.uid !== ctx.session.sessionUser.accountId) {
+                    throw '您无权删除';
+                }
+                if (advance.status !== auditConst.status.uncheck && advance.status !== auditConst.status.checkNo) {
+                    console.log(advance.status !== auditConst.status.uncheck);
+                    console.log(advance.status !== auditConst.status.checkNo);
+                    throw '当前不允许删除';
+                }
+                const isDeleted = await ctx.service.advance.deleteAdvance(id);
+                if (!isDeleted) {
+                    throw '删除失败,请重试';
+                }
+                ctx.body = { err: 0, msg: '' };
+            } catch (error) {
+                this.log(error);
+                ctx.body = { err: 1, msg: error.toString(), data: null };
+            }
+        }
+
+        /**
          * 添加审批人
          * 添加审批人
          * @param {Object} ctx 全局上下文
          * @param {Object} ctx 全局上下文
          */
          */

+ 12 - 7
app/controller/stage_controller.js

@@ -193,7 +193,7 @@ module.exports = app => {
                     attData[index].in_time = moment(attData[index].in_time * 1000).format('YYYY-MM-DD');
                     attData[index].in_time = moment(attData[index].in_time * 1000).format('YYYY-MM-DD');
                 }
                 }
                 renderData.attData = attData;
                 renderData.attData = attData;
-                renderData.coopwd = (ctx.stage.status === auditConst.status.uncheck && ctx.session.sessionUser.accountId === ctx.stage.user_id) || (ctx.stage.status === auditConst.status.checking && ctx.stage.curAuditor && ctx.stage.curAuditor.aid === ctx.session.sessionUser.accountId);
+                renderData.coopwd = ((ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === ctx.stage.user_id) || (ctx.stage.status === auditConst.status.checking && ctx.stage.curAuditor && ctx.stage.curAuditor.aid === ctx.session.sessionUser.accountId);
                 await this.layout('stage/index.ejs', renderData, 'stage/modal.ejs');
                 await this.layout('stage/index.ejs', renderData, 'stage/modal.ejs');
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
@@ -330,10 +330,15 @@ module.exports = app => {
                             responseData.data.tags = await ctx.service.ledgerTag.getDatas(ctx.tender.id, ctx.stage.id);
                             responseData.data.tags = await ctx.service.ledgerTag.getDatas(ctx.tender.id, ctx.stage.id);
                             break;
                             break;
                         case 'cooperation':
                         case 'cooperation':
-                            const uid = ctx.stage.curAuditor ? ctx.stage.curAuditor.aid : ctx.stage.status === auditConst.status.uncheck ? ctx.session.sessionUser.accountId : null;
+                            const uid = ctx.stage.curAuditor ?
+                                ctx.stage.curAuditor.aid :
+                                (ctx.stage.status === auditConst.status.uncheck ||
+                                (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id === ctx.session.sessionUser.accountId) ?
+                                    ctx.stage.user_id : (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id !== ctx.session.sessionUser.accountId) ?
+                                        ctx.session.sessionUser.accountId : null);
                             responseData.data.cooperation = uid !== null ? await ctx.service.ledgerCooperation.getValidData(
                             responseData.data.cooperation = uid !== null ? await ctx.service.ledgerCooperation.getValidData(
                                 ctx.tender.id, uid) : [];
                                 ctx.tender.id, uid) : [];
-                            responseData.data.cooperationPwd = uid !== null ? await ctx.service.cooperationPwd.getValidData(ctx.tender.id, uid) : [];
+                            // responseData.data.cooperationPwd = uid !== null ? await ctx.service.cooperationPwd.getValidData(ctx.tender.id, uid) : [];
                             const stageTimes = (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id !== ctx.session.sessionUser.accountId) ? ctx.stage.times - 1 : ctx.stage.times;
                             const stageTimes = (ctx.stage.status === auditConst.status.checkNo && ctx.stage.user_id !== ctx.session.sessionUser.accountId) ? ctx.stage.times - 1 : ctx.stage.times;
                             responseData.data.cooperationConfirm = uid !== null ? await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, stageTimes, uid) : [];
                             responseData.data.cooperationConfirm = uid !== null ? await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, stageTimes, uid) : [];
                             break;
                             break;
@@ -1830,10 +1835,10 @@ module.exports = app => {
                         await ctx.service.cooperationConfirm.del(data.postData);
                         await ctx.service.cooperationConfirm.del(data.postData);
                         responseData.data.cooperationConfirm = await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, ctx.stage.times, ctx.session.sessionUser.accountId);
                         responseData.data.cooperationConfirm = await ctx.service.cooperationConfirm.getValidData(ctx.tender.id, ctx.stage.id, ctx.stage.times, ctx.session.sessionUser.accountId);
                         break;
                         break;
-                    case 'save-pwd':
-                        const result = await ctx.service.cooperationPwd.save(data.postData);
-                        responseData.data.cooperationPwd = await ctx.service.cooperationPwd.getValidData(ctx.tender.id, ctx.session.sessionUser.accountId);
-                        break;
+                    // case 'save-pwd':
+                    //     const result = await ctx.service.cooperationPwd.save(data.postData);
+                    //     responseData.data.cooperationPwd = await ctx.service.cooperationPwd.getValidData(ctx.tender.id, ctx.session.sessionUser.accountId);
+                    //     break;
                     default:
                     default:
                         throw '参数有误';
                         throw '参数有误';
                 }
                 }

+ 12 - 0
app/public/js/advance.js

@@ -213,6 +213,18 @@ $(document).ready(function () {
             $('#audit-list').append(historyHTML)
             $('#audit-list').append(historyHTML)
         })
         })
     })
     })
+
+    $('a[data-target="#del-qi"').on('click', function () {
+      const id = $(this).data('id')
+      const order = $(this).data('order') //期数
+      $('#del-qi').find('.modal-body').children()[0].innerText = `确认删除「第${order}期」?`
+      $('#del-qi #del-confirm').click(function() {
+        postData(`${window.location.pathname}/delete`, {id}, (res) => {
+          console.log(res);
+          window.location.reload()
+        })
+      })
+    })
     function formatMoney(s, dot = ',', decimal = 2) {
     function formatMoney(s, dot = ',', decimal = 2) {
         if (!s) {
         if (!s) {
             s = 0;
             s = 0;

+ 18 - 1
app/public/js/change.js

@@ -274,7 +274,12 @@ $(document).ready(() => {
        if (status !== 0) {
        if (status !== 0) {
            url += '/status/'+ status;
            url += '/status/'+ status;
        }
        }
-       window.location.href = url + window.location.search;
+       let orderSetting = getLocalCache('change-'+ $('#tenderId').val() +'-list-order');
+       if (orderSetting) {
+           const orders = orderSetting.split('|');
+           url += '?sort=' + orders[0] + '&order=' + orders[1];
+       }
+       window.location.href = url;
     });
     });
     // 不再显示首次使用
     // 不再显示首次使用
     $('#changeFirst').click(function () {
     $('#changeFirst').click(function () {
@@ -302,16 +307,28 @@ $(document).ready(() => {
     } else {
     } else {
         $('#bpaixu').text('排序:变更令号');
         $('#bpaixu').text('排序:变更令号');
     }
     }
+    let sortSetting = getLocalCache('change-'+ $('#tenderId').val() +'-list-sort');
+    if (sortSetting && parseInt(sortSetting) === 1) {
+        $('#bpaixu').click();
+    }
+    $('#sort-dropdown').on('shown.bs.dropdown', function () {
+        setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
+    });
+    $('#sort-dropdown').on('hidden.bs.dropdown', function () {
+        setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 0);
+    });
 
 
     $('#sort-radio input[name="paizhi"]').click(function () {
     $('#sort-radio input[name="paizhi"]').click(function () {
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         const orderStr = $(this).val() + '|' + $('#order-radio input[name="paixu"]:checked').val();
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
+        setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
         const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
         const link = window.location.origin + window.location.pathname + '?sort='+ $(this).val() + '&order=' + $('#order-radio input[name="paixu"]:checked').val();
         window.location.href = link;
         window.location.href = link;
     });
     });
     $('#order-radio input[name="paixu"]').click(function () {
     $('#order-radio input[name="paixu"]').click(function () {
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         const orderStr = $('#sort-radio input[name="paizhi"]:checked').val() + '|' + $(this).val();
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
         setLocalCache('change-'+ $('#tenderId').val() +'-list-order', orderStr);
+        setLocalCache('change-'+ $('#tenderId').val() +'-list-sort', 1);
         const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
         const link = window.location.origin + window.location.pathname + '?sort='+ $('#sort-radio input[name="paizhi"]:checked').val() + '&order=' + $(this).val();
         window.location.href = link;
         window.location.href = link;
     })
     })

+ 24 - 22
app/public/js/path_tree.js

@@ -1167,12 +1167,14 @@ const createNewPathTree = function (type, setting) {
                 if (p) p.check = p.pwd === pwd;
                 if (p) p.check = p.pwd === pwd;
             }
             }
         }
         }
-        loadPwd(data, cacheKey) {
+        loadPwd(data, cacheKey, confirmList) {
             this.loadingPwd = true;
             this.loadingPwd = true;
             try {
             try {
                 this.pwdCacheKey = cacheKey;
                 this.pwdCacheKey = cacheKey;
+                this.confirmList = confirmList;
                 this.pwd = data;
                 this.pwd = data;
                 this._loadPwdCache();
                 this._loadPwdCache();
+                this._loadOnlineConfirm();
                 for (const p of this.pwd) {
                 for (const p of this.pwd) {
                     p.node = this.getItems(p.ledger_id);
                     p.node = this.getItems(p.ledger_id);
                     this.lockNode(p, !p.check);
                     this.lockNode(p, !p.check);
@@ -1206,22 +1208,22 @@ const createNewPathTree = function (type, setting) {
                 }
                 }
             }
             }
         }
         }
-        loadOnlinePwd(data, pwdList, confirmList) {
-            this.loadingPwd = true;
-            try {
-                this.pwdList = pwdList;
-                this.confirmList = confirmList;
-                this.pwd = data;
-                this._loadOnlinePwd();
-                this._loadOnlineConfirm();
-                // 旧数据上传,新数据补齐
-                for (const p of this.pwd) {
-                    p.node = this.getItems(p.ledger_id);
-                    this.lockNode(p, !p.check);
-                }
-            } catch(err) {}
-            this.loadingPwd = false;
-        }
+        // loadOnlinePwd(data, pwdList, confirmList) {
+        //     this.loadingPwd = true;
+        //     try {
+        //         this.pwdList = pwdList;
+        //         this.confirmList = confirmList;
+        //         this.pwd = data;
+        //         this._loadOnlinePwd();
+        //         this._loadOnlineConfirm();
+        //         // 旧数据上传,新数据补齐
+        //         for (const p of this.pwd) {
+        //             p.node = this.getItems(p.ledger_id);
+        //             this.lockNode(p, !p.check);
+        //         }
+        //     } catch(err) {}
+        //     this.loadingPwd = false;
+        // }
 
 
         getStageItems(id) {
         getStageItems(id) {
             return this.stageItems[itemsPre + id];
             return this.stageItems[itemsPre + id];
@@ -1411,7 +1413,7 @@ const createNewPathTree = function (type, setting) {
                 pn.lock = isLock;
                 pn.lock = isLock;
                 refresh.push(this.getNodeIndex(pn));
                 refresh.push(this.getNodeIndex(pn));
             }
             }
-            // if (!this.loadingPwd) this._savePwdCache();
+            if (!this.loadingPwd) this._savePwdCache();
             return refresh;
             return refresh;
         }
         }
     }
     }
@@ -1642,7 +1644,7 @@ const createNewPathTree = function (type, setting) {
                 this.loadCompareNode(source, c, cur, loadFun);
                 this.loadCompareNode(source, c, cur, loadFun);
             }
             }
         }
         }
-    
+
         generateSortNodes() {
         generateSortNodes() {
             const self = this;
             const self = this;
             const addSortNode = function (node) {
             const addSortNode = function (node) {
@@ -1656,13 +1658,13 @@ const createNewPathTree = function (type, setting) {
                 addSortNode(n);
                 addSortNode(n);
             }
             }
         }
         }
-    
+
         loadCompareTree(data, loadFun) {
         loadCompareTree(data, loadFun) {
             for (const c of data.billsTree.children) {
             for (const c of data.billsTree.children) {
                 this.loadCompareNode(data, c, null, loadFun);
                 this.loadCompareNode(data, c, null, loadFun);
             }
             }
         }
         }
-    
+
         calculateDiffer() {
         calculateDiffer() {
             if (this.setting.calcDiffer) {
             if (this.setting.calcDiffer) {
                 for (const d of this.datas) {
                 for (const d of this.datas) {
@@ -1670,7 +1672,7 @@ const createNewPathTree = function (type, setting) {
                 }
                 }
             }
             }
         }
         }
-    
+
         loadCompareData(data1, data2) {
         loadCompareData(data1, data2) {
             this.loadCompareTree(data1, this.setting.loadInfo1);
             this.loadCompareTree(data1, this.setting.loadInfo1);
             this.loadCompareTree(data2, this.setting.loadInfo2);
             this.loadCompareTree(data2, this.setting.loadInfo2);

+ 15 - 6
app/public/js/stage.js

@@ -335,7 +335,16 @@ $(document).ready(() => {
                 html.push('<td>', p.check ? `已解锁:${p.pwd}` : `<a name="ledger-unlock" lid="${p.ledger_id}" href="javascript: void(0);">解锁</a>`, '</td>');
                 html.push('<td>', p.check ? `已解锁:${p.pwd}` : `<a name="ledger-unlock" lid="${p.ledger_id}" href="javascript: void(0);">解锁</a>`, '</td>');
             }
             }
             html.push('<td>', p.company, '</td>');
             html.push('<td>', p.company, '</td>');
-            html.push('<td>', p.check ? (p.confirm ? (moment(p.confirm_time).format('YYYY-MM-DD HH:mm') + ' ' + (coopwd ? `<a name="ledger-unconfirm" href="javascript: void(0);" lid="${p.ledger_id}">重新审批</a>` : '')) : `<a name="ledger-confirm" href="javascript: void(0);" lid="${p.ledger_id}" class="btn btn-sm btn-success">确认</a>`) : '' ,'</td>');
+            if (p.check && p.confirm) {
+                html.push('<td>', moment(p.confirm_time).format('YYYY-MM-DD HH:mm') + ' ' + (coopwd ? `<a name="ledger-unconfirm" href="javascript: void(0);" lid="${p.ledger_id}">重新审批</a>` : ''), '</td>');
+            } else if (!p.check && p.confirm) {
+                html.push('<td>', moment(p.confirm_time).format('YYYY-MM-DD HH:mm'), '</td>');
+            } else if (p.check && !p.confirm) {
+                html.push('<td>', `<a name="ledger-confirm" href="javascript: void(0);" lid="${p.ledger_id}" class="btn btn-sm btn-success">确认</a>`, '</td>');
+            } else {
+                html.push('<td>', '</td>');
+            }
+            // html.push('<td>', p.check ? (p.confirm ? (moment(p.confirm_time).format('YYYY-MM-DD HH:mm') + ' ' + (coopwd ? `<a name="ledger-unconfirm" href="javascript: void(0);" lid="${p.ledger_id}">重新审批</a>` : '')) : `<a name="ledger-confirm" href="javascript: void(0);" lid="${p.ledger_id}" class="btn btn-sm btn-success">确认</a>`) : '' ,'</td>');
             html.push('</tr>');
             html.push('</tr>');
         }
         }
         $('#cooperationList').html(html.join(''));
         $('#cooperationList').html(html.join(''));
@@ -1946,8 +1955,8 @@ $(document).ready(() => {
         treeCalc.calculateAll(stageTree);
         treeCalc.calculateAll(stageTree);
         // 加载解锁相关
         // 加载解锁相关
         if (result.cooperation) {
         if (result.cooperation) {
-            // stageTree.loadPwd(result.cooperation, 'bills-p-' + userID + '-' + window.location.pathname.split('/')[2]);
-            stageTree.loadOnlinePwd(result.cooperation, result.cooperationPwd, result.cooperationConfirm);
+            stageTree.loadPwd(result.cooperation, 'bills-p-' + userID + '-' + window.location.pathname.split('/')[2], result.cooperationConfirm);
+            // stageTree.loadOnlinePwd(result.cooperation, result.cooperationPwd, result.cooperationConfirm);
             $('#cooperationCount').html(stageTree.pwd.length || '');
             $('#cooperationCount').html(stageTree.pwd.length || '');
             if (stageTree.pwd.length > 0) $('#cooperationCount').parent().show();
             if (stageTree.pwd.length > 0) $('#cooperationCount').parent().show();
             setCooperationSelectHtml();
             setCooperationSelectHtml();
@@ -4112,9 +4121,9 @@ $(document).ready(() => {
         if (p.pwd === $('#unlock-pwd').val()) {
         if (p.pwd === $('#unlock-pwd').val()) {
             const refresh = stageTree.lockNode(p, false);
             const refresh = stageTree.lockNode(p, false);
             // 修改线上
             // 修改线上
-            postData(window.location.pathname + '/save/cooperation', { type: 'save-pwd', postData: { ledger_id: lid, pwd: $('#unlock-pwd').val() } }, function (result) {
-                stageTree.pwdList = result.cooperationPwd;
-            });
+            // postData(window.location.pathname + '/save/cooperation', { type: 'save-pwd', postData: { ledger_id: lid, pwd: $('#unlock-pwd').val() } }, function (result) {
+            //     stageTree.pwdList = result.cooperationPwd;
+            // });
             SpreadJsObj.reloadRowsReadonly(slSpread.getActiveSheet(), refresh);
             SpreadJsObj.reloadRowsReadonly(slSpread.getActiveSheet(), refresh);
             stagePosSpreadObj.loadCurPosData();
             stagePosSpreadObj.loadCurPosData();
             $('#unlock').modal('hide');
             $('#unlock').modal('hide');

+ 1 - 0
app/router.js

@@ -133,6 +133,7 @@ module.exports = app => {
     app.get('/tender/:id/advance', sessionAuth, tenderCheck, 'advanceController.index');
     app.get('/tender/:id/advance', sessionAuth, tenderCheck, 'advanceController.index');
     app.get('/tender/:id/advance/material', sessionAuth, tenderCheck, 'advanceController.materialList');
     app.get('/tender/:id/advance/material', sessionAuth, tenderCheck, 'advanceController.materialList');
     app.post('/tender/:id/advance/create', sessionAuth, tenderCheck, 'advanceController.create');
     app.post('/tender/:id/advance/create', sessionAuth, tenderCheck, 'advanceController.create');
+    app.post('/tender/:id/advance/delete', sessionAuth, tenderCheck, 'advanceController.delete');
     app.get('/tender/:id/advance/:order/detail', sessionAuth, tenderCheck, advanceCheck, 'advanceController.detail');
     app.get('/tender/:id/advance/:order/detail', sessionAuth, tenderCheck, advanceCheck, 'advanceController.detail');
     app.post('/tender/:id/advance/:type/create', sessionAuth, tenderCheck, 'advanceController.create');
     app.post('/tender/:id/advance/:type/create', sessionAuth, tenderCheck, 'advanceController.create');
     app.post('/tender/:id/advance/:order/audit/add', sessionAuth, tenderCheck, advanceCheck, 'advanceController.addAudit');
     app.post('/tender/:id/advance/:order/audit/add', sessionAuth, tenderCheck, advanceCheck, 'advanceController.addAudit');

+ 7 - 0
app/service/advance.js

@@ -200,7 +200,14 @@ module.exports = app => {
             return await this.update(payload, {
             return await this.update(payload, {
                 id,
                 id,
             });
             });
+        }
 
 
+        /**
+         * 删除预付款记录
+         * @param {String} id 预付款id
+         */
+        async deleteAdvance(id) {
+            return await this.deleteById(id);
         }
         }
     }
     }
     return Advance;
     return Advance;

+ 2 - 0
app/service/ledger_cooperation.js

@@ -34,12 +34,14 @@ module.exports = app => {
                 const result = await this.db.insert(this.tableName, data);
                 const result = await this.db.insert(this.tableName, data);
                 data.id = result.insertId;
                 data.id = result.insertId;
                 data.sign_path = null;
                 data.sign_path = null;
+                data.company = '';
                 data.status = 1;
                 data.status = 1;
                 // }
                 // }
             } else if (data.pwd !== '' && info) {
             } else if (data.pwd !== '' && info) {
                 data.id = info.id;
                 data.id = info.id;
                 await this.db.update(this.tableName, data);
                 await this.db.update(this.tableName, data);
                 data.sign_path = info.sign_path;
                 data.sign_path = info.sign_path;
+                data.company = info.company;
             }
             }
             return data;
             return data;
         }
         }

+ 2 - 1
app/view/advance/index.ejs

@@ -52,7 +52,7 @@
                             <th class="text-center" width="15%">截止本期金额</th>
                             <th class="text-center" width="15%">截止本期金额</th>
                             <th class="text-center">附件</th>
                             <th class="text-center">附件</th>
                             <th class="text-center">进度</th>
                             <th class="text-center">进度</th>
-                            <th class="text-center" width="100">操作</th>
+                            <th class="text-center" width="150">操作</th>
                         </tr>
                         </tr>
                     </thead>
                     </thead>
                     <tbody id="advanceList">
                     <tbody id="advanceList">
@@ -76,6 +76,7 @@
                                 <td>
                                 <td>
                                     <% if((item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo) && item.uid === ctx.session.sessionUser.accountId) { %>
                                     <% if((item.status === auditConst.status.uncheck || item.status === auditConst.status.checkNo) && item.uid === ctx.session.sessionUser.accountId) { %>
                                         <a href="/tender/<%- ctx.tender.id %>/advance/<%- item.id %>/detail" class="btn btn-primary btn-sm">编辑</a>
                                         <a href="/tender/<%- ctx.tender.id %>/advance/<%- item.id %>/detail" class="btn btn-primary btn-sm">编辑</a>
+                                        <a href="del-qi" class="btn btn-outline-danger btn-sm ml-1" data-toggle="modal" data-target="#del-qi" data-id="<%- item.id %>" data-order="<%- item.order %>">删除</a>
                                     <% } else if(item.status === auditConst.status.checking && item.curAuditor.audit_id === ctx.session.sessionUser.accountId) {%>
                                     <% } else if(item.status === auditConst.status.checking && item.curAuditor.audit_id === ctx.session.sessionUser.accountId) {%>
                                         <a href="/tender/<%- ctx.tender.id %>/advance/<%- item.id %>/detail" class="btn btn-success btn-sm">审批</a>
                                         <a href="/tender/<%- ctx.tender.id %>/advance/<%- item.id %>/detail" class="btn btn-success btn-sm">审批</a>
                                     <% } else {%>
                                     <% } else {%>

+ 17 - 0
app/view/advance/modal.ejs

@@ -60,6 +60,23 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
+<div class="modal fade" id="del-qi" data-backdrop="static">
+  <div class="modal-dialog" role="document">
+      <div class="modal-content">
+          <div class="modal-header">
+              <h5 class="modal-title">删除期</h5>
+          </div>
+          <div class="modal-body">
+            <h6>确认删除「第3期」?</h6>
+            <h6>删除后,数据无法恢复,请谨慎操作。</h6>
+          </div>
+          <div class="modal-footer">
+            <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+            <button type="button" class="btn btn-danger" id="del-confirm">确定删除</button>
+          </div>
+      </div>
+  </div>
+</div>
 <script>
 <script>
     // 展开历史审核记录
     // 展开历史审核记录
     $('#audit-list').on('click', 'a', function() {
     $('#audit-list').on('click', 'a', function() {

+ 1 - 1
app/view/change/index.ejs

@@ -5,7 +5,7 @@
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <div>
             <div>
                 <div class="d-inline-block">
                 <div class="d-inline-block">
-                    <div class="btn-group">
+                    <div class="btn-group" id="sort-dropdown">
                         <button type="button" class="btn btn-sm btn-light text-primary dropdown-toggle" data-toggle="dropdown" id="bpaixu">排序:创建时间</button>
                         <button type="button" class="btn btn-sm btn-light text-primary dropdown-toggle" data-toggle="dropdown" id="bpaixu">排序:创建时间</button>
                         <div class="dropdown-menu" aria-labelledby="bpaixu">
                         <div class="dropdown-menu" aria-labelledby="bpaixu">
                             <ul class="list-unstyled px-3 mb-0" id="sort-radio">
                             <ul class="list-unstyled px-3 mb-0" id="sort-radio">

+ 5 - 5
app/view/material/list.ejs

@@ -64,12 +64,12 @@
 <script>
 <script>
     const materialType = JSON.parse('<%- materialType %>');
     const materialType = JSON.parse('<%- materialType %>');
     const materialBillsData = JSON.parse(unescape('<%- escape(JSON.stringify(materialBillsData)) %>'));
     const materialBillsData = JSON.parse(unescape('<%- escape(JSON.stringify(materialBillsData)) %>'));
-    let materialListData = JSON.parse('<%- JSON.stringify(materialListData) %>');
+    let materialListData = JSON.parse(unescape('<%- escape(JSON.stringify(materialListData)) %>'));
     const notJoinList = JSON.parse('<%- JSON.stringify(materialNotJoinListData) %>');
     const notJoinList = JSON.parse('<%- JSON.stringify(materialNotJoinListData) %>');
-    const ledger = JSON.parse('<%- JSON.stringify(ledger) %>');
-    const curLedgerData = JSON.parse('<%- JSON.stringify(curLedgerData) %>');
-    const pos = JSON.parse('<%- JSON.stringify(pos) %>');
-    const curPosData = JSON.parse('<%- JSON.stringify(curPosData) %>');
+    const ledger = JSON.parse(unescape('<%- escape(JSON.stringify(ledger)) %>'));
+    const curLedgerData = JSON.parse(unescape('<%- escape(JSON.stringify(curLedgerData)) %>'));
+    const pos = JSON.parse(unescape('<%- escape(JSON.stringify(pos)) %>'));
+    const curPosData = JSON.parse(unescape('<%- escape(JSON.stringify(curPosData)) %>'));
     const readOnly = <%- material.readOnly %>;
     const readOnly = <%- material.readOnly %>;
     const stage_order = <%- material.order %>;
     const stage_order = <%- material.order %>;
 </script>
 </script>

+ 1 - 1
app/view/tender/shenpi_modal.ejs

@@ -98,7 +98,7 @@
                 <div class="row">
                 <div class="row">
                     <div class="col-6">
                     <div class="col-6">
                         <% const yb = ctx.helper._.find(accountList, { id: ctx.tender.data.user_id }) %>
                         <% const yb = ctx.helper._.find(accountList, { id: ctx.tender.data.user_id }) %>
-                        <div class="modal-height-500">
+                        <div class="modal-height-500" style="overflow: auto;">
                             <table class="table table-hover table-bordered">
                             <table class="table table-hover table-bordered">
                                 <thead>
                                 <thead>
                                 <tr><th colspan="4" class="text-center" id="stage_audit"><%- yb.name %>(原报)</th></tr>
                                 <tr><th colspan="4" class="text-center" id="stage_audit"><%- yb.name %>(原报)</th></tr>

+ 27 - 14
sql/update.sql

@@ -1,28 +1,39 @@
-ALTER TABLE `zh_project_account` ADD `wx_unionid` VARCHAR(50) NULL COMMENT '微信绑定unionid(同一个开放平台共用)' AFTER `wx_openid`;
+ALTER TABLE `zh_ledger_cooperation` ADD `company` VARCHAR(100) NULL DEFAULT '' COMMENT '单位或备注名,筛选用' AFTER `sign_path`;
 
 
 --
 --
+-- 表的结构 `zh_cooperation_confirm`
 --
 --
-CREATE TABLE `calculation`.`zh_rpt_archive` (
-  `archive_id` INT NOT NULL,
-  `prj_id` INT NULL,
-  `stage_id` INT NULL,
-  `content` VARCHAR(4000) NULL,
-  PRIMARY KEY (`archive_id`),
-  INDEX `PRJ_STG` (`prj_id` ASC, `stage_id` ASC))
-COMMENT = '报表归档表;\n只考虑项目id及期id,其他信息全部归入content';
 
 
-ALTER TABLE `zh_project`
-ADD COLUMN `fun_rela`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '功能设置(json.stringify)' AFTER `rpt_nature`;
+CREATE TABLE `zh_cooperation_confirm` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tid` int(11) NOT NULL COMMENT '标段id',
+  `sid` int(11) NOT NULL COMMENT '期id',
+  `times` tinyint(11) NOT NULL COMMENT '次数',
+  `ledger_id` int(11) NOT NULL COMMENT '台账id',
+  `uid` int(11) NOT NULL COMMENT '审批人id',
+  `create_time` datetime DEFAULT NULL COMMENT '确认时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='多人协同确认表';
 
 
+--
+-- 表的结构 `zh_cooperation_pwd`
+--
+
+CREATE TABLE `zh_cooperation_pwd` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tid` int(11) NOT NULL COMMENT '标段id',
+  `ledger_id` int(11) NOT NULL COMMENT '台账id',
+  `uid` int(11) NOT NULL COMMENT '审批人id',
+  `pwd` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT '密码',
+  `create_time` datetime DEFAULT NULL COMMENT '解锁时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='多人协同密码解锁表';
 
 
-ALTER TABLE `zh_ledger_cooperation` ADD `company` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '单位或备注名,筛选用' AFTER `sign_path`;
 
 
-ALTER TABLE `zh_advance_audit` 
+ALTER TABLE `zh_advance_audit`
 CHANGE COLUMN `type` `type` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '预付款类型,0为开工预付款,1为材料预付款,2为安全生产费预付款' ;
 CHANGE COLUMN `type` `type` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '预付款类型,0为开工预付款,1为材料预付款,2为安全生产费预付款' ;
 
 
-ALTER TABLE `zh_advance_pay` 
+ALTER TABLE `zh_advance_pay`
 CHANGE COLUMN `type` `type` INT(1) NOT NULL DEFAULT '0' COMMENT '预付款类型,0为开工预付款,1为材料预付款,2位安全生产费预付款' ;
 CHANGE COLUMN `type` `type` INT(1) NOT NULL DEFAULT '0' COMMENT '预付款类型,0为开工预付款,1为材料预付款,2位安全生产费预付款' ;
 
 
 -- 接口相关
 -- 接口相关

+ 17 - 0
sql/update20210420.sql

@@ -0,0 +1,17 @@
+ALTER TABLE `zh_project_account` ADD `wx_unionid` VARCHAR(50) NULL COMMENT '微信绑定unionid(同一个开放平台共用)' AFTER `wx_openid`;
+
+--
+-- 报表归档表
+--
+CREATE TABLE `calculation`.`zh_rpt_archive` (
+  `archive_id` INT NOT NULL,
+  `prj_id` INT NULL,
+  `stage_id` INT NULL,
+  `content` VARCHAR(4000) NULL,
+  PRIMARY KEY (`archive_id`),
+  INDEX `PRJ_STG` (`prj_id` ASC, `stage_id` ASC))
+COMMENT = '报表归档表;\n只考虑项目id及期id,其他信息全部归入content';
+
+-- 项目设置-功能设置
+ALTER TABLE `zh_project`
+ADD COLUMN `fun_rela`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '功能设置(json.stringify)' AFTER `rpt_nature`;