Browse Source

Revert "fix: 代码优化;ui优化; bug修复"

This reverts commit db8f595122.
master
guoapeng 2 weeks ago
parent
commit
ad2e5904a6
  1. 2
      src/assets/styles/element.scss
  2. 13
      src/components/common/BTButton/index.vue
  3. 20
      src/components/common/CascadingSelectModal/index.vue
  4. 84
      src/components/common/DatePicker/index.vue
  5. 25
      src/components/common/SelectModal/index.vue
  6. 80
      src/components/common/SoftKeyboard/index.vue
  7. 70
      src/components/common/SoftKeyboard/moveKeyboard.vue
  8. 8
      src/components/home/Environment.vue
  9. 6
      src/components/setting/Device.vue
  10. 9
      src/components/setting/User.vue
  11. 2
      src/layouts/default.vue
  12. 25
      src/views/audit/index.vue
  13. 5
      src/views/setting/index.vue

2
src/assets/styles/element.scss

@ -1,5 +1,5 @@
:root {
--el-font-size-base: 16px;
--el-font-size-base: 18px;
// --el-button-size: 80px;
--el-color-primary: #1989fa;
//--el-button-active-bg-color: linear-gradient(90deg, #0657C0 24%, #096AE0 101%);

13
src/components/common/BTButton/index.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useSlots } from 'vue'
import { defineEmits, defineProps, useSlots } from 'vue'
const props = defineProps({
//
@ -109,9 +109,10 @@ const handleClick = (event: MouseEvent) => {
</template>
<style lang="scss" scoped>
.pl {
padding-left: 5px;
}
.button {
}
.pl{
padding-left: 5px;
}
.button{
}
</style>

20
src/components/common/CascadingSelectModal/index.vue

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { FtMessage } from 'libs/message'
import { useHomeStore } from 'stores/homeStore'
import { onBeforeMount, onMounted, ref, toRefs, watchEffect } from 'vue'
import { defineEmits, defineProps, onBeforeMount, onMounted, ref, toRefs, watchEffect } from 'vue'
const props = defineProps({
optionsLeft: {
@ -185,9 +185,7 @@ watchEffect(() => {
display: flex;
flex-direction: column;
overflow: hidden;
box-shadow:
0 10px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
animation: fadeIn 0.2s ease-out;
}
@ -223,9 +221,9 @@ watchEffect(() => {
flex: 1;
padding: 10px 0;
max-height: 15vw;
overflow: hidden;
overflow: hidden
}
.modal-content-right {
.modal-content-right{
flex: 1;
overflow-y: auto;
padding: 10px 0;
@ -334,13 +332,7 @@ watchEffect(() => {
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
</style>

84
src/components/common/DatePicker/index.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { computed, defineEmits, defineProps, onMounted, onUnmounted, ref, watch } from 'vue'
const props = defineProps({
modelValue: {
@ -105,26 +105,22 @@ onMounted(() => {
})
// props
watch(
() => props.modelValue,
(newVal) => {
if (newVal) {
const date = new Date(Number(newVal))
if (!Number.isNaN(date.getTime())) {
selectedDate.value = date
currentYear.value = date.getFullYear()
currentMonth.value = date.getMonth()
selectedHour.value = date.getHours().toString().padStart(2, '0')
selectedMinute.value = date.getMinutes().toString().padStart(2, '0')
selectedSecond.value = date.getSeconds().toString().padStart(2, '0')
}
}
else {
selectedDate.value = null
watch(() => props.modelValue, (newVal) => {
if (newVal) {
const date = new Date(Number(newVal))
if (!Number.isNaN(date.getTime())) {
selectedDate.value = date
currentYear.value = date.getFullYear()
currentMonth.value = date.getMonth()
selectedHour.value = date.getHours().toString().padStart(2, '0')
selectedMinute.value = date.getMinutes().toString().padStart(2, '0')
selectedSecond.value = date.getSeconds().toString().padStart(2, '0')
}
},
{ deep: true },
)
}
else {
selectedDate.value = null
}
}, { deep: true })
//
const prevMonth = () => {
@ -246,9 +242,7 @@ const isSameDay = (date1: Date, date2: Date | null) => {
return false
}
return (
date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate()
date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate()
)
}
@ -313,7 +307,9 @@ onUnmounted(() => {
<button class="nav-btn" @click="prevMonth">
<el-icon><ArrowLeft /></el-icon>
</button>
<span class="current-date"> {{ currentYear }} {{ currentMonth + 1 }} </span>
<span class="current-date">
{{ currentYear }} {{ currentMonth + 1 }}
</span>
<button class="nav-btn" @click="nextMonth">
<el-icon><ArrowRight /></el-icon>
</button>
@ -347,34 +343,19 @@ onUnmounted(() => {
时间:
</div>
<el-select v-model="selectedHour" class="time-select" @change="updateTime">
<el-option
v-for="i in hoursOptions"
:key="i"
:value="i.toString().padStart(2, '0')"
style="font-size: 20px; line-height: 2px; height: 5rem; display: flex; align-items: center"
>
<el-option v-for="i in hoursOptions" :key="i" :value="i.toString().padStart(2, '0')" style="font-size: 20px;line-height: 2px;height: 5rem;display: flex; align-items: center;">
{{ i.toString().padStart(2, '0') }}
</el-option>
</el-select>
<span class="time-separator">:</span>
<el-select v-model="selectedMinute" class="time-select" @change="updateTime">
<el-option
v-for="i in minuteOptions"
:key="i"
:value="i.toString().padStart(2, '0')"
style="font-size: 20px; line-height: 2px; height: 5rem; display: flex; align-items: center"
>
<el-option v-for="i in minuteOptions" :key="i" :value="i.toString().padStart(2, '0')" style="font-size: 20px;line-height: 2px;height: 5rem;display: flex; align-items: center;">
{{ i.toString().padStart(2, '0') }}
</el-option>
</el-select>
<span class="time-separator">:</span>
<el-select v-model="selectedSecond" class="time-select" @change="updateTime">
<el-option
v-for="i in secondOptions"
:key="i"
:value="i.toString().padStart(2, '0')"
style="font-size: 20px; line-height: 2px; height: 5rem; display: flex; align-items: center"
>
<el-option v-for="i in secondOptions" :key="i" :value="i.toString().padStart(2, '0')" style="font-size: 20px;line-height: 2px;height: 5rem;display: flex; align-items: center;">
{{ i.toString().padStart(2, '0') }}
</el-option>
</el-select>
@ -395,7 +376,7 @@ onUnmounted(() => {
<style lang="scss" scoped>
$fontSize: 1.5rem;
:deep(body) {
//--el-font-size-base: 20px;
--el-font-size-base: 20px;
}
.date-time-picker {
position: relative;
@ -439,9 +420,7 @@ $fontSize: 1.5rem;
background-color: white;
border: 1px solid #e2e8f0;
border-radius: 4px;
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
z-index: 100;
padding: 12px;
}
@ -556,7 +535,7 @@ select option {
width: 5rem;
}
.select-option {
.select-option{
max-height: 3rem;
}
@ -583,8 +562,7 @@ select {
gap: 10px;
}
.confirm-btn,
.cancel-btn {
.confirm-btn, .cancel-btn {
padding: 8px 16px;
border: none;
border-radius: 4px;
@ -611,17 +589,15 @@ select {
background-color: #e2e8f0;
}
.fade-enter-active,
.fade-leave-active {
.fade-enter-active, .fade-leave-active {
transition: opacity 0.2s;
}
.fade-enter-from,
.fade-leave-to {
.fade-enter-from, .fade-leave-to {
opacity: 0;
}
//
:deep(.el-select__wrapper) {
:deep(.el-select__wrapper){
height: 3rem;
font-size: 20px;
}

25
src/components/common/SelectModal/index.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, onMounted, ref, toRefs, watch } from 'vue'
import { computed, defineEmits, defineProps, onMounted, ref, toRefs, watch } from 'vue'
const props = defineProps({
options: {
@ -26,12 +26,9 @@ onMounted(() => {
console.log('selectedValue--', props.selectedValue)
scrollToSelectedItem()
})
watch(
() => props.options,
(newVal) => {
options.value = newVal
},
)
watch(() => props.options, (newVal) => {
options.value = newVal
})
const optionsList = ref<HTMLUListElement | null>(null)
const scrollToSelectedItem = () => {
if (!optionsList.value) {
@ -126,9 +123,7 @@ const handleCancel = () => {
display: flex;
flex-direction: column;
overflow: hidden;
box-shadow:
0 10px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
animation: fadeIn 0.2s ease-out;
}
@ -264,14 +259,8 @@ const handleCancel = () => {
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
.select-font {
font-size: 20px;

80
src/components/common/SoftKeyboard/index.vue

@ -2,7 +2,7 @@
import pinyinDict from 'libs/pinyinDict.json'
import { useDeviceStore } from 'stores/deviceStore'
import type { Ref } from 'vue'
import { computed, onMounted, ref, watch, watchEffect } from 'vue'
import { computed, defineEmits, defineProps, onMounted, ref, watch, watchEffect } from 'vue'
const props = defineProps<{
modelValue: string
@ -22,11 +22,11 @@ const cnList = ref<string[]>([])
const pinyinMap: Record<string, string[]> = pinyinDict
const pinyinValue = ref('')
//
const isDragging = ref(false) //
const startX = ref(0) // X
const startY = ref(0) // Y
const x = ref(0) // X
const y = ref(-50) // Y
const isDragging = ref(false)//
const startX = ref(0)// X
const startY = ref(0)// Y
const x = ref(0)// X
const y = ref(-50)// Y
const keyboardRef = ref() as Ref<HTMLDivElement> // DOM
onMounted(() => {
@ -50,15 +50,12 @@ watchEffect(() => {
inputValue.value = props.modelValue
})
watch(
() => props.isVisible,
(newVal) => {
console.log('deviceStete.deviceType--2-', deviceStete.isLowCost)
if (!deviceStete.isLowCost) {
isOpen.value = newVal
}
},
)
watch(() => props.isVisible, (newVal) => {
console.log('deviceStete.deviceType--2-', deviceStete.isLowCost)
if (!deviceStete.isLowCost) {
isOpen.value = newVal
}
})
const activeKey = ref('')
const keyboardLayout = computed(() => {
@ -204,18 +201,13 @@ const handleTouchEnd = () => {
>
<div>
<div v-if="keyboardType === 'text'" class="pinyin-container">
<span v-if="pinyinValue" style="font-size: 12px">拼音{{ pinyinValue }}</span>
<span v-if="pinyinValue" style="font-size:12px">拼音{{ pinyinValue }}</span>
<div v-if="cnList && cnList.length" class="pinyin-cn">
<div
v-for="(cnName, cnIndex) in cnList"
:key="cnIndex"
class="cn-name"
@click="
e => {
e.stopPropagation();
handleKeyCn(cnName);
}
"
@click="(e) => { e.stopPropagation(); handleKeyCn(cnName) }"
>
{{ cnName }}
</div>
@ -233,28 +225,12 @@ const handleTouchEnd = () => {
'key-text': key !== ' ' && keyboardType === 'text',
}"
:style="keyboardType === 'number' ? 'height: 10vh' : 'height:3rem;'"
@click="
e => {
e.stopPropagation();
handleKeyPress(key);
}
"
@click="(e) => {
e.stopPropagation()
handleKeyPress(key)
}"
>
{{
key === ' '
? '空格'
: key === 'del'
? '删除'
: key === 'enter'
? '确认'
: key === 'close'
? '关闭'
: key === 'cn'
? '英文'
: key === 'en'
? '拼音'
: key
}}
{{ key === ' ' ? '空格' : key === 'del' ? '删除' : key === 'enter' ? '确认' : key === 'close' ? '关闭' : key === 'cn' ? '英文' : key === 'en' ? '拼音' : key }}
</button>
</div>
</div>
@ -282,7 +258,7 @@ const handleTouchEnd = () => {
.keyboard-header {
margin-bottom: 10px;
position: absolute;
float: right;
float:right;
}
.keyboard-header button {
@ -297,20 +273,20 @@ const handleTouchEnd = () => {
display: flex;
flex-direction: column;
gap: 8px;
.pinyin-container {
.pinyin-container{
display: flex;
width: 80%;
height: 4rem;
padding-left: 2rem;
.pinyin-cn {
.pinyin-cn{
color: #1890ff;
padding-left: 1rem;
display: flex;
width: 1rem;
position: relative;
gap: 5px;
gap:5px;
//font-family: fangsong;
.cn-name {
.cn-name{
font-size: 2.5rem;
}
}
@ -345,7 +321,7 @@ const handleTouchEnd = () => {
.key-space {
margin-top: 3.5px;
width: 75vw;
width: 75vw;;
}
.key-special {
@ -357,7 +333,7 @@ const handleTouchEnd = () => {
transform: scale(0.95);
}
.key-number {
.key-number{
width: 30vw;
height: 6vh;
margin: 5px;
@ -368,7 +344,7 @@ const handleTouchEnd = () => {
height: 5vh;
margin: 5px;
}
.input-w {
.input-w{
width: 20%;
height: 4rem;
font-size: 2rem;
@ -381,7 +357,7 @@ const handleTouchEnd = () => {
left: 0;
width: 90%;
border-radius: 16px;
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
overflow: hidden;
z-index: 9999;
/* 让拖动更顺滑 */

70
src/components/common/SoftKeyboard/moveKeyboard.vue

@ -1,7 +1,7 @@
<script lang="ts" setup>
import pinyinDict from 'libs/pinyinDict.json'
import type { Ref } from 'vue'
import { computed, nextTick, onMounted, ref, watch, watchEffect } from 'vue'
import { computed, defineEmits, defineProps, nextTick, onMounted, ref, watch, watchEffect } from 'vue'
const props = defineProps<{
modelValue: string
@ -21,11 +21,11 @@ const cnList = ref<string[]>([])
const pinyinMap: Record<string, string[]> = pinyinDict
const pinyinValue = ref('')
//
const isDragging = ref(false) //
const startX = ref(0) // X
const startY = ref(0) // Y
const x = ref(0) // X
const y = ref(0) // Y
const isDragging = ref(false)//
const startX = ref(0)// X
const startY = ref(0)// Y
const x = ref(0)// X
const y = ref(0)// Y
const inputX = ref(0)
const inputY = ref(0)
const keyboardRef = ref() as Ref<HTMLDivElement> // DOM
@ -162,12 +162,9 @@ const closeKeyboard = () => {
emits('close')
}
watch(
() => props.isVisible,
(newVal) => {
isOpen.value = newVal
},
)
watch(() => props.isVisible, (newVal) => {
isOpen.value = newVal
})
//
const handleTouchStart = (e: TouchEvent) => {
@ -221,18 +218,13 @@ const handleTouchEnd = () => {
>
<div>
<div v-if="keyboardType === 'text'" class="pinyin-container">
<span v-if="pinyinValue" style="font-size: 12px">拼音{{ pinyinValue }}</span>
<span v-if="pinyinValue" style="font-size:12px">拼音{{ pinyinValue }}</span>
<div v-if="cnList && cnList.length" class="pinyin-cn">
<div
v-for="(cnName, cnIndex) in cnList"
:key="cnIndex"
class="cn-name"
@click="
e => {
e.stopPropagation();
handleKeyCn(cnName);
}
"
@click="(e) => { e.stopPropagation(); handleKeyCn(cnName) }"
>
{{ cnName }}
</div>
@ -250,28 +242,12 @@ const handleTouchEnd = () => {
'key-text': key !== ' ' && keyboardType === 'text',
}"
:style="keyboardType === 'number' ? 'height: 10vh' : 'height:3rem;'"
@click="
e => {
e.stopPropagation();
handleKeyPress(key);
}
"
@click="(e) => {
e.stopPropagation()
handleKeyPress(key)
}"
>
{{
key === ' '
? '空格'
: key === 'del'
? '删除'
: key === 'enter'
? '确认'
: key === 'close'
? '关闭'
: key === 'cn'
? '英文'
: key === 'en'
? '拼音'
: key
}}
{{ key === ' ' ? '空格' : key === 'del' ? '删除' : key === 'enter' ? '确认' : key === 'close' ? '关闭' : key === 'cn' ? '英文' : key === 'en' ? '拼音' : key }}
</button>
</div>
</div>
@ -298,20 +274,20 @@ const handleTouchEnd = () => {
display: flex;
flex-direction: column;
gap: 8px;
.pinyin-container {
.pinyin-container{
display: flex;
width: 80%;
height: 3rem;
padding-left: 2rem;
.pinyin-cn {
.pinyin-cn{
color: #1890ff;
padding-left: 1rem;
display: flex;
width: 1rem;
position: relative;
gap: 5px;
gap:5px;
//font-family: fangsong;
.cn-name {
.cn-name{
font-size: 2.5rem;
}
}
@ -342,7 +318,7 @@ const handleTouchEnd = () => {
.key-space {
margin-top: 3.5px;
width: 75vw;
width: 75vw;;
}
.key-special {
@ -354,7 +330,7 @@ const handleTouchEnd = () => {
transform: scale(0.95);
}
.key-number {
.key-number{
width: 30vw;
height: 6vh;
margin: 5px;
@ -368,7 +344,7 @@ const handleTouchEnd = () => {
.keyboard-container {
border-radius: 16px;
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
overflow: hidden;
z-index: 9999;
/* 让拖动更顺滑 */

8
src/components/home/Environment.vue

@ -60,7 +60,7 @@ onMounted(() => {
温度
</div>
<div class="env-row-value">
{{ !envParams.temp || envParams.temp === -1 ? '--' : roundNumber(envParams.temp, 2) }}°C
{{ envParams.temp === -1 ? '--' : roundNumber(envParams.temp, 2) }}°C
</div>
</div>
<div class="env-row">
@ -68,7 +68,7 @@ onMounted(() => {
相对湿度
</div>
<div class="env-row-value">
{{ !envParams.rh || envParams.rh === -1 ? '--' : roundNumber(envParams.rh, 2) }}%RH
{{ envParams.rh === -1 ? '--' : roundNumber(envParams.rh, 2) }}%RH
</div>
</div>
<div class="env-row odd">
@ -76,7 +76,7 @@ onMounted(() => {
相对饱和度
</div>
<div class="env-row-value">
{{ !envParams.rs || envParams.rs === -1 ? '--' : roundNumber(envParams.rs, 2) }}%RS
{{ envParams.rs === -1 ? '--' : roundNumber(envParams.rs, 2) }}%RS
</div>
</div>
<div class="env-row">
@ -84,7 +84,7 @@ onMounted(() => {
汽化过氧化氢
</div>
<div class="env-row-value">
{{ !envParams.h2o2 || envParams.h2o2 === -1 ? '--' : roundNumber(envParams.h2o2, 2) }}ppm
{{ envParams.h2o2 === -1 ? '--' : roundNumber(envParams.h2o2, 2) }}ppm
</div>
</div>
</template>

6
src/components/setting/Device.vue

@ -39,8 +39,8 @@ const screenHeight = ref(height)
</template>
<style lang="scss" scoped>
.device-ul {
background: #f6fafe;
.device-ul{
background: #F6FAFE;
height: 4rem;
display: flex;
align-items: center;
@ -48,6 +48,6 @@ const screenHeight = ref(height)
border-radius: 10px;
margin-top: 1rem;
padding-left: 2rem;
font-size: 16px;
font-size: 1.5rem;
}
</style>

9
src/components/setting/User.vue

@ -111,16 +111,19 @@ const handleSelectionChange = (users: User.UserItem[]) => {
<style lang="scss" scoped>
.user {
height: 100%;
height: 84vh;
overflow: hidden;
padding: 10px;
background: $gradient-color;
.add-user {
margin: 10px;
//height: 12%;
display: flex;
align-items: center;
height: 50px;
}
.user-table {
height: calc(100% - 50px);
height: 73vh;
overflow: auto;
}
}
.user-opera {

2
src/layouts/default.vue

@ -400,7 +400,7 @@ const statusMap = {
display: flex;
gap: 5px;
font-size: 1.6vw;
background: rgba(0, 0, 0, 0);
background: white;
transition: background-color 0.5s;
}
.menu-tags {

25
src/views/audit/index.vue

@ -98,10 +98,14 @@ const handleSelectionChange = (users: Audit.AuditItem[]) => {
<div class="dashboard-container">
<main class="main-content">
<div class="audit-export">
<bt-button type="primary" button-text="导出" @click="onExportRecord" />
<bt-button
type="primary"
button-text="导出"
@click="onExportRecord"
/>
</div>
<div class="audit-table">
<el-table :data="tableData" style="width: 100%" height="100%" @selection-change="handleSelectionChange">
<el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column prop="usrName" label="操作人" width="250" />
<el-table-column prop="behaviorinfo" label="操作内容" />
@ -116,23 +120,24 @@ const handleSelectionChange = (users: Audit.AuditItem[]) => {
</template>
<style lang="scss" scoped>
.main-content {
.main-content{
height: $main-container-height;
overflow: hidden;
background: $gradient-color;
box-shadow: 0px 1px 5px 0px rgba(9, 39, 62, 0.15);
.audit-export {
height: 50px;
padding: 0 10px;
.audit-export{
padding: 2vw;
display: flex;
align-items: center;
height: 12%;
}
.audit-table {
.audit-table{
max-height: 67vh;
overflow: auto;
height: calc(100% - 100px);
height: 76%;
}
.audit-pagination {
height: 50px;
.audit-pagination{
height: 12%;
display: flex;
align-items: center;
float: right;

5
src/views/setting/index.vue

@ -40,9 +40,9 @@ const selectItem = (menuCode: string) => {
<div v-if="selectedMenuCode === 'defaultFormula'">
<FormulaConfig type="setting" />
</div>
<template v-if="selectedMenuCode === 'user'">
<div v-if="selectedMenuCode === 'user'">
<User />
</template>
</div>
<div v-if="selectedMenuCode === 'date'">
<SystemDate />
</div>
@ -76,7 +76,6 @@ const selectItem = (menuCode: string) => {
background: $gradient-color;
border-radius: 10px;
overflow: hidden;
padding: 10px;
}
}
.menu-container {

Loading…
Cancel
Save