section_tree.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /**
  2. * Created by Zhong on 2017/12/18.
  3. */
  4. let pageOprObj = {
  5. rationLibName : null,
  6. rationLibId : null,
  7. gljLibId: null,
  8. initPage : function() {
  9. let me = this, rationLibId = getQueryString("repository");
  10. me.getRationLibInfo(rationLibId, function (rstData) {
  11. if(rstData.length > 0){
  12. me.rationLibName = rstData[0].dispName;
  13. me.gljLibId = rstData[0].gljLib;
  14. if(!me.gljLibId || typeof me.gljLibId === 'undefined' || me.gljLibId == -1){
  15. alert("没有引用人材机库!");
  16. window.location.href = "/rationRepository/main";
  17. }
  18. if (me.rationLibName) {
  19. var html = $("#rationname")[0].outerHTML;
  20. html = html.replace("XXX定额库", me.rationLibName);
  21. $("#rationname")[0].outerHTML = html;
  22. me.rationLibId = rationLibId;
  23. sectionTreeObj.getSectionTree(rationLibId);
  24. //job
  25. jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
  26. $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
  27. $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
  28. jobContentOprObj.bindAllEvents($('#txtareaAll'));
  29. //fz
  30. annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
  31. $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
  32. $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
  33. annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
  34. }
  35. }
  36. });
  37. },
  38. getRationLibInfo: function (rationLibId, callback) {
  39. CommonAjax.post('api/getRationLib', {libId: rationLibId}, callback);
  40. }
  41. }
  42. let sectionTreeObj = {
  43. cache: null,//ref to tree.items
  44. tree: null,
  45. controller: null,
  46. workBook: null,
  47. sheet: null,
  48. updateType: {new: 'new', update: 'update'},
  49. insertBtn: $('#tree_Insert'),
  50. removeBtn: $('#tree_remove'),
  51. upLevelBtn: $('#tree_upLevel'),
  52. downLevelBtn: $('#tree_downLevel'),
  53. downMoveBtn: $('#tree_downMove'),
  54. upMoveBtn: $('#tree_upMove'),
  55. setting: {
  56. sheet: {
  57. cols:[
  58. {
  59. head: {
  60. titleNames: ['名称'],
  61. spanCols: [1],
  62. spanRows: [2],
  63. vAlign: [1, 1],
  64. hAlign: [1, 1],
  65. font: 'Arial'
  66. },
  67. data: {
  68. field: 'name',
  69. vAlign: 1,
  70. hAlign: 0,
  71. font: 'Arial'
  72. },
  73. width: 400
  74. }
  75. ],
  76. headRows: 1,
  77. headRowHeight: [25],
  78. emptyRows: 0,
  79. treeCol: 0
  80. },
  81. tree: {
  82. id: 'ID',
  83. pid: 'ParentID',
  84. nid: 'NextSiblingID',
  85. rootId: -1
  86. },
  87. options: {
  88. tabStripVisible: false,
  89. allowContextMenu: false,
  90. allowCopyPasteExcelStyle : false,
  91. allowExtendPasteRange: false,
  92. allowUserDragDrop : false,
  93. allowUserDragFill: false,
  94. scrollbarMaxAlign : true
  95. }
  96. },
  97. isDef: function (v) {
  98. return v !== undefined && v !== null;
  99. },
  100. isFunc: function (v) {
  101. return this.isDef(v) && typeof v === 'function';
  102. },
  103. //sheet things
  104. setOptions: function (workbook, opts) {
  105. for(let opt in opts){
  106. workbook.options[opt] = opts[opt];
  107. }
  108. },
  109. renderFunc: function (sheet, func) {
  110. sheet.suspendPaint();
  111. sheet.suspendEvent();
  112. if(this.isFunc(func)){
  113. func();
  114. }
  115. sheet.resumePaint();
  116. sheet.resumeEvent();
  117. },
  118. buildSheet: function () {
  119. if(!this.isDef(this.workBook)){
  120. this.workBook = new GC.Spread.Sheets.Workbook($('#sectionSpread')[0], {sheetCount: 1});
  121. this.sheet = this.workBook.getActiveSheet();
  122. this.setOptions(this.workBook, this.setting.options);
  123. this.sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
  124. this.bindEvents(this.sheet);
  125. }
  126. },
  127. bindEvents: function (sheet) {
  128. let me = sectionTreeObj;
  129. const Events = GC.Spread.Sheets.Events;
  130. sheet.bind(Events.SelectionChanged, me.onSelectionChanged);
  131. sheet.bind(Events.EditEnded, me.onEditEnded);
  132. sheet.bind(Events.ClipboardPasted, me.onClipboardPasted);
  133. },
  134. onSelectionChanged: function (sender, info) {
  135. let me = sectionTreeObj;
  136. let row = info.newSelections[0].row;
  137. let section = me.cache[row];
  138. me.initSelection(section);
  139. /* if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
  140. }
  141. else {
  142. me.refreshBtn(null);
  143. }*/
  144. },
  145. onEditEnded: function (sender, args) {
  146. let me = sectionTreeObj;
  147. let postData = [];
  148. let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : '';
  149. let node = me.cache[args.row];
  150. if(me.isDef(node) && node.data.name !== v){
  151. let updateObj = me.getUpdateObj(me.updateType.update, node.getID(), null, null, v, null);
  152. postData.push(updateObj);
  153. //ajax
  154. //update
  155. me.sectionTreeAjax(postData, function (rstData) {
  156. node.data.name = v;
  157. }, function () {
  158. args.sheet.setValue(args.row, args.col, node.data.name ? node.data.name : '');
  159. });
  160. }
  161. },
  162. onClipboardPasted: function (sender, info) {
  163. let me = sectionTreeObj;
  164. let items = sheetCommonObj.analyzePasteData({header: [{dataCode: 'name'}]}, info);
  165. let postData = [];
  166. let frontData = [];
  167. for(let i = 0, len = items.length; i < len; i++){
  168. let row = info.cellRange.row + i;
  169. let node = me.cache[row];
  170. if(me.isDef(node) && me.isDef(items[i].name) && node.data.name !== items[i].name){
  171. let updateObj = me.getUpdateObj(me.updateType.update, node.getID(), null, null, items[i].name, null);
  172. postData.push(updateObj);
  173. frontData.push({row: row, name: items[i].name});
  174. node.data.name = items[i].name;
  175. }
  176. }
  177. if(postData.length > 0){
  178. //ajax
  179. me.sectionTreeAjax(postData, function (rstData) {
  180. for(let i = 0, len = frontData.length; i < len; i++){
  181. let node = me.cache[frontData[i]['row']];
  182. if(me.isDef(node)){
  183. node.data.name = frontData[i]['name'];
  184. }
  185. }
  186. }, function () {
  187. for(let i = 0, len = frontData.length; i < len; i++){
  188. let node = me.cache[frontData[i]['row']];
  189. me.sheet.setValue(frontData[i]['row'], 0, me.isDef(node) ? node.data.name : '');
  190. }
  191. });
  192. }
  193. },
  194. getSectionTree: function (repId) {
  195. let me = sectionTreeObj;
  196. let url = 'api/getRationTree';
  197. let postData = {rationLibId: repId};
  198. let sucFunc = function (rstData) {
  199. if(rstData.length > 0){
  200. storageUtil.setSessionCache("RationGrp","repositoryID",rstData[0].rationRepId);
  201. }
  202. //init
  203. me.buildSheet();
  204. me.initTree(rstData);
  205. me.cache = me.tree.items;
  206. me.bindBtn();
  207. me.initController(me.tree, me.sheet, me.setting.sheet);
  208. me.controller.showTreeData();
  209. me.sheet.setFormatter(-1, 0, '@');
  210. me.initSelection(me.tree.selected);
  211. explanatoryOprObj.bindEvents($('#explanationShow'), $('#ruleTextShow'));
  212. };
  213. let errFunc = function () {
  214. };
  215. CommonAjax.post(url, postData, sucFunc, errFunc);
  216. },
  217. initTree: function (datas) {
  218. this.tree = idTree.createNew(this.setting.tree);
  219. this.tree.loadDatas(datas);
  220. this.tree.selected = this.tree.items.length > 0 ? this.tree.items[0] : null;
  221. },
  222. initController: function (tree, sheet, setting) {
  223. this.controller = TREE_SHEET_CONTROLLER.createNew(tree, sheet, setting);
  224. },
  225. refreshBtn: function (selected) {
  226. let me = this;
  227. me.insertBtn.removeClass('disabled');
  228. me.removeBtn.removeClass('disabled');
  229. me.upLevelBtn.removeClass('disabled');
  230. me.downLevelBtn.removeClass('disabled');
  231. me.downMoveBtn.removeClass('disabled');
  232. me.upMoveBtn.removeClass('disabled');
  233. if(!me.isDef(selected)){
  234. me.removeBtn.addClass('disabled');
  235. me.upLevelBtn.addClass('disabled');
  236. me.downLevelBtn.addClass('disabled');
  237. me.downMoveBtn.addClass('disabled');
  238. me.upMoveBtn.addClass('disabled');
  239. }
  240. else {
  241. if(!me.isDef(selected.preSibling)){
  242. me.downLevelBtn.addClass('disabled');
  243. me.upMoveBtn.addClass('disabled');
  244. }
  245. if(!me.isDef(selected.nextSibling)){
  246. me.downMoveBtn.addClass('disabled');
  247. }
  248. if(!me.isDef(selected.parent)){
  249. me.upLevelBtn.addClass('disabled');
  250. }
  251. }
  252. },
  253. bindBtn: function () {
  254. let me = this;
  255. me.insertBtn.click(function () {
  256. me.insert();
  257. });
  258. $('#delConfirm').click(function () {
  259. me.remove(me.tree.selected);
  260. });
  261. me.removeBtn.click(function () {
  262. $('#delAlert').modal('show');
  263. });
  264. me.upLevelBtn.click(function () {
  265. me.upLevel(me.tree.selected);
  266. });
  267. me.downLevelBtn.click(function () {
  268. me.downLevel(me.tree.selected);
  269. });
  270. me.downMoveBtn.click(function () {
  271. me.downMove(me.tree.selected);
  272. });
  273. me.upMoveBtn.click(function () {
  274. me.upMove(me.tree.selected);
  275. });
  276. },
  277. insert: function () {
  278. let me = sectionTreeObj;
  279. me.insertBtn.addClass('disabled');
  280. let postData = [];
  281. CommonAjax.post('api/getNewRationTreeID', {}, function (newID) {
  282. if(!me.isDef(newID)){
  283. return;
  284. }
  285. me.tree.maxNodeID(newID - 1);
  286. let selected = me.tree.selected;
  287. let insertObj = me.getUpdateObj(me.updateType.new, newID, -1, -1, '', null);
  288. if(me.isDef(selected)) {
  289. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), newID, null, null, null);
  290. postData.push(updateObj);
  291. insertObj.updateData.ParentID = selected.getParentID();
  292. if(me.isDef(selected.nextSibling)){
  293. insertObj.updateData.NextSiblingID = selected.getNextSiblingID();
  294. }
  295. }
  296. postData.push(insertObj);
  297. if(postData.length > 0){
  298. //ajax
  299. me.sectionTreeAjax(postData, function (rstData) {
  300. me.controller.insert();
  301. me.refreshBtn(me.tree.selected);
  302. //fresh tools
  303. me.initTools(me.tree.selected);
  304. me.workBook.focus();
  305. me.initSelection(me.tree.selected);
  306. });
  307. }
  308. });
  309. },
  310. remove: function (selected) {
  311. let me = this;
  312. me.removeBtn.addClass('disabled');
  313. let postData = [], IDs = [];
  314. if(!selected){
  315. return;
  316. }
  317. getDelIds(selected);
  318. function getDelIds(node){
  319. if(me.isDef(node)){
  320. IDs.push(node.getID());
  321. if(node.children.length > 0){
  322. for(let i = 0, len = node.children.length; i < len; i++){
  323. getDelIds(node.children[i]);
  324. }
  325. }
  326. }
  327. }
  328. if(me.isDef(selected.preSibling)){
  329. let updateObj = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  330. postData.push(updateObj);
  331. }
  332. if(IDs.length > 0){
  333. for(let i = 0, len = IDs.length; i < len; i++){
  334. let delObj = me.getUpdateObj(me.updateType.update, IDs[i], null, null, null, true);
  335. postData.push(delObj);
  336. }
  337. }
  338. if(postData.length > 0){
  339. //ajax
  340. me.sectionTreeAjax(postData, function (rstData) {
  341. $('#delAlert').modal('hide');
  342. me.removeRationsCodes(rationOprObj.currentRations["_SEC_ID_" + selected.data.ID]);
  343. me.controller.delete();
  344. me.refreshBtn(me.tree.selected);
  345. me.initTools(me.tree.selected);
  346. me.initSelection(me.tree.selected);
  347. me.workBook.focus();
  348. });
  349. }
  350. },
  351. removeRationsCodes: function (rations) {
  352. for(let ration of rations){
  353. rationOprObj.rationsCodes.splice(rationOprObj.rationsCodes.indexOf(ration.code), 1);
  354. }
  355. },
  356. getSameDepthNodes: function(){
  357. let rst = [];
  358. let sel = this.sheet.getSelections()[0];
  359. let selectedDepth = this.tree.selected.depth();
  360. for(let i = 0; i < sel.rowCount; i++){
  361. let row = sel.row + i;
  362. if(this.cache[row].depth() === selectedDepth){
  363. rst.push(this.cache[row]);
  364. }
  365. }
  366. return rst;
  367. },
  368. upLevel: function (selected) {
  369. let me = this;
  370. me.upLevelBtn.addClass('disabled');
  371. let postData = [];
  372. let selNodes = me.getSameDepthNodes();
  373. if(selNodes.length <= 0){
  374. return ;
  375. }
  376. let firstParent = selNodes[0].parent;
  377. if(!me.isDef(firstParent)){
  378. return;
  379. }
  380. //更新父节点
  381. postData.push(me.getUpdateObj(me.updateType.update, firstParent.getID(), selNodes[0].getID(), null, null, null));
  382. //更新前节点
  383. if(me.isDef(selNodes[0].preSibling)){
  384. postData.push(me.getUpdateObj(me.updateType.update, selNodes[0].preSibling.getID(), -1, null, null, null));
  385. }
  386. //更新选中节点的后兄弟节点
  387. let lastSelNode = selNodes[selNodes.length - 1];
  388. let nextIDs = [];
  389. getNext(lastSelNode);
  390. function getNext(node){
  391. if(me.isDef(node.nextSibling)){
  392. nextIDs.push(node.getNextSiblingID());
  393. getNext(node.nextSibling);
  394. }
  395. }
  396. for(let nextID of nextIDs){
  397. postData.push(me.getUpdateObj(me.updateType.update, nextID, null, lastSelNode.getID(), null, null));
  398. }
  399. //更新选中节点
  400. for(let i = 0; i < selNodes.length; i++){
  401. let selNode = selNodes[i];
  402. let nid = i === selNodes.length - 1 ? firstParent.getNextSiblingID() : selNode.getNextSiblingID();
  403. postData.push(me.getUpdateObj(me.updateType.update, selNode.getID(), nid, firstParent.getParentID(), null, null));
  404. }
  405. if(postData.length > 0){
  406. //ajax
  407. me.sectionTreeAjax(postData, function (rstData) {
  408. for(let selNode of selNodes){
  409. me.controller.setTreeSelected(selNode);
  410. me.controller.upLevel();
  411. }
  412. me.refreshBtn(me.tree.selected);
  413. me.workBook.focus();
  414. });
  415. }
  416. },
  417. downLevel: function (selected) {
  418. let me = this;
  419. me.downLevelBtn.addClass('disabled');
  420. let postData = [];
  421. let selNodes = me.getSameDepthNodes();
  422. if(selNodes.length <= 0 ){
  423. return;
  424. }
  425. let firstPreSibling = selNodes[0].preSibling;
  426. if(!me.isDef(firstPreSibling)){
  427. return;
  428. }
  429. //更新前节点
  430. postData.push(me.getUpdateObj(me.updateType.update, firstPreSibling.getID(), selNodes[selNodes.length - 1].getNextSiblingID(), null, null, null));
  431. //更新前节点最末子节点
  432. if(firstPreSibling.children.length > 0){
  433. postData.push(me.getUpdateObj(me.updateType.update, firstPreSibling.children[firstPreSibling.children.length - 1].getID(), selNodes[0].getID(), null, null, null));
  434. }
  435. //更新选中节点
  436. for(let i = 0; i < selNodes.length; i++){
  437. let selNode = selNodes[i];
  438. postData.push(me.getUpdateObj(me.updateType.update, selNode.getID(), i === selNodes.length - 1 ? -1 : selNode.getNextSiblingID(), firstPreSibling.getID(), null, null));
  439. }
  440. if(postData.length > 0){
  441. //ajax
  442. me.sectionTreeAjax(postData, function (rstData) {
  443. for(let selNode of selNodes){
  444. me.controller.setTreeSelected(selNode);
  445. me.controller.downLevel();
  446. }
  447. me.refreshBtn(me.tree.selected);
  448. me.workBook.focus();
  449. });
  450. }
  451. },
  452. upMove: function (selected) {
  453. let me = this;
  454. me.upMoveBtn.addClass('disabled');
  455. let postData = [];
  456. if(!me.isDef(selected)){
  457. return;
  458. }
  459. if(!me.isDef(selected.preSibling)){
  460. return;
  461. }
  462. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), selected.preSibling.getID(), null, null, null);
  463. postData.push(updateObj);
  464. let updatePre = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  465. postData.push(updatePre);
  466. if(me.isDef(selected.preSibling.preSibling)){
  467. let updatePrepre = me.getUpdateObj(me.updateType.update, selected.preSibling.preSibling.getID(), selected.getID(), null, null, null);
  468. postData.push(updatePrepre);
  469. }
  470. if(postData.length > 0){
  471. //ajax
  472. me.sectionTreeAjax(postData, function (rstData) {
  473. me.controller.upMove();
  474. me.refreshBtn(me.tree.selected);
  475. me.workBook.focus();
  476. });
  477. }
  478. },
  479. downMove: function (selected) {
  480. let me = this;
  481. me.downMoveBtn.addClass('disabled');
  482. let postData = [];
  483. if(!me.isDef(selected)){
  484. return;
  485. }
  486. if(!me.isDef(selected.nextSibling)){
  487. return;
  488. }
  489. if(me.isDef(selected.preSibling)){
  490. let updatePre = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  491. postData.push(updatePre);
  492. }
  493. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), selected.nextSibling.getNextSiblingID(), null, null, null);
  494. postData.push(updateObj);
  495. let updateNext = me.getUpdateObj(me.updateType.update, selected.getNextSiblingID(), selected.getID(), null, null, null);
  496. postData.push(updateNext);
  497. if(postData.length > 0){
  498. //ajax
  499. me.sectionTreeAjax(postData, function (rstData) {
  500. me.controller.downMove();
  501. me.refreshBtn(me.tree.selected);
  502. me.workBook.focus();
  503. });
  504. }
  505. },
  506. getUpdateObj: function (updateType, id, nid, pid, name, deleted) {
  507. let updateObj = Object.create(null);
  508. updateObj.updateType = '';
  509. updateObj.updateData = Object.create(null);
  510. updateObj.updateData.rationRepId = pageOprObj.rationLibId;
  511. if(this.isDef(updateType)){
  512. updateObj.updateType = updateType;
  513. }
  514. if(this.isDef(id)){
  515. updateObj.updateData.ID = id;
  516. }
  517. if(this.isDef(nid)){
  518. updateObj.updateData.NextSiblingID = nid;
  519. }
  520. if(this.isDef(pid)){
  521. updateObj.updateData.ParentID = pid;
  522. }
  523. if(this.isDef(name)){
  524. updateObj.updateData.name = name;
  525. }
  526. if(this.isDef(deleted)){
  527. updateObj.updateData.isDeleted = true;
  528. }
  529. return updateObj;
  530. },
  531. sectionTreeAjax: function (postData, scFunc, errFunc) {
  532. CommonAjax.post('api/updateNodes', {updateData: postData, lastOpr: userAccount}, scFunc, errFunc);
  533. },
  534. initTools: function (node) {
  535. if(this.isDef(node)){
  536. explanatoryOprObj.setAttribute(explanatoryOprObj.currentTreeNode ? explanatoryOprObj.currentTreeNode : node, node, node.data.explanation, node.data.ruleText);
  537. explanatoryOprObj.clickUpdate($('#explanationShow'), $('#ruleTextShow'));
  538. explanatoryOprObj.showText($('#explanationShow'), $('#ruleTextShow'), node.data.explanation, node.data.ruleText);
  539. //job
  540. jobContentOprObj.currentSituation = typeof node.data.jobContentSituation !== 'undefined'? node.data.jobContentSituation : jobContentOprObj.situations.NONE;
  541. jobContentOprObj.setAttribute(jobContentOprObj.currentTreeNode ? jobContentOprObj.currentTreeNode : node, node);
  542. jobContentOprObj.clickUpdate($('#txtareaAll'));
  543. //fz
  544. annotationOprObj.currentSituation = typeof node.data.annotationSituation !== 'undefined'? node.data.annotationSituation : annotationOprObj.situations.NONE;
  545. annotationOprObj.clickUpdate($('#fzTxtareaAll'));
  546. }
  547. },
  548. //模仿默认点击
  549. initSelection: function (node) {
  550. let me = this;
  551. if(!me.isDef(node)){
  552. sheetCommonObj.cleanSheet(rationOprObj.workBook.getActiveSheet(), rationOprObj.setting, -1);
  553. sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
  554. sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
  555. sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
  556. sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
  557. return;
  558. }
  559. me.workBook.getActiveSheet().setActiveCell(node.serialNo(), 0);
  560. me.initTools(node);
  561. me.refreshBtn(node);
  562. if(!me.isDef(node.children) || node.children.length === 0){
  563. rationOprObj.canRations = true;
  564. rationOprObj.workBook.getSheet(0).clearSelection();
  565. rationOprObj.getRationItems(node.data.ID);
  566. rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), 'dynamic');
  567. }
  568. else {
  569. rationOprObj.canRations = false;
  570. rationOprObj.currentSectionId = node.data.ID;
  571. rationOprObj.workBook.getSheet(0).setRowCount(30);
  572. rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), null);
  573. jobContentOprObj.setRadiosDisabled(true, jobContentOprObj.radios);
  574. jobContentOprObj.hideTable($('#tableAll'), $('#tablePartial'));
  575. annotationOprObj.setRadiosDisabled(true, annotationOprObj.radios);
  576. annotationOprObj.hideTable($('#fzTableAll'), $('#fzTablePartial'));
  577. sheetCommonObj.cleanSheet(rationOprObj.workBook.getSheet(0), rationOprObj.setting, -1);
  578. rationGLJOprObj.sheet.getParent().focus(false);
  579. }
  580. sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
  581. sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
  582. sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
  583. sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
  584. me.workBook.focus(true);
  585. }
  586. };