Sfoglia il codice sorgente

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionOperation into 1.0.0_online

TonyKang 7 anni fa
parent
commit
86ed32ff20

+ 4 - 3
modules/all_models/engineering_lib.js

@@ -13,7 +13,8 @@ let taxGroupSchema = new  Schema({
     taxType: String,//计税方式
     program_lib: { type: Schema.Types.Mixed,default:{}},// 计算程序标准库
     template_lib:{ type: Schema.Types.Mixed,default:{}},//清单模板库
-    col_lib:{ type: Schema.Types.Mixed,default:{}}
+    col_lib:{ type: Schema.Types.Mixed,default:{}},//列设置
+    fee_lib:{ type: Schema.Types.Mixed,default:{}}//费率标准库
 },{_id: false});
 
 
@@ -42,11 +43,11 @@ let modelSchema = {
       type: [taxGroupSchema],
       default: []
     },
-    // 费率标准库
+   /* // 费率标准库 2018-08-28 改成放在tax_group 里了
     fee_lib: {
         type: Schema.Types.Mixed,
         default: []
-    },
+    },*/
     // 人工系数标准库
     artificial_lib: {
         type: Schema.Types.Mixed,

+ 20 - 0
modules/std_glj_lib/controllers/gljController.js

@@ -9,6 +9,8 @@ import rationItemDao from "../../ration_repository/models/ration_item";
 const multiparty = require("multiparty");
 const LZString = require('lz-string');
 const gljModel = mongoose.model('std_glj_lib_gljList');
+const stdRationModel = mongoose.model('std_ration_lib_ration_items');
+const cplRationModel = mongoose.model('complementary_ration_items');
 
 let gljDao = new GljDao();
 let callback = function(req, res, err, message, data){
@@ -164,6 +166,24 @@ class GljController extends BaseController{
             callback(req, res, err, message, rst);
         })
     }
+    async isUsed(req, res){
+        try{
+            let data = JSON.parse(req.body.data);
+            let gljIds = data.gljIds;
+            let stdRation = await stdRationModel.findOne({isDeleted: false, 'rationGljList.gljId': {$in: gljIds}});
+            if(stdRation){
+                res.json({error: 1, message: error, data: {isUsed: true}});
+            }
+            let cplRation = await cplRationModel.findOne({$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'rationGljList.gljId': {$in: gljIds}});
+            if(cplRation){
+                res.json({error: 1, message: error, data: {isUsed: true}});
+            }
+            res.json({error: 1, message: error, data: {isUsed: false}});
+        }
+        catch (error){
+            res.json({error: 1, message: error, data: null});
+        }
+    }
 }
 
 export default GljController;

+ 1 - 0
modules/std_glj_lib/routes/routes.js

