index.vue 68 KB

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