index-2.vue 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681
  1. <!--
  2. revit扫楼数据整理
  3. -->
  4. <template>
  5. <div style="height:100%;">
  6. <div class="build_header" ref="header">
  7. <!-- 建筑选择 -->
  8. <span style="padding-right:12px;color:#999;vertical-align: middle;">建筑名称</span>
  9. <el-select v-model="buildId" style="margin-right:10px;" placeholder="请选择" @change="changeBuild">
  10. <el-option v-for="item in buildList" :key="item.BuildID" :label="item.BuildLocalName" :value="item.BuildID"></el-option>
  11. </el-select>
  12. <!-- 楼层选择 -->
  13. <span style="padding-right:12px;color:#999;">楼层</span>
  14. <el-select v-model="floorId" placeholder="请选择" @change="changeFloor">
  15. <el-option v-for="item in floorList" :key="item.FloorID" :label="item.FloorLocalName" :value="item.FloorID"></el-option>
  16. </el-select>
  17. <!-- 选择时间插件 -->
  18. <build-time :timeArr="timeArr" @checkTime="checkTime"></build-time>
  19. </div>
  20. <div class="left-main">
  21. <div id="buildData">
  22. <!-- 头部信息 -->
  23. <div class="point_view" ref="point">
  24. <!-- 点位标签 -->
  25. <div class="build_label" v-show="labelShow">
  26. <!-- 左按钮 -->
  27. <div class="turn_left">
  28. <i class="iconfont" @click="turn(0)">&#xe720;</i>
  29. </div>
  30. <!-- 主体视窗 -->
  31. <div class="label_view">
  32. <el-scrollbar>
  33. <div class="swiper-wrapper">
  34. <div class="swiper-slide" :class="checkPointClass == 'all' ? 'active_swiper' : ''" @click="checkPoint('all','all','all')">
  35. <div class="all_view">
  36. <h3>全部</h3>
  37. </div>
  38. </div>
  39. <div class="swiper-slide" v-for="(item,index) in PTArr" :key="index" :class="checkPointClass == index ? 'active_swiper' : ''"
  40. @click="checkPoint(index,item.Id,item.Name)">
  41. <div class="img_view">
  42. <div :class="index == 0 ? 'msg_view' : 'title_view'">
  43. <h3>{{item.Name}}</h3>
  44. <p>
  45. 附近的资产:
  46. <span>{{item.Total}}</span> 个(
  47. <em>{{item.Nocheck}}</em> 个未完成修订)
  48. </p>
  49. </div>
  50. <img v-if="index != 0" v-load @error="setErrorImg"
  51. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Image +'&width=200'" :alt="item.Name">
  52. <el-button type="text" v-if="index != 0" class="btn" @click.stop="getTable(item.Id,index)">查看详情</el-button>
  53. <i v-if="index != 0" class="iconfont icon-shuaxin icon" @click.stop="refreshImg(index)"></i>
  54. </div>
  55. </div>
  56. </div>
  57. </el-scrollbar>
  58. </div>
  59. <!-- 右按钮 -->
  60. <div class="turn_right">
  61. <i class="iconfont" @click="turn(1)">&#xe6f8;</i>
  62. </div>
  63. </div>
  64. <!-- 控制点位标签显示 -->
  65. <div class="label_show">
  66. <el-button plain @click="labelShowBtn">{{labelChecked}}</el-button>
  67. </div>
  68. </div>
  69. <!-- 全部与未完成 -->
  70. <div class="build_operate" ref="operate">
  71. <el-radio-group v-model="checked" @change="changeChecked(checked)">
  72. <el-radio-button :label="''">全部</el-radio-button>
  73. <el-radio-button :label="0">未完成修订</el-radio-button>
  74. </el-radio-group>
  75. <div class="undo_btn" @click="undo">
  76. <el-button plain>撤回</el-button>
  77. </div>
  78. <div class="undo_btn" @click="refresh">
  79. <el-button plain>刷新</el-button>
  80. </div>
  81. <div class="undo_btn" @click="download">
  82. <el-button plain>下载</el-button>
  83. </div>
  84. <p class="build_msg" v-show="buildMsgShow" :class="buildMsg ? 'blink' : ''">其他设备族的资产只能在对应页签内维护,设备族变更的资产刷新后不匹配的信息点值将丢失,将会在对应的页签内显示</p>
  85. </div>
  86. <!-- 主体表格与tab -->
  87. <div class="build_table">
  88. <el-tabs type="card" v-model="tabAvtive" @tab-click="createHotBtn">
  89. <el-tab-pane v-for="(item,index) in facilityList" :key="index" :name="'table' + index" :label="item.FamilyName + '(' + item.Count + ')'">
  90. <div style="padding: .2rem;width:100%;padding-bottom:35px;" v-loading="loading">
  91. <div :id="'table' + index" v-loading="tableLoading"></div>
  92. <div class="data_page center">
  93. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage[tabChecked]"
  94. :page-sizes="pageSizeArrs" :page-size="pageSizeArr[tabChecked]" layout="total, sizes, prev, pager, next, jumper"
  95. :total="pageCount[tabChecked]"></el-pagination>
  96. </div>
  97. </div>
  98. </el-tab-pane>
  99. </el-tabs>
  100. </div>
  101. <!-- 图片查看浮层 -->
  102. <div class="mouse_move" style="backgroundColor:#ccc;height:3px;cursor:n-resize;" @mousedown="drag" @mouseup="mouseUp"></div>
  103. <div class="build_pic" v-bind:style="{height:picHeight+'px'}" ref="picview">
  104. <!-- <div class="pic_show" @click="picNoShow">关闭</div> -->
  105. <div class="turn_left">
  106. <i class="iconfont" @click="turnPic(0)">&#xe720;</i>
  107. </div>
  108. <div class="pic_view">
  109. <div class="swiper-container" id="swiperPic" v-show="tablePicArr.Pic.length">
  110. <div class="swiper-wrapper">
  111. <div class="swiper-slide" v-for="(item,$index) in tablePicArr.Nameplate" :key="item.Key">
  112. <div class="img_view">
  113. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)"
  114. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key" :title="item.Name" :alt="item.Name">
  115. <i class="iconfont icon-shuaxin icon" @click.stop="changeImgUrl('Nameplate',$index)"></i>
  116. </div>
  117. </div>
  118. <div class="swiper-slide" v-for="(item,$index) in tablePicArr.Pic" :key="item.Key">
  119. <div class="img_view" v-if="item.Type != 'image_video'">
  120. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '铭牌照片'"
  121. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  122. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '设备正面照片'"
  123. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  124. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '带二维码的设备远景照片'"
  125. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  126. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '设备左侧照片'"
  127. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  128. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '设备右侧照片'"
  129. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  130. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '设备背面照片'"
  131. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  132. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '带二维码的设备近景照片'"
  133. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  134. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '视频资料' && item.Type == 'image'"
  135. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  136. <div v-if="item.Type == 'video'" style="width:100%;height:100%;">
  137. <video style="width:100%;height:100%;" :src="'/image-service/common/file_get/'+ item.Key + '?systemId=dataPlatform'" controls
  138. :poster="'/image-service/common/image_get?systemId=dataPlatform&key='+ delVideo(item.Key) +'&width=200'"></video>
  139. </div>
  140. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '其他照片'"
  141. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  142. <img v-load @error="setErrorImg" @click="seeBig(item.Key,item.Name,item.Type)" v-if="item.Name == '全景照片'"
  143. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" :title="item.Name" :alt="item.Name">
  144. <!-- <i
  145. @click="delPic($index)"
  146. class="iconfont icon-guanbi"
  147. style="z-index:99;background:#fff;position:absolute;right:10px;top:10px;"
  148. ></i>-->
  149. <i class="iconfont icon-shuaxin icon" @click.stop="changeImgUrl('Pic',$index)"></i>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <div v-show="!tablePicArr.Pic.length">
  155. <p>{{ tablePicMsg ? tablePicMsg : '请选择资产'}}</p>
  156. </div>
  157. </div>
  158. <div class="turn_right">
  159. <i class="iconfont" @click="turnPic(1)">&#xe6f8;</i>
  160. </div>
  161. </div>
  162. <!-- 查看图片、视频、全景图页面唤起 -->
  163. <div class="iframe_view" v-if="iframeShow">
  164. <div class="iframe_no" @click="iframeShow = false">
  165. <i class="iconfont icon-guanbi"></i>
  166. </div>
  167. <iframe id="google_ads_frame2" name="google_ads_frame2" frameborder="0" :src="iframeSrc" marginwidth="0" marginheight="0" vspace="0"
  168. hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true"></iframe>
  169. </div>
  170. <!-- 编辑点位标签弹窗 -->
  171. <el-dialog title="点位标签编辑" class="modification" :visible.sync="dialogTableVisible" @close="closeDialog">
  172. <div class="content_box">
  173. <div class="mod_title">
  174. <div class="qr_code">
  175. <img v-if="pointList.PointId"
  176. :src="'/ScanBuilding/service/qrcode/point?projectId=' + projectId + '&pointId=' + pointList.PointId + '&FloorId=' + floorId + '&width=200&height=200'"
  177. alt>
  178. <p v-else>暂无二维码</p>
  179. </div>
  180. <!-- 头部信息 -->
  181. <div class="msg_main">
  182. <p :title="floorName">现场位置:{{floorName ? floorName : '暂无'}}</p>
  183. <div class="input_view">
  184. <input type="text" v-model="pointList.PointName" @focus="nameShow = true" @blur="nameNotShow" @keyup.enter="savePointChange"
  185. placeholder="点位标签的名称">
  186. <i class="iconfont icon-check" v-show="nameShow" @click="savePointChange"></i>
  187. </div>
  188. <div class="input_view">
  189. <input type="text" v-model="pointList.PointLocalId" @focus="noShow = true" @blur="noNotShow" @keyup.enter="savePointChange"
  190. placeholder="点位标签的本地编码">
  191. <i class="iconfont icon-check" v-show="noShow" @click="savePointChange"></i>
  192. </div>
  193. </div>
  194. </div>
  195. <!-- 表格信息 -->
  196. <div class="cant_mod">
  197. <div class="msg_table">
  198. <div class="table_header">编码及关系</div>
  199. <table>
  200. <tbody>
  201. <tr>
  202. <td>点位标签id</td>
  203. <td>{{pointList.PointId}}</td>
  204. </tr>
  205. <tr>
  206. <td>模型id</td>
  207. <td>{{pointList.BimId ? pointList.BimId : '暂无'}}</td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. </div>
  212. <!-- 照片信息 -->
  213. <div class="locale_pic">
  214. <p>现场照片</p>
  215. <div v-if="pointList.ImageList">
  216. <!-- //图片排序 -->
  217. <ul>
  218. <li v-for="(item,index) in imgList.place" v-if="imgList.place.length" class="img_view">
  219. <img @click="seeBig(item.Key,item.Name,item.Type)"
  220. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  221. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  222. </li>
  223. <li v-for="(item,index) in imgList.nameplate" v-if="imgList.nameplate.length" class="img_view">
  224. <img @click="seeBig(item.Key,item.Name,item.Type)"
  225. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  226. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  227. </li>
  228. <li v-for="(item,index) in imgList.ahead" v-if="imgList.ahead.length" class="img_view">
  229. <img @click="seeBig(item.Key,item.Name,item.Type)"
  230. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  231. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  232. </li>
  233. <li v-for="(item,index) in imgList.qrCodeLooger" v-if="imgList.qrCodeLooger.length" class="img_view">
  234. <img @click="seeBig(item.Key,item.Name,item.Type)"
  235. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  236. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  237. </li>
  238. <li v-for="(item,index) in imgList.left" v-if="imgList.left.length" class="img_view">
  239. <img @click="seeBig(item.Key,item.Name,item.Type)"
  240. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  241. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  242. </li>
  243. <li v-for="(item,index) in imgList.right" v-if="imgList.right.length" class="img_view">
  244. <img @click="seeBig(item.Key,item.Name,item.Type)"
  245. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  246. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  247. </li>
  248. <li v-for="(item,index) in imgList.bottom" v-if="imgList.bottom.length" class="img_view">
  249. <img @click="seeBig(item.Key,item.Name,item.Type)"
  250. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  251. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  252. </li>
  253. <li v-for="(item,index) in imgList.qrCode" v-if="imgList.qrCode.length" class="img_view">
  254. <img @click="seeBig(item.Key,item.Name,item.Type)"
  255. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  256. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  257. </li>
  258. <li v-for="(item,index) in imgList.panorama" v-if="imgList.panorama.length" class="img_view">
  259. <img @click="seeBig(item.Key,item.Name,item.Type)"
  260. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  261. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  262. </li>
  263. <li v-for="(item,index) in imgList.else" v-if="imgList.else.length && item.Type != 'image_video'" class="img_view">
  264. <img @click="seeBig(item.Key,item.Name,item.Type)"
  265. :src="'/image-service/common/image_get?systemId=dataPlatform&key='+ item.Key +'&width=200'" alt>
  266. <i class="iconfont icon-shuaxin icon" @click.stop="changeImage(index)"></i>
  267. </li>
  268. <li v-for="item in imgList.video" style="border: 1px solid #ccc;">
  269. <video style="width:100%;height:100%;" :src="'/image-service/common/file_get/'+ item.Key + '?systemId=dataPlatform'" controls
  270. :poster="'/image-service/common/image_get?systemId=dataPlatform&key='+ delVideo(item.Key) +'&width=200'"></video>
  271. </li>
  272. </ul>
  273. </div>
  274. <div v-else>暂无照片</div>
  275. </div>
  276. <div id="viewer"></div>
  277. </div>
  278. </div>
  279. </el-dialog>
  280. <!-- 删除提示 -->
  281. <el-dialog title="提示" :visible.sync="deldialog">
  282. <span>你确定删除该资产吗?</span>
  283. <span slot="footer" class="dialog-footer">
  284. <el-button @click="refresh">取 消</el-button>
  285. <el-button type="primary" @click="delTrue">确 定</el-button>
  286. </span>
  287. </el-dialog>
  288. <drag v-show="dragShow" @closeDrag="dragShow = false" :iframeSrc="dragSrc"></drag>
  289. </div>
  290. </div>
  291. <div class="right-main">
  292. <recommend ref="recommend" @loadData="loadData"></recommend>
  293. </div>
  294. </div>
  295. </template>
  296. <script>
  297. import buildTime from "@/components/data_admin/selectTime";
  298. import drag from "@/components/data_admin/drag";
  299. import Swiper from "swiper";
  300. import tools from "@/utils/scan/tools"
  301. import recommend from "@/components/data_admin/buildData/recommend-2";
  302. import showTools from "@/utils/handsontable/notShow"
  303. import text from "@/utils/handsontable/mainText"
  304. // import DragResize from '@/assets/js/resize'
  305. import "@/assets/js/chosen.jquery.min";
  306. import "@/assets/js/handsontable-chosen-editor";
  307. import handsonUtils from "@/utils/scan/hasontableUtils"
  308. import 'swiper/dist/css/swiper.min.css'
  309. import Handsontable from "handsontable-pro"
  310. import 'handsontable-pro/dist/handsontable.full.css'
  311. import zhCN from 'handsontable-pro/languages/zh-CN';
  312. //接口
  313. import {
  314. getPT, //根据时间、建筑名称、楼层查询点位标签
  315. getPoint, //获取点位标签详情
  316. updatePoint, //修改点位标签
  317. getTabFamily, //获取tab标签
  318. getTableHeader, //获取表格数据头部
  319. getTableMain, //获取表格主体内容
  320. upDateTableMain, //提交修改设备资产
  321. delErrAssets, //删除设备资产
  322. getdelMain, //获取过滤掉后的表格主体
  323. getBasicMatch, //获取完全匹配的厂商库id
  324. // buildingQuery, //数据中心-建筑查询
  325. // floorQuery, //数据中心-楼层查询
  326. queryLocationPoint, //数据中心-点位标签查询
  327. updateLocationPoint, //数据中心-更新点位标签
  328. getEquipBelongs, //数据中心-获取设备族
  329. queryProperty, //数据中心-资产查询
  330. deleteProperty, //数据中心-删除资产
  331. updateProperty, //数据中心-更新资产
  332. getDataDictionary, //数据中心-查询表头
  333. queryPropertyTypeCount, //数据中心-资产分类及数量
  334. queryPropertyPoint, //数据中心-位置标签及对应资产数量
  335. } from "@/api/scan/request";
  336. import { buildingQuery } from '@/api/object/build';
  337. import { floorQuery } from '@/api/object/floor';
  338. import { mapGetters, mapActions } from "vuex"
  339. export default {
  340. components: {
  341. buildTime,
  342. drag,
  343. recommend
  344. },
  345. data() {
  346. return {
  347. buildList: [],
  348. buildId: "",
  349. floorList: [],
  350. floorId: "",
  351. timeArr: ["一个月内", "一周内", "近三天", "昨天", "今天"],
  352. checkTimeArr: [],
  353. PTArr: [],
  354. value: "", //select的值
  355. swiper: "", //点位标签的swiper
  356. labelChecked: "请选择点位标签!", //按钮文案
  357. labelShow: true, //头部的点位标签的显示
  358. swiper2: "", //图片的swiper
  359. dialogTableVisible: false, //编辑点位标签弹窗显示
  360. dialogVisible: false, //请求错误弹窗
  361. ajaxMsg: "", //请求错误提示
  362. picShow: false, //最底层图片窗
  363. pointList: "", //点位标签详情数组
  364. pointId: "all", //点位标签详情查询需求的id
  365. checkPointClass: "all", //点击点位标签的当前标签
  366. pointCheck: "", //当前点击到的点位标签
  367. checked: 0, //审核标志
  368. facilityList: [], //设备list
  369. myHotArr: [], //Handsontable实例数组
  370. code: "", //被选中的设备族
  371. myHotHeaderArr: [], //表格实例的头部数组
  372. myHotMainArr: [], //表格实例的主体内容数组
  373. tabChecked: 0, //tab当前被选中的
  374. currentPageArr: [], //当前选中页数数组
  375. pageCount: [], //总共数据条数
  376. pageSizeArrs: [10, 30, 50, 100], //下拉页数个数
  377. pageSizeArr: [], //数组当前页个数
  378. currentPage: [], //当前页数
  379. loading: false, //loading动画
  380. deldialog: false, //删除提示
  381. delArr: [], //需要删除的Fmid
  382. tablePicArr: {
  383. Pic: []
  384. }, //底部pic的数组
  385. tabAvtive: "table0", //tab活跃页
  386. deepArr: [], //删除存储数组
  387. iframeSrc: "", //iframe的src
  388. iframeShow: false, //iframe的显示
  389. tableLoading: false, //table的loading
  390. AllFamily: [], //所有的Family
  391. filtersArr: [], //表格数据被过滤后的下标
  392. tablePicMsg: "", //设备照片提示语
  393. rowArr: "", //鼠标单击表格时的位置
  394. nameShow: false, //点位标签名的勾号是否显示
  395. noShow: false, //点位标签no是否显示
  396. imgList: [], //点位标签的图片数组
  397. floorName: "", //被选中的楼层名
  398. buildMsgShow: false, //提示显示与否
  399. buildMsg: false, //是否跳动
  400. picHeight: 180, //图片容器的高度
  401. dragShow: false, //拖拽容器的显示
  402. dragSrc: '', //拖拽元素的src
  403. infos: "", //点击时的信息
  404. };
  405. },
  406. created() {
  407. //默认时间赋值
  408. this.checkTimeArr = [
  409. this.getNowFormatDate(new Date().setHours(0, 0, 0, 0)),
  410. this.getNowFormatDate(new Date())
  411. ];
  412. // 获取建筑信息
  413. this.getBuilding();
  414. //获取所有所有的设备族
  415. this.getAllFamily();
  416. },
  417. computed: {
  418. ...mapGetters("layout", [
  419. "projectId",
  420. "userId",
  421. "secret"
  422. ])
  423. },
  424. methods: {
  425. //获取所有设备族
  426. getAllFamily() {
  427. let pa = {
  428. data: {
  429. Orders: 'Family asc',
  430. Distinct: true,
  431. PageSize: 500,
  432. Projection: ["Family", "FamilyName"]
  433. }
  434. }
  435. getEquipBelongs(pa, res => {
  436. this.AllFamily = res.Content.map(t => {
  437. return {
  438. Code: t.Family,
  439. Name: t.FamilyName
  440. }
  441. })
  442. })
  443. },
  444. //重新获取数据loadhot
  445. loadData() {
  446. let param = {
  447. BeginTime: this.checkTimeArr[0],
  448. BuildId: this.buildId,
  449. Checked: this.checked,
  450. EndTime: this.checkTimeArr[1],
  451. Family: this.code,
  452. FloorId: this.floorId,
  453. PageNum: this.currentPage[this.tabChecked],
  454. PageSize: this.pageSizeArr[this.tabChecked],
  455. PointId: this.pointCheck,
  456. ProjId: this.projectId,
  457. UserId: this.userId
  458. };
  459. getdelMain(param).then(res => {
  460. if (res.data.Result == "success") {
  461. let data = res.data.FmList
  462. if (data && data.length) {
  463. //如果数据存在,有localname取localname,否则取随机生成name
  464. data = data.map(item => {
  465. item.Infos.EquipLocalName = item.Infos.EquipLocalName || item.Infos.EquipName
  466. return item
  467. })
  468. }
  469. this.myHotMainArr[this.tabChecked] = data;
  470. this.pageCount[this.tabChecked] = res.data.Count;
  471. let dom = this.myHotArr[this.tabChecked];
  472. //存储一个数组防止删除操作找寻不到删除的该数组
  473. this.tableLoading = false;
  474. this.deepArr = this.deepCopy(data);
  475. if (!!this.myHotArr[this.tabChecked]) {
  476. this.myHotArr[this.tabChecked].loadData(data)
  477. this.myHotMainArr[this.tabChecked] = data
  478. } else {
  479. this.createHot(
  480. this.tabChecked,
  481. data,
  482. this.myHotHeaderArr[this.tabChecked]
  483. );
  484. }
  485. this.loading = false
  486. } else {
  487. this.$message.error("请求错误:" + res.data.ResultMsg)
  488. }
  489. })
  490. // .catch(_ => {
  491. // this.$message.error("请求错误")
  492. // })
  493. },
  494. //删除图片
  495. delPic(index) {
  496. let param = {}
  497. if (!!this.tablePicArr && this.tablePicArr.Pic.length) {
  498. this.$confirm("<p>你确定删除此照片吗?</p><div style='height:200px;'><img style='display: block;margin: auto;' src='/image-service/common/image_get?systemId=dataPlatform&width=200&height=200&key=" + this.tablePicArr.Pic[index].key + "' /></div>",
  499. "删除图片", {
  500. dangerouslyUseHTMLString: true
  501. }).then(() => {
  502. if (this.tablePicArr.Pic[index].name == "铭牌照片") {
  503. this.delPicPost("Nameplate", this.tablePicArr.Pic[index].key)
  504. } else {
  505. this.delPicPost("Pic", this.tablePicArr.Pic[index].key)
  506. }
  507. }).catch(_ => {
  508. this.$message("取消删除")
  509. })
  510. } else {
  511. this.$message.error("请确定该资产有pic信息")
  512. }
  513. },
  514. delPicPost(name, key) {
  515. let myInfos = this.infos.Infos[name].map(item => {
  516. if (item.Key == key) {
  517. return undefined
  518. } else {
  519. return item
  520. }
  521. }).filter(b => b);
  522. let param = {}
  523. param.BuildId = this.infos.BuildId
  524. param.BuildName = this.infos.BuildName
  525. param.Checked = this.infos.Checked
  526. param.CodeType = this.infos.CodeType
  527. param.CreateTime = this.infos.CreateTime
  528. param.Family = this.infos.Family
  529. param.FamilyName = this.infos.FamilyName
  530. param.FloorId = this.infos.FloorId
  531. param.FmId = this.infos.FmId
  532. param.FmName = this.infos.FmName
  533. param.LastUpdate = this.infos.LastUpdate
  534. param.ProjId = this.infos.ProjId
  535. param.X = this.infos.X
  536. param.Y = this.infos.Y
  537. param.Infos = {}
  538. if (!!this.infos.Infos.Pic && this.infos.Infos.Pic.length) {
  539. param.Infos.Pic = tools.copyArr(this.infos.Infos.Pic)
  540. }
  541. if (!!this.infos.Infos.Nameplate && this.infos.Infos.Nameplate.length) {
  542. param.Infos.Nameplate = tools.copyArr(this.infos.Infos.Nameplate)
  543. }
  544. param.Infos[name] = myInfos
  545. let Pj = {
  546. ProjId: this.projectId,
  547. UserId: this.userId
  548. }
  549. upDateTableMain(Pj, [param]).then(res => {
  550. if (res.data.Result == "success") {
  551. if (!!param.Infos.Nameplate) {
  552. this.tablePicArr.Pic = param.Infos.Nameplate.concat(param.Infos.Pic)
  553. } else {
  554. this.tablePicArr.Pic = param.Infos.Pic
  555. }
  556. this.$message.success("删除成功")
  557. this.getTableMain()
  558. } else {
  559. this.$message.error("请求错误:" + res.data.ResultMsg)
  560. }
  561. }).catch(_ => {
  562. this.$message.error("请求错误")
  563. })
  564. },
  565. //图片div移动事件
  566. drag(el) {
  567. let picDiv = this.$refs["picview"];
  568. let startY = el.clientY;
  569. const _this = this;
  570. document.onmousemove = function (e) {
  571. e.preventDefault();
  572. let endY = e.clientY;
  573. _this.picHeight = _this.picHeight - endY + startY;
  574. if (_this.picHeight > 245) {
  575. _this.mouseUp()
  576. }
  577. startY = endY;
  578. };
  579. },
  580. //移动图片容器的时候鼠标up时触发重新渲染表格高度
  581. mouseUp(el) {
  582. document.onmousemove = null;
  583. if (this.myHotArr[this.tabChecked]) {
  584. let windowH = document.documentElement.clientHeight
  585. let headerH = this.$refs["header"].offsetHeight;
  586. let pointH = this.$refs["point"].offsetHeight;
  587. let operateH = this.$refs["operate"].offsetHeight;
  588. let picH = this.$refs["picview"].offsetHeight;
  589. let height = windowH - headerH - 48 - operateH - picH - 32 - 32 - 32;
  590. this.myHotArr[this.tabChecked].container.children[0].style.height = height + 'px'
  591. this.myHotArr[this.tabChecked].container.parentNode.style.height = height + 'px'
  592. }
  593. this.createPicSwiper();
  594. },
  595. //获取建筑列表
  596. getBuilding() {
  597. buildingQuery({}, res => {
  598. this.buildList = res.Content;
  599. });
  600. },
  601. //获取点位标签详情
  602. getPointDetail() {
  603. let pa = {
  604. Filters: `Id='${this.pointId}'`
  605. }
  606. queryLocationPoint(pa, res => {
  607. this.pointList = res.Content[0];
  608. this.imgList = this.delImage(res.Content[0].ImageList || []);
  609. this.dialogTableVisible = true;
  610. })
  611. },
  612. delImage(imageList) {
  613. let list = {
  614. place: [],
  615. nameplate: [],
  616. ahead: [],
  617. qrCodeLooger: [],
  618. left: [],
  619. right: [],
  620. bottom: [],
  621. video: [],
  622. else: [],
  623. qrCode: [],
  624. panorama: []
  625. };
  626. let imgList = imageList;
  627. for (let i = 0; i < imgList.length; i++) {
  628. switch (imgList[i].name) {
  629. case "安装位置":
  630. list.place.push(imgList[i]);
  631. break;
  632. case "铭牌照片":
  633. list.nameplate.push(imgList[i]);
  634. break;
  635. case "设备正面照片":
  636. list.ahead.push(imgList[i]);
  637. break;
  638. case "带二维码的设备远景照片":
  639. list.qrCodeLooger.push(imgList[i]);
  640. break;
  641. case "设备左侧照片":
  642. list.left.push(imgList[i]);
  643. break;
  644. case "设备右侧照片":
  645. list.right.push(imgList[i]);
  646. break;
  647. case "设备背面照片":
  648. list.right.push(imgList[i]);
  649. break;
  650. case "带二维码的设备近景照片":
  651. list.qrCode.push(imgList[i]);
  652. break;
  653. case "视频":
  654. list.video.push(imgList[i]);
  655. break;
  656. case "全景照片":
  657. list.panorama.push(imgList[i]);
  658. break;
  659. default:
  660. list.else.push(imgList[i]);
  661. }
  662. }
  663. return list;
  664. },
  665. //保存点位标签详情的修改
  666. savePoint() {
  667. let pa = {
  668. Content: [this.pointList]
  669. }
  670. updateLocationPoint(pa, res => {
  671. this.$message.success('更新成功')
  672. })
  673. },
  674. //获取点位标签
  675. getPT() {
  676. let pa = {
  677. buildingId:this.buildId,
  678. endingTime:this.checkTimeArr[1],
  679. startTime:this.checkTimeArr[0]
  680. }
  681. if (this.floorId == 'all') {
  682. pa.floorId = `all`
  683. } else if (this.floorId != 'noKnow') {
  684. pa.floorId = this.floorId
  685. }
  686. queryPropertyPoint(pa, res => {
  687. this.PTArr = res.Content;
  688. this.labelShow = true;
  689. this.createPTSwiper();
  690. })
  691. },
  692. //获取楼层列表
  693. getFloorData() {
  694. let param = {
  695. Filters: `BuildID='${this.buildId}'`,
  696. Orders: 'FloorSequenceID desc'
  697. };
  698. floorQuery(param, res => {
  699. this.floorList = res.Content
  700. this.floorList.unshift({
  701. FloorName: "全部",
  702. FloorLocalName: "全部",
  703. FloorID: "all"
  704. }, {
  705. FloorName: "未明确楼层",
  706. FloorLocalName: "未明确楼层",
  707. FloorID: "noKnow"
  708. })
  709. });
  710. },
  711. //保存设备资产的更新
  712. upDateTableMain(paramList) {
  713. let param = {
  714. ProjId: this.projectId,
  715. UserId: this.userId
  716. };
  717. upDateTableMain(param, paramList).then(result => {
  718. if (result.data.Result == "success") {
  719. return;
  720. } else {
  721. this.dialogVisible = true;
  722. this.ajaxMsg = "保存出错";
  723. }
  724. });
  725. },
  726. //获取设备族列表
  727. getTabFamily() {
  728. let pa = {
  729. buildingId: this.buildId,
  730. checked: this.checked,
  731. endingTime: this.checkTimeArr[1],
  732. pointId: this.pointId,
  733. startTime: this.checkTimeArr[0]
  734. }
  735. if (this.floorId == 'noKnow') {
  736. pa.floorId = 'isNull'
  737. } else if (this.floorId != 'all') {
  738. pa.floorId = this.floorId
  739. }
  740. queryPropertyTypeCount(pa, res => {
  741. this.myHotArr.length = this.myHotMainArr.length = this.myHotMainArr.length = this.pageCount.length = this.currentPageArr.length = this.pageSizeArr.length = this.currentPage.length =
  742. res.Content.length;
  743. for (let i = 0; i < this.pageCount.length; i++) {
  744. this.pageCount[i] = 10;
  745. this.currentPageArr[i] = 1;
  746. this.pageSizeArr[i] = 10;
  747. this.currentPage[i] = 1;
  748. }
  749. if (this.facilityList.length == res.Content.length) {
  750. this.facilityList = res.Content;
  751. this.createHotBtn({
  752. index: this.tabAvtive.split("table")[1]
  753. });
  754. } else {
  755. this.facilityList = res.Content;
  756. this.createHotBtn({
  757. index: 0
  758. });
  759. }
  760. })
  761. },
  762. //点击刷新图片
  763. refreshImg(index) {
  764. if (this.PTArr[index].Image.indexOf("time") != "-1") {
  765. let url = this.PTArr[index].Image.split("time");
  766. this.PTArr[index].Image = url[0] + "time=" + new Date().getTime();
  767. } else {
  768. this.PTArr[index].Image =
  769. this.PTArr[index].Image + "&time=" + new Date().getTime();
  770. }
  771. },
  772. //第一个输入框失去焦点
  773. nameNotShow() {
  774. let that = this;
  775. let timer = window.setTimeout(function () {
  776. that.nameShow = false;
  777. if (!that.nameShow) {
  778. window.clearTimeout(timer);
  779. }
  780. }, 1000);
  781. },
  782. //第二个输入框失去焦点
  783. noNotShow() {
  784. let that = this;
  785. let timer = window.setTimeout(function () {
  786. that.noShow = false;
  787. if (!that.noShow) {
  788. window.clearTimeout(timer);
  789. }
  790. }, 1000);
  791. },
  792. //修改底部图片url
  793. changeImgUrl(name, index) {
  794. let data = this.tablePicArr[name][index];
  795. if (data.key.indexOf("time") != "-1") {
  796. let url = data.key.split("time");
  797. data.key = url[0] + "time=" + new Date().getTime();
  798. } else {
  799. data.key = data.key + "&time=" + new Date().getTime();
  800. }
  801. },
  802. labelShowBtn() {
  803. this.labelShow = !this.labelShow;
  804. },
  805. //弹窗图片刷新
  806. changeImage(index) {
  807. let data = this.pointList.ImageList[index];
  808. if (data.key.indexOf("time") != "-1") {
  809. let url = data.key.split("time");
  810. data.key = url[0] + "time=" + new Date().getTime();
  811. } else {
  812. data.key = data.key + "&time=" + new Date().getTime();
  813. }
  814. },
  815. //图片加载失败替换url
  816. setErrorImg(e) {
  817. let el = e.path[0];
  818. el.style.cssText = "width:100%;height100%;display:block;";
  819. },
  820. //获取表格头部内容与下拉内容
  821. getTableHeader() {
  822. let param = {
  823. code: this.code,
  824. ProjId: this.projectId
  825. };
  826. if (!!this.code) {
  827. let pa = {
  828. type: this.code,
  829. data: {
  830. Orders: 'sort asc',
  831. PageSize: 500
  832. }
  833. }
  834. getDataDictionary(pa, res => {
  835. this.myHotHeaderArr[this.tabChecked] = res.Content;
  836. this.getTableMain();
  837. })
  838. }
  839. },
  840. //获取表格主体内容
  841. async getTableMain() {
  842. let pa = {
  843. PageNumber: this.currentPage[this.tabChecked],
  844. PageSize: this.pageSizeArr[this.tabChecked],
  845. Filters: `CreateTime>='${this.checkTimeArr[0]}';CreateTime<='${this.checkTimeArr[1]}';BuildingId='${this.buildId}';Family='${this.code}'`
  846. }
  847. //;codeType in [ -1,-2,-3,0,2]
  848. // 添加建筑条件
  849. if (this.floorId == 'noKnow') {
  850. pa.Filters += `;FloorId isNull`
  851. } else if (this.floorId != 'all') {
  852. pa.Filters += `;FloorId='${this.floorId}'`
  853. }
  854. // 添加完成修订条件
  855. if (this.checked === 0) {
  856. pa.Filters += `;Checked=false or Checked isNull`
  857. }
  858. // 添加标签条件
  859. if (!this.pointCheck) {
  860. pa.Filters += `;PointId isNull`
  861. } else if (this.pointCheck != 'all') {
  862. pa.Filters += `;PointId='${this.pointCheck}'`
  863. }
  864. queryProperty(pa, res => {
  865. let data = res.Content
  866. this.myHotMainArr[this.tabChecked] = data;
  867. this.pageCount[this.tabChecked] = res.Total;
  868. let dom = this.myHotArr[this.tabChecked];
  869. this.tableLoading = false;
  870. this.deepArr = this.deepCopy(data);
  871. if (!!this.myHotArr[this.tabChecked]) {
  872. this.myHotArr[this.tabChecked].loadData(data)
  873. this.myHotMainArr[this.tabChecked] = data
  874. } else {
  875. this.createHot(this.tabChecked, data, this.myHotHeaderArr[this.tabChecked]);
  876. }
  877. this.loading = false
  878. })
  879. },
  880. getTabsData2() {
  881. let param = {
  882. BeginTime: this.checkTimeArr[0],
  883. BuildId: this.buildId,
  884. Checked: this.checked,
  885. EndTime: this.checkTimeArr[1],
  886. Family: this.code,
  887. FloorId: this.floorId,
  888. PageNum: this.currentPage[this.tabChecked],
  889. PageSize: this.pageSizeArr[this.tabChecked],
  890. PointId: this.pointCheck,
  891. ProjId: this.projectId,
  892. UserId: this.userId
  893. }
  894. getdelMain(param).then(result => {
  895. this.buildMsgShow = false;
  896. if (result.data.Result == "success") {
  897. let data = result.data.FmList
  898. if (data && data.length) {
  899. //如果数据存在,有localname取localname,否则取随机生成name
  900. data = data.map(item => {
  901. item.Infos.EquipLocalName = item.Infos.EquipLocalName || item.Infos.EquipName
  902. return item
  903. })
  904. }
  905. this.myHotMainArr[this.tabChecked] = result.data.FmList;
  906. this.pageCount[this.tabChecked] = result.data.Count;
  907. let dom = this.myHotArr[this.tabChecked];
  908. //存储一个数组防止删除操作找寻不到删除的该数组
  909. this.tableLoading = false;
  910. this.deepArr = this.deepCopy(result.data.FmList);
  911. if (!result.data.Count) {
  912. // this.loading = false;
  913. // this.myHotArr[this.tabChecked].loadData(result.data.FmList);
  914. } else {
  915. this.$nextTick(() => {
  916. if (this.myHotArr[this.tabChecked] && this.myHotArr[this.tabChecked] != '') {
  917. this.myHotArr[this.tabChecked].destroy()
  918. }
  919. this.createHot(
  920. this.tabChecked,
  921. result.data.FmList,
  922. this.myHotHeaderArr[this.tabChecked]
  923. );
  924. });
  925. }
  926. this.loading = false;
  927. } else {
  928. // this.dialogVisible = true;
  929. // this.ajaxMsg = "请求出错";
  930. this.$message.error("请求出错")
  931. }
  932. });
  933. },
  934. download() {
  935. if (!!this.myHotArr[this.tabChecked]) {
  936. let fileName = ''
  937. this.buildList.map(item => {
  938. if (item.BuildID == this.buildId) {
  939. fileName += item.BuildLocalName
  940. }
  941. })
  942. this.floorList.map(item => {
  943. if (item.FloorID == this.floorId) {
  944. fileName += '-' + item.FloorLocalName
  945. }
  946. })
  947. this.facilityList.map((item, index) => {
  948. if (index == this.tabChecked) {
  949. fileName += '-' + item.FamilyName + item.Count
  950. }
  951. })
  952. this.myHotArr[this.tabChecked].getPlugin('exportFile').downloadFile("csv", {
  953. filename: fileName,
  954. columnHeaders: true,
  955. exportHiddenRows: true,
  956. exportHiddenColumns: true,
  957. rowHeaders: true
  958. })
  959. } else {
  960. this.$message("请确定存在表格")
  961. }
  962. },
  963. //删除资产
  964. delErrAssets() {
  965. let param = {
  966. ProjId: this.projectId,
  967. UserId: this.userId
  968. };
  969. let paramList = this.delArr;
  970. delErrAssets(param, paramList).then(result => {
  971. if (result.data.Result == "success") {
  972. this.deldialog = false;
  973. this.getTabFamily();
  974. return;
  975. } else {
  976. this.$message.error("请求出错")
  977. }
  978. });
  979. },
  980. delVideo(key) {
  981. return key
  982. },
  983. //修改撕码状态
  984. changeAeestsCode() {
  985. let param = {
  986. ProjId: this.projectId,
  987. UserId: this.userId
  988. };
  989. let paramList = this.delArr;
  990. paramList.map(item => {
  991. item.CodeType = 3
  992. return item
  993. })
  994. upDateTableMain(param, paramList).then(result => {
  995. if (result.data.Result == "success") {
  996. this.deldialog = false;
  997. this.getTabFamily();
  998. return;
  999. } else {
  1000. this.$message.error("请求出错")
  1001. }
  1002. });
  1003. },
  1004. //关闭点位标签详情
  1005. closeDialog() {
  1006. this.getPT();
  1007. },
  1008. //点击tab创建对应的表格
  1009. createHotBtn(tab) {
  1010. this.loading = true;
  1011. this.tabChecked = tab.index;
  1012. this.rowArr = "";
  1013. this.code = this.facilityList.length ? this.facilityList[tab.index].Family : null;
  1014. this.getTableHeader();
  1015. },
  1016. //创建点位标签swiper
  1017. createPTSwiper() {
  1018. this.$nextTick(() => {
  1019. if (this.$refs['swiperPoint']) {
  1020. this.$refs['swiperPoint'].style.transform = ''
  1021. }
  1022. this.swiper = "";
  1023. this.swiper = new Swiper("#swiper", {
  1024. slidesPerView: 4,
  1025. spaceBetween: 30
  1026. });
  1027. });
  1028. },
  1029. //生成图片查看swiper
  1030. createPicSwiper() {
  1031. let sizeNum;
  1032. if (this.picHeight <= 200) {
  1033. sizeNum = 5;
  1034. } else if (this.picHeight < 400) {
  1035. sizeNum = 4;
  1036. } else if (this.picHeight < 600) {
  1037. sizeNum = 3;
  1038. } else {
  1039. sizeNum = 2;
  1040. }
  1041. this.$nextTick(() => {
  1042. this.swiper2 = new Swiper("#swiperPic", {
  1043. slidesPerView: sizeNum,
  1044. spaceBetween: 30
  1045. });
  1046. });
  1047. },
  1048. //点位标签详情中的enter事件
  1049. savePointChange() {
  1050. this.savePoint();
  1051. },
  1052. //点击点位标签整个swiper事件
  1053. checkPoint(val, id, name) {
  1054. name = name || "";
  1055. if (name == "") {
  1056. this.labelChecked = "请选择点位标签!";
  1057. } else if (name == "all") {
  1058. this.labelChecked = "全部";
  1059. } else {
  1060. this.labelChecked = name;
  1061. }
  1062. this.checkPointClass = val;
  1063. if (id) {
  1064. this.pointId = id;
  1065. } else {
  1066. this.pointId = "";
  1067. }
  1068. this.pointCheck = id;
  1069. this.changeChecked(0);
  1070. },
  1071. getTable(pointId, index) {
  1072. this.pointId = pointId;
  1073. // this.loading = true
  1074. this.getPointDetail();
  1075. },
  1076. //表格实例的单击事件
  1077. tableDown(el, rowArr) {
  1078. if (rowArr.row < 0) {
  1079. return
  1080. }
  1081. let filter = this.filtersArr[this.tabChecked];
  1082. //被筛选过后的数组
  1083. let trimmedArr = this.trimmedRows();
  1084. //是否启用了排序
  1085. let isSort = this.myHotArr[this.tabChecked].getPlugin("columnSorting").isSorted();
  1086. if (trimmedArr.length && isSort) {
  1087. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1088. .rowsMapper.__arrayMap;
  1089. let infos = this.myHotMainArr[this.tabChecked][
  1090. trimmedArr[sortArr[rowArr.row]]
  1091. ];
  1092. this.getInfors(infos, rowArr);
  1093. } else if (isSort) {
  1094. //排序后的数组
  1095. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1096. .rowsMapper.__arrayMap;
  1097. let infos = this.myHotMainArr[this.tabChecked][sortArr[rowArr.row]];
  1098. this.getInfors(infos, rowArr);
  1099. } else if (trimmedArr.length) {
  1100. let infos = this.myHotMainArr[this.tabChecked][trimmedArr[rowArr.row]];
  1101. this.getInfors(infos, rowArr);
  1102. } else {
  1103. let infos = this.myHotMainArr[this.tabChecked][rowArr.row];
  1104. this.getInfors(infos, rowArr);
  1105. }
  1106. },
  1107. getInfors(data, rowArr, falg = false) {
  1108. let val = this.myHotArr[this.tabChecked].getActiveEditor().prop;
  1109. this.$refs.recommend.randerData(data, val, this.myHotHeaderArr[this.tabChecked])
  1110. if (data.LedgerParam.PhotoDoc && (data.LedgerParam.PhotoDoc.Pic || data.LedgerParam.PhotoDoc.Nameplate)) {
  1111. if (data.LedgerParam.PhotoDoc.Nameplate) {
  1112. this.tablePicArr.Pic = data.LedgerParam.PhotoDoc.Nameplate.concat(data.LedgerParam.PhotoDoc.Pic) || [];
  1113. } else {
  1114. this.tablePicArr.Pic = data.LedgerParam.PhotoDoc.Pic || [];
  1115. }
  1116. } else {
  1117. this.tablePicArr.Pic = [];
  1118. }
  1119. if (this.tablePicArr.Pic && this.tablePicArr.Pic.length) {
  1120. this.dragSrc =
  1121. process.env.BASE_URL + ":8890/photo-View.html?type=" +
  1122. // "http://172.16.0.181:8890/photo-View.html?type=" +
  1123. this.tablePicArr.Pic[0].type +
  1124. "&key=" +
  1125. this.tablePicArr.Pic[0].key +
  1126. "&name=" +
  1127. this.tablePicArr.Pic[0].name;
  1128. }
  1129. this.infos = tools.deepClone(data)
  1130. this.tablePicMsg = "该设备照片为空";
  1131. this.picShow = true;
  1132. this.createPicSwiper();
  1133. this.rowArr = rowArr;
  1134. },
  1135. //下层的弹窗不显示
  1136. picNoShow() {
  1137. this.picShow = false;
  1138. },
  1139. //修改楼层
  1140. changeFloor() {
  1141. this.checkPointClass = -1;
  1142. for (let i = 0; i < this.floorList.length; i++) {
  1143. if (this.floorId == this.floorList[i].FloorId) {
  1144. this.floorName = this.floorList[i].FloorLocalName;
  1145. }
  1146. }
  1147. this.getPT();
  1148. this.checkPoint("all", this.pointId);
  1149. },
  1150. //切换时间事件
  1151. checkTime(val) {
  1152. this.checkTimeArr = val;
  1153. this.getPT();
  1154. this.checkPoint("all", this.pointId);
  1155. this.refresh();
  1156. },
  1157. //swiper点击label切换按钮事件
  1158. turn(val) {
  1159. if (val) {
  1160. this.swiper.slideNext();
  1161. } else {
  1162. this.swiper.slidePrev();
  1163. }
  1164. },
  1165. //swiper切换照片按钮事件
  1166. turnPic(val) {
  1167. if (val) {
  1168. this.swiper2.slideNext();
  1169. } else {
  1170. this.swiper2.slidePrev();
  1171. }
  1172. },
  1173. //头部建筑名称切换事件
  1174. changeBuild() {
  1175. this.getFloorData();
  1176. },
  1177. //获取现在的时间
  1178. getNowFormatDate(str) {
  1179. var date = new Date(str);
  1180. var seperator1 = "-";
  1181. var seperator2 = ":";
  1182. var month = date.getMonth() + 1;
  1183. var strDate = date.getDate();
  1184. if (month >= 1 && month <= 9) {
  1185. month = "0" + month;
  1186. }
  1187. if (strDate >= 0 && strDate <= 9) {
  1188. strDate = "0" + strDate;
  1189. }
  1190. var currentdate =
  1191. date.getFullYear() +
  1192. seperator1 +
  1193. month +
  1194. seperator1 +
  1195. strDate +
  1196. " " +
  1197. date.getHours() +
  1198. seperator2 +
  1199. date.getMinutes() +
  1200. seperator2 +
  1201. date.getSeconds();
  1202. return currentdate;
  1203. },
  1204. //点击图片查看大图
  1205. seeBig(key, name, type) {
  1206. this.dragSrc =
  1207. process.env.BASE_URL + ":8890/photo-View.html?type=" +
  1208. type +
  1209. "&key=" +
  1210. key +
  1211. "&name=" +
  1212. name;
  1213. this.dragShow = true
  1214. },
  1215. //改变页条数
  1216. handleSizeChange(val) {
  1217. this.tableLoading = true;
  1218. this.pageSizeArr[this.tabChecked] = val;
  1219. this.clearHot();
  1220. this.getTableMain();
  1221. },
  1222. //改变当前页
  1223. handleCurrentChange(val) {
  1224. this.tableLoading = true;
  1225. this.currentPageArr[this.tabChecked] = val;
  1226. this.clearHot();
  1227. this.getTableMain();
  1228. },
  1229. //改变checked,全部未完成修订
  1230. changeChecked(val) {
  1231. this.checked = val;
  1232. this.tabChecked = 0;
  1233. this.tabAvtive = "table0";
  1234. this.clearHot();
  1235. this.getTabFamily();
  1236. // this.createHotBtn({index:0})
  1237. },
  1238. //当表格中的内容被修改
  1239. tdChange(changeData, source) {
  1240. // 修改了的数据
  1241. let filter = this.filtersArr[this.tabChecked];
  1242. if (changeData) {
  1243. let trimmedArr = this.trimmedRows();
  1244. let param = handsonUtils.getParam(changeData, source, this.myHotArr[this.tabChecked], trimmedArr);
  1245. let data = [];
  1246. //获取第一个点击的数组
  1247. let firstObj = handsonUtils.getUnshiftParam(changeData, source, this.myHotArr[this.tabChecked], trimmedArr);
  1248. for (let i = 0; i < param.length; i++) {
  1249. data.push(param[i]);
  1250. }
  1251. //如果data中包含/且data长度为1,将其转换成.
  1252. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  1253. changeData[0][1] = changeData[0][1].split("/").join(".")
  1254. }
  1255. //存在data进行修改请求
  1256. if (data && data.length) {
  1257. this.updateBusiness(data, changeData, firstObj);
  1258. }
  1259. }
  1260. },
  1261. //修改请求
  1262. updateBusiness(data, change, obj) {
  1263. let pa = {
  1264. Content: data
  1265. }
  1266. updateProperty(pa, res => {
  1267. this.getTabFamily();
  1268. })
  1269. },
  1270. //判断文案是否相同
  1271. async getIdForVender(param) {
  1272. return await getBasicMatch(param).then(res => {
  1273. if (res.data.result == "success") {
  1274. return res.data.content
  1275. } else {
  1276. this.$message.error("请求错误" + res.data.resultMsg)
  1277. }
  1278. }).catch(error => {
  1279. this.$message.error(error)
  1280. })
  1281. },
  1282. getParam(changeData, source) {
  1283. let param = "";
  1284. //被筛选过后的数组
  1285. let trimmedArr = this.trimmedRows();
  1286. //是否启用了排序
  1287. let isSort = this.myHotArr[this.tabChecked]
  1288. .getPlugin("columnSorting")
  1289. .isSorted();
  1290. if (trimmedArr.length && isSort) {
  1291. //排序后的数组
  1292. let sortArr = this.myHotArr[this.tabChecked].getPlugin(
  1293. "columnSorting"
  1294. ).rowsMapper.__arrayMap;
  1295. param = changeData.map(item => {
  1296. return this.myHotArr[this.tabChecked].getSourceDataAtRow(
  1297. trimmedArr[sortArr[item[0]]]
  1298. );
  1299. });
  1300. } else if (isSort) {
  1301. //排序后的数组
  1302. let sortArr = this.myHotArr[this.tabChecked].getPlugin(
  1303. "columnSorting"
  1304. ).rowsMapper.__arrayMap;
  1305. param = changeData.map(item => {
  1306. return this.myHotArr[this.tabChecked].getSourceDataAtRow(
  1307. sortArr[item[0]]
  1308. );
  1309. });
  1310. } else if (trimmedArr.length) {
  1311. param = changeData.map(item => {
  1312. return this.myHotArr[this.tabChecked].getSourceDataAtRow(
  1313. trimmedArr[item[0]]
  1314. );
  1315. });
  1316. } else {
  1317. param = changeData.map(item => {
  1318. return this.myHotArr[this.tabChecked].getSourceDataAtRow(item[0]);
  1319. });
  1320. }
  1321. return param
  1322. },
  1323. //处理右键删除
  1324. romoveFm(index, amout) {
  1325. let delData = tools.differenceArr(this.myHotMainArr[this.tabChecked], this.deepArr)
  1326. this.$confirm('确认删除?')
  1327. .then(_ => {
  1328. let param = {
  1329. ProjId: this.projectId,
  1330. UserId: this.userId
  1331. };
  1332. let paramList = delData.map(item => {
  1333. item.CodeType = 3
  1334. return item
  1335. })
  1336. upDateTableMain(param, paramList).then(result => {
  1337. if (result.data.Result == "success") {
  1338. this.deldialog = false;
  1339. this.getTabFamily();
  1340. return;
  1341. } else {
  1342. this.dialogVisible = true;
  1343. this.ajaxMsg = "请求出错";
  1344. }
  1345. });
  1346. })
  1347. .catch(_ => {
  1348. this.$message("取消删除")
  1349. });
  1350. },
  1351. // 刷新当前表格
  1352. refresh() {
  1353. this.deldialog = false;
  1354. this.loading = true;
  1355. if (this.myHotArr[this.tabChecked]) {
  1356. this.myHotArr[this.tabChecked].destroy();
  1357. }
  1358. this.myHotArr[this.tabChecked] = "";
  1359. this.getTableMain();
  1360. },
  1361. //确定要删除
  1362. delTrue() {
  1363. //删除
  1364. // this.delErrAssets();
  1365. //撕码
  1366. this.changeAeestsCode()
  1367. },
  1368. //撤回操作
  1369. undo() {
  1370. this.myHotArr[this.tabChecked].undo();
  1371. },
  1372. //创建表格实例
  1373. createHot(variableNum, data, headerArr) {
  1374. if (!headerArr) {
  1375. return
  1376. }
  1377. let maxRow = "";
  1378. //当当前页数*当前页个数小于总个数时,当前表格行数为当前页数
  1379. if (
  1380. this.pageCount[this.tabChecked] >=
  1381. this.pageSizeArr[this.tabChecked] * this.currentPage[this.tabChecked]
  1382. ) {
  1383. maxRow = this.pageSizeArr[this.tabChecked];
  1384. } else {
  1385. maxRow =
  1386. this.pageCount[this.tabChecked] % this.pageSizeArr[this.tabChecked];
  1387. }
  1388. let containter = document.getElementById("table" + variableNum);
  1389. let height = 0;
  1390. let winHeight = document.documentElement.clientHeight;
  1391. let headerH = this.$refs["header"].offsetHeight;
  1392. let pointH = this.$refs["point"].offsetHeight;
  1393. let operateH = this.$refs["operate"].offsetHeight;
  1394. let picH = this.$refs["picview"].offsetHeight;
  1395. height = winHeight - headerH - 48 - operateH - picH - 32 - 32 - 32 - 155;
  1396. let headers = this.delHeader(headerArr)
  1397. let customBorders = data.map((item, index) => {
  1398. //铭牌识别标志
  1399. if (item.Nametemplate == 1) {
  1400. return {
  1401. range: {
  1402. from: {
  1403. row: index,
  1404. col: 0
  1405. },
  1406. to: {
  1407. row: index,
  1408. col: headers.length
  1409. }
  1410. },
  1411. left: {
  1412. width: 2,
  1413. color: "red"
  1414. },
  1415. right: {
  1416. width: 2,
  1417. color: "red"
  1418. },
  1419. top: {
  1420. width: 2,
  1421. color: "red"
  1422. },
  1423. bottom: {
  1424. width: 2,
  1425. color: "red"
  1426. }
  1427. }
  1428. } else {
  1429. return undefined
  1430. }
  1431. }).filter(d => d)
  1432. let options = {
  1433. data: data,
  1434. colHeaders: headers,
  1435. manualColumnResize: true,
  1436. manualColumnMove: true,
  1437. maxRows: maxRow,
  1438. height: height,
  1439. columnSorting: true, //添加排序
  1440. sortIndicator: true, //添加排序
  1441. renderAllRows: true,
  1442. autoColumnSize: true,
  1443. fixedColumnsLeft: 5,
  1444. language: "zh-CN",
  1445. contextMenu: {
  1446. items: {
  1447. remove_row: {
  1448. name: "删除资产"
  1449. }
  1450. }
  1451. },
  1452. // customBorders: customBorders,
  1453. columns: this.getType(headerArr),
  1454. afterOnCellMouseDown: this.tableDown, //鼠标单击
  1455. afterChange: this.tdChange, //修改后
  1456. afterRemoveRow: this.romoveFm, //右键删除
  1457. dropdownMenu: [
  1458. "filter_by_condition",
  1459. "filter_by_value",
  1460. "filter_action_bar"
  1461. ],
  1462. filters: true,
  1463. afterFilter: this.trimmedRows,
  1464. afterDocumentKeyDown: this.afterDocumentKeyDown
  1465. };
  1466. console.log(options, variableNum)
  1467. this.myHotArr[variableNum] = new Handsontable(containter, options);
  1468. //存在点击tab后分页不正确的问题,使用0转换
  1469. this.tabChecked = 0;
  1470. this.tabChecked = variableNum;
  1471. let pro = document.getElementById("hot-display-license-info");
  1472. pro.parentNode.removeChild(pro);
  1473. },
  1474. afterDocumentKeyDown(e) {
  1475. // this.$nextTick(() => {
  1476. let activeEditer = this.myHotArr[this.tabChecked].getActiveEditor(), td, row, prop,
  1477. val = e.realTarget.value,
  1478. infoArr = ["Brand", "Specification", "Manufacturer", "Supplier", "Maintainer", "Insurer", "SupplierContactor", "SupplierPhone", "SupplierEmail", "SupplierWeb", "SupplierFax", "MaintainerContactor", "MaintainerPhone", "MaintainerEmail", "MaintainerWeb", "MaintainerFax", "InsurerContactor", "InsurerPhone", "InsurerEmail", "InsurerWeb", "InsurerFax"];
  1479. if (activeEditer) {
  1480. td = activeEditer.TD
  1481. row = activeEditer.row
  1482. prop = activeEditer.prop
  1483. } else {
  1484. return false
  1485. }
  1486. let filter = this.filtersArr[this.tabChecked];
  1487. // console.log(activeEditer, val, document.getElementsByClassName("handsontableInput")[0].value)
  1488. //被筛选过后的数组
  1489. if (e.which == 8) {
  1490. console.log("val", val)
  1491. val = val.substring(0, val.length - 1)
  1492. console.log("val1", val)
  1493. }
  1494. let trimmedArr = this.trimmedRows();
  1495. //是否启用了排序
  1496. let isSort = this.myHotArr[this.tabChecked]
  1497. .getPlugin("columnSorting")
  1498. .isSorted();
  1499. let infos = "";
  1500. // if (infoArr.indexOf(prop.split('.')[1]) < 0) {
  1501. // return false
  1502. // }
  1503. if (trimmedArr.length && isSort) {
  1504. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1505. .rowsMapper.__arrayMap;
  1506. infos = this.myHotMainArr[this.tabChecked][
  1507. trimmedArr[sortArr[row]]
  1508. ];
  1509. } else if (isSort) {
  1510. //排序后的数组
  1511. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1512. .rowsMapper.__arrayMap;
  1513. infos = this.myHotMainArr[this.tabChecked][sortArr[row]];
  1514. } else if (trimmedArr.length) {
  1515. infos = this.myHotMainArr[this.tabChecked][trimmedArr[row]];
  1516. } else {
  1517. infos = this.myHotMainArr[this.tabChecked][row];
  1518. }
  1519. if (this.$refs.recommend) {
  1520. this.$refs.recommend.randerData(infos, prop, this.myHotHeaderArr[this.tabChecked], true, val)
  1521. }
  1522. // })
  1523. },
  1524. //获取被筛选掉的行号
  1525. trimmedRows() {
  1526. // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
  1527. var plugin = this.myHotArr[this.tabChecked].getPlugin("trimRows")
  1528. .trimmedRows;
  1529. let dataLength = this.pageSizeArr[this.tabChecked];
  1530. let dataArr = new Array();
  1531. for (let i = 0; i < dataLength; i++) {
  1532. dataArr.push(i);
  1533. }
  1534. if (plugin.length <= 0) {
  1535. dataArr = undefined;
  1536. } else {
  1537. dataArr = this.array_diff(dataArr, plugin);
  1538. }
  1539. this.filtersArr[this.tabChecked] = dataArr;
  1540. return dataArr || [];
  1541. // var DataArray = new Array();
  1542. // for (var i = 0; i < plugin.length; i++) {
  1543. // // 通过行号获取数据
  1544. // DataArray.push(this.myHotArr[this.tabChecked].getSourceDataAtRow(plugin[i]));
  1545. // }
  1546. },
  1547. //去除数组中相同的元素
  1548. array_diff(a, b) {
  1549. for (var i = 0; i < b.length; i++) {
  1550. for (var j = 0; j < a.length; j++) {
  1551. if (a[j] == b[i]) {
  1552. a.splice(j, 1);
  1553. j = j - 1;
  1554. }
  1555. }
  1556. }
  1557. return a;
  1558. },
  1559. //清空所有实例
  1560. clearHot() {
  1561. this.myHotArr = this.myHotArr.map(item => {
  1562. if (item) {
  1563. return item.destroy();
  1564. } else {
  1565. return;
  1566. }
  1567. });
  1568. },
  1569. //处理头部header方法
  1570. delHeader(arr) {
  1571. let readArr = ["A1", "A2", "B1", "C5", "D1", "D2", "X", "L", "L1", "L2", "M"]
  1572. let data = showTools.headerTextFilter(arr, 'property', false, 'Visible')
  1573. data.unshift("标记", "点位标签", "设备族");
  1574. return data;
  1575. },
  1576. //通过header生成columns
  1577. getType(arr) {
  1578. let data = showTools.headerTypeFilter(arr, 'property', false, 'Visible')
  1579. data.unshift({
  1580. type: "checkbox",
  1581. checkedTemplate: true,
  1582. uncheckedTemplate: false,
  1583. data: "Checked",
  1584. label: {
  1585. position: "after",
  1586. value: "完成修订"
  1587. }
  1588. }, {
  1589. data: "PointName",
  1590. readOnly: true
  1591. }, {
  1592. editor: "chosen",
  1593. data: "Family",
  1594. renderer: tools.customDropdownRenderer,
  1595. chosenOptions: {
  1596. data: this.AllFamily
  1597. }
  1598. });
  1599. data = data.filter(item => item)
  1600. return data;
  1601. },
  1602. //工具函数浅复制深拷贝,防止共用存储空间
  1603. deepCopy(obj) {
  1604. var out = [],
  1605. i = 0,
  1606. len = obj.length;
  1607. for (; i < len; i++) {
  1608. if (obj[i] instanceof Array) {
  1609. out[i] = deepcopy(obj[i]);
  1610. } else out[i] = obj[i];
  1611. }
  1612. return out;
  1613. }
  1614. },
  1615. watch: {
  1616. projectId() {
  1617. //默认时间赋值
  1618. this.checkTimeArr = [
  1619. this.getNowFormatDate(new Date().setHours(0, 0, 0, 0)),
  1620. this.getNowFormatDate(new Date())
  1621. ];
  1622. this.buildId = ""
  1623. this.floorId = ""
  1624. this.buildList = []
  1625. this.floorList = []
  1626. this.tabAvtive = "table0"
  1627. this.labelChecked = "请选择点位标签!"
  1628. // 获取建筑信息
  1629. this.getBuilding();
  1630. //获取所有所有的设备族
  1631. this.getAllFamily();
  1632. this.checked = 0
  1633. }
  1634. }
  1635. };
  1636. </script>
  1637. <style lang="scss" scoped>
  1638. .page-content {
  1639. position: relative;
  1640. }
  1641. @import "../../../components/data_admin/buildData/style.scss";
  1642. </style>
  1643. <style lang="scss" scoped>
  1644. #buildData {
  1645. .el-tabs__header {
  1646. width: 100%;
  1647. }
  1648. .el-dialog {
  1649. width: 900px;
  1650. height: auto;
  1651. }
  1652. .center {
  1653. text-align: center;
  1654. }
  1655. .el-radio-button__inner {
  1656. width: 90px;
  1657. }
  1658. .build_label {
  1659. .label_view {
  1660. padding: 0 4rem;
  1661. box-sizing: border-box;
  1662. }
  1663. }
  1664. .build_pic {
  1665. .turn_right {
  1666. right: 0;
  1667. }
  1668. }
  1669. }
  1670. .content_box {
  1671. max-height: 440px;
  1672. overflow-y: auto;
  1673. }
  1674. </style>