deviceDetail.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  1. <template>
  2. <!-- 设备详情 -->
  3. <view class="content">
  4. <view class="name_box">
  5. <view class="name_content">{{ devInfo.devName }}</view>
  6. </view>
  7. <view class="radar-box">
  8. <view
  9. :style="{
  10. width: `${length / 200}px`,
  11. height: `${width / 200}px`,
  12. position: 'relative',
  13. overflow: 'hidden',
  14. }"
  15. :class="[
  16. width < 25500 && length < 25000 ? 'tranStyle' : 'center',
  17. ]"
  18. >
  19. <view
  20. v-for="(item, index) in modules"
  21. :key="index"
  22. class="moduleContent"
  23. >
  24. <view
  25. :class="item.type"
  26. :style="{
  27. width: `${item.width / 2}px`,
  28. height: `${item.length / 2}px`,
  29. top: `${item.top / 2}px`,
  30. left: `${item.left / 2}px`,
  31. transform: `rotate(${item.rotate}deg)`,
  32. 'transform-origin': 'center center',
  33. }"
  34. >
  35. <image
  36. class="module-img"
  37. :src="`../../static/furnitures/${item.type}.png`"
  38. mode=""
  39. />
  40. </view>
  41. </view>
  42. <template v-if="devType == 'LNB'">
  43. <view v-for="item in targetPoints" :key="item.id">
  44. <image
  45. class="action-icon-M"
  46. :style="{
  47. position: 'absolute',
  48. transform: `translate3d(${
  49. item.displayX / 2 + 100
  50. }px, ${
  51. -item.displayY / 2 + 100
  52. }px, 0) translate(-50%, -50%)`,
  53. zIndex: 9999,
  54. transition: 'transform 1s linear',
  55. willChange: 'transform',
  56. }"
  57. :src="`../../static/${lnbAction}.png`"
  58. mode=""
  59. />
  60. </view>
  61. </template>
  62. <template v-else>
  63. <image
  64. v-if="actionName"
  65. class="action-icon-G"
  66. :style="{
  67. top: `${top / 200}px`,
  68. left: `${left / 200}px`,
  69. }"
  70. :src="`../../images/furnitures/${actionName}.png`"
  71. mode=""
  72. />
  73. </template>
  74. </view>
  75. </view>
  76. <view class="switchBox">
  77. <text class="name">呼吸灯</text>
  78. <switch
  79. :value="statusLight"
  80. @change="handleLightChange"
  81. :active-value="1"
  82. :inactive-value="0"
  83. size="24px"
  84. active-color="#07c160"
  85. inactive-color="#eeeff1"
  86. style="transform: scale(0.8)"
  87. />
  88. </view>
  89. <view class="notice-info">
  90. <view class="notice_title" @click="discrepancy">
  91. <text style="color: #95a4b3; font-size: 28rpx">{{
  92. todayDate
  93. }}</text>
  94. <image src="../../static/rightArrow.png"></image>
  95. </view>
  96. <view
  97. @click="getFrenEcharts()"
  98. class="title"
  99. v-if="
  100. devInfo.installPosition == 'Bedroom' ||
  101. (breathRate === 0 && breathRate !== '')
  102. "
  103. >
  104. <view
  105. class="title-text"
  106. style="color: #111111; font-size: 30rpx"
  107. >当前呼吸率</view
  108. >
  109. <view
  110. style="
  111. display: flex;
  112. justify-content: center;
  113. align-items: center;
  114. "
  115. >
  116. <view
  117. class="title-btn"
  118. style="color: #111111; font-size: 30rpx"
  119. v-if="breathRate !== ''"
  120. >
  121. {{ breathRate }}次/分钟</view
  122. >
  123. <view
  124. v-else
  125. class="title-btn"
  126. style="color: #111111; font-size: 30rpx"
  127. >
  128. 暂无
  129. </view>
  130. <image
  131. src="../../static/rightArrow.png"
  132. style="margin-left: auto; width: 30rpx; height: 30rpx"
  133. ></image>
  134. </view>
  135. </view>
  136. <view class="title" v-if="devInfo.installPosition == 'Toilet'">
  137. <view class="title-text" style="color: #22dea7"
  138. >今日卫生间使用频次</view
  139. >
  140. <view class="title-btn" style="color: #22dea7"
  141. >{{
  142. freQuenceList.length == "" ? "0" : freQuenceList.length
  143. }}次</view
  144. >
  145. </view>
  146. <view class="title" v-if="devInfo.installPosition != 'Toilet'">
  147. <view class="title-text" style="color: #22dea7"
  148. >今日进出频次</view
  149. >
  150. <view class="title-btn" style="color: #22dea7"
  151. >{{
  152. freQuenceList.length == "" ? "0" : freQuenceList.length
  153. }}次</view
  154. >
  155. </view>
  156. <view
  157. class="stayDetail"
  158. v-if="freQuenceList.length > 0 && freQuenceList.length == 1"
  159. >
  160. <view v-for="item in freQuenceList" :key="item.id">
  161. <view class="stayDetail-item">
  162. <view class="stayDetail-text"
  163. >{{
  164. item.info.start_time.slice(11, 16)
  165. }}目标进入</view
  166. >
  167. <view class="stayDetail-btn"
  168. >{{
  169. item.info.end_time.slice(11, 16)
  170. }}目标离开</view
  171. >
  172. </view>
  173. </view>
  174. </view>
  175. <view
  176. class="stayDetail"
  177. v-if="freQuenceList.length > 0 && freQuenceList.length > 1"
  178. >
  179. <swiper
  180. class="auto-scroll-swiper"
  181. :indicator-dots="false"
  182. :autoplay="false"
  183. :interval="3000"
  184. :circular="true"
  185. :display-multiple-items="1"
  186. :vertical="false"
  187. :current="currentIndex"
  188. @change="onSwiperChange"
  189. >
  190. <swiper-item
  191. v-for="item in freQuenceList"
  192. :key="item.id"
  193. class="stayDetail-item"
  194. >
  195. <view class="stayDetail-text"
  196. >{{
  197. item.info.start_time.slice(11, 16)
  198. }}目标进入</view
  199. >
  200. <view class="stayDetail-btn"
  201. >{{
  202. item.info.end_time.slice(11, 16)
  203. }}目标离开</view
  204. >
  205. </swiper-item>
  206. </swiper>
  207. </view>
  208. <!-- <view class="title" v-if="devInfo.installPosition == 'Toilet'">
  209. <view class="title-text" style="color: #ff976a"
  210. >昨日卫生间使用频次</view
  211. >
  212. <view class="title-btn" style="color: #ff976a"
  213. >{{
  214. freQuenceList.length == "" ? "0" : freQuenceList.length
  215. }}次</view
  216. >
  217. </view>
  218. <view class="title" v-else>
  219. <view class="title-text" style="color: #ff976a"
  220. >昨日进出频次</view
  221. >
  222. <view class="title-btn" style="color: #ff976a"
  223. >{{
  224. freQuenceList.length == "" ? "0" : freQuenceList.length
  225. }}次</view
  226. >
  227. </view> -->
  228. </view>
  229. <view class="box" v-if="!breathShow">
  230. <view class="handle-btn">
  231. <view class="btn1" @click="shareDevice">分享</view>
  232. <view class="btn1" @click="gotoSetting">设置</view>
  233. <view class="btn2" @click="healthAlarm"> 健康闹钟 </view>
  234. </view>
  235. </view>
  236. <view class="box" v-else>
  237. <view class="handle-btn">
  238. <view class="closeBreath" @click="breathShow = false"
  239. >关闭呼吸率曲线图</view
  240. >
  241. <view class="btn2" @click="saveBreath"> 保存呼吸率曲线图 </view>
  242. </view>
  243. </view>
  244. <!-- 遮罩层 -->
  245. <view class="mask" v-if="shareModel" @click="shareModel = false"></view>
  246. <!-- 弹窗内容 -->
  247. <view class="share-modal" v-if="shareModel">
  248. <view class="modal-header">
  249. <text class="cancel-btn" @click="shareModel = false">取消</text>
  250. <text class="modal-title">分享</text>
  251. <text class="confirm-btn" @click="onShareConfirm()">确认</text>
  252. </view>
  253. <view class="modal-body">
  254. <view class="info-row">
  255. <view class="label">设备序列号:</view>
  256. <view class="value">{{ devInfo.clientId }}</view>
  257. </view>
  258. <view class="info-row">
  259. <view class="label">设备名称:</view>
  260. <view class="value">{{ devInfo.devName }}</view>
  261. </view>
  262. <view class="input-row phoneInfo">
  263. <view>被分享人</view>
  264. <input
  265. class="input"
  266. placeholder="请输入手机号"
  267. type="number"
  268. v-model="sharedPhone"
  269. />
  270. </view>
  271. <view class="funChoice">
  272. <view class="funItem" @click="smChange()">
  273. <label class="simple-radio">
  274. <radio
  275. :value="messageFlag"
  276. color="#7c5345"
  277. :checked="messageFlag == true"
  278. class="hide-original"
  279. />
  280. <text>短信权限</text>
  281. </label>
  282. </view>
  283. <view class="funItem">
  284. <label class="simple-radio" @click="snChange()">
  285. <radio
  286. :value="serviceNumberFlag"
  287. color="#7c5345"
  288. :checked="serviceNumberFlag == true"
  289. class="hide-original"
  290. />
  291. <text>服务号通知</text>
  292. </label>
  293. </view>
  294. <view class="funItem">
  295. <label class="simple-radio" @click="vfChange()">
  296. <radio
  297. :value="voipFlag"
  298. color="#7c5345"
  299. :checked="voipFlag == true"
  300. class="hide-original"
  301. />
  302. <text>语音通话</text>
  303. </label>
  304. </view>
  305. </view>
  306. </view>
  307. </view>
  308. <view class="modal-mask" v-if="choiceVisible" @click="closeChoice">
  309. <view class="modal-container">
  310. <view class="modal-header">
  311. <text class="title">请选择分享方式</text>
  312. </view>
  313. <view class="modal-buttons">
  314. <!-- 手机号分析按钮 -->
  315. <button class="btn phone-btn" @click="handlePhoneAnalysis">
  316. <text>手机号分享</text>
  317. </button>
  318. <!-- 链接分享按钮 -->
  319. <button class="btn link-btn" @click="handleLinkShare">
  320. <text>链接分享</text>
  321. </button>
  322. </view>
  323. </view>
  324. </view>
  325. <!-- ECharts图标模块 -->
  326. <view v-if="breathShow" class="echartsClass">
  327. <image
  328. src="../../static/closePng.png"
  329. class="closePng"
  330. @click="breathShow = false"
  331. ></image>
  332. <l-echart
  333. id="chart-canvas"
  334. canvas-id="chart-canvas"
  335. ref="chartRef"
  336. @finished="initChart"
  337. v-if="breathShow"
  338. @click="breathShow = false"
  339. ></l-echart>
  340. </view>
  341. <alarModel
  342. v-if="isInitAlarm"
  343. :clientIdProp="clientIdProp"
  344. @sendChange="receptionChange"
  345. @sendHealth="receptHealth"
  346. />
  347. </view>
  348. </template>
  349. <script>
  350. import * as echarts from "../../uni_modules/lime-echart/static/echarts.min";
  351. export default {
  352. data() {
  353. return {
  354. width: 0, //检测区域宽度
  355. length: 0, //检测区域长度
  356. xOffset: 0,
  357. yOffset: 0,
  358. devInfo: "",
  359. actionName: "",
  360. startDate: "",
  361. endDate: "",
  362. softWare: "",
  363. statusLight: 0,
  364. currentDate: new Date().getTime(),
  365. lnbAction: "action8",
  366. wsj: false,
  367. todayWcTimes: "",
  368. stayDetail: "",
  369. todayDate: "",
  370. dev_id: "",
  371. nowTime: "",
  372. devName: "",
  373. devType: "",
  374. localPhone: uni.getStorageSync("phone"),
  375. startArr: [],
  376. freQuenceList: [],
  377. // mqtt相关
  378. currentIndex: 0,
  379. modules: [],
  380. autoPlayinterval: "",
  381. choiceVisible: "",
  382. // 手机号分享授权模块
  383. shareModel: false,
  384. alarmModel: false,
  385. sharedPhone: "",
  386. messageFlag: true,
  387. serviceNumberFlag: true,
  388. voipFlag: true,
  389. isInitAlarm: "",
  390. // mqtt模块
  391. targetPoints: {},
  392. inactivityTimer: null,
  393. left: 0,
  394. top: 0,
  395. clientIdProp: null,
  396. breathRate: "",
  397. breathShow: false,
  398. breathRpmList: [],
  399. option: {
  400. title: [
  401. {
  402. text: "呼吸率曲线",
  403. left: "center",
  404. top: 20,
  405. textStyle: { fontSize: 14 },
  406. },
  407. {
  408. text: "BPM: 0 次/分钟",
  409. left: "center",
  410. top: 50,
  411. textStyle: { fontSize: 12, color: "#805246" },
  412. },
  413. {
  414. text: "时间 (秒)",
  415. left: "right",
  416. top: "bottom",
  417. textStyle: { fontSize: 12, color: "#888888" },
  418. },
  419. ],
  420. grid: { left: 60, right: 20, top: 80, bottom: 50 },
  421. xAxis: {
  422. type: "category",
  423. data: Array.from({ length: 60 }, (_, i) => i + 1),
  424. boundaryGap: false,
  425. splitLine: { show: false },
  426. },
  427. yAxis: {
  428. type: "value",
  429. min: 0,
  430. max: 40,
  431. name: "呼吸率(次)",
  432. nameLocation: "end",
  433. nameGap: 20,
  434. nameTextStyle: { fontSize: 12, color: "#888888" },
  435. splitLine: { show: true },
  436. },
  437. series: [
  438. {
  439. type: "line",
  440. smooth: true,
  441. symbol: "none",
  442. lineStyle: { color: "#805246", width: 2 },
  443. data: Array(60).fill(0),
  444. },
  445. ],
  446. animation: true,
  447. animationDuration: 100,
  448. },
  449. index: 0,
  450. loopTimer: null,
  451. };
  452. },
  453. computed: {},
  454. methods: {
  455. getdevInfo(devId) {
  456. this.$http
  457. .get(`wap/device/queryDeviceInfoById`, {
  458. devId: devId,
  459. })
  460. .then((res) => {
  461. if (res.data.data) {
  462. this.devInfo = res.data.data;
  463. this.devType = this.devInfo.devType;
  464. this.width =
  465. Math.abs(
  466. this.devInfo.yyEnd - this.devInfo.yyStart
  467. ) * 100;
  468. this.length =
  469. Math.abs(
  470. this.devInfo.xxEnd - this.devInfo.xxStart
  471. ) * 100;
  472. this.xOffset =
  473. (this.devInfo.xxStart + this.devInfo.xxEnd) * 50;
  474. this.yOffset =
  475. -(this.devInfo.yyStart + this.devInfo.yyEnd) * 50;
  476. this.statusLight = this.devInfo.statusLight;
  477. }
  478. })
  479. .catch((err) => {});
  480. },
  481. getdevRoomInfo(devId) {
  482. this.$http
  483. .get(`wap/room/readRoom`, {
  484. devId: devId,
  485. })
  486. .then((res) => {
  487. if (res.data.data) {
  488. this.modules = res.data.data.furnitures;
  489. }
  490. });
  491. },
  492. handleLightChange(e) {
  493. let newValue = e.detail.value == true ? 1 : 0;
  494. this.$http
  495. .post(`wap/device/statusLight`, {
  496. statusLight: newValue,
  497. devId: this.devInfo.devId,
  498. })
  499. .then((res) => {
  500. if (res.data.code == 200) {
  501. uni.showToast({
  502. title: "操作成功",
  503. icon: "success",
  504. });
  505. this.statusLight = newValue;
  506. } else {
  507. wx.showToast({
  508. title: res.data.message,
  509. icon: "none",
  510. });
  511. }
  512. });
  513. },
  514. parseDeviceItem(devItemStr) {
  515. try {
  516. const devItem = JSON.parse(devItemStr);
  517. if (!devItem || !devItem.devId || !devItem.clientId) {
  518. throw new Error("设备信息不完整");
  519. }
  520. return devItem;
  521. } catch (e) {
  522. throw new Error("设备信息解析失败: " + e.message);
  523. }
  524. },
  525. // 分享功能模块
  526. shareDevice() {
  527. this.choiceVisible = true;
  528. },
  529. onShareConfirm() {
  530. if (!this.sharedPhone) {
  531. uni.showModal({
  532. content: "请填写手机号!",
  533. showCancel: false,
  534. });
  535. return;
  536. }
  537. let reg_tel =
  538. /^(13[0-9]|14[01456879]|15[0-3,5-9]|16[2567]|17[0-8]|18[0-9]|19[0-3,5-9])\d{8}$/;
  539. if (!reg_tel.test(this.sharedPhone)) {
  540. uni.showModal({
  541. content: "请填写正确手机号!",
  542. showCancel: false,
  543. });
  544. return;
  545. }
  546. let shareParam = {
  547. sharerUserId: uni.getStorageSync("userId"),
  548. devId: this.devInfo.devId,
  549. sharerPhone: uni.getStorageSync("phone"),
  550. sharedUserId: "",
  551. sharedPhone: this.sharedPhone,
  552. messageFlag: this.messageFlag == true ? 0 : 1,
  553. serviceNumberFlag: this.serviceNumberFlag == true ? 0 : 1,
  554. voipFlag: this.voipFlag == true ? 0 : 1,
  555. };
  556. this.$http
  557. .post("wap/share/deviceShare", shareParam, {
  558. header: {
  559. "Content-Type": "application/json;charset=UTF-8",
  560. },
  561. })
  562. .then((res) => {
  563. if (res.data.code == 200) {
  564. uni.showToast({
  565. title: "分享成功",
  566. icon: "success",
  567. duration: 1500,
  568. });
  569. } else {
  570. uni.showToast({
  571. title: res.data.message,
  572. icon: "none",
  573. duration: 1500,
  574. });
  575. }
  576. });
  577. this.shareModel = false;
  578. },
  579. closeChoice() {
  580. this.choiceVisible = false;
  581. },
  582. handlePhoneAnalysis() {
  583. this.choiceVisible = false;
  584. this.shareModel = true;
  585. },
  586. handleLinkShare() {
  587. this.choiceVisible = false;
  588. uni.navigateTo({
  589. url:
  590. "/pagesA/linkShare/linkShare?devInfo=" +
  591. JSON.stringify(this.devInfo),
  592. });
  593. },
  594. smChange() {
  595. this.messageFlag = !this.messageFlag;
  596. },
  597. snChange() {
  598. this.serviceNumberFlag = !this.serviceNumberFlag;
  599. },
  600. vfChange() {
  601. this.voipFlag = !this.voipFlag;
  602. },
  603. gotoSetting() {
  604. uni.navigateTo({
  605. url:
  606. "/pagesA/deviceSetting/deviceSetting?devInfo=" +
  607. JSON.stringify(this.devInfo),
  608. });
  609. },
  610. getFrequency(clientId) {
  611. this.$http
  612. .post(`wap/stats/alarmEventsQuery`, {
  613. clientId: clientId,
  614. createTimeStart: this.$time(new Date()),
  615. createTimeEnd: this.$time(new Date()),
  616. eventType: 1,
  617. })
  618. .then((res) => {
  619. if (res.data.code == 200) {
  620. if (res.data.data.rows.length > 0) {
  621. this.freQuenceList = this.parseJsonToObjects(
  622. res.data.data.rows
  623. );
  624. } else {
  625. this.freQuenceList = [];
  626. }
  627. } else {
  628. wx.showToast({
  629. title: res.data.message,
  630. icon: "none",
  631. });
  632. }
  633. });
  634. },
  635. parseJsonToObjects(jsonArray) {
  636. return jsonArray.map((item) => {
  637. // 解析info字段的JSON字符串
  638. let infoData = {};
  639. try {
  640. infoData = JSON.parse(item.info);
  641. } catch (e) {
  642. console.error("Failed to parse info JSON:", e);
  643. }
  644. return {
  645. id: item.id,
  646. clientId: item.clientId,
  647. tenantId: item.tenantId,
  648. devName: item.devName,
  649. uuid: item.uuid,
  650. planUuid: item.planUuid,
  651. eventType: item.eventType,
  652. info: infoData,
  653. isHandle: item.isHandle,
  654. createTime: item.createTime,
  655. remark: item.remark,
  656. };
  657. });
  658. },
  659. // 健康闹钟方法
  660. healthAlarm() {
  661. uni.navigateTo({
  662. url:
  663. "/pagesA/healthAlarm/healthAlarm?devInfo=" +
  664. JSON.stringify(this.devInfo),
  665. });
  666. },
  667. onSwiperChange(event) {
  668. const current = event.detail.current;
  669. const totalItems = this.freQuenceList.length;
  670. if (current === totalItems - 1) {
  671. this.autoplay = false;
  672. }
  673. this.currentIndex = current;
  674. },
  675. autoSwipe() {
  676. if (this.freQuenceList && this.freQuenceList.length > 0) {
  677. setInterval(() => {
  678. let nextIndex = this.currentIndex + 1;
  679. if (nextIndex >= this.freQuenceList.length) {
  680. nextIndex = 0; // 循环到第一个项目
  681. }
  682. this.currentIndex = nextIndex;
  683. }, 3000); // 每3秒自动滚动一次
  684. }
  685. },
  686. discrepancy() {
  687. uni.navigateTo({
  688. url:
  689. "/pagesA/discrepancy/discrepancy?freQuenceList=" +
  690. JSON.stringify(this.freQuenceList),
  691. });
  692. },
  693. getCurrentDate() {
  694. const now = new Date();
  695. this.currentDate = `${now.getFullYear()}-${
  696. now.getMonth() + 1
  697. }月${now.getDate().toString().padStart(2, "0")}日`;
  698. },
  699. receptionChange(val) {
  700. this.targetPoints = val;
  701. },
  702. receptHealth(val) {
  703. this.breathRate = val;
  704. this.setEcharts(val);
  705. },
  706. getToday() {
  707. const today = new Date();
  708. const year = today.getFullYear();
  709. const month = today.getMonth() + 1;
  710. const day = today.getDate();
  711. this.todayDate = `${year}年${month}月${day}日`;
  712. },
  713. // echarts图表模块
  714. getOption(list) {
  715. // 固定 X 轴 [0 ~ 60]
  716. const xData = Array.from({ length: 61 }, (_, i) => i);
  717. const recent = list.slice(-61);
  718. const data = new Array(61).fill(null);
  719. for (let i = 0; i < recent.length; i++) {
  720. data[i] = recent[i];
  721. }
  722. return {
  723. title: [
  724. { text: "呼吸率曲线", left: "center", top: 20 },
  725. {
  726. text: `BPM: ${recent[recent.length - 1] || 0} 次/分钟`,
  727. left: "center",
  728. top: 50,
  729. textStyle: { fontSize: 12, color: "#805246" },
  730. },
  731. {
  732. text: "时间 (秒)",
  733. left: "right",
  734. top: "bottom",
  735. textStyle: {
  736. fontSize: 10,
  737. color: "#888888",
  738. fontWeight: "normal",
  739. },
  740. },
  741. ],
  742. grid: { left: 60, right: 20, top: 80, bottom: 50 },
  743. xAxis: {
  744. type: "category",
  745. data: xData,
  746. boundaryGap: false,
  747. },
  748. yAxis: {
  749. type: "value",
  750. min: 0,
  751. max: 40,
  752. name: "呼吸率(次)",
  753. nameLocation: "end",
  754. nameGap: 20,
  755. nameTextStyle: {
  756. fontSize: 10,
  757. color: "#888888",
  758. fontWeight: "normal",
  759. },
  760. splitLine: { show: true },
  761. },
  762. series: [
  763. {
  764. type: "line",
  765. smooth: true,
  766. symbol: "none",
  767. data: data,
  768. showSymbol: false,
  769. lineStyle: { color: "#7a4e42", width: 2 },
  770. },
  771. ],
  772. };
  773. },
  774. getFrenEcharts() {
  775. if (this.breathRate === "" || this.breathRate === null) {
  776. uni.showToast({
  777. title: "暂无呼吸率",
  778. icon: "none",
  779. duration: 1500,
  780. });
  781. return;
  782. }
  783. this.breathShow = true;
  784. this.$nextTick(() => {
  785. this.initChart();
  786. });
  787. },
  788. initChart() {
  789. if (!this.$refs.chartRef) return;
  790. if (this.chartInstance) {
  791. this.chartInstance.dispose();
  792. this.chartInstance = null;
  793. }
  794. this.$refs.chartRef.init(echarts, (chart) => {
  795. this.chartInstance = chart;
  796. chart.setOption(this.option, true);
  797. });
  798. },
  799. setEcharts(val) {
  800. if (!Array.isArray(this.breathRpmList)) {
  801. this.breathRpmList = [];
  802. }
  803. this.breathRpmList.push(val);
  804. // if (this.breathRpmList.length > 60) {
  805. // this.breathRpmList = this.breathRpmList.shift();
  806. // }
  807. if (!this.chartInstance) return;
  808. const option = this.getOption(this.breathRpmList);
  809. this.chartInstance.setOption(option, { notMerge: true });
  810. },
  811. saveBreath() {
  812. const chart = this.$refs.chartRef;
  813. if (!chart) {
  814. uni.showToast({ title: "图表未渲染", icon: "none" });
  815. return;
  816. }
  817. chart.canvasToTempFilePath({
  818. success: (res) => {
  819. uni.saveImageToPhotosAlbum({
  820. filePath: res.tempFilePath,
  821. success: () => {
  822. uni.showToast({
  823. title: "保存成功",
  824. icon: "success",
  825. });
  826. },
  827. fail: (err) => {
  828. console.error("保存失败:", err);
  829. uni.showToast({
  830. title: "保存失败",
  831. icon: "none",
  832. });
  833. },
  834. });
  835. },
  836. fail: (err) => {
  837. console.error("导出失败:", err);
  838. uni.showToast({
  839. title: "导出失败",
  840. icon: "none",
  841. });
  842. },
  843. });
  844. },
  845. },
  846. onShow() {
  847. this.clientIdProp = uni.getStorageSync("clientIDetail");
  848. this.isInitAlarm = true;
  849. this.getToday();
  850. },
  851. onLoad(options) {
  852. const devItem = this.parseDeviceItem(options.devItem);
  853. const { devId, clientId } = devItem;
  854. this.getFrequency(clientId);
  855. this.getdevInfo(devId);
  856. this.getdevRoomInfo(devId);
  857. this.autoPlayinterval = setTimeout(() => {
  858. this.autoSwipe();
  859. }, 3000);
  860. this.getCurrentDate();
  861. },
  862. onUnload() {
  863. this.isInitAlarm = false;
  864. this.inactivityTimer = null;
  865. this.autoPlayinterval = null;
  866. },
  867. onHide() {
  868. this.inactivityTimer = null;
  869. this.autoPlayinterval = null;
  870. this.isInitAlarm = false;
  871. },
  872. };
  873. </script>
  874. <style lang="less" scoped>
  875. .content {
  876. height: 100vh;
  877. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  878. box-sizing: border-box;
  879. padding-top: 20rpx;
  880. .name_box {
  881. display: flex;
  882. justify-content: center;
  883. align-items: center;
  884. margin: 0 auto 37rpx 0;
  885. .name_content {
  886. display: inline-flex;
  887. background: rgba(255, 255, 255, 0.65);
  888. border-radius: 37rpx;
  889. padding: 6rpx 18rpx;
  890. }
  891. }
  892. .radar-box {
  893. margin: 0 auto;
  894. position: relative;
  895. display: flex;
  896. align-items: center;
  897. justify-content: center;
  898. width: 710rpx;
  899. height: 710rpx;
  900. background: #ffffff;
  901. border-radius: 37.5rpx;
  902. box-sizing: border-box;
  903. .center {
  904. position: absolute;
  905. background-color: #fff;
  906. border: 14rpx solid #333333;
  907. background-image: url("http://jkld.radar-power.com//uploadFiles/framework/file/20250620/toilet_bg.png");
  908. background-repeat: no-repeat;
  909. background-position: center;
  910. transform: scale(1.3);
  911. .moduleContent {
  912. position: relative;
  913. view {
  914. position: absolute;
  915. }
  916. .module-img {
  917. width: 100%;
  918. height: 100%;
  919. display: block;
  920. }
  921. }
  922. }
  923. .tranStyle {
  924. position: absolute;
  925. background-color: #fff;
  926. border: 9rpx solid #333333;
  927. background-image: url("http://jkld.radar-power.com//uploadFiles/framework/file/20250620/toilet_bg.png");
  928. background-repeat: no-repeat;
  929. background-position: center;
  930. transform: scale(2.2);
  931. .moduleContent {
  932. overflow: hidden;
  933. // position: relative;
  934. view {
  935. position: absolute;
  936. }
  937. .module-img {
  938. width: 100%;
  939. height: 100%;
  940. display: block;
  941. }
  942. }
  943. }
  944. .action-icon-G {
  945. position: absolute;
  946. width: 100rpx;
  947. height: 100rpx;
  948. }
  949. .action-icon-M {
  950. position: absolute;
  951. width: 50rpx;
  952. height: 50rpx;
  953. }
  954. }
  955. .switchBox {
  956. width: 710rpx;
  957. height: 94rpx;
  958. margin: 18rpx auto;
  959. padding: 0 37rpx;
  960. display: flex;
  961. align-items: center;
  962. background: #ffffff;
  963. border-radius: 37rpx;
  964. box-sizing: border-box;
  965. .name {
  966. color: #111111;
  967. font-size: 32rpx;
  968. }
  969. }
  970. .notice-info {
  971. width: 710rpx;
  972. max-height: 300rpx;
  973. overflow: hidden;
  974. padding: 30rpx 37rpx 10rpx 37rpx;
  975. background: #ffffff;
  976. border-radius: 37rpx;
  977. box-sizing: border-box;
  978. margin: 0 auto;
  979. .notice_title {
  980. display: flex;
  981. align-items: space-between;
  982. image {
  983. margin-left: auto;
  984. width: 30rpx;
  985. height: 30rpx;
  986. }
  987. }
  988. .title {
  989. margin-top: 10rpx;
  990. margin-bottom: 10rpx;
  991. font-family: PingFang SC, PingFang SC;
  992. font-weight: 500;
  993. font-size: 34rpx;
  994. color: #1757dd;
  995. display: flex;
  996. align-items: center;
  997. justify-content: space-between;
  998. .title-text {
  999. font-size: 28rpx;
  1000. font-weight: 500;
  1001. color: #1757dd;
  1002. }
  1003. .title-btn {
  1004. font-size: 28rpx;
  1005. font-weight: 500;
  1006. color: #5a5a5a;
  1007. }
  1008. }
  1009. .stayDetail {
  1010. height: 80rpx;
  1011. overflow: hidden;
  1012. margin-top: 10rpx;
  1013. margin-bottom: 10rpx;
  1014. padding-left: 20rpx;
  1015. font-family: PingFang SC, PingFang SC;
  1016. font-weight: 500;
  1017. font-size: 34rpx;
  1018. .stayDetail-item {
  1019. display: flex;
  1020. padding-bottom: 5rpx !important;
  1021. padding-top: 10rpx !important;
  1022. box-sizing: border-box;
  1023. line-height: 60rpx;
  1024. .stayDetail-text {
  1025. width: 40%;
  1026. font-size: 28rpx;
  1027. height: 30rpx !important;
  1028. }
  1029. .stayDetail-btn {
  1030. padding-left: 30rpx;
  1031. font-size: 28rpx;
  1032. height: 30rpx !important;
  1033. }
  1034. }
  1035. }
  1036. }
  1037. .box {
  1038. position: fixed;
  1039. bottom: 0;
  1040. left: 0;
  1041. width: 100vw;
  1042. height: 168rpx;
  1043. padding: 0 37rpx;
  1044. background: #ffffff;
  1045. box-sizing: border-box;
  1046. .handle-btn {
  1047. margin-top: 40rpx;
  1048. display: flex;
  1049. align-items: center;
  1050. justify-content: space-between;
  1051. .btn1 {
  1052. display: flex;
  1053. align-items: center;
  1054. justify-content: center;
  1055. width: 155rpx;
  1056. height: 94rpx;
  1057. background: #ffebe4;
  1058. border-radius: 28rpx;
  1059. font-weight: 500;
  1060. color: #111111;
  1061. font-size: 32rpx;
  1062. text-align: center;
  1063. }
  1064. .btn2 {
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. width: 328rpx;
  1069. height: 94rpx;
  1070. background: linear-gradient(
  1071. 105.95deg,
  1072. #a27867 0%,
  1073. #74483d 100%
  1074. );
  1075. border-radius: 28rpx;
  1076. box-shadow: 0rpx 4.69rpx 18.75rpx rgba(72, 41, 29, 0.15),
  1077. 0rpx 9.38rpx 9.38rpx rgba(154, 132, 89, 0.2),
  1078. 0rpx -4.69rpx 28.13rpx 4.69rpx #a16647 inset;
  1079. font-family: MiSans;
  1080. font-weight: 500;
  1081. color: #ffffff;
  1082. font-size: 32rpx;
  1083. }
  1084. .closeBreath {
  1085. display: flex;
  1086. align-items: center;
  1087. justify-content: center;
  1088. width: 328rpx;
  1089. height: 94rpx;
  1090. background: #ffebe4;
  1091. border-radius: 28rpx;
  1092. font-weight: 500;
  1093. color: #111111;
  1094. font-size: 32rpx;
  1095. text-align: center;
  1096. }
  1097. }
  1098. }
  1099. /* 弹窗部分样式 */
  1100. .mask {
  1101. position: fixed;
  1102. left: 0;
  1103. top: 0;
  1104. right: 0;
  1105. bottom: 0;
  1106. background: rgba(0, 0, 0, 0.3);
  1107. z-index: 100;
  1108. }
  1109. .share-modal {
  1110. position: fixed;
  1111. left: 0;
  1112. right: 0;
  1113. bottom: 0;
  1114. background: #fff;
  1115. border-radius: 24rpx 24rpx 0 0;
  1116. z-index: 101;
  1117. height: 750rpx;
  1118. .modal-header {
  1119. display: flex;
  1120. justify-content: space-between;
  1121. align-items: center;
  1122. padding: 32rpx 32rpx 0 32rpx;
  1123. font-size: 30rpx;
  1124. .cancel-btn {
  1125. color: #888;
  1126. font-size: 32rpx;
  1127. }
  1128. .modal-title {
  1129. color: #111111;
  1130. font-size: 36rpx;
  1131. }
  1132. .confirm-btn {
  1133. color: #996e5f;
  1134. font-size: 32rpx;
  1135. }
  1136. }
  1137. .modal-body {
  1138. padding: 50rpx;
  1139. .info-row {
  1140. display: flex;
  1141. margin-bottom: 24rpx;
  1142. font-size: 28rpx;
  1143. padding: 0 20rpx;
  1144. .label {
  1145. color: #111111;
  1146. width: 200rpx;
  1147. font-size: 32rpx;
  1148. text-align-last: justify;
  1149. }
  1150. .value {
  1151. text-align: right;
  1152. width: 65%;
  1153. color: #111111;
  1154. font-size: 32rpx;
  1155. }
  1156. }
  1157. .input-row {
  1158. display: flex;
  1159. align-items: center;
  1160. margin-top: 32rpx;
  1161. border-radius: 40rpx;
  1162. background: #f7f7f7;
  1163. padding: 0 24rpx;
  1164. height: 80rpx;
  1165. .input {
  1166. text-align: right;
  1167. flex: 1;
  1168. border: none;
  1169. background: transparent;
  1170. font-size: 28rpx;
  1171. color: #333;
  1172. }
  1173. }
  1174. .funChoice {
  1175. .funItem {
  1176. .simple-radio {
  1177. display: flex;
  1178. align-items: center;
  1179. padding: 20rpx 0;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. }
  1185. // 分享弹窗样式
  1186. .modal-mask {
  1187. position: fixed;
  1188. top: 0;
  1189. left: 0;
  1190. right: 0;
  1191. bottom: 0;
  1192. background: rgba(0, 0, 0, 0.5);
  1193. display: flex;
  1194. justify-content: center;
  1195. align-items: center;
  1196. z-index: 333;
  1197. .modal-container {
  1198. width: 80%;
  1199. background: #fff;
  1200. border-radius: 16rpx;
  1201. overflow: hidden;
  1202. animation: fadeIn 0.3s;
  1203. .modal-header {
  1204. padding: 30rpx;
  1205. text-align: center;
  1206. border-bottom: 1rpx solid #f5f5f5;
  1207. .title {
  1208. font-size: 36rpx;
  1209. display: block;
  1210. margin-bottom: 10rpx;
  1211. }
  1212. }
  1213. .modal-buttons {
  1214. display: flex;
  1215. flex-direction: column;
  1216. padding: 20rpx;
  1217. .btn {
  1218. flex: 1;
  1219. height: 90rpx;
  1220. margin: 15rpx 0;
  1221. border-radius: 45rpx;
  1222. display: flex;
  1223. align-items: center;
  1224. justify-content: center;
  1225. font-size: 32rpx;
  1226. border: none;
  1227. background: none;
  1228. position: relative;
  1229. }
  1230. .btn-icon {
  1231. width: 40rpx;
  1232. height: 40rpx;
  1233. margin-right: 15rpx;
  1234. }
  1235. .phone-btn {
  1236. background: linear-gradient(
  1237. 105.95deg,
  1238. #ba978a 0%,
  1239. #a27867 100%
  1240. );
  1241. color: white;
  1242. }
  1243. .link-btn {
  1244. background: linear-gradient(
  1245. 105.95deg,
  1246. #a27867 0%,
  1247. #74483d 100%
  1248. );
  1249. color: white;
  1250. }
  1251. }
  1252. }
  1253. }
  1254. .echartsClass {
  1255. position: absolute;
  1256. width: 650rpx;
  1257. height: 600rpx;
  1258. top: -8%;
  1259. left: -37%;
  1260. transform: translate(50%, 50%);
  1261. background: #ffffff;
  1262. .closePng {
  1263. width: 40rpx;
  1264. height: 40rpx;
  1265. position: fixed;
  1266. top: 10rpx;
  1267. right: 10rpx;
  1268. z-index: 999;
  1269. }
  1270. }
  1271. }
  1272. </style>