From d9f9627414829c4bb8b258b2f407e10277966003 Mon Sep 17 00:00:00 2001
From: LiLongLong <13717757313@163.com>
Date: Sun, 25 May 2025 17:27:21 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95=20?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8tag?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package-lock.json | 29 +-
package.json | 1 +
src/app.vue | 40 ++-
src/assets/images/background-logo.svg | 1 +
src/components/common/Card/index.vue | 0
src/components/common/ErrorModal/index.vue | 128 ++++++++
src/components/common/FTButton/index.vue | 2 +-
src/components/common/SelectModal/index.vue | 20 +-
src/components/common/SoftKeyboard/index.vue | 2 +-
src/components/formula/FormulaConfig.vue | 92 ++++--
src/components/formula/FormulaTable.vue | 16 +-
src/components/home/Environment.vue | 64 ++--
src/components/home/config.vue | 66 +++--
src/components/liquid/LiquidLevel.vue | 2 +-
src/components/seal/DashboardChart.vue | 50 +---
src/components/setting/AddUser.vue | 32 +-
src/components/setting/User.vue | 11 +-
src/layouts/default.vue | 48 +--
src/libs/countdownTimer.ts | 48 +++
src/libs/modalUtil.ts | 39 +++
src/libs/socket.ts | 2 +
src/libs/utils.ts | 20 ++
src/main.ts | 2 +
src/router/index.ts | 2 +-
src/stores/formulaStore.ts | 45 ++-
src/stores/homeStore.ts | 61 +++-
src/stores/liquidStore.ts | 14 +
src/stores/sealStore.ts | 14 +
src/stores/settingStore.ts | 30 +-
src/types/home.d.ts | 26 ++
src/types/liquid.d.ts | 5 +
src/types/seal.d.ts | 8 +
src/types/setting.d.ts | 2 +-
src/views/debug/index.vue | 418 +++++++++++++++------------
src/views/formula/index.vue | 2 +-
src/views/home/index.vue | 68 +++--
src/views/liquid/index.vue | 50 +++-
src/views/seal/index.vue | 125 ++++----
38 files changed, 1130 insertions(+), 455 deletions(-)
create mode 100644 src/assets/images/background-logo.svg
create mode 100644 src/components/common/Card/index.vue
create mode 100644 src/components/common/ErrorModal/index.vue
create mode 100644 src/libs/countdownTimer.ts
create mode 100644 src/libs/modalUtil.ts
create mode 100644 src/stores/liquidStore.ts
create mode 100644 src/stores/sealStore.ts
create mode 100644 src/types/liquid.d.ts
create mode 100644 src/types/seal.d.ts
diff --git a/package-lock.json b/package-lock.json
index 5d98193..0b87776 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,6 +27,7 @@
"express": "^5.1.0",
"konva": "^9.3.18",
"lodash": "^4.17.21",
+ "nanoid": "^5.1.5",
"pinia": "^3.0.1",
"pinia-plugin-persistedstate": "^4.2.0",
"pinyin": "^2.11.2",
@@ -7790,9 +7791,9 @@
"license": "MIT"
},
"node_modules/nanoid": {
- "version": "3.3.11",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
- "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
+ "version": "5.1.5",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.5.tgz",
+ "integrity": "sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw==",
"funding": [
{
"type": "github",
@@ -7801,10 +7802,10 @@
],
"license": "MIT",
"bin": {
- "nanoid": "bin/nanoid.cjs"
+ "nanoid": "bin/nanoid.js"
},
"engines": {
- "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ "node": "^18 || >=20"
}
},
"node_modules/napi-postinstall": {
@@ -9286,6 +9287,24 @@
"node": ">=0.8.0"
}
},
+ "node_modules/postcss/node_modules/nanoid": {
+ "version": "3.3.11",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
diff --git a/package.json b/package.json
index ae98f03..3f983e9 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"express": "^5.1.0",
"konva": "^9.3.18",
"lodash": "^4.17.21",
+ "nanoid": "^5.1.5",
"pinia": "^3.0.1",
"pinia-plugin-persistedstate": "^4.2.0",
"pinyin": "^2.11.2",
diff --git a/src/app.vue b/src/app.vue
index 0704782..537609c 100644
--- a/src/app.vue
+++ b/src/app.vue
@@ -1,13 +1,14 @@
-
+
@@ -66,7 +92,7 @@ const initData = async () => {
.main-content {
width: 100%;
height: 100%;
- background: url('assets/images/background.svg') no-repeat center;
+ background: url('assets/images/background-logo.svg') no-repeat center;
background-size: cover;
overflow: hidden;
}
diff --git a/src/assets/images/background-logo.svg b/src/assets/images/background-logo.svg
new file mode 100644
index 0000000..b03c52e
--- /dev/null
+++ b/src/assets/images/background-logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/common/Card/index.vue b/src/components/common/Card/index.vue
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/common/ErrorModal/index.vue b/src/components/common/ErrorModal/index.vue
new file mode 100644
index 0000000..8c9fc33
--- /dev/null
+++ b/src/components/common/ErrorModal/index.vue
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+ {{ message }}
+
+
+
+
+
+
+
diff --git a/src/components/common/FTButton/index.vue b/src/components/common/FTButton/index.vue
index 7b79f02..9ce38d9 100644
--- a/src/components/common/FTButton/index.vue
+++ b/src/components/common/FTButton/index.vue
@@ -55,7 +55,7 @@ defineExpose({
-
+
diff --git a/src/components/common/SelectModal/index.vue b/src/components/common/SelectModal/index.vue
index 7624216..0e06198 100644
--- a/src/components/common/SelectModal/index.vue
+++ b/src/components/common/SelectModal/index.vue
@@ -22,26 +22,17 @@ const props = defineProps({
const emits = defineEmits(['confirm', 'cancel'])
-const { options, selectedValue, searchable } = toRefs(props)
+const { options, selectedValue } = toRefs(props)
-// 组件状态
-const searchTerm = ref('')
const tempSelectedValue = ref(selectedValue.value)
-// 计算属性
-const filteredOptions = computed(() => {
- if (!searchTerm.value || !searchable.value) {
- return options.value
- }
- return options.value.filter((option) => {
- return option.label.toLowerCase().includes(searchTerm.value.toLowerCase())
- })
-})
-
const selectOption = (option: System.Option) => {
tempSelectedValue.value = option.value
}
+const filteredOptions = computed(() => {
+ return options.value.filter(item => item.value)
+})
const confirmSelection = () => {
emits('confirm', tempSelectedValue.value)
}
@@ -71,7 +62,7 @@ const handleCancel = () => {
{{ option.label }}
-
@@ -142,6 +133,7 @@ const handleCancel = () => {
flex: 1;
overflow-y: auto;
padding: 10px 0;
+ max-height: 15vw;
}
.search-box {
diff --git a/src/components/common/SoftKeyboard/index.vue b/src/components/common/SoftKeyboard/index.vue
index 1434f67..5ab5bc0 100644
--- a/src/components/common/SoftKeyboard/index.vue
+++ b/src/components/common/SoftKeyboard/index.vue
@@ -153,7 +153,7 @@ watch(() => props.isVisible, (newVal) => {
}
.keyboard-row button:hover {
- background-color: #e0e0e0;
+ /* background-color: #e0e0e0; */
}
.keyboard-row button:active {
diff --git a/src/components/formula/FormulaConfig.vue b/src/components/formula/FormulaConfig.vue
index b0e2441..512aabc 100644
--- a/src/components/formula/FormulaConfig.vue
+++ b/src/components/formula/FormulaConfig.vue
@@ -1,24 +1,37 @@
-
-
-
![]()
{{ envParams.title }}
+
+
![]()
{{ envParams.title }}
+
+
+
+ 温度
+
+
+ {{ roundNumber(envParams.temp, 2) }}°C
+
+
+
+
+ 相对湿度
+
+
+ {{ roundNumber(envParams.rh, 2) }}%RH
-
-
- 温度
-
-
- {{ roundNumber(envParams.temp, 2) }}°C
-
+
+
+
+ 相对饱和度
-
-
- 相对湿度
-
-
- {{ roundNumber(envParams.rh, 2) }}%RH
-
+
+ {{ roundNumber(envParams.rs, 2) }}%RS
-
-
- 相对饱和度
-
-
- {{ roundNumber(envParams.rs, 2) }}%RS
-
+
+
+
+ 汽化过氧化氢
-
-
- 汽化过氧化氢
-
-
- {{ roundNumber(envParams.h2o2, 2) }}ppm
-
+
+ {{ roundNumber(envParams.h2o2, 2) }}ppm
diff --git a/src/components/home/config.vue b/src/components/home/config.vue
index f50a0e8..9ac36f2 100644
--- a/src/components/home/config.vue
+++ b/src/components/home/config.vue
@@ -1,17 +1,24 @@
-
-
+
+
选择配方
@@ -63,12 +88,7 @@ const goHome = () => {
-
-
- 确定
- 返回
-
-
+
{
@confirm="handleConfirm"
@cancel="handleCancel"
/>
-
+
diff --git a/src/components/liquid/LiquidLevel.vue b/src/components/liquid/LiquidLevel.vue
index 1a90874..c460da8 100644
--- a/src/components/liquid/LiquidLevel.vue
+++ b/src/components/liquid/LiquidLevel.vue
@@ -16,7 +16,7 @@ const liquidHeight = ref((currentLevel.value / totalCapacity) * 200)
![液位图]()
-
+
当前液位
diff --git a/src/components/seal/DashboardChart.vue b/src/components/seal/DashboardChart.vue
index 3741220..97a8e46 100644
--- a/src/components/seal/DashboardChart.vue
+++ b/src/components/seal/DashboardChart.vue
@@ -3,7 +3,7 @@ import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
const option = ref()
-const pressure = ref(50)
+const pressure = ref(4.5)
onMounted(() => {
const chartDom = document.getElementById('main')!
const myChart = echarts.init(chartDom)
@@ -14,7 +14,7 @@ onMounted(() => {
{
data: [
{
- value: +(Math.random() * 100).toFixed(1),
+ value: +(Math.random() * 6).toFixed(1),
},
],
},
@@ -26,50 +26,26 @@ onMounted(() => {
const init = () => {
option.value = {
+ tooltip: {
+ formatter: '{a}
{b} : {c}%',
+ },
series: [
{
+ name: 'Pressure',
type: 'gauge',
- axisLine: {
- lineStyle: {
- width: 15,
- color: [
- [0.3, '#67e0e3'],
- [0.7, '#37a2da'],
- [1, '#fd666d'],
- ],
- },
- },
- pointer: { // 指针
- itemStyle: {
- color: 'auto',
- },
+ max: 6,
+ progress: {
+ show: true,
+ width: 5,
},
- axisTick: { // 中间刻度值
- distance: -15,
- length: 8, // 刻度线长度
- lineStyle: {
- color: '#fff',
- width: 1, // 刻度线宽度
- },
- },
- splitLine: {
- distance: -30, // 与圆盘之间的距离
- length: 30,
+ axisLine: {
lineStyle: {
- color: '#fff',
- width: 4,
+ width: 5,
},
},
- axisLabel: {
- color: 'inherit',
- distance: 25,
- fontSize: 14,
- },
detail: {
valueAnimation: true,
- formatter: '{value} KPa',
- color: 'inherit',
- fontSize: 14,
+ formatter: '{value}Kp',
},
data: [
{
diff --git a/src/components/setting/AddUser.vue b/src/components/setting/AddUser.vue
index d2051b2..874209c 100644
--- a/src/components/setting/AddUser.vue
+++ b/src/components/setting/AddUser.vue
@@ -2,33 +2,39 @@
import type { FormInstance } from 'element-plus'
import { useSettingStore } from '@/stores/settingStore'
import SoftKeyboard from 'components/common/SoftKeyboard/index.vue'
-import { onMounted, ref, watch } from 'vue'
+import { onMounted, ref, watchEffect } from 'vue'
const settingStore = useSettingStore()
const visible = ref(settingStore.addUserVisible)
+const modalType = ref(settingStore.userModalState)
const inputValue = ref
('')
const keyboardVisible = ref(false)
const keyboardType = ref<'text' | 'number'>('text')
const softKeyboardRef = ref()
const userFormRef = ref()
const focusedInput = ref(null)
+const modalTitle = ref('新增用户')
const userForm = ref({
uid: '',
id: '',
passwd: '',
confirmPassword: '',
- is_admin: '',
+ is_admin: false,
})
-watch(() => settingStore.addUserVisible, (newVal) => {
- console.log('newVal---', newVal)
- visible.value = newVal
-})
-
-// 监听软键盘输入
-watch(inputValue, (newVal) => {
- console.log('focusedInput.value--', focusedInput.value)
+watchEffect(() => {
+ modalType.value = settingStore.userModalState
+ if (settingStore.userModalState === 'edit') {
+ modalTitle.value = '修改密码'
+ }
+ if (settingStore.currentEditUser) {
+ userForm.value = settingStore.currentEditUser
+ }
+ else {
+ modalTitle.value = '新增用户'
+ }
+ visible.value = settingStore.addUserVisible
if (focusedInput.value) {
- userForm.value[focusedInput.value as keyof typeof userForm.value] = newVal
+ userForm.value[focusedInput.value as keyof typeof userForm.value] = inputValue.value
}
})
@@ -64,9 +70,7 @@ const openKeyboard = (e: any) => {
setTimeout(() => {
keyboardVisible.value = true
const labelName = e.target.name
- console.log('labelName---', labelName)
const formValue = userForm.value[labelName as keyof typeof userForm.value]
- console.log('formValue---', formValue)
inputValue.value = formValue ? formValue.toString() : ''
focusedInput.value = e.target.name
}, 100)
@@ -84,7 +88,7 @@ const handleConfirm = (value: string) => {
-
+
{
console.log('userItem===', userItem)
+ settingStore.updateCurrentEditUser(userItem)
+ settingStore.updateUserModalState('edit')
+ settingStore.updateVisible(true)
}
const onAddUser = () => {
+ settingStore.updateUserModalState('add')
settingStore.updateVisible(true)
}
const onDelUser = () => {
@@ -44,7 +47,7 @@ const onDelUser = () => {
-
+
修改密码
@@ -53,7 +56,7 @@ const onDelUser = () => {
diff --git a/src/layouts/default.vue b/src/layouts/default.vue
index 50a4377..6ed654f 100644
--- a/src/layouts/default.vue
+++ b/src/layouts/default.vue
@@ -1,5 +1,6 @@
@@ -28,22 +32,22 @@ onUnmounted(() => {