Browse Source

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

TonyKang 5 years ago
parent
commit
5273e0a078

+ 20 - 12
app/controller/report_controller.js

@@ -638,11 +638,11 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
     try {
         const rptPageRstArray = [];
         // 1. 这里只用一份数据,根据实际应用情况,先备份
-        const backupData = {};
-        for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
-            backupData[filterTables[filterIdx]] = [];
-            Object.assign(backupData[filterTables[filterIdx]], rawDataObj[filterTables[filterIdx]]);
-        }
+        // const backupData = {};
+        // for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
+        //     backupData[filterTables[filterIdx]] = [];
+        //     Object.assign(backupData[filterTables[filterIdx]], rawDataObj[filterTables[filterIdx]]);
+        // }
         // 2. 一个一个模板创建数据
         // let defProperties = await ctx.service.rptPreDefineCfg.getCfgById('Administrator');
         // defProperties = JSON.parse(defProperties[0].defined_content);
@@ -651,7 +651,15 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             const rptTpl = (rptTpls[tplIdx]._doc) ? rptTpls[tplIdx]._doc : rptTpls[tplIdx];
             rptDataUtil.initialize(rptTpl);
             const customSelect = await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id);
-            const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, null, customSelect);
+
+            // 从汇总的rawDataObj中拷贝所需数据表至curRawDataObj,以供后续使用
+            const curRawDataObj = {};
+            const filter = rptDataUtil.getDataRequestFilter();
+            for (const table of filter.tables) {
+                curRawDataObj[table] = ctx.helper.clone(rawDataObj[table]);
+            }
+
+            const tplData = rptDataUtil.assembleData(ctx, curRawDataObj, baseDir, null, customSelect);
             const printCom = JpcEx.createNew();
             rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = params.pageSize;
 
@@ -673,12 +681,12 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             }
             rptPageRstArray.push(pageRst);
             // 注意:这里需要把备份数据assign回去!!!
-            if (tplIdx < rptTpls.length - 1) {
-                for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
-                    backupData[filterTables[filterIdx]] = [];
-                    Object.assign(rawDataObj[filterTables[filterIdx]], backupData[filterTables[filterIdx]]);
-                }
-            }
+            // if (tplIdx < rptTpls.length - 1) {
+            //     for (let filterIdx = 0; filterIdx < filterTables.length; filterIdx++) {
+            //         backupData[filterTables[filterIdx]] = [];
+            //         Object.assign(rawDataObj[filterTables[filterIdx]], backupData[filterTables[filterIdx]]);
+            //     }
+            // }
         }
         return rptPageRstArray;
     } catch (ex) {

+ 14 - 0
app/extend/helper.js

@@ -941,4 +941,18 @@ module.exports = {
             this.ctx.debugInfo.other.push(data);
         }
     },
+
+    /**
+     * 深拷贝
+     * @param obj
+     * @returns {*}
+     */
+    clone: function (obj) {
+        if (obj === null) return null;
+        var o = obj instanceof Array ? [] : {};
+        for (var i in obj) {
+            o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? this.clone(obj[i]) : obj[i]);
+        }
+        return o;
+    },
 };

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

