1. <link rel="stylesheet" href="/static/zTreeV3/css/metroStyle/metroStyle.css" type="text/css">
  2. <script type="text/javascript" src="/static/zTreeV3/js/jquery.ztree.core-3.5.js"></script>
  3. <script type="text/javascript" src="/static/zTreeV3/js/jquery.ztree.excheck-3.5.js"></script>
  1. <ul id="deptTree" class="ztree"></ul>
  1. var tree_str = (eval(treeData.deptTreeData)).replace('"isleader"','isleader').replace('"core_user_id"','core_user_id').replace('"name"','name').replace('"pId"','pId').replace('"id"','id').replace('"ispost"','ispost').replace('"open"','open').replace('"iconSkin"','iconSkin');
  2. var zNodes = eval(tree_str);
  3. //zTree点击事件
  4. function zTreeOnClick(event, treeId, treeNode) {
  5. //确认框
  6. currentClickedNode = treeNode.tId;
  7. var treeObj = $.fn.zTree.getZTreeObj("deptTree");
  8. var node = treeObj.getNodeByTId(currentClickedNode);
  9.  
  10. $scope.assistDept = node.id;
  11. $scope.assistDeptName = node.name;
  12. $('#assist_dept').val(node.id);
  13. $('#assist_dept_name').val(node.name);
  14.  
  15. $scope.assister = "";
  16. $scope.assisterName = "";
  17. $('#assister').val("");
  18. $('#assister_name').val("");
  19.  
  20. $scope.closeModel("assist_dept_modal");
  21. }
  22.  
  23. $.fn.zTree.init($("#deptTree"),{data:{simpleData:{enable:true}},callback:{onClick:zTreeOnClick}},zNodes);
  1. [
  2. {
  3. "isleader": 0,
  4. "core_user_id": "",
  5. "name": "摩贝(上海)生物科技有限公司",
  6. "pId": 0,
  7. "id": 1,
  8. "ispost": 1,
  9. "open": true
  10. },
  11. {
  12. "isleader": 1,
  13. "core_user_id": "",
  14. "name": "总部",
  15. "pId": 1,
  16. "id": 2,
  17. "ispost": 1,
  18. "open": true
  19. },
  20. {
  21. "isleader": 0,
  22. "core_user_id": "33",
  23. "name": "运营部",
  24. "pId": 2,
  25. "id": 5,
  26. "ispost": 1,
  27. "open": false
  28. },
  29. {
  30. "isleader": 0,
  31. "core_user_id": "129",
  32. "name": "研发部",
  33. "pId": 2,
  34. "id": 6,
  35. "ispost": 1,
  36. "open": false
  37. },
  38. {
  39. "isleader": 0,
  40. "core_user_id": "173",
  41. "name": "人事行政部",
  42. "pId": 2,
  43. "id": 9,
  44. "ispost": 1,
  45. "open": false
  46. },
  47. {
  48. "isleader": 0,
  49. "core_user_id": "173",
  50. "name": "财务部",
  51. "pId": 2,
  52. "id": 10,
  53. "ispost": 1,
  54. "open": false
  55. },
  56. {
  57. "isleader": 1,
  58. "core_user_id": "",
  59. "iconSkin": "diy",
  60. "name": "销售副总监",
  61. "pId": 187,
  62. "id": 13,
  63. "ispost": 2,
  64. "open": false
  65. },
  66. {
  67. "isleader": 1,
  68. "core_user_id": "",
  69. "iconSkin": "diy",
  70. "name": "采购副总监",
  71. "pId": 16,
  72. "id": 14,
  73. "ispost": 2,
  74. "open": false
  75. },
  76. {
  77. "isleader": 0,
  78. "core_user_id": "",
  79. "name": "采购组",
  80. "pId": 133,
  81. "id": 16,
  82. "ispost": 1,
  83. "open": false
  84. },
  85. {
  86. "isleader": 0,
  87. "core_user_id": "",
  88. "name": "内容运营部",
  89. "pId": 5,
  90. "id": 17,
  91. "ispost": 1,
  92. "open": false
  93. },
  94. {
  95. "isleader": 0,
  96. "core_user_id": "",
  97. "name": "翼组",
  98. "pId": 187,
  99. "id": 18,
  100. "ispost": 1,
  101. "open": false
  102. },
  103. {
  104. "isleader": 0,
  105. "core_user_id": "",
  106. "name": "风组",
  107. "pId": 187,
  108. "id": 19,
  109. "ispost": 1,
  110. "open": false
  111. },
  112. {
  113. "isleader": 0,
  114. "core_user_id": "",
  115. "name": "勤组",
  116. "pId": 187,
  117. "id": 20,
  118. "ispost": 1,
  119. "open": false
  120. },
  121. {
  122. "isleader": 0,
  123. "core_user_id": "",
  124. "name": "宇组",
  125. "pId": 187,
  126. "id": 21,
  127. "ispost": 1,
  128. "open": false
  129. },
  130. {
  131. "isleader": 0,
  132. "core_user_id": "",
  133. "name": "昊组",
  134. "pId": 187,
  135. "id": 22,
  136. "ispost": 1,
  137. "open": false
  138. },
  139. {
  140. "isleader": 0,
  141. "core_user_id": "",
  142. "name": "轩组",
  143. "pId": 187,
  144. "id": 23,
  145. "ispost": 1,
  146. "open": false
  147. },
  148. {
  149. "isleader": 0,
  150. "core_user_id": "",
  151. "name": "睿组",
  152. "pId": 538,
  153. "id": 24,
  154. "ispost": 1,
  155. "open": false
  156. },
  157. {
  158. "isleader": 0,
  159. "core_user_id": "",
  160. "name": "物流组",
  161. "pId": 133,
  162. "id": 25,
  163. "ispost": 1,
  164. "open": false
  165. },
  166. {
  167. "isleader": 0,
  168. "core_user_id": "",
  169. "name": "JAVA组",
  170. "pId": 308,
  171. "id": 28,
  172. "ispost": 2,
  173. "open": false
  174. },
  175. {
  176. "isleader": 0,
  177. "core_user_id": "",
  178. "name": "产品部",
  179. "pId": 6,
  180. "id": 29,
  181. "ispost": 1,
  182. "open": false
  183. },
  184. {
  185. "isleader": 1,
  186. "core_user_id": "",
  187. "iconSkin": "diy",
  188. "name": "产品总监",
  189. "pId": 29,
  190. "id": 30,
  191. "ispost": 2,
  192. "open": false
  193. },
  194. {
  195. "isleader": 0,
  196. "core_user_id": "",
  197. "name": "高级产品经理",
  198. "pId": 29,
  199. "id": 31,
  200. "ispost": 2,
  201. "open": false
  202. },
  203. {
  204. "isleader": 0,
  205. "core_user_id": "",
  206. "name": "主站PHP",
  207. "pId": 308,
  208. "id": 32,
  209. "ispost": 1,
  210. "open": false
  211. },
  212. {
  213. "isleader": 0,
  214. "core_user_id": "",
  215. "name": "商城PHP",
  216. "pId": 308,
  217. "id": 33,
  218. "ispost": 1,
  219. "open": false
  220. },
  221. {
  222. "isleader": 0,
  223. "core_user_id": "",
  224. "name": "UED组",
  225. "pId": 6,
  226. "id": 34,
  227. "ispost": 1,
  228. "open": false
  229. },
  230. {
  231. "isleader": 1,
  232. "core_user_id": "",
  233. "iconSkin": "diy",
  234. "name": "UED副总监",
  235. "pId": 34,
  236. "id": 35,
  237. "ispost": 2,
  238. "open": false
  239. },
  240. {
  241. "isleader": 0,
  242. "core_user_id": "",
  243. "name": "测试组",
  244. "pId": 308,
  245. "id": 37,
  246. "ispost": 1,
  247. "open": false
  248. },
  249. {
  250. "isleader": 0,
  251. "core_user_id": "",
  252. "name": "运维组",
  253. "pId": 6,
  254. "id": 38,
  255. "ispost": 1,
  256. "open": false
  257. },
  258. {
  259. "isleader": 1,
  260. "core_user_id": "",
  261. "iconSkin": "diy",
  262. "name": "人事副总监",
  263. "pId": 9,
  264. "id": 40,
  265. "ispost": 2,
  266. "open": false
  267. },
  268. {
  269. "isleader": 0,
  270. "core_user_id": "",
  271. "name": "行政助理",
  272. "pId": 9,
  273. "id": 41,
  274. "ispost": 2,
  275. "open": false
  276. },
  277. {
  278. "isleader": 0,
  279. "core_user_id": "",
  280. "name": "招聘经理",
  281. "pId": 135,
  282. "id": 42,
  283. "ispost": 2,
  284. "open": false
  285. },
  286. {
  287. "isleader": 0,
  288. "core_user_id": "",
  289. "name": "采购经理",
  290. "pId": 16,
  291. "id": 43,
  292. "ispost": 2,
  293. "open": false
  294. },
  295. {
  296. "isleader": 0,
  297. "core_user_id": "",
  298. "name": "采购助理",
  299. "pId": 16,
  300. "id": 44,
  301. "ispost": 2,
  302. "open": false
  303. },
  304. {
  305. "isleader": 1,
  306. "core_user_id": "",
  307. "iconSkin": "diy",
  308. "name": "运营总监",
  309. "pId": 17,
  310. "id": 45,
  311. "ispost": 2,
  312. "open": false
  313. },
  314. {
  315. "isleader": 0,
  316. "core_user_id": "",
  317. "name": "数据管理(价格行情)",
  318. "pId": 17,
  319. "id": 46,
  320. "ispost": 2,
  321. "open": false
  322. },
  323. {
  324. "isleader": 0,
  325. "core_user_id": "",
  326. "name": "数据分析",
  327. "pId": 17,
  328. "id": 47,
  329. "ispost": 2,
  330. "open": false
  331. },
  332. {
  333. "isleader": 0,
  334. "core_user_id": "",
  335. "name": "物流",
  336. "pId": 520,
  337. "id": 48,
  338. "ispost": 1,
  339. "open": false
  340. },
  341. {
  342. "isleader": 0,
  343. "core_user_id": "",
  344. "name": "物流专员",
  345. "pId": 48,
  346. "id": 49,
  347. "ispost": 2,
  348. "open": false
  349. },
  350. {
  351. "isleader": 1,
  352. "core_user_id": "",
  353. "iconSkin": "diy",
  354. "name": "高级商务经理",
  355. "pId": 18,
  356. "id": 50,
  357. "ispost": 2,
  358. "open": false
  359. },
  360. {
  361. "isleader": 0,
  362. "core_user_id": "",
  363. "name": "销售经理",
  364. "pId": 18,
  365. "id": 51,
  366. "ispost": 2,
  367. "open": false
  368. },
  369. {
  370. "isleader": 0,
  371. "core_user_id": "",
  372. "name": "移动组",
  373. "pId": 6,
  374. "id": 59,
  375. "ispost": 1,
  376. "open": false
  377. },
  378. {
  379. "isleader": 1,
  380. "core_user_id": "",
  381. "iconSkin": "diy",
  382. "name": "资深安卓工程师",
  383. "pId": 59,
  384. "id": 60,
  385. "ispost": 2,
  386. "open": false
  387. },
  388. {
  389. "isleader": 0,
  390. "core_user_id": "",
  391. "name": "安卓工程师",
  392. "pId": 59,
  393. "id": 61,
  394. "ispost": 2,
  395. "open": false
  396. },
  397. {
  398. "isleader": 0,
  399. "core_user_id": "",
  400. "name": "IOS开发工程师",
  401. "pId": 59,
  402. "id": 62,
  403. "ispost": 2,
  404. "open": false
  405. },
  406. {
  407. "isleader": 0,
  408. "core_user_id": "",
  409. "name": "APP测试工程师",
  410. "pId": 59,
  411. "id": 63,
  412. "ispost": 2,
  413. "open": false
  414. },
  415. {
  416. "isleader": 0,
  417. "core_user_id": "",
  418. "name": "UI设计师",
  419. "pId": 34,
  420. "id": 64,
  421. "ispost": 2,
  422. "open": false
  423. },
  424. {
  425. "isleader": 0,
  426. "core_user_id": "",
  427. "name": "前端工程师",
  428. "pId": 34,
  429. "id": 65,
  430. "ispost": 2,
  431. "open": false
  432. },
  433. {
  434. "isleader": 1,
  435. "core_user_id": "",
  436. "iconSkin": "diy",
  437. "name": "高级测试工程师",
  438. "pId": 37,
  439. "id": 66,
  440. "ispost": 2,
  441. "open": false
  442. },
  443. {
  444. "isleader": 0,
  445. "core_user_id": "",
  446. "name": "测试工程师",
  447. "pId": 37,
  448. "id": 67,
  449. "ispost": 2,
  450. "open": false
  451. },
  452. {
  453. "isleader": 1,
  454. "core_user_id": "",
  455. "iconSkin": "diy",
  456. "name": "高级运维工程师",
  457. "pId": 38,
  458. "id": 68,
  459. "ispost": 2,
  460. "open": false
  461. },
  462. {
  463. "isleader": 0,
  464. "core_user_id": "",
  465. "name": "运维工程师",
  466. "pId": 38,
  467. "id": 69,
  468. "ispost": 2,
  469. "open": false
  470. },
  471. {
  472. "isleader": 0,
  473. "core_user_id": "",
  474. "name": "网络管理员",
  475. "pId": 38,
  476. "id": 70,
  477. "ispost": 2,
  478. "open": false
  479. },
  480. {
  481. "isleader": 1,
  482. "core_user_id": "",
  483. "iconSkin": "diy",
  484. "name": "财务总监",
  485. "pId": 10,
  486. "id": 75,
  487. "ispost": 2,
  488. "open": false
  489. },
  490. {
  491. "isleader": 0,
  492. "core_user_id": "",
  493. "name": "出纳",
  494. "pId": 452,
  495. "id": 76,
  496. "ispost": 2,
  497. "open": false
  498. },
  499. {
  500. "isleader": 0,
  501. "core_user_id": "",
  502. "name": "财务经理资金平台",
  503. "pId": 10,
  504. "id": 77,
  505. "ispost": 1,
  506. "open": false
  507. },
  508. {
  509. "isleader": 0,
  510. "core_user_id": "",
  511. "name": "财务主管",
  512. "pId": 452,
  513. "id": 79,
  514. "ispost": 2,
  515. "open": false
  516. },
  517. {
  518. "isleader": 1,
  519. "core_user_id": "",
  520. "iconSkin": "diy",
  521. "name": "主站PHPLeader",
  522. "pId": 32,
  523. "id": 80,
  524. "ispost": 2,
  525. "open": false
  526. },
  527. {
  528. "isleader": 0,
  529. "core_user_id": "",
  530. "name": "PHP工程师",
  531. "pId": 32,
  532. "id": 81,
  533. "ispost": 2,
  534. "open": false
  535. },
  536. {
  537. "isleader": 1,
  538. "core_user_id": "",
  539. "iconSkin": "diy",
  540. "name": "商城PHPleader",
  541. "pId": 33,
  542. "id": 82,
  543. "ispost": 2,
  544. "open": false
  545. },
  546. {
  547. "isleader": 0,
  548. "core_user_id": "",
  549. "name": "PHP工程师",
  550. "pId": 33,
  551. "id": 83,
  552. "ispost": 2,
  553. "open": false
  554. },
  555. {
  556. "isleader": 1,
  557. "core_user_id": "",
  558. "iconSkin": "diy",
  559. "name": "开发副总监",
  560. "pId": 308,
  561. "id": 84,
  562. "ispost": 2,
  563. "open": false
  564. },
  565. {
  566. "isleader": 1,
  567. "core_user_id": "",
  568. "iconSkin": "diy",
  569. "name": "高级商务经理",
  570. "pId": 19,
  571. "id": 86,
  572. "ispost": 2,
  573. "open": false
  574. },
  575. {
  576. "isleader": 0,
  577. "core_user_id": "",
  578. "name": "销售经理",
  579. "pId": 19,
  580. "id": 87,
  581. "ispost": 2,
  582. "open": false
  583. },
  584. {
  585. "isleader": 1,
  586. "core_user_id": "",
  587. "iconSkin": "diy",
  588. "name": "高级商务经理",
  589. "pId": 20,
  590. "id": 88,
  591. "ispost": 2,
  592. "open": false
  593. },
  594. {
  595. "isleader": 0,
  596. "core_user_id": "",
  597. "name": "销售经理",
  598. "pId": 20,
  599. "id": 89,
  600. "ispost": 2,
  601. "open": false
  602. },
  603. {
  604. "isleader": 1,
  605. "core_user_id": "",
  606. "iconSkin": "diy",
  607. "name": "高级商务经理",
  608. "pId": 21,
  609. "id": 90,
  610. "ispost": 2,
  611. "open": false
  612. },
  613. {
  614. "isleader": 0,
  615. "core_user_id": "",
  616. "name": "销售经理",
  617. "pId": 21,
  618. "id": 91,
  619. "ispost": 2,
  620. "open": false
  621. },
  622. {
  623. "isleader": 1,
  624. "core_user_id": "",
  625. "iconSkin": "diy",
  626. "name": "高级商务经理",
  627. "pId": 22,
  628. "id": 92,
  629. "ispost": 2,
  630. "open": false
  631. },
  632. {
  633. "isleader": 0,
  634. "core_user_id": "",
  635. "name": "销售经理",
  636. "pId": 22,
  637. "id": 93,
  638. "ispost": 2,
  639. "open": false
  640. },
  641. {
  642. "isleader": 1,
  643. "core_user_id": "",
  644. "iconSkin": "diy",
  645. "name": "高级商务经理",
  646. "pId": 23,
  647. "id": 94,
  648. "ispost": 2,
  649. "open": false
  650. },
  651. {
  652. "isleader": 0,
  653. "core_user_id": "",
  654. "name": "销售经理",
  655. "pId": 23,
  656. "id": 95,
  657. "ispost": 2,
  658. "open": false
  659. },
  660. {
  661. "isleader": 1,
  662. "core_user_id": "",
  663. "iconSkin": "diy",
  664. "name": "商务副总监",
  665. "pId": 24,
  666. "id": 96,
  667. "ispost": 2,
  668. "open": false
  669. },
  670. {
  671. "isleader": 0,
  672. "core_user_id": "",
  673. "name": "销售经理",
  674. "pId": 24,
  675. "id": 97,
  676. "ispost": 2,
  677. "open": false
  678. },
  679. {
  680. "isleader": 0,
  681. "core_user_id": "191",
  682. "name": "供应链金融部",
  683. "pId": 2,
  684. "id": 99,
  685. "ispost": 1,
  686. "open": false
  687. },
  688. {
  689. "isleader": 1,
  690. "core_user_id": "",
  691. "name": "供应链金融",
  692. "pId": 99,
  693. "id": 100,
  694. "ispost": 1,
  695. "open": false
  696. },
  697. {
  698. "isleader": 0,
  699. "core_user_id": "",
  700. "name": "供应链",
  701. "pId": 99,
  702. "id": 101,
  703. "ispost": 1,
  704. "open": false
  705. },
  706. {
  707. "isleader": 0,
  708. "core_user_id": "",
  709. "name": "项目经理",
  710. "pId": 426,
  711. "id": 102,
  712. "ispost": 2,
  713. "open": false
  714. },
  715. {
  716. "isleader": 0,
  717. "core_user_id": "",
  718. "name": "风控经理",
  719. "pId": 101,
  720. "id": 104,
  721. "ispost": 2,
  722. "open": false
  723. },
  724. {
  725. "isleader": 0,
  726. "core_user_id": "",
  727. "name": "风控助理",
  728. "pId": 100,
  729. "id": 106,
  730. "ispost": 2,
  731. "open": false
  732. },
  733. {
  734. "isleader": 0,
  735. "core_user_id": "",
  736. "name": "结算主管",
  737. "pId": 100,
  738. "id": 107,
  739. "ispost": 2,
  740. "open": false
  741. },
  742. {
  743. "isleader": 0,
  744. "core_user_id": "",
  745. "name": "贷后催收",
  746. "pId": 100,
  747. "id": 108,
  748. "ispost": 2,
  749. "open": false
  750. },
  751. {
  752. "isleader": 0,
  753. "core_user_id": "",
  754. "name": "运营",
  755. "pId": 5,
  756. "id": 109,
  757. "ispost": 1,
  758. "open": false
  759. },
  760. {
  761. "isleader": 0,
  762. "core_user_id": "",
  763. "name": "SEM专员",
  764. "pId": 474,
  765. "id": 110,
  766. "ispost": 2,
  767. "open": false
  768. },
  769. {
  770. "isleader": 0,
  771. "core_user_id": "",
  772. "name": "BI数据分析",
  773. "pId": 109,
  774. "id": 112,
  775. "ispost": 2,
  776. "open": false
  777. },
  778. {
  779. "isleader": 0,
  780. "core_user_id": "",
  781. "name": "高级SEO经理",
  782. "pId": 474,
  783. "id": 116,
  784. "ispost": 2,
  785. "open": false
  786. },
  787. {
  788. "isleader": 0,
  789. "core_user_id": "",
  790. "name": "凡组",
  791. "pId": 187,
  792. "id": 121,
  793. "ispost": 1,
  794. "open": false
  795. },
  796. {
  797. "isleader": 0,
  798. "core_user_id": "",
  799. "name": "销售经理",
  800. "pId": 121,
  801. "id": 122,
  802. "ispost": 2,
  803. "open": false
  804. },
  805. {
  806. "isleader": 1,
  807. "core_user_id": "",
  808. "iconSkin": "diy",
  809. "name": "销售副总监",
  810. "pId": 121,
  811. "id": 123,
  812. "ispost": 2,
  813. "open": false
  814. },
  815. {
  816. "isleader": 0,
  817. "core_user_id": "",
  818. "name": "实习生",
  819. "pId": 16,
  820. "id": 124,
  821. "ispost": 2,
  822. "open": false
  823. },
  824. {
  825. "isleader": 0,
  826. "core_user_id": "",
  827. "name": "产品助理",
  828. "pId": 29,
  829. "id": 127,
  830. "ispost": 2,
  831. "open": false
  832. },
  833. {
  834. "isleader": 1,
  835. "core_user_id": "",
  836. "iconSkin": "diy",
  837. "name": "VP",
  838. "pId": 6,
  839. "id": 131,
  840. "ispost": 2,
  841. "open": false
  842. },
  843. {
  844. "isleader": 1,
  845. "core_user_id": "174",
  846. "name": "商务部",
  847. "pId": 2,
  848. "id": 133,
  849. "ispost": 1,
  850. "open": false
  851. },
  852. {
  853. "isleader": 0,
  854. "core_user_id": "173",
  855. "name": "人力资源部",
  856. "pId": 2,
  857. "id": 135,
  858. "ispost": 1,
  859. "open": false
  860. },
  861. {
  862. "isleader": 0,
  863. "core_user_id": "",
  864. "name": "合伙人助理",
  865. "pId": 133,
  866. "id": 137,
  867. "ispost": 2,
  868. "open": false
  869. },
  870. {
  871. "isleader": 0,
  872. "core_user_id": "",
  873. "name": "国际事业部",
  874. "pId": 133,
  875. "id": 139,
  876. "ispost": 1,
  877. "open": false
  878. },
  879. {
  880. "isleader": 1,
  881. "core_user_id": "",
  882. "iconSkin": "diy",
  883. "name": "战略采购副总监",
  884. "pId": 139,
  885. "id": 141,
  886. "ispost": 2,
  887. "open": false
  888. },
  889. {
  890. "isleader": 0,
  891. "core_user_id": "",
  892. "name": "往来会计",
  893. "pId": 452,
  894. "id": 153,
  895. "ispost": 2,
  896. "open": false
  897. },
  898. {
  899. "isleader": 0,
  900. "core_user_id": "",
  901. "name": "成本会计",
  902. "pId": 452,
  903. "id": 155,
  904. "ispost": 2,
  905. "open": false
  906. },
  907. {
  908. "isleader": 0,
  909. "core_user_id": "",
  910. "name": "财务助理",
  911. "pId": 77,
  912. "id": 157,
  913. "ispost": 2,
  914. "open": false
  915. },
  916. {
  917. "isleader": 0,
  918. "core_user_id": "",
  919. "name": "交互设计师",
  920. "pId": 34,
  921. "id": 161,
  922. "ispost": 2,
  923. "open": false
  924. },
  925. {
  926. "isleader": 1,
  927. "core_user_id": "",
  928. "iconSkin": "diy",
  929. "name": "人力资源部总监",
  930. "pId": 135,
  931. "id": 165,
  932. "ispost": 2,
  933. "open": false
  934. },
  935. {
  936. "isleader": 0,
  937. "core_user_id": "",
  938. "name": "薪酬经理",
  939. "pId": 135,
  940. "id": 169,
  941. "ispost": 2,
  942. "open": false
  943. },
  944. {
  945. "isleader": 0,
  946. "core_user_id": "",
  947. "name": "产品经理",
  948. "pId": 29,
  949. "id": 177,
  950. "ispost": 2,
  951. "open": false
  952. },
  953. {
  954. "isleader": 0,
  955. "core_user_id": "",
  956. "name": "招聘主管",
  957. "pId": 135,
  958. "id": 179,
  959. "ispost": 2,
  960. "open": false
  961. },
  962. {
  963. "isleader": 0,
  964. "core_user_id": "",
  965. "name": "产品副总监",
  966. "pId": 29,
  967. "id": 181,
  968. "ispost": 2,
  969. "open": false
  970. },
  971. {
  972. "isleader": 0,
  973. "core_user_id": "",
  974. "name": "外贸经理",
  975. "pId": 139,
  976. "id": 183,
  977. "ispost": 2,
  978. "open": false
  979. },
  980. {
  981. "isleader": 0,
  982. "core_user_id": "",
  983. "name": "地推",
  984. "pId": 133,
  985. "id": 187,
  986. "ispost": 1,
  987. "open": false
  988. },
  989. {
  990. "isleader": 0,
  991. "core_user_id": "",
  992. "name": "CORE",
  993. "pId": 2,
  994. "id": 189,
  995. "ispost": 1,
  996. "open": false
  997. },
  998. {
  999. "isleader": 0,
  1000. "core_user_id": "",
  1001. "name": "单据组",
  1002. "pId": 10,
  1003. "id": 191,
  1004. "ispost": 1,
  1005. "open": false
  1006. },
  1007. {
  1008. "isleader": 0,
  1009. "core_user_id": "",
  1010. "name": "商务专员",
  1011. "pId": 191,
  1012. "id": 193,
  1013. "ispost": 2,
  1014. "open": false
  1015. },
  1016. {
  1017. "isleader": 0,
  1018. "core_user_id": "",
  1019. "name": "顺组",
  1020. "pId": 133,
  1021. "id": 195,
  1022. "ispost": 1,
  1023. "open": false
  1024. },
  1025. {
  1026. "isleader": 1,
  1027. "core_user_id": "",
  1028. "iconSkin": "diy",
  1029. "name": "高级商务经理",
  1030. "pId": 195,
  1031. "id": 197,
  1032. "ispost": 2,
  1033. "open": false
  1034. },
  1035. {
  1036. "isleader": 0,
  1037. "core_user_id": "",
  1038. "name": "销售经理",
  1039. "pId": 195,
  1040. "id": 199,
  1041. "ispost": 2,
  1042. "open": false
  1043. },
  1044. {
  1045. "isleader": 0,
  1046. "core_user_id": "",
  1047. "name": "销售助理",
  1048. "pId": 195,
  1049. "id": 201,
  1050. "ispost": 2,
  1051. "open": false
  1052. },
  1053. {
  1054. "isleader": 0,
  1055. "core_user_id": "",
  1056. "name": "擎组",
  1057. "pId": 187,
  1058. "id": 203,
  1059. "ispost": 1,
  1060. "open": false
  1061. },
  1062. {
  1063. "isleader": 1,
  1064. "core_user_id": "",
  1065. "iconSkin": "diy",
  1066. "name": "高级商务经理",
  1067. "pId": 203,
  1068. "id": 205,
  1069. "ispost": 2,
  1070. "open": false
  1071. },
  1072. {
  1073. "isleader": 0,
  1074. "core_user_id": "",
  1075. "name": "化工资讯",
  1076. "pId": 17,
  1077. "id": 207,
  1078. "ispost": 1,
  1079. "open": false
  1080. },
  1081. {
  1082. "isleader": 1,
  1083. "core_user_id": "",
  1084. "iconSkin": "diy",
  1085. "name": "化工资讯高级经理",
  1086. "pId": 207,
  1087. "id": 213,
  1088. "ispost": 2,
  1089. "open": false
  1090. },
  1091. {
  1092. "isleader": 0,
  1093. "core_user_id": "",
  1094. "name": "化工资讯专员",
  1095. "pId": 207,
  1096. "id": 215,
  1097. "ispost": 2,
  1098. "open": false
  1099. },
  1100. {
  1101. "isleader": 0,
  1102. "core_user_id": "",
  1103. "name": "化学品订制项目经理",
  1104. "pId": 538,
  1105. "id": 221,
  1106. "ispost": 2,
  1107. "open": false
  1108. },
  1109. {
  1110. "isleader": 0,
  1111. "core_user_id": "",
  1112. "name": "销售经理",
  1113. "pId": 203,
  1114. "id": 229,
  1115. "ispost": 2,
  1116. "open": false
  1117. },
  1118. {
  1119. "isleader": 0,
  1120. "core_user_id": "",
  1121. "name": "法务",
  1122. "pId": 10,
  1123. "id": 249,
  1124. "ispost": 1,
  1125. "open": false
  1126. },
  1127. {
  1128. "isleader": 1,
  1129. "core_user_id": "",
  1130. "iconSkin": "diy",
  1131. "name": "法务经理",
  1132. "pId": 249,
  1133. "id": 251,
  1134. "ispost": 2,
  1135. "open": false
  1136. },
  1137. {
  1138. "isleader": 0,
  1139. "core_user_id": "",
  1140. "name": "人力资源实习生",
  1141. "pId": 135,
  1142. "id": 255,
  1143. "ispost": 2,
  1144. "open": false
  1145. },
  1146. {
  1147. "isleader": 1,
  1148. "core_user_id": "",
  1149. "iconSkin": "diy",
  1150. "name": "首席战略官",
  1151. "pId": 5,
  1152. "id": 260,
  1153. "ispost": 2,
  1154. "open": false
  1155. },
  1156. {
  1157. "isleader": 0,
  1158. "core_user_id": "",
  1159. "name": "产品经理",
  1160. "pId": 101,
  1161. "id": 262,
  1162. "ispost": 2,
  1163. "open": false
  1164. },
  1165. {
  1166. "isleader": 0,
  1167. "core_user_id": "",
  1168. "name": "火组",
  1169. "pId": 187,
  1170. "id": 266,
  1171. "ispost": 1,
  1172. "open": false
  1173. },
  1174. {
  1175. "isleader": 1,
  1176. "core_user_id": "",
  1177. "iconSkin": "diy",
  1178. "name": "火组负责人",
  1179. "pId": 266,
  1180. "id": 268,
  1181. "ispost": 2,
  1182. "open": false
  1183. },
  1184. {
  1185. "isleader": 0,
  1186. "core_user_id": "",
  1187. "name": "火组成员",
  1188. "pId": 266,
  1189. "id": 270,
  1190. "ispost": 2,
  1191. "open": false
  1192. },
  1193. {
  1194. "isleader": 0,
  1195. "core_user_id": "",
  1196. "name": "鸣组",
  1197. "pId": 187,
  1198. "id": 272,
  1199. "ispost": 1,
  1200. "open": false
  1201. },
  1202. {
  1203. "isleader": 1,
  1204. "core_user_id": "",
  1205. "iconSkin": "diy",
  1206. "name": "鸣组负责人",
  1207. "pId": 272,
  1208. "id": 274,
  1209. "ispost": 2,
  1210. "open": false
  1211. },
  1212. {
  1213. "isleader": 0,
  1214. "core_user_id": "",
  1215. "name": "鸣组成员",
  1216. "pId": 272,
  1217. "id": 276,
  1218. "ispost": 2,
  1219. "open": false
  1220. },
  1221. {
  1222. "isleader": 0,
  1223. "core_user_id": "",
  1224. "name": "奉组",
  1225. "pId": 187,
  1226. "id": 278,
  1227. "ispost": 1,
  1228. "open": false
  1229. },
  1230. {
  1231. "isleader": 1,
  1232. "core_user_id": "",
  1233. "iconSkin": "diy",
  1234. "name": "奉组负责人",
  1235. "pId": 278,
  1236. "id": 280,
  1237. "ispost": 2,
  1238. "open": false
  1239. },
  1240. {
  1241. "isleader": 0,
  1242. "core_user_id": "",
  1243. "name": "奉组成员",
  1244. "pId": 278,
  1245. "id": 282,
  1246. "ispost": 2,
  1247. "open": false
  1248. },
  1249. {
  1250. "isleader": 0,
  1251. "core_user_id": "",
  1252. "name": "朗组",
  1253. "pId": 187,
  1254. "id": 284,
  1255. "ispost": 1,
  1256. "open": false
  1257. },
  1258. {
  1259. "isleader": 1,
  1260. "core_user_id": "",
  1261. "iconSkin": "diy",
  1262. "name": "朗组负责人",
  1263. "pId": 284,
  1264. "id": 286,
  1265. "ispost": 2,
  1266. "open": false
  1267. },
  1268. {
  1269. "isleader": 0,
  1270. "core_user_id": "",
  1271. "name": "朗组成员",
  1272. "pId": 284,
  1273. "id": 288,
  1274. "ispost": 2,
  1275. "open": false
  1276. },
  1277. {
  1278. "isleader": 0,
  1279. "core_user_id": "",
  1280. "name": "研发",
  1281. "pId": 6,
  1282. "id": 308,
  1283. "ispost": 1,
  1284. "open": false
  1285. },
  1286. {
  1287. "isleader": 0,
  1288. "core_user_id": "",
  1289. "name": "涂料事业部",
  1290. "pId": 386,
  1291. "id": 320,
  1292. "ispost": 1,
  1293. "open": false
  1294. },
  1295. {
  1296. "isleader": 0,
  1297. "core_user_id": "",
  1298. "name": "平面设计",
  1299. "pId": 328,
  1300. "id": 322,
  1301. "ispost": 2,
  1302. "open": false
  1303. },
  1304. {
  1305. "isleader": 0,
  1306. "core_user_id": "",
  1307. "name": "文案策划 ",
  1308. "pId": 328,
  1309. "id": 326,
  1310. "ispost": 2,
  1311. "open": false
  1312. },
  1313. {
  1314. "isleader": 0,
  1315. "core_user_id": "",
  1316. "name": "平台运营",
  1317. "pId": 5,
  1318. "id": 328,
  1319. "ispost": 1,
  1320. "open": false
  1321. },
  1322. {
  1323. "isleader": 1,
  1324. "core_user_id": "",
  1325. "iconSkin": "diy",
  1326. "name": "平台运营总监",
  1327. "pId": 328,
  1328. "id": 330,
  1329. "ispost": 2,
  1330. "open": false
  1331. },
  1332. {
  1333. "isleader": 1,
  1334. "core_user_id": "",
  1335. "iconSkin": "diy",
  1336. "name": "涂料事业部经理",
  1337. "pId": 320,
  1338. "id": 336,
  1339. "ispost": 2,
  1340. "open": false
  1341. },
  1342. {
  1343. "isleader": 0,
  1344. "core_user_id": "",
  1345. "name": "销售经理",
  1346. "pId": 320,
  1347. "id": 338,
  1348. "ispost": 2,
  1349. "open": false
  1350. },
  1351. {
  1352. "isleader": 0,
  1353. "core_user_id": "",
  1354. "name": "运营经理",
  1355. "pId": 328,
  1356. "id": 344,
  1357. "ispost": 2,
  1358. "open": false
  1359. },
  1360. {
  1361. "isleader": 0,
  1362. "core_user_id": "",
  1363. "name": "法务助理",
  1364. "pId": 249,
  1365. "id": 346,
  1366. "ispost": 2,
  1367. "open": false
  1368. },
  1369. {
  1370. "isleader": 0,
  1371. "core_user_id": "",
  1372. "name": "产品营销经理",
  1373. "pId": 320,
  1374. "id": 348,
  1375. "ispost": 2,
  1376. "open": false
  1377. },
  1378. {
  1379. "isleader": 0,
  1380. "core_user_id": "",
  1381. "name": "销售经理",
  1382. "pId": 139,
  1383. "id": 350,
  1384. "ispost": 2,
  1385. "open": false
  1386. },
  1387. {
  1388. "isleader": 0,
  1389. "core_user_id": "",
  1390. "name": "大宗溶剂事业部",
  1391. "pId": 386,
  1392. "id": 360,
  1393. "ispost": 1,
  1394. "open": false
  1395. },
  1396. {
  1397. "isleader": 1,
  1398. "core_user_id": "",
  1399. "iconSkin": "diy",
  1400. "name": "大宗事业部负责人",
  1401. "pId": 360,
  1402. "id": 364,
  1403. "ispost": 2,
  1404. "open": false
  1405. },
  1406. {
  1407. "isleader": 0,
  1408. "core_user_id": "",
  1409. "name": "大宗事业部成员",
  1410. "pId": 360,
  1411. "id": 366,
  1412. "ispost": 2,
  1413. "open": false
  1414. },
  1415. {
  1416. "isleader": 0,
  1417. "core_user_id": "",
  1418. "name": "大宗无机事业部",
  1419. "pId": 386,
  1420. "id": 370,
  1421. "ispost": 1,
  1422. "open": false
  1423. },
  1424. {
  1425. "isleader": 1,
  1426. "core_user_id": "",
  1427. "iconSkin": "diy",
  1428. "name": "大宗无机事业部负责人",
  1429. "pId": 370,
  1430. "id": 372,
  1431. "ispost": 2,
  1432. "open": false
  1433. },
  1434. {
  1435. "isleader": 0,
  1436. "core_user_id": "",
  1437. "name": "测试",
  1438. "pId": 29,
  1439. "id": 374,
  1440. "ispost": 1,
  1441. "open": false
  1442. },
  1443. {
  1444. "isleader": 1,
  1445. "core_user_id": "",
  1446. "iconSkin": "diy",
  1447. "name": "测试1",
  1448. "pId": 374,
  1449. "id": 376,
  1450. "ispost": 2,
  1451. "open": false
  1452. },
  1453. {
  1454. "isleader": 0,
  1455. "core_user_id": "",
  1456. "name": "测试2",
  1457. "pId": 374,
  1458. "id": 378,
  1459. "ispost": 2,
  1460. "open": false
  1461. },
  1462. {
  1463. "isleader": 0,
  1464. "core_user_id": "",
  1465. "name": "高级人力资源经理",
  1466. "pId": 135,
  1467. "id": 380,
  1468. "ispost": 2,
  1469. "open": false
  1470. },
  1471. {
  1472. "isleader": 0,
  1473. "core_user_id": "",
  1474. "name": "事业部",
  1475. "pId": 133,
  1476. "id": 386,
  1477. "ispost": 1,
  1478. "open": false
  1479. },
  1480. {
  1481. "isleader": 1,
  1482. "core_user_id": "",
  1483. "iconSkin": "diy",
  1484. "name": "事业部负责人",
  1485. "pId": 386,
  1486. "id": 388,
  1487. "ispost": 2,
  1488. "open": false
  1489. },
  1490. {
  1491. "isleader": 0,
  1492. "core_user_id": "",
  1493. "name": "香精香料事业部",
  1494. "pId": 386,
  1495. "id": 392,
  1496. "ispost": 2,
  1497. "open": false
  1498. },
  1499. {
  1500. "isleader": 0,
  1501. "core_user_id": "",
  1502. "name": "医药事业部",
  1503. "pId": 386,
  1504. "id": 394,
  1505. "ispost": 2,
  1506. "open": false
  1507. },
  1508. {
  1509. "isleader": 0,
  1510. "core_user_id": "",
  1511. "name": "大宗无机事业部成员",
  1512. "pId": 370,
  1513. "id": 402,
  1514. "ispost": 2,
  1515. "open": false
  1516. },
  1517. {
  1518. "isleader": 0,
  1519. "core_user_id": "",
  1520. "name": "橡塑事业部2",
  1521. "pId": 386,
  1522. "id": 404,
  1523. "ispost": 1,
  1524. "open": false
  1525. },
  1526. {
  1527. "isleader": 0,
  1528. "core_user_id": "",
  1529. "name": "橡塑事业部1",
  1530. "pId": 386,
  1531. "id": 406,
  1532. "ispost": 2,
  1533. "open": false
  1534. },
  1535. {
  1536. "isleader": 0,
  1537. "core_user_id": "",
  1538. "name": "农药中间体事业部",
  1539. "pId": 386,
  1540. "id": 410,
  1541. "ispost": 1,
  1542. "open": false
  1543. },
  1544. {
  1545. "isleader": 0,
  1546. "core_user_id": "",
  1547. "name": "产品经理",
  1548. "pId": 410,
  1549. "id": 412,
  1550. "ispost": 2,
  1551. "open": false
  1552. },
  1553. {
  1554. "isleader": 1,
  1555. "core_user_id": "",
  1556. "iconSkin": "diy",
  1557. "name": "农药中间体事业部总经理",
  1558. "pId": 410,
  1559. "id": 414,
  1560. "ispost": 2,
  1561. "open": false
  1562. },
  1563. {
  1564. "isleader": 0,
  1565. "core_user_id": "",
  1566. "name": "溶剂油事业部",
  1567. "pId": 386,
  1568. "id": 422,
  1569. "ispost": 1,
  1570. "open": false
  1571. },
  1572. {
  1573. "isleader": 0,
  1574. "core_user_id": "",
  1575. "name": "副经理",
  1576. "pId": 422,
  1577. "id": 424,
  1578. "ispost": 2,
  1579. "open": false
  1580. },
  1581. {
  1582. "isleader": 0,
  1583. "core_user_id": "",
  1584. "name": "项目",
  1585. "pId": 101,
  1586. "id": 426,
  1587. "ispost": 1,
  1588. "open": false
  1589. },
  1590. {
  1591. "isleader": 1,
  1592. "core_user_id": "",
  1593. "iconSkin": "diy",
  1594. "name": "高级项目经理",
  1595. "pId": 426,
  1596. "id": 428,
  1597. "ispost": 2,
  1598. "open": false
  1599. },
  1600. {
  1601. "isleader": 0,
  1602. "core_user_id": "",
  1603. "name": "项目助理",
  1604. "pId": 426,
  1605. "id": 430,
  1606. "ispost": 2,
  1607. "open": false
  1608. },
  1609. {
  1610. "isleader": 1,
  1611. "core_user_id": "",
  1612. "iconSkin": "diy",
  1613. "name": "副总监",
  1614. "pId": 101,
  1615. "id": 432,
  1616. "ispost": 2,
  1617. "open": false
  1618. },
  1619. {
  1620. "isleader": 1,
  1621. "core_user_id": "",
  1622. "iconSkin": "diy",
  1623. "name": "总监",
  1624. "pId": 100,
  1625. "id": 434,
  1626. "ispost": 2,
  1627. "open": false
  1628. },
  1629. {
  1630. "isleader": 0,
  1631. "core_user_id": "",
  1632. "name": "PHP CRM组",
  1633. "pId": 308,
  1634. "id": 436,
  1635. "ispost": 1,
  1636. "open": false
  1637. },
  1638. {
  1639. "isleader": 1,
  1640. "core_user_id": "",
  1641. "iconSkin": "diy",
  1642. "name": "PHP CRM组组长",
  1643. "pId": 436,
  1644. "id": 438,
  1645. "ispost": 2,
  1646. "open": false
  1647. },
  1648. {
  1649. "isleader": 0,
  1650. "core_user_id": "",
  1651. "name": "PHP CRM组组员",
  1652. "pId": 436,
  1653. "id": 440,
  1654. "ispost": 2,
  1655. "open": false
  1656. },
  1657. {
  1658. "isleader": 0,
  1659. "core_user_id": "",
  1660. "name": "PHP 运营组",
  1661. "pId": 308,
  1662. "id": 442,
  1663. "ispost": 1,
  1664. "open": false
  1665. },
  1666. {
  1667. "isleader": 1,
  1668. "core_user_id": "",
  1669. "iconSkin": "diy",
  1670. "name": "PHP运营组组长",
  1671. "pId": 442,
  1672. "id": 444,
  1673. "ispost": 2,
  1674. "open": false
  1675. },
  1676. {
  1677. "isleader": 0,
  1678. "core_user_id": "",
  1679. "name": "PHP 运营组组员",
  1680. "pId": 442,
  1681. "id": 446,
  1682. "ispost": 2,
  1683. "open": false
  1684. },
  1685. {
  1686. "isleader": 1,
  1687. "core_user_id": "",
  1688. "iconSkin": "diy",
  1689. "name": "财务经理",
  1690. "pId": 77,
  1691. "id": 448,
  1692. "ispost": 2,
  1693. "open": false
  1694. },
  1695. {
  1696. "isleader": 0,
  1697. "core_user_id": "",
  1698. "name": "出纳",
  1699. "pId": 77,
  1700. "id": 450,
  1701. "ispost": 2,
  1702. "open": false
  1703. },
  1704. {
  1705. "isleader": 0,
  1706. "core_user_id": "",
  1707. "name": "财务经理报表汇总",
  1708. "pId": 10,
  1709. "id": 452,
  1710. "ispost": 1,
  1711. "open": false
  1712. },
  1713. {
  1714. "isleader": 1,
  1715. "core_user_id": "",
  1716. "iconSkin": "diy",
  1717. "name": "财务经理",
  1718. "pId": 452,
  1719. "id": 454,
  1720. "ispost": 2,
  1721. "open": false
  1722. },
  1723. {
  1724. "isleader": 0,
  1725. "core_user_id": "",
  1726. "name": "财务专员",
  1727. "pId": 452,
  1728. "id": 456,
  1729. "ispost": 2,
  1730. "open": false
  1731. },
  1732. {
  1733. "isleader": 1,
  1734. "core_user_id": "",
  1735. "iconSkin": "diy",
  1736. "name": "单据组组长",
  1737. "pId": 191,
  1738. "id": 458,
  1739. "ispost": 2,
  1740. "open": false
  1741. },
  1742. {
  1743. "isleader": 0,
  1744. "core_user_id": "",
  1745. "name": "财务专员",
  1746. "pId": 191,
  1747. "id": 460,
  1748. "ispost": 2,
  1749. "open": false
  1750. },
  1751. {
  1752. "isleader": 0,
  1753. "core_user_id": "",
  1754. "name": "合同制作",
  1755. "pId": 191,
  1756. "id": 462,
  1757. "ispost": 1,
  1758. "open": false
  1759. },
  1760. {
  1761. "isleader": 1,
  1762. "core_user_id": "",
  1763. "iconSkin": "diy",
  1764. "name": "客户经理",
  1765. "pId": 462,
  1766. "id": 464,
  1767. "ispost": 2,
  1768. "open": false
  1769. },
  1770. {
  1771. "isleader": 0,
  1772. "core_user_id": "",
  1773. "name": "客户助理",
  1774. "pId": 462,
  1775. "id": 466,
  1776. "ispost": 2,
  1777. "open": false
  1778. },
  1779. {
  1780. "isleader": 0,
  1781. "core_user_id": "",
  1782. "name": "销售助理",
  1783. "pId": 191,
  1784. "id": 468,
  1785. "ispost": 2,
  1786. "open": false
  1787. },
  1788. {
  1789. "isleader": 0,
  1790. "core_user_id": "",
  1791. "name": "商务专员",
  1792. "pId": 328,
  1793. "id": 470,
  1794. "ispost": 2,
  1795. "open": false
  1796. },
  1797. {
  1798. "isleader": 1,
  1799. "core_user_id": "",
  1800. "iconSkin": "diy",
  1801. "name": "运营总监",
  1802. "pId": 109,
  1803. "id": 472,
  1804. "ispost": 2,
  1805. "open": false
  1806. },
  1807. {
  1808. "isleader": 0,
  1809. "core_user_id": "",
  1810. "name": "销售组",
  1811. "pId": 109,
  1812. "id": 474,
  1813. "ispost": 1,
  1814. "open": false
  1815. },
  1816. {
  1817. "isleader": 1,
  1818. "core_user_id": "",
  1819. "iconSkin": "diy",
  1820. "name": "高级销售经理",
  1821. "pId": 474,
  1822. "id": 476,
  1823. "ispost": 2,
  1824. "open": false
  1825. },
  1826. {
  1827. "isleader": 0,
  1828. "core_user_id": "",
  1829. "name": "销售代表",
  1830. "pId": 474,
  1831. "id": 478,
  1832. "ispost": 2,
  1833. "open": false
  1834. },
  1835. {
  1836. "isleader": 0,
  1837. "core_user_id": "",
  1838. "name": "客户经理",
  1839. "pId": 474,
  1840. "id": 480,
  1841. "ispost": 2,
  1842. "open": false
  1843. },
  1844. {
  1845. "isleader": 0,
  1846. "core_user_id": "",
  1847. "name": "客户经理",
  1848. "pId": 474,
  1849. "id": 482,
  1850. "ispost": 2,
  1851. "open": false
  1852. },
  1853. {
  1854. "isleader": 0,
  1855. "core_user_id": "",
  1856. "name": "商城客户组",
  1857. "pId": 109,
  1858. "id": 484,
  1859. "ispost": 1,
  1860. "open": false
  1861. },
  1862. {
  1863. "isleader": 1,
  1864. "core_user_id": "",
  1865. "iconSkin": "diy",
  1866. "name": "高级客户经理",
  1867. "pId": 484,
  1868. "id": 486,
  1869. "ispost": 2,
  1870. "open": false
  1871. },
  1872. {
  1873. "isleader": 0,
  1874. "core_user_id": "",
  1875. "name": "商城运营专员",
  1876. "pId": 484,
  1877. "id": 488,
  1878. "ispost": 2,
  1879. "open": false
  1880. },
  1881. {
  1882. "isleader": 0,
  1883. "core_user_id": "",
  1884. "name": "试剂外贸专员",
  1885. "pId": 484,
  1886. "id": 490,
  1887. "ispost": 2,
  1888. "open": false
  1889. },
  1890. {
  1891. "isleader": 0,
  1892. "core_user_id": "",
  1893. "name": "商城客户代表",
  1894. "pId": 484,
  1895. "id": 492,
  1896. "ispost": 2,
  1897. "open": false
  1898. },
  1899. {
  1900. "isleader": 0,
  1901. "core_user_id": "",
  1902. "name": "运营客户",
  1903. "pId": 109,
  1904. "id": 494,
  1905. "ispost": 1,
  1906. "open": false
  1907. },
  1908. {
  1909. "isleader": 1,
  1910. "core_user_id": "",
  1911. "iconSkin": "diy",
  1912. "name": "高级客户经理",
  1913. "pId": 494,
  1914. "id": 496,
  1915. "ispost": 2,
  1916. "open": false
  1917. },
  1918. {
  1919. "isleader": 0,
  1920. "core_user_id": "",
  1921. "name": "客户专员",
  1922. "pId": 494,
  1923. "id": 498,
  1924. "ispost": 2,
  1925. "open": false
  1926. },
  1927. {
  1928. "isleader": 0,
  1929. "core_user_id": "",
  1930. "name": "广告销售",
  1931. "pId": 109,
  1932. "id": 500,
  1933. "ispost": 2,
  1934. "open": false
  1935. },
  1936. {
  1937. "isleader": 0,
  1938. "core_user_id": "",
  1939. "name": "高级市场",
  1940. "pId": 5,
  1941. "id": 502,
  1942. "ispost": 1,
  1943. "open": false
  1944. },
  1945. {
  1946. "isleader": 1,
  1947. "core_user_id": "",
  1948. "iconSkin": "diy",
  1949. "name": "高级市场经理",
  1950. "pId": 502,
  1951. "id": 504,
  1952. "ispost": 2,
  1953. "open": false
  1954. },
  1955. {
  1956. "isleader": 0,
  1957. "core_user_id": "",
  1958. "name": "活动经理",
  1959. "pId": 502,
  1960. "id": 506,
  1961. "ispost": 2,
  1962. "open": false
  1963. },
  1964. {
  1965. "isleader": 0,
  1966. "core_user_id": "",
  1967. "name": "市场专员",
  1968. "pId": 502,
  1969. "id": 508,
  1970. "ispost": 2,
  1971. "open": false
  1972. },
  1973. {
  1974. "isleader": 0,
  1975. "core_user_id": "",
  1976. "name": "高级采购",
  1977. "pId": 16,
  1978. "id": 510,
  1979. "ispost": 1,
  1980. "open": false
  1981. },
  1982. {
  1983. "isleader": 1,
  1984. "core_user_id": "",
  1985. "iconSkin": "diy",
  1986. "name": "高级采购经理",
  1987. "pId": 510,
  1988. "id": 512,
  1989. "ispost": 2,
  1990. "open": false
  1991. },
  1992. {
  1993. "isleader": 0,
  1994. "core_user_id": "",
  1995. "name": "采购专员",
  1996. "pId": 510,
  1997. "id": 516,
  1998. "ispost": 2,
  1999. "open": false
  2000. },
  2001. {
  2002. "isleader": 1,
  2003. "core_user_id": "",
  2004. "iconSkin": "diy",
  2005. "name": "供应链总监",
  2006. "pId": 25,
  2007. "id": 518,
  2008. "ispost": 2,
  2009. "open": false
  2010. },
  2011. {
  2012. "isleader": 0,
  2013. "core_user_id": "",
  2014. "name": "高级物流",
  2015. "pId": 25,
  2016. "id": 520,
  2017. "ispost": 1,
  2018. "open": false
  2019. },
  2020. {
  2021. "isleader": 1,
  2022. "core_user_id": "",
  2023. "iconSkin": "diy",
  2024. "name": "高级物流经理",
  2025. "pId": 520,
  2026. "id": 522,
  2027. "ispost": 2,
  2028. "open": false
  2029. },
  2030. {
  2031. "isleader": 1,
  2032. "core_user_id": "",
  2033. "iconSkin": "diy",
  2034. "name": "物流主管",
  2035. "pId": 48,
  2036. "id": 524,
  2037. "ispost": 2,
  2038. "open": false
  2039. },
  2040. {
  2041. "isleader": 0,
  2042. "core_user_id": "",
  2043. "name": "客户经理",
  2044. "pId": 139,
  2045. "id": 526,
  2046. "ispost": 2,
  2047. "open": false
  2048. },
  2049. {
  2050. "isleader": 0,
  2051. "core_user_id": "",
  2052. "name": "外联组",
  2053. "pId": 133,
  2054. "id": 528,
  2055. "ispost": 1,
  2056. "open": false
  2057. },
  2058. {
  2059. "isleader": 1,
  2060. "core_user_id": "",
  2061. "iconSkin": "diy",
  2062. "name": "销售总监",
  2063. "pId": 528,
  2064. "id": 530,
  2065. "ispost": 2,
  2066. "open": false
  2067. },
  2068. {
  2069. "isleader": 0,
  2070. "core_user_id": "",
  2071. "name": "高级销售经理",
  2072. "pId": 528,
  2073. "id": 532,
  2074. "ispost": 2,
  2075. "open": false
  2076. },
  2077. {
  2078. "isleader": 0,
  2079. "core_user_id": "",
  2080. "name": "销售副总监",
  2081. "pId": 528,
  2082. "id": 534,
  2083. "ispost": 2,
  2084. "open": false
  2085. },
  2086. {
  2087. "isleader": 0,
  2088. "core_user_id": "",
  2089. "name": "销售经理",
  2090. "pId": 528,
  2091. "id": 536,
  2092. "ispost": 2,
  2093. "open": false
  2094. },
  2095. {
  2096. "isleader": 0,
  2097. "core_user_id": "",
  2098. "name": "试剂事业部",
  2099. "pId": 133,
  2100. "id": 538,
  2101. "ispost": 1,
  2102. "open": false
  2103. },
  2104. {
  2105. "isleader": 1,
  2106. "core_user_id": "",
  2107. "iconSkin": "diy",
  2108. "name": "销售副总监",
  2109. "pId": 538,
  2110. "id": 540,
  2111. "ispost": 2,
  2112. "open": false
  2113. },
  2114. {
  2115. "isleader": 0,
  2116. "core_user_id": "",
  2117. "name": "统筹经理",
  2118. "pId": 538,
  2119. "id": 542,
  2120. "ispost": 2,
  2121. "open": false
  2122. },
  2123. {
  2124. "isleader": 0,
  2125. "core_user_id": "",
  2126. "name": "试剂采购",
  2127. "pId": 538,
  2128. "id": 544,
  2129. "ispost": 1,
  2130. "open": false
  2131. },
  2132. {
  2133. "isleader": 1,
  2134. "core_user_id": "",
  2135. "iconSkin": "diy",
  2136. "name": "高级采购经理",
  2137. "pId": 544,
  2138. "id": 546,
  2139. "ispost": 2,
  2140. "open": false
  2141. },
  2142. {
  2143. "isleader": 0,
  2144. "core_user_id": "",
  2145. "name": "采购成员",
  2146. "pId": 544,
  2147. "id": 548,
  2148. "ispost": 2,
  2149. "open": false
  2150. },
  2151. {
  2152. "isleader": 0,
  2153. "core_user_id": "",
  2154. "name": "销售客服经理",
  2155. "pId": 538,
  2156. "id": 550,
  2157. "ispost": 2,
  2158. "open": false
  2159. },
  2160. {
  2161. "isleader": 0,
  2162. "core_user_id": "",
  2163. "name": "销售助理",
  2164. "pId": 538,
  2165. "id": 552,
  2166. "ispost": 2,
  2167. "open": false
  2168. },
  2169. {
  2170. "isleader": 0,
  2171. "core_user_id": "",
  2172. "name": "醇钠事业部",
  2173. "pId": 386,
  2174. "id": 554,
  2175. "ispost": 1,
  2176. "open": false
  2177. },
  2178. {
  2179. "isleader": 1,
  2180. "core_user_id": "",
  2181. "iconSkin": "diy",
  2182. "name": "总经理",
  2183. "pId": 554,
  2184. "id": 556,
  2185. "ispost": 2,
  2186. "open": false
  2187. },
  2188. {
  2189. "isleader": 0,
  2190. "core_user_id": "",
  2191. "name": "产品经理",
  2192. "pId": 554,
  2193. "id": 558,
  2194. "ispost": 2,
  2195. "open": false
  2196. },
  2197. {
  2198. "isleader": 0,
  2199. "core_user_id": "",
  2200. "name": "甘油事业部",
  2201. "pId": 386,
  2202. "id": 560,
  2203. "ispost": 1,
  2204. "open": false
  2205. },
  2206. {
  2207. "isleader": 1,
  2208. "core_user_id": "",
  2209. "iconSkin": "diy",
  2210. "name": "甘油事业部负责人",
  2211. "pId": 560,
  2212. "id": 562,
  2213. "ispost": 2,
  2214. "open": false
  2215. },
  2216. {
  2217. "isleader": 0,
  2218. "core_user_id": "",
  2219. "name": "甘油事业部成员",
  2220. "pId": 560,
  2221. "id": 564,
  2222. "ispost": 2,
  2223. "open": false
  2224. },
  2225. {
  2226. "isleader": 0,
  2227. "core_user_id": "",
  2228. "name": "胶黏剂事业部",
  2229. "pId": 386,
  2230. "id": 566,
  2231. "ispost": 1,
  2232. "open": false
  2233. },
  2234. {
  2235. "isleader": 1,
  2236. "core_user_id": "",
  2237. "iconSkin": "diy",
  2238. "name": "胶黏剂事业部负责人",
  2239. "pId": 566,
  2240. "id": 568,
  2241. "ispost": 2,
  2242. "open": false
  2243. },
  2244. {
  2245. "isleader": 0,
  2246. "core_user_id": "",
  2247. "name": "胶黏剂事业部成员",
  2248. "pId": 566,
  2249. "id": 570,
  2250. "ispost": 2,
  2251. "open": false
  2252. },
  2253. {
  2254. "isleader": 0,
  2255. "core_user_id": "",
  2256. "name": "氯碱事业部",
  2257. "pId": 386,
  2258. "id": 572,
  2259. "ispost": 1,
  2260. "open": false
  2261. },
  2262. {
  2263. "isleader": 1,
  2264. "core_user_id": "",
  2265. "iconSkin": "diy",
  2266. "name": "氯碱事业部负责人",
  2267. "pId": 572,
  2268. "id": 574,
  2269. "ispost": 2,
  2270. "open": false
  2271. },
  2272. {
  2273. "isleader": 0,
  2274. "core_user_id": "",
  2275. "name": "氯碱事业部成员",
  2276. "pId": 572,
  2277. "id": 576,
  2278. "ispost": 2,
  2279. "open": false
  2280. },
  2281. {
  2282. "isleader": 1,
  2283. "core_user_id": "",
  2284. "iconSkin": "diy",
  2285. "name": "总经理",
  2286. "pId": 422,
  2287. "id": 578,
  2288. "ispost": 2,
  2289. "open": false
  2290. },
  2291. {
  2292. "isleader": 1,
  2293. "core_user_id": "",
  2294. "iconSkin": "diy",
  2295. "name": "橡塑事业部2副经理",
  2296. "pId": 404,
  2297. "id": 580,
  2298. "ispost": 2,
  2299. "open": false
  2300. },
  2301. {
  2302. "isleader": 0,
  2303. "core_user_id": "",
  2304. "name": "橡塑事业部2成员",
  2305. "pId": 404,
  2306. "id": 582,
  2307. "ispost": 2,
  2308. "open": false
  2309. },
  2310. {
  2311. "isleader": 0,
  2312. "core_user_id": "",
  2313. "name": "电子化学事业部",
  2314. "pId": 386,
  2315. "id": 584,
  2316. "ispost": 1,
  2317. "open": false
  2318. },
  2319. {
  2320. "isleader": 1,
  2321. "core_user_id": "",
  2322. "iconSkin": "diy",
  2323. "name": "电子化学事业部总经理",
  2324. "pId": 584,
  2325. "id": 586,
  2326. "ispost": 2,
  2327. "open": false
  2328. },
  2329. {
  2330. "isleader": 0,
  2331. "core_user_id": "",
  2332. "name": "电子化学事业部成员",
  2333. "pId": 584,
  2334. "id": 588,
  2335. "ispost": 2,
  2336. "open": false
  2337. },
  2338. {
  2339. "isleader": 0,
  2340. "core_user_id": "",
  2341. "name": "食品添加剂事业部",
  2342. "pId": 386,
  2343. "id": 590,
  2344. "ispost": 1,
  2345. "open": false
  2346. },
  2347. {
  2348. "isleader": 1,
  2349. "core_user_id": "",
  2350. "iconSkin": "diy",
  2351. "name": "食品添加剂事业部总经理",
  2352. "pId": 590,
  2353. "id": 592,
  2354. "ispost": 2,
  2355. "open": false
  2356. },
  2357. {
  2358. "isleader": 0,
  2359. "core_user_id": "",
  2360. "name": "食品添加剂事业部成员",
  2361. "pId": 590,
  2362. "id": 594,
  2363. "ispost": 2,
  2364. "open": false
  2365. },
  2366. {
  2367. "isleader": 0,
  2368. "core_user_id": "",
  2369. "name": "总裁助理",
  2370. "pId": 189,
  2371. "id": 596,
  2372. "ispost": 2,
  2373. "open": false
  2374. },
  2375. {
  2376. "isleader": 0,
  2377. "core_user_id": "",
  2378. "name": "苯事业部",
  2379. "pId": 386,
  2380. "id": 598,
  2381. "ispost": 1,
  2382. "open": false
  2383. },
  2384. {
  2385. "isleader": 1,
  2386. "core_user_id": "",
  2387. "iconSkin": "diy",
  2388. "name": "苯事业部负责人",
  2389. "pId": 598,
  2390. "id": 600,
  2391. "ispost": 2,
  2392. "open": false
  2393. },
  2394. {
  2395. "isleader": 0,
  2396. "core_user_id": "",
  2397. "name": "苯事业部成员",
  2398. "pId": 598,
  2399. "id": 602,
  2400. "ispost": 2,
  2401. "open": false
  2402. },
  2403. {
  2404. "isleader": 0,
  2405. "core_user_id": "",
  2406. "name": "表面活性剂事业部",
  2407. "pId": 386,
  2408. "id": 604,
  2409. "ispost": 1,
  2410. "open": false
  2411. },
  2412. {
  2413. "isleader": 1,
  2414. "core_user_id": "",
  2415. "iconSkin": "diy",
  2416. "name": "表面活性剂事业部负责人",
  2417. "pId": 604,
  2418. "id": 606,
  2419. "ispost": 2,
  2420. "open": false
  2421. },
  2422. {
  2423. "isleader": 0,
  2424. "core_user_id": "",
  2425. "name": "表面活性剂事业部成员",
  2426. "pId": 604,
  2427. "id": 608,
  2428. "ispost": 2,
  2429. "open": false
  2430. }
  2431. ]

