index.vue 88 KB

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