supplement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <!-- 待补充页面 -->
  3. <div class="box" ref="boxBody">
  4. <div class="content-box" v-for="(item,index) in pageData" :key="index">
  5. <div class="content-top">
  6. <div class="details">
  7. <h4>{{ index |numTransformation(4) }}
  8. <el-badge value="待补充" class="item" type="success"></el-badge>
  9. </h4>
  10. <h4>
  11. {{ `${item.BuildingName}建筑模型` }}-{{
  12. `${item.FloorName}层`
  13. }}-{{ `${item.EquipLocalName ? item.EquipLocalName : item.EquipName}` }}</h4>
  14. <b>标记码:<span @dblclick="copyContent" id="copy">{{ item.EquipID }}</span></b><span class="copy"
  15. @click="clickCopy">点击复制</span>
  16. <input id="copyContent" type="text" @dblclick="copyContent"
  17. style="border:none;opacity:0;position:absolute;top:0;left:0;">
  18. <p style="margin-top:30px;">建议使用的Revit族:{{ item.Res }}</p>
  19. <p>设计图纸中编码:{{ item.CADID }}</p>
  20. <p><span>资产族:{{ item.FamilyName.Name }}</span></p>
  21. <p><span style="width:500px;">资产ID:{{ item.EquipID }}</span></p>
  22. <p>现场发现人:{{ item.FindPeople }}</p>
  23. </div>
  24. <div class="plan">
  25. <p>平面图上的位置:<span>{{ item.local | localTransformation }}</span></p>
  26. <div class="img-box">
  27. <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"
  28. :data-modelid="item.ModelId"
  29. :data-EquipID='item.EquipID' :data-x="item.local.X" :data-y="item.local.Y"></canvas>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="content-bottom">
  34. <div class="photo" v-for="(it,ind) in item.LedgerParam.PhotoDoc.Nameplate" :key="ind">
  35. <p>{{ it.name }}<span>拍摄时间:{{ it.createTime | timeTransformation }}</span></p>
  36. <div class="img-box">
  37. <div class="img-content">
  38. <img :src="`/image-service/common/image_get?systemId=dataPlatform&key=${it.key}`" alt="铭牌图片">
  39. </div>
  40. </div>
  41. </div>
  42. <div class="photo" v-for="(photo,num) in item.LedgerParam.PhotoDoc.Pic" :key="num+photo">
  43. <div class="img-box" v-if="item.LedgerParam.PhotoDoc.Pic">
  44. <p v-if="item.LedgerParam.PhotoDoc.Pic && photo.type !== 'video'">
  45. {{ photo.name }}<span>拍摄时间:{{ photo.createTime | timeTransformation }}</span>
  46. </p>
  47. <div class="img-content" v-if="photo.type !=='video'">
  48. <img :src="`/image-service/common/image_get?systemId=dataPlatform&key=${photo.key}`" alt="现场图片">
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import { mapGetters } from "vuex";
  58. import { toBeSupplementEquip } from "@/api/scan/request.js";
  59. import { LocationPointScene, FloorView } from "@saga-web/cad-engine/lib";
  60. export default {
  61. components: {},
  62. data() {
  63. return {
  64. pageData: [],
  65. equipComDelList: null,
  66. canvasWidth: 400,
  67. canvasHeight: 280,
  68. scene: '',
  69. view: '',
  70. i: 0,
  71. page: {
  72. pageSize: 20,
  73. pageNumber: 1,
  74. total: 0
  75. }
  76. }
  77. },
  78. filters: {
  79. numTransformation(num, length) {// 序列号转换为4位
  80. num = Number(num + 1)
  81. return (Array(length).join('0') + num).slice(-length);
  82. },
  83. localTransformation(local) {// 坐标转换
  84. let str = "";
  85. for (let key in local) {
  86. if (key !== "Z") {
  87. str += key + ':' + local[key] + ',';
  88. } else {
  89. str += key + ':' + local[key];
  90. }
  91. }
  92. return str;
  93. },
  94. timeTransformation(time) {// 时间转换
  95. return time ? time.substring(0, 16) : ''
  96. }
  97. },
  98. mounted() {
  99. this.getToBeSuppement();
  100. this.boxBody = this.$refs.boxBody;
  101. this.boxBody.addEventListener('scroll', () => {
  102. let clientHeight = this.boxBody.clientHeight;
  103. let scrollTop = this.boxBody.scrollTop;
  104. let scrollHeight = this.boxBody.scrollHeight;
  105. if (clientHeight + scrollTop === scrollHeight) {
  106. console.log(this.page.pageNumber * this.page.pageSize)
  107. if (this.page.pageNumber * this.page.pageSize < this.page.total) {
  108. this.page.pageNumber++;
  109. if (this.pageData.length < 20) {
  110. this.page.pageNumber = 1
  111. }
  112. this.queryToBelDelEquip();
  113. }
  114. }
  115. })
  116. },
  117. created() {
  118. this.equipComDelList = decodeURIComponent(this.$route.query.equipComDelList);
  119. },
  120. computed: {
  121. ...mapGetters('layout', ['projectId'])
  122. },
  123. methods: {
  124. copyContent(element) {
  125. // 双击复制
  126. let content = element.target.innerText;
  127. let inputObj = document.getElementById('copyContent');
  128. inputObj.value = content;
  129. inputObj.select();
  130. document.execCommand("Copy");
  131. this.$message({
  132. message: '复制成功',
  133. type: 'success',
  134. duration: 1000
  135. });
  136. },
  137. clickCopy() {
  138. // 点击复制
  139. let target = document.getElementById('copy');
  140. let content = target.innerText;
  141. let inputObj = document.getElementById('copyContent');
  142. inputObj.value = content;
  143. inputObj.select();
  144. document.execCommand("Copy");
  145. this.$message({
  146. message: '复制成功',
  147. type: 'success',
  148. duration: 1000
  149. });
  150. },
  151. getToBeSuppement() {
  152. let params = {
  153. ProjectId: this.projectId,
  154. Cascade: [
  155. {
  156. "Name": "equipFamily"
  157. },
  158. {
  159. "Name": "familyName"
  160. }
  161. ],
  162. Filters: `ModelId in ${this.equipComDelList}`,
  163. PageNumber: this.page.pageNumber,
  164. PageSize: this.page.pageSize
  165. }
  166. toBeSupplementEquip(params, res => {
  167. this.page.total = res.PageSize < 20 ? res.PageSize : res.Total;
  168. if (this.page.pageNumber == 1) {
  169. this.pageData = res.Content;
  170. this.$nextTick(() => {
  171. this.getGraphy();
  172. })
  173. } else {
  174. this.pageData = this.pageData.concat(res.Content);
  175. this.$nextTick(() => {
  176. this.getGraphy();
  177. })
  178. }
  179. // this.pageData = res.Content;
  180. this.pageData.forEach(item => {
  181. if (item.BIMLocation) {
  182. let local = {};
  183. let ary = item.BIMLocation.split(',');
  184. let localAry = ['X', 'Y', 'Z'];
  185. ary.forEach((item, index) => {
  186. local[localAry[index]] = ary[index];
  187. })
  188. item.local = local;
  189. }
  190. if (item.ScanTaskBase && item.ScanTaskBase.length > 1) {
  191. item.ScanTaskBase = item.ScanTaskBase.shift();
  192. }
  193. if (item.EquipFamily && item.EquipFamily.length) {
  194. item.Res = '';
  195. item.EquipFamily.forEach((it, index) => {
  196. if (index !== item.EquipFamily.length - 1) {
  197. item.Res += `${it.EquipCode + it.EquipName + ","}`;
  198. } else {
  199. item.Res += `${it.EquipCode + it.EquipName}`;
  200. }
  201. })
  202. }
  203. });
  204. })
  205. },
  206. getGraphy() {// 绘制空间位置图片
  207. let can = this.$refs.canvas;
  208. let that = this;
  209. that.clearGraphy(this.i)
  210. that.scene = new LocationPointScene();
  211. this.canvasLoading = true;
  212. that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: can[this.i].dataset.modelid }).then(res => {
  213. that.canvasLoading = false;
  214. if (res == 'error') {
  215. this.FloorMap = '';
  216. this.$message.warning('数据解析异常');
  217. return;
  218. }
  219. let modelID = can[this.i].dataset.modelid
  220. let EquipID = can[this.i].dataset.equipid;
  221. let X = Number(can[this.i].dataset.x);
  222. let Y = can[this.i].dataset.y * -1;
  223. that.view.scene = that.scene;
  224. this.scene.addMarker({
  225. Id: EquipID,
  226. X: X,
  227. Y: Y
  228. })
  229. that.view.fitSceneToView();
  230. this.scene.isSpaceSelectable = false;
  231. this.i++;
  232. if (this.i !== this.pageData.length) {
  233. this.$nextTick(() => {
  234. this.getGraphy();
  235. })
  236. }
  237. })
  238. },
  239. clearGraphy(i) {
  240. this.view = new FloorView(`canvas${i}`)
  241. }
  242. },
  243. watch: {}
  244. }
  245. </script>
  246. <style lang="less" scoped>
  247. // 取消打印功能默认的左右边距
  248. @media print {
  249. @page {
  250. margin-left: 0;
  251. margin-right: 0;
  252. }
  253. }
  254. .box {
  255. background: #f2f2f2;
  256. margin: 0 auto;
  257. height: 100%;
  258. overflow-y: auto;
  259. ul {
  260. .infinite-list-item {
  261. margin-bottom: 20px;
  262. }
  263. }
  264. .content-box {
  265. width: 1000px;
  266. margin: 0 auto;
  267. background: white;
  268. padding: 10px 4px 10px 20px;
  269. box-sizing: border-box;
  270. .content-top {
  271. display: flex;
  272. div {
  273. flex: 1;
  274. }
  275. .details {
  276. margin-right: 10px;
  277. .el-badge {
  278. margin: 10px 0 0 10px;
  279. }
  280. p {
  281. margin-top: 4px;
  282. span:nth-child(1) {
  283. display: inline-block;
  284. width: 200px;
  285. }
  286. }
  287. .copy {
  288. color: #409eff;
  289. margin-left: 20px;
  290. }
  291. }
  292. .plan {
  293. padding-left: 20px;
  294. box-sizing: border-box;
  295. p {
  296. width: 100%;
  297. margin: 10px 0 10px 0;
  298. span {
  299. float: right;
  300. padding-right: 20px;
  301. box-sizing: border-box;
  302. }
  303. }
  304. }
  305. }
  306. .content-bottom {
  307. width: 100%;
  308. margin-top: 20px;
  309. overflow: hidden;
  310. .photo,
  311. .explain {
  312. float: left;
  313. width: 50%;
  314. }
  315. .photo {
  316. box-sizing: border-box;
  317. margin-bottom: 24px;
  318. p {
  319. margin-bottom: 10px;
  320. }
  321. span {
  322. float: right;
  323. padding-right: 20px;
  324. box-sizing: border-box;
  325. }
  326. }
  327. .explain {
  328. padding-right: 20px;
  329. box-sizing: border-box;
  330. .el-scrollbar {
  331. background: #f2f2f2;
  332. }
  333. p {
  334. margin-bottom: 10px;
  335. }
  336. .explain-content {
  337. padding: 10px;
  338. width: 100%;
  339. height: 290px;
  340. box-sizing: border-box;
  341. }
  342. }
  343. }
  344. }
  345. }
  346. .img-box {
  347. width: 100%;
  348. .img-content {
  349. overflow: hidden;
  350. position: relative;
  351. width: calc(100% - 20px);
  352. height: 300px;
  353. vertical-align: middle;
  354. text-align: center;
  355. background: #ebeef5;
  356. margin-right: 20px;
  357. img {
  358. position: absolute;
  359. left: 50%;
  360. top: 50%;
  361. transform: translate(-50%, -50%);
  362. width: 400px;
  363. vertical-align: middle;
  364. }
  365. }
  366. }
  367. canvas {
  368. position: static !important;
  369. }
  370. </style>