section_tree.js 23 KB

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