@@ -39,6 +39,7 @@ module.exports = function (app) {
     router.post("/getGljItemsByIds",gljController.auth, gljController.init, gljController.getGljItemsByIds);
     router.post("/getGljItemsByCodes",gljController.auth, gljController.init, gljController.getGljItemsByCodes);
     router.post("/getGljItemsOccupied",gljController.auth, gljController.init, gljController.getGljItemsOccupied);
+    router.post("/isUsed",gljController.auth, gljController.init, gljController.isUsed);//工料机是否被引用
 
     app.use("/stdGljRepository/api", router);
 

+ 2 - 2
modules/users/models/engineering_lib_model.js

@@ -154,8 +154,8 @@ class EngineeringLibModel extends BaseModel {
         // 判断清单指引库
         data.billsGuidance_lib = this._validLib(data.billsGuidance_lib);
 
-        // 判断费率标准
-        data.fee_lib = this._validLib(data.fee_lib);
+        /*// 判断费率标准
+        data.fee_lib = this._validLib(data.fee_lib);*/
 
         // 判断人工系数
         data.artificial_lib = this._validLib(data.artificial_lib);

+ 29 - 9
public/web/scMathUtil.js

@@ -5,6 +5,12 @@
  *
  * zhangyin 2018-02-28
  * 采用重复一次四舍五入解决浮点精度误差后,10000次roundTo的时间为94毫秒。
+ *
+ * zhangyin 2018-04-28
+ * 因为js中的浮点数本身就有误差,经过运算后误差被放大,用加尾数的方式也不能消除。所以必须采用另一种思路。
+ * 考虑误差会被放大,因此放弃一位有效位数来消除误差,二进制有效位数50位,十进制有效位数15位。
+ * 原重复四舍五入的方法有缺陷,放弃。
+ * 10000次roundTo时间恢复到47毫秒
  */
 
 let scMathUtil = {
@@ -68,7 +74,8 @@ let scMathUtil = {
         let sResult2 = '';
         if (fNum > 0){
             // 双精度浮点数,尾数总长52位,因为第一位总是1,存储时已经被隐藏,所以有效位数为53位
-            const floatLength = 53;
+            // 由于js未对浮点数做优化,所以在有运算的情况下,误差会被放大,因此放弃一位有效位数来消除误差,二进制有效位数50位,十进制有效位数15位
+            const floatLength = 50;
 
             let iLength;
             // js的bug,浮点数直接取小数可能不能获得精确值,只有转成字符串,截取字符串中的小数段
@@ -155,16 +162,10 @@ let scMathUtil = {
         };
         return result;
     },
-    reRoundTo: function(num, digit){
-        let me = this;
-        return me.innerRoundTo(me.binToFloat(me.incMantissa(me.floatToBin(num))), digit);
-    },
-    // zhangyin 2018-02-28
-    // 经过运算后的浮点数,误差可能更大,加尾数也不能消除。目前采用笨办法,将有效位数加一位再四舍五入一次,以消除浮点误差。
-    // 此办法效率较低,没有别的更好办法时暂时用着
+
     roundTo: function(num, digit){
         let me = this;
-        return me.reRoundTo(me.reRoundTo(num, digit - 1), digit);
+        return me.innerRoundTo(me.binToFloat(me.incMantissa(me.floatToBin(num))), digit);
     },
     isNumber : function (obj) {
         return obj === +obj;
@@ -188,6 +189,25 @@ let scMathUtil = {
             value = me.roundTo(Number(obj),-decimal);
         }
         return value.toFixed(decimal);
+    },
+    isNumOrFormula:function (text) {
+        let value = Number(text);
+        if (!value) {
+            try {
+                let exp = new Expression('');
+                exp.Expression(text);
+                value = Number(exp.Evaluate());
+            } catch (error) {
+                value = null;
+            }
+        }
+        if(text==null||text==""){
+            value = null;
+        }
+        return value;
+    },
+    isDef:function (v) {
+        return v !== undefined && v !== null;
     }
 };
 

+ 20 - 0
web/maintain/ration_repository/dinge.html

@@ -499,6 +499,26 @@
                 </div>
             </div>
         </div>
+        <div class="modal fade" id="delRationAlert" 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">是否删除当前节点及其子项?</h5>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="btn btn-danger" id="delRationConfirm">确认</button>
+                        <button type="button" class="btn btn-secondary"  data-dismiss="modal">取消</button>
+                    </div>
+                </div>
+            </div>
+        </div>
         <!-- JS. -->
         <script src = "/lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js"></script>
         <script>GC.Spread.Sheets.LicenseKey =  '<%- LicenseKey %>';</script>

+ 2 - 0
web/maintain/ration_repository/js/main.js

@@ -85,6 +85,8 @@ $(function () {
         $("#showArea").on("click", "[data-target = '#del']", function(){
             let deleteId = $(this).parent().parent().attr("id");
             $("#deleteA").attr("deleteId", deleteId);
+            let delLibName = $(`#${deleteId}`).find('td:first').text();
+            $('#del').find('.modal-body h5').text(`准备删除 “${delLibName}”,会导致已引用此库的地方出错,确定要删除吗?`);
         });
         $("#deleteA").click(function(){
             let deleteId = $(this).attr("deleteId");

+ 32 - 4
web/maintain/ration_repository/js/ration.js

@@ -189,9 +189,17 @@ let rationOprObj = {
                         callback: function(){},
                         items: {
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
-                                me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
-                                me.mixDel = 1;
-                                me.mixUpdateRequest([], [], [ration.ID]);
+
+                                let removeInfo = `确定要删除定额 “${ration.code}” 及其下的所有数据吗?`;
+                                $('#delRationAlert').find('.modal-body h5').text(removeInfo);
+                                $('#delRationAlert').modal('show');
+                                $('#delRationConfirm').bind('click', function () {
+                                    me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
+                                    me.mixDel = 1;
+                                    me.mixUpdateRequest([], [], [ration.ID]);
+                                    $('#delRationConfirm').unbind('click');
+                                    $('#delRationAlert').modal('hide');
+                                });
                             }}
                         }
                     };
@@ -207,6 +215,7 @@ let rationOprObj = {
         me.workBook.commandManager().register('rationDelete', function () {
             let rationSheet = me.workBook.getActiveSheet();
             let sels = rationSheet.getSelections(), updateArr = [], removeArr = [], lockCols = me.setting.view.lockColumns;
+            let removeCodes = [];
             let cacheSection = me.getCache();
             if(sels.length > 0){
                 for(let sel = 0; sel < sels.length; sel++){
@@ -215,6 +224,7 @@ let rationOprObj = {
                             for(let i = 0; i < sels[sel].rowCount; i++){
                                 if(sels[sel].row + i < cacheSection.length){
                                     removeArr.push(cacheSection[sels[sel].row + i].ID);
+                                    removeCodes.push(cacheSection[sels[sel].row + i].code);
                                     me.rationsCodes.splice(me.rationsCodes.indexOf(cacheSection[sels[sel].row + i].code.toString()), 1);
                                 }
                             }
@@ -248,10 +258,25 @@ let rationOprObj = {
                     }
                 }
             }
-            if(updateArr.length > 0 || removeArr.length > 0){
+          /*  if(updateArr.length > 0 || removeArr.length > 0){
                 me.mixUpdate = 1;
                 me.mixDel = removeArr.length > 0 ? 1 : 0;
                 me.mixUpdateRequest(updateArr, [], removeArr);
+            }*/
+            if(updateArr.length > 0){
+                me.mixUpdate = 1;
+                me.mixUpdateRequest(updateArr, [], []);
+            }
+            if(removeArr.length > 0){
+                let removeInfo = `确定要删除定额 “${removeCodes.join(',')}” 及其下的所有数据吗?`;
+                $('#delRationAlert').find('.modal-body h5').text(removeInfo);
+                $('#delRationAlert').modal('show');
+                $('#delRationConfirm').bind('click', function () {
+                    me.mixDel = 1;
+                    me.mixUpdateRequest([], [], removeArr);
+                    $('#delRationConfirm').unbind('click');
+                    $('#delRationAlert').modal('hide');
+                });
             }
 
         });
@@ -586,6 +611,7 @@ let rationOprObj = {
                 //annotation
                 annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                 me.showRationItems(sectionID);
+                sectionTreeObj.removeBtn.removeClass('disabled');
             } else {
                 $.ajax({
                     type:"POST",
@@ -605,8 +631,10 @@ let rationOprObj = {
                             annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                             me.showRationItems(sectionID);
                         }
+                        sectionTreeObj.removeBtn.removeClass('disabled');
                     },
                     error:function(err){
+                        sectionTreeObj.removeBtn.removeClass('disabled');
                         alert(err);
                     }
                 })

+ 23 - 7
web/maintain/ration_repository/js/section_tree.js

@@ -164,12 +164,6 @@ let sectionTreeObj = {
         let row = info.newSelections[0].row;
         let section = me.cache[row];
         me.initSelection(section);
-       /* if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
-
-        }
-        else {
-            me.refreshBtn(null);
-        }*/
     },
 
     onEditStarting: function (sender, args) {
@@ -308,9 +302,29 @@ let sectionTreeObj = {
             me.insert();
         });
         $('#delConfirm').click(function () {
-            me.remove(me.tree.selected);
+            if(me.canRemoveSection){
+                me.remove(me.tree.selected);
+            }
+            else {
+                $('#delAlert').modal('hide');
+            }
         });
         me.removeBtn.click(function () {
+            //不可删除有子节点或有定额数据的节点
+            let section = me.cache[me.workBook.getActiveSheet().getActiveRowIndex()];
+            if(!section){
+                return;
+            }
+            let sectionName = me.isDef(section.data.name) ? section.data.name : '';
+            let sectionRations = rationOprObj.currentRations[`_SEC_ID_${section.data.ID}`];
+            if(section.children.length > 0 || (sectionRations && sectionRations.length > 0)){
+                me.canRemoveSection = false;
+                $('#delAlert').find('.modal-body h5').text('当前节点下有数据,不可删除。');
+            }
+            else {
+                me.canRemoveSection = true;
+                $('#delAlert').find('.modal-body h5').text(`确认要删除章节 “${sectionName}”吗?`);
+            }
             $('#delAlert').modal('show');
         });
         me.upLevelBtn.click(function () {
@@ -613,6 +627,8 @@ let sectionTreeObj = {
         me.initTools(node);
         me.refreshBtn(node);
         if(!me.isDef(node.children) || node.children.length === 0){
+            //需要根据章节树下是否含有定额数据判断是否可以删除,在异步获取定额数据前将删除按钮无效化
+            me.removeBtn.addClass('disabled');
             rationOprObj.canRations = true;
             rationOprObj.workBook.getSheet(0).clearSelection();
             rationOprObj.getRationItems(node.data.ID);

+ 0 - 4
web/maintain/std_glj_lib/html/gongliao.html

@@ -274,10 +274,6 @@
         };
         $(document).ready(function(){
             console.log(scMathUtil.roundTo(268.89472, -2));
-            //test
-            console.log(scMathUtil.roundTo(parseFloat(25*1.277), -2));
-            console.log(25*1.277);
-            //test
             //解决spreadjs sheet初始化没高度宽度
             $('#modalCon').width($(window).width()*0.5);
             $('#componentTreeDiv').height($(window).height() - 300);

+ 6 - 4
web/maintain/std_glj_lib/js/glj.js

@@ -471,9 +471,10 @@ let repositoryGljObj = {
                 focusToCol = getFocusToCol(me);
                 if(focusToCol !== -1) {
                     $('#gljAlertBtn').click();
-                    $('#aleConfBtn').click(function () {
+                    $('#aleConfBtn').bind('click', function () {
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
                         me.workBook.focus(true);
+                        $('#aleConfBtn').unbind('click');
                     });
                     $('#gljAleClose').click(function () {
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
@@ -669,6 +670,7 @@ let repositoryGljObj = {
             me.mixUpdateRequest(updateArr, addArr, []);
         }
     },
+    //删除人材机前需要判断人材机是否有被引用,被引用了则不可删除
     repositoryGljDelOpr: function () {
         let me = repositoryGljObj;
         me.workBook.commandManager().register('repositoryGljDel', function () {
@@ -745,17 +747,17 @@ let repositoryGljObj = {
                     //删除警告
                     let upAlertText = removeArr.length > 0 ? '可能已有定额引用了当前人材机,导致定额查找不到此人材机。确定要删除吗?' : '确认删除选中字段?';
                     $('#alertGljTxt').text(upAlertText);
-                    $('#gljAlertBtn').click();
+                    $('#gljAlert').modal('show');
                     //确认
-                    $('#aleConfBtn').click(function () {
+                    $('#aleConfBtn').bind('click', function () {
                         me.mixUpdateRequest(updateArr, [], removeArr);
                         if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
                             me.updateRationBasePrcRq(updateBasePrcArr);
                         }
+                        $('#aleConfBtn').unbind('click');
                     });
                 }
             }
-
         });
 
         me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);

+ 18 - 1
web/maintain/std_glj_lib/js/gljClassTree.js

@@ -240,10 +240,27 @@ let gljClassTreeObj = {
             me.insert();
         });
         $('#delConfirm').click(function () {
-            me.remove(me.tree.selected);
+            if(me.canRemoveClass){
+                me.remove(me.tree.selected);
+            }
             $('#delAlert').modal('hide');
         });
         me.removeBtn.click(function () {
+            //当前分类下无子项且无工料机数据,才允许删除
+            let classNode = me.cache[me.workBook.getActiveSheet().getActiveRowIndex()];
+            if(!classNode){
+                return;
+            }
+            let className = me.isDef(classNode.data.Name) ? classNode.data.Name : '';
+            let classGljs = repositoryGljObj.currentCache;
+            if(classNode.children.length > 0 || (classGljs && classGljs.length > 0)){
+                me.canRemoveClass = false;
+                $('#delAlert').find('.modal-body h5').text('当前分类下有数据,不可删除。');
+            }
+            else {
+                me.canRemoveClass = true;
+                $('#delAlert').find('.modal-body h5').text(`确认要删除分类 “${className}”吗?`);
+            }
             $('#delAlert').modal('show');
         });
         me.upLevelBtn.click(function () {

+ 2 - 0
web/maintain/std_glj_lib/js/main.js

@@ -92,6 +92,8 @@ $(function () {
             $("#showArea").on("click", "[data-target = '#del']", function(){
                 let deleteId = $(this).parent().parent().attr("id");
                 $("#deleteA").attr("deleteId", deleteId);
+                let delLibName = $(`#${deleteId}`).find('td:first').text();
+                $('#del').find('.modal-body h5').text(`准备删除 “${delLibName}”,会导致已引用此库的地方出错,确定要删除吗?`)
             });
             $("#deleteA").click(function(){
                 let deleteId = $(this).attr("deleteId");

+ 24 - 7
web/users/js/compilation.js

@@ -79,6 +79,7 @@ $(document).ready(function() {
         $("#program_lib").val("");
         $("#template_lib").val("");
         $("#col_lib").val("");
+        $("#fee_lib").val("");
     });
 
     //新增计税组合
@@ -94,10 +95,12 @@ $(document).ready(function() {
                 let p_name = groupData.program_lib?groupData.program_lib.displayName:"";
                 let t_name = groupData.template_lib?groupData.template_lib.name:"";
                 let c_name = groupData.col_lib?groupData.col_lib.name:"";
+                let f_name = groupData.fee_lib?groupData.fee_lib.name:"";
                 let htmlString = "<tr class='taxGroup_tr'><td><span>"+taxName+"</span></td>" +
                     "<td><span>"+p_name+"</span></td>" +
                     "<td><span>"+t_name+"</span></td>" +
                     "<td><span>"+c_name+"</span></td>" +
+                    "<td><span>"+f_name+"</span></td>" +
                     "<td> <a class='btn btn-link btn-sm' style='padding: 0px' onclick='editTaxGroup(this)'> 编辑</a>/<a class='btn btn-link btn-sm ' style='padding: 0px' onclick='deleteTaxGroup(this)'>删除</a> " +
                     "<input type='hidden' name='tax_group' data-id ='"+groupIndex+"' value='"+JSON.stringify(groupData)+"'>"+
                     "</td>" +
@@ -404,13 +407,6 @@ function initCompilation() {
     }
     $("select[name='billsGuidance_lib']").children("option").first().after(html);
 
-    // 费率标准库
-    html = '';
-    for(let tmp of feeLibData) {
-        let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + '</option>';
-        html += tmpHtml;
-    }
-    $("select[name='fee_lib']").children("option").first().after(html);
 
     // 人工系数标准库
     html = '';
@@ -442,6 +438,14 @@ function initCompilation() {
         html += tmpHtml;
     }
     $("select[name='col_lib']").children("option").first().after(html);
+
+    // 费率标准库
+    html = '';
+    for(let tmp of feeLibData) {
+        let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + '</option>';
+        html += tmpHtml;
+    }
+    $("select[name='fee_lib']").children("option").first().after(html);
 }
 
 /**
@@ -682,11 +686,13 @@ function editTaxGroup(ele) {
         $("#program_lib").val(groupData.program_lib?groupData.program_lib.id:"");
         $("#template_lib").val(groupData.template_lib?groupData.template_lib.id:"");
         $("#col_lib").val(groupData.col_lib?groupData.col_lib.id:"");
+        $("#fee_lib").val(groupData.fee_lib?groupData.fee_lib.id:"");
     }else {
         $("#taxType").val("");
         $("#program_lib").val("");
         $("#template_lib").val("");
         $("#col_lib").val("");
+        $("#fee_lib").val("");
     }
     $("#groupIndex").val(getGroupIndex(groupData));
     $("#addTaxGroup").modal({show:true});
@@ -704,6 +710,7 @@ function getGroupIndex(groupData) {//用来做唯一标识
         if(groupData.program_lib) index = index + groupData.program_lib.id;
         if(groupData.template_lib) index = index + groupData.template_lib.id;
         if(groupData.col_lib) index = index + groupData.col_lib.id;
+        if(groupData.fee_lib) index = index + groupData.fee_lib.id;
     }
     return index;
 }
@@ -711,6 +718,7 @@ function getTaxGroupData() {
     let programData = programList === undefined ? [] : _.indexBy(JSON.parse(programList), 'id');
     let billTemplateData = billTemplateList == undefined ? [] : _.indexBy(JSON.parse(billTemplateList),'ID');
     let mainTreeColData= mainTreeColList == undefined ? [] :  _.indexBy(JSON.parse(mainTreeColList),'ID');
+    let feeLibData = feeRateList === undefined ? [] : _.indexBy(JSON.parse(feeRateList),'id');
     let groupData = {};
     if($("#taxType").val() !==""){
         groupData.taxType = $("#taxType").val();
@@ -743,5 +751,14 @@ function getTaxGroupData() {
             }
         }
     }
+    if($("#fee_lib").val() !==""){
+        let feeRate =  feeLibData[$("#fee_lib").val()];
+        if(feeRate){
+            groupData.fee_lib = {
+                id:feeRate.id,
+                name:feeRate.name
+            }
+        }
+    }
     return groupData;
 }

+ 43 - 53
web/users/views/compilation/engineering.html

@@ -90,23 +90,6 @@
                         </div>
                         <div class="row">
                             <div class="form-group col-md-3">
-                                <label>费率标准</label>
-                                <div class="fee-list">
-                                    <% if (Object.keys(libData).length > 0 && libData.fee_lib.length > 0) { %>
-                                    <% libData.fee_lib.forEach(function (fee, index){ %>
-                                    <p class="form-control-static">
-                                        <a class="pull-right text-danger remove-lib" data-model="fee" title="移除" data-id="<%= fee.id %>">
-                                            <span class="glyphicon glyphicon-remove"></span>
-                                        </a>
-                                        <input type="hidden" name="fee_lib" data-id="<%= fee.id %>" value="<%= JSON.stringify({id: fee.id, name: fee.name}) %>">
-                                        <% if (index === 0) {%><i class="glyphicon glyphicon-flag"></i>&nbsp;<% } %><%= fee.name %>
-                                    </p>
-                                    <% }) %>
-                                    <% } %>
-                                </div>
-                                <a href="#" class="btn btn-link btn-sm add-compilation" data-model="fee">添加</a>
-                            </div>
-                            <div class="form-group col-md-3">
                                 <label>人工系数</label>
                                 <div class="artificial-list">
                                     <% if (Object.keys(libData).length > 0 && libData.artificial_lib.length > 0) { %>
@@ -128,7 +111,7 @@
                         <a data-toggle="modal" data-target="#other_setting" class="btn btn-primary btn-sm " style="margin-right:5px">显示设置</a>
                     </div>
                     <div class="col-md-12" style="padding-top:20px">
-                        <legend>计算程序/清单模板/列设置</legend>
+                        <legend>计算程序/清单模板/列设置/费率标准</legend>
                         <a data-toggle="modal" data-target="#addTaxGroup" class="btn btn-link btn-sm " id="addTaxGroupBtn" style="margin-right:5px">添加</a>
                         <table class="table engineer_table">
                             <thead>
@@ -137,46 +120,53 @@
                                 <th>计算程序</th>
                                 <th>清单模板</th>
                                 <th>列设置</th>
+                                <th>费率标准</th>
                                 <th>操作</th>
                             </tr>
                             </thead>
                             <tbody id="tax_group_tbody">
                             <% if (Object.keys(libData).length > 0 && libData.tax_group.length > 0) { %>
-                            <% for(let tax of libData.tax_group) {%>
-                            <% let groupIndex = "";%>
-                            <tr class='taxGroup_tr'>
-                                <td>
-                                    <% if(tax.taxType === "1") { %>
-                                    <%  groupIndex = groupIndex + tax.taxType;%>
-                                    <span>一般计税</span>
-                                    <% } else if(tax.taxType === "2"){%>
-                                    <%  groupIndex = groupIndex + tax.taxType;%>
-                                    <span>简易计税</span>
-                                    <% } %>
-                                </td>
-                                <td>
-                                    <% if(tax.program_lib) { %>
-                                    <%  groupIndex = groupIndex + tax.program_lib.id;%>
-                                        <span><%= tax.program_lib.displayName%></span>
-                                    <% } %>
-                                </td>
-                                <td>
-                                    <% if(tax.template_lib) { %>
-                                    <%  groupIndex = groupIndex + tax.template_lib.id;%>
-                                    <span><%= tax.template_lib.name%></span>
-                                    <% } %>
-                                </td>
-                                <td>
-                                    <% if(tax.col_lib) { %>
-                                    <%  groupIndex = groupIndex + tax.col_lib.id;%>
-                                    <span><%= tax.col_lib.name%></span>
-                                    <% } %>
-                                </td>
-                                <td><a class='btn btn-link btn-sm ' style="padding: 0px" onclick='editTaxGroup(this)'>编辑</a>/<a class='btn btn-link btn-sm ' style="padding: 0px" onclick='deleteTaxGroup(this)'>删除</a>
-                                    <input type='hidden' name='tax_group' data-id ="<%= groupIndex%>" value="<%= JSON.stringify(tax) %>">
-                                </td>
-                            </tr>
-                            <% } %>
+                                <% for(let tax of libData.tax_group) {%>
+                                <% let groupIndex = "";%>
+                                <tr class='taxGroup_tr'>
+                                    <td>
+                                        <% if(tax.taxType === "1") { %>
+                                        <%  groupIndex = groupIndex + tax.taxType;%>
+                                        <span>一般计税</span>
+                                        <% } else if(tax.taxType === "2"){%>
+                                        <%  groupIndex = groupIndex + tax.taxType;%>
+                                        <span>简易计税</span>
+                                        <% } %>
+                                    </td>
+                                    <td>
+                                        <% if(tax.program_lib && tax.program_lib.id) { %>
+                                        <%  groupIndex = groupIndex + tax.program_lib.id;%>
+                                            <span><%= tax.program_lib.displayName%></span>
+                                        <% } %>
+                                    </td>
+                                    <td>
+                                        <% if(tax.template_lib && tax.template_lib.id) { %>
+                                        <%  groupIndex = groupIndex + tax.template_lib.id;%>
+                                        <span><%= tax.template_lib.name%></span>
+                                        <% } %>
+                                    </td>
+                                    <td>
+                                        <% if(tax.col_lib && tax.col_lib.id) { %>
+                                        <%  groupIndex = groupIndex + tax.col_lib.id;%>
+                                        <span><%= tax.col_lib.name%></span>
+                                        <% } %>
+                                    </td>
+                                    <td>
+                                        <% if(tax.fee_lib && tax.fee_lib.id) { %>
+                                        <%  groupIndex = groupIndex + tax.fee_lib.id;%>
+                                        <span><%= tax.fee_lib.name%></span>
+                                        <% } %>
+                                    </td>
+                                    <td><a class='btn btn-link btn-sm ' style="padding: 0px" onclick='editTaxGroup(this)'>编辑</a>/<a class='btn btn-link btn-sm ' style="padding: 0px" onclick='deleteTaxGroup(this)'>删除</a>
+                                        <input type='hidden' name='tax_group' data-id ="<%= groupIndex%>" value="<%= JSON.stringify(tax) %>">
+                                    </td>
+                                </tr>
+                                <% } %>
                             <% } %>
                             </tbody>
                         </table>

+ 12 - 2
web/users/views/compilation/modal.html

@@ -51,7 +51,7 @@
                         </div>
                     </div>
                 </div>
-                <div class="form-group" id="fee-area">
+         <!--       <div class="form-group" id="fee-area">
                     <label>费率标准</label>
                     <div class="row">
                         <div class="col-xs-12">
@@ -60,7 +60,7 @@
                             </select>
                         </div>
                     </div>
-                </div>
+                </div>-->
                 <div class="form-group" id="artificial-area">
                     <label>人工系数</label>
                     <div class="row">
@@ -292,6 +292,16 @@
                         </div>
                     </div>
                 </div>
+                <div class="form-group" id="feeRate-area">
+                    <label>费率标准</label>
+                    <div class="row">
+                        <div class="col-xs-12">
+                            <select class="form-control" name="fee_lib" id = "fee_lib">
+                                <option value="">请选择费率库</option>
+                            </select>
+                        </div>
+                    </div>
+                </div>
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>