deviceData.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. <template>
  2. <view class="device-data-container">
  3. <!-- 顶部时间戳和图标区域 -->
  4. <view class="device-data-wraper">
  5. <view class="top-bar">
  6. <view class="timestamp">
  7. {{formatDate(deviceInfo.uptime)}}
  8. <u-icon name="reload" color="#0bbc58" style="margin-left: 12rpx" @click="refreshData"></u-icon>
  9. </view>
  10. <view class="icon-group">
  11. <!-- <view class="icon-item refresh-icon">
  12. <img class="copy-icon" :src="sim"/>
  13. </view>
  14. <view class="icon-item settings-icon" @click="openSettings">
  15. <img class="copy-icon" :src="setting"/>
  16. </view> -->
  17. <!-- <view class="icon-item info-icon">
  18. <img class="copy-icon" :src="edit"/>
  19. </view> -->
  20. </view>
  21. </view>
  22. <!-- 主要数据面板 -->
  23. <view class="main-data-panel">
  24. <view class="data-column-left">
  25. <view class="data-item">
  26. <text class="data-value">{{ objItem.ds == '1' ? '开机' : '关机' }}</text>
  27. <text class="data-label">设备开机</text>
  28. </view>
  29. <view class="data-item">
  30. <text class="data-value">{{ objItem.ws }}</text>
  31. <text class="data-label">工作状态</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="main-data-panel">
  36. <view class="data-column-left">
  37. <view class="data-item">
  38. <text class="data-value">{{ objItem.rps }}</text>
  39. <text class="data-label">雨控状态</text>
  40. </view>
  41. <view class="data-item">
  42. <text class="data-value">{{ objItem.tps }}</text>
  43. <text class="data-label">温控状态</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 图表区域 -->
  49. <view class="chart-section">
  50. <view class="chart-header">
  51. <view class="chart-tabs">
  52. <view
  53. v-for="(tab, index) in chartTabs"
  54. :key="index"
  55. class="chart-tab-item"
  56. :class="{ active: activeChartTab === index }"
  57. @click="switchChartTab(index)"
  58. >
  59. {{ tab.name }}
  60. </view>
  61. </view>
  62. <!-- <view class="chart-dropdown">
  63. <text class="iconfont dropdown-icon">&#xe606;</text>
  64. </view> -->
  65. </view>
  66. <view class="chart-content">
  67. <view class="chart-canvas-container" v-if="!show" :key="chartKey">
  68. <!-- <div id="tempChart" class="chart-canvas"></div> -->
  69. <qiun-data-charts type="line" :chartData="chartData" :canvas2d="true" :inScrollView="true" :opts="opts" :ontouch="true" v-show="xData.length"/>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 历史数据表格 -->
  74. <view class="history-section">
  75. <view class="history-header">
  76. <text class="history-title">历史数据</text>
  77. </view>
  78. <view class="history-table">
  79. <view class="table-container">
  80. <!-- 固定列 -->
  81. <view class="fixed-column">
  82. <view class="fixed-header">
  83. <text class="header-cell fixed">上报时间</text>
  84. </view>
  85. <view class="fixed-body">
  86. <view
  87. v-for="(item, index) in historyData"
  88. :key="index"
  89. class="fixed-row"
  90. >
  91. <text class="body-cell fixed">{{ formatTime(item.addtime) }}</text>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 可滑动列 -->
  96. <view class="scrollable-column">
  97. <view class="scrollable-header">
  98. <text class="header-cell">设备开关</text>
  99. <text class="header-cell">工作状态</text>
  100. <text class="header-cell">雨控状态</text>
  101. <text class="header-cell">温控状态</text>
  102. <text class="header-cell">倾倒状态</text>
  103. <text class="header-cell">灯管状态</text>
  104. <text class="header-cell">电压状态</text>
  105. <text class="header-cell">定时状态</text>
  106. <text class="header-cell">杀虫数量</text>
  107. <text class="header-cell">温度(°C)</text>
  108. <text class="header-cell">湿度(%)</text>
  109. <text class="header-cell">充电电压</text>
  110. <text class="header-cell">电池状态</text>
  111. <text class="header-cell">信号强度</text>
  112. <text class="header-cell">上报时间</text>
  113. </view>
  114. <view class="scrollable-body">
  115. <view
  116. v-for="(item, index) in historyData"
  117. :key="index"
  118. class="scrollable-row"
  119. >
  120. <text class="body-cell">
  121. <view class="status-icon" :class="item.ds == 1 ? 'success-icon' : 'status-icon'"></view>
  122. {{ item.ds == 1? '打开' : '关闭' }}
  123. </text>
  124. <text class="body-cell">
  125. <view class="status-icon" :class="item.ws == '工作' ? 'success-icon' : 'warning-icon'"></view>
  126. {{ item.ws }}
  127. </text>
  128. <text class="body-cell">
  129. <view class="status-icon" :class="item.rps == '正常' ? 'success-icon' : 'warning-icon'"></view>
  130. {{ item.rps }}
  131. </text>
  132. <text class="body-cell">
  133. <view class="status-icon" :class="item.tps == '正常' ? 'success-icon' : 'warning-icon'"></view>
  134. {{ item.tps }}
  135. </text>
  136. <text class="body-cell">
  137. <view class="status-icon" :class="item.tps == '正常' ? 'success-icon' : 'warning-icon'"></view>
  138. {{ item.dps }}
  139. </text>
  140. <text class="body-cell">
  141. <view class="status-icon" :class="item.voltval == '开灯' ? 'success-icon' : 'warning-icon'"></view>
  142. {{ item.voltval }}
  143. </text>
  144. <text class="body-cell">
  145. <view class="status-icon" :class="item.vps == 0 ? 'success-icon' : 'status-icon'"></view>
  146. {{ item.vps == '0' ? '正常' : '欠压' }}
  147. </text>
  148. <text class="body-cell">
  149. <view class="status-icon" :class="item.tt == '常亮' ? 'success-icon' : 'warning-icon'"></view>
  150. {{ item.tt }}
  151. </text>
  152. <text class="body-cell">{{ item.infr_ct }}</text>
  153. <text class="body-cell">{{ item.at }}</text>
  154. <text class="body-cell">{{ item.ah }}</text>
  155. <text class="body-cell">{{ item.cv }}</text>
  156. <text class="body-cell">{{ item.bv }}</text>
  157. <text class="body-cell">{{ item.csq }}</text>
  158. <text class="body-cell">{{ formatTime(item.addtime) }}</text>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. <view class="pagination">
  165. <text class="pagination-btn prev-btn" @click="prevPage">上一页</text>
  166. <text class="pagination-info">{{currentPage}}/{{totalPages || 1}}</text>
  167. <text class="pagination-btn next-btn" @click="nextPage">下一页</text>
  168. </view>
  169. </view>
  170. <u-popup v-model="show" mode="bottom" border-radius="20">
  171. <view style="height:70vh">
  172. <view class="tabs-container">
  173. <view class="tabs-item" @click="switchTab(0)" :class="{ active: activeTab === 0 }" v-if="data_iccid">数据SIM卡流量</view>
  174. <view class="tabs-item" @click="switchTab(1)" :class="{ active: activeTab === 1 }">图片SIM卡流量</view>
  175. </view>
  176. <view class="sim-container" v-if="activeTab === 0">
  177. <view class="sim-item">
  178. <text class="sim-label">ICCID:</text>
  179. <text class="sim-value">{{ deviceInfoStatic.iccid }}</text>
  180. </view>
  181. <view class="sim-item">
  182. <text class="sim-label">总流量:</text>
  183. <text class="sim-value">{{ deviceInfoStatic.total }}</text>
  184. </view>
  185. <view class="sim-item">
  186. <text class="sim-label">状态:</text>
  187. <text class="sim-value">{{ deviceInfoStatic.status }}</text>
  188. </view>
  189. <view class="sim-item">
  190. <text class="sim-label">到期时间:</text>
  191. <text class="sim-value">{{ deviceInfoStatic.expire }}</text>
  192. </view>
  193. <view class="sim-item">
  194. <text class="sim-label">厂商名称:</text>
  195. <text class="sim-value">{{ deviceInfoStatic.company }}</text>
  196. </view>
  197. <view class="sim-item">
  198. <text class="sim-label">已使用:</text>
  199. <text class="sim-value"><text style="color: #0bbc58">{{ deviceInfoStatic.used || ''}}</text>/{{ deviceInfoStatic.total || '' }}</text>
  200. </view>
  201. <view class="sim-item">
  202. <text class="sim-value">
  203. <u-line-progress active-color="#0bbc58" :percent="deviceInfoStatic.used / deviceInfoStatic.total * 100" :show-percent="false"></u-line-progress>
  204. </text>
  205. </view>
  206. </view>
  207. <view class="sim-container" v-if="activeTab === 1">
  208. <view class="sim-item" style="display:flex;align-items: center;height:80rpx;">
  209. <text class="sim-label">ICCID:</text>
  210. <text v-if="show1" style="margin-right: 10rpx">{{ photo_iccid }}</text>
  211. <text class="sim-value" style="color: #0bbc58;" @click="changeSim" v-if="show1">
  212. 更换SIM卡
  213. </text>
  214. <view v-else class="sim-value-change">
  215. <u-input v-model="data_iccidInput" placeholder="请输入ICCID" class="sim-value"></u-input>
  216. <view class="sim-value-button" size="small" @click="changeSimHandler">确认</view>
  217. <view class="sim-value-button" size="small" @click="show1 = true">取消</view>
  218. </view>
  219. </view>
  220. </view>
  221. </view>
  222. </u-popup>
  223. <floatButton v-if="false">
  224. <view slot="icon">
  225. <view class="general-border">
  226. <image :src="general" class="general-icon"></image>
  227. </view>
  228. </view>
  229. <view slot="expanded">
  230. <view class="general-images">
  231. <view class="general-image edit-border" :class="{'edit-border2':isShowPhoto}" @click="editData">
  232. <image :src="editBorder" class="image-icon"></image>
  233. </view>
  234. <view class="general-image sim-border" :class="{'sim-border2':isShowPhoto}" @click="simData">
  235. <image :src="simBorder" class="image-icon"></image>
  236. </view>
  237. <view class="general-image setting-border" :class="{'setting-border2':isShowPhoto}" @click="openSettings">
  238. <image :src="settingBorder" class="image-icon"></image>
  239. </view>
  240. <view class="general-image photo-border" @click="openPhoto" v-if="isShowPhoto">
  241. <image :src="photoBorder" class="image-icon"></image>
  242. </view>
  243. </view>
  244. </view>
  245. </floatButton>
  246. </view>
  247. </template>
  248. <script>
  249. import Circulation from '../../../static/js/equipState_dict.json';
  250. import floatButton from './floating-button.vue';
  251. let chartInstance = null;
  252. export default {
  253. name: 'DeviceData',
  254. props:{
  255. deviceInfo:{
  256. type:Object,
  257. default:()=>({}),
  258. },
  259. deviceStatic:{
  260. type:Object,
  261. default:()=>({}),
  262. },
  263. polylineList:{
  264. type:Array,
  265. default:()=>[],
  266. },
  267. deviceHistoryList:{
  268. type:Array,
  269. default:()=>[],
  270. },
  271. totalPage:{
  272. type:Number,
  273. default:0
  274. },
  275. currentPage:{
  276. type:Number,
  277. default:0
  278. },
  279. page_size:{
  280. type:Number,
  281. default:10
  282. },
  283. },
  284. components: {
  285. floatButton,
  286. },
  287. data() {
  288. return {
  289. setting:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/setting.png',
  290. general:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/general.png',
  291. editBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/editBorder.png',
  292. settingBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/settingBorder.png',
  293. simBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/simBorder.png',
  294. devImage:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/cbd.png',
  295. photoBorder:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/photoBorder.png',
  296. devImg:'',
  297. activeTab: 0,
  298. edit:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/edit.png',
  299. sim:'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/sim.png',
  300. show:false,
  301. isShowPhoto:false,
  302. show1:true,
  303. equipStateDict:{},
  304. chartTabs: [
  305. { name: '温度', id: 'new_tem' },
  306. { name: '湿度', id: 'new_hum' },
  307. { name: '充电电压', id: 'cv' },
  308. { name: '电池电压', id: 'bv' },
  309. { name: '杀虫数量', id: 'infr_ct' },
  310. ],
  311. opts: {
  312. type: 'line',
  313. xAxis: {
  314. disableGrid: true,
  315. itemCount: 3,
  316. scrollShow: true
  317. },
  318. yAxis: {
  319. disableGrid: true,
  320. gridType: 'dash',
  321. splitNumber: 5,
  322. min: 0,
  323. format: (val) => {
  324. return Math.round(val)
  325. }
  326. },
  327. extra: {
  328. line: {
  329. type: 'curve'
  330. },
  331. tooltip: {
  332. format: {
  333. name: '',
  334. value: (val) => Math.round(val)
  335. }
  336. }
  337. },
  338. legend: {
  339. },
  340. enableScroll: true
  341. },
  342. xData:[],
  343. yData:[],
  344. activeChartTab: 0,
  345. historyData: [],
  346. data_iccid:'',
  347. data_iccidInput:'',
  348. deviceInfoStatic:{},
  349. photo_iccid:'',
  350. chartData: {},
  351. chartKey: 0,
  352. objItem:{}
  353. };
  354. },
  355. mounted(){
  356. this.equipStateDict = Circulation
  357. },
  358. computed: {
  359. totalPages(){
  360. return Math.ceil(this.totalPage / this.page_size)
  361. },
  362. formatDevImg() {
  363. return `https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/${this.devImg}.png`;
  364. },
  365. },
  366. watch:{
  367. polylineList:{
  368. handler(newVal, oldVal){
  369. this.xData = newVal.map(item => this.formatDate(new Date(item.addtime)));
  370. this.yData = newVal.map(item => Number(item.new_tem) || 0);
  371. if(this.xData.length){
  372. this.initChart();
  373. }
  374. },
  375. deep:true,
  376. immediate:true,
  377. },
  378. deviceInfo:{
  379. handler(newVal, oldVal){
  380. if (newVal.device_model == '11'){
  381. this.devImg = 'cbd4.1'
  382. this.isShowPhoto = true
  383. } else if(newVal.device_model == '12'){
  384. this.devImg = 'cbd1'
  385. this.isShowPhoto = false
  386. } else if(newVal.device_model == '13'){
  387. this.devImg = 'cbd5'
  388. this.isShowPhoto = true
  389. } else if(newVal.device_model == '14'){
  390. this.devImg = 'cbd6'
  391. this.isShowPhoto = true
  392. } else if(newVal.device_model == '15'){
  393. this.devImg = 'gkcbd1'
  394. this.isShowPhoto = false
  395. } else{
  396. this.devImg = 'cbd'
  397. this.isShowPhoto = true
  398. }
  399. },
  400. deep:true,
  401. immediate:true,
  402. },
  403. deviceHistoryList:{
  404. handler(newVal, oldVal){
  405. this.historyData = []
  406. if(newVal.length > 0){
  407. newVal.forEach(item=>{
  408. this.historyData.push(item.d_h_t)
  409. })
  410. this.objItem = this.historyData[0]
  411. }else{
  412. this.objItem = {}
  413. }
  414. },
  415. deep:true,
  416. immediate:true,
  417. },
  418. },
  419. methods: {
  420. async openPhoto(){
  421. const res = await this.$myRequest({
  422. url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
  423. method: 'POST',
  424. data: {
  425. device_type_id: this.deviceInfo.type,
  426. d_id: this.deviceInfo.d_id,
  427. cmd: 'takephoto',
  428. },
  429. });
  430. if(res){
  431. this.$u.toast('拍照成功')
  432. }
  433. },
  434. editData(){
  435. uni.navigateTo({
  436. url: '/pages/afterSale/addafter?d_id=' + this.deviceInfo.d_id +'&device_id='+this.deviceInfo.id + '&device_type=' + this.deviceInfo.type,
  437. })
  438. },
  439. prevPage(){
  440. this.$emit('prevPage', this.currentPage)
  441. },
  442. nextPage(){
  443. this.$emit('nextPage', this.currentPage)
  444. },
  445. changeSim(){
  446. this.show1 = false
  447. },
  448. changeSimHandler(){
  449. if(this.data_iccidInput){
  450. this.changeSimAction(this.data_iccidInput);
  451. }else{
  452. this.$u.toast('请输入ICCID')
  453. }
  454. },
  455. switchTab(index){
  456. this.activeTab = index
  457. },
  458. simData(){
  459. this.show = true
  460. },
  461. async changeSimAction(simid){
  462. const res = await this.$myRequest({
  463. url: '/api/api_gateway?method=forecast.send_control.device_sim_update',
  464. method: 'POST',
  465. data: {
  466. d_id: this.deviceInfo.d_id,
  467. simid,
  468. },
  469. });
  470. if(res){
  471. this.$u.toast('更换成功')
  472. this.show1 = true
  473. this.data_iccidInput = ''
  474. this.getSimNew()
  475. }
  476. },
  477. async getSimNew(){
  478. const res = await this.$myRequest({
  479. url: '/api/api_gateway?method=forecast.send_control.device_sim_new',
  480. method: 'POST',
  481. data: {
  482. d_id: this.deviceInfo.d_id,
  483. },
  484. });
  485. if(res){
  486. const data_iccid = res.data_iccid
  487. this.data_iccid = data_iccid
  488. this.photo_iccid = res.photo_iccid
  489. if(data_iccid){
  490. this.getQueryNew(data_iccid);
  491. }else{
  492. this.activeTab = 1
  493. }
  494. }
  495. },
  496. async getQueryNew(data_iccid){
  497. const res = await this.$myRequest({
  498. url: '/api/api_gateway?method=forecast.send_control.sim_query_new',
  499. method: 'POST',
  500. data: {
  501. iccid: data_iccid,
  502. },
  503. });
  504. this.deviceInfoStatic = res
  505. },
  506. async refreshData(){
  507. const res = await this.$myRequest({
  508. url: '/api/api_gateway?method=forecast.send_control.get_device_config',
  509. method: 'POST',
  510. data: {
  511. device_type_id: this.deviceInfo.type,
  512. d_id: this.deviceInfo.d_id,
  513. control_type:'data',
  514. device_model: this.deviceInfo.device_model || 0,
  515. },
  516. });
  517. if(res){
  518. // 弹出提示
  519. this.$u.toast('刷新成功')
  520. }
  521. },
  522. getStateDict(item){
  523. return item.ws == 0 ? '待机' : this.equipStateDict.lamp.value[item.lamp]
  524. },
  525. getRpsDict(item){
  526. return this.equipStateDict.rps.value[item.rps]
  527. },
  528. getTpsDict(item){
  529. return this.equipStateDict.tps.value[item.tps]
  530. },
  531. getLpsDict(item){
  532. return this.equipStateDict.lps.value[item.lps]
  533. },
  534. openSettings(){
  535. uni.navigateTo({
  536. url: '/pages/scd/deviceControl?deviceId=' + this.deviceInfo.id + '&d_id=' + this.deviceInfo.d_id,
  537. });
  538. },
  539. initChart() {
  540. this.$nextTick(() => {
  541. this.updateChartsData();
  542. });
  543. },
  544. // 格式化时间
  545. formatDate(dateString) {
  546. const date = new Date(dateString*1000);
  547. const year = date.getFullYear();
  548. const month = String(date.getMonth() + 1).padStart(2, '0');
  549. const day = String(date.getDate()).padStart(2, '0');
  550. return `${year}-${month}-${day}`;
  551. },
  552. formatTime(dateString) {
  553. const date = new Date(dateString*1000);
  554. const year = date.getFullYear();
  555. const month = String(date.getMonth() + 1).padStart(2, '0');
  556. const day = String(date.getDate()).padStart(2, '0');
  557. const hour = String(date.getHours()).padStart(2, '0');
  558. const minute = String(date.getMinutes()).padStart(2, '0');
  559. const second = String(date.getSeconds()).padStart(2, '0');
  560. return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
  561. },
  562. drawChart() {
  563. // 销毁已有的图表实例
  564. if (chartInstance) {
  565. chartInstance.dispose();
  566. }
  567. // 初始化图表
  568. const chartDom = document.getElementById('tempChart');
  569. if (!chartDom) return;
  570. // chartInstance = echarts.init(chartDom);
  571. if(!chartInstance){
  572. return
  573. }
  574. const option = {
  575. backgroundColor: '#FFFFFF',
  576. tooltip: {
  577. trigger: 'axis'
  578. },
  579. legend: {
  580. show: false
  581. },
  582. grid: {
  583. left: '3%',
  584. right: '4%',
  585. bottom: '3%',
  586. top: '8%',
  587. containLabel: true
  588. },
  589. xAxis: {
  590. type: 'category',
  591. boundaryGap: false,
  592. data: this.xData,
  593. axisLine: {
  594. lineStyle: {
  595. color: '#CCCCCC'
  596. }
  597. },
  598. axisLabel: {
  599. fontSize: 10,
  600. color: '#999999'
  601. },
  602. splitLine: {
  603. show: false
  604. }
  605. },
  606. yAxis: {
  607. type: 'value',
  608. splitNumber: 4,
  609. axisLine: {
  610. show: true,
  611. lineStyle: {
  612. color: '#CCCCCC'
  613. }
  614. },
  615. axisLabel: {
  616. fontSize: 10,
  617. color: '#999999'
  618. },
  619. splitLine: {
  620. show: true,
  621. lineStyle: {
  622. color: '#E5E5E5',
  623. type: 'dashed'
  624. }
  625. }
  626. },
  627. series: [
  628. {
  629. name: this.chartTabs[this.activeChartTab].name,
  630. type: 'line',
  631. smooth: true,
  632. data: this.yData,
  633. lineStyle: {
  634. color: '#0bbc58',
  635. width: 2
  636. },
  637. itemStyle: {
  638. color: '#0bbc58',
  639. borderColor: '#0bbc58',
  640. borderWidth: 2
  641. },
  642. symbol: 'circle',
  643. symbolSize: 6,
  644. // areaStyle: {
  645. // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  646. // {
  647. // offset: 0,
  648. // color: 'rgba(11, 188, 88, 0.3)'
  649. // },
  650. // {
  651. // offset: 1,
  652. // color: 'rgba(11, 188, 88, 0)'
  653. // }
  654. // ])
  655. // }
  656. }
  657. ]
  658. };
  659. chartInstance.setOption(option);
  660. // 监听窗口大小变化,调整图表大小
  661. window.addEventListener('resize', () => {
  662. chartInstance.resize();
  663. });
  664. },
  665. switchChartTab(index) {
  666. this.activeChartTab = index;
  667. // 根据不同标签切换数据
  668. if (this.chartTabs[index].id === 'new_tem') {
  669. this.yData = this.polylineList.map(item => Number(item.new_tem) || 0);
  670. } else if (this.chartTabs[index].id === 'new_hum') {
  671. this.yData = this.polylineList.map(item => Number(item.new_hum) || 0);
  672. } else if (this.chartTabs[index].id === 'cv') {
  673. this.yData = this.polylineList.map(item => Number(item.others.cv) || 0);
  674. } else if (this.chartTabs[index].id === 'bv') {
  675. this.yData = this.polylineList.map(item => Number(item.others.bv) || 0);
  676. } else if (this.chartTabs[index].id === 'infr_ct') {
  677. this.yData = this.polylineList.map(item => Number(item.others.infr_ct) || 0);
  678. }
  679. this.$nextTick(() => {
  680. // this.drawChart();
  681. this.updateChartsData();
  682. });
  683. },
  684. updateChartsData(){
  685. const categories = this.xData.length ? this.xData : [];
  686. const lineData = {
  687. categories,
  688. series: [
  689. {
  690. name: this.chartTabs[this.activeChartTab].name,
  691. data: this.yData
  692. }
  693. ]
  694. };
  695. this.chartData = lineData;
  696. }
  697. }
  698. };
  699. </script>
  700. <style lang="scss" scoped>
  701. .device-data-container {
  702. width: 100%;
  703. }
  704. .device-data-wraper{
  705. padding: 16rpx;
  706. background: #ffffff;
  707. border-radius: 16rpx;
  708. }
  709. /* 顶部时间戳和图标区域 */
  710. .top-bar {
  711. display: flex;
  712. justify-content: space-between;
  713. align-items: center;
  714. padding: 16rpx 0;
  715. .timestamp {
  716. font-size: 28rpx;
  717. font-family: 'Source Han Sans CN VF', sans-serif;
  718. font-weight: 400;
  719. color: #999999;
  720. }
  721. .icon-group {
  722. display: flex;
  723. gap: 10rpx;
  724. .icon-item {
  725. width: 56rpx;
  726. height: 56rpx;
  727. display: flex;
  728. align-items: center;
  729. justify-content: center;
  730. border-radius: 50%;
  731. .iconfont {
  732. font-size: 36rpx;
  733. }
  734. &.refresh-icon .iconfont {
  735. color: #0bbc58;
  736. }
  737. &.settings-icon .iconfont {
  738. color: #999999;
  739. }
  740. &.info-icon .iconfont {
  741. color: #999999;
  742. }
  743. }
  744. }
  745. }
  746. .sim-container{
  747. padding: 0 20rpx;
  748. .sim-item{
  749. margin-bottom: 20rpx;
  750. .sim-value-change{
  751. display: flex;
  752. align-items: center;
  753. .sim-value-button{
  754. padding: 8rpx 16rpx;
  755. border-radius: 8rpx;
  756. font-size: 24rpx;
  757. font-family: 'Source Han Sans CN VF', sans-serif;
  758. font-weight: 400;
  759. color: #042118;
  760. background: #0bbc58;
  761. color: #ffffff;
  762. margin-left: 20rpx;
  763. }
  764. }
  765. }
  766. }
  767. .general-border{
  768. width: 100rpx;
  769. height: 100rpx;
  770. border-radius: 50%;
  771. display: flex;
  772. align-items: center;
  773. justify-content: center;
  774. transition: all 0.3s ease;
  775. background: #ffffff;
  776. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  777. .general-icon{
  778. width: 50rpx;
  779. height: 50rpx;
  780. border-radius: 50%;
  781. }
  782. }
  783. .general-images{
  784. display: flex;
  785. align-items: center;
  786. justify-content: center;
  787. position: relative;
  788. .general-image{
  789. position: absolute;
  790. width: 80rpx;
  791. height: 80rpx;
  792. border-radius: 50%;
  793. background: #ffffff;
  794. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  795. display:flex;
  796. align-items: center;
  797. justify-content: center;
  798. .image-icon{
  799. width: 45rpx;
  800. height: 45rpx;
  801. }
  802. }
  803. .edit-border{
  804. top: 45rpx;
  805. left: -110rpx;
  806. }
  807. .sim-border{
  808. top: -125rpx;
  809. left: -110rpx;
  810. }
  811. .setting-border{
  812. top: -40rpx;
  813. left: -180rpx;
  814. }
  815. .edit-border2{
  816. top: 60rpx;
  817. left: -70rpx;
  818. }
  819. .sim-border2{
  820. top: -75rpx;
  821. left: -150rpx;
  822. }
  823. .setting-border2{
  824. top: 20rpx;
  825. left: -150rpx;
  826. }
  827. .photo-border{
  828. top: -135rpx;
  829. left: -70rpx;
  830. }
  831. }
  832. /* 主要数据面板 */
  833. .main-data-panel {
  834. display: flex;
  835. background: #FFFFFF;
  836. border-radius: 16rpx;
  837. margin-bottom: 16rpx;
  838. .data-column-left {
  839. flex: 1;
  840. display: flex;
  841. gap: 24rpx;
  842. .data-item {
  843. display: flex;
  844. flex: 1;
  845. flex-direction: column;
  846. gap: 8rpx;
  847. .data-label {
  848. font-size: 24rpx;
  849. font-family: 'Source Han Sans CN VF', sans-serif;
  850. font-weight: 400;
  851. color: #999999;
  852. }
  853. .data-value {
  854. font-size: 24rpx;
  855. font-family: 'Source Han Sans CN VF', sans-serif;
  856. font-weight: 700;
  857. color: #042118;
  858. &.temp-value {
  859. color: #FF6B6B;
  860. }
  861. }
  862. .data-unit {
  863. font-size: 24rpx;
  864. font-family: 'Source Han Sans CN VF', sans-serif;
  865. font-weight: 400;
  866. color: #999999;
  867. }
  868. }
  869. }
  870. .data-column-right {
  871. flex: 1;
  872. display: flex;
  873. flex-direction: column;
  874. align-items: center;
  875. gap: 16rpx;
  876. .device-image-container {
  877. position: relative;
  878. width: 200rpx;
  879. height: 200rpx;
  880. display: flex;
  881. align-items: center;
  882. justify-content: center;
  883. .device-glow {
  884. position: absolute;
  885. width: 180rpx;
  886. height: 180rpx;
  887. background: radial-gradient(circle, rgba(11, 188, 88, 0.3) 0%, rgba(11, 188, 88, 0) 70%);
  888. border-radius: 50%;
  889. }
  890. .device-image {
  891. position: relative;
  892. width: 260rpx;
  893. height: 360rpx;
  894. z-index: 1;
  895. top: 60rpx;
  896. }
  897. }
  898. .device-info {
  899. display: flex;
  900. flex-direction: column;
  901. gap: 12rpx;
  902. width: 100%;
  903. .info-row {
  904. display: flex;
  905. justify-content: space-between;
  906. align-items: center;
  907. .info-label {
  908. font-size: 24rpx;
  909. font-family: 'Source Han Sans CN VF', sans-serif;
  910. font-weight: 400;
  911. color: #999999;
  912. }
  913. .info-value {
  914. font-size: 36rpx;
  915. font-family: 'Source Han Sans CN VF', sans-serif;
  916. font-weight: 700;
  917. color: #042118;
  918. }
  919. .info-version {
  920. font-size: 24rpx;
  921. font-family: 'Source Han Sans CN VF', sans-serif;
  922. font-weight: 400;
  923. color: #999999;
  924. }
  925. .info-label-small {
  926. font-size: 24rpx;
  927. font-family: 'Source Han Sans CN VF', sans-serif;
  928. font-weight: 400;
  929. color: #999999;
  930. }
  931. }
  932. }
  933. }
  934. }
  935. .status-icon{
  936. position: absolute;
  937. top: 50%;
  938. transform: translateY(-50%);
  939. left: 20rpx;
  940. width: 12rpx;
  941. height: 12rpx;
  942. border-radius: 50%;
  943. background: #B6BECA;
  944. }
  945. .success-icon{
  946. background: #0BBC58;
  947. }
  948. .warning-icon{
  949. background: #F8B610;
  950. }
  951. .tabs-container{
  952. display:flex;
  953. align-items: center;
  954. gap: 24rpx;
  955. padding: 24rpx;
  956. .tabs-item{
  957. font-size: 28rpx;
  958. font-family: 'Source Han Sans CN VF', sans-serif;
  959. font-weight: 500;
  960. color: #999999;
  961. }
  962. .tabs-item.active{
  963. color: #0bbc58;
  964. }
  965. }
  966. /* 图表区域 */
  967. .chart-section {
  968. background: #FFFFFF;
  969. border-radius: 16rpx;
  970. padding: 24rpx 32rpx 32rpx;
  971. margin: 24rpx 0;
  972. .chart-header {
  973. display: flex;
  974. justify-content: space-between;
  975. align-items: center;
  976. margin-bottom: 24rpx;
  977. .chart-tabs {
  978. display: flex;
  979. gap: 48rpx;
  980. overflow-x: auto;
  981. white-space: nowrap;
  982. .chart-tab-item {
  983. font-size: 28rpx;
  984. font-family: 'Source Han Sans CN VF', sans-serif;
  985. font-weight: 500;
  986. color: #999999;
  987. position: relative;
  988. padding-bottom: 8rpx;
  989. transition: all 0.3s;
  990. &.active {
  991. color: #0bbc58;
  992. font-weight: 700;
  993. &::after {
  994. content: '';
  995. position: absolute;
  996. bottom: 0;
  997. left: 0;
  998. right: 0;
  999. height: 4rpx;
  1000. background: #0bbc58;
  1001. border-radius: 2rpx;
  1002. }
  1003. }
  1004. }
  1005. }
  1006. .chart-dropdown {
  1007. .dropdown-icon {
  1008. font-size: 28rpx;
  1009. color: #999999;
  1010. }
  1011. }
  1012. }
  1013. .chart-content {
  1014. .chart-legend {
  1015. display: flex;
  1016. justify-content: space-between;
  1017. align-items: center;
  1018. margin-bottom: 16rpx;
  1019. .legend-item {
  1020. display: flex;
  1021. align-items: center;
  1022. gap: 8rpx;
  1023. .legend-dot {
  1024. width: 16rpx;
  1025. height: 16rpx;
  1026. background: #0bbc58;
  1027. border-radius: 50%;
  1028. }
  1029. .legend-text {
  1030. font-size: 24rpx;
  1031. font-family: 'Source Han Sans CN VF', sans-serif;
  1032. font-weight: 400;
  1033. color: #042118;
  1034. }
  1035. }
  1036. .legend-average {
  1037. .average-text {
  1038. font-size: 24rpx;
  1039. font-family: 'Source Han Sans CN VF', sans-serif;
  1040. font-weight: 400;
  1041. color: #999999;
  1042. }
  1043. }
  1044. }
  1045. .chart-canvas-container {
  1046. width: 100%;
  1047. height: 400rpx;
  1048. .chart-canvas {
  1049. width: 100%;
  1050. height: 100%;
  1051. }
  1052. }
  1053. }
  1054. }
  1055. .copy-icon{
  1056. width: 40rpx;
  1057. height: 40rpx;
  1058. }
  1059. /* 历史数据表格 */
  1060. .history-section {
  1061. background: #FFFFFF;
  1062. border-radius: 16rpx;
  1063. padding: 24rpx 32rpx 32rpx;
  1064. .history-header {
  1065. margin-bottom: 24rpx;
  1066. .history-title {
  1067. font-size: 32rpx;
  1068. font-family: 'Source Han Sans CN VF', sans-serif;
  1069. font-weight: 700;
  1070. color: #042118;
  1071. }
  1072. }
  1073. .history-table {
  1074. margin-bottom: 24rpx;
  1075. .table-container {
  1076. display: flex;
  1077. position: relative;
  1078. /* 固定列 */
  1079. .fixed-column {
  1080. width: 240rpx;
  1081. position: relative;
  1082. z-index: 2;
  1083. background: #FFFFFF;
  1084. .fixed-header {
  1085. border-bottom: 2rpx solid #F0F0F0;
  1086. padding: 16rpx 0;
  1087. .header-cell.fixed {
  1088. font-size: 24rpx;
  1089. font-family: 'Source Han Sans CN VF', sans-serif;
  1090. font-weight: 500;
  1091. color: #666666;
  1092. text-align: left;
  1093. padding-left: 0;
  1094. }
  1095. }
  1096. .fixed-body {
  1097. .fixed-row {
  1098. padding: 16rpx 0;
  1099. border-bottom: 1rpx solid #F5F5F5;
  1100. height: 80rpx;
  1101. display: flex;
  1102. align-items: center;
  1103. .body-cell.fixed {
  1104. font-size: 24rpx;
  1105. font-family: 'Source Han Sans CN VF', sans-serif;
  1106. font-weight: 400;
  1107. color: #042118;
  1108. text-align: left;
  1109. padding-left: 0;
  1110. }
  1111. }
  1112. }
  1113. }
  1114. /* 可滑动列 */
  1115. .scrollable-column {
  1116. flex: 1;
  1117. overflow-x: auto;
  1118. white-space: nowrap;
  1119. /* 隐藏滚动条 */
  1120. &::-webkit-scrollbar {
  1121. display: none;
  1122. }
  1123. scrollbar-width: none;
  1124. .scrollable-header {
  1125. display: flex;
  1126. border-bottom: 2rpx solid #F0F0F0;
  1127. padding: 20rpx 0;
  1128. .header-cell {
  1129. min-width: 140rpx;
  1130. font-size: 24rpx;
  1131. font-family: 'Source Han Sans CN VF', sans-serif;
  1132. font-weight: 500;
  1133. color: #666666;
  1134. text-align: center;
  1135. // 超出隐藏
  1136. overflow: hidden;
  1137. text-overflow: ellipsis;
  1138. white-space: nowrap;
  1139. margin-right: 10rpx;
  1140. }
  1141. }
  1142. .scrollable-body {
  1143. .scrollable-row {
  1144. display: flex;
  1145. padding: 16rpx 0;
  1146. border-bottom: 1rpx solid #F5F5F5;
  1147. height: 80rpx;
  1148. align-items: center;
  1149. .body-cell {
  1150. min-width: 140rpx;
  1151. font-size: 24rpx;
  1152. font-family: 'Source Han Sans CN VF', sans-serif;
  1153. font-weight: 400;
  1154. color: #042118;
  1155. text-align: center;
  1156. margin-right: 10rpx;
  1157. position: relative;
  1158. }
  1159. }
  1160. }
  1161. }
  1162. }
  1163. }
  1164. .pagination {
  1165. display: flex;
  1166. justify-content: space-between;
  1167. align-items: center;
  1168. .pagination-btn {
  1169. font-size: 24rpx;
  1170. font-family: 'Source Han Sans CN VF', sans-serif;
  1171. font-weight: 400;
  1172. padding: 6rpx 18rpx;
  1173. border-radius: 8rpx;
  1174. transition: all 0.3s;
  1175. &.prev-btn {
  1176. color: #656565;
  1177. border: 1px solid #E4E7ED;
  1178. }
  1179. &.next-btn {
  1180. color: #0bbc58;
  1181. border: 1px solid #0bbc58;
  1182. }
  1183. }
  1184. .pagination-info {
  1185. font-size: 28rpx;
  1186. font-family: 'Source Han Sans CN VF', sans-serif;
  1187. font-weight: 400;
  1188. color: #999999;
  1189. }
  1190. }
  1191. }
  1192. </style>