deviceData.vue 33 KB

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