section_tree.js 24 KB

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