Browse Source

新增附注

zhongzewei 7 years ago
parent
commit
2d03172e53

+ 8 - 0
modules/ration_repository/controllers/ration_controller.js

@@ -88,6 +88,14 @@ class RationController extends BaseController{
             callback(req, res, err, '', null);
         });
     }
+    updateAnnotation(req, res){
+        let repId = req.body.repId,
+            updateArr = JSON.parse(req.body.updateArr),
+            lastOpr = req.body.lastOpr;
+        rationItem.updateAnnotation(lastOpr, repId, updateArr, function (err) {
+            callback(req, res, err, '', null);
+        });
+    }
 }
 
 export default RationController;

+ 9 - 1
modules/ration_repository/controllers/ration_section_tree_controller.js

@@ -77,7 +77,15 @@ class RationChapterTreeController extends BaseController{
         rationChapterTreeData.updateSituation(lastOpr, repId, nodeId, situation, function (err) {
             callback(req, res, err, '', null);
         });
-
+    }
+    updateAnnoSituation(req, res){
+        let repId = req.body.repId,
+            nodeId = req.body.nodeId,
+            situation = req.body.situation,
+            lastOpr = req.body.lastOpr;
+        rationChapterTreeData.updateAnnoSituation(lastOpr, repId, nodeId, situation, function (err) {
+            callback(req, res, err, '', null);
+        });
     }
 }
 

+ 22 - 0
modules/ration_repository/models/ration_item.js

@@ -403,5 +403,27 @@ rationItemDAO.prototype.updateJobContent = function (lastOpr, repId, updateArr,
     });
 }
 
+rationItemDAO.prototype.updateAnnotation = function (lastOpr, repId, updateArr, callback) {
+    rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
+        async.each(updateArr, function (obj, cb) {
+            rationItemModel.update({rationRepId: repId, code: obj.code}, {$set: {annotation: obj.annotation}}, function (err) {
+                if(err){
+                    cb(err);
+                }
+                else{
+                    cb(null);
+                }
+            })
+        }, function (err) {
+            if(err){
+                callback(err);
+            }
+            else{
+                callback(null);
+            }
+        });
+    });
+}
+
 module.exports = new rationItemDAO()
 

+ 12 - 0
modules/ration_repository/models/ration_section_tree.js

@@ -139,6 +139,18 @@ rationChapterTreeDAO.prototype.updateSituation = function (lastOpr, repId, nodeI
         }
     });
 };