metroStyle.css

  1. /*-------------------------------------
  2. zTree Style
  3.  
  4. version: 3.4
  5. author: Hunter.z
  6. email: hunter.z@263.net
  7. website: http://code.google.com/p/jquerytree/
  8.  
  9. -------------------------------------*/
  10.  
  11. .ztree * {padding:; margin:; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
  12. .ztree {margin:; padding:5px; color:#333}
  13. .ztree li{padding:; margin:; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:}
  14. .ztree li ul{ margin:; padding:0 0 0 18px}
  15. .ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
  16.  
  17. .ztree li a {padding-right:3px; margin:; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block}
  18. .ztree li a:hover {text-decoration:underline}
  19. .ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;}
  20. .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;}
  21. .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid;
  22. opacity:0.8; filter:alpha(opacity=80)}
  23. .ztree li a.tmpTargetNode_prev {}
  24. .ztree li a.tmpTargetNode_next {}
  25. .ztree li a input.rename {height:14px; width:80px; padding:; margin:;
  26. font-size:12px; border:1px #585956 solid; *border:0px}
  27. .ztree li span {line-height:21px; margin-right:2px}
  28. .ztree li span.button {line-height:; margin:; padding:; width:21px; height:21px; display: inline-block; vertical-align:middle;
  29. border:0 none; cursor: pointer;outline:none;
  30. background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
  31. background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
  32.  
  33. .ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto}
  34. .ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;}
  35. .ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;}
  36. .ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;}
  37. .ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;}
  38. .ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;}
  39. .ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;}
  40. .ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;}
  41. .ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;}
  42. .ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;}
  43. .ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;}
  44. .ztree li span.button.chk.radio_false_full {background-position: -47px -5px;}
  45. .ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;}
  46. .ztree li span.button.chk.radio_false_part {background-position: -47px -47px;}
  47. .ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;}
  48. .ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;}
  49. .ztree li span.button.chk.radio_true_full {background-position: -68px -5px;}
  50. .ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;}
  51. .ztree li span.button.chk.radio_true_part {background-position: -68px -47px;}
  52. .ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;}
  53. .ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;}
  54.  
  55. .ztree li span.button.switch {width:21px; height:21px}
  56. .ztree li span.button.root_open{background-position:-105px -63px}
  57. .ztree li span.button.root_close{background-position:-126px -63px}
  58. .ztree li span.button.roots_open{background-position: -105px 0;}
  59. .ztree li span.button.roots_close{background-position: -126px 0;}
  60. .ztree li span.button.center_open{background-position: -105px -21px;}
  61. .ztree li span.button.center_close{background-position: -126px -21px;}
  62. .ztree li span.button.bottom_open{background-position: -105px -42px;}
  63. .ztree li span.button.bottom_close{background-position: -126px -42px;}
  64. .ztree li span.button.noline_open{background-position: -105px -84px;}
  65. .ztree li span.button.noline_close{background-position: -126px -84px;}
  66. .ztree li span.button.root_docu{ background:none;}
  67. .ztree li span.button.roots_docu{background-position: -84px 0;}
  68. .ztree li span.button.center_docu{background-position: -84px -21px;}
  69. .ztree li span.button.bottom_docu{background-position: -84px -42px;}
  70. .ztree li span.button.noline_docu{ background:none;}
  71.  
  72. .ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
  73. .ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
  74. .ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}
  75. .ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}
  76.  
  77. /**
  78. *���Ӹ�����ͼ��
  79. **/
  80. .ztree li span.button.diy_ico_docu{margin-right:2px; background-position: -23px -64px; vertical-align:top; *vertical-align:middle}
  81.  
  82. .ztree li span.button.edit:hover {
  83. background-position: -168px -21px;
  84. }
  85. .ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}
  86. .ztree li span.button.remove:hover {
  87. background-position: -168px -42px;
  88. }
  89. .ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}
  90. .ztree li span.button.add:hover {
  91. background-position: -168px 0;
  92. }
  93. .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  94.  
  95. ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
  96.  
  97. span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:; margin:2px 0 0 1px; border:0 none; position:absolute;
  98. background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
  99. background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
  100.  
  101. ul.ztreeul.ztreeDragUL {margin:; padding:; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
  102. .ztreeMask {z-index:; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}

jquery.ztree.core-3.5.js

  1. /*
  2. * JQuery zTree core v3.5.19.1
  3. * http://zTree.me/
  4. *
  5. * Copyright (c) 2010 Hunter.z
  6. *
  7. * Licensed same as jquery - MIT License
  8. * http://www.opensource.org/licenses/mit-license.php
  9. *
  10. * email: hunter.z@263.net
  11. * Date: 2015-10-26
  12. */
  13. (function($){
  14. var settings = {}, roots = {}, caches = {},
  15. //default consts of core
  16. _consts = {
  17. className: {
  18. BUTTON: "button",
  19. LEVEL: "level",
  20. ICO_LOADING: "ico_loading",
  21. SWITCH: "switch"
  22. },
  23. event: {
  24. NODECREATED: "ztree_nodeCreated",
  25. CLICK: "ztree_click",
  26. EXPAND: "ztree_expand",
  27. COLLAPSE: "ztree_collapse",
  28. ASYNC_SUCCESS: "ztree_async_success",
  29. ASYNC_ERROR: "ztree_async_error",
  30. REMOVE: "ztree_remove",
  31. SELECTED: "ztree_selected",
  32. UNSELECTED: "ztree_unselected"
  33. },
  34. id: {
  35. A: "_a",
  36. ICON: "_ico",
  37. SPAN: "_span",
  38. SWITCH: "_switch",
  39. UL: "_ul"
  40. },
  41. line: {
  42. ROOT: "root",
  43. ROOTS: "roots",
  44. CENTER: "center",
  45. BOTTOM: "bottom",
  46. NOLINE: "noline",
  47. LINE: "line"
  48. },
  49. folder: {
  50. OPEN: "open",
  51. CLOSE: "close",
  52. DOCU: "docu"
  53. },
  54. node: {
  55. CURSELECTED: "curSelectedNode"
  56. }
  57. },
  58. //default setting of core
  59. _setting = {
  60. treeId: "",
  61. treeObj: null,
  62. view: {
  63. addDiyDom: null,
  64. autoCancelSelected: true,
  65. dblClickExpand: true,
  66. expandSpeed: "fast",
  67. fontCss: {},
  68. nameIsHTML: false,
  69. selectedMulti: true,
  70. showIcon: true,
  71. showLine: true,
  72. showTitle: true,
  73. txtSelectedEnable: false
  74. },
  75. data: {
  76. key: {
  77. children: "children",
  78. name: "name",
  79. title: "",
  80. url: "url",
  81. icon: "icon"
  82. },
  83. simpleData: {
  84. enable: false,
  85. idKey: "id",
  86. pIdKey: "pId",
  87. rootPId: null
  88. },
  89. keep: {
  90. parent: false,
  91. leaf: false
  92. }
  93. },
  94. async: {
  95. enable: false,
  96. contentType: "application/x-www-form-urlencoded",
  97. type: "post",
  98. dataType: "text",
  99. url: "",
  100. autoParam: [],
  101. otherParam: [],
  102. dataFilter: null
  103. },
  104. callback: {
  105. beforeAsync:null,
  106. beforeClick:null,
  107. beforeDblClick:null,
  108. beforeRightClick:null,
  109. beforeMouseDown:null,
  110. beforeMouseUp:null,
  111. beforeExpand:null,
  112. beforeCollapse:null,
  113. beforeRemove:null,
  114.  
  115. onAsyncError:null,
  116. onAsyncSuccess:null,
  117. onNodeCreated:null,
  118. onClick:null,
  119. onDblClick:null,
  120. onRightClick:null,
  121. onMouseDown:null,
  122. onMouseUp:null,
  123. onExpand:null,
  124. onCollapse:null,
  125. onRemove:null
  126. }
  127. },
  128. //default root of core
  129. //zTree use root to save full data
  130. _initRoot = function (setting) {
  131. var r = data.getRoot(setting);
  132. if (!r) {
  133. r = {};
  134. data.setRoot(setting, r);
  135. }
  136. r[setting.data.key.children] = [];
  137. r.expandTriggerFlag = false;
  138. r.curSelectedList = [];
  139. r.noSelection = true;
  140. r.createdNodes = [];
  141. r.zId = 0;
  142. r._ver = (new Date()).getTime();
  143. },
  144. //default cache of core
  145. _initCache = function(setting) {
  146. var c = data.getCache(setting);
  147. if (!c) {
  148. c = {};
  149. data.setCache(setting, c);
  150. }
  151. c.nodes = [];
  152. c.doms = [];
  153. },
  154. //default bindEvent of core
  155. _bindEvent = function(setting) {
  156. var o = setting.treeObj,
  157. c = consts.event;
  158. o.bind(c.NODECREATED, function (event, treeId, node) {
  159. tools.apply(setting.callback.onNodeCreated, [event, treeId, node]);
  160. });
  161.  
  162. o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) {
  163. tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]);
  164. });
  165.  
  166. o.bind(c.EXPAND, function (event, treeId, node) {
  167. tools.apply(setting.callback.onExpand, [event, treeId, node]);
  168. });
  169.  
  170. o.bind(c.COLLAPSE, function (event, treeId, node) {
  171. tools.apply(setting.callback.onCollapse, [event, treeId, node]);
  172. });
  173.  
  174. o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) {
  175. tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]);
  176. });
  177.  
  178. o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) {
  179. tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]);
  180. });
  181.  
  182. o.bind(c.REMOVE, function (event, treeId, treeNode) {
  183. tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
  184. });
  185.  
  186. o.bind(c.SELECTED, function (event, treeId, node) {
  187. tools.apply(setting.callback.onSelected, [treeId, node]);
  188. });
  189. o.bind(c.UNSELECTED, function (event, treeId, node) {
  190. tools.apply(setting.callback.onUnSelected, [treeId, node]);
  191. });
  192. },
  193. _unbindEvent = function(setting) {
  194. var o = setting.treeObj,
  195. c = consts.event;
  196. o.unbind(c.NODECREATED)
  197. .unbind(c.CLICK)
  198. .unbind(c.EXPAND)
  199. .unbind(c.COLLAPSE)
  200. .unbind(c.ASYNC_SUCCESS)
  201. .unbind(c.ASYNC_ERROR)
  202. .unbind(c.REMOVE)
  203. .unbind(c.SELECTED)
  204. .unbind(c.UNSELECTED);
  205. },
  206. //default event proxy of core
  207. _eventProxy = function(event) {
  208. var target = event.target,
  209. setting = data.getSetting(event.data.treeId),
  210. tId = "", node = null,
  211. nodeEventType = "", treeEventType = "",
  212. nodeEventCallback = null, treeEventCallback = null,
  213. tmp = null;
  214.  
  215. if (tools.eqs(event.type, "mousedown")) {
  216. treeEventType = "mousedown";
  217. } else if (tools.eqs(event.type, "mouseup")) {
  218. treeEventType = "mouseup";
  219. } else if (tools.eqs(event.type, "contextmenu")) {
  220. treeEventType = "contextmenu";
  221. } else if (tools.eqs(event.type, "click")) {
  222. if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) {
  223. tId = tools.getNodeMainDom(target).id;
  224. nodeEventType = "switchNode";
  225. } else {
  226. tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  227. if (tmp) {
  228. tId = tools.getNodeMainDom(tmp).id;
  229. nodeEventType = "clickNode";
  230. }
  231. }
  232. } else if (tools.eqs(event.type, "dblclick")) {
  233. treeEventType = "dblclick";
  234. tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  235. if (tmp) {
  236. tId = tools.getNodeMainDom(tmp).id;
  237. nodeEventType = "switchNode";
  238. }
  239. }
  240. if (treeEventType.length > 0 && tId.length == 0) {
  241. tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  242. if (tmp) {tId = tools.getNodeMainDom(tmp).id;}
  243. }
  244. // event to node
  245. if (tId.length>0) {
  246. node = data.getNodeCache(setting, tId);
  247. switch (nodeEventType) {
  248. case "switchNode" :
  249. if (!node.isParent) {
  250. nodeEventType = "";
  251. } else if (tools.eqs(event.type, "click")
  252. || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) {
  253. nodeEventCallback = handler.onSwitchNode;
  254. } else {
  255. nodeEventType = "";
  256. }
  257. break;
  258. case "clickNode" :
  259. nodeEventCallback = handler.onClickNode;
  260. break;
  261. }
  262. }
  263. // event to zTree
  264. switch (treeEventType) {
  265. case "mousedown" :
  266. treeEventCallback = handler.onZTreeMousedown;
  267. break;
  268. case "mouseup" :
  269. treeEventCallback = handler.onZTreeMouseup;
  270. break;
  271. case "dblclick" :
  272. treeEventCallback = handler.onZTreeDblclick;
  273. break;
  274. case "contextmenu" :
  275. treeEventCallback = handler.onZTreeContextmenu;
  276. break;
  277. }
  278. var proxyResult = {
  279. stop: false,
  280. node: node,
  281. nodeEventType: nodeEventType,
  282. nodeEventCallback: nodeEventCallback,
  283. treeEventType: treeEventType,
  284. treeEventCallback: treeEventCallback
  285. };
  286. return proxyResult
  287. },
  288. //default init node of core
  289. _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
  290. if (!n) return;
  291. var r = data.getRoot(setting),
  292. childKey = setting.data.key.children;
  293. n.level = level;
  294. n.tId = setting.treeId + "_" + (++r.zId);
  295. n.parentTId = parentNode ? parentNode.tId : null;
  296. n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open;
  297. if (n[childKey] && n[childKey].length > 0) {
  298. n.isParent = true;
  299. n.zAsync = true;
  300. } else {
  301. n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent;
  302. n.open = (n.isParent && !setting.async.enable) ? n.open : false;
  303. n.zAsync = !n.isParent;
  304. }
  305. n.isFirstNode = isFirstNode;
  306. n.isLastNode = isLastNode;
  307. n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);};
  308. n.getPreNode = function() {return data.getPreNode(setting, n);};
  309. n.getNextNode = function() {return data.getNextNode(setting, n);};
  310. n.getIndex = function() {return data.getNodeIndex(setting, n);};
  311. n.getPath = function() {return data.getNodePath(setting, n);};
  312. n.isAjaxing = false;
  313. data.fixPIdKeyValue(setting, n);
  314. },
  315. _init = {
  316. bind: [_bindEvent],
  317. unbind: [_unbindEvent],
  318. caches: [_initCache],
  319. nodes: [_initNode],
  320. proxys: [_eventProxy],
  321. roots: [_initRoot],
  322. beforeA: [],
  323. afterA: [],
  324. innerBeforeA: [],
  325. innerAfterA: [],
  326. zTreeTools: []
  327. },
  328. //method of operate data
  329. data = {
  330. addNodeCache: function(setting, node) {
  331. data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node;
  332. },
  333. getNodeCacheId: function(tId) {
  334. return tId.substring(tId.lastIndexOf("_")+1);
  335. },
  336. addAfterA: function(afterA) {
  337. _init.afterA.push(afterA);
  338. },
  339. addBeforeA: function(beforeA) {
  340. _init.beforeA.push(beforeA);
  341. },
  342. addInnerAfterA: function(innerAfterA) {
  343. _init.innerAfterA.push(innerAfterA);
  344. },
  345. addInnerBeforeA: function(innerBeforeA) {
  346. _init.innerBeforeA.push(innerBeforeA);
  347. },
  348. addInitBind: function(bindEvent) {
  349. _init.bind.push(bindEvent);
  350. },
  351. addInitUnBind: function(unbindEvent) {
  352. _init.unbind.push(unbindEvent);
  353. },
  354. addInitCache: function(initCache) {
  355. _init.caches.push(initCache);
  356. },
  357. addInitNode: function(initNode) {
  358. _init.nodes.push(initNode);
  359. },
  360. addInitProxy: function(initProxy, isFirst) {
  361. if (!!isFirst) {
  362. _init.proxys.splice(0,0,initProxy);
  363. } else {
  364. _init.proxys.push(initProxy);
  365. }
  366. },
  367. addInitRoot: function(initRoot) {
  368. _init.roots.push(initRoot);
  369. },
  370. addNodesData: function(setting, parentNode, index, nodes) {
  371. var childKey = setting.data.key.children, params;
  372. if (!parentNode[childKey]) {
  373. parentNode[childKey] = [];
  374. index = -1;
  375. } else if (index >= parentNode[childKey].length) {
  376. index = -1;
  377. }
  378.  
  379. if (parentNode[childKey].length > 0 && index === 0) {
  380. parentNode[childKey][0].isFirstNode = false;
  381. view.setNodeLineIcos(setting, parentNode[childKey][0]);
  382. } else if (parentNode[childKey].length > 0 && index < 0) {
  383. parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false;
  384. view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]);
  385. }
  386. parentNode.isParent = true;
  387.  
  388. if (index<0) {
  389. parentNode[childKey] = parentNode[childKey].concat(nodes);
  390. } else {
  391. params = [index, 0].concat(nodes);
  392. parentNode[childKey].splice.apply(parentNode[childKey], params);
  393. }
  394. },
  395. addSelectedNode: function(setting, node) {
  396. var root = data.getRoot(setting);
  397. if (!data.isSelectedNode(setting, node)) {
  398. root.curSelectedList.push(node);
  399. }
  400. },
  401. addCreatedNode: function(setting, node) {
  402. if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
  403. var root = data.getRoot(setting);
  404. root.createdNodes.push(node);
  405. }
  406. },
  407. addZTreeTools: function(zTreeTools) {
  408. _init.zTreeTools.push(zTreeTools);
  409. },
  410. exSetting: function(s) {
  411. $.extend(true, _setting, s);
  412. },
  413. fixPIdKeyValue: function(setting, node) {
  414. if (setting.data.simpleData.enable) {
  415. node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId;
  416. }
  417. },
  418. getAfterA: function(setting, node, array) {
  419. for (var i=0, j=_init.afterA.length; i<j; i++) {
  420. _init.afterA[i].apply(this, arguments);
  421. }
  422. },
  423. getBeforeA: function(setting, node, array) {
  424. for (var i=0, j=_init.beforeA.length; i<j; i++) {
  425. _init.beforeA[i].apply(this, arguments);
  426. }
  427. },
  428. getInnerAfterA: function(setting, node, array) {
  429. for (var i=0, j=_init.innerAfterA.length; i<j; i++) {
  430. _init.innerAfterA[i].apply(this, arguments);
  431. }
  432. },
  433. getInnerBeforeA: function(setting, node, array) {
  434. for (var i=0, j=_init.innerBeforeA.length; i<j; i++) {
  435. _init.innerBeforeA[i].apply(this, arguments);
  436. }
  437. },
  438. getCache: function(setting) {
  439. return caches[setting.treeId];
  440. },
  441. getNodeIndex: function(setting, node) {
  442. if (!node) return null;
  443. var childKey = setting.data.key.children,
  444. p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  445. for (var i=0, l=p[childKey].length-1; i<=l; i++) {
  446. if (p[childKey][i] === node) {
  447. return i;
  448. }
  449. }
  450. return -1;
  451. },
  452. getNextNode: function(setting, node) {
  453. if (!node) return null;
  454. var childKey = setting.data.key.children,
  455. p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  456. for (var i=0, l=p[childKey].length-1; i<=l; i++) {
  457. if (p[childKey][i] === node) {
  458. return (i==l ? null : p[childKey][i+1]);
  459. }
  460. }
  461. return null;
  462. },
  463. getNodeByParam: function(setting, nodes, key, value) {
  464. if (!nodes || !key) return null;
  465. var childKey = setting.data.key.children;
  466. for (var i = 0, l = nodes.length; i < l; i++) {
  467. if (nodes[i][key] == value) {
  468. return nodes[i];
  469. }
  470. var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value);
  471. if (tmp) return tmp;
  472. }
  473. return null;
  474. },
  475. getNodeCache: function(setting, tId) {
  476. if (!tId) return null;
  477. var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)];
  478. return n ? n : null;
  479. },
  480. getNodeName: function(setting, node) {
  481. var nameKey = setting.data.key.name;
  482. return "" + node[nameKey];
  483. },
  484. getNodePath: function(setting, node) {
  485. if (!node) return null;
  486.  
  487. var path;
  488. if(node.parentTId) {
  489. path = node.getParentNode().getPath();
  490. } else {
  491. path = [];
  492. }
  493.  
  494. if (path) {
  495. path.push(node);
  496. }
  497.  
  498. return path;
  499. },
  500. getNodeTitle: function(setting, node) {
  501. var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
  502. return "" + node[t];
  503. },
  504. getNodes: function(setting) {
  505. return data.getRoot(setting)[setting.data.key.children];
  506. },
  507. getNodesByParam: function(setting, nodes, key, value) {
  508. if (!nodes || !key) return [];
  509. var childKey = setting.data.key.children,
  510. result = [];
  511. for (var i = 0, l = nodes.length; i < l; i++) {
  512. if (nodes[i][key] == value) {
  513. result.push(nodes[i]);
  514. }
  515. result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value));
  516. }
  517. return result;
  518. },
  519. getNodesByParamFuzzy: function(setting, nodes, key, value) {
  520. if (!nodes || !key) return [];
  521. var childKey = setting.data.key.children,
  522. result = [];
  523. value = value.toLowerCase();
  524. for (var i = 0, l = nodes.length; i < l; i++) {
  525. if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value)>-1) {
  526. result.push(nodes[i]);
  527. }
  528. result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value));
  529. }
  530. return result;
  531. },
  532. getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) {
  533. if (!nodes) return (isSingle ? null : []);
  534. var childKey = setting.data.key.children,
  535. result = isSingle ? null : [];
  536. for (var i = 0, l = nodes.length; i < l; i++) {
  537. if (tools.apply(filter, [nodes[i], invokeParam], false)) {
  538. if (isSingle) {return nodes[i];}
  539. result.push(nodes[i]);
  540. }
  541. var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam);
  542. if (isSingle && !!tmpResult) {return tmpResult;}
  543. result = isSingle ? tmpResult : result.concat(tmpResult);
  544. }
  545. return result;
  546. },
  547. getPreNode: function(setting, node) {
  548. if (!node) return null;
  549. var childKey = setting.data.key.children,
  550. p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  551. for (var i=0, l=p[childKey].length; i<l; i++) {
  552. if (p[childKey][i] === node) {
  553. return (i==0 ? null : p[childKey][i-1]);
  554. }
  555. }
  556. return null;
  557. },
  558. getRoot: function(setting) {
  559. return setting ? roots[setting.treeId] : null;
  560. },
  561. getRoots: function() {
  562. return roots;
  563. },
  564. getSetting: function(treeId) {
  565. return settings[treeId];
  566. },
  567. getSettings: function() {
  568. return settings;
  569. },
  570. getZTreeTools: function(treeId) {
  571. var r = this.getRoot(this.getSetting(treeId));
  572. return r ? r.treeTools : null;
  573. },
  574. initCache: function(setting) {
  575. for (var i=0, j=_init.caches.length; i<j; i++) {
  576. _init.caches[i].apply(this, arguments);
  577. }
  578. },
  579. initNode: function(setting, level, node, parentNode, preNode, nextNode) {
  580. for (var i=0, j=_init.nodes.length; i<j; i++) {
  581. _init.nodes[i].apply(this, arguments);
  582. }
  583. },
  584. initRoot: function(setting) {
  585. for (var i=0, j=_init.roots.length; i<j; i++) {
  586. _init.roots[i].apply(this, arguments);
  587. }
  588. },
  589. isSelectedNode: function(setting, node) {
  590. var root = data.getRoot(setting);
  591. for (var i=0, j=root.curSelectedList.length; i<j; i++) {
  592. if(node === root.curSelectedList[i]) return true;
  593. }
  594. return false;
  595. },
  596. removeNodeCache: function(setting, node) {
  597. var childKey = setting.data.key.children;
  598. if (node[childKey]) {
  599. for (var i=0, l=node[childKey].length; i<l; i++) {
  600. arguments.callee(setting, node[childKey][i]);
  601. }
  602. }
  603. data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null;
  604. },
  605. removeSelectedNode: function(setting, node) {
  606. var root = data.getRoot(setting);
  607. for (var i=0, j=root.curSelectedList.length; i<j; i++) {
  608. if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
  609. root.curSelectedList.splice(i, 1);
  610. setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]);
  611. i--;j--;
  612. }
  613. }
  614. },
  615. setCache: function(setting, cache) {
  616. caches[setting.treeId] = cache;
  617. },
  618. setRoot: function(setting, root) {
  619. roots[setting.treeId] = root;
  620. },
  621. setZTreeTools: function(setting, zTreeTools) {
  622. for (var i=0, j=_init.zTreeTools.length; i<j; i++) {
  623. _init.zTreeTools[i].apply(this, arguments);
  624. }
  625. },
  626. transformToArrayFormat: function (setting, nodes) {
  627. if (!nodes) return [];
  628. var childKey = setting.data.key.children,
  629. r = [];
  630. if (tools.isArray(nodes)) {
  631. for (var i=0, l=nodes.length; i<l; i++) {
  632. r.push(nodes[i]);
  633. if (nodes[i][childKey])
  634. r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey]));
  635. }
  636. } else {
  637. r.push(nodes);
  638. if (nodes[childKey])
  639. r = r.concat(data.transformToArrayFormat(setting, nodes[childKey]));
  640. }
  641. return r;
  642. },
  643. transformTozTreeFormat: function(setting, sNodes) {
  644. var i,l,
  645. key = setting.data.simpleData.idKey,
  646. parentKey = setting.data.simpleData.pIdKey,
  647. childKey = setting.data.key.children;
  648. if (!key || key=="" || !sNodes) return [];
  649.  
  650. if (tools.isArray(sNodes)) {
  651. var r = [];
  652. var tmpMap = [];
  653. for (i=0, l=sNodes.length; i<l; i++) {
  654. tmpMap[sNodes[i][key]] = sNodes[i];
  655. }
  656. for (i=0, l=sNodes.length; i<l; i++) {
  657. if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) {
  658. if (!tmpMap[sNodes[i][parentKey]][childKey])
  659. tmpMap[sNodes[i][parentKey]][childKey] = [];
  660. tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]);
  661. } else {
  662. r.push(sNodes[i]);
  663. }
  664. }
  665. return r;
  666. }else {
  667. return [sNodes];
  668. }
  669. }
  670. },
  671. //method of event proxy
  672. event = {
  673. bindEvent: function(setting) {
  674. for (var i=0, j=_init.bind.length; i<j; i++) {
  675. _init.bind[i].apply(this, arguments);
  676. }
  677. },
  678. unbindEvent: function(setting) {
  679. for (var i=0, j=_init.unbind.length; i<j; i++) {
  680. _init.unbind[i].apply(this, arguments);
  681. }
  682. },
  683. bindTree: function(setting) {
  684. var eventParam = {
  685. treeId: setting.treeId
  686. },
  687. o = setting.treeObj;
  688. if (!setting.view.txtSelectedEnable) {
  689. // for can't select text
  690. o.bind('selectstart', handler.onSelectStart).css({
  691. "-moz-user-select":"-moz-none"
  692. });
  693. }
  694. o.bind('click', eventParam, event.proxy);
  695. o.bind('dblclick', eventParam, event.proxy);
  696. o.bind('mouseover', eventParam, event.proxy);
  697. o.bind('mouseout', eventParam, event.proxy);
  698. o.bind('mousedown', eventParam, event.proxy);
  699. o.bind('mouseup', eventParam, event.proxy);
  700. o.bind('contextmenu', eventParam, event.proxy);
  701. },
  702. unbindTree: function(setting) {
  703. var o = setting.treeObj;
  704. o.unbind('selectstart', handler.onSelectStart)
  705. .unbind('click', event.proxy)
  706. .unbind('dblclick', event.proxy)
  707. .unbind('mouseover', event.proxy)
  708. .unbind('mouseout', event.proxy)
  709. .unbind('mousedown', event.proxy)
  710. .unbind('mouseup', event.proxy)
  711. .unbind('contextmenu', event.proxy);
  712. },
  713. doProxy: function(e) {
  714. var results = [];
  715. for (var i=0, j=_init.proxys.length; i<j; i++) {
  716. var proxyResult = _init.proxys[i].apply(this, arguments);
  717. results.push(proxyResult);
  718. if (proxyResult.stop) {
  719. break;
  720. }
  721. }
  722. return results;
  723. },
  724. proxy: function(e) {
  725. var setting = data.getSetting(e.data.treeId);
  726. if (!tools.uCanDo(setting, e)) return true;
  727. var results = event.doProxy(e),
  728. r = true, x = false;
  729. for (var i=0, l=results.length; i<l; i++) {
  730. var proxyResult = results[i];
  731. if (proxyResult.nodeEventCallback) {
  732. x = true;
  733. r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
  734. }
  735. if (proxyResult.treeEventCallback) {
  736. x = true;
  737. r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
  738. }
  739. }
  740. return r;
  741. }
  742. },
  743. //method of event handler
  744. handler = {
  745. onSwitchNode: function (event, node) {
  746. var setting = data.getSetting(event.data.treeId);
  747. if (node.open) {
  748. if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true;
  749. data.getRoot(setting).expandTriggerFlag = true;
  750. view.switchNode(setting, node);
  751. } else {
  752. if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true;
  753. data.getRoot(setting).expandTriggerFlag = true;
  754. view.switchNode(setting, node);
  755. }
  756. return true;
  757. },
  758. onClickNode: function (event, node) {
  759. var setting = data.getSetting(event.data.treeId),
  760. clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
  761. if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true;
  762. if (clickFlag === 0) {
  763. view.cancelPreSelectedNode(setting, node);
  764. } else {
  765. view.selectNode(setting, node, clickFlag === 2);
  766. }
  767. setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]);
  768. return true;
  769. },
  770. onZTreeMousedown: function(event, node) {
  771. var setting = data.getSetting(event.data.treeId);
  772. if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) {
  773. tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]);
  774. }
  775. return true;
  776. },
  777. onZTreeMouseup: function(event, node) {
  778. var setting = data.getSetting(event.data.treeId);
  779. if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) {
  780. tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]);
  781. }
  782. return true;
  783. },
  784. onZTreeDblclick: function(event, node) {
  785. var setting = data.getSetting(event.data.treeId);
  786. if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) {
  787. tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]);
  788. }
  789. return true;
  790. },
  791. onZTreeContextmenu: function(event, node) {
  792. var setting = data.getSetting(event.data.treeId);
  793. if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) {
  794. tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]);
  795. }
  796. return (typeof setting.callback.onRightClick) != "function";
  797. },
  798. onSelectStart: function(e){
  799. var n = e.originalEvent.srcElement.nodeName.toLowerCase();
  800. return (n === "input" || n === "textarea" );
  801. }
  802. },
  803. //method of tools for zTree
  804. tools = {
  805. apply: function(fun, param, defaultValue) {
  806. if ((typeof fun) == "function") {
  807. return fun.apply(zt, param?param:[]);
  808. }
  809. return defaultValue;
  810. },
  811. canAsync: function(setting, node) {
  812. var childKey = setting.data.key.children;
  813. return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0)));
  814. },
  815. clone: function (obj){
  816. if (obj === null) return null;
  817. var o = tools.isArray(obj) ? [] : {};
  818. for(var i in obj){
  819. o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]);
  820. }
  821. return o;
  822. },
  823. eqs: function(str1, str2) {
  824. return str1.toLowerCase() === str2.toLowerCase();
  825. },
  826. isArray: function(arr) {
  827. return Object.prototype.toString.apply(arr) === "[object Array]";
  828. },
  829. $: function(node, exp, setting) {
  830. if (!!exp && typeof exp != "string") {
  831. setting = exp;
  832. exp = "";
  833. }
  834. if (typeof node == "string") {
  835. return $(node, setting ? setting.treeObj.get(0).ownerDocument : null);
  836. } else {
  837. return $("#" + node.tId + exp, setting ? setting.treeObj : null);
  838. }
  839. },
  840. getMDom: function (setting, curDom, targetExpr) {
  841. if (!curDom) return null;
  842. while (curDom && curDom.id !== setting.treeId) {
  843. for (var i=0, l=targetExpr.length; curDom.tagName && i<l; i++) {
  844. if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) {
  845. return curDom;
  846. }
  847. }
  848. curDom = curDom.parentNode;
  849. }
  850. return null;
  851. },
  852. getNodeMainDom:function(target) {
  853. return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0));
  854. },
  855. isChildOrSelf: function(dom, parentId) {
  856. return ( $(dom).closest("#" + parentId).length> 0 );
  857. },
  858. uCanDo: function(setting, e) {
  859. return true;
  860. }
  861. },
  862. //method of operate ztree dom
  863. view = {
  864. addNodes: function(setting, parentNode, index, newNodes, isSilent) {
  865. if (setting.data.keep.leaf && parentNode && !parentNode.isParent) {
  866. return;
  867. }
  868. if (!tools.isArray(newNodes)) {
  869. newNodes = [newNodes];
  870. }
  871. if (setting.data.simpleData.enable) {
  872. newNodes = data.transformTozTreeFormat(setting, newNodes);
  873. }
  874. if (parentNode) {
  875. var target_switchObj = $$(parentNode, consts.id.SWITCH, setting),
  876. target_icoObj = $$(parentNode, consts.id.ICON, setting),
  877. target_ulObj = $$(parentNode, consts.id.UL, setting);
  878.  
  879. if (!parentNode.open) {
  880. view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE);
  881. view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE);
  882. parentNode.open = false;
  883. target_ulObj.css({
  884. "display": "none"
  885. });
  886. }
  887.  
  888. data.addNodesData(setting, parentNode, index, newNodes);
  889. view.createNodes(setting, parentNode.level + 1, newNodes, parentNode, index);
  890. if (!isSilent) {
  891. view.expandCollapseParentNode(setting, parentNode, true);
  892. }
  893. } else {
  894. data.addNodesData(setting, data.getRoot(setting), index, newNodes);
  895. view.createNodes(setting, 0, newNodes, null, index);
  896. }
  897. },
  898. appendNodes: function(setting, level, nodes, parentNode, index, initFlag, openFlag) {
  899. if (!nodes) return [];
  900. var html = [],
  901. childKey = setting.data.key.children;
  902.  
  903. var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
  904. tmpPChild = tmpPNode[childKey],
  905. isFirstNode, isLastNode;
  906.  
  907. if (!tmpPChild || index >= tmpPChild.length) {
  908. index = -1;
  909. }
  910.  
  911. for (var i = 0, l = nodes.length; i < l; i++) {
  912. var node = nodes[i];
  913. if (initFlag) {
  914. isFirstNode = ((index===0 || tmpPChild.length == nodes.length) && (i == 0));
  915. isLastNode = (index < 0 && i == (nodes.length - 1));
  916. data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag);
  917. data.addNodeCache(setting, node);
  918. }
  919.  
  920. var childHtml = [];
  921. if (node[childKey] && node[childKey].length > 0) {
  922. //make child html first, because checkType
  923. childHtml = view.appendNodes(setting, level + 1, node[childKey], node, -1, initFlag, openFlag && node.open);
  924. }
  925. if (openFlag) {
  926.  
  927. view.makeDOMNodeMainBefore(html, setting, node);
  928. view.makeDOMNodeLine(html, setting, node);
  929. data.getBeforeA(setting, node, html);
  930. view.makeDOMNodeNameBefore(html, setting, node);
  931. data.getInnerBeforeA(setting, node, html);
  932. view.makeDOMNodeIcon(html, setting, node);
  933. data.getInnerAfterA(setting, node, html);
  934. view.makeDOMNodeNameAfter(html, setting, node);
  935. data.getAfterA(setting, node, html);
  936. if (node.isParent && node.open) {
  937. view.makeUlHtml(setting, node, html, childHtml.join(''));
  938. }
  939. view.makeDOMNodeMainAfter(html, setting, node);
  940. data.addCreatedNode(setting, node);
  941. }
  942. }
  943. return html;
  944. },
  945. appendParentULDom: function(setting, node) {
  946. var html = [],
  947. nObj = $$(node, setting);
  948. if (!nObj.get(0) && !!node.parentTId) {
  949. view.appendParentULDom(setting, node.getParentNode());
  950. nObj = $$(node, setting);
  951. }
  952. var ulObj = $$(node, consts.id.UL, setting);
  953. if (ulObj.get(0)) {
  954. ulObj.remove();
  955. }
  956. var childKey = setting.data.key.children,
  957. childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, -1, false, true);
  958. view.makeUlHtml(setting, node, html, childHtml.join(''));
  959. nObj.append(html.join(''));
  960. },
  961. asyncNode: function(setting, node, isSilent, callback) {
  962. var i, l;
  963. if (node && !node.isParent) {
  964. tools.apply(callback);
  965. return false;
  966. } else if (node && node.isAjaxing) {
  967. return false;
  968. } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) {
  969. tools.apply(callback);
  970. return false;
  971. }
  972. if (node) {
  973. node.isAjaxing = true;
  974. var icoObj = $$(node, consts.id.ICON, setting);
  975. icoObj.attr({"style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING});
  976. }
  977.  
  978. var tmpParam = {};
  979. for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) {
  980. var pKey = setting.async.autoParam[i].split("="), spKey = pKey;
  981. if (pKey.length>1) {
  982. spKey = pKey[1];
  983. pKey = pKey[0];
  984. }
  985. tmpParam[spKey] = node[pKey];
  986. }
  987. if (tools.isArray(setting.async.otherParam)) {
  988. for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) {
  989. tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1];
  990. }
  991. } else {
  992. for (var p in setting.async.otherParam) {
  993. tmpParam[p] = setting.async.otherParam[p];
  994. }
  995. }
  996.  
  997. var _tmpV = data.getRoot(setting)._ver;
  998. $.ajax({
  999. contentType: setting.async.contentType,
  1000. cache: false,
  1001. type: setting.async.type,
  1002. url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url),
  1003. data: tmpParam,
  1004. dataType: setting.async.dataType,
  1005. success: function(msg) {
  1006. if (_tmpV != data.getRoot(setting)._ver) {
  1007. return;
  1008. }
  1009. var newNodes = [];
  1010. try {
  1011. if (!msg || msg.length == 0) {
  1012. newNodes = [];
  1013. } else if (typeof msg == "string") {
  1014. newNodes = eval("(" + msg + ")");
  1015. } else {
  1016. newNodes = msg;
  1017. }
  1018. } catch(err) {
  1019. newNodes = msg;
  1020. }
  1021.  
  1022. if (node) {
  1023. node.isAjaxing = null;
  1024. node.zAsync = true;
  1025. }
  1026. view.setNodeLineIcos(setting, node);
  1027. if (newNodes && newNodes !== "") {
  1028. newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes);
  1029. view.addNodes(setting, node, -1, !!newNodes ? tools.clone(newNodes) : [], !!isSilent);
  1030. } else {
  1031. view.addNodes(setting, node, -1, [], !!isSilent);
  1032. }
  1033. setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]);
  1034. tools.apply(callback);
  1035. },
  1036. error: function(XMLHttpRequest, textStatus, errorThrown) {
  1037. if (_tmpV != data.getRoot(setting)._ver) {
  1038. return;
  1039. }
  1040. if (node) node.isAjaxing = null;
  1041. view.setNodeLineIcos(setting, node);
  1042. setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]);
  1043. }
  1044. });
  1045. return true;
  1046. },
  1047. cancelPreSelectedNode: function (setting, node, excludeNode) {
  1048. var list = data.getRoot(setting).curSelectedList,
  1049. i, n;
  1050. for (i=list.length-1; i>=0; i--) {
  1051. n = list[i];
  1052. if (node === n || (!node && (!excludeNode || excludeNode !== n))) {
  1053. $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED);
  1054. if (node) {
  1055. data.removeSelectedNode(setting, node);
  1056. break;
  1057. } else {
  1058. list.splice(i, 1);
  1059. setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]);
  1060. }
  1061. }
  1062. }
  1063. },
  1064. createNodeCallback: function(setting) {
  1065. if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
  1066. var root = data.getRoot(setting);
  1067. while (root.createdNodes.length>0) {
  1068. var node = root.createdNodes.shift();
  1069. tools.apply(setting.view.addDiyDom, [setting.treeId, node]);
  1070. if (!!setting.callback.onNodeCreated) {
  1071. setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]);
  1072. }
  1073. }
  1074. }
  1075. },
  1076. createNodes: function(setting, level, nodes, parentNode, index) {
  1077. if (!nodes || nodes.length == 0) return;
  1078. var root = data.getRoot(setting),
  1079. childKey = setting.data.key.children,
  1080. openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0);
  1081. root.createdNodes = [];
  1082. var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, index, true, openFlag),
  1083. parentObj, nextObj;
  1084.  
  1085. if (!parentNode) {
  1086. parentObj = setting.treeObj;
  1087. //setting.treeObj.append(zTreeHtml.join(''));
  1088. } else {
  1089. var ulObj = $$(parentNode, consts.id.UL, setting);
  1090. if (ulObj.get(0)) {
  1091. parentObj = ulObj;
  1092. //ulObj.append(zTreeHtml.join(''));
  1093. }
  1094. }
  1095. if (parentObj) {
  1096. if (index >= 0) {
  1097. nextObj = parentObj.children()[index];
  1098. }
  1099. if (index >=0 && nextObj) {
  1100. $(nextObj).before(zTreeHtml.join(''));
  1101. } else {
  1102. parentObj.append(zTreeHtml.join(''));
  1103. }
  1104. }
  1105.  
  1106. view.createNodeCallback(setting);
  1107. },
  1108. destroy: function(setting) {
  1109. if (!setting) return;
  1110. data.initCache(setting);
  1111. data.initRoot(setting);
  1112. event.unbindTree(setting);
  1113. event.unbindEvent(setting);
  1114. setting.treeObj.empty();
  1115. delete settings[setting.treeId];
  1116. },
  1117. expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) {
  1118. var root = data.getRoot(setting),
  1119. childKey = setting.data.key.children;
  1120. if (!node) {
  1121. tools.apply(callback, []);
  1122. return;
  1123. }
  1124. if (root.expandTriggerFlag) {
  1125. var _callback = callback;
  1126. callback = function(){
  1127. if (_callback) _callback();
  1128. if (node.open) {
  1129. setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]);
  1130. } else {
  1131. setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]);
  1132. }
  1133. };
  1134. root.expandTriggerFlag = false;
  1135. }
  1136. if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) {
  1137. view.appendParentULDom(setting, node);
  1138. view.createNodeCallback(setting);
  1139. }
  1140. if (node.open == expandFlag) {
  1141. tools.apply(callback, []);
  1142. return;
  1143. }
  1144. var ulObj = $$(node, consts.id.UL, setting),
  1145. switchObj = $$(node, consts.id.SWITCH, setting),
  1146. icoObj = $$(node, consts.id.ICON, setting);
  1147.  
  1148. if (node.isParent) {
  1149. node.open = !node.open;
  1150. if (node.iconOpen && node.iconClose) {
  1151. icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
  1152. }
  1153.  
  1154. if (node.open) {
  1155. view.replaceSwitchClass(node, switchObj, consts.folder.OPEN);
  1156. view.replaceIcoClass(node, icoObj, consts.folder.OPEN);
  1157. if (animateFlag == false || setting.view.expandSpeed == "") {
  1158. ulObj.show();
  1159. tools.apply(callback, []);
  1160. } else {
  1161. if (node[childKey] && node[childKey].length > 0) {
  1162. ulObj.slideDown(setting.view.expandSpeed, callback);
  1163. } else {
  1164. ulObj.show();
  1165. tools.apply(callback, []);
  1166. }
  1167. }
  1168. } else {
  1169. view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE);
  1170. view.replaceIcoClass(node, icoObj, consts.folder.CLOSE);
  1171. if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) {
  1172. ulObj.hide();
  1173. tools.apply(callback, []);
  1174. } else {
  1175. ulObj.slideUp(setting.view.expandSpeed, callback);
  1176. }
  1177. }
  1178. } else {
  1179. tools.apply(callback, []);
  1180. }
  1181. },
  1182. expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) {
  1183. if (!node) return;
  1184. if (!node.parentTId) {
  1185. view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback);
  1186. return;
  1187. } else {
  1188. view.expandCollapseNode(setting, node, expandFlag, animateFlag);
  1189. }
  1190. if (node.parentTId) {
  1191. view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback);
  1192. }
  1193. },
  1194. expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) {
  1195. var root = data.getRoot(setting),
  1196. childKey = setting.data.key.children,
  1197. treeNodes = (node) ? node[childKey]: root[childKey],
  1198. selfAnimateSign = (node) ? false : animateFlag,
  1199. expandTriggerFlag = data.getRoot(setting).expandTriggerFlag;
  1200. data.getRoot(setting).expandTriggerFlag = false;
  1201. if (treeNodes) {
  1202. for (var i = 0, l = treeNodes.length; i < l; i++) {
  1203. if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign);
  1204. }
  1205. }
  1206. data.getRoot(setting).expandTriggerFlag = expandTriggerFlag;
  1207. view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback );
  1208. },
  1209. isSelectedNode: function (setting, node) {
  1210. if (!node) {
  1211. return false;
  1212. }
  1213. var list = data.getRoot(setting).curSelectedList,
  1214. i;
  1215. for (i=list.length-1; i>=0; i--) {
  1216. if (node === list[i]) {
  1217. return true;
  1218. }
  1219. }
  1220. return false;
  1221. },
  1222. makeDOMNodeIcon: function(html, setting, node) {
  1223. var nameStr = data.getNodeName(setting, node),
  1224. name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  1225. html.push("<span id='", node.tId, consts.id.ICON,
  1226. "' title='' treeNode", consts.id.ICON," class='", view.makeNodeIcoClass(setting, node),
  1227. "' style='", view.makeNodeIcoStyle(setting, node), "'></span><span id='", node.tId, consts.id.SPAN,
  1228. "'>",name,"</span>");
  1229. },
  1230. makeDOMNodeLine: function(html, setting, node) {
  1231. html.push("<span id='", node.tId, consts.id.SWITCH, "' title='' class='", view.makeNodeLineClass(setting, node), "' treeNode", consts.id.SWITCH,"></span>");
  1232. },
  1233. makeDOMNodeMainAfter: function(html, setting, node) {
  1234. html.push("</li>");
  1235. },
  1236. makeDOMNodeMainBefore: function(html, setting, node) {
  1237. html.push("<li id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
  1238. },
  1239. makeDOMNodeNameAfter: function(html, setting, node) {
  1240. html.push("</a>");
  1241. },
  1242. makeDOMNodeNameBefore: function(html, setting, node) {
  1243. var title = data.getNodeTitle(setting, node),
  1244. url = view.makeNodeUrl(setting, node),
  1245. fontcss = view.makeNodeFontCss(setting, node),
  1246. fontStyle = [];
  1247. for (var f in fontcss) {
  1248. fontStyle.push(f, ":", fontcss[f], ";");
  1249. }
  1250. html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,"' treeNode", consts.id.A," onclick=\"", (node.click || ''),
  1251. "\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''),
  1252. "'");
  1253. if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"'").replace(/</g,'&lt;').replace(/>/g,'&gt;'),"'");}
  1254. html.push(">");
  1255. },
  1256. makeNodeFontCss: function(setting, node) {
  1257. var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
  1258. return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
  1259. },
  1260. makeNodeIcoClass: function(setting, node) {
  1261. var icoCss = ["ico"];
  1262. if (!node.isAjaxing) {
  1263. icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0];
  1264. if (node.isParent) {
  1265. icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
  1266. } else {
  1267. icoCss.push(consts.folder.DOCU);
  1268. }
  1269. }
  1270. return consts.className.BUTTON + " " + icoCss.join('_');
  1271. },
  1272. makeNodeIcoStyle: function(setting, node) {
  1273. var icoStyle = [];
  1274. if (!node.isAjaxing) {
  1275. var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node[setting.data.key.icon];
  1276. if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;");
  1277. if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) {
  1278. icoStyle.push("width:0px;height:0px;");
  1279. }
  1280. }
  1281. return icoStyle.join('');
  1282. },
  1283. makeNodeLineClass: function(setting, node) {
  1284. var lineClass = [];
  1285. if (setting.view.showLine) {
  1286. if (node.level == 0 && node.isFirstNode && node.isLastNode) {
  1287. lineClass.push(consts.line.ROOT);
  1288. } else if (node.level == 0 && node.isFirstNode) {
  1289. lineClass.push(consts.line.ROOTS);
  1290. } else if (node.isLastNode) {
  1291. lineClass.push(consts.line.BOTTOM);
  1292. } else {
  1293. lineClass.push(consts.line.CENTER);
  1294. }
  1295. } else {
  1296. lineClass.push(consts.line.NOLINE);
  1297. }
  1298. if (node.isParent) {
  1299. lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
  1300. } else {
  1301. lineClass.push(consts.folder.DOCU);
  1302. }
  1303. return view.makeNodeLineClassEx(node) + lineClass.join('_');
  1304. },
  1305. makeNodeLineClassEx: function(node) {
  1306. return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " ";
  1307. },
  1308. makeNodeTarget: function(node) {
  1309. return (node.target || "_blank");
  1310. },
  1311. makeNodeUrl: function(setting, node) {
  1312. var urlKey = setting.data.key.url;
  1313. return node[urlKey] ? node[urlKey] : null;
  1314. },
  1315. makeUlHtml: function(setting, node, html, content) {
  1316. html.push("<ul id='", node.tId, consts.id.UL, "' class='", consts.className.LEVEL, node.level, " ", view.makeUlLineClass(setting, node), "' style='display:", (node.open ? "block": "none"),"'>");
  1317. html.push(content);
  1318. html.push("</ul>");
  1319. },
  1320. makeUlLineClass: function(setting, node) {
  1321. return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : "");
  1322. },
  1323. removeChildNodes: function(setting, node) {
  1324. if (!node) return;
  1325. var childKey = setting.data.key.children,
  1326. nodes = node[childKey];
  1327. if (!nodes) return;
  1328.  
  1329. for (var i = 0, l = nodes.length; i < l; i++) {
  1330. data.removeNodeCache(setting, nodes[i]);
  1331. }
  1332. data.removeSelectedNode(setting);
  1333. delete node[childKey];
  1334.  
  1335. if (!setting.data.keep.parent) {
  1336. node.isParent = false;
  1337. node.open = false;
  1338. var tmp_switchObj = $$(node, consts.id.SWITCH, setting),
  1339. tmp_icoObj = $$(node, consts.id.ICON, setting);
  1340. view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU);
  1341. view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU);
  1342. $$(node, consts.id.UL, setting).remove();
  1343. } else {
  1344. $$(node, consts.id.UL, setting).empty();
  1345. }
  1346. },
  1347. setFirstNode: function(setting, parentNode) {
  1348. var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
  1349. if ( childLength > 0) {
  1350. parentNode[childKey][0].isFirstNode = true;
  1351. }
  1352. },
  1353. setLastNode: function(setting, parentNode) {
  1354. var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
  1355. if ( childLength > 0) {
  1356. parentNode[childKey][childLength - 1].isLastNode = true;
  1357. }
  1358. },
  1359. removeNode: function(setting, node) {
  1360. var root = data.getRoot(setting),
  1361. childKey = setting.data.key.children,
  1362. parentNode = (node.parentTId) ? node.getParentNode() : root;
  1363.  
  1364. node.isFirstNode = false;
  1365. node.isLastNode = false;
  1366. node.getPreNode = function() {return null;};
  1367. node.getNextNode = function() {return null;};
  1368.  
  1369. if (!data.getNodeCache(setting, node.tId)) {
  1370. return;
  1371. }
  1372.  
  1373. $$(node, setting).remove();
  1374. data.removeNodeCache(setting, node);
  1375. data.removeSelectedNode(setting, node);
  1376.  
  1377. for (var i = 0, l = parentNode[childKey].length; i < l; i++) {
  1378. if (parentNode[childKey][i].tId == node.tId) {
  1379. parentNode[childKey].splice(i, 1);
  1380. break;
  1381. }
  1382. }
  1383. view.setFirstNode(setting, parentNode);
  1384. view.setLastNode(setting, parentNode);
  1385.  
  1386. var tmp_ulObj,tmp_switchObj,tmp_icoObj,
  1387. childLength = parentNode[childKey].length;
  1388.  
  1389. //repair nodes old parent
  1390. if (!setting.data.keep.parent && childLength == 0) {
  1391. //old parentNode has no child nodes
  1392. parentNode.isParent = false;
  1393. parentNode.open = false;
  1394. tmp_ulObj = $$(parentNode, consts.id.UL, setting);
  1395. tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting);
  1396. tmp_icoObj = $$(parentNode, consts.id.ICON, setting);
  1397. view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU);
  1398. view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU);
  1399. tmp_ulObj.css("display", "none");
  1400.  
  1401. } else if (setting.view.showLine && childLength > 0) {
  1402. //old parentNode has child nodes
  1403. var newLast = parentNode[childKey][childLength - 1];
  1404. tmp_ulObj = $$(newLast, consts.id.UL, setting);
  1405. tmp_switchObj = $$(newLast, consts.id.SWITCH, setting);
  1406. tmp_icoObj = $$(newLast, consts.id.ICON, setting);
  1407. if (parentNode == root) {
  1408. if (parentNode[childKey].length == 1) {
  1409. //node was root, and ztree has only one root after move node
  1410. view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT);
  1411. } else {
  1412. var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting);
  1413. view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS);
  1414. view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
  1415. }
  1416. } else {
  1417. view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
  1418. }
  1419. tmp_ulObj.removeClass(consts.line.LINE);
  1420. }
  1421. },
  1422. replaceIcoClass: function(node, obj, newName) {
  1423. if (!obj || node.isAjaxing) return;
  1424. var tmpName = obj.attr("class");
  1425. if (tmpName == undefined) return;
  1426. var tmpList = tmpName.split("_");
  1427. switch (newName) {
  1428. case consts.folder.OPEN:
  1429. case consts.folder.CLOSE:
  1430. case consts.folder.DOCU:
  1431. tmpList[tmpList.length-1] = newName;
  1432. break;
  1433. }
  1434. obj.attr("class", tmpList.join("_"));
  1435. },
  1436. replaceSwitchClass: function(node, obj, newName) {
  1437. if (!obj) return;
  1438. var tmpName = obj.attr("class");
  1439. if (tmpName == undefined) return;
  1440. var tmpList = tmpName.split("_");
  1441. switch (newName) {
  1442. case consts.line.ROOT:
  1443. case consts.line.ROOTS:
  1444. case consts.line.CENTER:
  1445. case consts.line.BOTTOM:
  1446. case consts.line.NOLINE:
  1447. tmpList[0] = view.makeNodeLineClassEx(node) + newName;
  1448. break;
  1449. case consts.folder.OPEN:
  1450. case consts.folder.CLOSE:
  1451. case consts.folder.DOCU:
  1452. tmpList[1] = newName;
  1453. break;
  1454. }
  1455. obj.attr("class", tmpList.join("_"));
  1456. if (newName !== consts.folder.DOCU) {
  1457. obj.removeAttr("disabled");
  1458. } else {
  1459. obj.attr("disabled", "disabled");
  1460. }
  1461. },
  1462. selectNode: function(setting, node, addFlag) {
  1463. if (!addFlag) {
  1464. view.cancelPreSelectedNode(setting, null, node);
  1465. }
  1466. $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
  1467. data.addSelectedNode(setting, node);
  1468. setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]);
  1469. },
  1470. setNodeFontCss: function(setting, treeNode) {
  1471. var aObj = $$(treeNode, consts.id.A, setting),
  1472. fontCss = view.makeNodeFontCss(setting, treeNode);
  1473. if (fontCss) {
  1474. aObj.css(fontCss);
  1475. }
  1476. },
  1477. setNodeLineIcos: function(setting, node) {
  1478. if (!node) return;
  1479. var switchObj = $$(node, consts.id.SWITCH, setting),
  1480. ulObj = $$(node, consts.id.UL, setting),
  1481. icoObj = $$(node, consts.id.ICON, setting),
  1482. ulLine = view.makeUlLineClass(setting, node);
  1483. if (ulLine.length==0) {
  1484. ulObj.removeClass(consts.line.LINE);
  1485. } else {
  1486. ulObj.addClass(ulLine);
  1487. }
  1488. switchObj.attr("class", view.makeNodeLineClass(setting, node));
  1489. if (node.isParent) {
  1490. switchObj.removeAttr("disabled");
  1491. } else {
  1492. switchObj.attr("disabled", "disabled");
  1493. }
  1494. icoObj.removeAttr("style");
  1495. icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
  1496. icoObj.attr("class", view.makeNodeIcoClass(setting, node));
  1497. },
  1498. setNodeName: function(setting, node) {
  1499. var title = data.getNodeTitle(setting, node),
  1500. nObj = $$(node, consts.id.SPAN, setting);
  1501. nObj.empty();
  1502. if (setting.view.nameIsHTML) {
  1503. nObj.html(data.getNodeName(setting, node));
  1504. } else {
  1505. nObj.text(data.getNodeName(setting, node));
  1506. }
  1507. if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) {
  1508. var aObj = $$(node, consts.id.A, setting);
  1509. aObj.attr("title", !title ? "" : title);
  1510. }
  1511. },
  1512. setNodeTarget: function(setting, node) {
  1513. var aObj = $$(node, consts.id.A, setting);
  1514. aObj.attr("target", view.makeNodeTarget(node));
  1515. },
  1516. setNodeUrl: function(setting, node) {
  1517. var aObj = $$(node, consts.id.A, setting),
  1518. url = view.makeNodeUrl(setting, node);
  1519. if (url == null || url.length == 0) {
  1520. aObj.removeAttr("href");
  1521. } else {
  1522. aObj.attr("href", url);
  1523. }
  1524. },
  1525. switchNode: function(setting, node) {
  1526. if (node.open || !tools.canAsync(setting, node)) {
  1527. view.expandCollapseNode(setting, node, !node.open);
  1528. } else if (setting.async.enable) {
  1529. if (!view.asyncNode(setting, node)) {
  1530. view.expandCollapseNode(setting, node, !node.open);
  1531. return;
  1532. }
  1533. } else if (node) {
  1534. view.expandCollapseNode(setting, node, !node.open);
  1535. }
  1536. }
  1537. };
  1538. // zTree defind
  1539. $.fn.zTree = {
  1540. consts : _consts,
  1541. _z : {
  1542. tools: tools,
  1543. view: view,
  1544. event: event,
  1545. data: data
  1546. },
  1547. getZTreeObj: function(treeId) {
  1548. var o = data.getZTreeTools(treeId);
  1549. return o ? o : null;
  1550. },
  1551. destroy: function(treeId) {
  1552. if (!!treeId && treeId.length > 0) {
  1553. view.destroy(data.getSetting(treeId));
  1554. } else {
  1555. for(var s in settings) {
  1556. view.destroy(settings[s]);
  1557. }
  1558. }
  1559. },
  1560. init: function(obj, zSetting, zNodes) {
  1561. var setting = tools.clone(_setting);
  1562. $.extend(true, setting, zSetting);
  1563. setting.treeId = obj.attr("id");
  1564. setting.treeObj = obj;
  1565. setting.treeObj.empty();
  1566. settings[setting.treeId] = setting;
  1567. //For some older browser,(e.g., ie6)
  1568. if(typeof document.body.style.maxHeight === "undefined") {
  1569. setting.view.expandSpeed = "";
  1570. }
  1571. data.initRoot(setting);
  1572. var root = data.getRoot(setting),
  1573. childKey = setting.data.key.children;
  1574. zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : [];
  1575. if (setting.data.simpleData.enable) {
  1576. root[childKey] = data.transformTozTreeFormat(setting, zNodes);
  1577. } else {
  1578. root[childKey] = zNodes;
  1579. }
  1580.  
  1581. data.initCache(setting);
  1582. event.unbindTree(setting);
  1583. event.bindTree(setting);
  1584. event.unbindEvent(setting);
  1585. event.bindEvent(setting);
  1586.  
  1587. var zTreeTools = {
  1588. setting : setting,
  1589. addNodes : function(parentNode, index, newNodes, isSilent) {
  1590. if (!parentNode) parentNode = null;
  1591. if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null;
  1592.  
  1593. var i = parseInt(index, 10);
  1594. if (isNaN(i)) {
  1595. isSilent = !!newNodes;
  1596. newNodes = index;
  1597. index = -1;
  1598. } else {
  1599. index = i;
  1600. }
  1601. if (!newNodes) return null;
  1602.  
  1603. var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]);
  1604. function addCallback() {
  1605. view.addNodes(setting, parentNode, index, xNewNodes, (isSilent==true));
  1606. }
  1607.  
  1608. if (tools.canAsync(setting, parentNode)) {
  1609. view.asyncNode(setting, parentNode, isSilent, addCallback);
  1610. } else {
  1611. addCallback();
  1612. }
  1613. return xNewNodes;
  1614. },
  1615. cancelSelectedNode : function(node) {
  1616. view.cancelPreSelectedNode(setting, node);
  1617. },
  1618. destroy : function() {
  1619. view.destroy(setting);
  1620. },
  1621. expandAll : function(expandFlag) {
  1622. expandFlag = !!expandFlag;
  1623. view.expandCollapseSonNode(setting, null, expandFlag, true);
  1624. return expandFlag;
  1625. },
  1626. expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) {
  1627. if (!node || !node.isParent) return null;
  1628. if (expandFlag !== true && expandFlag !== false) {
  1629. expandFlag = !node.open;
  1630. }
  1631. callbackFlag = !!callbackFlag;
  1632.  
  1633. if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) {
  1634. return null;
  1635. } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) {
  1636. return null;
  1637. }
  1638. if (expandFlag && node.parentTId) {
  1639. view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false);
  1640. }
  1641. if (expandFlag === node.open && !sonSign) {
  1642. return null;
  1643. }
  1644.  
  1645. data.getRoot(setting).expandTriggerFlag = callbackFlag;
  1646. if (!tools.canAsync(setting, node) && sonSign) {
  1647. view.expandCollapseSonNode(setting, node, expandFlag, true, function() {
  1648. if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
  1649. });
  1650. } else {
  1651. node.open = !expandFlag;
  1652. view.switchNode(this.setting, node);
  1653. if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
  1654. }
  1655. return expandFlag;
  1656. },
  1657. getNodes : function() {
  1658. return data.getNodes(setting);
  1659. },
  1660. getNodeByParam : function(key, value, parentNode) {
  1661. if (!key) return null;
  1662. return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1663. },
  1664. getNodeByTId : function(tId) {
  1665. return data.getNodeCache(setting, tId);
  1666. },
  1667. getNodesByParam : function(key, value, parentNode) {
  1668. if (!key) return null;
  1669. return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1670. },
  1671. getNodesByParamFuzzy : function(key, value, parentNode) {
  1672. if (!key) return null;
  1673. return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1674. },
  1675. getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) {
  1676. isSingle = !!isSingle;
  1677. if (!filter || (typeof filter != "function")) return (isSingle ? null : []);
  1678. return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam);
  1679. },
  1680. getNodeIndex : function(node) {
  1681. if (!node) return null;
  1682. var childKey = setting.data.key.children,
  1683. parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
  1684. for (var i=0, l = parentNode[childKey].length; i < l; i++) {
  1685. if (parentNode[childKey][i] == node) return i;
  1686. }
  1687. return -1;
  1688. },
  1689. getSelectedNodes : function() {
  1690. var r = [], list = data.getRoot(setting).curSelectedList;
  1691. for (var i=0, l=list.length; i<l; i++) {
  1692. r.push(list[i]);
  1693. }
  1694. return r;
  1695. },
  1696. isSelectedNode : function(node) {
  1697. return data.isSelectedNode(setting, node);
  1698. },
  1699. reAsyncChildNodes : function(parentNode, reloadType, isSilent) {
  1700. if (!this.setting.async.enable) return;
  1701. var isRoot = !parentNode;
  1702. if (isRoot) {
  1703. parentNode = data.getRoot(setting);
  1704. }
  1705. if (reloadType=="refresh") {
  1706. var childKey = this.setting.data.key.children;
  1707. for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) {
  1708. data.removeNodeCache(setting, parentNode[childKey][i]);
  1709. }
  1710. data.removeSelectedNode(setting);
  1711. parentNode[childKey] = [];
  1712. if (isRoot) {
  1713. this.setting.treeObj.empty();
  1714. } else {
  1715. var ulObj = $$(parentNode, consts.id.UL, setting);
  1716. ulObj.empty();
  1717. }
  1718. }
  1719. view.asyncNode(this.setting, isRoot? null:parentNode, !!isSilent);
  1720. },
  1721. refresh : function() {
  1722. this.setting.treeObj.empty();
  1723. var root = data.getRoot(setting),
  1724. nodes = root[setting.data.key.children]
  1725. data.initRoot(setting);
  1726. root[setting.data.key.children] = nodes
  1727. data.initCache(setting);
  1728. view.createNodes(setting, 0, root[setting.data.key.children], null, -1);
  1729. },
  1730. removeChildNodes : function(node) {
  1731. if (!node) return null;
  1732. var childKey = setting.data.key.children,
  1733. nodes = node[childKey];
  1734. view.removeChildNodes(setting, node);
  1735. return nodes ? nodes : null;
  1736. },
  1737. removeNode : function(node, callbackFlag) {
  1738. if (!node) return;
  1739. callbackFlag = !!callbackFlag;
  1740. if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return;
  1741. view.removeNode(setting, node);
  1742. if (callbackFlag) {
  1743. this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
  1744. }
  1745. },
  1746. selectNode : function(node, addFlag) {
  1747. if (!node) return;
  1748. if (tools.uCanDo(setting)) {
  1749. addFlag = setting.view.selectedMulti && addFlag;
  1750. if (node.parentTId) {
  1751. view.expandCollapseParentNode(setting, node.getParentNode(), true, false, function() {
  1752. try{$$(node, setting).focus().blur();}catch(e){}
  1753. });
  1754. } else {
  1755. try{$$(node, setting).focus().blur();}catch(e){}
  1756. }
  1757. view.selectNode(setting, node, addFlag);
  1758. }
  1759. },
  1760. transformTozTreeNodes : function(simpleNodes) {
  1761. return data.transformTozTreeFormat(setting, simpleNodes);
  1762. },
  1763. transformToArray : function(nodes) {
  1764. return data.transformToArrayFormat(setting, nodes);
  1765. },
  1766. updateNode : function(node, checkTypeFlag) {
  1767. if (!node) return;
  1768. var nObj = $$(node, setting);
  1769. if (nObj.get(0) && tools.uCanDo(setting)) {
  1770. view.setNodeName(setting, node);
  1771. view.setNodeTarget(setting, node);
  1772. view.setNodeUrl(setting, node);
  1773. view.setNodeLineIcos(setting, node);
  1774. view.setNodeFontCss(setting, node);
  1775. }
  1776. }
  1777. }
  1778. root.treeTools = zTreeTools;
  1779. data.setZTreeTools(setting, zTreeTools);
  1780.  
  1781. if (root[childKey] && root[childKey].length > 0) {
  1782. view.createNodes(setting, 0, root[childKey], null, -1);
  1783. } else if (setting.async.enable && setting.async.url && setting.async.url !== '') {
  1784. view.asyncNode(setting);
  1785. }
  1786. return zTreeTools;
  1787. }
  1788. };
  1789.  
  1790. var zt = $.fn.zTree,
  1791. $$ = tools.$,
  1792. consts = zt.consts;
  1793. })(jQuery);

