index.vue 88 KB

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