Commit 2ca6d418 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 会员信息变更

parent 991442a3
......@@ -119,6 +119,8 @@ const MemberArchiveInfo = () => {
const [loading, setLoading] = useState(false);
const [depositData, setDepositData] = useState({})
const [btnLoading, setBtnLoading] = useState(false)
const [detail, setDetail] = useState<any>({});
const [qualitiesList, setQualitiesList] = useState<any[]>([]);
const contenxt = useContext(MemberDetailsContext);
const categoryFormRef = useRef<MemberDocCategoryProRef | null>(null);
......@@ -145,17 +147,18 @@ const MemberArchiveInfo = () => {
const getDepositDetailData = async () => {
const { data, code } = await getMemberAbilityInfoDepositDetail({ validateId })
if (code === 1000) {
setDepositData(data)
depositRef.current.values = {}
qualitiesRef.current.values = []
data?.groups?.length > 0 && data.groups[0]?.elements?.length > 0 &&
if (code !== 1000) {
return
}
if (data?.groups?.length > 0 && data.groups[0]?.elements?.length > 0) {
const param = {}
data.groups.forEach(item => {
item.elements.forEach(_item => {
depositRef.current.values[_item.fieldName] = _item.fieldValue
param[_item.fieldName] = _item.fieldValue
})
})
/* 处理资质证明数据 */
setDetail(param)
}
const qualitiesList = data.qualities?.length > 0 ? data.qualities.map(item => (
{
expireDay: item.expireDay,
......@@ -163,9 +166,8 @@ const MemberArchiveInfo = () => {
permanent: [item.permanent]
}
)) : []
qualitiesRef.current.values = qualitiesList
console.log('depositRef', depositRef);
}
setQualitiesList(qualitiesList)
setDepositData(data)
}
const inspectionColumns: EditableColumns<InspectListItemType>[] = [
......@@ -381,8 +383,7 @@ const MemberArchiveInfo = () => {
];
return Promise.all(promises).then(() => {
console.log('depositRef.current', depositRef.current?.values);
const qualities = qualitiesRef.current?.values?.length > 0 ? qualitiesRef.current.values.filter((item) => item.file && item.file[0] && item.file[0].status === 'done')
const qualities = qualitiesList.length > 0 ? qualitiesList.filter((item) => item.file && item.file[0] && item.file[0].status === 'done')
.map((item) => ({
url: item.file && item.file?.length > 0 ? item.file[0].url : '',
name: item.file && item.file?.length > 0 ? item.file[0].name : '',
......@@ -392,8 +393,8 @@ const MemberArchiveInfo = () => {
const params = {
validateId,
detail: depositRef.current?.values,
qualities
detail,
qualities,
}
postMemberAbilityInfoDepositDetailUpdate(params, { ctlType: 'none' })
......@@ -426,11 +427,11 @@ const MemberArchiveInfo = () => {
}
const handleDepositChange = (values: DepositValueType) => {
depositRef.current.values = values;
setDetail({...values})
};
const handleQualitiesChange = (values) => {
qualitiesRef.current.values = values;
setQualitiesList([...values])
};
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment