deleted.vue 10 KB

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