@@ -100,7 +100,7 @@ $(document).ready(() => {
         cols: [
             {title: '项目节|编号', colSpan: '2|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
             {title: '|项目节名称', colSpan: '|1', rowSpan: '|1', field: 'jldy', hAlign: 0, width: 100, formatter: '@'},
-            {title: '部位明细|部位明细', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
+            {title: '计量单元|计量单元', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
             {title: '|复核数量', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 0, width: 80, type: 'Number'},
             {title: '部位信息|单位工程', colSpan: '3|1', rowSpan: '1|1', field: 'dwgc', hAlign: 0, width: 100, formatter: '@'},
             {title: '|分部工程', colSpan: '|1', rowSpan: '|1', field: 'fbgc', hAlign: 0, width: 100, formatter: '@'},
@@ -430,7 +430,7 @@ $(document).ready(() => {
             }
             // 判断需要应用调差工料的清单明细
             const needAddList = [];
-            const gather_qty = [];
+            // const gather_qty = [];
             for (const xmj of ledgerSelect.leafXmjs) {
                 if (xmj.mx_id !== undefined) {
                     const notx = findNotJoinLeafXmj(xmj);
@@ -439,8 +439,8 @@ $(document).ready(() => {
                             return xmj.mx_id === item.mx_id && select.mb_id === item.mb_id;
                         });
                         if (ml === undefined) {
-                            needAddList.push(xmj.mx_id);
-                            gather_qty.push(xmj.gather_qty);
+                            needAddList.push(xmj);
+                            // gather_qty.push(xmj.gather_qty);
                         }
                     }
                 }
@@ -450,7 +450,7 @@ $(document).ready(() => {
                 return false;
             }
             // 更新至服务器
-            postData(window.location.pathname + '/save', { type:'useOther', postData: { mx_id: needAddList, select: select, gather_qty: gather_qty } }, function (result) {
+            postData(window.location.pathname + '/save', { type:'useOther', postData: { addXmj: needAddList, select: select } }, function (result) {
                 materialListData = result;
                 toastr.success('成功添加了' + needAddList.length + '条调差工料到其他清单明细中');
                 const index = gclGatherData.indexOf(ledgerSelect);

+ 5 - 5
app/service/material_list.js

@@ -114,16 +114,16 @@ module.exports = app => {
             try {
                 const list = [];
                 const select = data.select;
-                for (const index in data.mx_id) {
+                for (const xmj of data.addXmj) {
                     const newLists = {
                         tid: this.ctx.tender.id,
                         order: this.ctx.material.order,
                         mid: this.ctx.material.id,
                         mb_id: select.mb_id,
-                        gcl_id: select.gcl_id,
-                        xmj_id: select.xmj_id,
-                        mx_id: data.mx_id[index],
-                        gather_qty: data.gather_qty[index],
+                        gcl_id: xmj.gcl_id,
+                        xmj_id: xmj.id,
+                        mx_id: xmj.mx_id,
+                        gather_qty: xmj.gather_qty,
                         quantity: select.quantity,
                         in_time: new Date(),
                     };

+ 1 - 2
app/view/layout/layout.ejs

@@ -21,8 +21,7 @@
     <% } %>
 </head>
 
-<!--<body oncontextmenu="return false;"> &lt;!&ndash;屏蔽input鼠标右键&ndash;&gt;-->
-<body> <!--屏蔽input鼠标右键-->
+<body oncontextmenu="return false;">
 <div>
 
 </div>

+ 57 - 0
sql/update.sql

@@ -50,6 +50,60 @@ INSERT INTO `zh_maintain` (`id`, `maintain_time`, `duration`, `msg`, `status`) V
 (1, '', 2, '', 0);
 
 -- ----------------------------
+-- zh_message add column 创建者id
+-- ----------------------------
+ALTER TABLE `zh_message`
+ADD COLUMN `create_uid` int(11) DEFAULT NULL COMMENT '创建者id' AFTER `create_time`;
+
+-- ----------------------------
+-- zh_message add column 项目id
+-- ----------------------------
+ALTER TABLE `zh_message`
+ADD COLUMN `project_id` int(11) DEFAULT NULL COMMENT '项目id,针对项目通知' AFTER `create_uid`;
+
+-- ----------------------------
+-- zh_message add column 是否置顶
+-- ----------------------------
+ALTER TABLE `zh_message`
+ADD COLUMN `istop` varchar(15) NOT NULL DEFAULT '0' COMMENT '是否置顶,0为非置顶,时间戳为置顶时间' AFTER `release_time`;
+
+-- ----------------------------
+-- zh_message change column content
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `content` `content` text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '消息内容';
+
+-- ----------------------------
+-- zh_message change column create_time
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `create_time` `create_time` varchar(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '创建时间';
+
+-- ----------------------------
+-- zh_message change column creator
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `creator` `creator` varchar(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '创建者';
+
+-- ----------------------------
+-- zh_message change column type
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `type` `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '消息类型 1为项目 2为系统';
+
+-- ----------------------------
+-- zh_message change column status
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `status` `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '消息状态,1:已发布,2:未发布';
+
+-- ----------------------------
+-- zh_message change column release_time
+-- ----------------------------
+ALTER TABLE `zh_message`
+CHANGE `release_time` `release_time` int(10) NOT NULL DEFAULT '0' COMMENT '发布时间';
+
+-- ----------------------------
 -- zh_project add column 是否定制项目
 -- ----------------------------
 ALTER TABLE `zh_project`
@@ -79,3 +133,6 @@ ADD COLUMN `bind` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已绑定定制
 INSERT INTO `calculation`.`zh_permission` (`id`, `name`, `controller`, `action`, `pid`, `icon_class`, `create_time`, `isshow`) VALUES ('67', '系统维护', 'maintain', '', '11', '', NULL, '1');
 INSERT INTO `calculation`.`zh_permission` (`id`, `name`, `controller`, `action`, `pid`, `icon_class`, `create_time`, `isshow`) VALUES ('68', '第三方接口', 'project', 'api2other', '38', 'api2other', NULL, '1');
 INSERT INTO `calculation`.`zh_permission` (`id`, `name`, `controller`, `action`, `pid`, `icon_class`, `create_time`, `isshow`) VALUES ('69', '第三方接口设置', 'project', 'api2otherSave', '38', '', NULL, '1');
+
+update `calculation`.`zh_permission` set `name` = '消息通知', `isshow` = 1 where `id` = 31;
+update `calculation`.`zh_permission` set `create_time` = '1' where `id` = 62;