section_tree.js 23 KB

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