Pārlūkot izejas kodu

安装增加费

zhongzewei 7 gadi atpakaļ
vecāks
revīzija
5a345d7423

+ 20 - 2
config/gulpConfig.js

@@ -7,7 +7,7 @@ module.exports = {
     common_jspaths:[
         'lib/jquery/jquery-3.2.1.min.js',
         'lib/popper/popper.min.js',
-        'lib/jquery-ui/jquery-ui.min.js',
+        'lib/jquery-ui/jquery-0i.min.js',
         'lib/bootstrap/bootstrap.min.js',
         'web/building_saas/js/*.js',
         'public/web/scMathUtil.js',
@@ -172,7 +172,8 @@ module.exports = {
         'web/building_saas/complementary_ration_lib/js/ration.js',
         'web/building_saas/complementary_ration_lib/js/ration_glj.js',
         'web/building_saas/complementary_ration_lib/js/ration_coe.js',
-        'web/building_saas/complementary_ration_lib/js/ration_assist.js'
+        'web/building_saas/complementary_ration_lib/js/ration_assist.js',
+        'web/building_saas/complementary_ration_lib/js/ration_installation.js.js'
     ],
     compleRation_glj_css: [
         'lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css'
@@ -201,6 +202,23 @@ module.exports = {
         'web/building_saas/complementary_ration_lib/js/sheetsOpr.js',
         'public/web/storageUtil.js',
         'web/building_saas/complementary_ration_lib/js/coe.js'
+    ],
+    compleRation_inst_css: [
+        'lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css',
+        'lib/jquery-contextmenu/jquery.contextMenu.css'
+    ],
+    compleRation_inst_jspaths: [
+        'public/web/QueryParam.js',
+        'public/web/uuid.js',
+        'public/web/common_util.js',
+        'public/web/storageUtil.js',
+        'public/web/id_tree.js',
+        'public/web/tree_sheet/tree_sheet_controller.js',
+        'public/web/tree_sheet/tree_sheet_helper.js',
+        'public/web/sheet/sheet_common.js',
+        'public/web/common_ajax.js',
+        'web/building_saas/complementary_ration_lib/js/global.js',
+        'web/building_saas/complementary_ration_lib/js/installation.js'
     ]
 }
 

+ 36 - 1
gulpfile.js

@@ -24,6 +24,8 @@ let compleRation_glj_jspaths = config.compleRation_glj_jspaths;
 let compleRation_glj_csspaths = config.compleRation_glj_css;
 let compleRation_coe_jspaths = config.compleRation_coe_jspaths;
 let compleRation_coe_csspaths = config.compleRation_coe_css;
+let compleRation_inst_csspaths = config.compleRation_inst_css;
+let compleRation_inst_jspaths = config.compleRation_inst_jspaths;
 let version=config.version;
 let cssDest='web/dest/css';
 let scriptsDest='web/dest/scripts';
@@ -152,6 +154,23 @@ let compleRation_coeOptions = {
     ]
 };
 
+let compleRation_instOptions = {
+    version: version,
+    scriptsDest: 'web/dest/scripts',
+    jspaths: compleRation_inst_jspaths,
+    csspaths: compleRation_inst_csspaths,
+    concatName: 'compleRation_inst.all.min',
+    srcHtml: 'web/src/html/complementary_ration_lib/anzhuang.html',
+    htmlDest: 'web/building_saas/complementary_ration_lib/html/anzhuang.html',
+    htmlName: 'anzhuang.html',
+    injectList: [
+        'web/dest/scripts/compleRation_inst.all.min' + version + '.js',
+        'web/dest/scripts/compleRation_inst.all.min' + version + '.css',
+        'web/dest/scripts/common.all.min.'+version+'.js',
+        'web/dest/css/common.all.min.' + version + '.css'
+    ]
+}
+
 function minify(options) {
     if(options.jspaths){
         return gulp.src(options.jspaths)
@@ -329,6 +348,22 @@ gulp.task('compleRation_coe', ['compleRation_coe_inject'], function () {
     return htmlmin(compleRation_coeOptions);
 });
 
+gulp.task('compleRation_inst_minify', ['common'], function () {
+    return minify(compleRation_instOptions);
+});
+
+gulp.task('compleRation_inst_css', function () {
+    return css(compleRation_instOptions);
+});
+
+gulp.task('compleRation_inst_inject', ['compleRation_inst_minify', 'compleRation_inst_css'], function () {
+    return inject(compleRation_instOptions);
+});
+
+gulp.task('compleRation_inst', ['compleRation_inst_inject'], function () {
+    return htmlmin(compleRation_instOptions);
+});
+
 
 
-gulp.task('build',['header','login','pm','main', 'compleGlj', 'compleRation_ration', 'compleRation_glj', 'compleRation_coe']);
+gulp.task('build',['header','login','pm','main', 'compleGlj', 'compleRation_ration', 'compleRation_glj', 'compleRation_coe', 'compleRation_inst']);

+ 7 - 0
modules/complementary_ration_lib/controllers/compleRationController.js

@@ -105,6 +105,13 @@ class CompleRationController extends BaseController{
             callback(req, res, err, '', data);
         });
     }
+
+    getInstallation(req, res){
+        let data = JSON.parse(req.body.data);
+        compleRationDao.getInstallation(data.rationRepId, function (err, data) {
+            callback(req, res, err, '', data);
+        });
+    }
 }
 
 export default CompleRationController;

+ 6 - 0
modules/complementary_ration_lib/controllers/compleViewController.js

@@ -36,6 +36,12 @@ class CompleViewController extends BaseController{
         });
     }
 
