index1.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <!--
  2. revit扫楼日志
  3. -->
  4. <template>
  5. <div id="build_log">
  6. <div class="search_header">
  7. <build-input :placeholder="placeholder" @search="search"></build-input>
  8. <em @click="showDic" class="dong_dic">
  9. <i class="iconfont icon-wenti"></i>
  10. <i style="font-size:12px;">动作说明</i>
  11. </em>
  12. <build-time :timeArr="timeArr" @checkTime="checkTime"></build-time>
  13. <div class="derived_btn" @click="downExcel">
  14. <i class="iconfont icon-excelwenjian"></i>
  15. <i class="excel">导出到Excel</i>
  16. </div>
  17. <div class="derived_btn" @click="refresh">
  18. <i class="iconfont icon-shuaxin"></i>
  19. <i class="excel">刷新</i>
  20. </div>
  21. </div>
  22. <div class="log_view" v-loading="loading">
  23. <div id="log"></div>
  24. <div v-if="noData" class="no_data">暂无数据</div>
  25. </div>
  26. <div class="log_page">
  27. <el-pagination
  28. @size-change="handleSizeChange"
  29. @current-change="handleCurrentChange"
  30. :current-page.sync="currentPage"
  31. :page-sizes="pageSizeArr"
  32. :page-size="pageSize"
  33. layout="total, sizes, prev, pager, next, jumper"
  34. :total="pageCount"
  35. ></el-pagination>
  36. </div>
  37. <el-dialog class="log_dialog" title="动作说明" :visible.sync="dic">
  38. <dl>二维码</dl>
  39. <dt>查询设备资产</dt>
  40. <dt>查询点位标签</dt>
  41. <dl>信标</dl>
  42. <dt>创建信标</dt>
  43. <dt>批量删除信标</dt>
  44. <dt>查询信标</dt>
  45. <dt>批量更新信标</dt>
  46. <dl>建筑</dl>
  47. <dt>下载建筑信息</dt>
  48. <dt>根据建筑ID获得楼层信息</dt>
  49. <dt>根据项目ID获得建筑列表</dt>
  50. <dl>扫楼用户</dl>
  51. <dt>扫楼用户切换项目</dt>
  52. <dt>创建扫楼用户</dt>
  53. <dt>删除扫楼用户</dt>
  54. <dt>扫楼用户登录</dt>
  55. <dt>查询扫楼用户</dt>
  56. <dt>批量更新扫楼用户</dt>
  57. <dt>扫楼用户获得验证码</dt>
  58. <dl>扫楼用户日志</dl>
  59. <dt>导出扫楼用户日志</dt>
  60. <dt>查看扫楼用户日志</dt>
  61. <dl>数据字典</dl>
  62. <dt>查看所有设备族</dt>
  63. <dt>设备族信息点</dt>
  64. <dl>模板</dl>
  65. <dt>打印标签模板</dt>
  66. <dl>点位标签</dl>
  67. <dt>创建点位标签</dt>
  68. <dt>批量删除点位标签</dt>
  69. <dt>查询点位标签</dt>
  70. <dt>批量更新扫楼用户</dt>
  71. <dl>设备资产</dl>
  72. <dt>创建设备资产</dt>
  73. <dt>批量删除设备资产</dt>
  74. <dt>异常设备资产</dt>
  75. <dt>设备族列表</dt>
  76. <dt>按标签分组查询修改信息</dt>
  77. <dt>查询设备资产</dt>
  78. <dt>查询设备资产(专供revit)</dt>
  79. <dt>批量更新设备资产</dt>
  80. <dl>项目</dl>
  81. <dt>登记项目(在扫楼app中登录项目信息)</dt>
  82. <dt>查询项目信息</dt>
  83. <dt>更新项目信息</dt>
  84. </el-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import buildInput from '@/components/data_admin/input'
  89. import buildTime from '@/components/data_admin/selectTime'
  90. import Handsontable from "handsontable-pro"
  91. import 'handsontable-pro/dist/handsontable.full.css'
  92. import zhCN from 'handsontable-pro/languages/zh-CN';
  93. import {
  94. getBuildLog,//获取日志
  95. dowmloadLog//下载日志
  96. } from '@/api/scan/request'
  97. import axios from 'axios'
  98. import {
  99. mapGetters,
  100. mapActions
  101. } from "vuex"
  102. export default {
  103. components: {
  104. 'build-input': buildInput,
  105. 'build-time': buildTime
  106. },
  107. data() {
  108. return {
  109. placeholder: '请输入操作人、动作、对象id、等关键字搜索',
  110. timeArr: ['一个月内', '一周内', '近三天', '昨天', '今天'],
  111. checkTimeArr: [],
  112. myHot: '',
  113. filter: '',
  114. pageNum: 1,
  115. pageSize: 10,
  116. logData: [],
  117. resrtData: [],
  118. pageSizeArr: [10, 30, 50, 100, 150, 200],
  119. pageCount: 0,
  120. currentPage: 1,
  121. noData: false,//有无数据
  122. // ProjId: this.$store.state.projectId,//url获取项目id this.$route.query.projId
  123. // UserId: this.$route.query.userId,//url获取用户id this.$route.query.userId
  124. loading: false,
  125. dic: false,
  126. }
  127. },
  128. created() {
  129. this.checkTimeArr = [this.getNowFormatDate(new Date().setHours(0, 0, 0, 0)), this.getNowFormatDate(new Date())]
  130. this.getLogData()
  131. },
  132. mounted() {
  133. },
  134. computed: {
  135. ...mapGetters("peojMess", [
  136. "projectId",
  137. "userId",
  138. "secret"
  139. ])
  140. },
  141. methods: {
  142. showDic() {
  143. this.dic = true
  144. },
  145. //下载excel
  146. downExcel() {
  147. let param = {
  148. 'startTime': this.checkTimeArr[0],
  149. 'endTime': this.checkTimeArr[1],
  150. 'filter': this.filter,
  151. "ProjId": this.projectId,
  152. "UserId": this.userId,
  153. "Comming": "revit",
  154. }
  155. axios({
  156. method: 'post',
  157. url: '/ScanBuilding/service/user_log/export',
  158. data: param,
  159. responseType: 'blob'
  160. })
  161. .then(function (res) {
  162. var blob = new Blob([res.data], {
  163. type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  164. });
  165. var fileName = res.headers['content-disposition'];
  166. if (fileName)
  167. fileName = fileName.substring(fileName.indexOf('=') + 1);
  168. if ('download' in document.createElement('a')) { // 非IE下载
  169. const elink = document.createElement('a')
  170. elink.download = fileName
  171. elink.style.display = 'none'
  172. elink.href = URL.createObjectURL(blob)
  173. document.body.appendChild(elink)
  174. elink.click()
  175. URL.revokeObjectURL(elink.href) // 释放URL 对象
  176. document.body.removeChild(elink)
  177. } else { // IE10+下载
  178. navigator.msSaveBlob(blob, fileName)
  179. }
  180. })
  181. .catch(function (err) {
  182. console.dirxml(err);
  183. })
  184. },
  185. //选择一页个数
  186. handleSizeChange(val) {
  187. this.loading = true
  188. if (this.myHot) {
  189. this.myHot.destroy()
  190. this.myHot = ''
  191. }
  192. this.pageSize = val
  193. this.getLogData()
  194. },
  195. //选择页数
  196. handleCurrentChange(val) {
  197. this.loading = true
  198. if (this.myHot) {
  199. this.myHot.destroy()
  200. this.myHot = ''
  201. }
  202. this.pageNum = val
  203. this.getLogData()
  204. },
  205. //刷新
  206. refresh() {
  207. this.loading = true
  208. if (this.myHot) {
  209. this.myHot.destroy()
  210. this.myHot = ''
  211. }
  212. this.pageNum = this.currentPage = 1
  213. this.getLogData()
  214. },
  215. //搜索
  216. search(val) {
  217. this.loading = true
  218. if (this.myHot) {
  219. this.myHot.destroy()
  220. this.myHot = ''
  221. }
  222. this.filter = val
  223. this.pageNum = this.currentPage = 1
  224. this.getLogData()
  225. },
  226. //选择时间
  227. checkTime(val) {
  228. this.loading = true
  229. if (this.myHot) {
  230. this.myHot.destroy()
  231. this.myHot = ''
  232. }
  233. this.pageNum = this.currentPage = 1
  234. this.checkTimeArr = val
  235. this.getLogData()
  236. },
  237. //获取log数据
  238. getLogData() {
  239. let param = {
  240. 'startTime': this.checkTimeArr[0],
  241. 'endTime': this.checkTimeArr[1],
  242. 'filter': this.filter,
  243. 'pageNum': this.pageNum,
  244. 'pageSize': this.pageSize,
  245. "ProjId": this.projectId,
  246. "UserId": this.userId
  247. }
  248. getBuildLog(
  249. param
  250. ).then(
  251. result => {
  252. this.logData = result.data.LogList
  253. this.pageCount = result.data.Count
  254. this.loading = false
  255. if (this.pageCount) {
  256. this.noData = false
  257. if (this.myHot) {
  258. this.myHot.loadData(this.delArr(this.logData))
  259. } else {
  260. this.populateHot()
  261. }
  262. } else {
  263. if (this.myHot) {
  264. this.myHot.destroy()
  265. this.myHot = ''
  266. }
  267. this.noData = true
  268. }
  269. }
  270. )
  271. },
  272. mouseOver(event, coords, TD) {
  273. if (coords.col == 6) {
  274. TD.setAttribute('title', this.resrtData[coords.row])
  275. }
  276. },
  277. //处理操作说明
  278. delArr(arr) {
  279. if (arr.length) {
  280. let newArr = this.deepCopy(arr).map(
  281. (item, index) => {
  282. this.resrtData[index] = item.Note
  283. let noteArr = item.Note.split('\n')
  284. if (noteArr.length > 2) {
  285. item.Note = noteArr[0] + '\n' + noteArr[1] + '\n ...'
  286. }
  287. return item
  288. }
  289. )
  290. return newArr
  291. }
  292. },
  293. //生成实例
  294. populateHot() {
  295. var container1 = document.getElementById('log')
  296. var options = {
  297. data: this.delArr(this.logData),
  298. colHeaders: ['时间', '来源', '操作人', '手机', '动作', '对象id', '操作说明'],
  299. manualColumnResize: true,
  300. manualColumnMove: true,
  301. stretchH: 'last',
  302. readOnly: true,
  303. columns: [
  304. {
  305. data: 'CreateTime',
  306. },
  307. {
  308. data: 'Comming',
  309. },
  310. {
  311. data: 'UserName',
  312. },
  313. {
  314. data: 'Phone',
  315. },
  316. {
  317. data: 'Action',
  318. },
  319. {
  320. data: 'projectId'
  321. },
  322. {
  323. data: 'Note',
  324. }
  325. ],
  326. afterOnCellMouseOver: this.mouseOver
  327. }
  328. this.myHot = new Handsontable(container1, options)
  329. // this.getTd()
  330. document.getElementById('hot-display-license-info').style.display = 'none'
  331. },
  332. //处理时间
  333. getNowFormatDate(str) {
  334. var date = new Date(str);
  335. var seperator1 = "-";
  336. var seperator2 = ":";
  337. var month = date.getMonth() + 1;
  338. var strDate = date.getDate();
  339. if (month >= 1 && month <= 9) {
  340. month = "0" + month;
  341. }
  342. if (strDate >= 0 && strDate <= 9) {
  343. strDate = "0" + strDate;
  344. }
  345. var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  346. + " " + date.getHours() + seperator2 + date.getMinutes()
  347. + seperator2 + date.getSeconds();
  348. return currentdate;
  349. },
  350. //工具函数浅复制深拷贝,防止共用存储空间
  351. deepCopy(obj) {
  352. var out = [], i = 0, len = obj.length;
  353. for (; i < len; i++) {
  354. if (obj[i] instanceof Array) {
  355. out[i] = deepcopy(obj[i]);
  356. }
  357. else out[i] = obj[i];
  358. }
  359. return out;
  360. },
  361. //字符处理,将\n转换成<br/>
  362. changeBr(str) {
  363. return str.replace(/\n/g, "<br/>")
  364. }
  365. }
  366. }
  367. </script>
  368. <style lang="less" scoped>
  369. #app {
  370. min-width: 1098px;
  371. min-height: 767px;
  372. position: relative;
  373. overflow-x: auto;
  374. }
  375. #build_log {
  376. width: 100%;
  377. height: 100%;
  378. overflow: hidden;
  379. box-sizing: border-box;
  380. position: relative;
  381. dl {
  382. font-size: 20px;
  383. font-weight: 600;
  384. }
  385. dt {
  386. margin-left: 20px;
  387. line-height: 25px;
  388. }
  389. .search_header {
  390. min-width: 1098px;
  391. padding-top: 0.4rem;
  392. padding-left: 1rem;
  393. padding-right: 1rem;
  394. height: 3rem;
  395. margin-bottom: 1rem;
  396. background-color: #eee;
  397. .dong_dic {
  398. cursor: pointer;
  399. }
  400. .derived_btn {
  401. width: 6rem;
  402. border: 1px solid #777;
  403. text-align: center;
  404. font-size: 0.6rem;
  405. height: 1.6rem;
  406. line-height: 1.6rem;
  407. cursor: pointer;
  408. background-color: #ccc;
  409. border-radius: 0.1rem;
  410. float: right;
  411. margin-right: 1rem;
  412. margin-top: 0.2rem;
  413. .icon-excelwenjian {
  414. font-size: 1rem;
  415. margin-bottom: -0.1rem;
  416. }
  417. .excel {
  418. font-size: 12px;
  419. display: inline-block;
  420. line-height: 1.4rem;
  421. }
  422. }
  423. }
  424. .log_view {
  425. position: absolute;
  426. left: 0;
  427. padding-left: 1rem;
  428. padding-right: 1rem;
  429. top: 3rem;
  430. bottom: 3rem;
  431. right: 0;
  432. overflow-y: auto;
  433. box-sizing: border-box;
  434. }
  435. .log_page {
  436. position: absolute;
  437. bottom: 0;
  438. width: 100%;
  439. right: 0;
  440. height: 3rem;
  441. background-color: #fff;
  442. }
  443. }
  444. </style>