index-2.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679
  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. } from "@/api/scan/request";
  335. import { mapGetters, mapActions } from "vuex"
  336. export default {
  337. components: {
  338. buildTime,
  339. drag,
  340. recommend
  341. },
  342. data() {
  343. return {
  344. buildList: [],
  345. buildId: "",
  346. floorList: [],
  347. floorId: "",
  348. timeArr: ["一个月内", "一周内", "近三天", "昨天", "今天"],
  349. checkTimeArr: [],
  350. PTArr: [],
  351. value: "", //select的值
  352. swiper: "", //点位标签的swiper
  353. labelChecked: "请选择点位标签!", //按钮文案
  354. labelShow: true, //头部的点位标签的显示
  355. swiper2: "", //图片的swiper
  356. dialogTableVisible: false, //编辑点位标签弹窗显示
  357. dialogVisible: false, //请求错误弹窗
  358. ajaxMsg: "", //请求错误提示
  359. picShow: false, //最底层图片窗
  360. pointList: "", //点位标签详情数组
  361. pointId: "all", //点位标签详情查询需求的id
  362. checkPointClass: "all", //点击点位标签的当前标签
  363. pointCheck: "", //当前点击到的点位标签
  364. checked: 0, //审核标志
  365. facilityList: [], //设备list
  366. myHotArr: [], //Handsontable实例数组
  367. code: "", //被选中的设备族
  368. myHotHeaderArr: [], //表格实例的头部数组
  369. myHotMainArr: [], //表格实例的主体内容数组
  370. tabChecked: 0, //tab当前被选中的
  371. currentPageArr: [], //当前选中页数数组
  372. pageCount: [], //总共数据条数
  373. pageSizeArrs: [10, 30, 50, 100], //下拉页数个数
  374. pageSizeArr: [], //数组当前页个数
  375. currentPage: [], //当前页数
  376. loading: false, //loading动画
  377. deldialog: false, //删除提示
  378. delArr: [], //需要删除的Fmid
  379. tablePicArr: {
  380. Pic: []
  381. }, //底部pic的数组
  382. tabAvtive: "table0", //tab活跃页
  383. deepArr: [], //删除存储数组
  384. iframeSrc: "", //iframe的src
  385. iframeShow: false, //iframe的显示
  386. tableLoading: false, //table的loading
  387. AllFamily: [], //所有的Family
  388. filtersArr: [], //表格数据被过滤后的下标
  389. tablePicMsg: "", //设备照片提示语
  390. rowArr: "", //鼠标单击表格时的位置
  391. nameShow: false, //点位标签名的勾号是否显示
  392. noShow: false, //点位标签no是否显示
  393. imgList: [], //点位标签的图片数组
  394. floorName: "", //被选中的楼层名
  395. buildMsgShow: false, //提示显示与否
  396. buildMsg: false, //是否跳动
  397. picHeight: 180, //图片容器的高度
  398. dragShow: false, //拖拽容器的显示
  399. dragSrc: '', //拖拽元素的src
  400. infos: "", //点击时的信息
  401. };
  402. },
  403. created() {
  404. //默认时间赋值
  405. this.checkTimeArr = [
  406. this.getNowFormatDate(new Date().setHours(0, 0, 0, 0)),
  407. this.getNowFormatDate(new Date())
  408. ];
  409. // 获取建筑信息
  410. this.getBuilding();
  411. //获取所有所有的设备族
  412. this.getAllFamily();
  413. },
  414. computed: {
  415. ...mapGetters("layout", [
  416. "projectId",
  417. "userId",
  418. "secret"
  419. ])
  420. },
  421. methods: {
  422. //获取所有设备族
  423. getAllFamily() {
  424. let pa = {
  425. data: {
  426. Orders: 'Family asc',
  427. Distinct: true,
  428. PageSize: 500,
  429. Projection: ["Family", "FamilyName"]
  430. }
  431. }
  432. getEquipBelongs(pa, res => {
  433. this.AllFamily = res.Content.map(t => {
  434. return {
  435. Code: t.Family,
  436. Name: t.FamilyName
  437. }
  438. })
  439. })
  440. },
  441. //重新获取数据loadhot
  442. loadData() {
  443. let param = {
  444. BeginTime: this.checkTimeArr[0],
  445. BuildId: this.buildId,
  446. Checked: this.checked,
  447. EndTime: this.checkTimeArr[1],
  448. Family: this.code,
  449. FloorId: this.floorId,
  450. PageNum: this.currentPage[this.tabChecked],
  451. PageSize: this.pageSizeArr[this.tabChecked],
  452. PointId: this.pointCheck,
  453. ProjId: this.projectId,
  454. UserId: this.userId
  455. };
  456. getdelMain(param).then(res => {
  457. if (res.data.Result == "success") {
  458. let data = res.data.FmList
  459. if (data && data.length) {
  460. //如果数据存在,有localname取localname,否则取随机生成name
  461. data = data.map(item => {
  462. item.Infos.EquipLocalName = item.Infos.EquipLocalName || item.Infos.EquipName
  463. return item
  464. })
  465. }
  466. this.myHotMainArr[this.tabChecked] = data;
  467. this.pageCount[this.tabChecked] = res.data.Count;
  468. let dom = this.myHotArr[this.tabChecked];
  469. //存储一个数组防止删除操作找寻不到删除的该数组
  470. this.tableLoading = false;
  471. this.deepArr = this.deepCopy(data);
  472. if (!!this.myHotArr[this.tabChecked]) {
  473. this.myHotArr[this.tabChecked].loadData(data)
  474. this.myHotMainArr[this.tabChecked] = data
  475. } else {
  476. this.createHot(
  477. this.tabChecked,
  478. data,
  479. this.myHotHeaderArr[this.tabChecked]
  480. );
  481. }
  482. this.loading = false
  483. } else {
  484. this.$message.error("请求错误:" + res.data.ResultMsg)
  485. }
  486. })
  487. // .catch(_ => {
  488. // this.$message.error("请求错误")
  489. // })
  490. },
  491. //删除图片
  492. delPic(index) {
  493. let param = {}
  494. if (!!this.tablePicArr && this.tablePicArr.Pic.length) {
  495. 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>",
  496. "删除图片", {
  497. dangerouslyUseHTMLString: true
  498. }).then(() => {
  499. if (this.tablePicArr.Pic[index].name == "铭牌照片") {
  500. this.delPicPost("Nameplate", this.tablePicArr.Pic[index].key)
  501. } else {
  502. this.delPicPost("Pic", this.tablePicArr.Pic[index].key)
  503. }
  504. }).catch(_ => {
  505. this.$message("取消删除")
  506. })
  507. } else {
  508. this.$message.error("请确定该资产有pic信息")
  509. }
  510. },
  511. delPicPost(name, key) {
  512. let myInfos = this.infos.Infos[name].map(item => {
  513. if (item.key == key) {
  514. return undefined
  515. } else {
  516. return item
  517. }
  518. }).filter(b => b);
  519. let param = {}
  520. param.BuildId = this.infos.BuildId
  521. param.BuildName = this.infos.BuildName
  522. param.Checked = this.infos.Checked
  523. param.CodeType = this.infos.CodeType
  524. param.CreateTime = this.infos.CreateTime
  525. param.Family = this.infos.Family
  526. param.FamilyName = this.infos.FamilyName
  527. param.FloorId = this.infos.FloorId
  528. param.FmId = this.infos.FmId
  529. param.FmName = this.infos.FmName
  530. param.LastUpdate = this.infos.LastUpdate
  531. param.ProjId = this.infos.ProjId
  532. param.X = this.infos.X
  533. param.Y = this.infos.Y
  534. param.Infos = {}
  535. if (!!this.infos.Infos.Pic && this.infos.Infos.Pic.length) {
  536. param.Infos.Pic = tools.copyArr(this.infos.Infos.Pic)
  537. }
  538. if (!!this.infos.Infos.Nameplate && this.infos.Infos.Nameplate.length) {
  539. param.Infos.Nameplate = tools.copyArr(this.infos.Infos.Nameplate)
  540. }
  541. param.Infos[name] = myInfos
  542. let Pj = {
  543. ProjId: this.projectId,
  544. UserId: this.userId
  545. }
  546. upDateTableMain(Pj, [param]).then(res => {
  547. if (res.data.Result == "success") {
  548. if (!!param.Infos.Nameplate) {
  549. this.tablePicArr.Pic = param.Infos.Nameplate.concat(param.Infos.Pic)
  550. } else {
  551. this.tablePicArr.Pic = param.Infos.Pic
  552. }
  553. this.$message.success("删除成功")
  554. this.getTableMain()
  555. } else {
  556. this.$message.error("请求错误:" + res.data.ResultMsg)
  557. }
  558. }).catch(_ => {
  559. this.$message.error("请求错误")
  560. })
  561. },
  562. //图片div移动事件
  563. drag(el) {
  564. let picDiv = this.$refs["picview"];
  565. let startY = el.clientY;
  566. const _this = this;
  567. document.onmousemove = function (e) {
  568. e.preventDefault();
  569. let endY = e.clientY;
  570. _this.picHeight = _this.picHeight - endY + startY;
  571. if (_this.picHeight > 245) {
  572. _this.mouseUp()
  573. }
  574. startY = endY;
  575. };
  576. },
  577. //移动图片容器的时候鼠标up时触发重新渲染表格高度
  578. mouseUp(el) {
  579. document.onmousemove = null;
  580. if (this.myHotArr[this.tabChecked]) {
  581. let windowH = document.documentElement.clientHeight
  582. let headerH = this.$refs["header"].offsetHeight;
  583. let pointH = this.$refs["point"].offsetHeight;
  584. let operateH = this.$refs["operate"].offsetHeight;
  585. let picH = this.$refs["picview"].offsetHeight;
  586. let height = windowH - headerH - 48 - operateH - picH - 32 - 32 - 32;
  587. this.myHotArr[this.tabChecked].container.children[0].style.height = height + 'px'
  588. this.myHotArr[this.tabChecked].container.parentNode.style.height = height + 'px'
  589. }
  590. this.createPicSwiper();
  591. },
  592. //获取建筑列表
  593. getBuilding() {
  594. buildingQuery({}, res => {
  595. this.buildList = res.Content;
  596. });
  597. },
  598. //获取点位标签详情
  599. getPointDetail() {
  600. let pa = {
  601. Filters: `Id='${this.pointId}'`
  602. }
  603. queryLocationPoint(pa, res => {
  604. this.pointList = res.Content[0];
  605. this.imgList = this.delImage(res.Content[0].ImageList || []);
  606. this.dialogTableVisible = true;
  607. })
  608. },
  609. delImage(imageList) {
  610. let list = {
  611. place: [],
  612. nameplate: [],
  613. ahead: [],
  614. qrCodeLooger: [],
  615. left: [],
  616. right: [],
  617. bottom: [],
  618. video: [],
  619. else: [],
  620. qrCode: [],
  621. panorama: []
  622. };
  623. let imgList = imageList;
  624. for (let i = 0; i < imgList.length; i++) {
  625. switch (imgList[i].name) {
  626. case "安装位置":
  627. list.place.push(imgList[i]);
  628. break;
  629. case "铭牌照片":
  630. list.nameplate.push(imgList[i]);
  631. break;
  632. case "设备正面照片":
  633. list.ahead.push(imgList[i]);
  634. break;
  635. case "带二维码的设备远景照片":
  636. list.qrCodeLooger.push(imgList[i]);
  637. break;
  638. case "设备左侧照片":
  639. list.left.push(imgList[i]);
  640. break;
  641. case "设备右侧照片":
  642. list.right.push(imgList[i]);
  643. break;
  644. case "设备背面照片":
  645. list.right.push(imgList[i]);
  646. break;
  647. case "带二维码的设备近景照片":
  648. list.qrCode.push(imgList[i]);
  649. break;
  650. case "视频":
  651. list.video.push(imgList[i]);
  652. break;
  653. case "全景照片":
  654. list.panorama.push(imgList[i]);
  655. break;
  656. default:
  657. list.else.push(imgList[i]);
  658. }
  659. }
  660. return list;
  661. },
  662. //保存点位标签详情的修改
  663. savePoint() {
  664. let pa = {
  665. Content: [this.pointList]
  666. }
  667. updateLocationPoint(pa, res => {
  668. this.$message.success('更新成功')
  669. })
  670. },
  671. //获取点位标签
  672. getPT() {
  673. let pa = {
  674. Filters: `LastUpdate>='${this.checkTimeArr[0]}';LastUpdate<='${this.checkTimeArr[1]}';BuildId='${this.buildId}'`,
  675. PageSize: 100
  676. }
  677. if (this.floorId == 'noKnow') {
  678. pa.Filters += `;FloorId isNull`
  679. } else if (this.floorId != 'all') {
  680. pa.Filters += `;FloorId='${this.floorId}'`
  681. }
  682. queryLocationPoint(pa, res => {
  683. this.PTArr = res.Content;
  684. this.labelShow = true;
  685. this.createPTSwiper();
  686. })
  687. },
  688. //获取楼层列表
  689. getFloorData() {
  690. let param = {
  691. Filters: `BuildID='${this.buildId}'`,
  692. Orders: 'FloorSequenceID desc'
  693. };
  694. floorQuery(param, res => {
  695. this.floorList = res.Content
  696. this.floorList.unshift({
  697. FloorName: "全部",
  698. FloorLocalName: "全部",
  699. FloorID: "all"
  700. }, {
  701. FloorName: "未明确楼层",
  702. FloorLocalName: "未明确楼层",
  703. FloorID: "noKnow"
  704. })
  705. });
  706. },
  707. //保存设备资产的更新
  708. upDateTableMain(paramList) {
  709. let param = {
  710. ProjId: this.projectId,
  711. UserId: this.userId
  712. };
  713. upDateTableMain(param, paramList).then(result => {
  714. if (result.data.Result == "success") {
  715. return;
  716. } else {
  717. this.dialogVisible = true;
  718. this.ajaxMsg = "保存出错";
  719. }
  720. });
  721. },
  722. //获取设备族列表
  723. getTabFamily() {
  724. let pa = {
  725. buildingId: this.buildId,
  726. checked: this.checked,
  727. endingTime: this.checkTimeArr[1],
  728. pointId: this.pointId,
  729. startTime: this.checkTimeArr[0]
  730. }
  731. if (this.floorId == 'noKnow') {
  732. pa.floorId = 'isNull'
  733. } else if (this.floorId != 'all') {
  734. pa.floorId = this.floorId
  735. }
  736. queryPropertyTypeCount(pa, res => {
  737. this.myHotArr.length = this.myHotMainArr.length = this.myHotMainArr.length = this.pageCount.length = this.currentPageArr.length = this.pageSizeArr.length = this.currentPage.length =
  738. res.Content.length;
  739. for (let i = 0; i < this.pageCount.length; i++) {
  740. this.pageCount[i] = 10;
  741. this.currentPageArr[i] = 1;
  742. this.pageSizeArr[i] = 10;
  743. this.currentPage[i] = 1;
  744. }
  745. if (this.facilityList.length == res.Content.length) {
  746. this.facilityList = res.Content;
  747. this.createHotBtn({
  748. index: this.tabAvtive.split("table")[1]
  749. });
  750. } else {
  751. this.facilityList = res.Content;
  752. this.createHotBtn({
  753. index: 0
  754. });
  755. }
  756. })
  757. },
  758. //点击刷新图片
  759. refreshImg(index) {
  760. if (this.PTArr[index].Image.indexOf("time") != "-1") {
  761. let url = this.PTArr[index].Image.split("time");
  762. this.PTArr[index].Image = url[0] + "time=" + new Date().getTime();
  763. } else {
  764. this.PTArr[index].Image =
  765. this.PTArr[index].Image + "&time=" + new Date().getTime();
  766. }
  767. },
  768. //第一个输入框失去焦点
  769. nameNotShow() {
  770. let that = this;
  771. let timer = window.setTimeout(function () {
  772. that.nameShow = false;
  773. if (!that.nameShow) {
  774. window.clearTimeout(timer);
  775. }
  776. }, 1000);
  777. },
  778. //第二个输入框失去焦点
  779. noNotShow() {
  780. let that = this;
  781. let timer = window.setTimeout(function () {
  782. that.noShow = false;
  783. if (!that.noShow) {
  784. window.clearTimeout(timer);
  785. }
  786. }, 1000);
  787. },
  788. //修改底部图片url
  789. changeImgUrl(name, index) {
  790. let data = this.tablePicArr[name][index];
  791. if (data.key.indexOf("time") != "-1") {
  792. let url = data.key.split("time");
  793. data.key = url[0] + "time=" + new Date().getTime();
  794. } else {
  795. data.key = data.key + "&time=" + new Date().getTime();
  796. }
  797. },
  798. labelShowBtn() {
  799. this.labelShow = !this.labelShow;
  800. },
  801. //弹窗图片刷新
  802. changeImage(index) {
  803. let data = this.pointList.ImageList[index];
  804. if (data.key.indexOf("time") != "-1") {
  805. let url = data.key.split("time");
  806. data.key = url[0] + "time=" + new Date().getTime();
  807. } else {
  808. data.key = data.key + "&time=" + new Date().getTime();
  809. }
  810. },
  811. //图片加载失败替换url
  812. setErrorImg(e) {
  813. let el = e.path[0];
  814. el.style.cssText = "width:100%;height100%;display:block;";
  815. },
  816. //获取表格头部内容与下拉内容
  817. getTableHeader() {
  818. let param = {
  819. code: this.code,
  820. ProjId: this.projectId
  821. };
  822. if (!!this.code) {
  823. let pa = {
  824. type: this.code,
  825. data: {
  826. Orders: 'sort asc',
  827. PageSize: 500
  828. }
  829. }
  830. getDataDictionary(pa, res => {
  831. this.myHotHeaderArr[this.tabChecked] = res.Content;
  832. this.getTableMain();
  833. })
  834. }
  835. },
  836. //获取表格主体内容
  837. async getTableMain() {
  838. let pa = {
  839. PageNumber: this.currentPage[this.tabChecked],
  840. PageSize: this.pageSizeArr[this.tabChecked],
  841. Filters: `LastUpdate>='${this.checkTimeArr[0]}';LastUpdate<='${this.checkTimeArr[1]}';BuildingId='${this.buildId}';Family='${this.code}'`
  842. }
  843. // 添加建筑条件
  844. if (this.floorId == 'noKnow') {
  845. pa.Filters += `;FloorId isNull`
  846. } else if (this.floorId != 'all') {
  847. pa.Filters += `;FloorId='${this.floorId}'`
  848. }
  849. // 添加完成修订条件
  850. if (this.checked === 0) {
  851. pa.Filters += `;Checked=false`
  852. }
  853. // 添加标签条件
  854. if (!this.pointCheck) {
  855. pa.Filters += `;PointId isNull`
  856. } else if (this.pointCheck != 'all') {
  857. pa.Filters += `;PointId='${this.pointCheck}'`
  858. }
  859. queryProperty(pa, res => {
  860. let data = res.Content
  861. this.myHotMainArr[this.tabChecked] = data;
  862. this.pageCount[this.tabChecked] = res.Total;
  863. let dom = this.myHotArr[this.tabChecked];
  864. this.tableLoading = false;
  865. this.deepArr = this.deepCopy(data);
  866. if (!!this.myHotArr[this.tabChecked]) {
  867. this.myHotArr[this.tabChecked].loadData(data)
  868. this.myHotMainArr[this.tabChecked] = data
  869. } else {
  870. this.createHot(this.tabChecked, data, this.myHotHeaderArr[this.tabChecked]);
  871. }
  872. this.loading = false
  873. })
  874. },
  875. getTabsData2() {
  876. let param = {
  877. BeginTime: this.checkTimeArr[0],
  878. BuildId: this.buildId,
  879. Checked: this.checked,
  880. EndTime: this.checkTimeArr[1],
  881. Family: this.code,
  882. FloorId: this.floorId,
  883. PageNum: this.currentPage[this.tabChecked],
  884. PageSize: this.pageSizeArr[this.tabChecked],
  885. PointId: this.pointCheck,
  886. ProjId: this.projectId,
  887. UserId: this.userId
  888. }
  889. getdelMain(param).then(result => {
  890. this.buildMsgShow = false;
  891. if (result.data.Result == "success") {
  892. let data = result.data.FmList
  893. if (data && data.length) {
  894. //如果数据存在,有localname取localname,否则取随机生成name
  895. data = data.map(item => {
  896. item.Infos.EquipLocalName = item.Infos.EquipLocalName || item.Infos.EquipName
  897. return item
  898. })
  899. }
  900. this.myHotMainArr[this.tabChecked] = result.data.FmList;
  901. this.pageCount[this.tabChecked] = result.data.Count;
  902. let dom = this.myHotArr[this.tabChecked];
  903. //存储一个数组防止删除操作找寻不到删除的该数组
  904. this.tableLoading = false;
  905. this.deepArr = this.deepCopy(result.data.FmList);
  906. if (!result.data.Count) {
  907. // this.loading = false;
  908. // this.myHotArr[this.tabChecked].loadData(result.data.FmList);
  909. } else {
  910. this.$nextTick(() => {
  911. if (this.myHotArr[this.tabChecked] && this.myHotArr[this.tabChecked] != '') {
  912. this.myHotArr[this.tabChecked].destroy()
  913. }
  914. this.createHot(
  915. this.tabChecked,
  916. result.data.FmList,
  917. this.myHotHeaderArr[this.tabChecked]
  918. );
  919. });
  920. }
  921. this.loading = false;
  922. } else {
  923. // this.dialogVisible = true;
  924. // this.ajaxMsg = "请求出错";
  925. this.$message.error("请求出错")
  926. }
  927. });
  928. },
  929. download() {
  930. if (!!this.myHotArr[this.tabChecked]) {
  931. let fileName = ''
  932. this.buildList.map(item => {
  933. if (item.BuildId == this.buildId) {
  934. fileName += item.BuildLocalName
  935. }
  936. })
  937. this.floorList.map(item => {
  938. if (item.FloorId == this.floorId) {
  939. fileName += '-' + item.FloorLocalName
  940. }
  941. })
  942. this.facilityList.map((item, index) => {
  943. if (index == this.tabChecked) {
  944. fileName += '-' + item.Name + item.Total
  945. }
  946. })
  947. this.myHotArr[this.tabChecked].getPlugin('exportFile').downloadFile("csv", {
  948. filename: fileName,
  949. columnHeaders: true,
  950. exportHiddenRows: true,
  951. exportHiddenColumns: true,
  952. rowHeaders: true
  953. })
  954. } else {
  955. this.$message("请确定存在表格")
  956. }
  957. },
  958. //删除资产
  959. delErrAssets() {
  960. let param = {
  961. ProjId: this.projectId,
  962. UserId: this.userId
  963. };
  964. let paramList = this.delArr;
  965. delErrAssets(param, paramList).then(result => {
  966. if (result.data.Result == "success") {
  967. this.deldialog = false;
  968. this.getTabFamily();
  969. return;
  970. } else {
  971. this.$message.error("请求出错")
  972. }
  973. });
  974. },
  975. delVideo(key) {
  976. return key
  977. },
  978. //修改撕码状态
  979. changeAeestsCode() {
  980. let param = {
  981. ProjId: this.projectId,
  982. UserId: this.userId
  983. };
  984. let paramList = this.delArr;
  985. paramList.map(item => {
  986. item.CodeType = 3
  987. return item
  988. })
  989. upDateTableMain(param, paramList).then(result => {
  990. if (result.data.Result == "success") {
  991. this.deldialog = false;
  992. this.getTabFamily();
  993. return;
  994. } else {
  995. this.$message.error("请求出错")
  996. }
  997. });
  998. },
  999. //关闭点位标签详情
  1000. closeDialog() {
  1001. this.getPT();
  1002. },
  1003. //点击tab创建对应的表格
  1004. createHotBtn(tab) {
  1005. this.loading = true;
  1006. this.tabChecked = tab.index;
  1007. this.rowArr = "";
  1008. this.code = this.facilityList.length ? this.facilityList[tab.index].Family : null;
  1009. this.getTableHeader();
  1010. },
  1011. //创建点位标签swiper
  1012. createPTSwiper() {
  1013. this.$nextTick(() => {
  1014. if (this.$refs['swiperPoint']) {
  1015. this.$refs['swiperPoint'].style.transform = ''
  1016. }
  1017. this.swiper = "";
  1018. this.swiper = new Swiper("#swiper", {
  1019. slidesPerView: 4,
  1020. spaceBetween: 30
  1021. });
  1022. });
  1023. },
  1024. //生成图片查看swiper
  1025. createPicSwiper() {
  1026. let sizeNum;
  1027. if (this.picHeight <= 200) {
  1028. sizeNum = 5;
  1029. } else if (this.picHeight < 400) {
  1030. sizeNum = 4;
  1031. } else if (this.picHeight < 600) {
  1032. sizeNum = 3;
  1033. } else {
  1034. sizeNum = 2;
  1035. }
  1036. this.$nextTick(() => {
  1037. this.swiper2 = new Swiper("#swiperPic", {
  1038. slidesPerView: sizeNum,
  1039. spaceBetween: 30
  1040. });
  1041. });
  1042. },
  1043. //点位标签详情中的enter事件
  1044. savePointChange() {
  1045. this.savePoint();
  1046. },
  1047. //点击点位标签整个swiper事件
  1048. checkPoint(val, id, name) {
  1049. name = name || "";
  1050. if (name == "") {
  1051. this.labelChecked = "请选择点位标签!";
  1052. } else if (name == "all") {
  1053. this.labelChecked = "全部";
  1054. } else {
  1055. this.labelChecked = name;
  1056. }
  1057. this.checkPointClass = val;
  1058. if (id) {
  1059. this.pointId = id;
  1060. } else {
  1061. this.pointId = "";
  1062. }
  1063. this.pointCheck = id;
  1064. this.changeChecked(0);
  1065. },
  1066. getTable(pointId, index) {
  1067. this.pointId = pointId;
  1068. // this.loading = true
  1069. this.getPointDetail();
  1070. },
  1071. //表格实例的单击事件
  1072. tableDown(el, rowArr) {
  1073. if (rowArr.row < 0) {
  1074. return
  1075. }
  1076. let filter = this.filtersArr[this.tabChecked];
  1077. //被筛选过后的数组
  1078. let trimmedArr = this.trimmedRows();
  1079. //是否启用了排序
  1080. let isSort = this.myHotArr[this.tabChecked].getPlugin("columnSorting").isSorted();
  1081. if (trimmedArr.length && isSort) {
  1082. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1083. .rowsMapper.__arrayMap;
  1084. let infos = this.myHotMainArr[this.tabChecked][
  1085. trimmedArr[sortArr[rowArr.row]]
  1086. ];
  1087. this.getInfors(infos, rowArr);
  1088. } else if (isSort) {
  1089. //排序后的数组
  1090. let sortArr = this.myHotArr[this.tabChecked].getPlugin("columnSorting")
  1091. .rowsMapper.__arrayMap;
  1092. let infos = this.myHotMainArr[this.tabChecked][sortArr[rowArr.row]];
  1093. this.getInfors(infos, rowArr);
  1094. } else if (trimmedArr.length) {
  1095. let infos = this.myHotMainArr[this.tabChecked][trimmedArr[rowArr.row]];
  1096. this.getInfors(infos, rowArr);
  1097. } else {
  1098. let infos = this.myHotMainArr[this.tabChecked][rowArr.row];
  1099. this.getInfors(infos, rowArr);
  1100. }
  1101. },
  1102. getInfors(data, rowArr, falg = false) {
  1103. let val = this.myHotArr[this.tabChecked].getActiveEditor().prop;
  1104. this.$refs.recommend.randerData(data, val, this.myHotHeaderArr[this.tabChecked])
  1105. if (data.LedgerParam.PhotoDoc && (data.LedgerParam.PhotoDoc.Pic || data.LedgerParam.PhotoDoc.Nameplate)) {
  1106. if (data.LedgerParam.PhotoDoc.Nameplate) {
  1107. this.tablePicArr.Pic = data.LedgerParam.PhotoDoc.Nameplate.concat(data.LedgerParam.PhotoDoc.Pic) || [];
  1108. } else {
  1109. this.tablePicArr.Pic = data.LedgerParam.PhotoDoc.Pic || [];
  1110. }
  1111. } else {
  1112. this.tablePicArr.Pic = [];
  1113. }
  1114. if (this.tablePicArr.Pic && this.tablePicArr.Pic.length) {
  1115. this.dragSrc =
  1116. process.env.BASE_URL + ":8890/photo-View.html?type=" +
  1117. // "http://172.16.0.181:8890/photo-View.html?type=" +
  1118. this.tablePicArr.Pic[0].type +
  1119. "&key=" +
  1120. this.tablePicArr.Pic[0].key +
  1121. "&name=" +
  1122. this.tablePicArr.Pic[0].name;
  1123. }
  1124. this.infos = tools.deepClone(data)
  1125. this.tablePicMsg = "该设备照片为空";
  1126. this.picShow = true;
  1127. this.createPicSwiper();
  1128. this.rowArr = rowArr;
  1129. },
  1130. //下层的弹窗不显示
  1131. picNoShow() {
  1132. this.picShow = false;
  1133. },
  1134. //修改楼层
  1135. changeFloor() {
  1136. this.checkPointClass = -1;
  1137. for (let i = 0; i < this.floorList.length; i++) {
  1138. if (this.floorId == this.floorList[i].FloorId) {
  1139. this.floorName = this.floorList[i].FloorLocalName;
  1140. }
  1141. }
  1142. this.getPT();
  1143. this.checkPoint("all", this.pointId);
  1144. },
  1145. //切换时间事件
  1146. checkTime(val) {
  1147. this.checkTimeArr = val;
  1148. this.getPT();
  1149. this.checkPoint("all", this.pointId);
  1150. this.refresh();
  1151. },
  1152. //swiper点击label切换按钮事件
  1153. turn(val) {
  1154. if (val) {
  1155. this.swiper.slideNext();
  1156. } else {
  1157. this.swiper.slidePrev();
  1158. }
  1159. },
  1160. //swiper切换照片按钮事件
  1161. turnPic(val) {
  1162. if (val) {
  1163. this.swiper2.slideNext();
  1164. } else {
  1165. this.swiper2.slidePrev();
  1166. }
  1167. },
  1168. //头部建筑名称切换事件
  1169. changeBuild() {
  1170. this.getFloorData();
  1171. },
  1172. //获取现在的时间
  1173. getNowFormatDate(str) {
  1174. var date = new Date(str);
  1175. var seperator1 = "-";
  1176. var seperator2 = ":";
  1177. var month = date.getMonth() + 1;
  1178. var strDate = date.getDate();
  1179. if (month >= 1 && month <= 9) {
  1180. month = "0" + month;
  1181. }
  1182. if (strDate >= 0 && strDate <= 9) {
  1183. strDate = "0" + strDate;
  1184. }
  1185. var currentdate =
  1186. date.getFullYear() +
  1187. seperator1 +
  1188. month +
  1189. seperator1 +
  1190. strDate +
  1191. " " +
  1192. date.getHours() +
  1193. seperator2 +
  1194. date.getMinutes() +
  1195. seperator2 +
  1196. date.getSeconds();
  1197. return currentdate;
  1198. },
  1199. //点击图片查看大图
  1200. seeBig(key, name, type) {
  1201. this.dragSrc =
  1202. process.env.BASE_URL + ":8890/photo-View.html?type=" +
  1203. type +
  1204. "&key=" +
  1205. key +
  1206. "&name=" +
  1207. name;
  1208. this.dragShow = true
  1209. },
  1210. //改变页条数
  1211. handleSizeChange(val) {
  1212. this.tableLoading = true;
  1213. this.pageSizeArr[this.tabChecked] = val;
  1214. this.clearHot();
  1215. this.getTableMain();
  1216. },
  1217. //改变当前页
  1218. handleCurrentChange(val) {
  1219. this.tableLoading = true;
  1220. this.currentPageArr[this.tabChecked] = val;
  1221. this.clearHot();
  1222. this.getTableMain();
  1223. },
  1224. //改变checked,全部未完成修订
  1225. changeChecked(val) {
  1226. this.checked = val;
  1227. this.tabChecked = 0;
  1228. this.tabAvtive = "table0";
  1229. this.clearHot();
  1230. this.getTabFamily();
  1231. // this.createHotBtn({index:0})
  1232. },
  1233. //当表格中的内容被修改
  1234. tdChange(changeData, source) {
  1235. // 修改了的数据
  1236. let filter = this.filtersArr[this.tabChecked];
  1237. if (changeData) {
  1238. let trimmedArr = this.trimmedRows();
  1239. let param = handsonUtils.getParam(changeData, source, this.myHotArr[this.tabChecked], trimmedArr);
  1240. let data = [];
  1241. //获取第一个点击的数组
  1242. let firstObj = handsonUtils.getUnshiftParam(changeData, source, this.myHotArr[this.tabChecked], trimmedArr);
  1243. for (let i = 0; i < param.length; i++) {
  1244. data.push(param[i]);
  1245. }
  1246. //如果data中包含/且data长度为1,将其转换成.
  1247. if (changeData.length == 1 && changeData[0][1].indexOf("/") > 0) {
  1248. changeData[0][1] = changeData[0][1].split("/").join(".")
  1249. }
  1250. //存在data进行修改请求
  1251. if (data && data.length) {
  1252. this.updateBusiness(data, changeData, firstObj);
  1253. }
  1254. }
  1255. },
  1256. //修改请求
  1257. updateBusiness(data, change, obj) {
  1258. console.log(data)
  1259. console.log(change)
  1260. console.log(obj)
  1261. let pa = {
  1262. Content: data
  1263. }
  1264. updateProperty(pa, res => {
  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: 1,
  1579. uncheckedTemplate: 0,
  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>