Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c7d9a7fe
authored
Dec 14, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能完善】IOT: 物模型布尔值数据类型组件完善
parent
5209318b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
src/views/iot/product/product/detail/ThingModel/ThingModelDataSpecs.vue
+24
-1
src/views/iot/product/product/detail/ThingModel/config.ts
+1
-1
src/views/iot/product/product/detail/ThingModel/dataSpecs/ThingModelEnumTypeDataSpecs.vue
+2
-2
No files found.
src/views/iot/product/product/detail/ThingModel/ThingModelDataSpecs.vue
View file @
c7d9a7fe
...
...
@@ -16,6 +16,20 @@
v-if=
"formData.dataType === DataSpecsDataType.ENUM"
v-model=
"formData.dataSpecsList"
/>
<!-- 布尔型配置 -->
<el-form-item
label=
"布尔值"
prop=
"bool"
v-if=
"formData.dataType === DataSpecsDataType.BOOL"
>
<template
v-for=
"item in formData.dataSpecsList"
:key=
"item.value"
>
<div
class=
"flex items-center justify-start w-1/1 mb-5px"
>
<span>
{{
item
.
value
}}
</span>
<span
class=
"mx-2"
>
-
</span>
<el-input
v-model=
"item.name"
class=
"w-255px!"
:placeholder=
"`如:$
{item.value === 0 ? '关' : '开'}`"
/>
</div>
</
template
>
</el-form-item>
</template>
<
script
lang=
"ts"
setup
>
...
...
@@ -41,10 +55,19 @@ const handleChange = (dataType: any) => {
switch
(
dataType
)
{
case
DataSpecsDataType
.
ENUM
:
formData
.
value
.
dataSpecsList
.
push
({
dataType
:
'ENUM'
,
dataType
:
DataSpecsDataType
.
ENUM
,
name
:
''
,
// 枚举项的名称
value
:
undefined
// 枚举值
})
break
case
DataSpecsDataType
.
BOOL
:
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
formData
.
value
.
dataSpecsList
.
push
({
dataType
:
DataSpecsDataType
.
BOOL
,
name
:
''
,
// 布尔值的名称
value
:
i
// 布尔值
})
}
}
}
// dataType为INT的dataSpecs示例:
...
...
src/views/iot/product/product/detail/ThingModel/config.ts
View file @
c7d9a7fe
...
...
@@ -17,7 +17,7 @@ export interface DataSpecsTextDataVO {
}
/** dataSpecs 枚举型数据结构 */
export
interface
DataSpecsEnumDataVO
{
export
interface
DataSpecsEnum
OrBool
DataVO
{
dataType
:
'enum'
|
'bool'
defaultValue
?:
string
// 默认值,可选
name
:
string
// 枚举项的名称
...
...
src/views/iot/product/product/detail/ThingModel/dataSpecs/ThingModelEnumTypeDataSpecs.vue
View file @
c7d9a7fe
...
...
@@ -24,14 +24,14 @@
import
{
useVModel
}
from
'@vueuse/core'
import
{
DataSpecsDataType
,
DataSpecsEnumDataVO
DataSpecsEnum
OrBool
DataVO
}
from
'@/views/iot/product/product/detail/ThingModel/config'
/** 枚举型的 dataSpecs 配置组件 */
defineOptions
({
name
:
'ThingModelEnumTypeDataSpecs'
})
const
props
=
defineProps
<
{
modelValue
:
any
}
>
()
const
emits
=
defineEmits
([
'update:modelValue'
])
const
dataSpecsList
=
useVModel
(
props
,
'modelValue'
,
emits
)
as
Ref
<
DataSpecsEnumDataVO
[]
>
const
dataSpecsList
=
useVModel
(
props
,
'modelValue'
,
emits
)
as
Ref
<
DataSpecsEnum
OrBool
DataVO
[]
>
const
message
=
useMessage
()
/** 添加枚举项 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment