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

fix: 会员信息变更

parent 991442a3
...@@ -119,6 +119,8 @@ const MemberArchiveInfo = () => { ...@@ -119,6 +119,8 @@ const MemberArchiveInfo = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [depositData, setDepositData] = useState({}) const [depositData, setDepositData] = useState({})
const [btnLoading, setBtnLoading] = useState(false) const [btnLoading, setBtnLoading] = useState(false)
const [detail, setDetail] = useState<any>({});
const [qualitiesList, setQualitiesList] = useState<any[]>([]);
const contenxt = useContext(MemberDetailsContext); const contenxt = useContext(MemberDetailsContext);
const categoryFormRef = useRef<MemberDocCategoryProRef | null>(null); const categoryFormRef = useRef<MemberDocCategoryProRef | null>(null);
...@@ -145,27 +147,27 @@ const MemberArchiveInfo = () => { ...@@ -145,27 +147,27 @@ const MemberArchiveInfo = () => {
const getDepositDetailData = async () => { const getDepositDetailData = async () => {
const { data, code } = await getMemberAbilityInfoDepositDetail({ validateId }) const { data, code } = await getMemberAbilityInfoDepositDetail({ validateId })
if (code === 1000) { if (code !== 1000) {
setDepositData(data) return
depositRef.current.values = {} }
qualitiesRef.current.values = [] if (data?.groups?.length > 0 && data.groups[0]?.elements?.length > 0) {
data?.groups?.length > 0 && data.groups[0]?.elements?.length > 0 && const param = {}
data.groups.forEach(item => { data.groups.forEach(item => {
item.elements.forEach(_item => { item.elements.forEach(_item => {
depositRef.current.values[_item.fieldName] = _item.fieldValue param[_item.fieldName] = _item.fieldValue
})
}) })
/* 处理资质证明数据 */ })
const qualitiesList = data.qualities?.length > 0 ? data.qualities.map(item => ( setDetail(param)
{
expireDay: item.expireDay,
file: [{ name: item.name, status: 'done', url: item.url }],
permanent: [item.permanent]
}
)) : []
qualitiesRef.current.values = qualitiesList
console.log('depositRef', depositRef);
} }
const qualitiesList = data.qualities?.length > 0 ? data.qualities.map(item => (
{
expireDay: item.expireDay,
file: [{ name: item.name, status: 'done', url: item.url }],
permanent: [item.permanent]
}
)) : []
setQualitiesList(qualitiesList)
setDepositData(data)
} }
const inspectionColumns: EditableColumns<InspectListItemType>[] = [ const inspectionColumns: EditableColumns<InspectListItemType>[] = [
...@@ -381,8 +383,7 @@ const MemberArchiveInfo = () => { ...@@ -381,8 +383,7 @@ const MemberArchiveInfo = () => {
]; ];
return Promise.all(promises).then(() => { return Promise.all(promises).then(() => {
console.log('depositRef.current', depositRef.current?.values); const qualities = qualitiesList.length > 0 ? qualitiesList.filter((item) => item.file && item.file[0] && item.file[0].status === 'done')
const qualities = qualitiesRef.current?.values?.length > 0 ? qualitiesRef.current.values.filter((item) => item.file && item.file[0] && item.file[0].status === 'done')
.map((item) => ({ .map((item) => ({
url: item.file && item.file?.length > 0 ? item.file[0].url : '', url: item.file && item.file?.length > 0 ? item.file[0].url : '',
name: item.file && item.file?.length > 0 ? item.file[0].name : '', name: item.file && item.file?.length > 0 ? item.file[0].name : '',
...@@ -392,8 +393,8 @@ const MemberArchiveInfo = () => { ...@@ -392,8 +393,8 @@ const MemberArchiveInfo = () => {
const params = { const params = {
validateId, validateId,
detail: depositRef.current?.values, detail,
qualities qualities,
} }
postMemberAbilityInfoDepositDetailUpdate(params, { ctlType: 'none' }) postMemberAbilityInfoDepositDetailUpdate(params, { ctlType: 'none' })
...@@ -426,11 +427,11 @@ const MemberArchiveInfo = () => { ...@@ -426,11 +427,11 @@ const MemberArchiveInfo = () => {
} }
const handleDepositChange = (values: DepositValueType) => { const handleDepositChange = (values: DepositValueType) => {
depositRef.current.values = values; setDetail({...values})
}; };
const handleQualitiesChange = (values) => { const handleQualitiesChange = (values) => {
qualitiesRef.current.values = values; setQualitiesList([...values])
}; };
return ( 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