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
9bd96a3d
authored
Dec 25, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码完善】IOT: 确保 ThingModel 中 dataSpecs 和 dataSpecsList 之中必须传入且只能传入一个
parent
45694910
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
src/views/iot/thingmodel/ThingModelDataSpecs.vue
+3
-2
src/views/iot/thingmodel/ThingModelForm.vue
+8
-0
src/views/iot/thingmodel/dataSpecs/ThingModelStructDataSpecs.vue
+1
-1
No files found.
src/views/iot/thingmodel/ThingModelDataSpecs.vue
View file @
9bd96a3d
...
@@ -121,8 +121,9 @@ const getDataTypeOptions = computed(() => {
...
@@ -121,8 +121,9 @@ const getDataTypeOptions = computed(() => {
const
handleChange
=
(
dataType
:
any
)
=>
{
const
handleChange
=
(
dataType
:
any
)
=>
{
property
.
value
.
dataSpecsList
=
[]
property
.
value
.
dataSpecsList
=
[]
property
.
value
.
dataSpecs
=
{}
property
.
value
.
dataSpecs
=
{}
// 不是列表型数据才设置 dataSpecs.dataType
property
.
value
.
dataSpecs
.
dataType
=
dataType
!
[
DataSpecsDataType
.
ENUM
,
DataSpecsDataType
.
BOOL
,
DataSpecsDataType
.
STRUCT
].
includes
(
dataType
)
&&
(
property
.
value
.
dataSpecs
.
dataType
=
dataType
)
switch
(
dataType
)
{
switch
(
dataType
)
{
case
DataSpecsDataType
.
ENUM
:
case
DataSpecsDataType
.
ENUM
:
property
.
value
.
dataSpecsList
.
push
({
property
.
value
.
dataSpecsList
.
push
({
...
...
src/views/iot/thingmodel/ThingModelForm.vue
View file @
9bd96a3d
...
@@ -46,6 +46,7 @@ import { IOT_PROVIDE_KEY } from '@/views/iot/utils/constants'
...
@@ -46,6 +46,7 @@ import { IOT_PROVIDE_KEY } from '@/views/iot/utils/constants'
import
{
DataSpecsDataType
,
ThingModelFormRules
}
from
'./config'
import
{
DataSpecsDataType
,
ThingModelFormRules
}
from
'./config'
import
{
cloneDeep
}
from
'lodash-es'
import
{
cloneDeep
}
from
'lodash-es'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
isEmpty
}
from
'@/utils/is'
/** IoT 物模型数据表单 */
/** IoT 物模型数据表单 */
defineOptions
({
name
:
'IoTProductThingModelForm'
})
defineOptions
({
name
:
'IoTProductThingModelForm'
})
...
@@ -103,6 +104,13 @@ const submitForm = async () => {
...
@@ -103,6 +104,13 @@ const submitForm = async () => {
data
.
dataType
=
data
.
property
.
dataType
data
.
dataType
=
data
.
property
.
dataType
data
.
property
.
identifier
=
data
.
identifier
data
.
property
.
identifier
=
data
.
identifier
data
.
property
.
name
=
data
.
name
data
.
property
.
name
=
data
.
name
// 处理 dataSpecs 为空的情况
if
(
isEmpty
(
data
.
property
.
dataSpecs
))
{
delete
data
.
property
.
dataSpecs
}
if
(
isEmpty
(
data
.
property
.
dataSpecsList
))
{
delete
data
.
property
.
dataSpecsList
}
if
(
formType
.
value
===
'create'
)
{
if
(
formType
.
value
===
'create'
)
{
await
ThingModelApi
.
createThingModel
(
data
)
await
ThingModelApi
.
createThingModel
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
message
.
success
(
t
(
'common.createSuccess'
))
...
...
src/views/iot/thingmodel/dataSpecs/ThingModelStructDataSpecs.vue
View file @
9bd96a3d
...
@@ -111,7 +111,7 @@ const submitForm = async () => {
...
@@ -111,7 +111,7 @@ const submitForm = async () => {
!!
data
.
property
.
dataSpecs
&&
Object
.
keys
(
data
.
property
.
dataSpecs
).
length
>
1
!!
data
.
property
.
dataSpecs
&&
Object
.
keys
(
data
.
property
.
dataSpecs
).
length
>
1
?
data
.
property
.
dataSpecs
?
data
.
property
.
dataSpecs
:
undefined
,
:
undefined
,
dataSpecsList
:
data
.
property
.
dataSpecsList
dataSpecsList
:
isEmpty
(
data
.
property
.
dataSpecsList
)
?
undefined
:
data
.
property
.
dataSpecsList
}
}
// 查找是否已有相同 identifier 的项
// 查找是否已有相同 identifier 的项
...
...
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