云链智安app
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

index.vue 32KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. <template>
  2. <view class="container">
  3. <!-- -->
  4. <view class="container_title">
  5. <l-liquid v-model:current="modelVale" :percent="target" :outline="true" background="#007545"
  6. waveColor="#007545" innerColor="rgba(#007545, 0.1)">
  7. <text class="liquid_text">{{devicedata.soc}} <text class="income_unit">%</text></text>
  8. </l-liquid>
  9. </view>
  10. <view class="container_box">
  11. <view class="health">
  12. {{$t('devicedetails.label')}}
  13. </view>
  14. <view class="income_box">
  15. <view class="income">
  16. <view class="income_yesterday">
  17. <image class="income_image" src="/static/realtimepower.png" mode="aspectFill" />
  18. <view class="income_yesterday1">{{$t('devicedetails.power')}}:</view>
  19. <view class="income_yesterday2">{{devicedata.realTimepower}} <text class="income_unit">kW</text></view>
  20. </view>
  21. <view class="income_tired">
  22. <image class="income_image" src="/static/electriccurrent.png" mode="aspectFill" />
  23. <view class="income_tired1">{{$t('devicedetails.charge')}}:</view>
  24. <view class="income_tired2">{{devicedata.chargingCurrent}} <text class="income_unit">A</text></view>
  25. </view>
  26. </view>
  27. <view class="income">
  28. <view class="income_yesterday">
  29. <image class="income_image" src="/static/cumulativestorage.png" mode="aspectFill" />
  30. <view class="income_yesterday1">{{$t('devicedetails.today')}}:</view>
  31. <view class="income_yesterday2">{{devicedata.dayExportKwh}} <text class="income_unit">kWh</text></view>
  32. </view>
  33. <view class="income_tired">
  34. <image class="income_image" src="/static/storage.png" mode="aspectFill" />
  35. <view class="income_tired1">{{$t('devicedetails.total')}}:</view>
  36. <view class="income_tired2">{{devicedata.accumulativeExportKwh}} <text class="income_unit">kWh</text></view>
  37. </view>
  38. </view>
  39. <view class="income">
  40. <view class="income_yesterday">
  41. <image class="income_image" src="/static/totalvoltage.png" mode="aspectFill" />
  42. <view class="income_yesterday1">{{$t('devicedetails.battery')}}:</view>
  43. <view class="income_yesterday2">{{devicedata.totalVoltageOfBattery}} <text class="income_unit">V</text></view>
  44. </view>
  45. <view class="income_tired">
  46. <image class="income_image" src="/static/biandianzhan.png" mode="aspectFill" />
  47. <view class="income_tired1">{{$t('devicedetails.insulation')}}:</view>
  48. <view class="income_tired2">{{devicedata.insulationImpedance}} <text class="income_unit">kQ</text></view>
  49. </view>
  50. </view>
  51. <view class="income_income">
  52. <view class="income_income_yesterday">
  53. <image class="income_image" src="/static/device1.png" mode="aspectFit" />
  54. <view class="income_yesterday1">{{$t('devicedetails.title')}}:</view>
  55. <view class="income_yesterday2">{{devicedata.name}}</view>
  56. </view>
  57. </view>
  58. <view class="income_income">
  59. <view class="income_income_yesterday">
  60. <image class="income_image" src="/static/model.png" mode="aspectFit" />
  61. <view class="income_tired1">{{$t('devicedetails.model')}}:</view>
  62. <view class="income_tired2">{{devicedata.equipmentmodel}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- 顶部标签栏 -->
  68. <!-- <view class="toptabbar">
  69. <top-tabbar :tabIndex="tabIndex" :tabBars="tabBars" @toggleToptab="toggleTab" selectedBottomColor="#30c58d"
  70. selectedTextColor="#343434" textColor="#7d7e80" bgColor="#ffffff"></top-tabbar>
  71. </view> -->
  72. <!-- <view class="datecalendar">
  73. <view class="datecalendar_1">
  74. <view @click="ondatecalendar(1)" class="datecalendar_1sun"
  75. :style="brightcalendar == 1?'backgroundColor:#007544;color:#ffffff':'backgroundColor:#ffffff'">
  76. </view>
  77. <view @click="ondatecalendar(2)" class="datecalendar_1moon"
  78. :style="brightcalendar == 2?'backgroundColor:#007544;color:#ffffff':'backgroundColor:#ffffff'">
  79. </view>
  80. <view @click="ondatecalendar(3)" class="datecalendar_1year"
  81. :style="brightcalendar==3?'backgroundColor:#007544;color:#ffffff':'backgroundColor:#ffffff'">
  82. </view>
  83. </view>
  84. <view v-if="brightcalendar!=3" class="datecalendar_2" @click="Dateselection">
  85. {{date}}
  86. </view>
  87. </view> -->
  88. <!-- <KDatePicker v-model="show" :type="selectiondata" :modelValue="date" :is-disabled="isDisabled"
  89. @change="handleChange" :formatter="formatter" /> -->
  90. <!-- 图表 -->
  91. <!-- <view class="qiun_data">
  92. <view class="qiun_title" v-if="brightcalendar == 1">
  93. {{tabIndex==0?'电量(MWh/日)':'收益(元/日)'}}
  94. </view>
  95. <view class="qiun_title" v-if="brightcalendar == 2">
  96. {{tabIndex==0?'电量(MWh/月)':'收益(万元/月)'}}
  97. </view>
  98. <view class="qiun_title" v-if="brightcalendar == 3">
  99. {{tabIndex==0?'电量(MWh/年)':'收益(万元/年)'}}
  100. </view>
  101. <qiun-data-charts type="column" :opts="opts" :ontouch="true" :chartData="chartData" />
  102. </view> -->
  103. <!-- <view class="qiun_data">
  104. <view class="qiun_title" v-if="brightcalendar == 1">
  105. {{tabIndex==0?'电压(V)':'温度(℃)'}}
  106. </view>
  107. <view class="qiun_title" v-if="brightcalendar == 2">
  108. {{tabIndex==0?'电压(V)':'温度(℃)'}}
  109. </view>
  110. <qiun-data-charts type="area" :opts="optsline" :ontouch="true" :chartData="chartDataline" />
  111. </view> -->
  112. <!-- <view class="container_box">
  113. <view class="income_box">
  114. <view class="incomeweekday">
  115. <view class="weekday1">
  116. <view class="income_yesterday1">设备ID:</view>
  117. </view>
  118. <view class="restday1">
  119. <view class="income_moon1">型号:</view>
  120. </view>
  121. </view>
  122. </view>
  123. </view> -->
  124. <view class="energy">
  125. <view class="energy_title">
  126. <!-- 运行计划 -->
  127. {{$t('devicedetails.schedule')}}
  128. </view>
  129. <view class="energy_calendar">
  130. <uni-calendar
  131. :insert="true"
  132. :lunar="true"
  133. :selected="selecteddata"
  134. @change="oncalendar"
  135. @monthSwitch="oncalendar"
  136. />
  137. </view>
  138. </view>
  139. <view class="container_box">
  140. <view class="income_box">
  141. <view class="incomeweekday">
  142. <view class="weekday1" @click="weekday(1)" :style="weekdaytype==1?'border: 1rpx solid #2979ff;color:#2979ff':'border: 1rpx solid #fff'">
  143. <view class="weekday"></view>
  144. <view class="income_yesterday1" :style="weekdaytype==1?'color:#2979ff':'color: #999999;'">{{$t('devicedetails.weekdays')}}</view>
  145. </view>
  146. <view class="restday1" @click="weekday(2)" :style="weekdaytype==2?'border: 1rpx solid #2979ff;color:#2979ff':'border: 1rpx solid #fff'">
  147. <view class="restday"></view>
  148. <view class="income_moon1" :style="weekdaytype==2?'color:#2979ff':'color: #999999;'">{{$t('devicedetails.weekends')}}</view>
  149. </view>
  150. <view class="restday2"> </view>
  151. <view class="restday2"> </view>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="power_box1">
  156. <view class="powerstation">
  157. <view class="power_yesterdaystrategy" @click="ondevices">
  158. <view class="strategybox">
  159. <image class="strategycalendar" src="/static/calendar.png" mode=""></image>
  160. <view class="power_iconstrategy">
  161. <view class="power_yesterday11">{{date}}</view>
  162. <view class="power_yesterday11">{{$t('devicedetails.listTitle')}}:{{weekdaytype==1?$t('devicedetails.weekdays'):$t('devicedetails.weekends')}}</view>
  163. </view>
  164. </view>
  165. <view class="power_strategy">{{$t('devicedetails.detailTitle')}}<image class="energy_jumpto" src="/static/jumpto.png" mode=""></image></view>
  166. </view>
  167. </view>
  168. </view>
  169. <view class="power_box2">
  170. <view class="powerstation">
  171. <view class="power_yesterdaystrategy">
  172. <view class="strategybox">
  173. <image class="strategy" src="/static/startstop.png" mode=""></image>
  174. <view class="power_iconstrategy">
  175. <view class="power_yesterday11">{{$t('devicedetails.powerControl')}}</view>
  176. <!-- <view class="power_yesterday1">2024-09-13</view> -->
  177. </view>
  178. </view>
  179. <l-switch v-model="defaultValue" disabled="false" :placeholder="[$t('devicedetails.on'), $t('devicedetails.off')]" dotSize="14px" height="22px" width="32px"></l-switch>
  180. <!-- <view class="power_strategy1" @click="toggle('center')">开启<image class="energy_jumpto" src="/static/jumpto.png" mode=""></image></view> -->
  181. <!-- <view class="power_strategy2" @click="toggle('center')">停止<image class="energy_jumpto" src="/static/jumpto.png" mode=""></image></view> -->
  182. </view>
  183. </view>
  184. </view>
  185. <!-- 普通弹窗-->
  186. <uni-popup ref="popupRef" background-color="#fff" @change="change" borderRadius="10rpx">
  187. <view class="popup-content" :class="{ 'popup-height': devicetype === 'left' || devicetype === 'right' }">
  188. <view class="popuptext">
  189. 是否开启?
  190. </view>
  191. <view class="popupbutton">
  192. <button class="cancel-button" size="mini" @click="handleCancel">取消</button>
  193. <button class="confirm-button" @click="handleConfirm">确认</button>
  194. </view>
  195. </view>
  196. </uni-popup>
  197. </view>
  198. </template>
  199. <!-- -->
  200. <!-- -->
  201. <script setup>
  202. import {
  203. onMounted,
  204. ref
  205. } from 'vue';
  206. import topTabbar from '@/components/top-tabbar.vue';
  207. import KDatePicker from '../../components/k-date-picker/KDatePicker.vue';
  208. import { formatAmount,Accumulateddischarge } from '@/utils/format.js'; // 引入格式化函数
  209. import request from '@/utils/request';
  210. import {
  211. getMonthRange,
  212. getMonth
  213. } from '@/utils/date.js';
  214. import { onLoad,onHide,onShow,onUnload } from '@dcloudio/uni-app';
  215. const deviceid = ref()
  216. onLoad((options) => {
  217. console.log('页面加载,参数为:', options);
  218. if (options) {
  219. uni.setNavigationBarTitle({
  220. title: options.stationName||'设备',
  221. });
  222. deviceid.value = options.id
  223. // options.date
  224. }
  225. });
  226. const interval = ref(null)
  227. onHide(() => {
  228. // 页面隐藏时也可以选择清理定时器
  229. if (interval.value) {
  230. clearInterval(interval.value);
  231. interval.value = null
  232. }
  233. });
  234. onUnload(() => {
  235. // 页面隐藏时也可以选择清理定时器
  236. if (interval.value) {
  237. clearInterval(interval.value);
  238. interval.value = null
  239. }
  240. });
  241. onShow(() => {
  242. // 页面再次显示时重新启动定时器
  243. if (!interval.value) {
  244. setIntervalDemo();
  245. }
  246. });
  247. const setIntervalDemo =() => {
  248. interval.value = setInterval(() => {
  249. getoverview(); // 首页收益充电
  250. }, 10000)
  251. };
  252. onMounted(() => {
  253. const monthRange = getMonthRange();
  254. date.value = monthRange.firstDay.substring(0, 7);
  255. getoverview(); // 首页收益充电
  256. // getmuitiStationinfo(); // 电站接口
  257. operationplan(); // 运行计划
  258. // gettemperature(); // 温度统计图
  259. });
  260. const target = ref(0)
  261. const modelVale = ref(0)
  262. const devicedata = ref({})
  263. const getoverview = async () => {
  264. console.log(deviceid.value);
  265. // /station/f39b18f4-100c-498d-af97-d4ea70d0c7de/system/stationHDES0124050011/realtime/info
  266. try {
  267. const response = await request({
  268. url: `/connectionapp/system/${deviceid.value}/realtime/info`,
  269. method: 'POST',
  270. header: {
  271. 'Content-Type': 'application/x-www-form-urlencoded'
  272. },
  273. });
  274. devicedata.value = response.data
  275. modelVale.value =devicedata.value.soc*1
  276. target.value =devicedata.value.soc*1
  277. } catch (error) {
  278. console.error('登录失败:', error);
  279. }
  280. }
  281. // 电站数量
  282. const muitiStationinfo = ref()
  283. const onlineStatus = ref()
  284. const getmuitiStationinfo = async () => {
  285. try {
  286. const response = await request({
  287. url: '/muitiStation/page/info',
  288. method: 'POST',
  289. header: {
  290. 'Content-Type': 'application/x-www-form-urlencoded'
  291. },
  292. data: {
  293. state: '',
  294. city: '',
  295. country: '',
  296. county: '',
  297. keyword: '',
  298. keywordCategory: 0,
  299. countryCode: '',
  300. provinceCode: '',
  301. cityCode: '',
  302. countyCode: '',
  303. pn: 1,
  304. ps: 99,
  305. onlineStatus: ''
  306. }
  307. });
  308. muitiStationinfo.value = response.data.stationPicArray
  309. } catch (error) {
  310. console.error('登录失败:', error);
  311. }
  312. };
  313. // 图表数据
  314. const chartData = ref();
  315. const chartDataline = ref();
  316. const opts = ref({
  317. enableScroll: true, //开启滚动条,X轴配置里需要配置itemCount单屏幕数据点数量
  318. color: ["#B2D5CB"],
  319. padding: [15, 10, 0, 15],
  320. backgroundColor: "#B2D5CB",
  321. legend: false,
  322. xAxis: {
  323. disableGrid: true,
  324. itemCount: 5, //单屏数据密度即图表可视区域内显示的X轴数据点数量,仅在启用enableScroll时有效
  325. scrollShow: false, //是否显示滚动条,配合拖拽滚动使用(即仅在启用【基本配置】的 enableScroll 时有效)
  326. },
  327. yAxis: {
  328. gridType: "dash",
  329. dashLength: 2,
  330. },
  331. extra: {
  332. line: {
  333. type: "straight",
  334. width: 2,
  335. activeType: "hollow",
  336. },
  337. column: {
  338. barBorderRadius: [4, 4, 0, 0],
  339. },
  340. }
  341. })
  342. const optsline = ref({
  343. enableScroll: true, //开启滚动条,X轴配置里需要配置itemCount单屏幕数据点数量
  344. color: ["#B2D5CB"],
  345. padding: [15, 10, 0, 15],
  346. backgroundColor: "#B2D5CB",
  347. legend: false,
  348. xAxis: {
  349. disableGrid: true,
  350. itemCount: 5, //单屏数据密度即图表可视区域内显示的X轴数据点数量,仅在启用enableScroll时有效
  351. scrollShow: false, //是否显示滚动条,配合拖拽滚动使用(即仅在启用【基本配置】的 enableScroll 时有效)
  352. boundaryGap: "justify",
  353. },
  354. yAxis: {
  355. gridType: "dash",
  356. dashLength: 2,
  357. },
  358. extra: {
  359. area: {
  360. type: "straight",
  361. opacity: 0.2,
  362. addLine: true,
  363. width: 2,
  364. gradient: false,
  365. activeType: "hollow"
  366. }
  367. }
  368. })
  369. const params = ref();
  370. // 多站电量
  371. const getelectricity = async () => {
  372. try {
  373. const response = await request({
  374. url: '/api/va/hisdata/hour/datas',
  375. method: 'GET',
  376. header: {
  377. 'Content-Type': 'application/x-www-form-urlencoded'
  378. },
  379. data:{
  380. page:1,
  381. rows:100,
  382. starttime:date.value,
  383. filed:filed.value,
  384. filter:filter.value,
  385. uuid:deviceid.value
  386. }
  387. });
  388. let arr1 = [];
  389. let arr2 = [];
  390. response.data.list.forEach((item, index) => {
  391. if (brightcalendar.value == 1) {
  392. const ymdSubstring = item.recordtime.slice(3, 5);
  393. arr1.push(ymdSubstring);
  394. if(tabIndex.value==0){
  395. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  396. }else{
  397. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/1000).toFixed(2));
  398. }
  399. } else if(brightcalendar.value == 2) {
  400. const ymdSubstring = item.recordtime;
  401. arr1.push(ymdSubstring);
  402. if(tabIndex.value==0){
  403. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  404. }else{
  405. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/10000).toFixed(2));
  406. }
  407. }else if(brightcalendar.value == 3){
  408. const ymdSubstring = item.recordtime;
  409. arr1.push(ymdSubstring);
  410. if(tabIndex.value==0){
  411. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  412. }else{
  413. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/10000).toFixed(2));
  414. }
  415. }
  416. })
  417. // setTimeout(() => {
  418. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  419. let res = {}
  420. if(tabIndex.value==0){
  421. res = {
  422. categories: arr1,
  423. series: [{
  424. name: "电量",
  425. data: arr2
  426. },
  427. ]
  428. };
  429. }else{
  430. res = {
  431. categories: arr1,
  432. series: [{
  433. name: "收益",
  434. data: arr2
  435. },
  436. ]
  437. };
  438. }
  439. chartData.value = JSON.parse(JSON.stringify(res));
  440. chartData.value ={
  441. categories: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  442. series: [
  443. {
  444. name: '销量',
  445. data: [120, 200, 150, 80, 70, 110, 130]
  446. }
  447. ]
  448. }
  449. // }, 500);
  450. } catch (error) {
  451. console.error('登录失败:', error);
  452. };
  453. };
  454. // 温度电压
  455. const gettemperature = async () => {
  456. try {
  457. const response = await request({
  458. url: '/api/va/hisdata/hour/datas',
  459. method: 'GET',
  460. header: {
  461. 'Content-Type': 'application/x-www-form-urlencoded'
  462. },
  463. data:{
  464. page:1,
  465. rows:100,
  466. starttime:date.value,
  467. filed:filed.value,
  468. filter:filter.value,
  469. uuid:deviceid.value
  470. }
  471. });
  472. let arr1 = [];
  473. let arr2 = [];
  474. response.data.list.forEach((item, index) => {
  475. if (brightcalendar.value == 1) {
  476. const ymdSubstring = item.recordtime.slice(3, 5);
  477. arr1.push(ymdSubstring);
  478. if(tabIndex.value==0){
  479. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  480. }else{
  481. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/1000).toFixed(2));
  482. }
  483. } else if(brightcalendar.value == 2) {
  484. const ymdSubstring = item.recordtime;
  485. arr1.push(ymdSubstring);
  486. if(tabIndex.value==0){
  487. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  488. }else{
  489. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/10000).toFixed(2));
  490. }
  491. }else if(brightcalendar.value == 3){
  492. const ymdSubstring = item.recordtime;
  493. arr1.push(ymdSubstring);
  494. if(tabIndex.value==0){
  495. arr2.push((item['5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta']/1000).toFixed(2));
  496. }else{
  497. arr2.push((item['a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta']/10000).toFixed(2));
  498. }
  499. }
  500. })
  501. // setTimeout(() => {
  502. //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
  503. let res = {}
  504. if(tabIndex.value==0){
  505. res = {
  506. categories: arr1,
  507. series: [{
  508. name: "电量",
  509. data: arr2
  510. },
  511. ]
  512. };
  513. }else{
  514. res = {
  515. categories: arr1,
  516. series: [{
  517. name: "收益",
  518. data: arr2
  519. },
  520. ]
  521. };
  522. }
  523. chartDataline.value = JSON.parse(JSON.stringify(res));
  524. chartDataline.value ={
  525. categories: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  526. series: [
  527. {
  528. name: '销量',
  529. data: [120, 200, 150, 80, 70, 110, 130]
  530. }
  531. ]
  532. }
  533. // }, 500);
  534. } catch (error) {
  535. console.error('登录失败:', error);
  536. };
  537. };
  538. // 选中标签的索引
  539. const tabIndex = ref(0);
  540. // 导航栏标签列表
  541. const tabBars = ref([{
  542. name: '电量',
  543. id: 0
  544. },
  545. {
  546. name: '收益',
  547. id: 1
  548. },
  549. ]);
  550. // 切换标签
  551. const toggleTab = (index) => {
  552. tabIndex.value = index;
  553. if(tabIndex.value==0){
  554. filter.value = '5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta,469dc1cc-e5ad-492f-a350-f7bc473d55ee_delta'
  555. }else{
  556. filter.value = 'a0acf8cf-7d12-49af-97d9-1a2e630c4bfe_delta'
  557. }
  558. getelectricity();
  559. };
  560. const show = ref(false)
  561. const date = ref('')
  562. const open = () => {
  563. show.value = true;
  564. toggleTab(tabIndex.value);
  565. };
  566. const isDisabled = (value) => {
  567. return value > new Date().getTime()
  568. }
  569. const handleChange = async (value) => {
  570. // 示例用法
  571. try {
  572. date.value = value
  573. show.value = false
  574. getelectricity();
  575. } catch (error) {
  576. console.error(error.message);
  577. }
  578. };
  579. const brightcalendar = ref(1);
  580. const selectiondata = ref('month');
  581. const formatter = ref('YYYY-MM');
  582. const filed = ref('day');
  583. const filter = ref('5c465aaa-b65e-463f-a9ae-a338a630a4c1_delta,469dc1cc-e5ad-492f-a350-f7bc473d55ee_delta');
  584. const ondatecalendar = (e) => {
  585. console.log(e);
  586. brightcalendar.value = e
  587. if (e == 1) {
  588. const monthRange = getMonthRange();
  589. date.value = monthRange.firstDay.substring(0, 7);
  590. filed.value = 'day'
  591. selectiondata.value = 'month'
  592. formatter.value = 'YYYY-MM'
  593. } else if (e == 2) {
  594. const Year = new Date().getFullYear(); // 获取当前年份
  595. date.value = Year
  596. selectiondata.value = 'year'
  597. formatter.value = 'YYYY'
  598. filed.value = 'Month'
  599. } else if (e == 3) {
  600. filed.value = 'year'
  601. }
  602. getelectricity();
  603. }
  604. const Dateselection = (e) => {
  605. console.log(e);
  606. open();
  607. }
  608. // 策略详情
  609. const ondevices = () => {
  610. if(weekdaytype.value==1){
  611. uni.navigateTo({
  612. url: `/pages/strategy/index?id=${deviceid.value}&type=1`
  613. })
  614. }else{
  615. uni.navigateTo({
  616. url: `/pages/strategy/index?id=${deviceid.value}&type=2`
  617. })
  618. }
  619. }
  620. const onhost = () => {
  621. uni.navigateTo({
  622. url: '/pages/devicedetails/index'
  623. })
  624. }
  625. // change
  626. // 日历
  627. const oncalendar = (e) => {
  628. // console.log(e);
  629. let month = 0
  630. if(e.month*1<10){
  631. month = '0' + e.month
  632. }else{
  633. month = e.month
  634. }
  635. date.value = e.year +'-'+month
  636. operationplan();
  637. }
  638. const weekdaytype =ref(1);
  639. // 工作日 休息日
  640. const weekday = (e) => {
  641. // console.log(e);
  642. weekdaytype.value =e
  643. }
  644. // 运行计划
  645. const selecteddata = ref()
  646. const operationplan = async () => {
  647. console.log(deviceid.value);
  648. try {
  649. const response = await request({
  650. url: `/connectionapp/plan`,
  651. method: 'get',
  652. header: {
  653. 'Content-Type': 'application/x-www-form-urlencoded'
  654. },
  655. data:{
  656. grid:deviceid.value,
  657. month:date.value
  658. }
  659. });
  660. // console.log(response);
  661. selecteddata.value = response.data
  662. } catch (error) {
  663. console.error('登录失败:', error);
  664. }
  665. }
  666. // 设备启停
  667. const devicetype =ref('center')
  668. const msgType= ref('success')
  669. const messageText=ref('这是一条成功提示')
  670. const value= ref('')
  671. const popupRef = ref(null)
  672. const toggle=(type)=> {
  673. console.log(type);
  674. devicetype.value = type
  675. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  676. if (popupRef.value) {
  677. popupRef.value.open(type);
  678. }
  679. };
  680. // 处理取消按钮点击事件
  681. const handleCancel=()=> {
  682. console.log('用户点击了取消');
  683. this.$refs.popupRef.close(); // 关闭弹出层
  684. };
  685. // 处理确认按钮点击事件
  686. const handleConfirm=()=> {
  687. console.log('用户点击了确认');
  688. this.$refs.popupRef.close(); // 关闭弹出层
  689. // 在这里添加确认后的逻辑
  690. };
  691. // popup 状态变化事件
  692. const change=(e)=> {
  693. console.log('弹出层状态变化:', e);
  694. }
  695. </script>
  696. <style scoped>
  697. uni-page {
  698. width: 100%;
  699. height: 100%;
  700. overflow: auto;
  701. visibility: hidden;
  702. }
  703. .container {
  704. background: linear-gradient(to bottom, #007545 -40%, #f0f5f5 40%, #f0f5f5 100%);
  705. box-sizing: border-box;
  706. padding-bottom:1rpx;
  707. }
  708. .l-liquid {
  709. /* background-color: #007545; */
  710. border: 10rpx solid #007545;
  711. }
  712. .liquid_text {
  713. font-size: 38rpx;
  714. color: #fff;
  715. }
  716. .container_title {
  717. width: 100%;
  718. height: 400rpx;
  719. display: flex;
  720. justify-content: center;
  721. align-items: center;
  722. }
  723. .container_box {
  724. width: 100%;
  725. padding: 0rpx 20rpx;
  726. box-sizing: border-box;
  727. display: flex;
  728. flex-direction: column;
  729. align-items: center;
  730. }
  731. .health{
  732. color: #007545;
  733. font-size: 28rpx;
  734. margin-bottom: 20rpx;
  735. }
  736. .container_box1{
  737. width: 100%;
  738. padding: 0rpx 20rpx;
  739. box-sizing: border-box;
  740. margin-top: 20rpx;
  741. }
  742. .container_parameter {
  743. width: 100%;
  744. height: 500rpx;
  745. background-color: #ffffff;
  746. border-radius: 10rpx;
  747. }
  748. .income_box {
  749. width: 100%;
  750. background-color: #ffffff;
  751. box-sizing: border-box;
  752. border-radius: 16rpx;
  753. }
  754. .income {
  755. width: 100%;
  756. display: flex;
  757. align-items: center;
  758. padding: 20rpx;
  759. box-sizing: border-box;
  760. /* justify-content: space-around; */
  761. /* justify-content: space-between; */
  762. }
  763. .income_income{
  764. width: 100%;
  765. display: flex;
  766. align-items: center;
  767. padding: 20rpx;
  768. box-sizing: border-box;
  769. }
  770. .income_income_yesterday{
  771. /* width: 320rpx; */
  772. display: flex;
  773. align-items: center;
  774. }
  775. .income_image {
  776. width: 36rpx;
  777. height: 36rpx;
  778. margin-right: 6rpx;
  779. }
  780. .income_yesterday,
  781. .income_moon,
  782. .income_tired {
  783. width: 320rpx;
  784. display: flex;
  785. align-items: center;
  786. /* justify-content: space-around; */
  787. /* justify-content: space-between; */
  788. }
  789. .income_yesterday1,
  790. .income_moon1,
  791. .income_tired1 {
  792. font-size: 26rpx;
  793. color: #999999;
  794. }
  795. .income_yesterday2,
  796. .income_moon2,
  797. .income_tired2 {
  798. font-size: 26rpx;
  799. margin-left: 8rpx;
  800. color: #222;
  801. }
  802. .qiun_data {
  803. width: 100%;
  804. padding: 16rpx;
  805. overflow: auto;
  806. box-sizing: border-box;
  807. }
  808. .qiun_title {
  809. height: 12%;
  810. font-size: 28rpx;
  811. margin-left: 20rpx;
  812. }
  813. .power_box {
  814. width: 100%;
  815. padding: 0rpx 20rpx;
  816. box-sizing: border-box;
  817. margin-bottom: 30rpx;
  818. }
  819. .power_box1 {
  820. width: 100%;
  821. padding: 0rpx 20rpx;
  822. box-sizing: border-box;
  823. }
  824. .power_box2{
  825. width: 100%;
  826. padding: 0rpx 20rpx;
  827. box-sizing: border-box;
  828. margin-bottom: 30rpx;
  829. }
  830. .powerstation {
  831. width: 100%;
  832. display: flex;
  833. align-items: center;
  834. justify-content: space-between;
  835. }
  836. .power_yesterday,
  837. .power_moon,
  838. .power_tired {
  839. width: 31%;
  840. padding: 20rpx 0rpx;
  841. display: flex;
  842. flex-direction: column;
  843. align-items: center;
  844. justify-content: center;
  845. border-radius: 10rpx;
  846. background-color: #ffffff;
  847. }
  848. .power_yesterday image,
  849. .power_moon image,
  850. .power_tired image {
  851. width: 40rpx;
  852. height: 40rpx;
  853. }
  854. .power_yesterday image {
  855. /* background-color: #007544; */
  856. }
  857. .power_moon image {
  858. /* background-color: #3774f3; */
  859. }
  860. .power_tired image {
  861. /* background-color: #b3cef9; */
  862. }
  863. .power_icon{
  864. display: flex;
  865. }
  866. .power_yesterday1,
  867. .power_moon1,
  868. .power_tired1 {
  869. font-size: 26rpx;
  870. margin-left:10rpx;
  871. color: #999999;
  872. }
  873. .power_yesterday11{
  874. font-size: 26rpx;
  875. margin-left:10rpx;
  876. color: #222;
  877. }
  878. .power_moon2,.power_yesterday2,.power_tired2{
  879. margin-top:10rpx;
  880. font-size: 24rpx;
  881. }
  882. .toptabbar {
  883. width: 100%;
  884. height: 80rpx;
  885. margin-top: 20px;
  886. padding: 10rpx 20rpx;
  887. box-sizing: border-box;
  888. }
  889. /deep/ .uni-scroll-view-content {
  890. display: flex;
  891. justify-content: center;
  892. }
  893. .datecalendar {
  894. display: flex;
  895. justify-content: space-between;
  896. padding: 0rpx 24rpx;
  897. margin-top: 60rpx;
  898. }
  899. .datecalendar_1 {
  900. width: 320rpx;
  901. height: 60rpx;
  902. display: flex;
  903. font-size: 28rpx;
  904. border: 0.2rpx solid #999999;
  905. border-radius: 40rpx;
  906. overflow: overlay;
  907. }xz
  908. .datecalendar_1sun {
  909. flex: 1;
  910. display: flex;
  911. align-items: center;
  912. justify-content: center;
  913. color: #222222;
  914. background-color: #ffffff;
  915. }
  916. .datecalendar_1moon {
  917. flex: 1;
  918. display: flex;
  919. align-items: center;
  920. justify-content: center;
  921. background-color: #ffffff;
  922. border-left: 0.2rpx solid #999999;
  923. border-right: 0.2rpx solid #999999;
  924. }
  925. .datecalendar_1year {
  926. flex: 1;
  927. display: flex;
  928. align-items: center;
  929. justify-content: center;
  930. background-color: #ffffff;
  931. }
  932. .datecalendar_2 {
  933. width: 180rpx;
  934. height: 60rpx;
  935. display: flex;
  936. align-items: center;
  937. justify-content: center;
  938. font-size: 28rpx;
  939. border: 0.2rpx solid #999999;
  940. border-radius: 40rpx;
  941. }
  942. .qiun_data {
  943. width: 100%;
  944. height: 600rpx;
  945. padding: 16rpx;
  946. overflow: auto;
  947. box-sizing: border-box;
  948. }
  949. .qiun_title {
  950. height: 12%;
  951. font-size: 28rpx;
  952. margin-left: 20rpx;
  953. }
  954. /* --------------------------------------- */
  955. .energy {
  956. width: 100%;
  957. padding: 20rpx;
  958. box-sizing: border-box;
  959. }
  960. .energy_hostbox{
  961. padding: 20rpx;
  962. box-sizing: border-box;
  963. }
  964. .energy_host {
  965. width: 100%;
  966. padding: 20rpx;
  967. box-sizing: border-box;
  968. background-color: #ffffff;
  969. margin-bottom: 10rpx;
  970. border-radius: 10rpx;
  971. }
  972. .energy_title {
  973. width: 100%;
  974. }
  975. .energy_box {
  976. width: 100%;
  977. background-color: #B2D5CB;
  978. border-radius: 10rpx;
  979. margin-top: 20rpx;
  980. padding: 30rpx 16rpx;
  981. display: flex;
  982. align-items: center;
  983. box-sizing: border-box;
  984. }
  985. .energy_boximage {
  986. width: 88rpx;
  987. height: 88rpx;
  988. }
  989. .energy_boxtitle {
  990. flex: 1;
  991. display: flex;
  992. flex-direction: column;
  993. margin-left: 20rpx;
  994. }
  995. .energy_boxtitle1 {
  996. font-size: 28rpx;
  997. }
  998. .energy_boxtitle2 {
  999. font-size: 28rpx;
  1000. margin-top: 4rpx;
  1001. }
  1002. .energy_right {
  1003. display: flex;
  1004. align-items: center;
  1005. }
  1006. .energy_boxright {
  1007. display: flex;
  1008. flex-direction: column;
  1009. align-items: center;
  1010. justify-content: center;
  1011. }
  1012. .energy_boxright1 {
  1013. padding: 8rpx 6rpx;
  1014. font-size: 26rpx;
  1015. border-radius: 50rpx;
  1016. display: flex;
  1017. align-items: center;
  1018. justify-content: center;
  1019. background-color: rgba(0, 116, 84, .3);
  1020. color: #fff;
  1021. }
  1022. .energy_boxright2 {
  1023. font-size: 24rpx;
  1024. margin-top: 10rpx;
  1025. }
  1026. .energy_jumpto {
  1027. width: 30rpx;
  1028. height: 30rpx;
  1029. margin-left: 8rpx;
  1030. }
  1031. .energy_calendar{
  1032. margin-top:30rpx;
  1033. border-radius: 10rpx;
  1034. overflow: hidden;
  1035. }
  1036. .incomeweekday{
  1037. width: 100%;
  1038. height: 100rpx;
  1039. display: flex;
  1040. align-items: center;
  1041. /* justify-content: space-around; */
  1042. }
  1043. .weekday{
  1044. width: 20rpx;
  1045. height: 20rpx;
  1046. border-radius: 50rpx;
  1047. background-color: red;
  1048. margin-right: 10rpx;
  1049. }
  1050. .restday1{
  1051. display: flex;
  1052. align-items: center;
  1053. margin-left: 40rpx;
  1054. padding: 10rpx;
  1055. border-radius: 100rpx;
  1056. box-sizing: border-box;
  1057. }
  1058. .restday2{
  1059. display: flex;
  1060. align-items: center;
  1061. margin-left: 40rpx;
  1062. border: 1rpx solid #fff;
  1063. padding: 10rpx;
  1064. border-radius: 100rpx;
  1065. box-sizing: border-box;
  1066. }
  1067. .weekday1{
  1068. display: flex;
  1069. align-items: center;
  1070. margin-left: 20rpx;
  1071. padding: 10rpx;
  1072. border-radius: 100rpx;
  1073. box-sizing: border-box;
  1074. }
  1075. .restday{
  1076. width: 20rpx;
  1077. height: 20rpx;
  1078. border-radius: 50rpx;
  1079. background-color: #007545;
  1080. margin-right: 10rpx;
  1081. }
  1082. .power_yesterdaystrategy{
  1083. width: 100%;
  1084. padding: 20rpx 20rpx;
  1085. display: flex;
  1086. align-items: center;
  1087. justify-content: space-between;
  1088. border-radius: 10rpx;
  1089. background-color: #ffffff;
  1090. margin-top: 20rpx;
  1091. overflow: hidden;
  1092. box-sizing: border-box;
  1093. }
  1094. .power_iconstrategy{
  1095. flex-direction: column;
  1096. }
  1097. .strategy{
  1098. width: 60rpx;
  1099. height: 60rpx;
  1100. }
  1101. .strategycalendar{
  1102. width: 60rpx;
  1103. height: 60rpx;
  1104. padding: 6rpx;
  1105. box-sizing: border-box;
  1106. }
  1107. .strategybox{
  1108. display: flex;
  1109. align-items: center;
  1110. }
  1111. .power_strategy{
  1112. font-size: 24rpx;
  1113. color: #ccc;
  1114. display: flex;
  1115. align-items: center;
  1116. }
  1117. .power_strategy1{
  1118. font-size: 24rpx;
  1119. color: #B2D5CB;
  1120. display: flex;
  1121. align-items: center;
  1122. }
  1123. .power_strategy2{
  1124. font-size: 24rpx;
  1125. color: red;
  1126. display: flex;
  1127. align-items: center;
  1128. }
  1129. @mixin flex {
  1130. /* #ifndef APP-NVUE */
  1131. display: flex;
  1132. /* #endif */
  1133. flex-direction: row;
  1134. }
  1135. @mixin height {
  1136. /* #ifndef APP-NVUE */
  1137. height: 100%;
  1138. /* #endif */
  1139. /* #ifdef APP-NVUE */
  1140. flex: 1;
  1141. /* #endif */
  1142. }
  1143. .box {
  1144. @include flex;
  1145. }
  1146. .button {
  1147. @include flex;
  1148. align-items: center;
  1149. justify-content: center;
  1150. flex: 1;
  1151. height: 35px;
  1152. margin: 0 5px;
  1153. border-radius: 5px;
  1154. }
  1155. .example-body {
  1156. background-color: #fff;
  1157. padding: 10px 0;
  1158. }
  1159. .button-text {
  1160. color: #fff;
  1161. font-size: 12px;
  1162. }
  1163. .popup-content {
  1164. @include flex;
  1165. align-items: center;
  1166. justify-content: center;
  1167. padding: 15px;
  1168. background-color: #fff;
  1169. }
  1170. .popup-height {
  1171. @include height;
  1172. width: 400px;
  1173. }
  1174. .text {
  1175. font-size: 12px;
  1176. color: #333;
  1177. }
  1178. .popup-success {
  1179. color: #fff;
  1180. background-color: #e1f3d8;
  1181. }
  1182. .popup-warn {
  1183. color: #fff;
  1184. background-color: #faecd8;
  1185. }
  1186. .popup-error {
  1187. color: #fff;
  1188. background-color: #fde2e2;
  1189. }
  1190. .popup-info {
  1191. color: #fff;
  1192. background-color: #f2f6fc;
  1193. }
  1194. .success-text {
  1195. color: #09bb07;
  1196. }
  1197. .warn-text {
  1198. color: #e6a23c;
  1199. }
  1200. .error-text {
  1201. color: #f56c6c;
  1202. }
  1203. .info-text {
  1204. color: #909399;
  1205. }
  1206. .dialog,
  1207. .share {
  1208. /* #ifndef APP-NVUE */
  1209. display: flex;
  1210. /* #endif */
  1211. flex-direction: column;
  1212. }
  1213. .dialog-box {
  1214. padding: 10px;
  1215. }
  1216. .dialog .button,
  1217. .share .button {
  1218. /* #ifndef APP-NVUE */
  1219. width: 100%;
  1220. /* #endif */
  1221. margin: 0;
  1222. margin-top: 10px;
  1223. padding: 3px 0;
  1224. flex: 1;
  1225. }
  1226. .dialog-text {
  1227. font-size: 14px;
  1228. color: #333;
  1229. }
  1230. /* 弹出层内容样式 */
  1231. .popup-content {
  1232. padding: 20px;
  1233. text-align: center;
  1234. border-radius: 20rpx;
  1235. }
  1236. /* 文本样式 */
  1237. .popuptext {
  1238. font-size: 26rpx;
  1239. color: #333;
  1240. margin-bottom: 20rpx;
  1241. }
  1242. /* 取消按钮样式 */
  1243. .cancel-button {
  1244. width: 120rpx;
  1245. height: 60rpx;
  1246. margin-top: 10rpx;
  1247. font-size: 24rpx;
  1248. background-color: #f0f0f0;
  1249. color: #333;
  1250. margin-right: 40rpx;
  1251. }
  1252. /* 确认按钮样式 */
  1253. .confirm-button {
  1254. width: 120rpx;
  1255. height: 60rpx;
  1256. margin-top: 10rpx;
  1257. font-size: 24rpx;
  1258. background-color: #007aff;
  1259. color: #fff;
  1260. }
  1261. /* 根据设备类型调整高度 */
  1262. .popup-height {
  1263. height: 200px;
  1264. }
  1265. .popupbutton{
  1266. display: flex;
  1267. }
  1268. .income_unit{
  1269. font-size: 20rpx;
  1270. }
  1271. </style>