index.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. (() => {
  2. Vue.component('uploadPointclound', {
  3. props: [],
  4. name: 'uploadPointclound',
  5. template: `<div id="uploadBox" >
  6. <h4>添加数据集 </h4>
  7. <div class="selectBox">
  8. <el-select v-model="value" filterable @click.native="options = dataList" :filter-method="searchScene" placeholder="请选择">
  9. <el-option v-for="item in options" :key="item.id" :label="item.title" :value="item.id">
  10. <div class="sceneName">
  11. <p class="code">{{item.title}}</p>
  12. <span class="name">数据集:{{item.id}}</span>
  13. </div>
  14. </el-option>
  15. </el-select>
  16. </div>
  17. <div class="uploadBtn" @click="openUpload" :class="{disabled:value==''}">
  18. <i class="fa fa-plus ng-scope"></i>&nbsp;&nbsp;添加到场景
  19. </div>
  20. <p class="itemTitle">已添加的数据集 </p>
  21. <div class="listBox">
  22. <ul class="sceneList">
  23. <li class="sceneItem" v-for="i in 10">
  24. <div class="sceneName">
  25. <p class="code">t-iksBApb</p>
  26. <span class="name">来自场景:港2</span>
  27. </div>
  28. <div class="scene_control">
  29. <el-popconfirm placement="top" title="是否要删除该数据集?" :hide-icon="true" @confirm="delConfirm">
  30. <el-button class="delBtn" title="删除" slot="reference"></el-button>
  31. </el-popconfirm>
  32. <!-- <div class="delBtn" title="删除"></div> -->
  33. </div>
  34. </li>
  35. </ul>
  36. </div>
  37. </div>`,
  38. data() {
  39. return {
  40. dataList: [],
  41. options: [{
  42. id: 1,
  43. name: "港2",
  44. }, {
  45. id: 2,
  46. name: "港2",
  47. }, {
  48. id: 3,
  49. name: "港2",
  50. }, {
  51. id: 4,
  52. name: "港2",
  53. }, {
  54. id: 5,
  55. name: "港2",
  56. }, {
  57. id: 6,
  58. title: "港2",
  59. }],
  60. value: '',
  61. }
  62. },
  63. methods: {
  64. getSceneData() {
  65. let params = {
  66. "pageNum": 0,
  67. "pageSize": 12,
  68. "searchKey": "",
  69. "userId": 477
  70. }
  71. axios.post(`/indoor/scene/list`, params).then(res => {
  72. console.log(res)
  73. this.dataList = res.data.data.content
  74. this.options = res.data.data.content
  75. }).catch(err => {
  76. })
  77. },
  78. searchScene(e) {
  79. console.log(e)
  80. let res = this.dataList.filter(i => {
  81. if (i.id.indexOf(e) != -1 || i.title.indexOf(e) != -1) {
  82. return i
  83. }
  84. })
  85. console.log(res)
  86. this.options = res
  87. },
  88. openUpload() {
  89. //
  90. this.$parent.showLoading()
  91. axios.post(`/indoor/${sceneNum}/api/merge/${this.value}`).then(res => {
  92. this.$parent.hideLoading()
  93. this.value = ''
  94. if (res.data.code == 0) {
  95. this.$message({
  96. message: '数据集添加成功',
  97. type: 'success',
  98. duration: 2000,
  99. });
  100. IV.api.AuthenticationService.sendAuthenticationChanged()
  101. } else {
  102. this.$message({
  103. message: '数据集添加失败',
  104. type: 'error',
  105. duration: 2000,
  106. });
  107. }
  108. }).catch(err => {
  109. this.value = ''
  110. this.$parent.hideLoading()
  111. this.$message({
  112. message: '数据集添加失败',
  113. type: 'error',
  114. duration: 2000,
  115. });
  116. })
  117. },
  118. delConfirm() {
  119. console.log(1)
  120. },
  121. },
  122. computed: {
  123. },
  124. destroyed() {
  125. },
  126. mounted() {
  127. // window.eventBus.off('openMap', openMap);
  128. // window.eventBus.on('openMap', openMap);
  129. // function openMap() {
  130. // IV.swapScenes()
  131. // }
  132. this.getSceneData()
  133. },
  134. })
  135. })();