widget.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. <template>
  2. <!-- 在线监控 -->
  3. <div class="scada-monitor" style="padding: 0">
  4. <tf-legend class="legend_dept" label="条件搜索" isopen="true" title="描述站位。">
  5. <el-row>
  6. <div class="innerType">
  7. <el-select
  8. v-model="type"
  9. size="small"
  10. clearable
  11. placeholder="请选择设备类型"
  12. style="float: left; width: 46%; margin-right: 4%;"
  13. >
  14. <el-option key="1" label="水厂" value="1" />
  15. <el-option key="2" label="管网" value="2" />
  16. <!-- <el-option key="3" label="泵站" value="3" />
  17. <el-option key="4" label="泵组" value="4" />
  18. <el-option key="5" label="污水厂" value="5" /> -->
  19. </el-select>
  20. <el-select
  21. v-model="deviceType"
  22. size="small"
  23. clearable
  24. multiple
  25. collapse-tags
  26. placeholder="请选择设备类型"
  27. style="float: left;margin-right: 4%; width: 50%;"
  28. >
  29. <el-option v-for="item in deviceTypes" :key="item.ccode" :label="item.cname" :value="item.ccode" />
  30. </el-select>
  31. </div>
  32. <el-input
  33. v-model="querySiteName"
  34. class="helpInput"
  35. style="float: left; width: calc(100% - 46px); margin: 6px 0"
  36. clearable
  37. size="small"
  38. placeholder="请输入设备名称"
  39. >
  40. <template slot-scope="{ item }">
  41. <i class="el-icon-location" />
  42. <span class="name">{{ item.value }}</span>
  43. </template>
  44. </el-input>
  45. <el-button
  46. style="
  47. float: left;
  48. height: 32px;
  49. margin-top: 6px;
  50. border-radius: 0px 4px 4px 0px;
  51. "
  52. type="primary"
  53. icon="el-icon-search"
  54. size="small"
  55. plain
  56. @click="querySite"
  57. />
  58. </el-row>
  59. </tf-legend>
  60. <tf-legend
  61. class="legend_dept"
  62. label="监测列表"
  63. isopen="true"
  64. title="描述站位。"
  65. style="height: calc(100% - 124px); padding: 0"
  66. :can-change="false"
  67. >
  68. <div style="position: absolute;top: -28px;right: 20px;" class='warning'>
  69. <el-switch v-model="warning" active-text="关闭报警" inactive-text="开启报警"></el-switch>
  70. <video autoplay='autoplay' loop='loop' v-if='existWarnig&&warning' ref="videoMsg" :src="mp3" style="display: none" />
  71. </div>
  72. <el-table v-loading="tableLoading" height="calc(100% - 26px)" :data="siteDataTable" stripe style="width: 100%">
  73. <el-table-column prop="site" label="设备名称" align="center" show-overflow-tooltip />
  74. <el-table-column fixed="right" label="操作" width="120" align="center">
  75. <template slot-scope="scope">
  76. <el-button type="text" size="small" @click="goto(scope.row)">查看</el-button>
  77. <el-button type="text" size="small" @click="getSiteHistroty(scope.row)">趋势图</el-button>
  78. <el-button v-if="scope.row.isCraft" type="text" size="small" @click="watchCraft(scope.row)">工艺图</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <div style="margin-top: 8px">
  83. <div style="float: left; width: 80%">
  84. <el-pagination
  85. ref="pagination"
  86. background
  87. layout="total, sizes, prev, next"
  88. :total="total"
  89. :page-sizes="[20, 30, 50, 80, 160]"
  90. @current-change="listRefersh(resData)"
  91. @size-change="listRefersh(resData)"
  92. />
  93. </div>
  94. <div style="float: left; width: 20%" class="el-pagination is-background">
  95. <span ref="pageLength" style="font-size: 13px" class="el-pagination__total">1/1 页</span>
  96. </div>
  97. <div style="clear: both" />
  98. </div>
  99. </tf-legend>
  100. <el-dialog title="工艺图" :visible.sync="craftVisible" top="50px" @close="craftClose">
  101. <div ref="craft" />
  102. </el-dialog>
  103. <ScadaMapCom
  104. ref="scadaMapComAll"
  105. :map-view="mapView"
  106. :site-data="siteData"
  107. :isscadashow="true"
  108. :ismapok="false"
  109. maplayer-name="scadaAll"
  110. />
  111. </div>
  112. </template>
  113. <script>
  114. import tfLegend from '@/views/zhpt/common/Legend'
  115. import TableItem from '@/components/Table'
  116. import request from '@/utils/request'
  117. import mp3 from '@/assets/images/home/msg.mp3';
  118. import { getScadaMonitor, getScadaListAll, queryMonitorHistory } from '@/api/SCADAInfoApi'
  119. import Echarts from 'echarts'
  120. import { TF_craft } from './createSiteCraft'
  121. import { craftConfig, deviceConfig, deviceStateConfig } from './craftConfig'
  122. import { getSysCommonCode } from '@/api/dataCenter'
  123. import ScadaMapCom from '@/views/zhpt/scada/scadaMonitorAll/components/scadaMapCom'
  124. import MonitorCurve from './components/monitorcurve'
  125. export default {
  126. name: 'ScadaMonitor',
  127. components: { TableItem, tfLegend, Echarts, MonitorCurve, ScadaMapCom },
  128. props: { data: Object },
  129. data() {
  130. return {
  131. // 输入框
  132. querySiteName: '',
  133. tableLoading: false,
  134. // 列表
  135. siteDataTable: [],
  136. total: 0,
  137. warning:true,//报警开关
  138. mp3:mp3,
  139. existWarnig:false,//是否存在报警
  140. // 工艺图
  141. craftVisible: false,
  142. // 测站历史
  143. historyLoading: false,
  144. siteVisible: false,
  145. siteTitle: '',
  146. siteType: '',
  147. sites: [],
  148. timss: [],
  149. siteHistoryDataTable: [],
  150. total2: 0,
  151. dontShow: true,
  152. resData: [],
  153. deviceTypes: [],
  154. type: '', // 1=水厂,2=管网
  155. // deviceType: ['1', '2', '3'], // 默认展示流量计 压力计 水厂
  156. deviceType: [], // 默认展示流量计 压力计 水厂
  157. mapView: {}, // 地图
  158. siteData: [], // 时间监控站点
  159. queryTimeOut:null,
  160. // tip 弹窗
  161. layer: undefined,
  162. hitlayer: undefined,
  163. divs: [],
  164. mapClick: undefined
  165. }
  166. },
  167. computed: {
  168. sidePanelOn() {
  169. return this.$store.state.map.P_editableTabsValue
  170. }
  171. },
  172. watch: {
  173. sidePanelOn(newTab, oldTab) {
  174. if (newTab == oldTab) return
  175. if (newTab == 'scadaMonitorAll') {
  176. this.$nextTick(() => {
  177. // if(this.layer){
  178. // this.layer.visible = true
  179. // }
  180. const scadalayer = this.data.mapView.map.findLayerById('scadaAll')
  181. const scadahitlayer = this.data.mapView.map.findLayerById('scadaAllhit')
  182. if (scadalayer !== null && scadalayer !== undefined) {
  183. scadalayer.visible = true
  184. }
  185. if (scadahitlayer !== null && scadahitlayer !== undefined) {
  186. scadahitlayer.visible = true
  187. }
  188. if(this.$refs.scadaMapComAll&&this.$refs.scadaMapComAll.divs){
  189. for (var i = 0, il =this.$refs.scadaMapComAll.divs, ii = il.length; i < ii; i++) {
  190. il[i].div.style.display = ''
  191. }
  192. }
  193. this.addWatch&&this.addWatch()
  194. if (this.ids&&this.ids.length > 0) this.loadRealTimeSiteValue()
  195. })
  196. }
  197. if (oldTab == 'scadaMonitorAll') {
  198. const scadalayer = this.data.mapView.map.findLayerById('scadaAll')
  199. const scadahitlayer = this.data.mapView.map.findLayerById('scadaAllhit')
  200. if (scadalayer !== null && scadalayer !== undefined) {
  201. scadalayer.visible = false
  202. }
  203. if (scadahitlayer !== null && scadahitlayer !== undefined) {
  204. scadahitlayer.visible = false
  205. }
  206. if(this.$refs.scadaMapComAll&&this.$refs.scadaMapComAll.divs){
  207. for (var i = 0, il = this.$refs.scadaMapComAll.divs, ii = il.length; i < ii; i++) {
  208. il[i].div.style.display = 'none'
  209. }
  210. }
  211. if (this.watch) {
  212. this.watch.remove()
  213. this.watch = undefined
  214. }
  215. if (this.timeOut) window.clearTimeout(this.timeOut)
  216. }
  217. }
  218. },
  219. created() {
  220. getSysCommonCode({ pCid: '53400' }).then((res) => {
  221. this.deviceTypes = res.result[0].codeList
  222. // 剔除噪音监测仪
  223. this.deviceTypes.splice(this.deviceTypes.findIndex(item => item.ccode === '4'), 1)
  224. })
  225. },
  226. mounted() {
  227. var view = (this.mapView = this.data.mapView)
  228. this.floatDiv = view.TF_floatPanel
  229. const scadalayer = view.map.findLayerById('scadaAll')
  230. const scadahitlayer = view.map.findLayerById('scadaAllhit')
  231. if (scadalayer !== null && scadalayer !== undefined) {
  232. scadalayer.visible = false
  233. }
  234. if (scadahitlayer !== null && scadahitlayer !== undefined) {
  235. scadahitlayer.visible = false
  236. }
  237. this.querySite()
  238. },
  239. destroyed() {
  240. this.siteData = []
  241. if (this.queryTimeOut) window.clearTimeout(this.queryTimeOut)
  242. // this.clearSiteDiv();
  243. var view = this.mapView
  244. const scadalayer = view.map.findLayerById('scadaAll')
  245. const scadahitlayer = view.map.findLayerById('scadaAllhit')
  246. if (scadalayer !== null && scadalayer !== undefined) {
  247. scadalayer.visible = true
  248. }
  249. if (scadahitlayer !== null && scadahitlayer !== undefined) {
  250. scadahitlayer.visible = true
  251. }
  252. //
  253. // view.map.remove(this.hitlayer);
  254. },
  255. methods: {
  256. querySite() {
  257. const that = this
  258. var pages = that.$refs.pagination
  259. const data = { name: that.querySiteName }
  260. that.tableLoading = true
  261. if (that.type != '') { Object.assign(data, { type: that.type }) }
  262. if (that.deviceType != '') {
  263. // Object.assign(data, { deviceType: that.deviceType }); //单个
  264. Object.assign(data, { deviceTypeIds: that.deviceType.join(',') }) // 单个
  265. }
  266. var modulesFiles = require.context('./images', true, /\.png$/)
  267. getScadaMonitor(data).then((res) => {
  268. that.siteData = []
  269. pages.internalCurrentPage = 1
  270. if (res.code == 1) {
  271. // res = res.result.filter((item) => {
  272. // return item.allocations;
  273. // });
  274. var result = res.result
  275. if (result) {
  276. this.existWarnig=false;
  277. this.resData = result // 保存所有站点数据,用于分页时调用
  278. this.total = result.length
  279. for (var i = 0, ii = result.length; i < ii; i++) {
  280. var site = result[i]
  281. // 判断是否存在实时监控数据,数据类型
  282. let isError = false // 是否报警
  283. let monitorModel = {}
  284. if (site.allocations) {
  285. const allocationsAry = site.allocations.sort(compare('sortNumber'))
  286. if (allocationsAry.length > 0) {
  287. monitorModel = allocationsAry[0]
  288. }
  289. const allocationsFilter = site.allocations.filter(item => {
  290. return item.isAlarm == '1'
  291. })
  292. if (allocationsFilter.length > 0) {
  293. isError = true;
  294. this.existWarnig=true;
  295. }
  296. }
  297. // 图片路径
  298. const deviceTypeImg = modulesFiles('./' + (isError ? deviceConfig[site.deviceType].image_red : deviceConfig[site.deviceType].image))
  299. // console.log("图片路径:"+deviceTypeImg)
  300. that.siteData.push({
  301. id: site.id,
  302. site: site.name,
  303. x: site.longitude,
  304. y: site.latitude,
  305. isCraft: false,
  306. icon: deviceTypeImg,
  307. monitorModel: monitorModel,
  308. deviceType:site.deviceType,
  309. scadaEntity: site
  310. }) // site.iscraft == '1' })
  311. }
  312. this.listRefersh(result)
  313. } else {
  314. that.siteDataTable = []
  315. this.$refs.pageLength.innerHTML = '0/0 页'
  316. }
  317. }
  318. this.tableLoading = false
  319. })
  320. function compare(key) {
  321. return function(value1, value2) {
  322. var val1 = value1[key]
  323. var val2 = value2[key]
  324. return val1 - val2
  325. }
  326. }
  327. //定时更新报警内容
  328. if(!this.queryTimeOut){
  329. this.queryTimeOut = window.setTimeout(() => {
  330. window.clearTimeout(this.queryTimeOut);
  331. this.queryTimeOut=null;
  332. this.querySite()
  333. }, 1000 * 60 * 1)
  334. }
  335. },
  336. listRefersh(res) {
  337. console.log('前端分页')
  338. // this.clearSiteDiv();
  339. var pages = this.$refs.pagination
  340. var current = pages.internalCurrentPage
  341. var size = pages.internalPageSize
  342. var sites = this.siteData
  343. var firstIndex = (current - 1) * size
  344. var showSites = (this.siteDataTable = sites.slice(
  345. firstIndex,
  346. firstIndex + size
  347. ))
  348. this.$refs.pageLength.innerHTML =
  349. current + '/' + Math.ceil(sites.length / size) + ' 页'
  350. },
  351. loadRealTimeSiteValue() {
  352. const data = { name: this.querySiteName }
  353. if (this.deviceType != '') { Object.assign(data, { deviceType: this.deviceType }) }
  354. getScadaMonitor(data).then((res) => {
  355. if (res.code == 1) {
  356. res = res.result.filter((item) => {
  357. return item.allocations
  358. })
  359. setValue(res)
  360. } else {
  361. this.$message.error('获取测站指标失败!' + res.message)
  362. console.log(res)
  363. }
  364. })
  365. var setValue = (res) => {
  366. var index = this.siteIndex
  367. for (var item in res) {
  368. if (!index.hasOwnProperty(res[item].id)) continue
  369. var di = index[res[item].id].children
  370. var dr = res[item].allocations
  371. for (const item2 in dr) {
  372. for (var i = 0, ii = di.length; i < ii; i++) {
  373. var ddi = di[i]
  374. var id = ddi.getAttribute('data')
  375. if (dr[item2].variableCode != id) continue
  376. var ddr = dr[item2].scada
  377. if (!ddr) continue
  378. var value = ddr.value
  379. ddi.children[1].innerHTML = value == 'null' ? '-' : value
  380. ddi.children[3].classList.value =
  381. 'scadaLayer-float-arrow' + (ddr.mark || 1)
  382. }
  383. }
  384. }
  385. this.timeOut = window.setTimeout(
  386. (_) => this.loadRealTimeSiteValue(),
  387. 1000 * 60 * 1
  388. )
  389. }
  390. },
  391. goto(row) {
  392. if (row.x) {
  393. var mapView = this.mapView
  394. mapView.center = {
  395. x: row.x,
  396. y: row.y,
  397. spatialReference: mapView.spatialReference
  398. }
  399. mapView.zoom = 6
  400. } else {
  401. this.$message('此测站无坐标信息')
  402. }
  403. },
  404. getSiteHistroty(e) {
  405. this.$refs.scadaMapComAll.getSiteHistroty(e)
  406. // var stid, zbx;
  407. // stid = e.id;
  408. // this.siteVisible = true;
  409. // this.historyLoading = true;
  410. // var date = new Date();
  411. // var date1 = new Date(date.getTime() - 1000 * 60 * 60 * 24);
  412. // this.timss = [
  413. // [date1.getFullYear(), date1.getMonth() + 1, date1.getDate()].join("-") +
  414. // " 00:00:00",
  415. // [date.getFullYear(), date.getMonth() + 1, date.getDate()].join("-") +
  416. // " 00:00:00",
  417. // ];
  418. // getScadaMonitor({ deviceId: stid }).then((res) => {
  419. // if (res.code == 1) {
  420. // res = res.result[0];
  421. // this.selectSite = res;
  422. // var index = (this.selectZBXIndex = {});
  423. // let allocations = res.allocations.sort((a, b) => { return parseInt(a.sortNumber) - parseInt(b.sortNumber) })
  424. // this.sites = allocations.map((e) => {
  425. // index[e.variableCode] = [e.displayName, e.unit];
  426. // return { value: e.variableCode, label: e.displayName };
  427. // });
  428. // this.siteType = zbx || this.sites[0].value;
  429. // this.chart = Echarts.init(this.$refs.chart);
  430. // idDone();
  431. // } else {
  432. // this.$message.error("获取测站失败!");
  433. // console.error(res);
  434. // this.siteVisible = false;
  435. // }
  436. // });
  437. // var done = 0;
  438. // var idDone = () => {
  439. // if (++done == 1) this.showResult();
  440. // };
  441. },
  442. /**
  443. * @dscription 显示 Scada 监测历史
  444. */
  445. showScadaHistory(e) {
  446. this.siteVisible = true
  447. this.getSiteHistroty(e)
  448. },
  449. /**
  450. * @description scada 监测历史
  451. */
  452. showResult() {
  453. if (!this.timss) return this.$message.error('请选择时间范围')
  454. this.historyLoading = true
  455. this.$refs.pagination2.internalCurrentPage = 1
  456. this.getAllData()
  457. this.siteHistiryQuery = [
  458. this.selectZBXIndex[this.siteType][0],
  459. this.timss
  460. ]
  461. this.pagRefersh()
  462. },
  463. getAllData() {
  464. var datt = this.selectZBXIndex[this.siteType]
  465. var times = this.timss
  466. var parm = this.siteType.replace(/\#/g, '%23')
  467. const params = {
  468. code: parm,
  469. start: times[0],
  470. end: times[1],
  471. isPage: false
  472. }
  473. getScadaListAll(params).then((res) => {
  474. var chart = this.chart
  475. chart.clear()
  476. if (res.code == 1) {
  477. res = res.result.records
  478. this.total2 = res.length
  479. var dontShow = this.dontShow
  480. var dataX = []
  481. var dataY = []
  482. var max = -Infinity
  483. var min = Infinity
  484. var Xmax = -Infinity
  485. var Xmin = Infinity
  486. var d
  487. var symbol = 'none'
  488. for (var i = 0, ii = res.length; i < ii; i++) {
  489. var v = parseFloat(res[i].value)
  490. if (dontShow && v == -9999) continue
  491. // var x = res[i].scadaTime.split(' ')[0]
  492. const x = res[i].scadaTime.substring(5)
  493. dataX.push(x)
  494. dataY.push(v)
  495. // if (v < min) min = v
  496. // if (v > max) max = v
  497. // if (x < Xmin) Xmin = x
  498. // if (x > Xmax) Xmax = x
  499. }
  500. // if (ii <= 1) symbol = Xmin = Xmax = max = min = undefined
  501. // else d = max - min, [max, min] = [max + d * 0.2, min - d * 0.2].map(e => parseFloat(e).toFixed(2))
  502. var [type, unit] = datt
  503. chart.setOption({
  504. title: {
  505. text: type,
  506. left: 'center',
  507. subtext: times[0] + '至' + times[1]
  508. },
  509. color: 'rgb(45, 116, 231)',
  510. grid: { left: '50px', right: '50px', bottom: '80px' },
  511. // dataZoom: [{ minSpan: 1, type: 'slider', labelFormatter: (i) => {
  512. // var date = new Date(i)
  513. // var time = [date.getHours(), date.getMinutes()]
  514. // if (time[0] < 10) time[0] = '0' + time[0]
  515. // if (time[1] < 10) time[1] = '0' + time[1]
  516. // return [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-') + '\n' + time.join(':')
  517. // } }],
  518. toolbox: { feature: { saveAsImage: {}}},
  519. tooltip: {
  520. trigger: 'axis',
  521. formatter(a) {
  522. return (
  523. '记录时间:' +
  524. a[0].axisValue +
  525. '<br>' +
  526. type +
  527. ' ' +
  528. a[0].data +
  529. ' ' +
  530. unit
  531. )
  532. }
  533. },
  534. xAxis: [
  535. {
  536. name: '日期',
  537. type: 'category',
  538. data: dataX,
  539. axisTick: {
  540. show: false
  541. },
  542. axisLine: {
  543. show: false
  544. }
  545. }
  546. ],
  547. yAxis: [{ name: unit, type: 'value' }],
  548. dataZoom: [
  549. { type: 'inside', start: 0, end: 100 },
  550. { start: 0, end: 100 }
  551. ],
  552. series: [
  553. {
  554. type: 'line',
  555. symbol,
  556. smooth: true,
  557. data: dataY,
  558. markPoint: {
  559. data: [
  560. { type: 'max', name: 'Max' },
  561. { type: 'min', name: 'Min' }
  562. ]
  563. },
  564. markLine: {
  565. data: [
  566. {
  567. type: 'average',
  568. name: 'Avg',
  569. label: {
  570. show: true,
  571. formatter: '平均值:\n {c}'
  572. }
  573. }
  574. ]
  575. }
  576. }
  577. ]
  578. })
  579. } else {
  580. this.$message.error('获取指标历史失败!' + res.message)
  581. console.error(res)
  582. }
  583. this.historyLoading = false
  584. })
  585. },
  586. pagRefersh() {
  587. this.tableLoading = true
  588. var pages = this.$refs.pagination2
  589. var parm = this.siteType.replace(/\#/g, '%23')
  590. var [zbx, times] = this.siteHistiryQuery
  591. const params = {
  592. code: parm,
  593. start: times[0],
  594. end: times[1],
  595. current: pages.internalCurrentPage,
  596. size: pages.internalPageSize
  597. }
  598. queryMonitorHistory(params).then((res) => {
  599. if (res.code == 1) {
  600. res = res.result
  601. this.siteHistoryDataTable = res.records
  602. this.$refs.pageLength2.innerHTML =
  603. (pages.internalCurrentPage || 1) +
  604. '/' +
  605. Math.ceil(parseInt(res.total) / pages.internalPageSize) +
  606. ' 页'
  607. } else {
  608. this.$message.error(res.message)
  609. this.siteHistoryDataTable = []
  610. this.$refs.pageLength2.innerHTML = '1/1 页'
  611. }
  612. this.tableLoading = false
  613. })
  614. },
  615. watchCraft(row) {
  616. var config = craftConfig[row.id]
  617. if (config) {
  618. this.craftVisible = true
  619. var image = new Image()
  620. var modulesFiles = require.context('./images', true, /\.png$/)
  621. image.src = modulesFiles('./' + config.craftImage)
  622. image.onload = () => {
  623. var craft = TF_craft({
  624. div: this.$refs.craft,
  625. image: image,
  626. config: config.config,
  627. id: row.id
  628. })
  629. this.craftRealTime(row.id, craft.index)
  630. craft.divs.map((e) => (e.onclick = this.getSiteHistroty))
  631. }
  632. } else this.$message.error('工艺图未配置')
  633. },
  634. craftRealTime(id, index) {
  635. request({
  636. url: '/gis/customDisplay/getSiteInfos?stids=' + id,
  637. method: 'post'
  638. }).then((res) => {
  639. if (res.code == 1 && (res = res.result[id])) {
  640. for (var item in res) {
  641. if (!index.hasOwnProperty(item)) continue
  642. index[item].innerHTML = res[item].realVal
  643. }
  644. this.craftTimeOut = window.setTimeout(() => {
  645. this.craftRealTime(id, index)
  646. }, 1000 * 60 * 1)
  647. } else {
  648. this.$message.error('获取测站指标失败!' + res.message)
  649. console.log(res)
  650. }
  651. })
  652. },
  653. craftClose() {
  654. if (this.craftTimeOut) window.clearTimeout(this.craftTimeOut)
  655. },
  656. /**
  657. * @description 判断数组是否为空
  658. */
  659. arrayIsNull(aryList) {
  660. return (typeof (aryList) === 'undefined' || aryList == null || aryList.length == 0)
  661. },
  662. /**
  663. * @description 判断字符串是否为空
  664. */
  665. strIsNull(strVal) {
  666. strVal = strVal || ''
  667. return (typeof (strVal) === 'undefined' || strVal == null || strVal == '')
  668. }
  669. }
  670. }
  671. </script>
  672. <style lang='scss' scoped>
  673. .innerType {
  674. display: flex;
  675. width: 100%;
  676. // border: 1px red solid;
  677. }
  678. .legend_dept{
  679. /deep/ .el-table tr {
  680. background-color: #FFFFFF;
  681. height: auto;
  682. }
  683. }
  684. </style>