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
3bf3795e
Commit
3bf3795e
authored
Jan 16, 2022
by
beisir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(校验必填内容): 添加表格详细校验说明
parent
99da4b14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
58 deletions
+27
-58
mixin.jsx
src/pages/GoodsManage/createModal/mixin.jsx
+27
-58
No files found.
src/pages/GoodsManage/createModal/mixin.jsx
View file @
3bf3795e
...
...
@@ -3,20 +3,12 @@ import React from 'react';
import
{
Input
,
Button
,
notification
,
Popover
,
InputNumber
}
from
'
antd
'
;
import
{
sortBy
}
from
'
lodash
'
;
const
KEYLIST
=
[
'
id
'
,
'
name
'
,
'
skuLink
'
,
'
imageList
'
,
'
firstSpecId
'
,
'
secondSpecId
'
,
'
supplyPrice
'
,
'
productStockWarning
'
,
'
firstSpec
'
,
'
firstSpecValue
'
,
'
secondSpec
'
,
'
secondSpecValue
'
,
];
const
CHECK_OBJECT
=
{
supplyPrice
:
'
供货价
'
,
marketPrice
:
'
市场价
'
,
productStock
:
'
库存
'
,
thirdSkuNo
:
'
商品自编码
'
,
};
export
function
normFile
(
fileList
)
{
return
fileList
;
...
...
@@ -135,27 +127,31 @@ export function createEditData(values, initData) {
}
export
function
validateSpuInfo
(
values
,
initData
,
editData
,
productType
)
{
const
checkKeyList
=
productType
===
1
?
KEYLIST
:
[...
KEYLIST
,
'
weight
'
];
let
flag
=
false
;
editData
.
forEach
(
item
=>
{
const
keys
=
Object
.
keys
(
item
);
keys
.
forEach
(
key
=>
{
if
(
checkKeyList
.
includes
(
key
))
{
return
;
}
// console.log(key, item, item[key], (item[key] === undefined) || (item[key] === null));
// if (!`${item[key]}`) {
if
(
item
[
key
]
===
undefined
||
item
[
key
]
===
null
||
item
[
key
]
===
''
)
{
flag
=
true
;
const
newCheckObject
=
productType
===
1
?
{
...
CHECK_OBJECT
,
weight
:
'
重量(kg)
'
}
:
{
...
CHECK_OBJECT
};
const
checkKey
=
Object
.
keys
(
newCheckObject
);
const
checkString
=
[];
editData
.
forEach
((
item
,
index
)
=>
{
const
rowCheckString
=
checkKey
.
reduce
((
checkMessage
,
val
,
ind
)
=>
{
const
checkItem
=
item
[
val
];
if
(
checkItem
===
null
||
checkItem
===
undefined
||
checkItem
===
''
)
{
checkMessage
+=
`
${
newCheckObject
[
val
]}
; `
;
}
});
return
checkMessage
;
},
''
);
if
(
rowCheckString
)
{
checkString
.
push
(<
div
key=
{
index
.
toString
()
}
>
{
`第${index + 1}行: ${rowCheckString}`
}
</
div
>);
}
});
if
(
flag
)
{
notification
.
error
({
message
:
'
请完善商品表格!
'
,
if
(
checkString
.
length
)
{
notification
.
warning
({
message
:
'
请完善表格:
'
,
description
:
checkString
,
duration
:
null
,
});
return
true
;
}
return
f
lag
;
return
f
alse
;
}
export
function
dataInit
(
list
)
{
...
...
@@ -208,13 +204,6 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
onChange=
{
value
=>
inputChange
(
value
,
'
supplyPrice
'
,
index
)
}
disabled=
{
isJDGoods
}
/>
// <Input
// value={val}
// className={`supplyPrice ${index}`}
// defaultValue={val}
// onChange={evt => inputChange(evt.target.value, 'supplyPrice', index)}
// disabled={isJDGoods}
// />
),
},
{
...
...
@@ -231,13 +220,6 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
min=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
marketPrice
'
,
index
)
}
/>
// <Input
// value={val}
// className={`marketPrice ${index}`}
// defaultValue={val}
// onChange={evt => inputChange(evt.target.value, 'marketPrice', index)}
// />
),
},
{
...
...
@@ -252,7 +234,6 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision=
{
0
}
min=
{
0
}
onChange=
{
value
=>
inputChange
(
value
,
'
productStock
'
,
index
)
}
// disabled={isEdit && row.id}
/>
),
},
...
...
@@ -271,18 +252,6 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
/>
),
},
// {
// title: 'sku名称',
// align: 'center',
// key: 'name',
// dataIndex: 'name',
// width: 100,
// render: val => (
// <Popover content={val} trigger="hover">
// <a>查看名称</a>
// </Popover>
// ),
// },
{
title
:
'
京东链接
'
,
align
:
'
center
'
,
...
...
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