jquery.ztree.excheck-3.5.js

/*
* JQuery zTree excheck v3.5.19.1
* http://zTree.me/
*
* Copyright (c) 2010 Hunter.z
*
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
* email: hunter.z@263.net
* Date: 2015-10-26
*/
(function($){
//default consts of excheck
var _consts = {
event: {
CHECK: "ztree_check"
},
id: {
CHECK: "_check"
},
checkbox: {
STYLE: "checkbox",
DEFAULT: "chk",
DISABLED: "disable",
FALSE: "false",
TRUE: "true",
FULL: "full",
PART: "part",
FOCUS: "focus"
},
radio: {
STYLE: "radio",
TYPE_ALL: "all",
TYPE_LEVEL: "level"
}
},
//default setting of excheck
_setting = {
check: {
enable: false,
autoCheckTrigger: false,
chkStyle: _consts.checkbox.STYLE,
nocheckInherit: false,
chkDisabledInherit: false,
radioType: _consts.radio.TYPE_LEVEL,
chkboxType: {
"Y": "ps",
"N": "ps"
}
},
data: {
key: {
checked: "checked"
}
},
callback: {
beforeCheck:null,
onCheck:null
}
},
//default root of excheck
_initRoot = function (setting) {
var r = data.getRoot(setting);
r.radioCheckedList = [];
},
//default cache of excheck
_initCache = function(treeId) {},
//default bind event of excheck
_bindEvent = function(setting) {
var o = setting.treeObj,
c = consts.event;
o.bind(c.CHECK, function (event, srcEvent, treeId, node) {
event.srcEvent = srcEvent;
tools.apply(setting.callback.onCheck, [event, treeId, node]);
});
},
_unbindEvent = function(setting) {
var o = setting.treeObj,
c = consts.event;
o.unbind(c.CHECK);
},
//default event proxy of excheck
_eventProxy = function(e) {
var target = e.target,
setting = data.getSetting(e.data.treeId),
tId = "", node = null,
nodeEventType = "", treeEventType = "",
nodeEventCallback = null, treeEventCallback = null; if (tools.eqs(e.type, "mouseover")) {
if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
tId = tools.getNodeMainDom(target).id;
nodeEventType = "mouseoverCheck";
}
} else if (tools.eqs(e.type, "mouseout")) {
if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
tId = tools.getNodeMainDom(target).id;
nodeEventType = "mouseoutCheck";
}
} else if (tools.eqs(e.type, "click")) {
if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) {
tId = tools.getNodeMainDom(target).id;
nodeEventType = "checkNode";
}
}
if (tId.length>0) {
node = data.getNodeCache(setting, tId);
switch (nodeEventType) {
case "checkNode" :
nodeEventCallback = _handler.onCheckNode;
break;
case "mouseoverCheck" :
nodeEventCallback = _handler.onMouseoverCheck;
break;
case "mouseoutCheck" :
nodeEventCallback = _handler.onMouseoutCheck;
break;
}
}
var proxyResult = {
stop: nodeEventType === "checkNode",
node: node,
nodeEventType: nodeEventType,
nodeEventCallback: nodeEventCallback,
treeEventType: treeEventType,
treeEventCallback: treeEventCallback
};
return proxyResult
},
//default init node of excheck
_initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
if (!n) return;
var checkedKey = setting.data.key.checked;
if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true");
n[checkedKey] = !!n[checkedKey];
n.checkedOld = n[checkedKey];
if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true");
n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck);
if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true");
n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled);
if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true");
n.halfCheck = !!n.halfCheck;
n.check_Child_State = -1;
n.check_Focus = false;
n.getCheckStatus = function() {return data.getCheckStatus(setting, n);}; if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) {
var r = data.getRoot(setting);
r.radioCheckedList.push(n);
}
},
//add dom for check
_beforeA = function(setting, node, html) {
var checkedKey = setting.data.key.checked;
if (setting.check.enable) {
data.makeChkFlag(setting, node);
html.push("<span ID='", node.tId, consts.id.CHECK, "' class='", view.makeChkClass(setting, node), "' treeNode", consts.id.CHECK, (node.nocheck === true?" style='display:none;'":""),"></span>");
}
},
//update zTreeObj, add method of check
_zTreeTools = function(setting, zTreeTools) {
zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
var checkedKey = this.setting.data.key.checked;
if (node.chkDisabled === true) return;
if (checked !== true && checked !== false) {
checked = !node[checkedKey];
}
callbackFlag = !!callbackFlag; if (node[checkedKey] === checked && !checkTypeFlag) {
return;
} else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) {
return;
}
if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) {
node[checkedKey] = checked;
var checkObj = $$(node, consts.id.CHECK, this.setting);
if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
view.setChkClass(this.setting, checkObj, node);
view.repairParentChkClassWithSelf(this.setting, node);
if (callbackFlag) {
this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]);
}
}
} zTreeTools.checkAllNodes = function(checked) {
view.repairAllChk(this.setting, !!checked);
} zTreeTools.getCheckedNodes = function(checked) {
var childKey = this.setting.data.key.children;
checked = (checked !== false);
return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked);
} zTreeTools.getChangeCheckedNodes = function() {
var childKey = this.setting.data.key.children;
return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]);
} zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) {
disabled = !!disabled;
inheritParent = !!inheritParent;
inheritChildren = !!inheritChildren;
view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren);
view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent);
} var _updateNode = zTreeTools.updateNode;
zTreeTools.updateNode = function(node, checkTypeFlag) {
if (_updateNode) _updateNode.apply(zTreeTools, arguments);
if (!node || !this.setting.check.enable) return;
var nObj = $$(node, this.setting);
if (nObj.get(0) && tools.uCanDo(this.setting)) {
var checkObj = $$(node, consts.id.CHECK, this.setting);
if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node);
view.setChkClass(this.setting, checkObj, node);
view.repairParentChkClassWithSelf(this.setting, node);
}
}
},
//method of operate data
_data = {
getRadioCheckedList: function(setting) {
var checkedList = data.getRoot(setting).radioCheckedList;
for (var i=0, j=checkedList.length; i<j; i++) {
if(!data.getNodeCache(setting, checkedList[i].tId)) {
checkedList.splice(i, 1);
i--; j--;
}
}
return checkedList;
},
getCheckStatus: function(setting, node) {
if (!setting.check.enable || node.nocheck || node.chkDisabled) return null;
var checkedKey = setting.data.key.checked,
r = {
checked: node[checkedKey],
half: node.halfCheck ? node.halfCheck : (setting.check.chkStyle == consts.radio.STYLE ? (node.check_Child_State === 2) : (node[checkedKey] ? (node.check_Child_State > -1 && node.check_Child_State < 2) : (node.check_Child_State > 0)))
};
return r;
},
getTreeCheckedNodes: function(setting, nodes, checked, results) {
if (!nodes) return [];
var childKey = setting.data.key.children,
checkedKey = setting.data.key.checked,
onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL);
results = !results ? [] : results;
for (var i = 0, l = nodes.length; i < l; i++) {
if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) {
results.push(nodes[i]);
if(onlyOne) {
break;
}
}
data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results);
if(onlyOne && results.length > 0) {
break;
}
}
return results;
},
getTreeChangeCheckedNodes: function(setting, nodes, results) {
if (!nodes) return [];
var childKey = setting.data.key.children,
checkedKey = setting.data.key.checked;
results = !results ? [] : results;
for (var i = 0, l = nodes.length; i < l; i++) {
if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) {
results.push(nodes[i]);
}
data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results);
}
return results;
},
makeChkFlag: function(setting, node) {
if (!node) return;
var childKey = setting.data.key.children,
checkedKey = setting.data.key.checked,
chkFlag = -1;
if (node[childKey]) {
for (var i = 0, l = node[childKey].length; i < l; i++) {
var cNode = node[childKey][i];
var tmp = -1;
if (setting.check.chkStyle == consts.radio.STYLE) {
if (cNode.nocheck === true || cNode.chkDisabled === true) {
tmp = cNode.check_Child_State;
} else if (cNode.halfCheck === true) {
tmp = 2;
} else if (cNode[checkedKey]) {
tmp = 2;
} else {
tmp = cNode.check_Child_State > 0 ? 2:0;
}
if (tmp == 2) {
chkFlag = 2; break;
} else if (tmp == 0){
chkFlag = 0;
}
} else if (setting.check.chkStyle == consts.checkbox.STYLE) {
if (cNode.nocheck === true || cNode.chkDisabled === true) {
tmp = cNode.check_Child_State;
} else if (cNode.halfCheck === true) {
tmp = 1;
} else if (cNode[checkedKey] ) {
tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1;
} else {
tmp = (cNode.check_Child_State > 0) ? 1 : 0;
}
if (tmp === 1) {
chkFlag = 1; break;
} else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) {
chkFlag = 1; break;
} else if (chkFlag === 2 && tmp > -1 && tmp < 2) {
chkFlag = 1; break;
} else if (tmp > -1) {
chkFlag = tmp;
}
}
}
}
node.check_Child_State = chkFlag;
}
},
//method of event proxy
_event = { },
//method of event handler
_handler = {
onCheckNode: function (event, node) {
if (node.chkDisabled === true) return false;
var setting = data.getSetting(event.data.treeId),
checkedKey = setting.data.key.checked;
if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true;
node[checkedKey] = !node[checkedKey];
view.checkNodeRelation(setting, node);
var checkObj = $$(node, consts.id.CHECK, setting);
view.setChkClass(setting, checkObj, node);
view.repairParentChkClassWithSelf(setting, node);
setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]);
return true;
},
onMouseoverCheck: function(event, node) {
if (node.chkDisabled === true) return false;
var setting = data.getSetting(event.data.treeId),
checkObj = $$(node, consts.id.CHECK, setting);
node.check_Focus = true;
view.setChkClass(setting, checkObj, node);
return true;
},
onMouseoutCheck: function(event, node) {
if (node.chkDisabled === true) return false;
var setting = data.getSetting(event.data.treeId),
checkObj = $$(node, consts.id.CHECK, setting);
node.check_Focus = false;
view.setChkClass(setting, checkObj, node);
return true;
}
},
//method of tools for zTree
_tools = { },
//method of operate ztree dom
_view = {
checkNodeRelation: function(setting, node) {
var pNode, i, l,
childKey = setting.data.key.children,
checkedKey = setting.data.key.checked,
r = consts.radio;
if (setting.check.chkStyle == r.STYLE) {
var checkedList = data.getRadioCheckedList(setting);
if (node[checkedKey]) {
if (setting.check.radioType == r.TYPE_ALL) {
for (i = checkedList.length-1; i >= 0; i--) {
pNode = checkedList[i];
if (pNode[checkedKey] && pNode != node) {
pNode[checkedKey] = false;
checkedList.splice(i, 1); view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
if (pNode.parentTId != node.parentTId) {
view.repairParentChkClassWithSelf(setting, pNode);
}
}
}
checkedList.push(node);
} else {
var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
for (i = 0, l = parentNode[childKey].length; i < l; i++) {
pNode = parentNode[childKey][i];
if (pNode[checkedKey] && pNode != node) {
pNode[checkedKey] = false;
view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode);
}
}
}
} else if (setting.check.radioType == r.TYPE_ALL) {
for (i = 0, l = checkedList.length; i < l; i++) {
if (node == checkedList[i]) {
checkedList.splice(i, 1);
break;
}
}
} } else {
if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) {
view.setSonNodeCheckBox(setting, node, true);
}
if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) {
view.setSonNodeCheckBox(setting, node, false);
}
if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) {
view.setParentNodeCheckBox(setting, node, true);
}
if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) {
view.setParentNodeCheckBox(setting, node, false);
}
}
},
makeChkClass: function(setting, node) {
var checkedKey = setting.data.key.checked,
c = consts.checkbox, r = consts.radio,
fullStyle = "";
if (node.chkDisabled === true) {
fullStyle = c.DISABLED;
} else if (node.halfCheck) {
fullStyle = c.PART;
} else if (setting.check.chkStyle == r.STYLE) {
fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART;
} else {
fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART);
}
var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle;
chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName;
return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName;
},
repairAllChk: function(setting, checked) {
if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) {
var checkedKey = setting.data.key.checked,
childKey = setting.data.key.children,
root = data.getRoot(setting);
for (var i = 0, l = root[childKey].length; i<l ; i++) {
var node = root[childKey][i];
if (node.nocheck !== true && node.chkDisabled !== true) {
node[checkedKey] = checked;
}
view.setSonNodeCheckBox(setting, node, checked);
}
}
},
repairChkClass: function(setting, node) {
if (!node) return;
data.makeChkFlag(setting, node);
if (node.nocheck !== true) {
var checkObj = $$(node, consts.id.CHECK, setting);
view.setChkClass(setting, checkObj, node);
}
},
repairParentChkClass: function(setting, node) {
if (!node || !node.parentTId) return;
var pNode = node.getParentNode();
view.repairChkClass(setting, pNode);
view.repairParentChkClass(setting, pNode);
},
repairParentChkClassWithSelf: function(setting, node) {
if (!node) return;
var childKey = setting.data.key.children;
if (node[childKey] && node[childKey].length > 0) {
view.repairParentChkClass(setting, node[childKey][0]);
} else {
view.repairParentChkClass(setting, node);
}
},
repairSonChkDisabled: function(setting, node, chkDisabled, inherit) {
if (!node) return;
var childKey = setting.data.key.children;
if (node.chkDisabled != chkDisabled) {
node.chkDisabled = chkDisabled;
}
view.repairChkClass(setting, node);
if (node[childKey] && inherit) {
for (var i = 0, l = node[childKey].length; i < l; i++) {
var sNode = node[childKey][i];
view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit);
}
}
},
repairParentChkDisabled: function(setting, node, chkDisabled, inherit) {
if (!node) return;
if (node.chkDisabled != chkDisabled && inherit) {
node.chkDisabled = chkDisabled;
}
view.repairChkClass(setting, node);
view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit);
},
setChkClass: function(setting, obj, node) {
if (!obj) return;
if (node.nocheck === true) {
obj.hide();
} else {
obj.show();
}
obj.attr('class', view.makeChkClass(setting, node));
},
setParentNodeCheckBox: function(setting, node, value, srcNode) {
var childKey = setting.data.key.children,
checkedKey = setting.data.key.checked,
checkObj = $$(node, consts.id.CHECK, setting);
if (!srcNode) srcNode = node;
data.makeChkFlag(setting, node);
if (node.nocheck !== true && node.chkDisabled !== true) {
node[checkedKey] = value;
view.setChkClass(setting, checkObj, node);
if (setting.check.autoCheckTrigger && node != srcNode) {
setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
}
}
if (node.parentTId) {
var pSign = true;
if (!value) {
var pNodes = node.getParentNode()[childKey];
for (var i = 0, l = pNodes.length; i < l; i++) {
if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey])
|| ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) {
pSign = false;
break;
}
}
}
if (pSign) {
view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode);
}
}
},
setSonNodeCheckBox: function(setting, node, value, srcNode) {
if (!node) return;
var childKey = setting.data.key.children,
checkedKey = setting.data.key.checked,
checkObj = $$(node, consts.id.CHECK, setting);
if (!srcNode) srcNode = node; var hasDisable = false;
if (node[childKey]) {
for (var i = 0, l = node[childKey].length; i < l && node.chkDisabled !== true; i++) {
var sNode = node[childKey][i];
view.setSonNodeCheckBox(setting, sNode, value, srcNode);
if (sNode.chkDisabled === true) hasDisable = true;
}
} if (node != data.getRoot(setting) && node.chkDisabled !== true) {
if (hasDisable && node.nocheck !== true) {
data.makeChkFlag(setting, node);
}
if (node.nocheck !== true && node.chkDisabled !== true) {
node[checkedKey] = value;
if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1;
} else {
node.check_Child_State = -1;
}
view.setChkClass(setting, checkObj, node);
if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) {
setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]);
}
} }
}, _z = {
tools: _tools,
view: _view,
event: _event,
data: _data
};
$.extend(true, $.fn.zTree.consts, _consts);
$.extend(true, $.fn.zTree._z, _z); var zt = $.fn.zTree,
tools = zt._z.tools,
consts = zt.consts,
view = zt._z.view,
data = zt._z.data,
event = zt._z.event,
$$ = tools.$; data.exSetting(_setting);
data.addInitBind(_bindEvent);
data.addInitUnBind(_unbindEvent);
data.addInitCache(_initCache);
data.addInitNode(_initNode);
data.addInitProxy(_eventProxy, true);
data.addInitRoot(_initRoot);
data.addBeforeA(_beforeA);
data.addZTreeTools(_zTreeTools); var _createNodes = view.createNodes;
view.createNodes = function(setting, level, nodes, parentNode, index) {
if (_createNodes) _createNodes.apply(view, arguments);
if (!nodes) return;
view.repairParentChkClassWithSelf(setting, parentNode);
}
var _removeNode = view.removeNode;
view.removeNode = function(setting, node) {
var parentNode = node.getParentNode();
if (_removeNode) _removeNode.apply(view, arguments);
if (!node || !parentNode) return;
view.repairChkClass(setting, parentNode);
view.repairParentChkClass(setting, parentNode);
} var _appendNodes = view.appendNodes;
view.appendNodes = function(setting, level, nodes, parentNode, index, initFlag, openFlag) {
var html = "";
if (_appendNodes) {
html = _appendNodes.apply(view, arguments);
}
if (parentNode) {
data.makeChkFlag(setting, parentNode);
}
return html;
}
})(jQuery);

