index.vue 88 KB

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