graphyTabs.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <!--
  2. setFalg 插旗事件
  3. getLocation 定位
  4. -->
  5. <template>
  6. <div id="graphy-tabs">
  7. <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
  8. <el-tab-pane label="本层的点位标签" name="point">
  9. <div
  10. v-if="pointData.length"
  11. v-loading="isLoading"
  12. style="max-height: 800px;overflow-y:auto;"
  13. >
  14. <div v-for="(item,index) in pointData" :key="index">
  15. <div class="point">
  16. <span>{{item.Name}}</span>
  17. <el-button size="mini" @click="getDetails(item)">编辑点位标签</el-button>
  18. <el-button
  19. :disabled="!map"
  20. size="mini"
  21. @click="btnClick(item)"
  22. >{{ item.X == 0 && item.Y == 0 ? '插旗' : '定位'}}</el-button>
  23. </div>
  24. </div>
  25. </div>
  26. <template v-if="!pointData.length">
  27. <div class="saga-message">{{pointParam.FloorId ? "数据为空" : "←请选择楼层"}}</div>
  28. </template>
  29. </el-tab-pane>
  30. <el-tab-pane label="无法定位到楼层的点位标签" name="noPoint">
  31. <div v-if="pointNoData.length" v-loading="isLoading" style="max-height: 800px;">
  32. <div v-for="(item,index) in pointNoData" :key="index">
  33. <div class="point">
  34. <span>{{item.Name}}</span>
  35. <el-button size="mini" @click="getDetails(item)">编辑点位标签</el-button>
  36. <el-button
  37. :disabled="!(item.X == 0 && item.Y == 0)"
  38. size="mini"
  39. @click="btnClick(item)"
  40. >{{ item.X == 0 && item.Y == 0 ? '插旗' : '定位'}}</el-button>
  41. </div>
  42. </div>
  43. </div>
  44. <template v-if="!pointNoData.length">
  45. <div class="saga-message">{{pointParam.FloorId ? "数据为空" : "←请选择楼层"}}</div>
  46. </template>
  47. </el-tab-pane>
  48. </el-tabs>
  49. <el-dialog title="详情" :visible.sync="pointShow" width="40%">
  50. <div class="qrcode">
  51. <div class="qrcode-view">
  52. <img
  53. :src="'api/ScanBuilding/service/qrcode/point?projectId=' + projectId + '&pointId=' + pointDetails.PointId + '&FloorId=' + pointDetails.FloorId + '&width=200&height=200'"
  54. alt="点位标签二维码"
  55. >
  56. </div>
  57. <div class="point-edit">
  58. <p>
  59. 点位标签的现场位置:{{activeName2 != 'point' ? '无楼层' : pointParam.fllorName}}
  60. -{{pointDetails.spaceName || '未知原空间'}}
  61. -({{pointDetails.X}},{{pointDetails.Y}})
  62. </p>
  63. <div>
  64. <form-input
  65. :width="100"
  66. @change="changeInput"
  67. :value="pointDetails.PointName"
  68. :keys="'PointName'"
  69. :label="'点位标签:'"
  70. :isRule="false"
  71. ></form-input>
  72. <form-input
  73. :width="100"
  74. @change="changeInput"
  75. :value="pointDetails.PointLocalId"
  76. :keys="'PointLocalId'"
  77. :label="'点位本地编码:'"
  78. :isRule="false"
  79. ></form-input>
  80. <!-- <form-input></form-input> -->
  81. </div>
  82. </div>
  83. </div>
  84. <div class="point-coding">
  85. <p>编码及关系</p>
  86. <ul>
  87. <li>
  88. <span>点位标签ID</span>
  89. <span>{{pointDetails.PointId}}</span>
  90. </li>
  91. <li>
  92. <span>模型ID</span>
  93. <span>{{pointDetails.BimId || '暂无'}}</span>
  94. </li>
  95. </ul>
  96. </div>
  97. <div class="point-coding">
  98. <p>基本信息</p>
  99. <ul>
  100. <li>
  101. <span>信标类型</span>
  102. <span>二维码</span>
  103. </li>
  104. <li>
  105. <span>备注</span>
  106. <span>
  107. <form-input
  108. :width="0"
  109. @change="changeInput"
  110. :value="pointDetails.Note"
  111. :keys="'Note'"
  112. :label="''"
  113. :isRule="false"
  114. ></form-input>
  115. </span>
  116. </li>
  117. </ul>
  118. </div>
  119. <div class="point-pic">
  120. <p>点位安装位置效果照片</p>
  121. <template v-for="(item,index) in installPic">
  122. <div class="point-image" :key="index">
  123. <i class="el-icon-delete" @click="delImage(index,installPic)"></i>
  124. <img
  125. :src="'img/image-service/common/image_get?systemId=dataPlatform&key='+ item.key +'&width=200&height=200'"
  126. alt
  127. >
  128. </div>
  129. </template>
  130. <load-img keyName="安装位置" @getKey="getKey"></load-img>
  131. </div>
  132. <div class="point-pic">
  133. <p>全景照片</p>
  134. <template v-for="(item,index) in panorama">
  135. <div class="point-image" :key="index">
  136. <i class="el-icon-delete" @click="delImage(index,panorama)"></i>
  137. <img
  138. :src="'img/image-service/common/image_get?systemId=dataPlatform&key='+ item.key +'&width=200&height=200'"
  139. alt
  140. >
  141. </div>
  142. </template>
  143. <load-img keyName="全景照片" @getKey="getKey"></load-img>
  144. </div>
  145. <div class="point-pic">
  146. <p>周边照片</p>
  147. <template v-for="(item,index) in rimPic">
  148. <div class="point-image" :key="index">
  149. <i class="el-icon-delete" @click="delImage(index,rimPic)"></i>
  150. <img
  151. :src="'img/image-service/common/image_get?systemId=dataPlatform&key='+ item.key +'&width=200&height=200'"
  152. alt
  153. >
  154. </div>
  155. </template>
  156. <load-img keyName="周边照片" @getKey="getKey"></load-img>
  157. </div>
  158. <div class="point-pic">
  159. <p>视频资料</p>
  160. <template v-for="(item,index) in videoPic">
  161. <div class="point-image" :key="index">
  162. <i class="el-icon-delete" @click="delImage(index,videoPic)"></i>
  163. <img
  164. :src="'img/image-service/common/image_get?systemId=dataPlatform&key='+ item.key +'&width=200&height=200'"
  165. alt
  166. >
  167. </div>
  168. </template>
  169. <load-img keyName="视频" @getKey="getKey"></load-img>
  170. </div>
  171. <div class="point-pic">
  172. <p>其他照片</p>
  173. <template v-for="(item,index) in elsePic">
  174. <div class="point-image" :key="index">
  175. <i class="el-icon-delete" @click="delImage(index,elsePic)"></i>
  176. <img
  177. :src="'img/image-service/common/image_get?systemId=dataPlatform&key='+ item.key +'&width=200&height=200'"
  178. alt
  179. >
  180. </div>
  181. </template>
  182. <load-img keyName="其他照片" @getKey="getKey"></load-img>
  183. </div>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import {
  189. getPT, //获取点位列表
  190. getPoint, //获取点位详情
  191. updatePoint //修改点位
  192. } from "@/api/scan/request";
  193. import formInput from "./lib/formInput";
  194. import loadImg from "./lib/uploadImg";
  195. import {mapGetters, mapActions} from 'vuex';
  196. export default {
  197. props: {
  198. pointParam: {
  199. type: Object
  200. }
  201. },
  202. components: {
  203. formInput,
  204. loadImg
  205. },
  206. data() {
  207. return {
  208. activeName2: "point",
  209. pointData: [], //tab为本层的点位标签
  210. pointNoData: [], //tab为无法定位的点位标签
  211. pointShow: false, //标签详情的弹窗
  212. pointDetails: {}, //标签详情信息对象
  213. // projId: this.$route.query.projId,
  214. index: "",
  215. installPic: [], //安装位置
  216. panorama: [], //全景照片
  217. rimPic: [], //周边照片
  218. videoPic: [], //视频资料
  219. elsePic: [], //其他照片
  220. map: true
  221. };
  222. },
  223. computed: {
  224. ...mapGetters("peojMess", [
  225. "projectId",
  226. "userId",
  227. "secret"
  228. ])
  229. },
  230. methods: {
  231. //tabs被点击
  232. handleClick(tab, event) {
  233. this.index = tab.index;
  234. this.getPointList();
  235. },
  236. //修改input
  237. changeInput(val, key) {
  238. this.pointDetails[key] = val;
  239. this.updatePoint();
  240. },
  241. //删除图片
  242. delImage(index, arr) {
  243. arr.splice(index, 1);
  244. this.updatePoint();
  245. },
  246. //获取key的值
  247. getKey(val, name) {
  248. switch (name) {
  249. case "安装位置":
  250. this.installPic.push({
  251. key: val,
  252. name: name,
  253. type: "image_wz"
  254. });
  255. break;
  256. case "全景照片":
  257. this.panorama.push({
  258. key: val,
  259. name: name,
  260. type: "panorama"
  261. });
  262. break;
  263. case "周边照片":
  264. this.rimPic.push({
  265. key: val,
  266. name: name,
  267. type: "image_zb"
  268. });
  269. break;
  270. case "视频":
  271. this.videoPic.push({
  272. key: val,
  273. name: name,
  274. type: "video"
  275. });
  276. break;
  277. default:
  278. this.elsePic.push({
  279. key: val,
  280. name: name,
  281. type: "image_else"
  282. });
  283. }
  284. this.updatePoint();
  285. },
  286. btnClick(item) {
  287. if (item.X == 0 && item.Y == 0) {
  288. this.$emit("setFalg", item);
  289. } else {
  290. this.$emit("getLocation", item);
  291. }
  292. },
  293. mapPush(detailsArr, pic) {
  294. pic.map(item => {
  295. detailsArr.push(item);
  296. });
  297. },
  298. //修改详情
  299. updatePoint() {
  300. this.pointDetails.ImageList = [];
  301. this.mapPush(this.pointDetails.ImageList, this.installPic);
  302. this.mapPush(this.pointDetails.ImageList, this.panorama);
  303. this.mapPush(this.pointDetails.ImageList, this.rimPic);
  304. this.mapPush(this.pointDetails.ImageList, this.videoPic);
  305. this.mapPush(this.pointDetails.ImageList, this.elsePic);
  306. let param = {
  307. ProjId: this.pointParam.ProjId,
  308. UserId: this.pointParam.UserId,
  309. PointList: this.pointDetails
  310. };
  311. updatePoint(param).then(res => {
  312. this.$message.success("修改成功");
  313. });
  314. },
  315. getDetails(item) {
  316. let params = {
  317. ProjId: this.projectId,
  318. UserId: this.userId,
  319. PointId: item.Id
  320. };
  321. getPoint(params).then(res => {
  322. let data = res.data;
  323. if (data.Result == "success") {
  324. this.pointShow = true;
  325. this.pointDetails = data.PointList[0];
  326. this.getPic(data.PointList[0].ImageList);
  327. } else {
  328. this.$message.error("请求出错");
  329. }
  330. });
  331. },
  332. getPic(imgArr) {
  333. this.installPic = [];
  334. this.panorama = [];
  335. this.rimPic = [];
  336. this.videoPic = [];
  337. this.elsePic = [];
  338. imgArr.map((item, index) => {
  339. switch (item.name) {
  340. case "安装位置":
  341. this.installPic.push(item);
  342. break;
  343. case "全景照片":
  344. this.panorama.push(item);
  345. break;
  346. case "周边照片":
  347. this.rimPic.push(item);
  348. break;
  349. case "视频":
  350. this.videoPic.push(item);
  351. break;
  352. default:
  353. this.elsePic.push(item);
  354. }
  355. });
  356. },
  357. //获取point
  358. getPointList() {
  359. this.isLoading = true;
  360. if (this.pointParam.FloorId) {
  361. let param = {
  362. FloorId: this.pointParam.FloorId,
  363. ProjId: this.pointParam.ProjId,
  364. UserId: this.pointParam.UserId
  365. };
  366. console.log(param)
  367. //当index为1时FloorId为空
  368. if (this.index == "1") {
  369. param.FloorId = "";
  370. }
  371. getPT(param).then(res => {
  372. res.data.PointList.splice(0, 1);
  373. if (this.index == "1") {
  374. this.pointNoData = res.data.PointList;
  375. } else {
  376. this.$emit("getPointList", res.data.PointList);
  377. this.pointData = res.data.PointList;
  378. }
  379. this.isLoading = false;
  380. });
  381. }
  382. },
  383. //初始化
  384. reset(data, map) {
  385. this.map = map
  386. this.pointParam.FloorId = data.FloorId;
  387. this.pointParam.fllorName = data.fllorName;
  388. this.activeName2 = "point";
  389. this.getPointList();
  390. }
  391. },
  392. watch: {
  393. pointShow: {
  394. deep: true,
  395. handler: function (old, val) {
  396. if (old == false && val == true) {
  397. this.getPointList();
  398. }
  399. }
  400. }
  401. }
  402. };
  403. </script>
  404. <style lang="less" scoped>
  405. #graphy-tabs {
  406. .saga-message {
  407. height: 400px;
  408. line-height: 400px;
  409. color: #ccc;
  410. font-size: 24px;
  411. text-align: center;
  412. }
  413. .point {
  414. padding-left: 20px;
  415. height: 30px;
  416. span {
  417. font-size: 12px;
  418. width: 180px;
  419. display: inline-block;
  420. white-space: nowrap;
  421. text-overflow: ellipsis;
  422. overflow: hidden;
  423. }
  424. button {
  425. margin-bottom: 5px;
  426. }
  427. }
  428. .point:hover {
  429. background-color: #f2f6fc;
  430. }
  431. .qrcode {
  432. width: 100%;
  433. height: 180px;
  434. overflow: hidden;
  435. .qrcode-view {
  436. width: 180px;
  437. height: 180px;
  438. overflow: hidden;
  439. float: left;
  440. img {
  441. width: 100%;
  442. height: 100%;
  443. }
  444. }
  445. .point-edit {
  446. height: 180px;
  447. display: inline-block;
  448. padding-top: 10px;
  449. overflow-x: hidden;
  450. width: calc(100% - 200px);
  451. }
  452. }
  453. .point-coding {
  454. width: 100%;
  455. height: 120px;
  456. margin-top: 5px;
  457. overflow: hidden;
  458. p {
  459. height: 30px;
  460. line-height: 30px;
  461. padding-left: 10px;
  462. font-weight: 500;
  463. font-size: 16px;
  464. text-align: left;
  465. }
  466. ul {
  467. width: 100%;
  468. border: 1px solid #ccc;
  469. border-bottom: none;
  470. li {
  471. line-height: 40px;
  472. height: 40px;
  473. span {
  474. display: block;
  475. float: left;
  476. padding-left: 10px;
  477. box-sizing: border-box;
  478. border-right: 1px solid #ccc;
  479. border-bottom: 1px solid #ccc;
  480. border-left: 1px solid #ccc;
  481. height: 40px;
  482. overflow: hidden;
  483. }
  484. span:first-child {
  485. width: 30%;
  486. }
  487. span:last-child {
  488. width: 70%;
  489. }
  490. }
  491. }
  492. }
  493. .point-pic {
  494. width: 100%;
  495. overflow: hidden;
  496. p {
  497. height: 25px;
  498. line-height: 25px;
  499. padding-left: 10px;
  500. font-weight: 500;
  501. font-size: 16px;
  502. margin-top: 5px;
  503. margin-bottom: 5px;
  504. }
  505. }
  506. .point-image {
  507. width: 180px;
  508. height: 180px;
  509. float: left;
  510. position: relative;
  511. margin-right: 10px;
  512. margin-bottom: 10px;
  513. border: 1px solid #ccc;
  514. img {
  515. width: 100%;
  516. height: 100%;
  517. }
  518. i {
  519. position: absolute;
  520. bottom: 10px;
  521. right: 10px;
  522. background-color: #fff;
  523. padding: 5px;
  524. cursor: pointer;
  525. }
  526. }
  527. }
  528. </style>