zTree树的更多相关文章

  1. ztree树 叶子节点路径的集合

    1.Question Description: ztree树各个节点都带有路径,如“/根节点”,"/根节点/一级节点",“根节点/一级节点/二级节点‘; 现在想获取所选的最末级节点 ...

  2. MVC4加载zTree树小控件

    前言: 第一次学习使用MVC框架,找了个练手项目,加载zTree树小控件.下面我就一步步说明我这次练手的经历以记录.如果有什么错误,希望各位大神帮忙指正,谢谢. 第一步: 利用VS2010新建一个MV ...

  3. easyui&8Jquery ztree树插件

    7Jquery easyui前台UI框架 开发包: 7.1Layout页面布局 将课后资料中后台系统前台页面素材导入项目中 1.导入Jquery,easyui相关js,css文件 <link r ...

  4. 通用权限管理系统之权限菜单zTree树的展示及移动的处理方法

    在通用权限管理系统中,有很多数据结构是有父子关系的,如组织机构,部门,权限菜单等,在展示的时候,大多数是通过zTree树的形式展现的,如下: 权限菜单展示 这种数据后台输出比较容易处理,参考如下获取某 ...

  5. 转:zTree树控件实战篇:针对多个下拉加载zTree树应该如何做出合理的配置

    今天有一个zTree的朋友遇到一个非常棘手的问题,才研究zTree树控件两天就被上头催着看成果,很是苦恼.他面对的问题就是页面内多个地方需要下拉在其文本框下方加载zTree树,由于对zTree下拉加载 ...

  6. 转:zTree树控件扩展篇:巧用zTree控件实现文本框输入关键词自动模糊查找zTree树节点实现模糊匹配下拉选择效果

    是否可以借助于zTree实现文本框输入关键词自动模糊匹配zTree下拉树,然后选择下拉树内节点显示在文本框内且隐藏下拉树. 看到这个需求脑子里头大致已经想到了要如何实现这样一个需求,当时是限于时间问题 ...

  7. ztree树的模糊搜索功能

    在做机场项目的时候,业务为一个input框,点击的时候出现一个下拉树,这个下拉树是所有的设备,由于设备太多,加上分了区域,为了更好的用户体验,设计一个模糊搜索的功能,方便用户进行选择 具体实现过程如下 ...

  8. Ztree树增删改查菜单,遇到的问题总结

    一.引言 我今天做了一个Ztree树增删改查菜单的功能.其中遇到了很多坑爹的问题,和大家讲述一下. 二.代码展示 1.Ztree树前台代码 <%@ page language="jav ...

  9. JQuery Ztree 树插件配置与应用小结

    JQuery Ztree 树插件配置与应用小结 by:授客 QQ:1033553122 测试环境 Win7 jquery-3.2.1.min.js 下载地址: https://gitee.com/is ...

  10. ztree树默认根据ID默认选中该条数据

    functiongetZtree() { varsetting = { view: { expandSpeed: 100, selectedMulti: true, showLine: true, / ...

随机推荐

  1. APMServ5.2.6win10系统Apache、MySQL5.1启动失败解决办法

    今天想在本地测试网站源码能否正常运行,如果可以就转空间了,然而下载了APMServ之后发现系统Apache.MySQL5.1启动均失败,小白的人表示只能借助百度,用了一个小时的时间终于解决了,虽然坎坷 ...

  2. centos 监控进程,并自动重启

    编辑Crontab crontab -e 按i进行编辑 */ * * * * /root/monitor.sh # 每分钟运行一遍monitor.sh脚本 * * * /sbin/reboot # 每 ...

  3. Solr7.4.0的API(Solrj)操作

    一.SolrJ的概念 solr单机版服务搭建:https://www.cnblogs.com/frankdeng/p/9615253.html solr集群版服务搭建:https://www.cnbl ...

  4. Redux架构

    深入Redux架构   阅读目录 关于redux API 中间件与异步操作 异步操作的基本思路 React-Redux的用法 回到顶部 关于redux 之前写了一篇通过一个demo了解Redux,但对 ...

  5. 关于spark standalone模式下的executor问题

    1.spark standalone模式下,worker与executor是一一对应的. 2.如果想要多个worker,那么需要修改spark-env的SPARK_WORKER_INSTANCES为2 ...

  6. 【Java】 大话数据结构(14) 排序算法(1) (冒泡排序及其优化)

    本文根据<大话数据结构>一书,实现了Java版的冒泡排序. 更多:数据结构与算法合集 基本概念 基本思想:将相邻的元素两两比较,根据大小关系交换位置,直到完成排序. 对n个数组成的无序数列 ...

  7. js加入购物车抛物线动画

    天猫将商品加入购物车会有一个抛物线动画,告诉用户操作成功以及购物车的位置,业务中需要用到类似的效果,记录一下实现过程备忘,先上demo 一开始没有想到用抛物线函数去做,也已经忘记还有这么个函数了,想着 ...

  8. clob字段超过4000转String类型

    上次提到listagg()和wm_concat()方法合并过的字段类型为clob,要是字段长度超过4000,直接使用to_char()方法转会报错. 解决方法可以在java代码中使用流的方式转化成字符 ...

  9. 纠结好久的VM虚拟机MAC地址绑定问题

    VM虚拟机(centos)采用桥接的方式访问网络,搭建一个Online Judger 的 web服务端.本想让虚拟机的ip能够固定下来,因此在路由上采用MAC和IP绑定的方式解决. 结果:每次重启虚拟 ...

  10. 回忆Ajax ๑乛◡乛๑

    东西越多,记不完,也记不住,笔记是最好的记忆了. 回顾以前的ajax的写法,简单封装一个ajax. //data = { // url: "url", // method: &qu ...