瀏覽代碼

说明信息,debug

zhongzewei 7 年之前
父節點
當前提交
f2957538c7

+ 1 - 0
modules/all_models/ration.js

@@ -63,6 +63,7 @@ let rationSchema = new Schema({
     flags: [subSchema.flagsSchema],             // 标记字段
     rationAssList: [rationAssItemSchema],
     content: String,                            // 工作内容
+    annotation: String,                         //附注
     ruleText: String,                            // 计算规则
     prefix: {type: String, default: ''},                              //定额是补充、借用时用  补 借
 

+ 70 - 5
modules/bills_lib/models/bills_lib_interfaces.js

@@ -3031,7 +3031,72 @@ billsLibDao.prototype.edUpdateItem = function(data, callback){
 };
 //
 
-billsLibDao.prototype.getStdBillsByCode = function (data, callback) {
+billsLibDao.prototype.getStdBillsByCode = async function (data, callback) {
+    let findData = function (value, field, Array) {
+        let i = 0;
+        for (i = 0; i < Array.length; i++) {
+            if (value[field] === Array[i][field]) {
+                return Array[i];
+            }
+        }
+        return null;
+    };
+    let MergeData = function (arr) {
+        let result = "", count = 0;
+        for(let i = 0; i < arr.length; i++){
+            if(arr[i].isChecked === true){
+                count += 1;
+                if (count === 1) {
+                    result += count + ". " + arr[i].content;
+                } else {
+                    result += "\n" + count + ". " + arr[i].content;
+                }
+            }
+        }
+        return result;
+    }
+    try{
+        let bills = await Bills.findOne({billsLibId: data.billsLibId, code: data.code, deleted: false}, '-_id');
+        //设置清单备注(父项清单补注)
+        if(bills.ParentID != -1){
+            let parentBills = await Bills.findOne({billsLibId: data.billsLibId, ID: bills.ParentID, deleted: false});
+            if(parentBills && parentBills.recharge){
+                bills.recharge = parentBills.recharge;
+            }
+        }
+        if(bills){
+            //设置项目特征
+            let itemCharacters = await ItemCharacter.find({billsLibId: data.billsLibId, deleted: false}, '-_id');
+            bills._doc.itemCharacter = [];
+            if(itemCharacters && bills.items){
+                for(let item of bills.items){
+                    let itemData = findData(item, 'id', itemCharacters);
+                    if(itemData){
+                        bills._doc.itemCharacter.push(itemData);
+                    }
+                }
+            }
+            bills._doc.itemCharacterText = MergeData(bills._doc.itemCharacter);
+            //设置工作内容
+            let jobContents = await JobContent.find({billsLibId: data.billsLibId, deleted: false}, '-_id');
+            bills._doc.jobContent = [];
+            if(jobContents && bills.jobs){
+                for(let job of bills.jobs){
+                    let jobData = findData(job, 'id', jobContents);
+                    jobData.isChecked = true;
+                    bills._doc.jobContent.push(jobData);
+                }
+            }
+            bills._doc.jobContentText = MergeData(bills._doc.jobContent);
+        }
+        callback(0, '', bills);
+
+    }
+    catch(err){
+        callback(1, err, null);
+    }
+};
+billsLibDao.prototype.getStdBillsByCodet = function (data, callback) {
     let findData = function (value, field, Array) {
         let i = 0;
         for (i = 0; i < Array.length; i++) {
@@ -3067,23 +3132,23 @@ billsLibDao.prototype.getStdBillsByCode = function (data, callback) {
                     if (err) {
                         callback(err, bills);
                     } else {
-                        bills.itemCharacter = [];
+                        bills._doc.itemCharacter = [];
                         if (result && bills && bills.items) {
                             for (let item of bills.items) {
                                 let itemData = findData(item, 'id', result);
                                 if (itemData) {
-                                    bills.itemCharacter.push(JSON.parse(JSON.stringify(itemData)));
+                                    bills._doc.itemCharacter.push(JSON.parse(JSON.stringify(itemData)));
                                 }
                             }
                         }
-                        bills.itemCharacterText = MergeData(bills.itemCharacter);
+                        bills._doc.itemCharacterText = MergeData(bills.itemCharacter);
                         callback(err, bills);
                     }
                 });
             } else {
                 callback(null, bills);
             }
-            
+
         },
         function (bills, callback) {
             if (bills) {

+ 1 - 0
modules/main/facade/ration_facade.js

@@ -88,6 +88,7 @@ async function insertNewRation(newData,firstLibID,std,calQuantity) {//插入新
         newData.unit = std.unit;
         newData.libID = std.rationRepId;
         newData.content = std.jobContent;
+        newData.annotation = std.annotation;
         if (std.chapter) {
             newData.comments = std.chapter.explanation;
             newData.ruleText = std.chapter.ruleText;

+ 3 - 3
web/building_saas/css/main.css

@@ -149,9 +149,9 @@ body {
 .bottom-tools {
     height: 30px;
     line-height: 30px;
-    background:#fff;
-    bottom:22px;
-    left:22px;
+    background:#F1F1F1;
+    bottom:30px;
+    left:2px;
     z-index: 999
 }
 .side-tabs .nav-tabs .nav-item {

+ 2 - 2
web/building_saas/main/js/models/bills.js

@@ -202,8 +202,8 @@ var Bills = {
                     data.data.unit = stdBillsData.unit;
                     // 工程量计算规则
                     data.data.ruleText = stdBillsData.ruleText;
-                    // 说明(注)
-                    data.data.comments = stdBillsData.recharge;
+                    // 说明(清单备注)
+                    data.data.comments = stdBillsData.comments;
                     //zhong 特征及内容
                     data.data.jobContent = stdBillsData.jobContent;
                     data.data.itemCharacter = stdBillsData.itemCharacter;

+ 6 - 3
web/building_saas/main/js/views/std_bills_lib.js

@@ -125,6 +125,10 @@ var billsLibObj = {
         if(projectInfoObj.projectInfo.property.lockBills == true){
             return false;
         }
+        //设置清单备注
+        if(node.parent && node.parent.data.recharge){
+            node.data.comments = node.parent.data.recharge;
+        }
         //特征及内容转化
         pageCCOprObj.setItemContentNode(node, this.getBillsJobs(stdBillsJobData, node), this.getBillsFeatures(stdBillsFeatureData, node), node.data.name);
         if (/\//.test(node.data.unit)) {
@@ -164,9 +168,8 @@ var billsLibObj = {
             $('#stdBillsRemarkTab').hide();
             billsLibObj.refreshBillsRelaSpread();
             billsLibObj.checkBillsRelaSpread();
-            billsLibObj.sortJobsAndFeatures(billsLibObj.getBillsJobs(node));
-            showJobs(billsLibObj.getBillsJobs(node));
-            showFeatures(billsLibObj.getBillsFeatures(node));
+            showJobs(billsLibObj.getBillsJobs(stdBillsJobData, node));
+            showFeatures(billsLibObj.getBillsFeatures(stdBillsFeatureData, node));
         };
         var showBillsRemark = function (node) {
             $('#stdBillsJobTab').hide();

+ 22 - 3
web/building_saas/main/js/views/sub_view.js

@@ -316,13 +316,32 @@ let subViewObj = {
         $($(this).attr('href')).show();
     },
     loadComments: function (node) {
+        let comments = [];
+        let commentText = '';
         if (node) {
-            if (node.sourceType === projectObj.project.Bills.getSourceType()) {
-                $('#comments>textarea').val(node.data.comments)
+            if (node.sourceType === projectObj.project.Bills.getSourceType() &&
+                (node.data.type === billType.FX || node.data.type === billType.BX || node.data.type === billType.BILL)) {
+                if(node.data.comments && node.data.comments !== ''){
+                    comments.push('清单注释:');
+                    comments.push(node.data.comments);
+                }
+                if(node.data.ruleText && node.data.ruleText !== ''){
+                    comments.push('工程量计算规则:');
+                    comments.push(node.data.ruleText);
+                }
             } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
-                $('#comments>textarea').val(node.data.content);
+                if(node.data.content && node.data.content !== ''){
+                    comments.push('工作内容:');
+                    comments.push(node.data.content);
+                }
+                if(node.data.annotation && node.data.annotation !== ''){
+                    comments.push('附注:');
+                    comments.push(node.data.annotation);
+                }
             }
+            commentText = comments.join('\n');
         }
+        $('#comments>textarea').val(commentText);
     },
     saveComments: function (node) {
         let text = $('#comments>textarea').val();