index-2.vue 61 KB

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