瀏覽代碼

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

TonyKang 7 年之前
父節點
當前提交
6c4d91f38a
共有 41 個文件被更改,包括 762 次插入274 次删除
  1. 二進制
      img/avatar.png
  2. 5 1
      modules/all_models/bills_template.js
  3. 4 0
      modules/all_models/engineering_lib.js
  4. 7 9
      modules/bills_lib/models/bills_lib_interfaces.js
  5. 8 2
      modules/ration_repository/models/installation.js
  6. 20 14
      modules/ration_repository/models/ration_section_tree.js
  7. 32 5
      modules/ration_repository/models/repository_map.js
  8. 10 4
      modules/std_billsGuidance_lib/facade/facades.js
  9. 33 5
      modules/std_glj_lib/models/gljMapModel.js
  10. 20 32
      modules/std_glj_lib/models/gljModel.js
  11. 1 0
      modules/users/controllers/compilation_controller.js
  12. 1 1
      modules/users/models/bills_template_model.js
  13. 3 0
      modules/users/models/engineering_lib_model.js
  14. 1 0
      public/web/tree_sheet/tree_sheet_helper.js
  15. 1 1
      web/maintain/billsGuidance_lib/html/main.html
  16. 21 0
      web/maintain/billsGuidance_lib/html/zhiyin.html
  17. 8 3
      web/maintain/billsGuidance_lib/js/billsGuidance.js
  18. 27 11
      web/maintain/billsGuidance_lib/js/main.js
  19. 62 57
      web/maintain/bills_lib/css/main.css
  20. 15 2
      web/maintain/bills_lib/html/main.html
  21. 21 0
      web/maintain/bills_lib/html/neirong.html
  22. 27 1
      web/maintain/bills_lib/html/qingdan.html
  23. 21 0
      web/maintain/bills_lib/html/tezheng.html
  24. 1 0
      web/maintain/bills_lib/scripts/bills_lib_ajax.js
  25. 11 3
      web/maintain/bills_lib/scripts/set_sheets.js
  26. 20 1
      web/maintain/ration_repository/anzhuang.html
  27. 21 0
      web/maintain/ration_repository/dinge.html
  28. 95 56
      web/maintain/ration_repository/js/installation.js
  29. 15 1
      web/maintain/ration_repository/js/main.js
  30. 6 2
      web/maintain/ration_repository/js/section_tree.js
  31. 1 3
      web/maintain/ration_repository/main.html
  32. 21 1
      web/maintain/std_glj_lib/html/gongliao.html
  33. 2 1
      web/maintain/std_glj_lib/html/main.html
  34. 25 20
      web/maintain/std_glj_lib/js/glj.js
  35. 9 5
      web/maintain/std_glj_lib/js/gljClassTree.js
  36. 25 6
      web/maintain/std_glj_lib/js/main.js
  37. 19 0
      web/users/js/col_setting.js
  38. 108 23
      web/users/js/template.js
  39. 4 2
      web/users/views/compilation/engineering.html
  40. 29 0
      web/users/views/compilation/modal.html
  41. 2 2
      web/users/views/compilation/template.html

二進制
img/avatar.png


+ 5 - 1
modules/all_models/bills_template.js

@@ -32,7 +32,11 @@ let BillsTemplateSchema = {
     // 所属计价ID
     valuationId: String,
     // 工程专业
-    engineering: Number
+    engineering: Number,
+    //计算基数
+    calcBase: String,
+    //费率ID
+    feeRateID:Number
 };
 
 mongoose.model(collectionName, new Schema(BillsTemplateSchema, {versionKey: false, collection: collectionName}));

+ 4 - 0
modules/all_models/engineering_lib.js

@@ -55,6 +55,10 @@ let modelSchema = {
     program_lib: {
         type: Schema.Types.Mixed,
         default: []
+    },
+    //设置人材机显示列
+    glj_col:{
+        showAdjustPrice:Boolean//是否显示调整价列
     }
 };
 mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 7 - 9
modules/bills_lib/models/bills_lib_interfaces.js

