Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
f61bb2a3
Commit
f61bb2a3
authored
Oct 24, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化属性
parent
1c90ec04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
34 deletions
+25
-34
index.jsx
src/pages/GoodsManage/createModal/index.jsx
+25
-34
No files found.
src/pages/GoodsManage/createModal/index.jsx
View file @
f61bb2a3
...
@@ -387,6 +387,18 @@ class goodsManage extends Component {
...
@@ -387,6 +387,18 @@ class goodsManage extends Component {
});
});
};
};
deal
=
attr
=>
{
try
{
const
json
=
JSON
.
parse
(
attr
);
if
(
typeof
json
===
'
object
'
&&
this
.
checkInAttrList
(
json
.
attributeValueId
))
{
return
json
;
}
return
{
attributeValueName
:
json
};
}
catch
{
return
{
attributeValueName
:
attr
};
}
};
// 最终提交
// 最终提交
confirm
=
async
isContinue
=>
{
confirm
=
async
isContinue
=>
{
const
{
const
{
...
@@ -430,6 +442,7 @@ class goodsManage extends Component {
...
@@ -430,6 +442,7 @@ class goodsManage extends Component {
});
});
const
attributeApplyList
=
[];
const
attributeApplyList
=
[];
let
isMaxLength
=
false
;
let
isMaxLength
=
false
;
if
(
values
.
attributeApplyList
&&
values
.
attributeApplyList
.
length
)
{
if
(
values
.
attributeApplyList
&&
values
.
attributeApplyList
.
length
)
{
values
.
attributeApplyList
.
forEach
(
item
=>
{
values
.
attributeApplyList
.
forEach
(
item
=>
{
const
key
=
Object
.
keys
(
item
)[
0
];
const
key
=
Object
.
keys
(
item
)[
0
];
...
@@ -437,44 +450,22 @@ class goodsManage extends Component {
...
@@ -437,44 +450,22 @@ class goodsManage extends Component {
if
(
Array
.
isArray
(
item
[
key
]))
{
if
(
Array
.
isArray
(
item
[
key
]))
{
attrs
=
[];
attrs
=
[];
item
[
key
].
forEach
(
attr
=>
{
item
[
key
].
forEach
(
attr
=>
{
try
{
const
json
=
this
.
deal
(
attr
);
const
json
=
JSON
.
parse
(
attr
);
if
(
!
json
)
{
if
(
typeof
json
===
'
object
'
)
{
return
;
if
(
this
.
checkInAttrList
(
json
.
attributeValueId
))
{
attrs
.
push
(
json
);
}
}
else
{
if
(
`
${
json
}
`
&&
`
${
json
}
`
.
length
>
30
)
{
isMaxLength
=
true
;
}
attrs
.
push
({
attributeValueName
:
json
});
}
}
catch
{
if
(
attr
&&
attr
.
length
>
30
)
{
isMaxLength
=
true
;
}
attrs
.
push
({
attributeValueName
:
attr
});
}
}
// eslint-disable-next-line no-unused-expressions
json
.
attributeValueName
.
length
>
30
&&
(
isMaxLength
=
true
);
attrs
.
push
(
json
);
});
});
}
else
{
}
else
{
try
{
const
json
=
this
.
deal
(
item
[
key
]);
const
json
=
JSON
.
parse
(
item
[
key
]);
if
(
!
json
)
{
if
(
typeof
json
===
'
object
'
)
{
return
;
if
(
this
.
checkInAttrList
(
json
.
attributeValueId
))
{
attrs
=
[
json
];
}
}
else
{
if
(
`
${
json
}
`
&&
`
${
json
}
`
.
length
>
30
)
{
isMaxLength
=
true
;
}
attrs
.
push
({
attributeValueName
:
json
});
}
}
catch
{
if
(
item
[
key
]
&&
item
[
key
].
length
>
30
)
{
isMaxLength
=
true
;
}
attrs
=
[{
attributeValueName
:
item
[
key
]
}];
}
}
// eslint-disable-next-line no-unused-expressions
json
.
attributeValueName
.
length
>
30
&&
(
isMaxLength
=
true
);
attrs
=
[
json
];
}
}
attributeApplyList
.
push
({
attributeApplyList
.
push
({
attributeId
:
key
.
replace
(
'
attr
'
,
''
),
attributeId
:
key
.
replace
(
'
attr
'
,
''
),
...
...
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