+    redirectInstallation(req, res){
+        res.render('building_saas/complementary_ration_lib/html/anzhuang.html', {
+            userID: req.session.sessionUser.ssoId
+        });
+    }
+
     getRationLib(req, res){
         let data = JSON.parse(req.body.data);
         compleViewModel.getRationLib(data.rationRepId, function (err, data) {

+ 21 - 1
modules/complementary_ration_lib/models/compleRationModel.js

@@ -2,7 +2,7 @@
  * Created by Zhong on 2017/12/21.
  */
 
-import {compleRationModel} from './schemas';
+import {compleRationModel, installSectionModel, installFeeItemModel} from './schemas';
 import {complementaryGljModel, stdGljModel} from '../../complementary_glj_lib/models/schemas';
 import async from 'async';
 let stdRationModel = require ('../../ration_repository/models/ration_item').Model;
@@ -430,6 +430,26 @@ class CompleRatoinDao {
             callback(err, results);
         });
     }
+
+    async getInstallation(rationRepId, callback){
+        try {
+            let feeItems = await installFeeItemModel.find({rationRepId: rationRepId, $or: [{deleted: false}, {deleted: null}]});
+            for(let feeItem of feeItems){
+                let sids = [];
+                for(let sec of feeItem.section){
+                    sids.push(sec.ID);
+                }
+                if(sids.length > 0){
+                    let sections = await installSectionModel.find({ID: {$in: sids}, $or: [{deleted: false}, {deleted: null}]});
+                    feeItem._doc.section = sections;
+                }
+            }
+            callback(0, feeItems);
+        }
+        catch(err){
+            callback(err, null);
+        }
+    }
 }
 
 function isDef(v){

+ 43 - 1
modules/complementary_ration_lib/models/schemas.js

@@ -46,6 +46,45 @@ let compleRationAssItemSchema = new Schema({
     maxValue: String
 }, { _id: false });
 
+//安装增加费-费用规则
+let feeRuleSchema = new Schema({
+    ID: String,
+    code: String,
+    rule: String,
+    base: String,
+    feeRate: Number,
+    labour: Number,
+    material: Number,
+    machine: Number
+});
+
+//定额安装增加费用
+let rationInstSchema = new Schema({
+    feeItemId: String,
+    sectionId: String
+},{_id: false});
+
+//标准安装增加费-分册章节
+let installSectionSchema = new Schema({
+    rationRepId: Number,
+    ID: String,
+    feeItemId: String,
+    name: String,
+    feeRule: [feeRuleSchema],
+    deleted: false
+}, {versionKey: false});
+
+//标准安装增加费-费用项
+let installFeeItemSchema = new Schema({
+    rationRepId: Number,
+    ID: String,
+    feeItem: String, //费用项
+    feeType: String, //费用类型
+    position: String, //记取位置
+    section: [],
+    deleted: false
+}, {versionKey: false});
+
 //补充定额
 let compleRationSchema = new Schema({
     userId: Number,
@@ -67,10 +106,13 @@ let compleRationSchema = new Schema({
     rationGljList: [compleRationGljItemSchema],
     rationCoeList: Array,
     rationAssList: [compleRationAssItemSchema],
+    rationInstList: [rationInstSchema],
     deleteInfo: deleteSchema
 }, {versionKey: false});
 
 let compleRationSectionTreeModel = mongoose.model('complementary_ration_section_tree', compleRationSectionTreeSchema, 'complementary_ration_section_tree');
 let compleRationModel = mongoose.model('complementary_ration_items', compleRationSchema, 'complementary_ration_items');
+let installSectionModel = mongoose.model("std_ration_lib_installationSection", installSectionSchema, "std_ration_lib_installationSection");
+let installFeeItemModel = mongoose.model("std_ration_lib_installation", installFeeItemSchema, "std_ration_lib_installation");
 
-export {compleRationSectionTreeModel, compleRationModel};
+export {compleRationSectionTreeModel, compleRationModel, installSectionModel, installFeeItemModel};

+ 4 - 0
modules/complementary_ration_lib/routes/routes.js

@@ -21,6 +21,7 @@ module.exports = function (app) {
     app.get('/complementaryRation/ration', compleViewController.init, compleViewController.redirectRation);
     app.get('/complementaryRation/glj', compleViewController.init, compleViewController.redirectGljList);
     app.get('/complementaryRation/coe', compleViewController.init, compleViewController.redirectCoeList);
+    app.get('/complementaryRation/installation', compleViewController.init, compleViewController.redirectInstallation);
 
     router.post('/getRationLib', compleViewController.init, compleViewController.getRationLib);
     router.post('/getRationLibs', compleViewController.init, compleViewController.getRationLibs);
@@ -44,6 +45,9 @@ module.exports = function (app) {
     router.post('/getCoeItemsByIDs', compleRationController.init, compleRationController.getCoeItemsByIDs);
     router.post('/getCoeItemsByNos', compleRationController.init, compleRationController.getCoeItemsByNos);
 
+    //安装增加费
+    router.post('/getInstallation', compleRationController.init, compleRationController.getInstallation);
+
     //造价书定额库
     router.post('/getRationItem', searchController.init, searchController.getRationItem);
     router.post('/findRation', searchController.init, searchController.findRation);

+ 8 - 1
modules/ration_repository/models/ration_item.js

@@ -25,6 +25,12 @@ var rationAssItemSchema = mongoose.Schema({
     maxValue: String
 }, { _id: false });
 
+//定额安装增加费用
+let rationInstSchema = mongoose.Schema({
+    feeItemId: String,
+    sectionId: String
+},{_id: false});
+
 var rationItemSchema = mongoose.Schema({
     ID:Number,
     code: String,
@@ -39,7 +45,8 @@ var rationItemSchema = mongoose.Schema({
     annotation: String,
     rationGljList: [rationGljItemSchema],
     rationCoeList: Array,
-    rationAssList: [rationAssItemSchema]
+    rationAssList: [rationAssItemSchema],
+    rationInstList: [rationInstSchema]
 });
 var rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items")
 var counter = require('../../../public/counter/counter');

+ 10 - 6
public/web/tree_sheet/tree_sheet_helper.js

@@ -104,15 +104,19 @@ var TREE_SHEET_HELPER = {
     refreshTreeNodeData: function (setting, sheet, nodes, recursive) {
         nodes.forEach(function (node) {
             let iRow = node.serialNo();
-            let nodeStyle = projectObj.getNodeColorStyle(node);
-            if(nodeStyle){
-                sheet.setStyle(iRow, -1, nodeStyle);
+            if(typeof projectObj !== 'undefined'){
+                let nodeStyle = projectObj.getNodeColorStyle(node);
+                if(nodeStyle){
+                    sheet.setStyle(iRow, -1, nodeStyle);
+                }
             }
             setting.cols.forEach(function (colSetting, iCol) {
                 var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
-                let boldFontStyle = projectObj.getBoldFontStyle(node, colSetting);
-                if(boldFontStyle){
-                    sheet.setStyle(iRow, iCol, boldFontStyle);
+                if(typeof projectObj !== 'undefined'){
+                    let boldFontStyle = projectObj.getBoldFontStyle(node, colSetting);
+                    if(boldFontStyle){
+                        sheet.setStyle(iRow, iCol, boldFontStyle);
+                    }
                 }
                 // var getFieldText = function () {
                 //     var fields = colSetting.data.field.split('.');

+ 173 - 0
web/building_saas/complementary_ration_lib/html/anzhuang.html

@@ -0,0 +1,173 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <title>定额库编辑器</title>
+    <!--inject:css-->
+    <link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css">
+    <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css" type="text/css">
+    <link rel="stylesheet" href="/web/building_saas/css/main.css">
+    <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
+    <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css">
+    <!--endinject-->
+</head>
+
+<body>
+    <div class="header">
+        <nav class="navbar navbar-toggleable-lg navbar-light bg-faded p-0 ">
+            <span class="header-logo px-2">Smartcost</span>
+            <div class="navbar-text" id="rationname"><a href="main">定额库</a><i class="fa fa-angle-right fa-fw"></i>XXX定额库</div>
+        </nav>
+        <nav class="navbar navbar-toggleable-lg justify-content-between navbar-light p-0">
+              <ul class="nav nav-tabs" role="tablist">
+                  <li class="nav-item">
+                      <a class="nav-link px-3" id="dinge" href="dinge.html">定额</a>
+                  </li>
+                  <li class="nav-item">
+                      <a class="nav-link px-3" id="gongliao" href="gongliao.html">工料机</a>
+                  </li>
+                  <li class="nav-item">
+                      <a class="nav-link px-3" id="fuzhu" href="fuzhu.html">附注条件</a>
+                  </li>
+                  <li class="nav-item">
+                      <a class="nav-link active px-3" >安装增加费</a>
+                  </li>
+              </ul>
+        </nav>
+    </div>
+    <div class="main">
+        <div class="content">
+            <div class="container-fluid">
+              <div class="row">
+                <div class="main-content col-lg-12 p-0">
+                    <div class="container-fluid">
+                      <div class="row">
+                          <div class="main-data-top-fluid" id="feeItemSpread" style="width: 50%">
+                          <!--  <table class="table table-sm table-bordered mt-1">
+                              <thead><tr><th></th><th>费用项</th><th>费用类型</th><th>记取位置</th></tr></thead>
+                              <tbody>
+                                <tr><td>1</td><td>高层增加费</td><td>子目费用</td><td></td></tr>
+                              </tbody>
+                            </table>-->
+                          </div>
+                          <div class="main-data-top-fluid" id="instSectionSpread" style="width: 50%" >
+                            <!--<table class="table table-sm table-bordered mt-1">
+                              <thead><tr><th></th><th>分册章节</th></tr></thead>
+                              <tbody>
+                                <tr><td>1</td><td>第一册 机械设备安装工程1~6、8~16章节</td></tr>
+                              </tbody>
+                            </table>-->
+                          </div>
+                      </div>
+                    </div>
+                    <div class="bottom-content" id="instFeeRuleSpread">
+                        <!--<table class="table table-sm table-bordered">
+                          <thead><tr><th></th><th>编码</th><th>费用规则</th><th>基数</th><th>费率(%)</th><th>其中人工(%)</th><th>其中材料(%)</th><th>其中机械(%)</th></tr></thead>
+                          <tbody>
+                            <tr><td>1</td><td>AZFY1</td><td>超高费(标高15m以内)(第一册 机械设备安装工程1~6章节)</td><td>分贝按人材机乘系数</td><td></td><td>25</td><td></td><td>25</td></tr>
+                          </tbody>
+                        </table>-->
+                    </div>
+                  </div>
+              </div>
+            </div>
+        </div>
+    </div>
+    <button id="rcjAlertBtn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#rcjAlert" style="display: none"></button>
+    <button id="codeAlertBtn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#codeAlert" style="display: none"></button>
+    <div class="modal fade" id="rcjAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
+        <input type="hidden" id="gdid" value="123">
+        <div class="modal-dialog" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">取消确认</h5>
+                    <button type="button" id="gljAleClose" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <h5 class="text-danger" id="alertGljTxt">人工、材料、机械之和必须为100,是否取消输入?</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-secondary" id="aleCanceBtn" data-dismiss="modal">取消</button>
+                    <a href="javascript: void(0);" id="aleConfBtn" class="btn btn-danger" data-dismiss="modal">确认</a>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="modal" id="codeAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
+        <input type="hidden" id="codedid" value="123">
+        <div class="modal-dialog" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">警告</h5>
+                    <button type="button" id="codAleClose" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <h5 class="text-danger" id="alertText">输入的编号已存在,请重新输入!</h5>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-secondary" id="codAlertQX" data-dismiss="modal">取消</button>
+                    <button type="button" class="btn btn-danger" id="codAlertQR" data-dismiss="modal">确认</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <!--批量关联分册至定额-->
+    <div class="modal fade" id="sectionTreeModal" data-backdrop="static">
+        <div class="modal-dialog modal-feeRate" role="document" id="fee_rate_dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">请选择定额章节</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">&times;</span>
+                    </button>
+                </div>
+                <div class="modal-body" >
+                    <input type="hidden" id="edit_from">
+                    <div class="row" style="height: 500px">
+                        <div class="modal-auto-height col-12" style="overflow: hidden" id="batchSectionSpread"></div>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" id="scTreeCancel" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                        <a href="javascript:void(0);" id="bsTree_conf" class="btn btn-primary">确定</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <!-- JS. -->
+    <script src = "/lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
+    <script src="/lib/jquery/jquery-3.2.1.min.js"></script>
+    <script src="/lib/jquery-contextmenu/jquery.contextMenu.min.js"></script>
+    <script src="/lib/jquery-contextmenu/jquery.ui.position.js"></script>
+    <!--inject:js-->
+    <script>GC.Spread.Sheets.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";</script>
+    <script type="text/javascript" src="/lib/popper/popper.min.js"></script>
+    <script src="/lib/bootstrap/bootstrap.min.js"></script>
+    <script type="text/javascript" src="/public/web/QueryParam.js"></script>
+    <script src="/public/web/uuid.js"></script>
+    <script src="/public/web/scMathUtil.js"></script>
+    <script src="/public/web/common_util.js"></script>
+    <script src="/public/web/storageUtil.js"></script>
+    <script  src="/public/web/id_tree.js"></script>
+    <script src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
+    <script src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
+    <script src="/public/web/sheet/sheet_common.js"></script>
+    <script src="/public/web/common_ajax.js"></script>
+    <script src="/web/building_saas/complementary_ration_lib/js/global.js"></script>
+    <script src="/web/building_saas/complementary_ration_lib/js/installation.js"></script>
+    <!--endinject-->
+</body>
+<script type="text/javascript">
+    autoFlashHeight();
+</script>
+
+</html>

+ 13 - 4
web/building_saas/complementary_ration_lib/html/dinge.html

@@ -34,7 +34,7 @@
                       <a class="nav-link px-3" id="fuzhu" href="#">附注条件</a>
                   </li>
                   <li class="nav-item">
-                      <a class="nav-link px-3" href="#">安装增加费</a>
+                      <a class="nav-link px-3" id="anzhuang" href="#">安装增加费</a>
                   </li>
               </ul>
         </nav>
@@ -94,8 +94,7 @@
                                           <a class="nav-link" id="linkFZTJ" data-toggle="tab" href="#rDetail" role="tab">附注条件调整</a>
                                       </li>
                                       <li class="nav-item">
-                                          <!--<a class="nav-link" id="linkAZZJ" data-toggle="tab" href="#" role="tab">安装增加费</a>-->
-                                          <a class="nav-link" href="#">安装增加费</a>
+                                          <a class="nav-link px-3" id="linkAZZJ" data-toggle="tab" href="#rDetail" role="tab">安装增加费</a>
                                       </li>
                                   </ul>
                                   <!-- 内容 -->
@@ -460,6 +459,7 @@
    <!--     <script type="text/javascript" src="/public/web/sheet/sheet_creater.js"></script>-->
         <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_coe.js"></script>
         <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_assist.js"></script>
+        <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_installation.js"></script>
         <!--endinject-->
         <script type="text/javascript">
             let userID = '<%=userID %>';
@@ -469,7 +469,7 @@
                // sheetCommonObj.shieldAllCells(rationOprObj.workBook.getSheet(0), rationOprObj.setting);
 
                // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。
-                var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 3);
+                var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4);
                 rationGLJOprObj.buildSheet(rdSpread.getSheet(0));
                // sheetCommonObj.shieldAllCells(rdSpread.getSheet(0), rationGLJOprObj.setting);
 
@@ -479,6 +479,10 @@
                 rationCoeOprObj.buildSheet(rdSpread.getSheet(2));
               //  sheetCommonObj.shieldAllCells(rdSpread.getSheet(2), rationCoeOprObj.setting);
 
+                rationInstObj.getInstallation(parseInt(getQueryString("repository")), function () {
+                    rationInstObj.buildSheet(rdSpread.getSheet(3));
+                });
+
                 $("#linkGLJ").click(function(){
                     rationGLJOprObj.bindRationGljDelOpr();
                     rdSpread.setActiveSheetIndex(0);
@@ -493,6 +497,11 @@
                     rationCoeOprObj.bindRationCoeDel();
                     rdSpread.setActiveSheetIndex(2);
                 });
+
+                $("#linkAZZJ").click(function(){
+                    rationInstObj.bindRationInstDel();
+                    rdSpread.setActiveSheetIndex(3);
+                });
             });
         </script>
     </div>

+ 1 - 1
web/building_saas/complementary_ration_lib/html/fuzhu.html

@@ -32,7 +32,7 @@
                       <a class="nav-link active px-3">附注条件</a>
                   </li>
                   <li class="nav-item">
-                      <a class="nav-link px-3" href="#maz">安装增加费</a>
+                      <a class="nav-link px-3" id="anzhuang" href="javascript:void(0);">安装增加费</a>
                   </li>
 
                   <li class="nav-item">

+ 1 - 1
web/building_saas/complementary_ration_lib/html/gongliao.html

@@ -37,7 +37,7 @@
                       <a class="nav-link px-3" id="fuzhu" href="javascript:void(0);">附注条件</a>
                   </li>
                   <li class="nav-item">
-                      <a class="nav-link px-3" href="#maz">安装增加费</a>
+                      <a class="nav-link px-3" id="anzhuang" href="javascript:void(0);">安装增加费</a>
                   </li>
               </ul>
         </nav>

+ 3 - 0
web/building_saas/complementary_ration_lib/js/coe.js

@@ -16,6 +16,9 @@ var pageObj = {
             $(this).attr('href', "/complementaryRation/glj" + "?repository=" + getQueryString("repository"))
         });
 
+        $("#anzhuang").click(function(){
+            $(this).attr('href', "/complementaryRation/installation" + "?repository=" + getQueryString("repository"))
+        });
         var libID = getQueryString("repository");
         var libName = storageUtil.getSessionCache("RationGrp","repositoryID_" + libID);
         if (libName) {

+ 1 - 0
web/building_saas/complementary_ration_lib/js/global.js

@@ -10,6 +10,7 @@ function autoFlashHeight(){
     $(".poj-list").height($(window).height()-headerHeight);
     $(".form-list").height($(window).height()-headerHeight-50 );
     $(".main-data-top").height($(window).height()-headerHeight-toolsBar-bottomContentHeight-2);
+    $(".main-data-top-fluid").height($(window).height()-headerHeight-bottomContentHeight-2);
     $(".main-data").height($(window).height()-headerHeight);
     $(".main-side .tab-content").height($(window).height()-headerHeight-38);
 };

+ 282 - 0
web/building_saas/complementary_ration_lib/js/installation.js

@@ -0,0 +1,282 @@
+/**
+ * Created by Zhong on 2018/1/19.
+ **/
+$("#gongliao").click(function(){
+    $(this).attr('href', "/complementaryRation/lmm" + "?repository=" + getQueryString("repository"))
+});
+
+$("#fuzhu").click(function(){
+    $(this).attr('href', "/complementaryRation/coeList" + "?repository=" + getQueryString("repository"))
+});
+
+$("#dinge").click(function(){
+    $(this).attr('href', "/complementaryRation/ration" + "?repository=" + getQueryString("repository"))
+});
+
+$(document).ready(function () {
+    feeItemObj.buildSheet();
+});
+//费用项
+let feeItemObj = {
+    rationRepId: null,
+    workBook: null,
+    sheet: null,
+    cache: [],
+    currentFeeItem: null,
+    setting: {
+        header:[
+            {headerName:"费用项",headerWidth:120,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"费用类型",headerWidth:260,dataCode:"feeType", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"记取位置",headerWidth:260,dataCode:"position", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
+        ],
+        view: {lockColumns: []},
+        options: {
+            tabStripVisible:  false,
+            allowCopyPasteExcelStyle : false,
+            allowExtendPasteRange: false,
+            allowUserDragDrop : false,
+            allowUserDragFill: false,
+            scrollbarMaxAlign : true
+        }
+    },
+    isDef: function (v) {
+        return v !== undefined && v !== null;
+    },
+    //sheet things
+    setOptions: function (workbook, opts) {
+        for(let opt in opts){
+            workbook.options[opt] = opts[opt];
+        }
+    },
+    buildSheet: function () {
+        let me = this, se = sectionObj, fr = feeRuleObj;
+        if(!this.isDef(this.workBook)){
+            this.workBook = sheetCommonObj.buildSheet($('#feeItemSpread')[0], this.setting, 10);
+            this.sheet = this.workBook.getActiveSheet();
+            this.setOptions(this.workBook, this.setting.options);
+            this.bindEvents(this.sheet);
+            this.rationRepId = parseInt(getQueryString("repository"));
+            let libName = storageUtil.getSessionCache("RationGrp","repositoryID_" + this.rationRepId);
+            if (libName) {
+                let html = $("#rationname")[0].outerHTML;
+                html = html.replace("XXX定额库", libName);
+                $("#rationname")[0].outerHTML = html;
+            }
+            //init sectionSpread
+            se.buildSheet();
+            //init feeRuleSpread
+            fr.buildSheet();
+            //init installation
+            this.getInstallation(this.rationRepId, function (rstData) {
+                me.cache = rstData;
+                sheetCommonObj.showData(me.sheet, me.setting, me.cache);
+                me.initSelection(me.cache[0]);
+            });
+            //init batchSectionSpread
+        }
+    },
+    bindEvents: function (sheet) {
+        let me = this;
+        const Events = GC.Spread.Sheets.Events;
+        sheet.bind(Events.SelectionChanged, me.onSelectionChanged);
+        sheet.bind(Events.EditStarting, me.onEditStarting);
+        sheet.bind(Events.ClipboardPasting, me.onClipboardPasting);
+        me.feeItemDelOpr();
+    },
+    initSelection: function (feeItem) {
+        let me = this, se = sectionObj, fr = feeRuleObj;
+        sheetCommonObj.cleanSheet(se.sheet, se.setting, -1);
+        sheetCommonObj.cleanSheet(fr.sheet, fr.setting, -1);
+        me.workBook.focus(true);
+        if(!me.isDef(feeItem)){
+            me.currentFeeItem = null;
+            return;
+        }
+        fr.addObj = null;
+        fr.updateObj = null;
+        me.currentFeeItem = feeItem;
+        se.cache = feeItem.section;
+        sheetCommonObj.showData(se.sheet, se.setting, se.cache);
+        se.initSelection(se.cache[0]);
+
+    },
+    onSelectionChanged: function (sender, info) {
+        let me = feeItemObj;
+        if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
+            let row = info.newSelections[0].row;
+            let node = me.cache[row];
+            me.initSelection(node);
+        }
+    },
+    onEditStarting: function (sender, args) {
+        args.cancel = true;
+    },
+    onClipboardPasting: function (sender, info) {
+        info.cancel = true;
+    },
+    feeItemDelOpr: function () {
+        let me = this;
+        me.workBook.commandManager().register('feeItemDel', function () {
+        });
+        me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
+        me.workBook.commandManager().setShortcutKey('feeItemDel', GC.Spread.Commands.Key.del, false, false, false, false);
+    },
+    getInstallation: function (rationRepId, callback) {
+        let me = this;
+        CommonAjax.post('/complementaryRation/api/getInstallation', {rationRepId: rationRepId}, function (rstData) {
+            me.cache = rstData;
+            if(callback){
+                callback(rstData);
+            }
+        });
+    }
+};
+
+//分册章节
+let sectionObj = {
+    workBook: null,
+    sheet: null,
+    cache: [],
+    currentSection: null,
+    setting: {
+        header:[
+            {headerName:"分册章节",headerWidth:800,dataCode:"name", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
+        ],
+        view: {lockColumns: []},
+        options: {
+            tabStripVisible:  false,
+            allowCopyPasteExcelStyle : false,
+            allowExtendPasteRange: false,
+            allowUserDragDrop : false,
+            allowUserDragFill: false,
+            scrollbarMaxAlign : true
+        }
+    },
+    isDef: function (v) {
+        return v !== undefined && v !== null;
+    },
+    //sheet things
+    setOptions: function (workbook, opts) {
+        for(let opt in opts){
+            workbook.options[opt] = opts[opt];
+        }
+    },
+    buildSheet: function () {
+        if(!this.isDef(this.workBook)){
+            this.workBook = sheetCommonObj.buildSheet($('#instSectionSpread')[0], this.setting, 10);
+            this.sheet = this.workBook.getActiveSheet();
+            this.setOptions(this.workBook, this.setting.options);
+            this.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
+            this.bindEvents(this.sheet);
+        }
+    },
+    bindEvents: function (sheet) {
+        let me = sectionObj;
+        const Events = GC.Spread.Sheets.Events;
+        sheet.bind(Events.SelectionChanged, me.onSelectionChanged);
+        sheet.bind(Events.EditStarting, me.onEditStarting);
+        sheet.bind(Events.ClipboardPasting, me.onClipboardPasting);
+        me.sectionDelOpr();
+    },
+    initSelection: function (section) {
+        let me = sectionObj, fr = feeRuleObj;
+        sheetCommonObj.cleanSheet(fr.sheet, fr.setting, -1);
+        this.workBook.focus(true);
+        if(!this.isDef(section)){
+            me.currentSection = null;
+            return;
+        }
+        me.currentSection = section;
+        fr.addObj = null;
+        fr.updateObj = null;
+        fr.cache = section.feeRule;
+        sheetCommonObj.showData(fr.sheet, fr.setting, fr.cache);
+    },
+    onSelectionChanged: function (sender, info) {
+        let me = sectionObj;
+        if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
+            let row = info.newSelections[0].row;
+            let section = me.cache[row];
+            me.initSelection(section);
+        }
+    },
+    onEditStarting: function (sender, args) {
+       args.cancel = true;
+    },
+    onClipboardPasting: function (sender, info) {
+        info.cancel = true;
+    },
+    sectionDelOpr: function () {
+        let me = this;
+        me.workBook.commandManager().register('sectionDel', function () {
+        });
+        me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
+        me.workBook.commandManager().setShortcutKey('sectionDel', GC.Spread.Commands.Key.del, false, false, false, false);
+    }
+};
+
+//费用规则
+let feeRuleObj = {
+    workBook: null,
+    sheet: null,
+    addObj: null,
+    updateObj: null,
+    cache: [],
+    setting: {
+        header:[
+            {headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"费用规则",headerWidth:240,dataCode:"rule", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"基数",headerWidth:120,dataCode:"base", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"费率(%)",headerWidth:120,dataCode:"feeRate", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
+            {headerName:"其中人工(%)",headerWidth:120,dataCode:"labour", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
+            {headerName:"其中材料(%)",headerWidth:120,dataCode:"material", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
+            {headerName:"其中机械(%)",headerWidth:120,dataCode:"machine", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"}
+        ],
+        view: {lockColumns: []},
+        options: {
+            tabStripVisible:  false,
+            allowCopyPasteExcelStyle : false,
+            allowExtendPasteRange: false,
+            allowUserDragDrop : false,
+            allowUserDragFill: false,
+            scrollbarMaxAlign : true
+        }
+    },
+    isDef: function (v) {
+        return v !== undefined && v !== null;
+    },
+    //sheet things
+    setOptions: function (workbook, opts) {
+        for(let opt in opts){
+            workbook.options[opt] = opts[opt];
+        }
+    },
+    buildSheet: function () {
+        if(!this.isDef(this.workBook)){
+            this.workBook = sheetCommonObj.buildSheet($('#instFeeRuleSpread')[0], this.setting, 10);
+            this.sheet = this.workBook.getActiveSheet();
+            this.setOptions(this.workBook, this.setting.options);
+            this.bindEvents(this.sheet);
+        }
+    },
+    bindEvents: function (sheet) {
+        let me = feeRuleObj;
+        const Events = GC.Spread.Sheets.Events;
+        sheet.bind(Events.EditStarting, me.onEditStarting);
+        sheet.bind(Events.ClipboardPasting, me.onClipboardPasting);
+        me.feeRuleDelOpr();
+    },
+    onEditStarting: function (sender, args) {
+        args.cancel = true;
+    },
+    onClipboardPasting: function (sender, info) {
+        info.cancel = true;
+    },
+    feeRuleDelOpr: function () {
+        let me = feeRuleObj, se = sectionObj;
+        me.workBook.commandManager().register('feeRuleDel', function () {
+        });
+        me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
+        me.workBook.commandManager().setShortcutKey('feeRuleDel', GC.Spread.Commands.Key.del, false, false, false, false);
+    }
+};

+ 16 - 3
web/building_saas/complementary_ration_lib/js/ration.js

@@ -9,6 +9,10 @@ $("#gongliao").click(function(){
 $("#fuzhu").click(function(){
     $(this).attr('href', "/complementaryRation/coe" + "?repository=" + getQueryString("repository"))
 });
+
+$("#anzhuang").click(function(){
+    $(this).attr('href', "/complementaryRation/installation" + "?repository=" + getQueryString("repository"))
+});
 const digital = {
     gljPrc: -3,//计算定额基价时单个工料机价格取三位
     rationBasePrc: -2,
@@ -78,10 +82,12 @@ let rationOprObj = {
             let me = rationOprObj,
                 sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
                 sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
-                sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
+                sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting,
+                sheetInst = rationInstObj.sheet, settingInst = rationInstObj.setting;
             sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
             sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
             sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
+            sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
             let cacheSection = me.getCache();
             if (cacheSection && row < cacheSection.length) {
                 rationGLJOprObj.getGljItems(cacheSection[row], function () {
@@ -91,6 +97,9 @@ let rationOprObj = {
                     me.workBook.focus(true);
                 });
                 rationAssistOprObj.getAssItems(cacheSection[row]);
+                rationInstObj.getInstItems(cacheSection[row], function () {
+                    me.workBook.focus(true);
+                });
             }
             else {
                 rationGLJOprObj.currentRationItem = null;
@@ -561,13 +570,13 @@ let rationOprObj = {
         let me = rationOprObj,
             sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
             sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
-            sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
+            sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting,
+            sheetInst = rationInstObj.sheet, settingInst = rationInstObj.setting;
         if (me.workBook) {
             if (me.currentRations && me.currentRations["_SEC_ID_" + sectionID] && me.currentRations["_SEC_ID_" + sectionID].length > 0) {
                 let cacheSection = me.currentRations["_SEC_ID_" + sectionID];
                 sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
                 sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
-                console.log(cacheSection);
                 me.setColor(cacheSection);
                 //combo
                 //sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 2, cacheSection.length, rationUnits, 10, false);
@@ -578,15 +587,18 @@ let rationOprObj = {
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
+                        sheetCommonObj.cleanData(sheetInst, settingInst, -1);
                         rationGLJOprObj.getGljItems(cacheSection[row]);
                         rationCoeOprObj.getCoeItems(cacheSection[row]);
                         rationAssistOprObj.getAssItems(cacheSection[row]);
+                        rationInstObj.getInstItems(cacheSection[row]);
                     }
                     else {
                         rationGLJOprObj.currentRationItem = null;
                         sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
                         sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
                         sheetCommonObj.cleanData(sheetAss, settingAss, -1);
+                        sheetCommonObj.cleanData(sheetInst, settingInst, -1);
                         sheetCommonObj.setDynamicCombo(sheetAss, 0, 5, sheetAss.getRowCount(), rationAssistOprObj.setting.comboItems, false, false);
                     }
                 }
@@ -600,6 +612,7 @@ let rationOprObj = {
                 sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
                 sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
                 sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
+                sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
             }
            //--- me.workBook.focus(true);
         }

+ 313 - 0
web/building_saas/complementary_ration_lib/js/ration_installation.js

@@ -0,0 +1,313 @@
+/**
+ * Created by Zhong on 2018/1/25.
+ */
+let rationInstObj = {
+    IDMapping: null, //ID - name
+    feeItem: null, //name - ID
+    sheet: null,
+    rationRepId: null,
+    curRation: null,
+    cache: [],
+    setting: {
+        header:[
+            {headerName:"费用项",headerWidth:120,dataCode:"feeItem", dataType: "String", hAlign: 'left'},
+            {headerName:"分册章节",headerWidth:400,dataCode:"section", dataType: "String", hAlign: 'left'}
+        ],
+        view:{
+            comboBox:[],
+            lockColumns:[]
+        },
+    },
+    buildSheet: function(sheet) {
+        let me = this;
+        me.sheet = sheet;
+        me.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
+        me.rationRepId = parseInt(pageOprObj.rationLibId); // 不可靠,有时取不到
+        if (me.rationRepId == undefined){me.rationRepId = parseInt(getQueryString('repository'))};
+        sheetCommonObj.initSheet(me.sheet, me.setting, 30);
+        me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
+        me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
+        me.sheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
+        me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
+        me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
+        //右键
+      //  me.onContextmenuOpr();
+    },
+    renderFunc: function (sheet, func) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        if(func){
+            func();
+        }
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    },
+    isDef: function (v) {
+        return v !== undefined && v !== null;
+    },
+    getInstallation: function (rationRepId, callback) {
+        let me = this;
+        CommonAjax.post('/complementaryRation/api/getInstallation', {rationRepId: rationRepId}, function (rstData) {
+            //建立name - ID 映射, ID - name 映射
+            me.feeItem = {};
+            me.IDMapping = {feeItem: {}, section: {}};
+            for(let feeItem of rstData){
+                me.feeItem[feeItem.feeItem] = {ID: feeItem.ID, section: {}};
+                me.IDMapping['feeItem'][feeItem.ID] = feeItem.feeItem;
+                for(let section of feeItem.section){
+                    me.feeItem[feeItem.feeItem]['section'][section.name] = section.ID;
+                    me.IDMapping['section'][section.ID] = section.name;
+                }
+            }
+            if(callback){
+                callback(rstData);
+            }
+        });
+    },
+    getFeeItemCombo: function () {
+        let feeItemArr = [];
+        for(let name in this.feeItem){
+            feeItemArr.push(name);
+        }
+        let combo = sheetCommonObj.getDynamicCombo();
+        combo.items(feeItemArr).itemHeight(10).editable(false);
+        return combo;
+    },
+    getSectionCombo: function (feeItem) {
+        let sectionObjs = this.feeItem[feeItem]['section'];
+        let sectionArr = [];
+        for(let name in sectionObjs){
+            sectionArr.push(name);
+        }
+        let combo = sheetCommonObj.getDynamicCombo();
+        combo.items(sectionArr).itemHeight(10).editable(false);
+        return combo;
+    },
+    getInstItems: function (ration, callback) {
+        let me = this, rst = [];
+        me.curRation = ration;
+        me.cache = me.isDef(ration.rationInstList) ? ration.rationInstList : [];
+        for(let inst of me.cache){
+            let data = Object.create(null);
+            let feeItem = me.IDMapping['feeItem'][inst.feeItemId];
+            let section = me.IDMapping['section'][inst.sectionId];
+            data.feeItem = me.isDef(feeItem) ? feeItem : '';
+            data.section = me.isDef(section) ? section : '';
+            rst.push(data);
+        }
+        me.showInstItems(rst);
+        if(callback){
+            callback();
+        }
+    },
+    showInstItems: function (data) {
+        let me = this;
+        sheetCommonObj.showData(this.sheet, this.setting, data);
+        //init combo
+        this.renderFunc(this.sheet, function () {
+            let feeIemCombo = me.getFeeItemCombo();
+            let rowCount = me.sheet.getRowCount();
+            for(let i = 0, len = rowCount.length; i < len; i++){
+                me.getRange(i, -1, 1, -1).cellType(null);
+            }
+            me.sheet.getRange(-1, 0, -1, 1).cellType(feeIemCombo);
+            for(let i = 0, len = data.length; i < len; i++){
+                let sectionCombo = me.getSectionCombo(data[i].feeItem);
+                me.sheet.getCell(i, 1).cellType(sectionCombo);
+            }
+        });
+    },
+    onEnterCell: function (sender, args) {
+        args.sheet.repaint();
+    },
+    onEditStarting: function (sender, args) {
+        let me = rationInstObj;
+        if(!me.isDef(me.curRation)){
+            args.cancel = true;
+            return;
+        }
+        if(me.curRation.type === rationOprObj.type.std){
+            args.cancel = true;
+            return;
+        }
+        if(!me.isDef(me.cache[args.row]) && args.col === 1){
+            args.cancel = true;
+            return;
+        }
+    },
+    onEditEnded: function (sender, args) {
+        let me = rationInstObj;
+        let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : '';
+        let field = me.setting.header[args.col]['dataCode'];
+        let inst = me.cache[args.row];
+        let toUpdate = false;
+        //update
+        if(me.isDef(inst)){
+            if(field === 'feeItem'){
+                let feeItemId = me.isDef(me.feeItem[v]) ? me.feeItem[v]['ID'] : null;
+                if(feeItemId){
+                    inst.feeItemId = feeItemId;
+                    toUpdate = true;
+                }
+                else {
+                    me.sheet.setValue(args.row, args.col, me.IDMapping['feeItem'][inst.feeItemId]);
+                    return;
+                }
+            }
+            else{
+                let sectionId = me.isDef(me.feeItem[me.IDMapping['feeItem'][inst.feeItemId]]) ? me.feeItem[me.IDMapping['feeItem'][inst.feeItemId]]['section'][v] : null;
+                inst.sectionId = sectionId;
+                toUpdate = true;
+            }
+        }
+        //insert
+        else{
+            let feeItemId = me.isDef(me.feeItem[v]) ? me.feeItem[v]['ID'] : null;
+            if(feeItemId){
+                let obj = {feeItemId: feeItemId, sectionId: null};
+                me.cache.push(obj);
+                toUpdate = true;
+            }
+        }
+        if(toUpdate){
+            me.updateRation(me.curRation, function () {
+                me.getInstItems(me.curRation);
+            });
+        }
+    },
+    validUpdatePaste: function (rowData, data) {
+        if(this.isDef(data.feeItem) && this.isDef(data.section) && data.feeItem !== '' && data.section !== ''){
+            if(!this.isDef(this.feeItem[data.feeItem])){
+                return false;
+            }
+            if(!this.isDef(this.feeItem[data.feeItem]['section'][data.section])){
+                return false;
+            }
+        }
+        else if(this.isDef(data.feeItem) && data.feeItem !== ''){
+            if(!this.isDef(this.feeItem[data.feeItem])){
+                return false;
+            }
+        }
+        else if(this.isDef(data.section) && data.section !== ''){
+            if(!this.isDef(this.feeItem[this.IDMapping['feeItem'][rowData.feeItemId]]['section'][data.section])){
+                return false;
+            }
+        }
+        return true;
+    },
+    validInsertPaste: function (data) {
+        if(!this.isDef(data.feeItem) || data.feeItem == ''){
+            return false;
+        }
+        if(!this.isDef(this.feeItem[data.feeItem])){
+            return false;
+        }
+        if(this.isDef(data.section) && data.section !== '' && !this.isDef(this.feeItem[data.feeItem]['section'][data.section])){
+            return false;
+        }
+        return true;
+    },
+    toSaveData: function (data, rowData = null) {
+        let obj = {feeItemId: null, sectionId: null};
+        if(this.isDef(data.feeItem) && data.feeItem !== ''){
+            obj.feeItemId = this.isDef(this.feeItem[data.feeItem]) ? this.feeItem[data.feeItem]['ID'] : null;
+        }
+        else if(this.isDef(rowData)){
+            obj.feeItemId = rowData.feeItemId;
+        }
+        if(this.isDef(data.section) && data.section !== ''){
+            obj.sectionId = this.isDef(this.feeItem[this.IDMapping['feeItem'][obj.feeItemId]]['section'][data.section]) ?
+                this.feeItem[this.IDMapping['feeItem'][obj.feeItemId]]['section'][data.section]: null;
+        }
+        return obj;
+    },
+    bindRationInstDel: function () {
+        let me = this;
+        let workBook = me.sheet.getParent();
+        workBook.commandManager().register('rationInstDel', function () {
+            if(me.isDef(me.curRation) && me.curRation.type === rationOprObj.type.std){
+                return;
+            }
+            let toUpdate = false;
+            let sels = me.sheet.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 inst = me.cache[row];
+                        //有数据,删除数据
+                        if(me.isDef(inst)){
+                            if(!toUpdate){
+                                toUpdate = true;
+                            }
+                        }
+                    }
+                    //front delete
+                    me.cache.splice(sel.row, sel.rowCount);
+                }
+            }
+            if(toUpdate && me.curRation){
+                me.updateRation(me.curRation, function () {
+                    me.getInstItems(me.curRation);
+                });
+            }
+        });
+        workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
+        workBook.commandManager().setShortcutKey('rationInstDel', GC.Spread.Commands.Key.del, false, false, false, false);
+    },
+    onClipboardPasting: function (sender, info) {
+        let me = rationInstObj;
+        if(!me.isDef(me.curRation)){
+            info.cancel = true;
+            return;
+        }
+        if(me.curRation.type === rationOprObj.type.std){
+            info.cancel = true;
+            return;
+        }
+    },
+    onClipboardPasted: function (sender, info) {
+        let me = rationInstObj;
+        let items = sheetCommonObj.analyzePasteData(me.setting, info);
+        let toUpdate = false;
+        for(let i = 0, len = items.length; i < len; i++){
+            let row = info.cellRange.row + i;
+            //update
+            let inst = me.cache[row];
+            if(me.isDef(inst)){
+                if(me.validUpdatePaste(inst, items[i])){
+                    let updateObj = me.toSaveData(items[i], inst);
+                    for(let attr in updateObj){
+                        inst[attr] = updateObj[attr];
+                    }
+                    toUpdate = true;
+                }
+            }
+            //insert
+            else{
+                if(me.validInsertPaste(items[i])){
+                    me.cache.push(me.toSaveData(items[i]));
+                    toUpdate = true;
+                }
+            }
+        }
+        if(toUpdate){
+            me.updateRation(me.curRation, function () {
+                me.getInstItems(me.curRation);
+            });
+        }
+        else {
+            me.getInstItems(me.curRation);
+        }
+    },
+    updateRation: function (ration,callback) {
+        rationOprObj.mixUpdateRequest([ration], [], [], function () {
+            if(callback){
+                callback();
+            }
+        });
+    }
+};

+ 4 - 0
web/building_saas/complementary_ration_lib/js/repository_glj.js

@@ -10,6 +10,10 @@ $("#fuzhu").click(function(){
     $(this).attr('href', "/complementaryRation/coe" + "?repository=" + getQueryString("repository"))
 });
 
+$("#anzhuang").click(function(){
+    $(this).attr('href', "/complementaryRation/installation" + "?repository=" + getQueryString("repository"))
+});
+
 var pageOprObj = {
     rationLibName : null,
     rationLibId: null,

+ 1 - 0
web/building_saas/complementary_ration_lib/js/section_tree.js

@@ -436,6 +436,7 @@ let sectionTreeObj = {
         sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
         sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
         sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
+        sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
         //rationGLJOprObj.sheet.getParent().focus(false);
         me.workBook.focus(true);
     }