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 @@ 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 @@ 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 @@ 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) => {