deviceData.vue 31 KB

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