Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mes
mes-ui
Commits
3c7d11b6
Commit
3c7d11b6
authored
Jan 27, 2024
by
hiyonx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复sap特性查询问题
parent
dfe4cbb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
29 deletions
+11
-29
index.vue
src/components/SapPropertyData/index.vue
+11
-29
No files found.
src/components/SapPropertyData/index.vue
View file @
3c7d11b6
...
...
@@ -4,7 +4,7 @@
<el-row
class=
"form-wrap"
:gutter=
"gutter"
>
<div>
<template
v-for=
"(sapProperties, key) in sapPropertyMap"
>
<
el-col
v-if=
"showSubTitle"
:span=
"24"
class=
"separator"
>
{{
getViewTypeName
(
key
)
}}
</el-col
>
<
div
class=
"separator"
>
{{
getViewTypeName
(
key
)
}}
</div
>
<template
v-for=
"item in sapProperties"
>
<el-col
:span=
"span"
:key=
"item.id"
>
<el-form-item
:label=
"item.name"
:prop=
"key + '.' + item.sapField"
...
...
@@ -34,7 +34,6 @@ export default {
props
:
{
gutter
:
{
type
:
Number
,
default
:
10
},
span
:
{
type
:
Number
,
default
:
8
},
showSubTitle
:
{
type
:
Boolean
,
default
:
true
},
},
data
()
{
return
{
...
...
@@ -107,30 +106,8 @@ export default {
return
viewType
},
setData
(
data
,
sapData
,
propertyViews
)
{
let
newSapData
=
{}
for
(
const
propertyView
of
propertyViews
)
{
let
propertyList
=
propertyView
.
propertyList
switch
(
propertyView
.
dataType
)
{
case
0
:
// 属性
for
(
const
property
of
propertyList
)
{
newSapData
[
property
.
sapField
]
=
data
[
property
.
relationField
]
||
sapData
[
property
.
sapField
]
||
''
}
case
1
:
// 对象
let
viewObj
=
{}
for
(
const
property
of
propertyList
)
{
viewObj
[
property
.
sapField
]
=
data
[
propertyView
.
viewType
][
property
.
relationField
]
||
data
[
property
.
relationField
]
||
sapData
[
propertyView
.
viewType
][
property
.
sapField
]
||
''
}
newSapData
[
propertyView
.
viewType
]
=
viewObj
case
2
:
// 列表
let
viewArr
=
sapData
[
propertyView
.
viewType
]
||
[]
data
for
(
const
property
of
propertyList
)
{
}
}
}
setData
(
data
,
sapData
,
sapPropertyMap
)
{
let
keys
=
Object
.
keys
(
sapPropertyMap
)
for
(
const
key
of
keys
)
{
if
(
!
sapPropertyMap
.
hasOwnProperty
(
key
))
continue
if
(
!
sapData
[
key
])
sapData
[
key
]
=
{}
...
...
@@ -154,7 +131,12 @@ export default {
let
sapData
=
{}
// 获取sap特性列表
listByType
({
type
,
viewType
}).
then
(
res
=>
{
let
propertyViews
=
res
.
data
||
[]
let
sapProperties
=
res
.
data
||
[]
let
sapPropertyMap
=
sapProperties
.
reduce
((
sapPropertyMap
,
item
)
=>
{
if
(
!
sapPropertyMap
[
item
.
viewType
])
sapPropertyMap
[
item
.
viewType
]
=
[]
sapPropertyMap
[
item
.
viewType
].
push
(
item
)
return
sapPropertyMap
},
{})
if
(
relationId
)
{
// 获取sap特性值
listData
({
type
,
viewType
,
relationId
}).
then
(
resp
=>
{
...
...
@@ -162,10 +144,10 @@ export default {
this
.
form
.
id
=
row
.
id
sapData
=
JSON
.
parse
(
row
.
sapData
)
// 再次赋值
this
.
setData
(
data
,
sapData
,
propertyViews
)
this
.
setData
(
data
,
sapData
,
sapPropertyMap
)
})
}
else
{
this
.
setData
(
data
,
sapData
,
propertyViews
)
this
.
setData
(
data
,
sapData
,
sapPropertyMap
)
}
})
}
...
...
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