|
|
@@ -101,6 +101,11 @@ var gljOprObj = {
|
|
|
}
|
|
|
},
|
|
|
gljLibSheet: null,
|
|
|
+ scopeSetting:{},
|
|
|
+ scopeSpread:null,
|
|
|
+ scopeSheet:null,
|
|
|
+ scopeDatas:[],
|
|
|
+ scopeSelectedIDMap:{},
|
|
|
initSheet: function (sheet) {
|
|
|
var me = this;
|
|
|
me.sheet = sheet;
|
|
|
@@ -1083,7 +1088,6 @@ var gljOprObj = {
|
|
|
if (me.GLJSelection.length <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
- $("#glj_tree_div").modal('hide');
|
|
|
$.bootstrapLoading.start();
|
|
|
project.ration_glj.insertGLJAsRation(me.GLJSelection, selected, function (parentNodeID,nextNodeID,data) {
|
|
|
let newNode=null;
|
|
|
@@ -1126,7 +1130,6 @@ var gljOprObj = {
|
|
|
return rg ? false : true;
|
|
|
})
|
|
|
if (gljOprObj.GLJSelection.length > 0 && selected && selected.sourceType == ModuleNames.ration) {
|
|
|
- $("#glj_tree_div").modal('hide');
|
|
|
project.ration_glj.addGLJByLib(gljOprObj.GLJSelection, selected.data, function (result) {
|
|
|
if (result) {
|
|
|
selected.data.adjustState = result.adjustState;
|
|
|
@@ -1142,8 +1145,6 @@ var gljOprObj = {
|
|
|
});
|
|
|
}
|
|
|
});//doc.rationID=selected.data.ID;
|
|
|
- } else {
|
|
|
- $("#glj_tree_div").modal('hide');
|
|
|
}
|
|
|
},
|
|
|
doReplaceGLJ: function () {
|
|
|
@@ -1152,7 +1153,6 @@ var gljOprObj = {
|
|
|
let project = projectObj.project;
|
|
|
let selectCode = gljOprObj.GLJSelection[0];
|
|
|
let selected = projectObj.project.mainTree.selected;
|
|
|
- $("#glj_tree_div").modal('hide');
|
|
|
project.ration_glj.replaceGLJ(selectCode, oldData, function (result) {
|
|
|
if (result) {
|
|
|
//result.adjustState;
|
|
|
@@ -1187,7 +1187,6 @@ var gljOprObj = {
|
|
|
let oldData = me.sheetData[gljContextMenu.selectedRow];
|
|
|
let project = projectObj.project;
|
|
|
let selectCode = me.GLJSelection[0];
|
|
|
- $("#glj_tree_div").modal('hide');
|
|
|
project.ration_glj.mReplaceGLJ(selectCode, oldData, function (result,updateMap) {
|
|
|
if(result == null){
|
|
|
return;
|
|
|
@@ -1412,8 +1411,72 @@ var gljOprObj = {
|
|
|
me.gljTreeSetting.callback.onClick(null, 'gljTree', me.rootNode);
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ initScopeSpread:function() {
|
|
|
+ if (this.scopeSpread) return this.scopeSpread.repaint();
|
|
|
+ this.scopeSpread = SheetDataHelper.createNewSpread($('#scopeSpread')[0]);
|
|
|
+ sheetCommonObj.spreadDefaultStyle(this.scopeSpread);
|
|
|
+ this.scopeTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
|
|
|
+ this.scopeTreeController = TREE_SHEET_CONTROLLER.createNew(this.scopeTree, this.scopeSpread.getActiveSheet(), this.scopeSetting);
|
|
|
+ this.scopeSheet = this.scopeSpread.getActiveSheet();
|
|
|
+ this.scopeSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, this.onScopeChecked);
|
|
|
+ },
|
|
|
+ showScopeDatas:function () {
|
|
|
+ this.initScopeSpread();
|
|
|
+ this.scopeDatas =this.getScopeDatas();
|
|
|
+ this.scopeTree.loadDatas(this.scopeDatas);
|
|
|
+ this.scopeTreeController.showTreeData();
|
|
|
+ },
|
|
|
+ getScopeDatas:function () {
|
|
|
+ let controller = projectObj.mainController, project = projectObj.project;
|
|
|
+ let allNodes = [],datas = []
|
|
|
+ for(let rootNode of controller.tree.roots){
|
|
|
+ allNodes.push(rootNode);
|
|
|
+ controller.tree.getAllSubNode(rootNode.source,allNodes);
|
|
|
+ }
|
|
|
+ for(let n of allNodes){
|
|
|
+ let temData = {
|
|
|
+ ID:n.data.ID,
|
|
|
+ NextSiblingID:n.data.NextSiblingID,
|
|
|
+ ParentID:n.data.ParentID,
|
|
|
+ unit : n.data.unit,
|
|
|
+ code : n.data.code,
|
|
|
+ selected:0,
|
|
|
+ name : n.data.name,
|
|
|
+ quantity:calcTools.uiNodeQty(n)?calcTools.uiNodeQty(n):"",
|
|
|
+ };
|
|
|
+ if(n.data.feesIndex && n.data.feesIndex.common){
|
|
|
+ temData.unitPrice = n.data.feesIndex.common.unitFee;
|
|
|
+ temData.totalPrice = n.data.feesIndex.common.totalFee;
|
|
|
+ }
|
|
|
+ datas.push(temData);
|
|
|
+ }
|
|
|
+ return datas;
|
|
|
+ },
|
|
|
+ onScopeChecked:function (e,args) {
|
|
|
+ let me = gljOprObj,nodes = [];
|
|
|
+ var checkboxValue = args.sheet.getCell(args.row, args.col).value();
|
|
|
+ var newval = checkboxValue?0:1;
|
|
|
+ let node = me.scopeTree.items[args.row];
|
|
|
+ setNodeAndChildreSelected(node,newval,nodes);
|
|
|
+ me.scopeTreeController.refreshTreeNode(nodes);
|
|
|
+
|
|
|
+ function setNodeAndChildreSelected(n,val,arr){
|
|
|
+ n.data.selected = val;
|
|
|
+ nodes.push(n);
|
|
|
+ for(let c of n.children){
|
|
|
+ setNodeAndChildreSelected(c,val,arr)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setScopeSelection:function () {
|
|
|
+ for(let node of this.scopeTree.items){
|
|
|
+ //挑出选中数,过滤父节点
|
|
|
+ if(node.data.selected == 1 && node.children.length == 0) this.scopeSelectedIDMap[node.data.ID] = true
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
$(function () {
|
|
|
$('#glj_tree_div').on('shown.bs.modal', function (e) {
|
|
|
@@ -1485,6 +1548,13 @@ $(function () {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ $('#mreplace_next_div').on('shown.bs.modal', function (e) {
|
|
|
+ gljOprObj.scopeSelectedIDMap = {};
|
|
|
+ gljOprObj.showScopeDatas();
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$('#glj_tree_div').on('hidden.bs.modal', function () {
|
|
|
$('#gljSearchKeyword').val('');
|
|
|
});
|
|
|
@@ -1540,8 +1610,16 @@ $(function () {
|
|
|
}else if($('#actionType').val() == 'addMix'){
|
|
|
projectGljObject.addMixRatio();
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ $("#glj_tree_div").modal('hide');
|
|
|
+ });
|
|
|
+ $('#scope_position_confirm').click(function () {
|
|
|
+ gljOprObj.setScopeSelection();
|
|
|
+ gljOprObj.doMReplaceGLJ();
|
|
|
+ });
|
|
|
+ $('#replace_next_btn').click(function () {
|
|
|
+ $("#glj_tree_div").modal('hide');
|
|
|
+ $("#mreplace_next_div").modal('show');
|
|
|
+ });
|
|
|
$('#class_selected_conf').click(function () {
|
|
|
var gljClass = $('#selected_class').val();
|
|
|
var glj = gljOprObj.selectedGLJClass;
|