Browse Source

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

TonyKang 5 years atrás
parent
commit
ccaba200a4

+ 0 - 5
app/const/deal_pay.js

@@ -14,11 +14,6 @@ const payType = {
     sf: 3,
     wc: 4
 };
-const paySubType = {
-    normal: {value: 1, name: '常规'},
-    award: {value: 2, name: '奖罚金'},
-    supply: {value: 3, title: '甲供材料'},
-};
 
 const payTemplate = [
     {order: 1, name: '本期应付', ptype: payType.yf, minus: false, expr: null, sexpr: null, rexpr: null},

+ 8 - 1
app/lib/analysis_excel.js

@@ -60,14 +60,18 @@ class ImportBaseTree {
      * @private
      */
     _loadTemplateTree(data) {
+        let loadCodeNodes = true;
         for (const node of data) {
             node.ledger_id = node.template_id;
             node.ledger_pid = node.pid;
             node.id = this.ctx.app.uuid.v4();
             delete node.pid;
-            if (node.code) {
+            if (node.code && loadCodeNodes) {
                 this.codeNodes[node.code] = node;
             }
+            if (node.code === '3') {
+                loadCodeNodes = false;
+            }
             this.items.push(node);
             if (node.ledger_pid === -1) {
                 this.roots.push(node);
@@ -228,6 +232,9 @@ class ImportBaseTree {
             const numB = _.toNumber(codeB[codeB.length -1]);
             return numA - numB;
         });
+        for (const [i, c] of firstPart.children.entries()) {
+            c.order = i + 1;
+        }
     }
 
     calculateLeafWithPos () {

+ 1 - 1
app/lib/pay_calc.js

@@ -17,7 +17,7 @@ class PayCalculate {
     constructor (ctx, stage, tenderInfo) {
         this.ctx = ctx;
         this.stage = stage;
-        this.percentReg = /((\d?)|((\d+)(\.\d+)))%/g;
+        this.percentReg = /((\d+)|((\d+)(\.\d+)))%/g;
         this.tenderInfo = tenderInfo;
         this.decimal = tenderInfo.decimal.pay ? tenderInfo.decimal.payTp : tenderInfo.decimal.tp;
         /* 以下变量在调用calculate方法后获得

+ 5 - 0
app/middleware/session_auth.js

@@ -29,6 +29,11 @@ module.exports = options => {
                 throw 'session数据错误';
             }
 
+            // 获取用户新建标段权利
+            const accountInfo = yield this.service.projectAccount.getDataById(this.session.sessionUser.accountId);
+            this.session.sessionUser.permission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
+
+
             // 同步消息
             yield this.service.notify.syncNotifyData();
         } catch (error) {

+ 2 - 1
app/middleware/stage_check.js

@@ -56,6 +56,7 @@ module.exports = options => {
             // 权限相关
             // todo 校验权限 (标段参与人、分享)
             const accountId = this.session.sessionUser.accountId, auditorIds = _.map(stage.auditors, 'aid'), shareIds = [];
+            const permission = this.session.sessionUser.permission;
             if (accountId === stage.user_id) { // 原报
                 if (stage.curAuditor) {
                     stage.readOnly = stage.curAuditor.aid !== accountId;
@@ -86,7 +87,7 @@ module.exports = options => {
                     stage.curOrder = accountId === stage.curAuditor.aid ? stage.curAuditor.order : stage.curAuditor.order - 1;
                 }
                 stage.readOnly = (stage.status !== status.checking && stage.status !== status.checkNoPre) || accountId !== stage.curAuditor.aid;
-            } else if (shareIds.indexOf(accountId) !== -1) { // 分享人
+            } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人
                 if (stage.status === status.uncheck) {
                     throw '您无权查看该数据';
                 }

+ 2 - 1
app/public/js/change_set.js

@@ -97,6 +97,7 @@ $(document).ready(() => {
     // }
     $('#table-list-select').html(listHtml);
     tableDataRemake(changeListData);
+    maketablelist();
 
     // 上报时按钮点击
     $('a[data-target="#sub-ap"]').on('click', function () {
@@ -606,7 +607,7 @@ function tableDataRemake(changeListData) {
                 // 针对旧数据获取清单信息
                 listinfo = changeListData[clinfo[8] - 1];
                 if (listinfo === undefined) {
-                    toastr.warning('台账清单列表已不存在'+ clinfo[0] +',请手动删除,并重新添加修订后的清单');
+                    toastr.warning('台账清单列表已不存在'+ clinfo[0] +',已更新变更清单列表');
                     changeList.splice(index, 1);
                     continue;
                 }

+ 80 - 43
app/public/js/global.js

@@ -227,7 +227,7 @@ const postDataWithFile = function (url, formData, successCallback, errorCallBack
         type:"POST",
         url: url,
         data: formData,
-        dataType: 'json',
+        dataType: 'json', 
         cache: false,
         // 告诉jQuery不要去设置Content-Type请求头
         contentType: false,
@@ -300,51 +300,88 @@ function closeWaitingView() {
         if(msgDiv != null){
             document.body.removeChild(msgDiv);
         }
-    }, Math.max(beginWaitingTime - time + 1000, 0));
+    }, Math.max(beginWaitingTime - time + 500, 0));
 }
 //显示等待窗口
 function showWaitingView() {
-    bShowWaiting = true;
-    setTimeout(function () {
-        if (!bShowWaiting) return;
-        beginWaitingTime = parseInt(new Date());
-        var msgw = 300; //提示窗口的宽度
-        var msgh = 100; //提示窗口的高度
-
-        var sWidth, sHeight;
-        sWidth = document.body.clientWidth;
-        sHeight = document.body.clientHeight;
-
-        //背景遮罩层div
-        var bgObj = document.createElement("div");
-        bgObj.setAttribute('id', 'bgDiv');
-        bgObj.style.zIndex = '9998';
-        bgObj.style.position = "absolute";
-        bgObj.style.top = "0px";
-        bgObj.style.background = "#888";
-        bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
-        bgObj.style.opacity = "0.6";
-        bgObj.style.left = "0px";
-        bgObj.style.width = sWidth + "px";
-        bgObj.style.height = sHeight + "px";
-        document.body.appendChild(bgObj);
-
-        //信息提示层div
-        var msgObj = document.createElement("div");
-        msgObj.style.zIndex = '9999';
-        msgObj.setAttribute("id", "msgDiv");
-        msgObj.setAttribute("align", "center");
-        msgObj.style.position = "absolute";
-        msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
-        msgObj.style.width = msgw + "px";
-        msgObj.style.height = msgh + "px";
-        msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
-        msgObj.style.left = (sWidth - msgw) / 2 + "px";
-        document.body.appendChild(msgObj);
-
-        //中间等待图标
-        document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
-    }, 1000);
+    // bShowWaiting = true;
+    // setTimeout(function () {
+    //     if (!bShowWaiting) return;
+    //     beginWaitingTime = parseInt(new Date());
+    //     var msgw = 300; //提示窗口的宽度
+    //     var msgh = 100; //提示窗口的高度
+    //
+    //     var sWidth, sHeight;
+    //     sWidth = document.body.clientWidth;
+    //     sHeight = document.body.clientHeight;
+    //
+    //     //背景遮罩层div
+    //     var bgObj = document.createElement("div");
+    //     bgObj.setAttribute('id', 'bgDiv');
+    //     bgObj.style.zIndex = '9998';
+    //     bgObj.style.position = "absolute";
+    //     bgObj.style.top = "0px";
+    //     bgObj.style.background = "#888";
+    //     bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
+    //     bgObj.style.opacity = "0.6";
+    //     bgObj.style.left = "0px";
+    //     bgObj.style.width = sWidth + "px";
+    //     bgObj.style.height = sHeight + "px";
+    //     document.body.appendChild(bgObj);
+    //
+    //     //信息提示层div
+    //     var msgObj = document.createElement("div");
+    //     msgObj.style.zIndex = '9999';
+    //     msgObj.setAttribute("id", "msgDiv");
+    //     msgObj.setAttribute("align", "center");
+    //     msgObj.style.position = "absolute";
+    //     msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
+    //     msgObj.style.width = msgw + "px";
+    //     msgObj.style.height = msgh + "px";
+    //     msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
+    //     msgObj.style.left = (sWidth - msgw) / 2 + "px";
+    //     document.body.appendChild(msgObj);
+    //
+    //     //中间等待图标
+    //     document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
+    // }, 1000);
+    beginWaitingTime = parseInt(new Date());
+    var msgw = 300; //提示窗口的宽度
+    var msgh = 100; //提示窗口的高度
+
+    var sWidth, sHeight;
+    sWidth = document.body.clientWidth;
+    sHeight = document.body.clientHeight;
+
+    //背景遮罩层div
+    var bgObj = document.createElement("div");
+    bgObj.setAttribute('id', 'bgDiv');
+    bgObj.style.zIndex = '9998';
+    bgObj.style.position = "absolute";
+    bgObj.style.top = "0px";
+    // bgObj.style.background = "#888";
+    bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
+    bgObj.style.opacity = "0.6";
+    bgObj.style.left = "0px";
+    bgObj.style.width = sWidth + "px";
+    bgObj.style.height = sHeight + "px";
+    document.body.appendChild(bgObj);
+
+    //信息提示层div
+    var msgObj = document.createElement("div");
+    msgObj.style.zIndex = '9999';
+    msgObj.setAttribute("id", "msgDiv");
+    msgObj.setAttribute("align", "center");
+    msgObj.style.position = "absolute";
+    msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
+    msgObj.style.width = msgw + "px";
+    msgObj.style.height = msgh + "px";
+    msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
+    msgObj.style.left = (sWidth - msgw) / 2 + "px";
+    document.body.appendChild(msgObj);
+
+    //中间等待图标
+    document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
 }
 
 let progressInterval;

+ 1 - 1
app/public/js/ledger.js

@@ -1340,7 +1340,7 @@ $(document).ready(function() {
                 const posData = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
                 const col = info.sheet.zh_setting.cols[info.col];
                 const orgText = posData ? posData[col.field] : null;
-                const newText = trimInvalidChar(info.sheet.getCell(info.row, info.col).text());
+                const newText = trimInvalidChar(info.editingText);
                 if (orgText === newText || ((!orgText || orgText === '') && (newText === ''))) {
                     return;
                 }

+ 1 - 1
app/public/js/revise.js

@@ -1028,7 +1028,7 @@ $(document).ready(() => {
             const posData = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
             const col = info.sheet.zh_setting.cols[info.col];
             const orgText = posData ? posData[col.field] : null;
-            const newText = trimInvalidChar(info.sheet.getCell(info.row, info.col).text());
+            const newText = trimInvalidChar(info.editingText);
             if (orgText === newText || ((!orgText || orgText === '') && (newText === ''))) return;
 
             const node = posSpreadObj.billsNode;

+ 1 - 0
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -215,6 +215,7 @@ const SpreadJsObj = {
      */
     safeRightClickSelection: function (obj, e, spread) {
         const sheet = spread.getActiveSheet();
+        if (sheet.isEditing()) sheet.endEdit(true);
         const selections = sheet.getSelections(), target = this.getHitTest(obj, e, sheet), range = this.getTargetSelection(sheet, target);
         if (!this.checkTargetInSelection(selections, range)) {
             sheet.setSelection(range.row, range.col, range.rowCount, range.colCount);

+ 1 - 1
app/public/js/stage.js

@@ -897,7 +897,7 @@ $(document).ready(() => {
                 };
 
                 if (col.field === 'is_tp') {
-                    if (info.sheet.isEditing) {
+                    if (info.sheet.isEditing()) {
                         info.sheet.endEdit(true);
                     }
 

+ 1 - 1
app/public/js/stage_pay.js

@@ -658,7 +658,7 @@ $(document).ready(() => {
                     return;
                 }
                 if (col.field === 'minus') {
-                    if (info.sheet.isEditing) {
+                    if (info.sheet.isEditing()) {
                         info.sheet.endEdit(true);
                     }
                     // 获取更新数据

+ 2 - 2
app/service/ledger_revise.js

@@ -87,10 +87,10 @@ module.exports = app => {
             const sql = 'Insert Into ' + this.ctx.service.reviseBills.tableName +
                 '  (id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
-                '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id)' +
+                '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp)' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
-                '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id' +
+                '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp' +
                 '  From ' + this.ctx.service.ledger.tableName +
                 '  Where `tender_id` = ?';
             const sqlParam = [tid];

+ 2 - 2
app/service/revise_audit.js

@@ -226,10 +226,10 @@ module.exports = app => {
             const bSql = 'Insert Into ' + this.ctx.service.ledger.tableName +
                 '  (id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
-                '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id)' +
+                '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp)' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
-                '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id' +
+                '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp' +
                 '  From ' + this.ctx.service.reviseBills.tableName +
                 '  Where `tender_id` = ?';
             await transaction.query(bSql, sqlParam);

+ 2 - 1
app/service/stage.js

@@ -35,6 +35,7 @@ module.exports = app => {
                 stage.curAuditor = await this.ctx.service.stageAudit.getCurAuditor(stage.id, stage.times);
 
                 const accountId = this.ctx.session.sessionUser.accountId, auditorIds = this._.map(stage.auditors, 'aid'), shareIds = [];
+                const permission = this.ctx.session.sessionUser.permission;
                 if (accountId === stage.user_id) { // 原报
                     if (stage.curAuditor) {
                         stage.readOnly = stage.curAuditor.aid !== accountId;
@@ -65,7 +66,7 @@ module.exports = app => {
                         stage.curOrder = accountId === stage.curAuditor.aid ? stage.curAuditor.order : stage.curAuditor.order - 1;
                     }
                     stage.readOnly = (stage.status !== status.checking && stage.status !== status.checkNoPre) || accountId !== stage.curAuditor.aid;
-                } else if (shareIds.indexOf(accountId) !== -1) { // 分享人
+                } else if (shareIds.indexOf(accountId) !== -1 || (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1)) { // 分享人
                     if (stage.status === status.uncheck) {
                         throw '您无权查看该数据';
                     }