+rationChapterTreeDAO.prototype.updateAnnoSituation = function (lastOpr, repId, nodeId, situation, callback) {
+    rationChapterTreeModel.update({rationRepId: repId, ID: nodeId}, {$set: {annotationSituation: situation}}, function (err, result) {
+        if(err){
+            callback(err);
+        }
+        else{
+            rationRepositoryDao.updateOprArr({ID: repId}, lastOpr, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
+                callback(null);
+            });
+        }
+    });
+};
 
 rationChapterTreeDAO.prototype.updateNodes = function(repId, lastOpr, nodes,callback){
     var functions = [];

+ 2 - 0
modules/ration_repository/routes/ration_rep_routes.js

@@ -42,6 +42,7 @@ module.exports =  function (app) {
     apiRouter.post("/updateExplanation",rationChapterTreeController.auth, rationChapterTreeController.init, rationChapterTreeController.updateExplanation);
     apiRouter.post("/updateRuleText",rationChapterTreeController.auth, rationChapterTreeController.init, rationChapterTreeController.updateRuleText);
     apiRouter.post("/updateSituation",rationChapterTreeController.auth, rationChapterTreeController.init, rationChapterTreeController.updateSituation);
+    apiRouter.post("/updateAnnoSituation",rationChapterTreeController.auth, rationChapterTreeController.init, rationChapterTreeController.updateAnnoSituation);
 
     apiRouter.post("/getRationItems",rationController.auth, rationController.init, rationController.getRationItemsBySection);
     apiRouter.post("/mixUpdateRationItems",rationController.auth, rationController.init, rationController.mixUpdateRationItems);
@@ -49,6 +50,7 @@ module.exports =  function (app) {
     apiRouter.post("/getRationGljIds",rationController.auth, rationController.init, rationController.getRationGljIds);
     apiRouter.post("/getRationsCodes",rationController.auth, rationController.init, rationController.getRationsCodes);
     apiRouter.post("/updateJobContent",rationController.auth, rationController.init, rationController.updateJobContent);
+    apiRouter.post("/updateAnnotation",rationController.auth, rationController.init, rationController.updateAnnotation);
 
     apiRouter.post("/createNewGljTypeNode",repositoryGljController.auth, repositoryGljController.init, repositoryGljController.createNewGljTypeNode);
     apiRouter.post("/updateGljNodes",repositoryGljController.auth, repositoryGljController.init, repositoryGljController.updateGljNodes);

+ 57 - 2
web/maintain/ration_repository/dinge.html

@@ -69,9 +69,9 @@
                           <li class="nav-item">
                               <a class="nav-link" data-toggle="tab" href="#tgz" role="tab">工作内容</a>
                           </li>
-                         <!-- <li class="nav-item">
+                          <li class="nav-item">
                               <a class="nav-link" data-toggle="tab" href="#tfz" role="tab">附注</a>
-                          </li>-->
+                          </li>
                       </ul>
                       <div class="tab-content">
                           <!--定额-->
@@ -331,6 +331,61 @@
                 </div>
             </div>
         </div>
+        <!--弹出附注-->
+        <div class="modal fade" id="fzEditBianmaQ" data-backdrop="static" style="display: none;" aria-hidden="true">
+            <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">
+                        <form>
+                            <div class="form-group">
+                                <label>编码</label>
+                                <div class="form-control">
+                                    <div class="row code" id="fzUpdateCon">
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                        <a href="javascript: void(0);" class="btn btn-primary" data-dismiss="modal" id="fzUpdateConBtn">确定</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="modal fade" id="fzEditBianma" data-backdrop="static" style="display: none;" aria-hidden="true">
+            <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">
+                        <form>
+                            <div class="form-group">
+                                <label>编码</label>
+                                <div class="form-control">
+                                    <div class="row code" id="fzAddCon">
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="modal-footer">
+                        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                        <a href="javascript: void(0);" class="btn btn-primary" data-dismiss="modal" id="fzAddConBtn">确定</a>
+                    </div>
+                </div>
+            </div>
+        </div>
         <!--弹出警告窗-->
         <button id="rationAlertBtn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#rationAlert" style="display: none"></button>
         <div class="modal fade" id="rationAlert" data-backdrop="static" style="display: none;" aria-hidden="true">

+ 81 - 11
web/maintain/ration_repository/js/ration.js

@@ -15,7 +15,6 @@ let rationOprObj = {
     currentRations: {},
     currentEditingRation: null,
     currentSectionId: -1,
-    activeCell: null,
     rationsCodes: [],
     setting: {
         header:[
@@ -57,7 +56,38 @@ let rationOprObj = {
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
-        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
+        //me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
+        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.SelectionChanged, me.onSelectionChanged);
+    },
+
+    onSelectionChanged: function (sender, info) {
+        if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
+            let row = info.newSelections[0].row;
+            let me = rationOprObj,
+                sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
+                sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
+                sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
+            sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
+            sheetCommonObj.shieldAllCells(sheetGLJ);
+            sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
+            sheetCommonObj.shieldAllCells(sheetCoe);
+            sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
+            sheetCommonObj.shieldAllCells(sheetAss);
+            let cacheSection = me.getCache();
+            if (cacheSection && row < cacheSection.length) {
+                rationGLJOprObj.getGljItems(cacheSection[row], function () {
+                    me.workBook.focus(true);
+                });
+                rationCoeOprObj.getCoeItems(cacheSection[row], function () {
+                    me.workBook.focus(true);
+                });
+                rationAssistOprObj.getAssItems(cacheSection[row]);
+            }
+            else {
+                rationGLJOprObj.currentRationItem = null;
+            }
+            me.workBook.focus(true);
+        }
     },
 
     onCellClick: function(sender, args) {
@@ -65,7 +95,6 @@ let rationOprObj = {
             sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
             sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
             sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting;
-        me.activeCell = {row: args.row, col: args.col};
         sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
         sheetCommonObj.shieldAllCells(sheetGLJ);
         sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
@@ -89,7 +118,9 @@ let rationOprObj = {
         };
         me.workBook.focus(true);
     },
-
+    isInt: function (num) {
+        return !isNaN(num) && num % 1 === 0;
+    },
     getCache: function() {
         let me = this, rst = me.currentRations["_SEC_ID_" + me.currentSectionId];
         if (!(rst)) {
@@ -249,7 +280,11 @@ let rationOprObj = {
         let dataCode = me.setting.header[args.col].dataCode;
         me.editingRowIdx = args.row;
         if (me.currentEditingRation["ID"]) {
-            rObj["ID"] = me.currentEditingRation["ID"];
+            if((!args.editingText || args.editingText.toString().trim().length === 0) && args.col === 0){
+                args.sheet.setValue(args.row, args.col, me.currentEditingRation[dataCode] + '');
+            }
+            else {
+                rObj["ID"] = me.currentEditingRation["ID"];
                 if(me.currentEditingRation[dataCode] !== rObj[dataCode]){
                     me.addRationItem = rObj;
                     if(dataCode === 'code'){
@@ -264,10 +299,20 @@ let rationOprObj = {
 
                         }
                     }
+                    else if(dataCode === 'feeType'){//取费专业控制为整数
+                        if(me.isInt(rObj[dataCode])){
+                            updateArr.push(rObj);
+                        }
+                        else {
+                            rObj[dataCode] = '';
+                            args.sheet.setValue(args.row, args.col, typeof me.currentEditingRation[dataCode] !== 'undefined' && me.currentEditingRation[dataCode] ? me.currentEditingRation[dataCode] : '');
+                        }
+                    }
                     else{
                         updateArr.push(rObj);
                     }
                 }
+            }
         }
         else if(!me.currentEditingRation["ID"]) {
             if (!sheetCommonObj.chkIfEmpty(rObj, me.setting)) {
@@ -279,6 +324,9 @@ let rationOprObj = {
                         if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
                             rObj.jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
                         }
+                        if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
+                            rObj.annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
+                        }
                         me.setInitPrc(rObj);
                         addArr.push(rObj);
                         me.rationsCodes.push(rObj.code);
@@ -324,7 +372,7 @@ let rationOprObj = {
         let cacheSection = me.getCache();
         let updateArr = [], addArr = [];
         let items = sheetCommonObj.analyzePasteData(me.setting, info);
-        let failPasteArr = [];
+        //let failPasteArr = [];
         for (let i = 0, rowIdx =info.cellRange.row; i < items.length; i++, rowIdx++) {
             if (cacheSection) {
                 if(!me.isValidUnit(items[i], rationUnits)){//无效单位
@@ -336,12 +384,15 @@ let rationOprObj = {
                         if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
                             items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
                         }
+                        if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
+                            items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
+                        }
                         me.setInitPrc(items[i]);
                         addArr.push(items[i]);
                         me.rationsCodes.push(items[i].code);
                     }
                     else{
-                        failPasteArr.push(items[i].code);
+                        //failPasteArr.push(items[i].code);
                         me.workBook.getSheet(0).setValue(rowIdx, 0, '');
                     }
                 }
@@ -351,6 +402,10 @@ let rationOprObj = {
                             items[i][me.setting.header[col].dataCode] = cacheSection[rowIdx][me.setting.header[col].dataCode];
                         }
                     }
+                    if(items[i].feeType && !me.isInt(items[i].feeType)){
+                        items[i].feeType = '';
+                        me.workBook.getSheet(0).setValue(rowIdx, 8, '');
+                    }
                     if(info.cellRange.col === 0){
                         if(me.rationsCodes.indexOf(items[i].code) === -1){
                             items[i].ID = cacheSection[rowIdx].ID;
@@ -378,12 +433,15 @@ let rationOprObj = {
                             if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
                                 items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
                             }
+                            if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
+                                items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
+                            }
                             me.setInitPrc(items[i]);
                             addArr.push(items[i]);
                         }
-                        else{
+                        /*else{
                             failPasteArr.push(items[i]);
-                        }
+                        }*/
                 }
             }
         };
@@ -456,6 +514,16 @@ let rationOprObj = {
                             jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));
                         }
                     }
+                    if(annotationOprObj ){
+                        annotationOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, annotationOprObj.radios);
+                        if(cacheSection.length === 0){
+                            annotationOprObj.updateAnnoSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
+                        }
+                        annotationOprObj.setRadiosChecked(annotationOprObj.currentSituation, annotationOprObj.radios);
+                        if(annotationOprObj.currentSituation === annotationOprObj.situations.PARTIAL){
+                            annotationOprObj.buildTablePartial(annotationOprObj.fzTablePartial, annotationOprObj.getGroup(cacheSection));
+                        }
+                    }
                     me.showRationItems(me.currentSectionId);
                     me.mixUpdate = 0;
                 }
@@ -474,7 +542,8 @@ let rationOprObj = {
                 //jobContent--
                 jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
                 jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
-                //jobContent--
+                //annotation
+                annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                 me.showRationItems(sectionID);
                 ///sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
                 sheetCommonObj.lockCells(rationGLJOprObj.sheet, rationGLJOprObj.setting);
@@ -496,7 +565,8 @@ let rationOprObj = {
                             //job--
                             jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
                             jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
-                            //job--
+                            //annotation
+                            annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                             me.showRationItems(sectionID);
                             //sheetCommonObj.unShieldAllCells(me.workBook.getSheet(0));
                             sheetCommonObj.lockCells(me.workBook.getSheet(0), rationOprObj.setting);

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

@@ -20,6 +20,11 @@ var pageOprObj = {
             $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
             $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
             jobContentOprObj.bindAllEvents($('#txtareaAll'));
+            //fz
+            annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
+            $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
+            $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
+            annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
         }
     }
 }
@@ -335,9 +340,13 @@ var zTreeOprObj = {
         explanatoryOprObj.setAttribute(explanatoryOprObj.currentTreeNode ? explanatoryOprObj.currentTreeNode : treeNode, treeNode, treeNode.explanation, treeNode.ruleText);
         explanatoryOprObj.clickUpdate($('#explanationShow'), $('#ruleTextShow'));
         explanatoryOprObj.showText($('#explanationShow'), $('#ruleTextShow'), treeNode.explanation, treeNode.ruleText);
+        //job
         jobContentOprObj.currentSituation = typeof treeNode.jobContentSituation !== 'undefined'? treeNode.jobContentSituation : jobContentOprObj.situations.NONE;
         jobContentOprObj.setAttribute(jobContentOprObj.currentTreeNode ? jobContentOprObj.currentTreeNode : treeNode, treeNode);
         jobContentOprObj.clickUpdate($('#txtareaAll'));
+        //fz
+        annotationOprObj.currentSituation = typeof treeNode.annotationSituation !== 'undefined'? treeNode.annotationSituation : annotationOprObj.situations.NONE;
+        annotationOprObj.clickUpdate($('#fzTxtareaAll'));
         var sectionID = treeNode.ID;
         if (!(treeNode.items) || treeNode.items.length == 0) {
             rationOprObj.workBook.getSheet(0).clearSelection();
@@ -345,6 +354,8 @@ var zTreeOprObj = {
         } else {
             jobContentOprObj.setRadiosDisabled(true, jobContentOprObj.radios);
             jobContentOprObj.hideTable($('#tableAll'), $('#tablePartial'));
+            annotationOprObj.setRadiosDisabled(true, annotationOprObj.radios);
+            annotationOprObj.hideTable($('#fzTableAll'), $('#fzTablePartial'));
             sheetCommonObj.cleanSheet(rationOprObj.workBook.getSheet(0), rationOprObj.setting, -1);
             sheetCommonObj.shieldAllCells(rationOprObj.workBook.getSheet(0));
         }
@@ -469,7 +480,7 @@ let jobContentOprObj = {
         let me = jobContentOprObj;
         if(txtarea.is(':focus')){
             let jobContent = txtarea.val();
-            if(jobContent !== me.jobContent){
+            if(jobContent !== me.currentJobContent){
                 me.preTreeNode.jobContent = jobContent;
                 me.unbindEvents(txtarea);
                 txtarea.blur();
@@ -482,6 +493,9 @@ let jobContentOprObj = {
                     me.bindAllEvents(txtarea);
                 })
             }
+            else {
+                txtarea.blur();
+            }
         }
     },
     getGroup: function (rationItems) {
@@ -831,7 +845,7 @@ let jobContentOprObj = {
             dataType: 'json',
             success: function (result) {
                 if(!result.error){
-                    me.updateRationItem(me.currentRationItems, updateArr);
+                    me.updateRationItem(jobContentOprObj.currentRationItems, updateArr);
                     callback();
                 }
             }
@@ -854,3 +868,407 @@ let jobContentOprObj = {
         })
     }
 };
+
+let annotationOprObj = {
+    situations: {ALL: 'ALL', PARTIAL: 'PARTIAL', NONE: 'NONE'},
+    currentSituation: null,//本项适用情况
+    radios: $("input[name = 'fzRadios']"),
+    fzTableAll: $('#fzTableAll'),
+    fzTablePartial: $('#fzTablePartial'),
+    currentOprTr: null,
+    currentAnnotation: null,
+    addCon: $('#fzAddCon'),//勾选编码模态框
+    updateCon: $('#fzUpdateCon'),//编辑编码模态框
+    clickUpdate: function (txtarea) {//解决编辑完后在未失去焦点的时候直接定额章节树
+        let me = annotationOprObj;
+        if(txtarea.is(':focus')){
+            let annotation = txtarea.val();
+            if(annotation !== me.currentAnnotation){
+                jobContentOprObj.preTreeNode.annotation = annotation;
+                me.unbindEvents(txtarea);
+                txtarea.blur();
+                let updateCodes = [];
+                for(let i = 0, len = jobContentOprObj.currentRationItems.length; i < len; i++){
+                    updateCodes.push(jobContentOprObj.currentRationItems[i].code);
+                    jobContentOprObj.currentRationItems[i].annotation = annotation;
+                }
+                me.updateAnnotation(pageOprObj.rationLibId, me.getUpdateArr(updateCodes, annotation), function () {
+                    me.bindAllEvents(txtarea);
+                });
+            }
+            else {
+                txtarea.blur();
+            }
+        }
+    },
+    getGroup: function (rationItems) {
+        let rst = [];//rst = [{jobContent: String, items: Array}]
+        for(let i = 0, len = rationItems.length; i < len; i++){
+            if(typeof rationItems[i].annotation !== 'undefined' && rationItems[i].annotation.toString().trim().length > 0){
+                let isExist = false;
+                for(let j = 0, jLen = rst.length; j < jLen; j++){
+                    if(rst[j].annotation === rationItems[i].annotation){
+                        isExist = true;
+                        rst[j].items.push(rationItems[i].code);
+                        break;
+                    }
+                }
+                if(!isExist){
+                    rst.push({annotation: rationItems[i].annotation, items: [rationItems[i].code]});
+                }
+            }
+        }
+        return rst;
+    },
+    hideTable: function (tableAll, tablePartial) {
+        if(tableAll){
+            tableAll.hide();
+        }
+        if(tablePartial){
+            tablePartial.hide();
+        }
+    },
+    //建table
+    buildTablePartial: function (table, group) {
+        let me = annotationOprObj;
+        table.empty();
+        let $thead = $("<thead><tr><th></th><th>编码</th><th>附注</th>/tr></thead>");
+        let $tbody = $("<tbody></tbody>");
+        let count = 1;
+        for(let i = 0, len = group.length; i < len; i++){
+            let $newTr = me.getNewTr($tbody, group[i].items, group[i].annotation);
+            $tbody.append($newTr);
+            count++;
+        }
+        let $trEnd = $("<tr><td>"+ count +"</td><td><a href data-toggle='modal' data-target='#fzEditBianma' class='m-0'>点击勾选编码</a></td><td><textarea class='form-control'></textarea></td></tr>");//勾选行
+        $($trEnd.children().children()[0]).bind('click', function () {
+            me.onclickFuncAdd($(this));
+            me.currentOprTr = $trEnd;
+            me.currentAnnotation = $(me.currentOprTr.children()[2]).children().val();
+        });
+        $tbody.append($trEnd);
+        table.append($thead);
+        table.append($tbody);
+    },
+    //新增一行tr
+    getNewTr: function (tbody, codes, jobContent) {
+        let me = annotationOprObj;
+        let count = tbody.children().length > 0 ? tbody.children().length : 1;
+        let $textTd = $("<td></td>");
+        let $textarea = $("<textarea class='form-control'></textarea>");
+        $textarea.val(jobContent);
+        $textTd.append($textarea);
+        let $tr = $("<tr><td>" + count + "</td><td><a href data-toggle='modal' data-target='#fzEditBianmaQ' class='m-0'>编辑编码</a></td></tr>");
+        $tr.children().children().bind('click', function () {
+            me.currentOprTr = $tr;
+            me.currentAnnotation = $(me.currentOprTr.children()[2]).children().val();
+            me.onclickFuncEdit($(this));
+        });
+        //文本变化;
+        $textarea.bind('change', function () {
+            let codes = me.getUpdateCodes($($(this).parent().parent().children()[1]).children());
+            let annotation = $(this).val();
+            me.updateAnnotation(pageOprObj.rationLibId, me.getUpdateArr(codes, annotation), function () {
+                if(annotation.trim().length === 0){
+                    me.buildTablePartial(me.fzTablePartial, me.getGroup(jobContentOprObj.currentRationItems));
+                }
+            });
+        });
+        $tr.append($textTd);
+        for(let i = 0, len = codes.length; i < len; i ++){
+            let $p = $("<p class='m-0'>" + codes[i] + "</p>");
+            $tr.children()[1].append($p[0]);
+        }
+        me.setTextareaHeight($textarea, codes.length + 1);
+        return $tr[0];
+    },
+    onclickFuncAdd: function (obj) {
+        let me = annotationOprObj;
+        let txtarea = $(obj.parent().parent().children().children()[1]);
+        let annotation = txtarea.val();
+        if(annotation.trim().length > 0){
+            let codesObj = me.getAddCodes(jobContentOprObj.currentRationItems);
+            me.buildCheckCodesCon(me.addCon, codesObj.checkedCodes, codesObj.disabledCodes)
+            obj.attr('data-target', '#fzEditBianma');
+        }
+        else{
+            obj.attr('data-target', '');
+            alert("附注不能为空!");
+        }
+    },
+    onclickFuncEdit: function (obj) {
+        let me = annotationOprObj;
+        me.buildEditableCodesCon(jobContentOprObj.currentRationItems, me.updateCon, me.getUpdateCodes(obj));
+    },
+    //获取编码td中的编码
+    getUpdateCodes: function (jq) {
+        let rst = [];
+        let nodes = jq.parent().children();
+        for(let i = 1, len = nodes.length; i < len; i++){
+            rst.push(nodes[i].textContent);
+        }
+        return rst;
+    },
+    //建一个编码checkbox Div
+    buildCodeOption: function (code, attr) {
+        let $div = $("<div class='col'><label class='form-check-label'><input class='form-check-input' type='checkbox' value= "+ code +"> "+ code +"</label></div>");
+        let $checkBox = $div.children().children();
+        if(attr){
+            $checkBox.attr(attr, true);
+        }
+        return $div;
+    },
+    //建修改编码弹窗
+    buildEditableCodesCon: function (rationItems, container, codes) {
+        let me = annotationOprObj;
+        let codeDivs = [];
+        container.empty();
+        for(let i = 0, len = codes.length; i < len; i++){
+            codeDivs.push({code: codes[i], attr: 'checked'});
+        }
+        for(let i = 0, len = rationItems.length; i < len; i++){
+            if(codes.indexOf(rationItems[i].code) === -1){
+                if(typeof rationItems[i].annotation !== 'undefined' && rationItems[i].annotation.toString().trim().length > 0){
+                    codeDivs.push({code: rationItems[i].code, attr: 'disabled'});
+                }
+                else{
+                    codeDivs.push({code: rationItems[i].code, attr: ''});
+                }
+            }
+        }
+        //排序
+        codeDivs.sort(function (a, b) {
+            let rst = 0;
+            if(a.code > b.code) rst = 1;
+            else if(a.code < b.code) rst = -1;
+            return rst;
+        });
+        for(let i = 0, len = codeDivs.length; i < len; i++){
+            container.append(me.buildCodeOption(codeDivs[i].code, codeDivs[i].attr));
+        }
+    },
+    //建勾选编码弹窗
+    buildCheckCodesCon: function (container, checkedCodes, disabledCodes) {
+        let me = annotationOprObj;
+        container.empty();
+        for(let i = 0, len = checkedCodes.length; i < len; i++){
+            let $codeDiv = me.buildCodeOption(checkedCodes[i], 'checked');
+            container.append($codeDiv);
+        }
+        for(let i = 0, len = disabledCodes.length; i < len; i++){
+            let $codeDiv = me.buildCodeOption(disabledCodes[i], 'disabled');
+            container.append($codeDiv);
+        }
+    },
+    getAddCodes: function (rationItems) {
+        let me = annotationOprObj;
+        let rst = {checkedCodes: [], disabledCodes: []};
+        for(let i = 0, len = rationItems.length; i < len; i++){
+            if(typeof rationItems[i].annotation !== 'undefined' && rationItems[i].annotation.toString().trim().length > 0){
+                rst.disabledCodes.push(rationItems[i].code);
+            }
+            else{
+                rst.checkedCodes.push(rationItems[i].code);
+            }
+        }
+        return rst;
+    },
+    //获取选择后的编码窗口的编码及状态
+    getCodesAfterS: function (checkNodes) {
+        let rst = {checked: [], unchecked: []};
+        for(let i = 0, len = checkNodes.length; i < len; i++){
+            if(checkNodes[i].checked){
+                rst.checked.push(checkNodes[i].value);
+            }
+            else if(!checkNodes[i].checked && !checkNodes[i].disabled){
+                rst.unchecked.push(checkNodes[i].value);
+            }
+        }
+        return rst;
+    },
+    setRadiosChecked: function (situation, radios) {
+        let me = annotationOprObj;
+        if(situation === me.situations.ALL){
+            radios[0].checked = true;
+            radios[1].checked = false;
+            $('#fzTxtareaAll').val(jobContentOprObj.currentRationItems.length > 0 ? jobContentOprObj.currentRationItems[0].annotation : '');
+            me.currentAnnotation = jobContentOprObj.currentRationItems.length > 0 ? jobContentOprObj.currentRationItems[0].annotation : '';
+            me.fzTableAll.show();
+            me.fzTablePartial.hide();
+        }
+        else if(situation === me.situations.PARTIAL){
+            radios[0].checked = false;
+            radios[1].checked = true;
+            me.fzTableAll.hide();
+            me.fzTablePartial.show();
+        }
+        else if(situation === me.situations.NONE){
+            radios[0].checked = false;
+            radios[1].checked = false;
+            me.fzTableAll.hide();
+            me.fzTablePartial.hide();
+        }
+    },
+    //radios是否可用,只有在定额章节树的底层节点才可用
+    setRadiosDisabled: function (val, radios) {
+        let me =annotationOprObj;
+        if(val){
+            radios[0].checked = false;
+            radios[1].checked = false;
+            me.currentSituation = me.situations.NONE;
+        }
+        radios.attr('disabled', val);
+    },
+    radiosChange: function (radios, tableAll, tablePartial) {
+        let me = annotationOprObj;
+        radios.change(function () {
+            let val = $("input[name = 'fzRadios']:checked").val();
+            let selectedNode = zTreeOprObj.treeObj.getSelectedNodes()[0];
+            me.updateAnnoSituation(pageOprObj.rationLibId, selectedNode.ID, val, function () {
+                selectedNode.annotationSituation = val;
+                me.currentSituation = val;
+                if(val === me.situations.ALL){
+                    let updateCodes = [];
+                    for(let i = 0, len = jobContentOprObj.currentRationItems.length; i < len; i++){
+                        updateCodes.push(jobContentOprObj.currentRationItems[i].code);
+                    }
+                    me.updateAnnotation(pageOprObj.rationLibId, me.getUpdateArr(updateCodes, ''), function () {
+                        me.currentAnnotation = '';
+                        $('#fzTxtareaAll').val('');
+                        tableAll.show();
+                        tablePartial.hide();
+                    });
+                }
+                else{
+                    me.buildTablePartial(me.fzTablePartial, me.getGroup(jobContentOprObj.currentRationItems));
+                    tableAll.hide();
+                    tablePartial.show();
+                }
+            });
+        });
+    },
+    setTextareaHeight: function (textarea, nodesCount) {
+        const perHeight = 21.6;
+        textarea.height(nodesCount * 21.6);
+    },
+    bindEvents: function (txtarea) {
+        let me = annotationOprObj;
+        txtarea.bind('change', function () {
+            let annotation = txtarea.val();
+            let jqNodes = txtarea.parent().parent().children()[1].children;
+            let updateCodes = me.getUpdateCodes(jqNodes);
+            txtarea.attr('disabled', true);
+            me.updateAnnotation(pageOprObj.rationLibId, me.getUpdateArr(updateCodes, annotation), function () {
+                txtarea.attr('disabled', false);
+            });
+        });
+    },
+    bindAllEvents: function (txtarea) {
+        let me = annotationOprObj;
+        txtarea.bind('change', function () {
+            let met = this;
+            let annotation = $(met).val();
+            $(met).attr('disabled', true);
+            let updateCodes = [];
+            for(let i = 0, len = jobContentOprObj.currentRationItems.length; i < len; i++){
+                updateCodes.push(jobContentOprObj.currentRationItems[i].code);
+                jobContentOprObj.currentRationItems[i].annotation = annotation;
+            }
+            me.currentAnnotation = annotation;
+            me.updateAnnotation(pageOprObj.rationLibId, me.getUpdateArr(updateCodes, annotation), function () {
+                $(met).attr('disabled', false);
+            });
+        });
+    },
+    unbindEvents: function (txtarea) {
+        txtarea.unbind();
+    },
+    //定额工作内容相关操作
+    rationAnnotationOpr: function (rationItems) {
+        let me = annotationOprObj;
+        me.setRadiosDisabled(rationItems.length > 0 ? false : true, me.radios);
+        me.setRadiosChecked(me.currentSituation, me.radios);
+        me.buildTablePartial(me.fzTablePartial, me.getGroup(rationItems));
+    },
+    getUpdateArr: function (updateCodes, annotation) {
+        let rst = [];
+        for(let i = 0, len = updateCodes.length; i < len; i++){
+            rst.push({code: updateCodes[i], annotation: annotation});
+        }
+        return rst;
+    },
+    bindAddConBtn: function () {
+        let me = annotationOprObj;
+        return function () {
+            let codesObj = me.getCodesAfterS(me.addCon.children().children().children());
+            let $tbody = $('#fzTablePartial tbody');
+            let lastEle = $tbody[0].lastElementChild;
+            let txtare = lastEle.lastElementChild.children[0];
+            if(me.currentAnnotation.trim().length > 0){//工作内容不为空才可添加编码
+                let updateArr = me.getUpdateArr(codesObj.checked, me.currentAnnotation);
+                me.updateAnnotation(pageOprObj.rationLibId, updateArr, function () {
+                    me.buildTablePartial(me.fzTablePartial, me.getGroup(jobContentOprObj.currentRationItems));
+                    $(txtare).val('');
+                });
+            }
+            else{
+                alert("附注不能为空!");
+            }
+        }
+    },
+    bindUpdateConBtn: function () {
+        let me = annotationOprObj;
+        return function () {
+            let codesObj = me.getCodesAfterS(me.updateCon.children().children().children());
+            let updateC = me.getUpdateArr(codesObj.checked, me.currentAnnotation),
+                updateUnC = me.getUpdateArr(codesObj.unchecked, ''),
+                updateArr = updateC.concat(updateUnC);
+            me.updateAnnotation(pageOprObj.rationLibId, updateArr, function () {
+                me.buildTablePartial(me.fzTablePartial, me.getGroup(jobContentOprObj.currentRationItems));
+            });
+        }
+    },
+    //更新缓存的定额
+    updateRationItem: function (rationItems, updateArr) {
+        for(let i = 0, len = rationItems.length; i < len; i++){
+            for(let j = 0, jLen = updateArr.length; j < jLen; j++){
+                if(rationItems[i].code === updateArr[j].code){
+                    rationItems[i].annotation = updateArr[j].annotation;
+                    break;
+                }
+            }
+        }
+    },
+    updateAnnotation: function (repId, updateArr, callback){
+        let me = annotationOprObj;
+        $.ajax({
+            type: 'post',
+            url: 'api/updateAnnotation',
+            data: {lastOpr: userAccount, repId: repId, updateArr: JSON.stringify(updateArr)},
+            dataType: 'json',
+            success: function (result) {
+                if(!result.error){
+                    me.updateRationItem(jobContentOprObj.currentRationItems, updateArr);
+                    callback();
+                }
+            }
+        });
+    },
+    updateAnnoSituation: function (repId, nodeId, situation, callback) {
+        let me = annotationOprObj;
+        $.ajax({
+            type: 'post',
+            url: 'api/updateAnnoSituation',
+            data: {lastOpr: userAccount, repId: repId, nodeId: nodeId, situation: situation},
+            dataType: 'json',
+            success: function (result) {
+                if(!result.error){
+                    if(callback){
+                        callback();
+                    }
+                }
+            }
+        })
+    }
+
+};