section_tree.js 24 KB

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