瀏覽代碼

移动费率库位置

zhangweicheng 7 年之前
父節點
當前提交
76951deae9

+ 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,

+ 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);

+ 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>