Browse Source

fix:传感器别名1

master
guoapeng 1 week ago
parent
commit
a9cf00bdea
  1. 1
      src/components/common/FTInput/index.vue
  2. 35
      src/components/home/Environment.vue

1
src/components/common/FTInput/index.vue

@ -147,7 +147,6 @@ const onInit = (keyboard: any) => {
}
const onChange = (input: any) => {
ignoreBlur.value = true
console.log(input)
model.value = input
setTimeout(() => {
ignoreBlur.value = false

35
src/components/home/Environment.vue

@ -1,8 +1,9 @@
<script lang="ts" setup>
import { syncSendCmd } from 'apis/system'
import { sendCmd } from 'apis/system'
import homeInside from 'assets/images/home/home-inside.svg'
import homeProbe1 from 'assets/images/home/home-probe1.svg'
import homeProbe2 from 'assets/images/home/home-probe2.svg'
import { FtMessage } from 'libs/message'
import { roundNumber } from 'libs/utils'
import { nextTick, onMounted, ref } from 'vue'
@ -66,7 +67,12 @@ onMounted(() => {
//
})
const changeNameHandle = () => {
const changeNameHandle = async () => {
if (aliasName.value.length > 10) {
FtMessage.warning('请输入小于10个字符的备注名称')
inputRef.value?.focus()
return
}
const params = {
className: 'H2O2SensorMgr',
fnName: 'setH2O2SensorAliasName',
@ -76,7 +82,7 @@ const changeNameHandle = () => {
aliasName: aliasName.value,
},
}
syncSendCmd(params)
await sendCmd(params)
inputVisible.value = false
}
@ -103,20 +109,23 @@ const showInput = () => {
</el-tag>
</div>
<div style="display: flex; flex-direction: column; justify-content: flex-end">
<div class="env-row">
<div class="env-row" style="height: 50px">
<div class="env-row-label">
备注
</div>
<div v-if="envParams.isOnline" class="env-row-value">
<ft-input
v-if="inputVisible"
ref="inputRef"
v-model="aliasName"
size="small"
style="width: 100px"
@blur="changeNameHandle"
@focus="aliasName = envParams.aliasName"
/>
<div v-if="inputVisible" style="display: flex; align-items: center; gap: 10px">
<ft-input
ref="inputRef"
v-model="aliasName"
style="width: 100px"
@focus="aliasName = envParams.aliasName"
/>
<el-icon size="25" color="#3b82f6" @click="changeNameHandle">
<CircleCheckFilled />
</el-icon>
</div>
<span v-else style="color: #3b82f6; font-weight: 600" @click="showInput">{{
envParams.aliasName || '--'
}}</span>

Loading…
Cancel
Save