DataDetails.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. <template>
  2. <div>
  3. <el-breadcrumb separator-class="el-icon-arrow-right" :class="'el-icon-arrow-right '+ (flag.flag == false ? 'breadcrumb_tab' : '')">
  4. <el-breadcrumb-item :to="{ path: '/index/cbd' }">物联网虫情测报</el-breadcrumb-item>
  5. <el-breadcrumb-item>数据详情</el-breadcrumb-item>
  6. </el-breadcrumb>
  7. <div class="equipInfo">
  8. <div class="equipMsg">
  9. <span>设备ID:{{this.$route.query.id}}</span>
  10. <span>设备名称:{{this.$route.query.name || '无'}}</span>
  11. <span>位置:{{this.$route.query.address || "无"}}</span>
  12. </div>
  13. <DateSearch @dateChange="dateChange" ref="setSelected"></DateSearch>
  14. </div>
  15. <div class="ctrl-check">
  16. <el-button type="primary" size="mini" @click="refresh">刷新</el-button>
  17. <!-- <el-button type="primary" size="mini" @click="lookSIMCode('sim')">SIM 卡</el-button> -->
  18. </div>
  19. <!-- 统计图 -->
  20. <el-row :gutter="10">
  21. <el-col :md="24" :lg="15">
  22. <el-card class="box-card">
  23. <div class="charts">
  24. <template v-if="Object.keys(options).length>0">
  25. <highcharts :options="options"></highcharts>
  26. </template>
  27. <template v-else>
  28. <div style="text-align:center;font-size:20px;line-height:360px">暂无数据</div>
  29. </template>
  30. </div>
  31. </el-card>
  32. </el-col>
  33. <el-col :md="24" :lg="9">
  34. <el-card class="box-card">
  35. <el-row :gutter="10">
  36. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  37. <div class="equipStatus">
  38. <div class="equipIcon">
  39. <img src="@/assets/images/forecasting/cbd/staticIcon1.png" alt />
  40. </div>
  41. <div class="equipParams">
  42. <strong>{{equipStatus.device_status?"在线":"离线"}}</strong>
  43. <p>在线状态</p>
  44. </div>
  45. </div>
  46. </el-col>
  47. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  48. <div class="equipStatus">
  49. <div class="equipIcon">
  50. <img src="@/assets/images/forecasting/cbd/staticIcon2.png" alt />
  51. </div>
  52. <div class="equipParams">
  53. <strong>{{equipStatus.ts?"时控":"光控"}}</strong>
  54. <p>定时模式</p>
  55. </div>
  56. </div>
  57. </el-col>
  58. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  59. <div class="equipStatus">
  60. <div class="equipIcon">
  61. <img src="@/assets/images/forecasting/cbd/staticIcon3.png" alt />
  62. </div>
  63. <div class="equipParams">
  64. <strong>{{equipStatus.gs?"落虫":"排水"}}</strong>
  65. <p>通道状态</p>
  66. </div>
  67. </div>
  68. </el-col>
  69. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  70. <div class="equipStatus">
  71. <div class="equipIcon">
  72. <img src="@/assets/images/forecasting/cbd/staticIcon4.png" alt />
  73. </div>
  74. <div class="equipParams">
  75. <strong>{{equipStatus.hs?"加热":"正常"}}</strong>
  76. <p>加热状态</p>
  77. </div>
  78. </div>
  79. </el-col>
  80. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  81. <div class="equipStatus">
  82. <div class="equipIcon">
  83. <img src="@/assets/images/forecasting/cbd/staticIcon5.png" alt />
  84. </div>
  85. <div class="equipParams">
  86. <strong>{{equipStatus.upds?"打开":"关闭"}}</strong>
  87. <p>上仓门</p>
  88. </div>
  89. </div>
  90. </el-col>
  91. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  92. <div class="equipStatus">
  93. <div class="equipIcon">
  94. <img src="@/assets/images/forecasting/cbd/staticIcon7.png" alt />
  95. </div>
  96. <div class="equipParams">
  97. <strong>{{equipStatus.csq}}</strong>
  98. <p>信号强度</p>
  99. </div>
  100. </div>
  101. </el-col>
  102. <el-col :xs="12" :sm="12" :md="6" :lg="12">
  103. <div class="equipStatus">
  104. <div class="equipIcon">
  105. <img src="@/assets/images/forecasting/cbd/staticIcon8.png" alt />
  106. </div>
  107. <div class="equipParams">
  108. <strong>{{equipStatus.dver}}</strong>
  109. <p>设备版本</p>
  110. </div>
  111. </div>
  112. </el-col>
  113. </el-row>
  114. </el-card>
  115. </el-col>
  116. </el-row>
  117. <div class="dataTableSearch">
  118. <div>
  119. <!-- <el-button type="primary" size="mini">导出</el-button> -->
  120. </div>
  121. </div>
  122. <el-card class="box-card" v-if="showControl">
  123. <el-table :data="tableData" stripe style="width: 100%">
  124. <el-table-column
  125. v-for="(item,index) in tableHeadTxt"
  126. :key="index"
  127. :prop="item[1]"
  128. :label="item[0]"
  129. >
  130. <template slot-scope="scope">{{scope.row[scope.column.property]}}</template>
  131. </el-table-column>
  132. </el-table>
  133. <el-pagination
  134. background
  135. layout="prev, pager, next"
  136. :total="total"
  137. :current-page="queryInfo.page"
  138. @current-change="changePage"
  139. ></el-pagination>
  140. </el-card>
  141. <!-- SIM卡对话框 -->
  142. <el-dialog title="SIM卡" :visible.sync="simCodeVisible" width="30%">
  143. <template>
  144. <el-tabs v-loading="simLoading" element-loading-text="数据请求中" v-model="activeName" @tab-click="handleClick">
  145. <el-tab-pane label="SIM卡流量" name="sim">
  146. <div class="simCodeBox">
  147. <div>
  148. <span class="simCodeTitle">ICCID:</span>
  149. <div>{{sim.iccid}}</div>
  150. </div>
  151. <div>
  152. <span class="simCodeTitle">状态:</span>
  153. <div>{{sim.account_status | simStatus}}</div>
  154. </div>
  155. <div>
  156. <span class="simCodeTitle">套餐:</span>
  157. <div>
  158. <el-progress :show-text="false" :percentage="100"></el-progress>
  159. </div>
  160. <span>{{sim.data_plan}}MB</span>
  161. </div>
  162. <div>
  163. <span class="simCodeTitle">已用流量:</span>
  164. <div>
  165. <template v-if="!isNaN(data_usage_Per)">
  166. <el-progress :show-text="false" :percentage="data_usage_Per"></el-progress>
  167. </template>
  168. </div>
  169. <span>{{sim.data_usage}}MB</span>
  170. </div>
  171. <div>
  172. <span class="simCodeTitle">剩余流量:</span>
  173. <div>
  174. <template v-if="!isNaN(data_balance_per)">
  175. <el-progress :show-text="false" :percentage="data_balance_per"></el-progress>
  176. </template>
  177. </div>
  178. <span>{{sim.data_balance}}MB</span>
  179. </div>
  180. <div>
  181. <span class="simCodeTitle">到期时间:</span>
  182. <div>{{sim.expiry_date*1000 | formatTime}}</div>
  183. </div>
  184. <div class="operateBtn">
  185. <el-button size="mini" @click="simCodeVisible=false">关闭</el-button>
  186. </div>
  187. </div>
  188. </el-tab-pane>
  189. <el-tab-pane label="海康SIM卡流量" name="hksim" v-if="showHksimFlag">
  190. <div class="simCodeBox">
  191. <div>
  192. <span class="simCodeTitle">ICCID:</span>
  193. <div>{{hksim.iccid}}</div>
  194. </div>
  195. <div>
  196. <span class="simCodeTitle">状态:</span>
  197. <div>{{hksim.account_status | simStatus}}</div>
  198. </div>
  199. <div>
  200. <span class="simCodeTitle">套餐:</span>
  201. <div>
  202. <el-progress :show-text="false" :percentage="100"></el-progress>
  203. </div>
  204. <span>{{hksim.data_plan}}MB</span>
  205. </div>
  206. <div>
  207. <span class="simCodeTitle">已用流量:</span>
  208. <div>
  209. <template v-if="!isNaN(hkdata_usage_Per)">
  210. <el-progress :show-text="false" :percentage="hkdata_usage_Per"></el-progress>
  211. </template>
  212. </div>
  213. <span>{{hksim.data_usage}}MB</span>
  214. </div>
  215. <div>
  216. <span class="simCodeTitle">剩余流量:</span>
  217. <div>
  218. <template v-if="!isNaN(hkdata_balance_per)">
  219. <el-progress :show-text="false" :percentage="hkdata_balance_per"></el-progress>
  220. </template>
  221. </div>
  222. <span>{{hksim.data_balance}}MB</span>
  223. </div>
  224. <div>
  225. <span class="simCodeTitle">到期时间:</span>
  226. <div>{{hksim.expiry_date*1000 | formatTime}}</div>
  227. </div>
  228. <div>
  229. <span class="simCodeTitle">更换ICCID:</span>
  230. <div>
  231. <el-input type="number" v-model="hksiminp" placeholder="请输入ICCID"></el-input>
  232. </div>
  233. </div>
  234. <div class="operateBtn">
  235. <el-button type="primary" size="mini" @click="changeHkSim">确定</el-button>
  236. <el-button size="mini" @click="simCodeVisible=false">取消</el-button>
  237. </div>
  238. </div>
  239. </el-tab-pane>
  240. </el-tabs>
  241. </template>
  242. </el-dialog>
  243. </div>
  244. </template>
  245. <script>
  246. import DateSearch from '@/components/DateSearch'
  247. export default {
  248. props: {
  249. flag: {
  250. flag: Boolean,
  251. siteID: Number
  252. },
  253. },
  254. data() {
  255. return {
  256. isOne:true,
  257. isSelect:true,
  258. isSelectNian:true,
  259. isSelectYear:true,
  260. // 请求sim卡获取到需要回显的数据
  261. simLoading:true, //sim卡加载loading
  262. showHksimFlag:true, //是否显示hksim卡标识
  263. simCodeVisible: false,
  264. simFlag:true, //是否重复加载hksim卡
  265. sim: {
  266. iccid: '',
  267. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  268. data_plan: 0, //套餐大小
  269. data_usage: 0, //当月用量
  270. data_balance: 0, //剩余流量
  271. expiry_date: 0 //到期日期
  272. },
  273. hksimFlag:true, //是否重复加载hksim卡
  274. hksim: {
  275. iccid: '',
  276. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  277. data_plan: 0, //套餐大小
  278. data_usage: 0, //当月用量
  279. data_balance: 0, //剩余流量
  280. expiry_date: 0 //到期日期
  281. },
  282. hksiminp:'',
  283. timeRange: '', //时间范围picker
  284. btnSelected: null, //时间按钮高亮
  285. dataList: [], //所有数据
  286. options: {},
  287. // 状态信息
  288. equipStatus: {},
  289. // 统计图表信息
  290. equipChartData: [],
  291. //总数据条数
  292. total: 0,
  293. // 动态表头
  294. tableHeadTxt: [
  295. ['环境温度(°C)', 'at'],
  296. ['环境湿度(%)', 'ah'],
  297. ['加热仓温度(°C)', 'hrt'],
  298. ['雨控状态', 'rps'],
  299. ['温控状态', 'tps'],
  300. ['光控状态', 'lps'],
  301. ['电池电压(V)', 'vbat'],
  302. ['上报时间', 'addtime']
  303. ],
  304. // 表格数据
  305. tableData: [],
  306. timeRange: '',
  307. queryInfo: {
  308. begin: '',
  309. end: '',
  310. e_id: this.$route.query.e_id,
  311. page: 1
  312. },
  313. //图表实时否有数据
  314. isEchartData: true,
  315. //表格和图表按钮样式切换参数
  316. display: '0', //0代表表格、1代表图表
  317. // 表格和图表显示切换控制
  318. showControl: true,
  319. //echarts图表参数
  320. echartOptions: [],
  321. // 动态表头
  322. tableHead: [],
  323. // 表格数据
  324. hisData: [],
  325. simCodeDialogVisible: false,
  326. f_id: '',
  327. // sim卡切换状态
  328. activeName: 'sim'
  329. }
  330. },
  331. filters: {
  332. simStatus(val) {
  333. switch (val) {
  334. case 0:
  335. return '未知'
  336. case 1:
  337. return '测试期'
  338. case 2:
  339. return '沉默期'
  340. case 3:
  341. return '使用中'
  342. case 4:
  343. return '停机'
  344. case 5:
  345. return '停机保号'
  346. case 6:
  347. return '预销号'
  348. case 7:
  349. return '销号'
  350. }
  351. }
  352. },
  353. computed: {
  354. data_usage_Per: function () {
  355. let aa = Number(this.sim.data_usage / this.sim.data_plan) * 100
  356. return aa
  357. },
  358. data_balance_per: function () {
  359. let aa = Number(this.sim.data_balance / this.sim.data_plan) * 100
  360. return aa
  361. },
  362. hkdata_usage_Per: function () {
  363. let aa = Number(this.hksim.data_usage / this.hksim.data_plan) * 100
  364. return aa
  365. },
  366. hkdata_balance_per: function () {
  367. let aa = Number(this.hksim.data_balance / this.hksim.data_plan) * 100
  368. return aa
  369. }
  370. },
  371. mounted() {
  372. this.getEquipStatus()
  373. },
  374. methods: {
  375. //获取折线图数据
  376. initChartLine() {
  377. this.$axios({
  378. method: 'POST',
  379. url: '/cbd_report_detail_chart',
  380. data: this.qs.stringify({
  381. req: 'filter',
  382. begin: this.queryInfo.begin,
  383. end: this.queryInfo.end,
  384. id: this.$route.query.id
  385. })
  386. }).then((res) => {
  387. if(res.data.length>0){
  388. this.isOne = false;
  389. var at = [],ah = [];
  390. for(var i = 0;i<res.data.length;i++){
  391. at.push([this.returnTime(res.data[i].tim),res.data[i].at/10])
  392. ah.push([this.returnTime(res.data[i].tim),res.data[i].ah/10])
  393. if(i == res.data.length-1){
  394. this.options = {
  395. chart: {
  396. zoomType: 'x',
  397. height: 360,
  398. },
  399. title: {
  400. text: '环境温湿度',
  401. align: 'left'
  402. },
  403. subtitle: {
  404. text: ''
  405. },
  406. xAxis: {
  407. crosshair: true, //十字基准线
  408. type: 'datetime',
  409. dateTimeLabelFormats: {
  410. //根据时间间距X轴自动显示哪种格式
  411. millisecond: '%H:%M:%S.%L',
  412. second: '%H:%M:%S',
  413. minute: '%H:%M',
  414. hour: '%H:%M',
  415. day: '%m-%d',
  416. week: '%m-%d',
  417. month: '%Y-%m',
  418. year: '%Y'
  419. }
  420. },
  421. yAxis: {
  422. title: {
  423. text: ''
  424. }
  425. },
  426. legend: {
  427. // layout: 'vertical',
  428. align: 'right',
  429. verticalAlign: 'top'
  430. },
  431. plotOptions: {
  432. series: {
  433. label: {
  434. connectorAllowed: false
  435. },
  436. pointStart: 2010
  437. }
  438. },
  439. series: [
  440. {
  441. name: '环境湿度',
  442. data: ah
  443. },
  444. {
  445. name: '环境温度',
  446. data: at
  447. }
  448. ],
  449. colors: ['#00e29d', '#6cbbff', '#ff3f3f'],
  450. credits: {
  451. //去掉默认的highcharts.com
  452. enabled: false
  453. },
  454. tooltip: {
  455. // crosshairs: true,
  456. shared: true, //折线共享
  457. headerFormat: '<b>{point.x:%Y-%m-%e %H:%M:%S}</b><br>'
  458. },
  459. responsive: {
  460. rules: [
  461. {
  462. condition: {
  463. maxWidth: 500
  464. },
  465. chartOptions: {
  466. legend: {
  467. layout: 'horizontal',
  468. align: 'center',
  469. verticalAlign: 'bottom'
  470. }
  471. }
  472. }
  473. ]
  474. }
  475. }
  476. }
  477. }
  478. }else{
  479. this.options = {};
  480. if(this.isSelect){
  481. console.log(res.data.length);
  482. this.$refs.setSelected.timeBtnClick(2);
  483. this.isSelect = false
  484. // this.getChartLine();
  485. // this.getHisDataList()
  486. }else if(this.isSelectNian){
  487. console.log(res.data.length);
  488. this.$refs.setSelected.timeBtnClick(3);
  489. this.isSelectNian = false
  490. // this.getChartLine()
  491. // this.getHisDataList()
  492. }else if(this.isSelectYear){
  493. console.log(res.data.length);
  494. this.$refs.setSelected.timeBtnClick(4);
  495. this.isSelectYear = false
  496. // this.getChartLine()
  497. // this.getHisDataList()
  498. }
  499. }
  500. })
  501. },
  502. //获取折线图数据
  503. getChartLine() {
  504. this.$axios({
  505. method: 'POST',
  506. url: '/cbd_report_detail_chart',
  507. data: this.qs.stringify({
  508. req: 'filter',
  509. begin: this.queryInfo.begin,
  510. end: this.queryInfo.end,
  511. id: this.$route.query.id
  512. })
  513. }).then((res) => {
  514. if(res.data.length>0){
  515. var at = [],ah = [];
  516. for(var i = 0;i<res.data.length;i++){
  517. at.push([this.returnTime(res.data[i].tim),res.data[i].at/10])
  518. ah.push([this.returnTime(res.data[i].tim),res.data[i].ah/10])
  519. if(i == res.data.length-1){
  520. this.options = {
  521. chart: {
  522. zoomType: 'x',
  523. height: 360,
  524. },
  525. title: {
  526. text: '环境温湿度',
  527. align: 'left'
  528. },
  529. subtitle: {
  530. text: ''
  531. },
  532. xAxis: {
  533. crosshair: true, //十字基准线
  534. type: 'datetime',
  535. dateTimeLabelFormats: {
  536. //根据时间间距X轴自动显示哪种格式
  537. millisecond: '%H:%M:%S.%L',
  538. second: '%H:%M:%S',
  539. minute: '%H:%M',
  540. hour: '%H:%M',
  541. day: '%m-%d',
  542. week: '%m-%d',
  543. month: '%Y-%m',
  544. year: '%Y'
  545. }
  546. },
  547. yAxis: {
  548. title: {
  549. text: ''
  550. }
  551. },
  552. legend: {
  553. // layout: 'vertical',
  554. align: 'right',
  555. verticalAlign: 'top'
  556. },
  557. plotOptions: {
  558. series: {
  559. label: {
  560. connectorAllowed: false
  561. },
  562. pointStart: 2010
  563. }
  564. },
  565. series: [
  566. {
  567. name: '环境湿度',
  568. data: ah
  569. },
  570. {
  571. name: '环境温度',
  572. data: at
  573. }
  574. ],
  575. colors: ['#00e29d', '#6cbbff', '#ff3f3f'],
  576. credits: {
  577. //去掉默认的highcharts.com
  578. enabled: false
  579. },
  580. tooltip: {
  581. // crosshairs: true,
  582. shared: true, //折线共享
  583. headerFormat: '<b>{point.x:%Y-%m-%e %H:%M:%S}</b><br>'
  584. },
  585. responsive: {
  586. rules: [
  587. {
  588. condition: {
  589. maxWidth: 500
  590. },
  591. chartOptions: {
  592. legend: {
  593. layout: 'horizontal',
  594. align: 'center',
  595. verticalAlign: 'bottom'
  596. }
  597. }
  598. }
  599. ]
  600. }
  601. }
  602. }
  603. }
  604. }else{
  605. this.options = {};
  606. }
  607. })
  608. },
  609. // 返回时间戳
  610. returnTime(time) {
  611. var thisTime = time.replace(/-/g, '/');
  612. var time = new Date(thisTime);
  613. var timestamp = time.getTime() + 8 * 3600000;
  614. return timestamp;
  615. },
  616. // 获取状态信息
  617. getEquipStatus() {
  618. this.$axios({
  619. method: 'POST',
  620. url: '/equipmanage_cbd_detail',
  621. data: this.qs.stringify({
  622. id: this.$route.query.id
  623. })
  624. }).then((res) => {
  625. var datStr = res.data[0].cbd_status;
  626. var dat = eval('('+datStr+')');
  627. this.equipStatus = {
  628. dver:dat.dver,
  629. csq:dat.csq,
  630. upds:dat.upds,
  631. hs:dat.hs,
  632. gs:dat.gs,
  633. ts:dat.ts,
  634. device_status:dat.is_online,
  635. };
  636. })
  637. },
  638. dateChange(data) {
  639. this.queryInfo.page = 1
  640. this.queryInfo.begin = new Date(data.begin*1000).toLocaleDateString().replace(/\//g,'-');
  641. this.queryInfo.end = new Date(data.end*1000).toLocaleDateString().replace(/\//g,'-');
  642. if(this.isOne){
  643. this.initChartLine()
  644. this.getHisDataList()
  645. }else{
  646. this.getChartLine()
  647. this.getHisDataList()
  648. }
  649. },
  650. //获取表格数据
  651. getHisDataList() {
  652. this.$axios({
  653. method: 'POST',
  654. url: '/cbd_report_detail',
  655. data: this.qs.stringify({
  656. page: this.queryInfo.page,
  657. req: 'filter',
  658. id: this.$route.query.id,
  659. begin: this.queryInfo.begin,
  660. end: this.queryInfo.end
  661. })
  662. }).then((res) => {
  663. this.tableData = []
  664. this.total = res.data.nums
  665. var dat = res.data.dat
  666. for (var i = 0; i < dat.length; i++) {
  667. var cbd_data = eval('('+dat[i].cbd_data+')')
  668. var rps = cbd_data.rps == 0 ? '正常' : '雨控';
  669. var tps = cbd_data.tps == 0 ? '正常' : '温控';
  670. var lps = cbd_data.lps == 0 ? '正常' : '光控';
  671. this.tableData.push({
  672. at:(cbd_data.at/10).toFixed(2),
  673. ah:(cbd_data.ah/10).toFixed(2),
  674. hrt:cbd_data.hrt,
  675. rps:rps,
  676. tps:tps,
  677. lps:lps,
  678. vbat:cbd_data.vbat,
  679. addtime:dat[i].upl_time
  680. })
  681. }
  682. })
  683. },
  684. //改变page
  685. changePage(val) {
  686. this.queryInfo.page = val
  687. this.getHisDataList()
  688. },
  689. // SIM卡
  690. lookSIMCode(flag) {
  691. this.simLoading = true;
  692. this.simCodeVisible = true
  693. if(flag == 'sim'){
  694. if(!this.simFlag){
  695. this.simLoading = false;
  696. return false;
  697. }
  698. }
  699. this.$axios({
  700. method: 'post',
  701. url: '/api_gateway?method=forecast.send_control.device_sim',
  702. data: this.qs.stringify({
  703. d_id: this.queryInfo.d_id,
  704. type:flag
  705. })
  706. }).then((res) => {
  707. if (res.data.message == '') {
  708. this.sim.iccid = res.data.data[0].iccid
  709. this.$axios({
  710. method: 'POST',
  711. url: '/api_gateway?method=forecast.send_control.sim_query',
  712. data: this.qs.stringify({
  713. iccid: this.sim.iccid
  714. })
  715. }).then((res) => {
  716. let data = eval('(' + res.data.data.data + ')')
  717. if (data.code!=0){
  718. this.$message({
  719. type: 'info',
  720. message: data.msg
  721. });
  722. this.hksim = {
  723. iccid: '',
  724. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  725. data_plan: 0, //套餐大小
  726. data_usage: 0, //当月用量
  727. data_balance: 0, //剩余流量
  728. expiry_date: 0 //到期日期
  729. }
  730. console.log(this.hksim)
  731. }
  732. if (res.data.message == '') {
  733. console.log(data)
  734. let cardInfo = data.data
  735. this.simLoading = false;
  736. if(flag == 'sim'){
  737. this.sim = cardInfo
  738. this.simFlag = false;
  739. }else{
  740. if(cardInfo){
  741. this.hksim = cardInfo
  742. }else{
  743. this.hksim = {
  744. iccid: '',
  745. account_status: 0, //卡状态 0-7 未知 测试期 沉默期 使用中 停机 停机保号 预销号 销号
  746. data_plan: 0, //套餐大小
  747. data_usage: 0, //当月用量
  748. data_balance: 0, //剩余流量
  749. expiry_date: 0 //到期日期
  750. }
  751. }
  752. }
  753. }
  754. })
  755. }
  756. })
  757. },
  758. //sim卡状态
  759. handleClick(tab, event) {
  760. console.log(event)
  761. console.log(event.target)
  762. console.log(event.target.innerText)
  763. if((event.target.innerText == '海康SIM卡流量') && (this.hksimFlag) ){
  764. this.hksimFlag = false;
  765. console.log(event.target.innerText)
  766. this.lookSIMCode('hksim');
  767. }
  768. },
  769. //绑定更换海康SIM
  770. changeHkSim(){
  771. if(!this.hksiminp){}
  772. this.$axios({
  773. method: 'post',
  774. url: '/api_gateway?method=forecast.send_control.device_sim',
  775. data: this.qs.stringify({
  776. d_id: this.queryInfo.d_id,
  777. iccid: this.hksiminp,
  778. type:'change'
  779. })
  780. }).then((res) => {
  781. this.hksiminp = '';
  782. if (res.data.data == '1') {
  783. this.lookSIMCode('hksim')
  784. }
  785. })
  786. },
  787. //刷新按钮
  788. refresh() {
  789. this.$axios({
  790. method: 'POST',
  791. url: '/cbd_mqtt',
  792. data: this.qs.stringify({
  793. req: 'read',
  794. topicid: this.$route.query.id,
  795. kind: 'status'
  796. })
  797. }).then((res) => {
  798. if (res.data == 0) {
  799. this.$message.success('刷新成功')
  800. } else {
  801. this.$message.err('刷新失败')
  802. }
  803. })
  804. }
  805. },
  806. components: {
  807. DateSearch
  808. }
  809. }
  810. </script>
  811. <style lang='less' scoped>
  812. .equipInfo {
  813. display: flex;
  814. justify-content: space-between;
  815. margin-bottom: 15px;
  816. .equipMsg {
  817. font-size: 14px;
  818. color: #3d3d3d;
  819. }
  820. }
  821. .ctrl-check {
  822. margin-bottom: 20px;
  823. }
  824. .time-check {
  825. display: flex;
  826. justify-content: space-between;
  827. .el-button {
  828. border-radius: 30px;
  829. }
  830. .el-input__inner {
  831. width: 222px;
  832. }
  833. }
  834. .charts {
  835. height: 360px;
  836. highcharts{
  837. height: 360px;
  838. }
  839. }
  840. .equipStatus {
  841. display: flex;
  842. margin: 10px 0;
  843. .equipIcon {
  844. margin: 0 10%;
  845. }
  846. .equipParams {
  847. min-width: 80px;
  848. line-height: 27px;
  849. p {
  850. color: #a6a6a6;
  851. }
  852. }
  853. }
  854. .dataTableSearch {
  855. display: flex;
  856. justify-content: space-between;
  857. margin: 20px 0;
  858. .el-input__inner {
  859. width: 222px;
  860. }
  861. }
  862. .echarts {
  863. width: 100%;
  864. height: 300px;
  865. }
  866. .simCodeBox {
  867. > div {
  868. line-height: 40px;
  869. display: flex;
  870. align-content: center;
  871. .simCodeTitle {
  872. width: 100px;
  873. text-align: right;
  874. font-size: 14px;
  875. color: #333;
  876. }
  877. > div {
  878. flex: 1;
  879. .el-progress {
  880. margin-top: 17px;
  881. }
  882. }
  883. span {
  884. width: 85px;
  885. font-size: 12px;
  886. padding-left: 3px;
  887. color: #909090;
  888. }
  889. .el-input {
  890. width: 60%;
  891. }
  892. }
  893. .operateBtn {
  894. display: block;
  895. text-align: right;
  896. }
  897. }
  898. .breadcrumb_tab {
  899. top: 60px !important;
  900. }
  901. </style>