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
12399379
Commit
12399379
authored
Dec 16, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改自动保存方法
parent
d921a692
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
105 additions
and
43 deletions
+105
-43
EditFormTable.jsx
src/pages/ServiceGoods/components/EditFormTable.jsx
+8
-3
FormAttr.jsx
src/pages/ServiceGoods/components/FormAttr.jsx
+7
-1
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+7
-1
FormPackage.jsx
src/pages/ServiceGoods/components/FormPackage.jsx
+8
-1
FormPriceOrStock.jsx
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
+7
-1
FormRuleSetting.jsx
src/pages/ServiceGoods/components/FormRuleSetting.jsx
+7
-2
FormRuleVPictures.jsx
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
+7
-1
FormSettlementOthers.jsx
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
+7
-1
index.jsx
src/pages/ServiceGoods/index.jsx
+8
-6
utils.js
src/pages/ServiceGoods/utils.js
+39
-26
No files found.
src/pages/ServiceGoods/components/EditFormTable.jsx
View file @
12399379
import
{
Input
,
Modal
,
Button
,
Form
,
Table
,
InputNumber
}
from
'
antd
'
;
import
{
Input
,
Modal
,
Button
,
Form
,
Table
}
from
'
antd
'
;
import
React
,
{
import
React
,
{
useContext
,
useContext
,
createContext
,
createContext
,
...
@@ -9,7 +9,7 @@ import React, {
...
@@ -9,7 +9,7 @@ import React, {
}
from
'
react
'
;
}
from
'
react
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
CreateFormInput
}
from
'
./CommonTemplate
'
;
import
{
CreateFormInput
}
from
'
./CommonTemplate
'
;
import
UUID
from
'
../../../utils/uuid
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
UpdateSkuName
=
({
skuVisble
,
value
,
confirmEvent
,
cancelEvent
})
=>
{
const
UpdateSkuName
=
({
skuVisble
,
value
,
confirmEvent
,
cancelEvent
})
=>
{
const
[
skuForm
]
=
Form
.
useForm
();
const
[
skuForm
]
=
Form
.
useForm
();
...
@@ -95,6 +95,11 @@ const EditFormTable = forwardRef((props, ref) => {
...
@@ -95,6 +95,11 @@ const EditFormTable = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
const
rowOnClickEvent
=
row
=>
{
const
rowOnClickEvent
=
row
=>
{
setSkuVisble
(
true
);
setSkuVisble
(
true
);
setSkuNameItem
({
setSkuNameItem
({
...
@@ -171,7 +176,7 @@ const EditFormTable = forwardRef((props, ref) => {
...
@@ -171,7 +176,7 @@ const EditFormTable = forwardRef((props, ref) => {
return
(
return
(
<>
<>
<
Form
form=
{
form
}
scrollToFirstError
component=
{
false
}
onValuesChange=
{
props
.
onValuesChange
}
>
<
Form
form=
{
form
}
scrollToFirstError
component=
{
false
}
onValuesChange=
{
getFormValues
}
>
<
EditableContext
.
Provider
value=
{
form
}
>
<
EditableContext
.
Provider
value=
{
form
}
>
<
Table
<
Table
scroll=
{
{
y
:
300
,
x
:
1000
}
}
scroll=
{
{
y
:
300
,
x
:
1000
}
}
...
...
src/pages/ServiceGoods/components/FormAttr.jsx
View file @
12399379
...
@@ -6,6 +6,7 @@ import { UpOutlined, DownOutlined } from '@ant-design/icons';
...
@@ -6,6 +6,7 @@ import { UpOutlined, DownOutlined } from '@ant-design/icons';
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
import
{
apiGetAttribute
}
from
'
../service
'
;
import
{
apiGetAttribute
}
from
'
../service
'
;
import
CustomSelect
from
'
@/components/CustomSelect
'
;
import
CustomSelect
from
'
@/components/CustomSelect
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
FormAttr
=
forwardRef
((
props
,
ref
)
=>
{
const
FormAttr
=
forwardRef
((
props
,
ref
)
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
...
@@ -125,6 +126,11 @@ const FormAttr = forwardRef((props, ref) => {
...
@@ -125,6 +126,11 @@ const FormAttr = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
try
{
try
{
const
values
=
await
form
.
validateFields
();
const
values
=
await
form
.
validateFields
();
...
@@ -175,7 +181,7 @@ const FormAttr = forwardRef((props, ref) => {
...
@@ -175,7 +181,7 @@ const FormAttr = forwardRef((props, ref) => {
<>
<>
<
div
className=
{
styles
.
attrbox
+
(
isMore
?
styles
.
attrboxMore
:
''
)
}
>
<
div
className=
{
styles
.
attrbox
+
(
isMore
?
styles
.
attrboxMore
:
''
)
}
>
{
categoryAttrs
.
length
>
0
&&
(
{
categoryAttrs
.
length
>
0
&&
(
<
Form
form=
{
form
}
initialValues=
{
initAttrData
}
onValuesChange=
{
props
.
onValuesChange
}
>
<
Form
form=
{
form
}
initialValues=
{
initAttrData
}
onValuesChange=
{
getFormValues
}
>
<
Row
>
<
Row
>
{
categoryAttrs
.
map
(
k
=>
(
{
categoryAttrs
.
map
(
k
=>
(
<
Col
span=
{
12
}
key=
{
k
.
id
}
>
<
Col
span=
{
12
}
key=
{
k
.
id
}
>
...
...
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
12399379
...
@@ -2,6 +2,7 @@ import React, { useState, useContext, useEffect, forwardRef, useImperativeHandle
...
@@ -2,6 +2,7 @@ import React, { useState, useContext, useEffect, forwardRef, useImperativeHandle
import
{
Cascader
,
Form
,
Input
,
Select
,
Popover
,
Button
,
Checkbox
}
from
'
antd
'
;
import
{
Cascader
,
Form
,
Input
,
Select
,
Popover
,
Button
,
Checkbox
}
from
'
antd
'
;
import
{
formItemLayout
}
from
'
../config
'
;
import
{
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
CreateSelectOption
=
optionList
=>
const
CreateSelectOption
=
optionList
=>
optionList
.
map
(
brandItem
=>
(
optionList
.
map
(
brandItem
=>
(
...
@@ -53,6 +54,11 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -53,6 +54,11 @@ const FormInformationBasic = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
onCheck
,
onCheck
,
reset
:
form
.
resetFields
,
reset
:
form
.
resetFields
,
...
@@ -82,7 +88,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -82,7 +88,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
description
:
''
,
description
:
''
,
}
}
}
}
scrollToFirstError
scrollToFirstError
onValuesChange=
{
props
.
onValuesChange
}
onValuesChange=
{
getFormValues
}
>
>
<
Form
.
Item
<
Form
.
Item
name=
"categoryId"
name=
"categoryId"
...
...
src/pages/ServiceGoods/components/FormPackage.jsx
View file @
12399379
...
@@ -4,6 +4,7 @@ import { PlusOutlined } from '@ant-design/icons';
...
@@ -4,6 +4,7 @@ import { PlusOutlined } from '@ant-design/icons';
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
import
{
isIntegerNotZero
,
isCheckPriceOneDecimal
}
from
'
@/utils/validator
'
;
import
{
isIntegerNotZero
,
isCheckPriceOneDecimal
}
from
'
@/utils/validator
'
;
import
UUID
from
'
@/utils/uuid
'
;
import
UUID
from
'
@/utils/uuid
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -176,6 +177,11 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -176,6 +177,11 @@ const FormPackage = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
// 创建分组
// 创建分组
const
onCreateGroup
=
()
=>
{
const
onCreateGroup
=
()
=>
{
const
str
=
groupName
&&
groupName
.
trim
();
const
str
=
groupName
&&
groupName
.
trim
();
...
@@ -230,6 +236,7 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -230,6 +236,7 @@ const FormPackage = forwardRef((props, ref) => {
}
}
setList
(
arr
);
setList
(
arr
);
form
.
setFieldsValue
(
arrList
);
form
.
setFieldsValue
(
arrList
);
getFormValues
();
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -270,7 +277,7 @@ const FormPackage = forwardRef((props, ref) => {
...
@@ -270,7 +277,7 @@ const FormPackage = forwardRef((props, ref) => {
return
(
return
(
<
div
className=
{
styles
.
formPackageBox
}
>
<
div
className=
{
styles
.
formPackageBox
}
>
<
Form
style=
{
{
marginBottom
:
10
}
}
form=
{
form
}
onValuesChange=
{
props
.
onValuesChange
}
>
<
Form
style=
{
{
marginBottom
:
10
}
}
form=
{
form
}
onValuesChange=
{
getFormValues
}
>
<
Form
.
List
name=
"lists"
>
<
Form
.
List
name=
"lists"
>
{
(
fields
,
{
add
,
remove
})
=>
(
{
(
fields
,
{
add
,
remove
})
=>
(
<>
<>
...
...
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
View file @
12399379
...
@@ -19,6 +19,7 @@ import {
...
@@ -19,6 +19,7 @@ import {
fliterSkuListSortData
,
fliterSkuListSortData
,
filterSkuNotIdList
,
filterSkuNotIdList
,
}
from
'
../utils
'
;
}
from
'
../utils
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
SelectTemplate
,
Title
}
from
'
./CommonTemplate
'
;
import
{
SelectTemplate
,
Title
}
from
'
./CommonTemplate
'
;
...
@@ -255,6 +256,11 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -255,6 +256,11 @@ const FormPriceOrStock = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
const
CreateColumnsEvent
=
specData
=>
{
const
CreateColumnsEvent
=
specData
=>
{
const
columsData
=
[];
const
columsData
=
[];
if
(
specData
.
firstSpec
&&
specData
.
firstSpecValue
.
length
)
{
if
(
specData
.
firstSpec
&&
specData
.
firstSpecValue
.
length
)
{
...
@@ -389,7 +395,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -389,7 +395,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
form=
{
form
}
form=
{
form
}
autoComplete=
"off"
autoComplete=
"off"
initialValues=
{
initSpecReced
()
}
initialValues=
{
initSpecReced
()
}
onValuesChange=
{
props
.
onValuesChange
}
onValuesChange=
{
getFormValues
}
>
>
<
SpecificationTemplate
<
SpecificationTemplate
form=
{
form
}
form=
{
form
}
...
...
src/pages/ServiceGoods/components/FormRuleSetting.jsx
View file @
12399379
...
@@ -3,7 +3,7 @@ import React, { useEffect, forwardRef, useImperativeHandle, useContext } from 'r
...
@@ -3,7 +3,7 @@ import React, { useEffect, forwardRef, useImperativeHandle, useContext } from 'r
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
import
{
WeeksList
,
formItemLayout
}
from
'
../config
'
;
import
{
WeeksList
,
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
formatTime
}
from
'
../../..
/utils/utils
'
;
import
{
debounce
,
formatTime
}
from
'
@
/utils/utils
'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
...
@@ -62,6 +62,11 @@ const FormRuleSetting = forwardRef((props, ref) => {
...
@@ -62,6 +62,11 @@ const FormRuleSetting = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
const
nowDateTime
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 00:00:00
'
));
const
nowDateTime
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 00:00:00
'
));
const
nowDateTimeEnd
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 23:59:59
'
));
const
nowDateTimeEnd
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 23:59:59
'
));
...
@@ -89,7 +94,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
...
@@ -89,7 +94,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
tips
:
''
,
// 温馨提示
tips
:
''
,
// 温馨提示
}
}
}
}
scrollToFirstError
scrollToFirstError
onValuesChange=
{
props
.
onValuesChange
}
onValuesChange=
{
getFormValues
}
>
>
<
Form
.
Item
name=
"purchaseTime"
label=
"购买时间"
{
...
rangeConfig
}
>
<
Form
.
Item
name=
"purchaseTime"
label=
"购买时间"
{
...
rangeConfig
}
>
<
RangePicker
<
RangePicker
...
...
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
View file @
12399379
...
@@ -4,6 +4,7 @@ import { ServiceContext } from '../context';
...
@@ -4,6 +4,7 @@ import { ServiceContext } from '../context';
import
{
TaskList
,
formItemLayout
}
from
'
../config
'
;
import
{
TaskList
,
formItemLayout
}
from
'
../config
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
commonStyle
from
'
../common.less
'
;
import
commonStyle
from
'
../common.less
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
FormRuleVPictures
=
forwardRef
((
props
,
ref
)
=>
{
const
FormRuleVPictures
=
forwardRef
((
props
,
ref
)
=>
{
const
{
editData
,
specKeyItem
}
=
props
;
const
{
editData
,
specKeyItem
}
=
props
;
...
@@ -65,6 +66,11 @@ const FormRuleVPictures = forwardRef((props, ref) => {
...
@@ -65,6 +66,11 @@ const FormRuleVPictures = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
onCheck
,
onCheck
,
setFieldsValue
:
form
.
setFieldsValue
,
setFieldsValue
:
form
.
setFieldsValue
,
...
@@ -117,7 +123,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
...
@@ -117,7 +123,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
imageList
:
{},
imageList
:
{},
detailImageList
:
[],
detailImageList
:
[],
}
}
}
}
onValuesChange=
{
props
.
onValuesChange
}
onValuesChange=
{
getFormValues
}
>
>
<
Form
.
Item
<
Form
.
Item
name=
"commonImageList"
name=
"commonImageList"
...
...
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
View file @
12399379
...
@@ -3,6 +3,7 @@ import { Form, Input, Select, Checkbox, Radio, Space, InputNumber } from 'antd';
...
@@ -3,6 +3,7 @@ import { Form, Input, Select, Checkbox, Radio, Space, InputNumber } from 'antd';
import
{
Title
}
from
'
./CommonTemplate
'
;
import
{
Title
}
from
'
./CommonTemplate
'
;
import
{
formItemLayout
}
from
'
../config
'
;
import
{
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
const
createInitValues
=
()
=>
({
const
createInitValues
=
()
=>
({
settlementMethod
:
1
,
settlementMethod
:
1
,
...
@@ -35,6 +36,11 @@ const FormSettlementOthers = forwardRef((props, ref) => {
...
@@ -35,6 +36,11 @@ const FormSettlementOthers = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
customer
.
isEdit
)
{
if
(
customer
.
isEdit
)
{
if
(
!
editData
)
return
;
if
(
!
editData
)
return
;
...
@@ -120,7 +126,7 @@ const FormSettlementOthers = forwardRef((props, ref) => {
...
@@ -120,7 +126,7 @@ const FormSettlementOthers = forwardRef((props, ref) => {
name=
"register"
name=
"register"
initialValues=
{
initValue
}
initialValues=
{
initValue
}
scrollToFirstError
scrollToFirstError
onValuesChange=
{
props
.
onValuesChange
}
onValuesChange=
{
getFormValues
}
>
>
<
Form
.
Item
<
Form
.
Item
name=
"appointment"
name=
"appointment"
...
...
src/pages/ServiceGoods/index.jsx
View file @
12399379
...
@@ -72,15 +72,17 @@ const ServiceGoods = options => {
...
@@ -72,15 +72,17 @@ const ServiceGoods = options => {
const
productChange
=
task
=>
{
const
productChange
=
task
=>
{
setProductType
(
task
.
type
);
setProductType
(
task
.
type
);
onAutoSaveValue
(
setPageLoading
(
true
);
{
type
:
task
.
type
,
},
!
0
,
);
const
timer
=
setTimeout
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
setPageLoading
(
false
);
resetForm
();
resetForm
();
clearTimeout
(
timer
);
clearTimeout
(
timer
);
onAutoSaveValue
(
{
type
:
task
.
type
,
},
!
0
,
);
},
1000
);
},
1000
);
};
};
...
...
src/pages/ServiceGoods/utils.js
View file @
12399379
...
@@ -109,7 +109,6 @@ const filterItems = (type, props) => {
...
@@ -109,7 +109,6 @@ const filterItems = (type, props) => {
};
};
export
const
filterSendData
=
(
type
,
params
)
=>
{
export
const
filterSendData
=
(
type
,
params
)
=>
{
console
.
log
(
'
===============>生成数据
'
,
params
);
const
{
infoMation
,
infoImageData
,
attributeApplyList
}
=
params
;
const
{
infoMation
,
infoImageData
,
attributeApplyList
}
=
params
;
const
items
=
filterItems
(
type
,
params
);
const
items
=
filterItems
(
type
,
params
);
const
commonImageList
=
type
===
4
?
[]
:
infoImageData
.
commonImageList
;
const
commonImageList
=
type
===
4
?
[]
:
infoImageData
.
commonImageList
;
...
@@ -258,30 +257,44 @@ export const onAutoSaveValue = (e, isClear) => {
...
@@ -258,30 +257,44 @@ export const onAutoSaveValue = (e, isClear) => {
localStorage
.
set
(
localkey
,
Object
.
assign
({},
e
));
localStorage
.
set
(
localkey
,
Object
.
assign
({},
e
));
}
else
{
}
else
{
const
info
=
localStorage
.
get
(
localkey
)
||
{};
const
info
=
localStorage
.
get
(
localkey
)
||
{};
console
.
log
(
'
e :>>
'
,
e
);
localStorage
.
set
(
localkey
,
Object
.
assign
({},
info
,
e
));
const
key
=
Object
.
keys
(
e
)[
0
];
if
(
getObjectType
(
e
[
key
])
===
'
Array
'
)
{
e
[
key
].
forEach
((
item
,
i
)
=>
{
if
(
item
!==
null
)
{
if
(
getObjectType
(
item
)
===
'
Object
'
)
{
const
itemkeys
=
Object
.
keys
(
item
);
if
(
itemkeys
.
length
>
1
||
info
[
key
][
i
]
===
null
)
{
info
[
key
][
i
]
=
item
;
}
else
{
info
[
key
][
i
][
itemkeys
[
0
]]
=
item
[
itemkeys
[
0
]];
}
}
else
{
info
[
key
][
i
]
=
item
;
}
}
});
localStorage
.
set
(
localkey
,
Object
.
assign
({},
info
));
}
else
if
(
getObjectType
(
e
[
key
])
===
'
Object
'
)
{
const
okey
=
Object
.
keys
(
e
[
key
])[
0
];
info
[
key
][
okey
]
=
e
[
key
][
okey
];
}
else
{
localStorage
.
set
(
localkey
,
Object
.
assign
({},
info
,
e
));
}
}
}
message
.
success
(
'
已自动保存至缓存
'
);
};
};
// export const onAutoSaveValue = (e, isClear) => {
// const localkey = 'good-info-auto-save';
// if (isClear) {
// localStorage.set(localkey, Object.assign({}, e));
// } else {
// const info = localStorage.get(localkey) || {};
// const key = Object.keys(e)[0];
// if (info[key] === undefined) {
// info[key] = e[key];
// localStorage.set(localkey, Object.assign({}, info));
// return;
// }
// if (getObjectType(e[key]) === 'Array' && e[key].length && getObjectType(e[key][0]) === 'Object') {
// e[key].forEach((item, i) => {
// if (item !== null) {
// if (getObjectType(item) === 'Object') {
// const itemkeys = Object.keys(item);
// if (itemkeys.length > 1 || info[key][i] === null) {
// info[key][i] = item;
// } else {
// info[key][i][itemkeys[0]] = item[itemkeys[0]];
// }
// } else {
// info[key][i] = item;
// }
// }
// });
// localStorage.set(localkey, Object.assign({}, info));
// } else if (getObjectType(e[key]) === 'Object') {
// const okey = Object.keys(e[key])[0];
// info[key][okey] = e[key][okey];
// } else {
// localStorage.set(localkey, Object.assign({}, info, e));
// }
// }
// message.success('已自动保存至缓存');
// };
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