section_tree.js 24 KB

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