supplement.vue 10 KB

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