section_tree.js 25 KB

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