2987abd25e5fa1c709ea9346f1a4020d2bf95cfd.svn-base 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="tree" :style="{'height':height + 'px','width':width == 0 ? 250 : width + 'px'}">
  3. <el-tree
  4. class="el-treeWhite"
  5. :data="treeData"
  6. :props="treeProps"
  7. :expand-on-click-node="false"
  8. @node-click="nodeClick"
  9. node-key="objId"
  10. :default-expanded-keys="tableDefaultExpandedKeys"
  11. ></el-tree>
  12. </div>
  13. </template>
  14. <script>
  15. import {getNodeByPidAndCode} from "../../api/duChaAPI.js";
  16. import request from '../../utils/gw_ajax_request.js';
  17. import {dateFormat} from "../../utils/gw_date";
  18. import globalVariable from "@api/globalVariable.js";
  19. export default {
  20. components: {},
  21. props: ['height','width'],
  22. data() {
  23. return {
  24. treeData: [],
  25. tableDefaultExpandedKeys: [],
  26. treeProps: {
  27. label: "nm",
  28. children: "children",
  29. disabled: false,
  30. expandOnClickNode: false,
  31. first: true,
  32. },
  33. };
  34. },
  35. mounted: function () {
  36. this.getLeftTreeData();
  37. },
  38. computed: {
  39. userId: function () {
  40. return localStorage.getItem("userid")
  41. ? localStorage.getItem("userid")
  42. : "1098101939614724096";
  43. }
  44. },
  45. methods: {
  46. // 节点点击事件
  47. nodeClick: function (data) {
  48. this.$emit("provTreeSelectChange", {'objId':data.objId});
  49. },
  50. //根据用户id获取左侧树
  51. getLeftTreeData(){
  52. let paramObj = {
  53. presId: this.userId,
  54. pType: '4'
  55. }
  56. request.post('/dc/gd/base/getGcNode',paramObj).then((res)=>{
  57. this.treeData = res.data
  58. })
  59. }
  60. }
  61. };
  62. </script>
  63. <style scoped>
  64. .tree{
  65. overflow-y: auto;
  66. overflow-x: auto;
  67. }
  68. .el-tree {
  69. min-width: 100%;
  70. display:inline-block !important;
  71. }
  72. /*滚动条样式*/
  73. .tree::-webkit-scrollbar {
  74. width: 8px;
  75. height: 8px;
  76. }
  77. /*正常情况下滑块的样式*/
  78. .tree::-webkit-scrollbar-thumb {
  79. background-color: rgba(0, 0, 0, .05);
  80. border-radius: 10px;
  81. -webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
  82. }
  83. /*鼠标悬浮在该类指向的控件上时滑块的样式*/
  84. .tree:hover::-webkit-scrollbar-thumb {
  85. background-color: rgba(0, 0, 0, .2);
  86. border-radius: 10px;
  87. -webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
  88. }
  89. /*鼠标悬浮在滑块上时滑块的样式*/
  90. .tree::-webkit-scrollbar-thumb:hover {
  91. background-color: rgba(0, 0, 0, .4);
  92. -webkit-box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .1);
  93. }
  94. /*正常时候的主干部分*/
  95. .tree::-webkit-scrollbar-track {
  96. border-radius: 10px;
  97. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
  98. background-color: white;
  99. }
  100. /*鼠标悬浮在滚动条上的主干部分*/
  101. .tree::-webkit-scrollbar-track:hover {
  102. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .4);
  103. background-color: rgba(0, 0, 0, .01);
  104. }
  105. </style>