ServiceTree.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div id="serviceTree" v-show="mapStore.layerShow">
  3. <div class="common-title">
  4. <span>图层</span>
  5. </div>
  6. <div class="tree-content scroll">
  7. <el-tree
  8. :data="treeData"
  9. @check="changeChange"
  10. ref="treeRef"
  11. show-checkbox
  12. >
  13. <template #default="{ node, data }">
  14. <span class="custom-tree-label">{{ node.label }}</span>
  15. <span v-if="node.isLeaf" class="custom-tree-gl-icon" @click="showLayerGL(data)">
  16. <OfficeBuilding />
  17. </span>
  18. <span v-if="node.isLeaf" class="custom-tree-detail-icon" @click="showDetailDialog(data)">
  19. <Document />
  20. </span>
  21. <span v-if="node.isLeaf" class="custom-tree-icon" @click="applyData(data)">
  22. <Edit />
  23. </span>
  24. </template>
  25. </el-tree>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import {onMounted, ref, watch} from "vue";
  31. import CommonTitle from "@/views/c-cpns/CommonTitle.vue";
  32. import {getServiceTree} from "@/service/http.js";
  33. import {AddSingleLayer, FeatureThreeDimension} from "@/unit/map/addLayer.js";
  34. import {useMapStore} from "@/store/mapStore.js";
  35. import {Edit,Document,OfficeBuilding} from "@element-plus/icons-vue";
  36. export default {
  37. name: "ServiceTree",
  38. components: {CommonTitle,Edit,Document,OfficeBuilding},
  39. setup(){
  40. const mapStore = useMapStore()
  41. let treeData = ref([]);
  42. const treeRef = ref(null);
  43. const showGL = ref(false);
  44. const GLLayer = ref('');
  45. function getTreeData(){
  46. getServiceTree({
  47. TYPE:"",
  48. labelId:"1318"
  49. }).then(res =>{
  50. let resData =res.data.data.Rows[0].children;
  51. treeData.value = resData;
  52. })
  53. }
  54. function applyData(data){
  55. window.open("https://cimweb.zjw.sh.cegn.cn:2007/space-application/#/main/resource-apply?name=" + data.label)
  56. }
  57. function showDetailDialog(data){
  58. mapStore.layerDetailObj = data;
  59. mapStore.layerDetailShow = true;
  60. }
  61. function showLayerGL(data){
  62. if(showGL&&data.ADDRESS == GLLayer.value){
  63. showGL.value = false;
  64. GLLayer.value = '';
  65. FeatureThreeDimension({
  66. url:data.ADDRESS,
  67. status:"hide"
  68. })
  69. return
  70. }
  71. GLLayer.value = data.ADDRESS;
  72. FeatureThreeDimension({
  73. url:data.ADDRESS,
  74. status:"show"
  75. });
  76. }
  77. function changeChange(){
  78. let nowChecked = treeRef.value.getCheckedNodes(true);
  79. //找到原来有现在没有的删除
  80. for(let i = 0; i < mapStore.currentLayerList.length; i++){
  81. if(nowChecked.findIndex(i2 =>i2.CODE === mapStore.currentLayerList[i].CODE) == -1){
  82. AddSingleLayer({
  83. type:mapStore.currentLayerList[i].TYPE,
  84. id:mapStore.currentLayerList[i].S_CODE,
  85. visible:false,
  86. url:mapStore.currentLayerList[i].ADDRESS,
  87. opacity:100,
  88. title:mapStore.currentLayerList[i].label,
  89. wkid:mapStore.currentLayerList[i].COORDINATE_SYSTEM,
  90. token:mapStore.currentLayerList[i].TOKEN
  91. })
  92. mapStore.currentLayerList.splice(i,1);
  93. i--;
  94. }
  95. }
  96. //找到原来没有,现在有的新增
  97. for(let i = 0; i < nowChecked.length; i++){
  98. if(mapStore.currentLayerList.findIndex(i2 =>i2.CODE === nowChecked[i].CODE) == -1){
  99. mapStore.currentLayerList.push(nowChecked[i]);
  100. AddSingleLayer({
  101. type:nowChecked[i].TYPE,
  102. id:nowChecked[i].S_CODE,
  103. visible:true,
  104. url:nowChecked[i].ADDRESS,
  105. opacity:100,
  106. title:nowChecked[i].label,
  107. wkid:nowChecked[i].COORDINATE_SYSTEM,
  108. token:nowChecked[i].TOKEN
  109. })
  110. }
  111. }
  112. }
  113. onMounted(()=>{
  114. getTreeData()
  115. })
  116. return {
  117. mapStore,
  118. treeData,
  119. changeChange,
  120. treeRef,
  121. applyData,
  122. showLayerGL,
  123. showDetailDialog
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped lang="scss">
  129. #serviceTree{
  130. :deep{
  131. .el-tree{
  132. background: transparent !important;
  133. }
  134. }
  135. .custom-tree-label{
  136. font-size: 16px;
  137. }
  138. .custom-tree-gl-icon{
  139. position: absolute;
  140. right: 70px;
  141. width: 16px;
  142. height: 16px;
  143. font-size: 10px;
  144. }
  145. .custom-tree-detail-icon{
  146. position: absolute;
  147. right: 40px;
  148. width: 16px;
  149. height: 16px;
  150. font-size: 10px;
  151. }
  152. .custom-tree-icon{
  153. position: absolute;
  154. right: 10px;
  155. width: 16px;
  156. height: 16px;
  157. font-size: 10px;
  158. }
  159. position: absolute;
  160. z-index: 2;
  161. left: 460px;
  162. top: 87px;
  163. width: 370px;
  164. height: 553px;
  165. background-color: rgba(0, 22, 52, 0.75);
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: center;
  169. align-items: center;
  170. .common-title{
  171. width: 100%;
  172. height: 37px;
  173. background: url("@/assets/imgs/tkxbt.png") no-repeat;
  174. background-size: 100% 100%;
  175. span {
  176. font-family: YouSheBiaoTiHei;
  177. font-weight: 400;
  178. font-size: 20px;
  179. color: #BBCDE6;
  180. opacity: 1;
  181. padding-left: 60px;
  182. background: linear-gradient(0deg, #ACE5FF 0%, #FFFFFF 100%);
  183. -webkit-background-clip: text;
  184. -webkit-text-fill-color: transparent;
  185. }
  186. }
  187. .tree-content{
  188. width: 100%;
  189. height: 500px;
  190. }
  191. }
  192. </style>