section_tree.js 25 KB

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