瀏覽代碼

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

chenshilong 7 年之前
父節點
當前提交
798a36e560

+ 3 - 3
modules/bills_lib/models/bills_lib_schemas.js

@@ -37,9 +37,9 @@ let itemsSchema = mongoose.Schema({
     {versionKey: false});
 
 let billsSchema = mongoose.Schema({
-        ID: Number,
-        ParentID: Number,
-        NextSiblingID: Number,
+        ID: String,
+        ParentID: String,
+        NextSiblingID: String,
         code: String,
         name: String,
         unit: String,

+ 41 - 0
modules/main/facade/bill_facade.js

@@ -0,0 +1,41 @@
+/**
+ * Created by zhang on 2018/1/22.
+ */
+let model = require("../../bills_lib/models/bills_lib_model");
+let Bills = model.billsMod;
+let _ = require("lodash");
+module.exports={
+   getSectionInfo : async function (data) {
+        console.log(data);
+        let conditions=[];
+        let fxList=[];
+        let billsLibId=0;
+        let sectionInfo ={};
+        for(let libID in data){
+            let codes=[];
+            let temp={};
+            let billsLibId = libID;
+            codes= _.keys(data[libID]);
+            temp['billsLibId']=libID;
+            temp['code'] = {"$in": codes};
+            conditions.push(temp);
+        }
+        if(conditions.length>0){
+            fxList = await Bills.find({"$or":conditions});
+        }
+        if(fxList.length>0){
+            let sectionIDs = {};
+            for(let f of fxList){
+                if(f._doc.sectionInfo){
+                    f._doc.sectionInfo.first?sectionIDs[f._doc.sectionInfo.first]=true:"";
+                    f._doc.sectionInfo.second?sectionIDs[f._doc.sectionInfo.second]=true:"";
+                    f._doc.sectionInfo.third?sectionIDs[f._doc.sectionInfo.third]=true:"";
+                }
+            }
+            let IDList = _.keys(sectionIDs);
+            let sectionList = await Bills.find({"billsLibId":billsLibId,'ID':{'$in':IDList}});
+            console.log(sectionList);
+            console.log('getData');
+        }
+    }
+}

+ 8 - 8
public/web/id_tree.js

@@ -422,7 +422,7 @@ var idTree = {
             }
         })();
         Tree.prototype.newNodeID = function () {
-            if (this.rangeNodeID() === -1) {
+            if (this.rangeNodeID() == -1) {
                 return this.maxNodeID() + 1;
             } else {
                 if (this.maxNodeID() < this.rangeNodeID()) {
@@ -460,7 +460,7 @@ var idTree = {
             // set parent by pid, set nextSibling by nid
             datas.forEach(function (data) {
                 node = that.nodes[prefix + data[that.setting.id]];
-                if (data[that.setting.pid] === that.setting.rootId) {
+                if (data[that.setting.pid] == that.setting.rootId) {
                     that.roots.push(node);
                 } else {
                     parent = that.nodes[prefix + data[that.setting.pid]];
@@ -500,8 +500,8 @@ var idTree = {
 
         Tree.prototype.insert = function (parentID, nextSiblingID) {
             var newID = this.newNodeID(), node = null, data = {};
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
             if (newID !== -1) {
                 data = {};
                 data[this.setting.id] = newID;
@@ -522,8 +522,8 @@ var idTree = {
         Tree.prototype.getInsertData = function (parentID, nextSiblingID, uid = null) {
             var data = [];
             var newID = uid ? uuid.v1() : this.newNodeID();
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
             if (newID != -1) {
                 data.push({type: 'new', data: this.getDataTemplate(newID, parent ? parent.getID() : this.setting.rootId, nextSibling ? nextSibling.getID() : this.setting.rootId)});
 
@@ -538,8 +538,8 @@ var idTree = {
             return data;
         };
         Tree.prototype.insertByData = function (data, parentID, nextSiblingID, uid = null) {
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null : this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null : this.nodes[this.prefix + nextSiblingID];
             var node = this.nodes[this.prefix + data[this.setting.id]];
             if (node) {
                 return node;

+ 70 - 0
web/building_saas/main/html/main.html

@@ -789,6 +789,75 @@
         </div>
     </div>
 
+    <!--弹出 整理分部-->
+    <div class="modal fade" id="zlfb" data-backdrop="static">
+        <div class="modal-dialog" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">整理分部</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">&times;</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" id="bill_first" >
+                        <label class="form-check-label">
+                            需要专业分部标题
+                        </label>
+                    </div>
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" id="bill_second" >
+                        <label class="form-check-label">
+                            需要章分部标题
+                        </label>
+                    </div>
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" id="bill_third" >
+                        <label class="form-check-label">
+                            需要节分部标题
+                        </label>
+                    </div>
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" checked disabled value="" >
+                        <label class="form-check-label">
+                            删除自定义分部标题
+                        </label>
+                    </div>
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" id="bill_resort">
+                        <label class="form-check-label">
+                            清单排序
+                        </label>
+                    </div>
+                    <div class="form-check">
+                        <input class="form-check-input zlfb-check" type="checkbox" id="bill_recode"  >
+                        <label class="form-check-label">
+                            清单重新编码
+                        </label>
+                    </div>
+                    <div class="card mt-3">
+                        <div class="card-body p-2">
+                            <h5 class="card-title">操作说明</h5>
+                            <p class="card-text">执行分部整理将对当前清单列表存在的清单按以上勾选项进行整理;</br>
+                                勾选“需要专业分部标题”,表示分部整理时需要添加清单专业标题;</br>
+                                勾选“需要章分部标题”,表示分部整理时需要添加章标题;</br>
+                                勾选“需要节分部标题”,表示分部整理时需要添加节标题;</br>
+                                勾选“删除自定义分部标题”,将首先删除已有自定义分部标题,然后再执行分部整理;</br>
+                                勾选“清单排序”,表示分部整理后对每个分部下的清单进行排序;</br>
+                                勾选“清单重新编码”,表示分部整理后对每个分部下的清单重新生成水流号;
+                            </p>
+                        </div>
+                    </div>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+                    <button type="button" class="btn btn-primary" id="zlfb_confirm">确定</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
         <!-- JS. -->
         <script type="text/javascript" src="/lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
 
@@ -895,6 +964,7 @@
         <script type="text/javascript" src="/web/building_saas/main/js/views/glj_view_contextMenu.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/views/calc_program_view.js"></script>
         <script type="text/javascript" src='/web/building_saas/main/js/views/confirm_modal.js'></script>
+        <script type="text/javascript" src='/web/building_saas/main/js/views/zlfb_view.js'></script>
         <!--报表-->
         <script type="text/javascript" src="/public/web/rpt_tpl_def.js"></script>
         <script type="text/javascript" src="/public/web/treeDataHelper.js"></script>

+ 13 - 0
web/building_saas/main/js/views/project_view.js

@@ -727,6 +727,19 @@ var projectObj = {
                         return false;
                     }
                 },
+                "ZLFB": {
+                    name: "整理分部",
+                    icon: 'fa-sign-in',
+                    disabled: function () {
+                       return false;
+                    },
+                    callback: function (key, opt) {
+                        zlfb_object.getSectionInfo();
+                    },
+                    visible: function(key, opt){
+                        return true;
+                    }
+                },
                 "spr1": '--------',
                 "delete": {
                     name: '删除',

+ 1 - 1
web/building_saas/main/js/views/std_bills_lib.js

@@ -80,7 +80,7 @@ var billsLibObj = {
         var findData = function (value, field, Array) {
             var i = 0;
             for (i = 0; i < Array.length; i++) {
-                if (value[field] === Array[i][field]) {
+                if (value[field] == Array[i][field]) {
                     return Array[i];
                 }
             }

+ 76 - 0
web/building_saas/main/js/views/zlfb_view.js

@@ -0,0 +1,76 @@
+/**
+ * Created by zhang on 2018/1/22.
+ */
+let zlfb_object={
+    sectionInfo:null,
+    getSectionInfo:function () {
+        let controller = projectObj.mainController, project = projectObj.project;
+        let Bill = project.Bills;
+        let FBFX = Bill.getFBFXNode(controller);//取分部分项工程节点;
+        let all_sub_nodes=[],FB_nodes =[],FX_nodes =[], query={};
+        let codeMap = {};
+        let reorganize = false;
+        controller.tree.getAllSubNode(FBFX.source,all_sub_nodes);//取分部分项工程节点下的所有节点,不包括定额和工料机节点;
+        for(let tem_node of all_sub_nodes){
+            if(tem_node.data.type == billType.FB){
+                FB_nodes.push(tem_node);
+            }
+            if(tem_node.data.type == billType.FX){
+                FX_nodes.push(tem_node);
+                let l_code = zlfb_object.getLibCode(tem_node.data.code);
+                if(tem_node.data.billsLibId&&l_code!=false){
+                    reorganize= true;
+                    if(codeMap[l_code]){
+                        codeMap[l_code].push(tem_node);
+                    }else {
+                        codeMap[l_code]=[tem_node];
+                    }
+                    if(query[tem_node.data.billsLibId]){
+                        query[tem_node.data.billsLibId][l_code]=true;
+                    }else {
+                        query[tem_node.data.billsLibId]={};
+                        query[tem_node.data.billsLibId][l_code]=true;
+                    }
+                }
+            }
+        }
+        if(reorganize==true){
+            zlfb_object.sectionInfo = {
+                'codeMap':codeMap,
+                'FB_nodes':FB_nodes,
+                'FX_nodes':FX_nodes
+            }
+            CommonAjax.post('/bills/getSectionInfo',query,function (data) {
+                $("#zlfb").modal({show:true});
+            });
+        }else {
+            $("#zlfb").modal({show:true});
+        }
+
+        console.log(query);
+
+    },
+    getLibCode:function (billCode) {//根据清单编号得到清单库中的编号
+        if(billCode&&billCode.length>=9){
+            return billCode.substr(0,9);
+        }else {
+            return false;
+        }
+    }
+}
+
+
+
+
+$(function () {
+    $('#zlfb_confirm').click(function (){
+        console.log("confirm click")
+
+
+
+
+
+
+
+    })
+})