From ce12fd4407705d429d2d325dfead375f7af99aa1 Mon Sep 17 00:00:00 2001 From: sige Date: Fri, 24 May 2024 19:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E8=AE=BE=E5=A4=87=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AE=BE=E7=BD=AE=E5=A2=9E=E5=8A=A0=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E5=87=BA=E5=8E=82=E8=AE=BE=E7=BD=AE=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../img/icon/exclamation-cricle-red-fill.svg | 17 +++ src/components/MyModal.vue | 133 +++++++++++++++++++++ src/components/Setting/components/Device.vue | 25 ++++ src/main.js | 2 + src/style.scss | 8 ++ src/utils/MyModal.js | 60 ++++++++++ 6 files changed, 245 insertions(+) create mode 100644 src/assets/img/icon/exclamation-cricle-red-fill.svg create mode 100644 src/components/MyModal.vue create mode 100644 src/utils/MyModal.js diff --git a/src/assets/img/icon/exclamation-cricle-red-fill.svg b/src/assets/img/icon/exclamation-cricle-red-fill.svg new file mode 100644 index 0000000..62fc034 --- /dev/null +++ b/src/assets/img/icon/exclamation-cricle-red-fill.svg @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/src/components/MyModal.vue b/src/components/MyModal.vue new file mode 100644 index 0000000..6fec489 --- /dev/null +++ b/src/components/MyModal.vue @@ -0,0 +1,133 @@ + + + \ No newline at end of file diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue index 2d6e43a..174eb2c 100644 --- a/src/components/Setting/components/Device.vue +++ b/src/components/Setting/components/Device.vue @@ -107,6 +107,12 @@ >

+
+

恢复默认设置

+

+

恢复
+

+
@@ -119,10 +125,15 @@ import Down from '@/assets/img/arrow/down.png' import Top from '@/assets/img/arrow/top.png' import { setSettingValJSON, + getAllSettingJSON, changeDisinfectionParameterJSON, updateSettingInRunInfectionJSON, } from '@/mock/command' + +import MyModal from '../../../utils/MyModal' + + const topContainer = () => { const ele = document.getElementById('set_device_container') ele.scrollTop = ele.scrollTop - 100 < 100 ? 0 : ele.scrollTop - 100 @@ -681,6 +692,20 @@ const setSprayLiquidVal = () => { } showSuccessToast('设置成功') } + +// 恢复到默认设置 +async function actionDefaultSetting() { + let isConfirmed = await MyModal.confirm('是否恢复到默认设置?'); + if (!isConfirmed) { + return; + } + + if ( !props.runInfection ) { + await webSocketStore.call('factoryResetSettings'); + webSocketStore.sendCommandMsg(getAllSettingJSON); + } + showSuccessToast('设置成功') +}