section_tree.js 25 KB

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