section_tree.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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. me.removeBtn.click(function () {
  259. me.remove(me.tree.selected);
  260. });
  261. me.upLevelBtn.click(function () {
  262. me.upLevel(me.tree.selected);
  263. });
  264. me.downLevelBtn.click(function () {
  265. me.downLevel(me.tree.selected);
  266. });
  267. me.downMoveBtn.click(function () {
  268. me.downMove(me.tree.selected);
  269. });
  270. me.upMoveBtn.click(function () {
  271. me.upMove(me.tree.selected);
  272. });
  273. },
  274. insert: function () {
  275. let me = this;
  276. me.insertBtn.addClass('disabled');
  277. let postData = [];
  278. CommonAjax.post('api/getNewRationTreeID', {}, function (newID) {
  279. if(!me.isDef(newID)){
  280. return;
  281. }
  282. me.tree.maxNodeID(newID - 1);
  283. let selected = me.tree.selected;
  284. let insertObj = me.getUpdateObj(me.updateType.new, newID, -1, -1, '', null);
  285. if(me.isDef(selected)) {
  286. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), newID, null, null, null);
  287. postData.push(updateObj);
  288. insertObj.updateData.ParentID = selected.getParentID();
  289. if(me.isDef(selected.nextSibling)){
  290. insertObj.updateData.NextSiblingID = selected.getNextSiblingID();
  291. }
  292. }
  293. postData.push(insertObj);
  294. if(postData.length > 0){
  295. //ajax
  296. me.sectionTreeAjax(postData, function (rstData) {
  297. me.controller.insert();
  298. me.refreshBtn(me.tree.selected);
  299. //fresh tools
  300. me.initTools(me.tree.selected);
  301. me.workBook.focus();
  302. me.initSelection(me.tree.selected);
  303. });
  304. }
  305. });
  306. },
  307. remove: function (selected) {
  308. let me = this;
  309. me.removeBtn.addClass('disabled');
  310. let postData = [], IDs = [];
  311. if(!selected){
  312. return;
  313. }
  314. getDelIds(selected);
  315. function getDelIds(node){
  316. if(me.isDef(node)){
  317. IDs.push(node.getID());
  318. if(node.children.length > 0){
  319. for(let i = 0, len = node.children.length; i < len; i++){
  320. getDelIds(node.children[i]);
  321. }
  322. }
  323. }
  324. }
  325. if(me.isDef(selected.preSibling)){
  326. let updateObj = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  327. postData.push(updateObj);
  328. }
  329. if(IDs.length > 0){
  330. for(let i = 0, len = IDs.length; i < len; i++){
  331. let delObj = me.getUpdateObj(me.updateType.update, IDs[i], null, null, null, true);
  332. postData.push(delObj);
  333. }
  334. }
  335. if(postData.length > 0){
  336. //ajax
  337. me.sectionTreeAjax(postData, function (rstData) {
  338. me.removeRationsCodes(rationOprObj.currentRations["_SEC_ID_" + selected.data.ID]);
  339. me.controller.delete();
  340. me.refreshBtn(me.tree.selected);
  341. me.initTools(me.tree.selected);
  342. me.initSelection(me.tree.selected);
  343. me.workBook.focus();
  344. });
  345. }
  346. },
  347. removeRationsCodes: function (rations) {
  348. for(let ration of rations){
  349. rationOprObj.rationsCodes.splice(rationOprObj.rationsCodes.indexOf(ration.code), 1);
  350. }
  351. },
  352. getSameDepthNodes: function(){
  353. let rst = [];
  354. let sel = this.sheet.getSelections()[0];
  355. let selectedDepth = this.tree.selected.depth();
  356. for(let i = 0; i < sel.rowCount; i++){
  357. let row = sel.row + i;
  358. if(this.cache[row].depth() === selectedDepth){
  359. rst.push(this.cache[row]);
  360. }
  361. }
  362. return rst;
  363. },
  364. upLevel: function (selected) {
  365. let me = this;
  366. me.upLevelBtn.addClass('disabled');
  367. let postData = [];
  368. let selNodes = me.getSameDepthNodes();
  369. if(selNodes.length <= 0){
  370. return ;
  371. }
  372. let firstParent = selNodes[0].parent;
  373. if(!me.isDef(firstParent)){
  374. return;
  375. }
  376. //更新父节点
  377. postData.push(me.getUpdateObj(me.updateType.update, firstParent.getID(), selNodes[0].getID(), null, null, null));
  378. //更新前节点
  379. if(me.isDef(selNodes[0].preSibling)){
  380. postData.push(me.getUpdateObj(me.updateType.update, selNodes[0].preSibling.getID(), -1, null, null, null));
  381. }
  382. //更新选中节点的后兄弟节点
  383. let lastSelNode = selNodes[selNodes.length - 1];
  384. let nextIDs = [];
  385. getNext(lastSelNode);
  386. function getNext(node){
  387. if(me.isDef(node.nextSibling)){
  388. nextIDs.push(node.getNextSiblingID());
  389. getNext(node.nextSibling);
  390. }
  391. }
  392. for(let nextID of nextIDs){
  393. postData.push(me.getUpdateObj(me.updateType.update, nextID, null, lastSelNode.getID(), null, null));
  394. }
  395. //更新选中节点
  396. for(let i = 0; i < selNodes.length; i++){
  397. let selNode = selNodes[i];
  398. let nid = i === selNodes.length - 1 ? firstParent.getNextSiblingID() : selNode.getNextSiblingID();
  399. postData.push(me.getUpdateObj(me.updateType.update, selNode.getID(), nid, firstParent.getParentID(), null, null));
  400. }
  401. if(postData.length > 0){
  402. //ajax
  403. me.sectionTreeAjax(postData, function (rstData) {
  404. for(let selNode of selNodes){
  405. me.controller.setTreeSelected(selNode);
  406. me.controller.upLevel();
  407. }
  408. me.refreshBtn(me.tree.selected);
  409. me.workBook.focus();
  410. });
  411. }
  412. },
  413. downLevel: function (selected) {
  414. let me = this;
  415. me.downLevelBtn.addClass('disabled');
  416. let postData = [];
  417. let selNodes = me.getSameDepthNodes();
  418. if(selNodes.length <= 0 ){
  419. return;
  420. }
  421. let firstPreSibling = selNodes[0].preSibling;
  422. if(!me.isDef(firstPreSibling)){
  423. return;
  424. }
  425. //更新前节点
  426. postData.push(me.getUpdateObj(me.updateType.update, firstPreSibling.getID(), selNodes[selNodes.length - 1].getNextSiblingID(), null, null, null));
  427. //更新前节点最末子节点
  428. if(firstPreSibling.children.length > 0){
  429. postData.push(me.getUpdateObj(me.updateType.update, firstPreSibling.children[firstPreSibling.children.length - 1].getID(), selNodes[0].getID(), null, null, null));
  430. }
  431. //更新选中节点
  432. for(let i = 0; i < selNodes.length; i++){
  433. let selNode = selNodes[i];
  434. postData.push(me.getUpdateObj(me.updateType.update, selNode.getID(), i === selNodes.length - 1 ? -1 : selNode.getNextSiblingID(), firstPreSibling.getID(), null, null));
  435. }
  436. if(postData.length > 0){
  437. //ajax
  438. me.sectionTreeAjax(postData, function (rstData) {
  439. for(let selNode of selNodes){
  440. me.controller.setTreeSelected(selNode);
  441. me.controller.downLevel();
  442. }
  443. me.refreshBtn(me.tree.selected);
  444. me.workBook.focus();
  445. });
  446. }
  447. },
  448. upMove: function (selected) {
  449. let me = this;
  450. me.upMoveBtn.addClass('disabled');
  451. let postData = [];
  452. if(!me.isDef(selected)){
  453. return;
  454. }
  455. if(!me.isDef(selected.preSibling)){
  456. return;
  457. }
  458. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), selected.preSibling.getID(), null, null, null);
  459. postData.push(updateObj);
  460. let updatePre = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  461. postData.push(updatePre);
  462. if(me.isDef(selected.preSibling.preSibling)){
  463. let updatePrepre = me.getUpdateObj(me.updateType.update, selected.preSibling.preSibling.getID(), selected.getID(), null, null, null);
  464. postData.push(updatePrepre);
  465. }
  466. if(postData.length > 0){
  467. //ajax
  468. me.sectionTreeAjax(postData, function (rstData) {
  469. me.controller.upMove();
  470. me.refreshBtn(me.tree.selected);
  471. me.workBook.focus();
  472. });
  473. }
  474. },
  475. downMove: function (selected) {
  476. let me = this;
  477. me.downMoveBtn.addClass('disabled');
  478. let postData = [];
  479. if(!me.isDef(selected)){
  480. return;
  481. }
  482. if(!me.isDef(selected.nextSibling)){
  483. return;
  484. }
  485. if(me.isDef(selected.preSibling)){
  486. let updatePre = me.getUpdateObj(me.updateType.update, selected.preSibling.getID(), selected.getNextSiblingID(), null, null, null);
  487. postData.push(updatePre);
  488. }
  489. let updateObj = me.getUpdateObj(me.updateType.update, selected.getID(), selected.nextSibling.getNextSiblingID(), null, null, null);
  490. postData.push(updateObj);
  491. let updateNext = me.getUpdateObj(me.updateType.update, selected.getNextSiblingID(), selected.getID(), null, null, null);
  492. postData.push(updateNext);
  493. if(postData.length > 0){
  494. //ajax
  495. me.sectionTreeAjax(postData, function (rstData) {
  496. me.controller.downMove();
  497. me.refreshBtn(me.tree.selected);
  498. me.workBook.focus();
  499. });
  500. }
  501. },
  502. getUpdateObj: function (updateType, id, nid, pid, name, deleted) {
  503. let updateObj = Object.create(null);
  504. updateObj.updateType = '';
  505. updateObj.updateData = Object.create(null);
  506. updateObj.updateData.rationRepId = pageOprObj.rationLibId;
  507. if(this.isDef(updateType)){
  508. updateObj.updateType = updateType;
  509. }
  510. if(this.isDef(id)){
  511. updateObj.updateData.ID = id;
  512. }
  513. if(this.isDef(nid)){
  514. updateObj.updateData.NextSiblingID = nid;
  515. }
  516. if(this.isDef(pid)){
  517. updateObj.updateData.ParentID = pid;
  518. }
  519. if(this.isDef(name)){
  520. updateObj.updateData.name = name;
  521. }
  522. if(this.isDef(deleted)){
  523. updateObj.updateData.isDeleted = true;
  524. }
  525. return updateObj;
  526. },
  527. sectionTreeAjax: function (postData, scFunc, errFunc) {
  528. CommonAjax.post('api/updateNodes', {updateData: postData, lastOpr: userAccount}, scFunc, errFunc);
  529. },
  530. initTools: function (node) {
  531. if(this.isDef(node)){
  532. explanatoryOprObj.setAttribute(explanatoryOprObj.currentTreeNode ? explanatoryOprObj.currentTreeNode : node, node, node.data.explanation, node.data.ruleText);
  533. explanatoryOprObj.clickUpdate($('#explanationShow'), $('#ruleTextShow'));
  534. explanatoryOprObj.showText($('#explanationShow'), $('#ruleTextShow'), node.data.explanation, node.data.ruleText);
  535. //job
  536. jobContentOprObj.currentSituation = typeof node.data.jobContentSituation !== 'undefined'? node.data.jobContentSituation : jobContentOprObj.situations.NONE;
  537. jobContentOprObj.setAttribute(jobContentOprObj.currentTreeNode ? jobContentOprObj.currentTreeNode : node, node);
  538. jobContentOprObj.clickUpdate($('#txtareaAll'));
  539. //fz
  540. annotationOprObj.currentSituation = typeof node.data.annotationSituation !== 'undefined'? node.data.annotationSituation : annotationOprObj.situations.NONE;
  541. annotationOprObj.clickUpdate($('#fzTxtareaAll'));
  542. }
  543. },
  544. //模仿默认点击
  545. initSelection: function (node) {
  546. let me = this;
  547. if(!me.isDef(node)){
  548. sheetCommonObj.cleanSheet(rationOprObj.workBook.getActiveSheet(), rationOprObj.setting, -1);
  549. sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
  550. sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
  551. sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
  552. sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
  553. return;
  554. }
  555. me.workBook.getActiveSheet().setActiveCell(node.serialNo(), 0);
  556. me.initTools(node);
  557. me.refreshBtn(node);
  558. if(!me.isDef(node.children) || node.children.length === 0){
  559. rationOprObj.canRations = true;
  560. rationOprObj.workBook.getSheet(0).clearSelection();
  561. rationOprObj.getRationItems(node.data.ID);
  562. rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), 'dynamic');
  563. }
  564. else {
  565. rationOprObj.canRations = false;
  566. rationOprObj.currentSectionId = node.data.ID;
  567. rationOprObj.workBook.getSheet(0).setRowCount(30);
  568. rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), null);
  569. jobContentOprObj.setRadiosDisabled(true, jobContentOprObj.radios);
  570. jobContentOprObj.hideTable($('#tableAll'), $('#tablePartial'));
  571. annotationOprObj.setRadiosDisabled(true, annotationOprObj.radios);
  572. annotationOprObj.hideTable($('#fzTableAll'), $('#fzTablePartial'));
  573. sheetCommonObj.cleanSheet(rationOprObj.workBook.getSheet(0), rationOprObj.setting, -1);
  574. rationGLJOprObj.sheet.getParent().focus(false);
  575. }
  576. sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
  577. sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
  578. sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
  579. sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
  580. me.workBook.focus(true);
  581. }
  582. };