@@ -139,7 +139,7 @@ billsLibDao.prototype.deleteStdBillsLib = function(data, callback){
                 else{
                     if(result.length > 0 ){
                         let newRecentOpr = getNewOprArr(result[0].recentOpr, lastOperator, lastOperateDate);
-                        StdBillsLib.update({billsLibId: billsLibId}, {$set: {recentOpr: newRecentOpr, deleted: true}}, function(err){
+                        StdBillsLib.remove({billsLibId: billsLibId}, function(err){
                             if(err){
                                 cb(err);
                             }
@@ -152,17 +152,17 @@ billsLibDao.prototype.deleteStdBillsLib = function(data, callback){
             });
         },
         function(cb){
-            Bills.update({billsLibId: billsLibId, deleted: false}, {$set: {deleted: true}}, {upsert: false, multi: true}, function(err){
+            Bills.remove({billsLibId: billsLibId}, function(err){
                 cb(null);
             });
         },
         function(cb){
-            JobContent.update({billsLibId: billsLibId, deleted: false}, {$set: {deleted: true}}, {upsert: false, multi: true}, function(err, result){
+            JobContent.remove({billsLibId: billsLibId}, function(err, result){
                 cb(null);
             });
         },
         function(cb){
-            ItemCharacter.update({billsLibId: billsLibId, deleted: false}, {$set: {deleted: true}}, {upsert: false, multi: true}, function(err){
+            ItemCharacter.remove({billsLibId: billsLibId}, function(err){
                 cb(null);
             })
         }
@@ -844,7 +844,7 @@ billsLibDao.prototype.removeTotal = function (data, callback) {
         delJobs: function () {
             return function (cb) {
                 async.each(delIds, function (delJobId, ecb) {
-                    JobContent.update({billsLibId: billsLibId, id: delJobId, deleted: false}, {$set: {deleted: true}}, function (err, result) {
+                    JobContent.remove({billsLibId: billsLibId, id: delJobId}, function (err, result) {
                         if(err){
                             ecb(err);
                         }
@@ -865,8 +865,6 @@ billsLibDao.prototype.removeTotal = function (data, callback) {
         delJobsArr: function () {
             return function (cb) {
                 async.each(delArr, function (delObj, ecb) {
-                    console.log(`delObj`);
-                    console.log(delObj);
                     Bills.update({billsLibId: billsLibId, ID: delObj.updateID, deleted: false}, {$pull: {jobs: {id: delObj.delId}}}, function (err) {
                         if(err){
                             ecb(err);
@@ -887,7 +885,7 @@ billsLibDao.prototype.removeTotal = function (data, callback) {
         delItems: function () {
             return function (cb) {
                 async.each(delIds, function (delItemId, ecb) {
-                    ItemCharacter.update({billsLibId: billsLibId, id: delItemId, deleted: false}, {$set: {deleted: true}}, function (err) {
+                    ItemCharacter.remove({billsLibId: billsLibId, id: delItemId}, function (err) {
                         if(err){
                             ecb(err);
                         }
@@ -1772,7 +1770,7 @@ billsLibDao.prototype.deleteBills = function(delData, callback){
         async.parallel([
             function(cb){
                 async.each(deleteIds, function(delId, ecb){
-                    Bills.update({billsLibId: billsLibId, ID: delId, deleted: false}, {$set: {deleted: true}}, function(err){
+                    Bills.remove({billsLibId: billsLibId, ID: delId}, function(err){
                         if(err){
                             ecb(err);
                         }

+ 8 - 2
modules/ration_repository/models/installation.js

@@ -33,9 +33,12 @@ class InstallationDao{
                 if(data.updateType === 'new'){
                     await installSectionModel.create(data.updateData);
                 }
-                else if(data.updateType === 'update'){
+                else if(data.updateType === 'update' && !data.updateData.deleted){
                     await installSectionModel.update({ID: data.updateData.ID}, data.updateData);
                 }
+                else {
+                    await installSectionModel.remove({ID: data.updateData.ID});
+                }
             }
             callback(0, null);
         }
@@ -50,9 +53,12 @@ class InstallationDao{
                 if(data.updateType === 'new'){
                     await installFeeItemModel.create(data.updateData);
                 }
-                else if(data.updateType === 'update'){
+                else if(data.updateType === 'update' && !data.updateData.deleted){
                     await installFeeItemModel.update({ID: data.updateData.ID}, data.updateData);
                 }
+                else{
+                    await installFeeItemModel.remove({ID: data.updateData.ID});
+                }
             }
             callback(0, null);
         }

+ 20 - 14
modules/ration_repository/models/ration_section_tree.js

@@ -170,25 +170,31 @@ rationChapterTreeDAO.prototype.updateNodes = function(lastOpr, updateData,callba
         //md.isNew = false;
         functions.push((function(doc) {
             return function(cb) {
-                if(doc.updateType === 'update'){
+                if(doc.updateType === 'update' && !doc.updateData.isDeleted){
                     rationChapterTreeModel.update({rationRepId: doc.updateData.rationRepId, ID: doc.updateData.ID}, doc.updateData, function (err) {
                         if(err){
                             cb(err);
                         }
                         else {
-                            if(doc.updateData.isDeleted){
-                                rationModel.update({sectionId: doc.updateData.ID}, {$set: {isDeleted: true}}, {multi: true}, function(err){
-                                    if(err){
-                                        cb(err);
-                                    }
-                                    else {
-                                        cb(null);
-                                    }
-                                });
-                            }
-                            else {
-                                cb(null);
-                            }
+                            cb(null);
+                        }
+                    });
+                }
+                else if(doc.updateType === 'update' && doc.updateData.isDeleted){
+                    rationChapterTreeModel.remove({rationRepId: doc.updateData.rationRepId, ID: doc.updateData.ID}, function (err) {
+                        if(err){
+                            cb(err);
+                        }
+                        else {
+                            rationModel.remove({sectionId: doc.updateData.ID}, function(err){
+                                if(err){
+                                    cb(err);
+                                }
+                                else {
+                                    cb(null);
+                                }
+                            });
+
                         }
                     });
                 }

+ 32 - 5
modules/ration_repository/models/repository_map.js

@@ -10,6 +10,9 @@ const gljMapModel = mongoose.model('std_glj_lib_map');
 const rationRepository = mongoose.model('std_ration_lib_map');
 const rationChapterTreeModel = mongoose.model('std_ration_lib_ration_chapter_trees');
 const rationItemModel = mongoose.model('std_ration_lib_ration_items');
+const rationCoeModel = mongoose.model('std_ration_lib_coe_list');
+const rationInstallFeeItem = mongoose.model('std_ration_lib_installation');
+const rationInstallSection = mongoose.model('std_ration_lib_installationSection');
 
 function createNewLibModel(rationLibObj){
     var rst = {};
@@ -207,9 +210,9 @@ rationRepositoryDao.prototype.deleteRationLib = function(oprtor, libId, callback
                    callback(err, "没有数据!");
                }
                 else{
-                   rationRepository.update({ID: libId, deleted: false}, {$set: {deleted: true}}, function (err) {
+                   rationRepository.remove({ID: libId}, function (err) {
                        if(err){
-                           callback(err, '移除工料机库失败!');
+                           callback(err, '移除定额库失败!');
                        }
                        else{
                            async.parallel([
@@ -226,18 +229,42 @@ rationRepositoryDao.prototype.deleteRationLib = function(oprtor, libId, callback
                                },
                                //删除库下定额
                                function (cb) {
-                                        console.log('enterD==================================');
-                                   rationItemModel.update({rationRepId: libId}, {$set: {isDeleted: true}}, {upsert: true, multi: true}, function (err) {
+                                   rationItemModel.remove({rationRepId: libId}, function (err) {
                                        if(err)cb(err);
                                        else cb(null);
                                    });
                                },
                                //删除库下章节树
                                function (cb) {
-                                   rationChapterTreeModel.update({rationRepId: libId}, {$set: {isDeleted: true}}, {upsert: true, multi: true}, function (err) {
+                                   rationChapterTreeModel.remove({rationRepId: libId}, function (err) {
                                        if(err)cb(err);
                                        else cb(null);
                                    })
+                               },
+                               //删除子目换算
+                               function (cb) {
+                                   rationCoeModel.remove({libID: libId}, function (err) {
+                                       if(err)cb(err);
+                                       else cb(null);
+                                   });
+                               },
+                               //删除安装
+                               async function (cb) {
+                                    try{
+                                        let feeItems = await rationInstallFeeItem.find({rationRepId: libId});
+                                        let sectionIDs = [];
+                                        for(let item of feeItems){
+                                            for(let section of item.section){
+                                                sectionIDs.push(section.ID);
+                                            }
+                                        }
+                                        await rationInstallFeeItem.remove({rationRepId: libId});
+                                        await rationInstallSection.remove({ID: {$in: sectionIDs}});
+                                        cb(null);
+                                    }
+                                    catch (err){
+                                        cb(err);
+                                    }
                                }
                            ], function (err) {
                                if(err) callback(err, 'fail');

+ 10 - 4
modules/std_billsGuidance_lib/facade/facades.js

@@ -105,10 +105,13 @@ async function initBillsGuideLib(updateData){
 }
 
 async function updateBillsGuideLib(data) {
-    await billsGuideLibModel.update(data.findData, {$set: data.updateData});
     if(data.updateType === 'delete'){
-        //假删除所有条目
-        await billsGuideItemsModel.update({libID: data.findData.ID}, {$set: {deleted: true}}, {multi: true});
+        //删除所有条目
+        await billsGuideLibModel.remove(data.findData);
+        await billsGuideItemsModel.remove({libID: data.findData.ID});
+    }
+    else {
+        await billsGuideLibModel.update(data.findData, {$set: data.updateData});
     }
 }
 
@@ -223,9 +226,12 @@ async function updateItems(updateDatas) {
         if(updateData.updateType === 'create'){
             bulkArr.push({insertOne: {document: updateData.updateData}});
         }
-        else{
+        else if(updateData.updateType === 'update'){
             bulkArr.push({updateOne: {filter: updateData.findData, update: {$set: updateData.updateData}}});
         }
+        else{
+            bulkArr.push({deleteOne: {filter: updateData.findData}});
+        }
     }
     if(bulkArr.length > 0){
         await billsGuideItemsModel.bulkWrite(bulkArr);

+ 33 - 5
modules/std_glj_lib/models/gljMapModel.js

@@ -5,6 +5,7 @@ const mongoose = require('mongoose');
 const gljMapModel = mongoose.model('std_glj_lib_map');
 const gljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
+const gljClassTemplateModel = mongoose.model('std_glj_lib_gljClassTemplate');
 const rationRepository = mongoose.model('std_ration_lib_map');
 import moment from "moment";
 import counter from "../../../public/counter/counter";
@@ -119,7 +120,34 @@ class GljMapDao extends OprDao{
                         callback(err, '创建新工料机库失败!', null);
                     }
                     else{
-                        callback(null, '创建成功!', result);
+                        //创建分类模板
+                        gljClassTemplateModel.find({'$or': [{isDeleted: null}, {isDeleted: false}, {deleted: false}]}, function (err, datas) {
+                            if(err){
+                                callback(err, "获取工料机类型错误!", null);
+                            }
+                            else{
+                                let rst = [];
+                                async.each(datas, function (data, cb) {
+                                    let newClassObj = {};
+                                    newClassObj.ID = data.ID;
+                                    newClassObj.ParentID = data.ParentID;
+                                    newClassObj.NextSiblingID = data.NextSiblingID;
+                                    newClassObj.Name = data.Name;
+                                    newClassObj.repositoryId = newGljLib.ID;
+                                    newClassObj.deleted = false;
+                                    gljClassModel.create(newClassObj, function(err){
+                                        if(err)cb(err);
+                                        else{
+                                            rst.push(newClassObj);
+                                            cb(null);
+                                        }
+                                    });
+                                }, function (err) {
+                                    if(err) callback(err, "新增工料机类型错误!", null);
+                                    else callback(null, '创建成功', result);
+                                });
+                            }
+                        });
                     }
                 });
             }
@@ -154,12 +182,12 @@ class GljMapDao extends OprDao{
                     }
                     else{
                         if(result[0].rationLibs.length > 0){//已被引用
-                            callback(null, '此工料机库已被引用!');
+                            callback(null, '此人材机库已被引用!');
                         }
                         else{
                             async.parallel([
                                 function (cb) {
-                                    gljMapModel.update({ID: libId, deleted: false}, {$set: {deleted: true}}, function (err) {
+                                    gljMapModel.remove({ID: libId}, function (err) {
                                         if(err){
                                             cb(err);
                                         }
@@ -169,7 +197,7 @@ class GljMapDao extends OprDao{
                                     });
                                 },
                                 function (cb) {
-                                    gljModel.update({repositoryId: libId}, {$set: {deleted: true}}, {upsert: true, multi: true}, function (err) {
+                                    gljModel.remove({repositoryId: libId}, function (err) {
                                         if(err){
                                             cb(err);
                                         }
@@ -179,7 +207,7 @@ class GljMapDao extends OprDao{
                                     });
                                 },
                                 function (cb) {
-                                    gljClassModel.update({repositoryId: libId}, {$set: {deleted: true}}, {upsert: true, multi: true}, function (err) {
+                                    gljClassModel.remove({repositoryId: libId}, function (err) {
                                         if(err){
                                             cb(err);
                                         }

+ 20 - 32
modules/std_glj_lib/models/gljModel.js

@@ -14,38 +14,9 @@ import async from "async";
 class GljDao  extends OprDao{
     getGljTypes (gljLibId, callback){
         gljClassModel.find({"repositoryId": gljLibId, "$or": [{"isDeleted": null}, {"isDeleted": false}, {deleted: false} ]},function(err,data){
-            if(data.length) {
-                callback(0, data);
-            }
-            else  if(err) callback("获取工料机类型错误!",false)
+            if(err) callback("获取工料机类型错误!",false)
             else {
-                gljClassTemplateModel.find({'$or': [{isDeleted: null}, {isDeleted: false}, {deleted: false}]}, function (err, datas) {
-                    if(err){
-                        callback("获取工料机类型错误!", false);
-                    }
-                    else{
-                        let rst = [];
-                        async.each(datas, function (data, cb) {
-                            let newClassObj = {};
-                            newClassObj.ID = data.ID;
-                            newClassObj.ParentID = data.ParentID;
-                            newClassObj.NextSiblingID = data.NextSiblingID;
-                            newClassObj.Name = data.Name;
-                            newClassObj.repositoryId = gljLibId;
-                            newClassObj.deleted = false;
-                            gljClassModel.create(newClassObj, function(err){
-                                if(err)cb(err);
-                                else{
-                                    rst.push(newClassObj);
-                                    cb(null);
-                                }
-                            });
-                        }, function (err) {
-                            if(err) callback("新增工料机类型错误!", false);
-                            else callback(0, rst);
-                        });
-                    }
-                });
+                callback(0, data);
             }
         })
     }
@@ -351,7 +322,7 @@ class GljDao  extends OprDao{
         for (let i = 0, len = updateData.length; i < len; i++) {
             functions.push((function(doc) {
                 return function(cb) {
-                    if(doc.updateType === 'update'){
+                    if(doc.updateType === 'update' && !doc.updateData.deleted){
                         gljClassModel.update({repositoryId: doc.updateData.repositoryId, ID: doc.updateData.ID}, doc.updateData, function (err) {
                             if(err){
                                 cb(err);
@@ -361,6 +332,23 @@ class GljDao  extends OprDao{
                             }
                         });
                     }
+                    else if(doc.updateType === 'update' && doc.updateData.deleted){
+                        gljClassModel.remove({repositoryId: doc.updateData.repositoryId, ID: doc.updateData.ID}, function (err) {
+                            if(err){
+                                cb(err);
+                            }
+                            else {
+                                gljModel.remove({repositoryId: doc.updateData.repositoryId, gljClass: doc.updateData.ID}, function (err) {
+                                    if(err){
+                                        cb(err);
+                                    }
+                                    else{
+                                        cb(null);
+                                    }
+                                });
+                            }
+                        });
+                    }
                     else if(doc.updateType === 'new'){
                         gljClassModel.create(doc.updateData, function (err) {
                             if(err){

+ 1 - 0
modules/users/controllers/compilation_controller.js

@@ -253,6 +253,7 @@ class CompilationController extends BaseController {
             feeRateList: JSON.stringify(feeRateList),
             billsTemplateData: JSON.stringify(billsTemplateData),
             mainTreeCol: JSON.stringify(libData.main_tree_col),
+            gljCol:JSON.stringify(libData.glj_col),
             calculationList: JSON.stringify(calculationList),
             billsGuidanceList: JSON.stringify(billsGuidanceList),
             layout: 'users/views/layout/layout'

+ 1 - 1
modules/users/models/bills_template_model.js

@@ -25,7 +25,7 @@ class BillsTemplateModel extends BaseModel {
      */
     async getTemplateData (valuationId, engineering) {
         // 筛选字段
-        let field = {_id: 1, valuationId: 1, ID: 1, ParentID: 1, NextSiblingID: 1, code: 1, name: 1, unit: 1, flags: 1, type: 1};
+        let field = {_id: 1, valuationId: 1, ID: 1, ParentID: 1, NextSiblingID: 1, code: 1, name: 1, unit: 1, flags: 1, type: 1,calcBase:1,feeRateID:1};
         let data = await this.findDataByCondition({valuationId: valuationId, engineering: engineering}, field, false);
         console.log(data);
         return data === null ? [] : data;

+ 3 - 0
modules/users/models/engineering_lib_model.js

@@ -67,6 +67,9 @@ class EngineeringLibModel extends BaseModel {
                 cols:[]
             }
         }
+        if(data.glj_col){
+            data.glj_col =  JSON.parse(data.glj_col);
+        }
 
         let result = false;
         data = this.filterLibData(data);

+ 1 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -31,6 +31,7 @@ var TREE_SHEET_HELPER = {
         spread.options.allowCopyPasteExcelStyle = false;
         spread.options.allowUserDragDrop = false;
         spread.options.allowContextMenu = false;
+        spread.options.showDragFillSmartTag = false;
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },

+ 1 - 1
web/maintain/billsGuidance_lib/html/main.html

@@ -122,8 +122,8 @@
                     <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
                 </div>
                 <div class="modal-footer">
+                    <a id="delY" href="javascript:void(0);" class="btn btn-danger">确认</a>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a id="delY" href="javascript:void(0);" class="btn btn-danger" data-dismiss="modal">删除</a>
                 </div>
             </div>
         </div>

+ 21 - 0
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -71,6 +71,27 @@
             </div>
         </div>
     </div>
+    <!--删除-->
+    <div class="modal fade" id="delAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
+        <input type="hidden"  value="123">
+        <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">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <h5 class="text-danger" id="delText">是否删除当前节点及其子项?</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-danger" id="delConfirm">确认</button>
+                    <button type="button" class="btn btn-secondary"  data-dismiss="modal">取消</button>
+                </div>
+            </div>
+        </div>
+    </div>
     <!-- JS. -->
     <script src="/lib/jquery/jquery.min.js"></script>
     <script src="/lib/tether/tether.min.js"></script>

+ 8 - 3
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -76,7 +76,8 @@ const billsGuidance = (function () {
     };
     const updateType = {
         create: 'create',
-        update: 'update'
+        update: 'update',
+        del: 'delete'
     };
     const guideItem = {
         dom: $('#guideItemSpread'),
@@ -554,7 +555,7 @@ const billsGuidance = (function () {
         let selected = bills.tree.selected.guidance.tree.selected;
         let updateDatas = [];
         function getDelDatas(node){
-            updateDatas.push({updateType: updateType.update, findData: {ID: node.getID()}, updateData: {deleted: true}});
+            updateDatas.push({updateType: updateType.del, findData: {ID: node.getID()}, updateData: {deleted: true}});
             if(node.children.length > 0){
                 for(let c of node.children){
                     getDelDatas(c);
@@ -728,8 +729,12 @@ const billsGuidance = (function () {
         $('#insert').click(function () {
             insert([{type: itemType.job, name: ''}]);
         });
-        $('#del').click(function () {
+        $('#delConfirm').click(function () {
             del();
+            $('#delAlert').modal('hide');
+        });
+        $('#del').click(function () {
+            $('#delAlert').modal('show');
         });
         $('#upLevel').click(function () {
             upLevel();

+ 27 - 11
web/maintain/billsGuidance_lib/js/main.js

@@ -12,6 +12,9 @@ const billsGuidanceMain = (function () {
     const updateType = {create: 'create', update: 'update', delete: 'delete'};
     let guidanceLibs = [];
     let curLib = null;
+    //上一个选择的库(三次确认删除同一库时用)
+    let preLib = null;
+    let deleteCount = 0;
 
     //获取编办及编办下清单库
     //@return {void}
@@ -171,6 +174,7 @@ const billsGuidanceMain = (function () {
         $('.main').find('tbody').on('click', '[data-target="#del"]', function () {
             let tr = $(this).parent().parent();
             curLib = existLib({k: 'ID', v: tr.attr('id')}, guidanceLibs);
+            console.log(curLib);
         });
         //删除确认
         $('#delY').click(function () {
@@ -178,23 +182,35 @@ const billsGuidanceMain = (function () {
                 if(!curLib){
                     throw '不存在该库!';
                 }
-                $.bootstrapLoading.start();
-                let updateData = {updateType: updateType.delete, findData: {ID: curLib.ID}, updateData: {deleted: true}};
-                CommonAjax.post('/billsGuidance/api/updateBillsGuideLib', updateData, function (rstData) {
-                    $(`#${curLib.ID}`).remove();
-                    curLib = null;
-                    _.remove(guidanceLibs, function (lib) {
-                        return lib.ID === updateData.findData.ID;
+                if(preLib && preLib.ID !== curLib.ID){
+                    deleteCount = 0;
+                }
+                deleteCount++;
+                preLib = curLib;
+                if(deleteCount === 3){
+                    $('#del').modal('hide');
+                    $.bootstrapLoading.start();
+                    let updateData = {updateType: updateType.delete, findData: {ID: curLib.ID}, updateData: {deleted: true}};
+                    CommonAjax.post('/billsGuidance/api/updateBillsGuideLib', updateData, function (rstData) {
+                        $(`#${curLib.ID}`).remove();
+                        curLib = null;
+                        _.remove(guidanceLibs, function (lib) {
+                            return lib.ID === updateData.findData.ID;
+                        });
+                        $.bootstrapLoading.end();
+                    }, function () {
+                        $.bootstrapLoading.end();
                     });
-                    $.bootstrapLoading.end();
-                }, function () {
-                    $.bootstrapLoading.end();
-                });
+                }
             }
             catch(err){
                 alert(err);
             }
         });
+        //删除确认窗口关闭,重新计数
+        $('#del').on('hidden.bs.modal', function () {
+            deleteCount = 0;
+        });
 
     }
 

+ 62 - 57
web/maintain/bills_lib/css/main.css

@@ -1,8 +1,7 @@
 /*building SAAS 0.1*/
 /*bootstrap 初始化*/
 body {
-    font-size: 0.9rem;
-    overflow: hidden;
+    font-size: 0.9rem
 }
 .dropdown-menu {
     font-size: 0.9rem
@@ -22,17 +21,17 @@ body {
     line-height: inherit
 }
 .top-msg{
-  position: fixed;
-  top:0;
-  width:100%;
-  z-index: 999
-}
-.in-1{padding-left:0px!important}
-.in-2{padding-left:21px!important}
-.in-3{padding-left:42px!important}
-.in-4{padding-left:63px!important}
-.in-5{padding-left:84px!important}
-.in-6{padding-left:105px!important}
+    position: fixed;
+    top:0;
+    width:100%;
+    z-index: 999
+}
+.in-1{padding-left:0rem!important}
+.in-2{padding-left:1rem!important}
+.in-3{padding-left:1.5rem!important}
+.in-4{padding-left:2rem!important}
+.in-5{padding-left:2.5rem!important}
+.in-6{padding-left:3rem!important}
 .main {
     position: relative;
     background: #f7f7f9;
@@ -63,12 +62,7 @@ body {
     background: #fff;
     color: #333
 }
-.main-nav .nav-tabs{
-  border-bottom: none
-}
 .content {
-    border-left: 1px solid #ccc;
-    margin-left: 29px;
     background: #fff
 }
 .tools-btn {
@@ -79,27 +73,34 @@ body {
     background: #f7f7f9;
 }
 .main-side {
-    border-top: 1px solid #ccc;
-    border-left: 1px solid #ccc;
-    overflow-y: hidden;
+    border-right: 1px solid #ccc;
+    overflow:hidden;
 }
-.sidebar-bottom,.sidebar-bottom .col-lg-6,.sidebar-bottom .col-lg-12 {
-  height:200px
+.main-side .tab-bar {
+    padding:5px 10px;
+    height:38px;
+    position:fixed;
+}
+.main-side .tab-content {
+    margin-top: 38px
 }
 .top-content, .fluid-content {
-    overflow: auto;
+    overflow: hidden;
     border-bottom: 1px solid #ccc;
 }
-.bottom-content .nav {
+.warp-p2 {
+    padding: 2px
+}
+.bottom-content .nav,.top-content .nav {
     background: #f7f7f9;
     padding:0 0 0 2px
 }
-.bottom-content .nav-tabs .nav-link, .side-tabs .nav-tabs .nav-link {
+.bottom-content .nav-tabs .nav-link, .side-tabs .nav-tabs .nav-link,.top-content .nav-tabs .nav-link {
     border-radius: 0;
     padding: 0.2em 0.5em
 }
 .side-tabs .nav-tabs .nav-item {
-  z-index: 999
+    z-index: 999
 }
 .side-tabs .nav-tabs {
     border-bottom: none;
@@ -211,13 +212,14 @@ body {
         transform: translateX(10px);
     }
 }
+.bottom-content {
+    height: 370px;
+    overflow: hidden;
+}
 .bottom-content .tab-content .main-data-bottom{
-    height: 200px;
+    height: 340px;
     overflow: auto;
 }
-.bottom-content .tab-content .ovf-hidden{
-    overflow: hidden;
-}
 .form-signin {
     max-width: 500px;
     margin: 150px auto;
@@ -226,49 +228,52 @@ body {
     overflow: auto;
 }
 .poj-list span.poj-icon {
-  padding-right:7px;
-  color:#ccc
-}
-.poj-list a.tree-open,.poj-list a.tree-close{
-  width:15px;
-  display: inline-block;
+    padding-right:10px;
+    color:#ccc
 }
 .print-toolsbar{
-  padding:5px
+    padding:5px
 }
 .print-toolsbar .panel {
-  display:inline-block;
-  vertical-align:top;
-  background:#f7f7f9
+    display:inline-block;
+    vertical-align:top;
+    background:#f7f7f9
 }
 .print-toolsbar .panel .panel-foot{
-  text-align: center;
-  font-size: 12px
+    text-align: center;
+    font-size: 12px
 }
 .print-list {
-  border-right:1px solid #ccc
+    border-right:1px solid #ccc
 }
 .print-list .form-list {
-  overflow: auto
+    overflow: auto
 }
 .print-list .list-tools{
-  height:50px;
-  padding:10px 0;
-  border-bottom:1px solid #f2f2f2
+    height:50px;
+    padding:10px 0;
+    border-bottom:1px solid #f2f2f2
 }
 .pageContainer {
-  background: #ededed;
-  text-align: center
+    background: #ededed;
+    text-align: center
 }
 .pageContainer .page{
-  border:9px solid transparent;
-  display: inline-block;
+    border:9px solid transparent;
+    display: inline-block;
 }
 .pageContainer .page img{
-  width:inherit;
-  height: inherit;
+    width:inherit;
+    height: inherit;
 }
-.modal-fixed-height {
-  height: 400px;
-  overflow-y: auto;
+.codeList{
+    max-height: 200px;
+    overflow:auto;
 }
+.main-data-top,.main-data-bottom,.main-data{
+    overflow: hidden;
+}
+.modal-fixed-height {
+    height:400px;
+    overflow-y:auto;
+}

+ 15 - 2
web/maintain/bills_lib/html/main.html

@@ -114,8 +114,8 @@
                     <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
                 </div>
                 <div class="modal-footer">
+                    <a id="deleteA" href="javascript:void(0);" class="btn btn-danger" deleteId="">确认</a>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a id="deleteA" href="javascript:void(0);" class="btn btn-danger" data-dismiss="modal" deleteId="">删除</a>
                 </div>
             </div>
         </div>
@@ -134,6 +134,8 @@
 </script>
 <script>
     let userAccount = '<%= userAccount %>';
+    let deleteCount = 0;
+    let preDeleteId = null;
     mainAjax.getCompilationList();
     mainAjax.getStdBillsLib();
     $(document).ready(function(){
@@ -160,7 +162,18 @@
        });
         $("#deleteA").click(function(){
             let deleteId = $(this).attr("deleteId");
-            mainAjax.deleteStdBillsLib(userAccount, deleteId);
+            if(preDeleteId && preDeleteId !== deleteId){
+                deleteCount = 0;
+            }
+            preDeleteId = deleteId;
+            deleteCount++;
+            if(deleteCount === 3){
+                mainAjax.deleteStdBillsLib(userAccount, deleteId);
+                deleteCount = 0;
+            }
+        });
+        $('#del').on('hidden.bs.modal', function () {
+            deleteCount = 0;
         });
 
        $("#showArea").on("click", "[data-target = '#edit']", function(){

File diff suppressed because it is too large
+ 21 - 0
web/maintain/bills_lib/html/neirong.html


File diff suppressed because it is too large
+ 27 - 1
web/maintain/bills_lib/html/qingdan.html


File diff suppressed because it is too large
+ 21 - 0
web/maintain/bills_lib/html/tezheng.html


+ 1 - 0
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -141,6 +141,7 @@ var mainAjax = {
                 if(!result.error){
                     var jqSel = "#"+billsLibId;
                     $(jqSel).remove();
+                    $('#del').modal('hide');
                 }
             }
         });

+ 11 - 3
web/maintain/bills_lib/scripts/set_sheets.js

@@ -164,8 +164,7 @@ var myKey = {
         }
 
         function bindTotalJobDel(spread, billsIds, totalJobs, setting){
-            var sheet = spread.getActiveSheet();
-            spread.commandManager().register('myJobDelete', function(){
+            $('#delConfirm').click(function () {
                 spread.suspendEvent();
                 var ids = tools.delIds(sheet);
                 if(ids.length > 0){
@@ -184,6 +183,11 @@ var myKey = {
                     billsAjax.removeTotal(userAccount, billsLibId, billsIds, ids, 'jobs');
                 }
                 spread.resumeEvent();
+                $('#delAlert').modal('hide');
+            });
+            var sheet = spread.getActiveSheet();
+            spread.commandManager().register('myJobDelete', function(){
+                $('#delAlert').modal('show');
             });
             spread.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
             spread.commandManager().setShortcutKey('myJobDelete', GC.Spread.Commands.Key.del, false, false, false, false)
@@ -191,7 +195,7 @@ var myKey = {
 
         function bindTotalItemDel(spread, valSheet, billsIds, totalItems, setting){
             var sheet = spread.getActiveSheet();
-            spread.commandManager().register('myItemDelete', function(){
+            $('#delConfirm').click(function () {
                 spread.suspendEvent();
                 var ids = tools.delIds(sheet);
                 if(ids.length > 0){
@@ -218,6 +222,10 @@ var myKey = {
                     }
                 }
                 spread.resumeEvent();
+                $('#delAlert').modal('hide');
+            });
+            spread.commandManager().register('myItemDelete', function(){
+                $('#delAlert').modal('show');
             });
             spread.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
             spread.commandManager().setShortcutKey('myItemDelete', GC.Spread.Commands.Key.del, false, false, false, false)

+ 20 - 1
web/maintain/ration_repository/anzhuang.html

@@ -140,7 +140,26 @@
             </div>
         </div>
     </div>
-
+    <div class="modal fade" id="delAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
+        <input type="hidden"  value="123">
+        <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">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <h5 class="text-danger" id="delText">是否删除当前节点及其子项?</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-danger" id="delConfirm">确认</button>
+                    <button type="button" class="btn btn-secondary"  data-dismiss="modal">取消</button>
+                </div>
+            </div>
+        </div>
+    </div>
     <!-- JS. -->
     <!-- JS. -->
     <script src = "/lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js"></script>

File diff suppressed because it is too large
+ 21 - 0
web/maintain/ration_repository/dinge.html


+ 95 - 56
web/maintain/ration_repository/js/installation.js

@@ -12,7 +12,92 @@ $(document).ready(function () {
     $('#sectionTreeModal').on('hidden.bs.modal', function () {
         batchSectionObj.clearChecked();
     });
+    $('#delConfirm').click(function () {
+        if(curDeleteType === feeItemObj.deleteType){
+            let me = feeItemObj, se = sectionObj, fr = feeRuleObj;
+            let fiPostData = [], sePostData = [];
+            let sels = me.workBook.getSheet(0).getSelections();
+            for(let i = 0, len = sels.length; i < len; i++){
+                let sel = sels[i];
+                //delete
+                if(sel.colCount === me.setting.header.length){
+                    for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
+                        let row = sel.row + j;
+                        let feeItem = me.cache[row];
+                        //有数据,删除数据
+                        if(me.isDef(feeItem)){
+                            fiPostData.push({updateType: me.updateType.update, updateData: {ID: feeItem.ID, deleted: true}});
+                            //delete feeItem section
+                            for(let section of feeItem.section){
+                                sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
+                            }
+                        }
+                    }
+                    //front delete
+                    me.cache.splice(sel.row, sel.rowCount);
+                }
+            }
+            //update currentFeeItem
+            me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
+            se.cache = me.isDef(me.currentFeeItem) ? me.currentFeeItem.section : [];
+            if(fiPostData.length > 0){
+                me.updateFeeItem(fiPostData, function () {
+                    me.sheet.setRowCount(me.cache.length + 10);
+                    sheetCommonObj.showData(me.sheet, me.setting, me.cache);
+                    $('#delAlert').modal('hide');
+                });
+                if(sePostData.length > 0){
+                    se.updateSection(sePostData);
+                }
+                sheetCommonObj.cleanData(se.sheet, se.setting, 10);
+                sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
+            }
+            else {
+                $('#delAlert').modal('hide');
+            }
+        }
+        else if(curDeleteType === sectionObj.deleteType){
+            let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
+            let sePostData = [], fiPostData = [];
+            let sels = me.workBook.getSheet(0).getSelections();
+            for(let i = 0, len = sels.length; i < len; i++){
+                let sel = sels[i];
+                //delete
+                if(sel.colCount === me.setting.header.length){
+                    for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
+                        let row = sel.row + j;
+                        let section = me.cache[row];
+                        //有数据,删除数据
+                        if(me.isDef(section)){
+                            sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
+                            fiPostData.push({updateType: me.updateType.update, updateData: {ID: fi.currentFeeItem.ID, $pull: {section: {ID: section.ID}}}});
+                        }
+                    }
+                    //front delete
+                    me.cache.splice(sel.row, sel.rowCount);
+                }
+            }
+            //update currentSection
+            me.currentSection = fi.getCurrentData(me.sheet, me.cache);
+            fr.cache = me.isDef(me.currentSection) ? me.currentSection.feeRule : [];
+            if(sePostData.length > 0){
+                me.updateSection(sePostData, function () {
+                    me.sheet.setRowCount(me.cache.length + 5);
+                    sheetCommonObj.showData(me.sheet, me.setting, me.cache);
+                    $('#delAlert').modal('hide');
+                });
+                if(fiPostData.length > 0){
+                    fi.updateFeeItem(fiPostData);
+                }
+                sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
+            }
+            else{
+                $('#delAlert').modal('hide');
+            }
+        }
+    });
 });
+let curDeleteType = null;
 //费用项
 let feeItemObj = {
     rationRepId: null,
@@ -22,6 +107,7 @@ let feeItemObj = {
     currentFeeItem: null,
     feeType: {ZM: '子目费用', FX: '分项费用', CS: '措施费用'},
     updateType: {update: 'update', new: 'new'},
+    deleteType: 'feeItem',
     setting: {
         header:[
             {headerName:"费用项",headerWidth:300,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
@@ -225,43 +311,17 @@ let feeItemObj = {
         }
     },
     feeItemDelOpr: function () {
-        let me = feeItemObj, se = sectionObj, fr = feeRuleObj;
-        let fiPostData = [], sePostData = [];
+        let me = this;
         me.workBook.commandManager().register('feeItemDel', function () {
+            curDeleteType = me.deleteType;
             let sels = me.workBook.getSheet(0).getSelections();
             for(let i = 0, len = sels.length; i < len; i++){
                 let sel = sels[i];
                 //delete
                 if(sel.colCount === me.setting.header.length){
-                    for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
-                        let row = sel.row + j;
-                        let feeItem = me.cache[row];
-                        //有数据,删除数据
-                        if(me.isDef(feeItem)){
-                            fiPostData.push({updateType: me.updateType.update, updateData: {ID: feeItem.ID, deleted: true}});
-                            //delete feeItem section
-                            for(let section of feeItem.section){
-                                sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
-                            }
-                        }
-                    }
-                    //front delete
-                    me.cache.splice(sel.row, sel.rowCount);
-                }
-            }
-            //update currentFeeItem
-            me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
-            se.cache = me.isDef(me.currentFeeItem) ? me.currentFeeItem.section : [];
-            if(fiPostData.length > 0){
-                me.updateFeeItem(fiPostData, function () {
-                    me.sheet.setRowCount(me.cache.length + 10);
-                    sheetCommonObj.showData(me.sheet, me.setting, me.cache);
-                });
-                if(sePostData.length > 0){
-                    se.updateSection(sePostData);
+                    $('#delAlert').modal('show');
+                    break;
                 }
-                sheetCommonObj.cleanData(se.sheet, se.setting, 10);
-                sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
             }
         });
         me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
@@ -313,6 +373,7 @@ let sectionObj = {
     cache: [],
     currentSection: null,
     updateType: {update: 'update', new: 'new'},
+    deleteType: 'section',
     setting: {
         header:[
             {headerName:"分册章节",headerWidth:600,dataCode:"name", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
@@ -510,39 +571,17 @@ let sectionObj = {
         }
     },
     sectionDelOpr: function () {
-        let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
-        let sePostData = [], fiPostData = [];
+        let me = this;
         me.workBook.commandManager().register('sectionDel', function () {
+            curDeleteType = me.deleteType;
             let sels = me.workBook.getSheet(0).getSelections();
             for(let i = 0, len = sels.length; i < len; i++){
                 let sel = sels[i];
                 //delete
                 if(sel.colCount === me.setting.header.length){
-                    for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
-                        let row = sel.row + j;
-                        let section = me.cache[row];
-                        //有数据,删除数据
-                        if(me.isDef(section)){
-                            sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
-                            fiPostData.push({updateType: me.updateType.update, updateData: {ID: fi.currentFeeItem.ID, $pull: {section: {ID: section.ID}}}});
-                        }
-                    }
-                    //front delete
-                    me.cache.splice(sel.row, sel.rowCount);
-                }
-            }
-            //update currentSection
-            me.currentSection = fi.getCurrentData(me.sheet, me.cache);
-            fr.cache = me.isDef(me.currentSection) ? me.currentSection.feeRule : [];
-            if(sePostData.length > 0){
-                me.updateSection(sePostData, function () {
-                    me.sheet.setRowCount(me.cache.length + 5);
-                    sheetCommonObj.showData(me.sheet, me.setting, me.cache);
-                });
-                if(fiPostData.length > 0){
-                    fi.updateFeeItem(fiPostData);
+                    $('#delAlert').modal('show');
+                    break;
                 }
-                sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
             }
         });
         me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);

+ 15 - 1
web/maintain/ration_repository/js/main.js

@@ -4,6 +4,11 @@
 
 $(function () {
     let dispNameArr;
+    let preDeleteId = null;
+    let deleteCount = 0;
+    $('#del').on('hidden.bs.modal', function () {
+        deleteCount = 0;
+    });
     getAllRationLib(function (dispNames) {
         dispNameArr = dispNames;
         //添加
@@ -68,9 +73,18 @@ $(function () {
         });
         $("#deleteA").click(function(){
             let deleteId = $(this).attr("deleteId");
+            if(preDeleteId && preDeleteId !== deleteId){
+                deleteCount = 0;
+            }
+            preDeleteId = deleteId;
+            deleteCount++;
             let jqSel = "#" + deleteId + " td:first" + " a";
             let libName = $(jqSel).text();
-            removeRationLib({libId: deleteId, libName: libName}, dispNameArr);
+            if(deleteCount === 3){
+                deleteCount = 0;
+                removeRationLib({libId: deleteId, libName: libName}, dispNameArr);
+                $('#del').modal('hide');
+            }
         });
 
 

+ 6 - 2
web/maintain/ration_repository/js/section_tree.js

@@ -270,8 +270,11 @@ let sectionTreeObj = {
         me.insertBtn.click(function () {
             me.insert();
         });
+        $('#delConfirm').click(function () {
+            me.remove(me.tree.selected);
+        });
         me.removeBtn.click(function () {
-           me.remove(me.tree.selected);
+            $('#delAlert').modal('show');
         });
         me.upLevelBtn.click(function () {
             me.upLevel(me.tree.selected);
@@ -288,7 +291,7 @@ let sectionTreeObj = {
     },
     
     insert: function () {
-        let me = this;
+        let me = sectionTreeObj;
         me.insertBtn.addClass('disabled');
         let postData = [];
         CommonAjax.post('api/getNewRationTreeID', {}, function (newID) {
@@ -351,6 +354,7 @@ let sectionTreeObj = {
         if(postData.length > 0){
             //ajax
             me.sectionTreeAjax(postData, function (rstData) {
+                $('#delAlert').modal('hide');
                 me.removeRationsCodes(rationOprObj.currentRations["_SEC_ID_" + selected.data.ID]);
                 me.controller.delete();
                 me.refreshBtn(me.tree.selected);

+ 1 - 3
web/maintain/ration_repository/main.html

@@ -145,10 +145,8 @@
                     <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
                 </div>
                 <div class="modal-footer">
-                    <!--<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a href="" id="deleteLib" class="btn btn-danger">删除</a>-->
+                    <a id="deleteA" href="javascript: void(0);" class="btn btn-danger">确认</a>
                     <button id="delCancelBtn" type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a id="deleteA" href="javascript: void(0);" class="btn btn-danger">删除</a>
                 </div>
             </div>
         </div>

+ 21 - 1
web/maintain/std_glj_lib/html/gongliao.html

@@ -140,7 +140,27 @@
             </div>
         </div>
     </div>
-
+    <!--删除-->
+    <div class="modal fade" id="delAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
+        <input type="hidden"  value="123">
+        <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">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <h5 class="text-danger" id="delText">是否删除当前节点及其子项?</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-danger" id="delConfirm">确认</button>
+                    <button type="button" class="btn btn-secondary"  data-dismiss="modal">取消</button>
+                </div>
+            </div>
+        </div>
+    </div>
     <!-- JS. -->
     <script src="/lib/jquery/jquery.min.js"></script>
     <script src="/lib/jquery-contextmenu/jquery.contextMenu.min.js"></script>

+ 2 - 1
web/maintain/std_glj_lib/html/main.html

@@ -119,8 +119,8 @@
                     <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
                 </div>
                 <div class="modal-footer">
+                    <a id="deleteA" href="javascript: void(0);" class="btn btn-danger">确认</a>
                     <button id="delCancelBtn" type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a id="deleteA" href="javascript: void(0);" class="btn btn-danger">删除</a>
                 </div>
             </div>
         </div>
@@ -131,6 +131,7 @@
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/web/maintain/std_glj_lib/js/global.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/PerfectLoad.js"></script>
     <!-- zTree -->
   	<script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>
   	<script type="text/javascript" src="/lib/ztree/jquery.ztree.excheck.js"></script>

+ 25 - 20
web/maintain/std_glj_lib/js/glj.js

@@ -212,6 +212,7 @@ let repositoryGljObj = {
             sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, false, 'text');
             sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 7, me.workBook.getActiveSheet().getRowCount(), me.materialType.comboItems, false, 'text');
             cacheSection = null;
+            me.initSel(0);
         }
     },
     buildSheet: function(container) {
@@ -320,31 +321,35 @@ let repositoryGljObj = {
             }
         }
     },
+    initSel: function (row) {
+        let me = repositoryGljObj, that = gljComponentOprObj;
+        sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, -1);
+        me.workBook.focus(true);
+        me.currentComponent = [];
+        that.workBook.getSheet(0).setRowCount(10);
+        if(row < me.currentCache.length){
+            //标记当前工料机
+            me.currentGlj = me.currentCache[row];
+            if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
+                //展示数据
+                if(me.currentGlj.component.length > 0){
+                    me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
+                    if(me.currentComponent.length > 0){
+                        sheetsOprObj.showData(that.workBook.getSheet(0), that.setting, me.currentComponent);
+                    }
+                }
+            }
+        }
+        else{
+            me.currentGlj = null;
+        }
+    },
     onSelectionChanged: function (sender, info) {
         let me = repositoryGljObj, that = gljComponentOprObj;
         //混凝土202、砂浆203、配合比204、机械3
         if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
             let row = info.newSelections[0].row;
-            sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, -1);
-            me.workBook.focus(true);
-            me.currentComponent = [];
-            that.workBook.getSheet(0).setRowCount(10);
-            if(row < me.currentCache.length){
-                //标记当前工料机
-                me.currentGlj = me.currentCache[row];
-                if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
-                    //展示数据
-                    if(me.currentGlj.component.length > 0){
-                        me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
-                        if(me.currentComponent.length > 0){
-                            sheetsOprObj.showData(that.workBook.getSheet(0), that.setting, me.currentComponent);
-                        }
-                    }
-                }
-            }
-            else{
-                me.currentGlj = null;
-            }
+            me.initSel(row);
         }
     },
     onLeaveCell: function (sender, args) {

+ 9 - 5
web/maintain/std_glj_lib/js/gljClassTree.js

@@ -239,8 +239,12 @@ let gljClassTreeObj = {
         me.insertBtn.click(function () {
             me.insert();
         });
-        me.removeBtn.click(function () {
+        $('#delConfirm').click(function () {
             me.remove(me.tree.selected);
+            $('#delAlert').modal('hide');
+        });
+        me.removeBtn.click(function () {
+            $('#delAlert').modal('show');
         });
         me.upLevelBtn.click(function () {
             me.upLevel(me.tree.selected);
@@ -282,8 +286,8 @@ let gljClassTreeObj = {
                 me.controller.insert();
                 me.refreshBtn(me.tree.selected);
                 //fresh tools
-                me.initTools(me.tree.selected);
                 re.updateParentNodeIds(me.cache, re);
+                me.initSelection(me.tree.selected);
             });
         }
     },
@@ -321,8 +325,9 @@ let gljClassTreeObj = {
             me.gljClassTreeAjax(postData, function (rstData) {
                 me.controller.delete();
                 me.refreshBtn(me.tree.selected);
-                me.initTools(me.tree.selected);
                 re.updateParentNodeIds(me.cache, re);
+                me.initSelection(me.tree.selected);
+                me.workBook.getActiveSheet().setActiveCell(me.tree.selected ? me.tree.selected.serialNo() : 0, 0);
             });
         }
     },
@@ -479,11 +484,10 @@ let gljClassTreeObj = {
         let me = this,
             re = repositoryGljObj,
             that = gljComponentOprObj;
+        me.refreshBtn(node);
         if(!re.isDef(node)){
             return;
         }
-        me.refreshBtn(node);
-
         let gljTypeId = node.data.ID;
         re.gljCurTypeId = node.data.ID;
         re.addGljObj = null;

+ 25 - 6
web/maintain/std_glj_lib/js/main.js

@@ -5,6 +5,11 @@ $(function () {
     let dispNameArr;
     let compilationsArr;
     let usedCom;
+    let deleteCount = 0;
+    let preDeleteId = null;
+    $('#del').on('hidden.bs.modal', function () {
+        deleteCount = 0;
+    });
     getCompilationList(function (datas) {
         compilationsArr = datas;
         getAllGljLib(function (dispNames, compilationsUsedArr) {
@@ -72,16 +77,24 @@ $(function () {
             });
             $("#deleteA").click(function(){
                 let deleteId = $(this).attr("deleteId");
+                if(preDeleteId && preDeleteId !== deleteId){
+                    deleteCount = 0;
+                }
+                preDeleteId = deleteId;
+                deleteCount++;
                 let jqSel = "#" + deleteId + " td:first" + " a";
                 let libName = $(jqSel).text();
                 let compilationName = $("#" + deleteId + " td:eq(1)").text();
-                for(let i = 0, len = compilationsArr.length; i < len; i++){
-                    if(compilationsArr[i].name === compilationName.trim()){
-                        usedCom.splice(usedCom.indexOf(compilationsArr[i]._id), 1);
-                        break;
+                if(deleteCount === 3){
+                    for(let i = 0, len = compilationsArr.length; i < len; i++){
+                        if(compilationsArr[i].name === compilationName.trim()){
+                            usedCom.splice(usedCom.indexOf(compilationsArr[i]._id), 1);
+                            break;
+                        }
                     }
+                    removeGljLib({libId: deleteId, libName: libName}, dispNameArr);
+                    deleteCount = 0;
                 }
-                removeGljLib({libId: deleteId, libName: libName}, dispNameArr);
             });
 
 
@@ -197,6 +210,7 @@ function renameGljLib(renameObj, dispNames){
     })
 }
 function removeGljLib(delObj, dispNames){
+    $.bootstrapLoading.start();
     $.ajax({
         type: 'post',
         url: 'api/removeGljLib',
@@ -204,7 +218,7 @@ function removeGljLib(delObj, dispNames){
         dataType: 'json',
         success: function (result) {
             if(!result.error){
-                if(result.message === '人材机库已被引用!'){
+                if(result.message === '人材机库已被引用!'){
                     $('#delCancelBtn').click();
                     alert("此人材机库已被引用,不可删除!");
                 }
@@ -216,6 +230,11 @@ function removeGljLib(delObj, dispNames){
                     $('#delCancelBtn').click();
                 }
             }
+            $.bootstrapLoading.end();
+        },
+        error: function () {
+            alert('服务器出错!');
+            $.bootstrapLoading.end();
         }
     })
 }

+ 19 - 0
web/users/js/col_setting.js

@@ -320,6 +320,25 @@ $('#set-column').on('shown.bs.modal', function () {
         ColSettingObj.initColSetting(ColSettingObj.colSetting);
     }
 });
+
+$('#set-glj-col').on('show.bs.modal', function () {
+    let glj_col_setting = JSON.parse($("#glj_col").val());
+    if(glj_col_setting.showAdjustPrice){
+        $('#adjustPrice_cb').prop('checked',true);
+    }else {
+        $('#adjustPrice_cb').prop('checked',false);
+    }
+});
+
+$('#set-glj-comf').click(function () {
+
+    let showAdjustPrice =  $('#adjustPrice_cb').prop('checked');
+    let glj_col_setting = {
+        showAdjustPrice :showAdjustPrice
+    };
+    $("#glj_col").val(JSON.stringify(glj_col_setting));
+});
+
 $('#col-count').change(function () {
     ColSettingObj.setColCount(parseInt($(this).val()));
 });

+ 108 - 23
web/users/js/template.js

@@ -94,6 +94,41 @@ let TEMPLATE_BILLS_SETTING = {
             "font":"Arail",
         }
     }, {
+        "width":250,
+        "readOnly":false,
+        "head":{
+            "titleNames":["计算基数"],
+            "spanCols":[1],
+            "spanRows":[1],
+            "vAlign":[1],
+            "hAlign":[1],
+            "font":["Arial"]
+        },
+        "data":{
+            "field":"calcBase",
+            "vAlign":0,
+            "hAlign":3,
+            "font":"Arail",
+        }
+    }, {
+        "width":50,
+        "readOnly":false,
+        "head":{
+            "titleNames":["费率ID"],
+            "spanCols":[1],
+            "spanRows":[1],
+            "vAlign":[1],
+            "hAlign":[1],
+            "font":["Arial"]
+        },
+        "data":{
+            "field":"feeRateID",
+            "type":'Number',
+            "vAlign":0,
+            "hAlign":1,
+            "font":"Arail"
+        }
+    }, {
         "width":50,
         "readOnly":true,
         "head":{
@@ -161,7 +196,7 @@ $(document).ready(function () {
         showButton(tree.selected && tree.selected.canUpMove(), $('#upMove'));
         showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
         showButton(tree.selected ? true : false, $('#delete'));
-    }
+    };
     let RefreshBillsData = function (datas) {
         datas.forEach(function (data) {
             let node = tree.findNode(data.data.ID);
@@ -179,11 +214,19 @@ $(document).ready(function () {
         combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value)
             .items(comboItems);
         return combo;
-    }
+    };
     let getFixedFlagCellType = function () {
         let billsFixedFlagData = JSON.parse(billsFixedFlagList);
         return getNameValueComboCellType(billsFixedFlagData);
     };
+    let getNameToValueMap = function (listString) {
+        let map = {};
+        let datas = JSON.parse(listString);
+        for(let data of datas){
+            map[data.name] = data.value;
+        }
+        return map;
+    };
     let getTypeFlagCellType = function () {
         let billsTypeFlagData = JSON.parse(billsTypeFlagList);
         return getNameValueComboCellType(billsTypeFlagData);
@@ -206,7 +249,30 @@ $(document).ready(function () {
                 valueField = valueField[fields[i]];
             }
         }
-    }
+    };
+    let getRealValue = function (value,map) {//中文到实际值的转换
+        value = value.replace(/[\s\r\n]/g, "");//去掉空格,回车等无用字符
+        if(map[value]!==undefined && map[value]!==null) value = map[value];
+        return value;
+    };
+    let setUpdateData = function (node,data,col,value,setting) {
+        let fieldName = setting.cols[col].data.field;
+        let valueType = setting.cols[col].data.type;
+        if(fieldName == 'type'){
+            value = getRealValue(value,typeMap);
+        }
+        if(fieldName == 'flagsIndex.fixed.flag'){
+            value = getRealValue(value,fixedFlagMap);
+        }
+        if (/flagsIndex/.test(fieldName)) {
+            data.data.flags = [];
+            let flagField = fieldName.split('.');
+            data.data.flags.push({fieldName: flagField[1],flag: value});
+        } else {
+            if(valueType == 'Number') value = parseInt(value);
+            setFee(data.data, fieldName, value);
+        }
+    };
 
     billsTemplateData = billsTemplateData.replace(/\n/g, '\\n');
     let templateData = JSON.parse(billsTemplateData);
@@ -230,6 +296,10 @@ $(document).ready(function () {
     let tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
     let billsSpread = TREE_SHEET_HELPER.createNewSpread($('#billsSpread')[0]);
     let controller = TREE_SHEET_CONTROLLER.createNew(tree, billsSpread.getActiveSheet(), TEMPLATE_BILLS_SETTING);
+    let fixedFlagMap = getNameToValueMap(billsFixedFlagList);
+    let typeMap = getNameToValueMap(billsTypeFlagList);
+    console.log(fixedFlagMap);
+    console.log(typeMap);
     //format code
     //billsSpread.getSheet(0).setFormatter(-1, 1, '@');
     controller.bind('refreshBaseActn', RefreshBaseActn);
@@ -237,25 +307,33 @@ $(document).ready(function () {
     billsSpread.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, info) {
         var node = controller.tree.items[info.row];
         var fieldName = controller.setting.cols[info.col].data.field;
-        var data = {type: 'update', data: {ID: node.getID()}};
-       if (/flagsIndex/.test(fieldName)) {
-            data.data.flags = [];
-            let flagField = fieldName.split('.');
-            data.data.flags.push({fieldName: flagField[1], flag: info.editingText});
-        } else {
-            setFee(data.data, fieldName, info.editingText);
+        var valueType = controller.setting.cols[info.col].data.type;
+        let value = info.editingText;
+        if(node){
+            var data = {type: 'update', data: {ID: node.getID()}};
+            if (/flagsIndex/.test(fieldName)) {
+                data.data.flags = [];
+                let flagField = fieldName.split('.');
+                data.data.flags.push({fieldName: flagField[1], flag: info.editingText});
+            } else {
+                if(valueType == 'Number') value = parseInt(info.editingText);
+                setFee(data.data, fieldName, value);
+            }
+            var updateData = [data];
+            CommonAjax.post(updateUrl, updateData, function (data) {
+                setFee(node.data, fieldName, value);
+                controller.refreshTreeNode([node], false);
+            }, function () {
+                controller.refreshTreeNode([node], false);
+            });
+        }else {
+           info.sheet.getCell(info.row,info.col).value("");
         }
-        var updateData = [data];
-        CommonAjax.post(updateUrl, updateData, function (data) {
-            setFee(node.data, fieldName, info.editingText);
-            controller.refreshTreeNode([node], false);
-        }, function () {
-            controller.refreshTreeNode([node], false);
-        });
+
     });
     billsSpread.bind(GC.Spread.Sheets.Events.ClipboardPasted, function (e, info) {
         console.log("ClipboardPasted");
-        var node, iRow, iCol, curRow, curCol, datas = [], data, fieldName, updateData;
+        var node, iRow, iCol, curRow, curCol, datas = [], data, fieldName,valueType,value, updateData;
         for (iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
             curRow = info.cellRange.row + iRow;
             node = controller.tree.items[curRow];
@@ -263,15 +341,20 @@ $(document).ready(function () {
                 data = {type: 'update', data: {ID: node.getID()}};
                 for (iCol = 0; iCol < info.cellRange.colCount; iCol++) {
                     curCol = info.cellRange.col + iCol;
+                    value = info.sheet.getText(curRow, curCol);
+                   /* curCol = info.cellRange.col + iCol;
                     fieldName = controller.setting.cols[curCol].data.field;
-
+                    valueType = controller.setting.cols[curCol].data.type;
+                    value = info.sheet.getText(curRow, curCol);
                     if (/flagsIndex/.test(fieldName)) {
                         data.data.flags = [];
                         let flagField = fieldName.split('.');
-                        data.data.flags.push({fieldName: flagField[1],flag: info.sheet.getText(curRow, curCol)});
+                        data.data.flags.push({fieldName: flagField[1],flag: value});
                     } else {
-                        setFee(data.data, fieldName, info.sheet.getText(curRow, curCol));
-                    }
+                        if(valueType == 'Number') value = parseInt(value);
+                        setFee(data.data, fieldName, value);
+                    }*/
+                    setUpdateData(node,data,curCol,value,controller.setting);
                 }
                 datas.push(data);
             }
@@ -283,7 +366,9 @@ $(document).ready(function () {
             controller.showTreeData();
         });
     });
-
+    billsSpread.bind(GC.Spread.Sheets.Events.RangeChanged, function (e,info) {
+        console.log(info);
+    });
     tree.loadDatas(templateData);
     controller.showTreeData();
     RefreshBaseActn(tree);

+ 4 - 2
web/users/views/compilation/engineering.html

@@ -144,14 +144,16 @@
                     </div>
                     <div class="col-md-12">
                         <legend>清单模板 / 造价书列</legend>
-                        <a href="javascript:void(0)" data-toggle="modal" data-target="#set-column" class="btn btn-primary btn-sm pull-right">设置</a>
+                        <a data-toggle="modal" data-target="#set-column" class="btn btn-primary btn-sm pull-right">设置</a>
                         <a href="/compilation/template/<%= section %>/<%= valuationId %>/<%= engineeringInfo.id%>"
                                data-toggle="modal" data-target="" class="btn btn-primary btn-sm pull-right"
                                style="margin-right:5px">模板设置</a>
+                        <a data-toggle="modal" data-target="#set-glj-col" class="btn btn-primary btn-sm pull-right" style="margin-right:5px">人材机列</a>
                         <input type="hidden" name="main_tree_col" value="<%= mainTreeCol %>">
                         <div id="main-tree-col" style="height: 400px;"></div>
                     </div>
                 </div>
+                <input type="hidden" name="glj_col" value="<%= gljCol %>" id="glj_col">
                 <input type="hidden" name="engineering" value="<%= engineeringInfo.id %>" id="engineering">
                 <input type="hidden" name="section" value="<%= section %>" id="section">
                 <input type="hidden" name="id" value="<%= valuationId %>">
@@ -169,7 +171,7 @@
     let mainTreeCol = '<%- mainTreeCol %>';
     let billsTemplateData = '<%- billsTemplateData %>';
     let billsGuidanceList = '<%- billsGuidanceList %>';
-    let colSpread = null;
+    let gljCol = '<%- gljCol %>';    let colSpread = null;
     let colEditSpread = null;
 </script>
 <script type="text/javascript" src="/public/web/id_tree.js"></script>

+ 29 - 0
web/users/views/compilation/modal.html

@@ -213,4 +213,33 @@
         </div>
     </div>
 </div>
+
+<!-- 弹窗人材机列设置 -->
+<div class="modal fade" id="set-glj-col" tabindex="-1" role="dialog">
+    <div class="modal-dialog " role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                <h4 class="modal-title" id="glj_tit">人材机列设置</h4>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-md-12">
+                        <div class="checkbox">
+                            <label>
+                                <input type="checkbox" id="adjustPrice_cb"> 显示调整价列
+                            </label>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-primary" data-dismiss="modal" id = "set-glj-comf">确定</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+
 <script type="text/javascript" src="/web/users/js/col_setting.js"></script>

+ 2 - 2
web/users/views/compilation/template.html

@@ -25,7 +25,7 @@
         <div class="c-body">
             <legend>清单模板设置<a href="/compilation/valuation/<%= section %>/<%= valuationId %>" class="btn btn-default btn-sm pull-right">返回</a><a href="#" class="btn btn-primary btn-sm pull-right" style="margin-right:5px">保存</a></legend>
             <div class="row">
-                <div class="col-md-9">
+                <div class="col-md-11">
                     <div class="tools-btn btn-group align-top">
                         <a href="" class="btn btn-sm"><i class="fa fa-files-o" aria-hidden="true"></i> 复制</a>
                         <a href="" class="btn btn-sm"><i class="fa fa-scissors" aria-hidden="true"></i> 剪切</a>
@@ -40,7 +40,7 @@
                     <div class="mb-qd-height" id="billsSpread" style="height: 500px;">
                     </div>
                 </div>
-                <div class="col-md-3">
+                <div class="col-md-1">
                     <select class="form-control" style="display: none"><option>定额</option></select>
                     <div class="mb-de-height">
                     </div>