export const mapDraft = (state: any) => {
    return {
        /**第一页 */
        nftHash: state[0].trace.nftHash,
        nftName: state[0].trace.name,
        files: state[0].fileList.map((item: {fileName: string, type: string, fileUrl: string, fileHash: string, fileSize:number})=>{
            return {
             fileHash: item.fileHash,
             fileName: item.fileName,
             fileSuffix: item.type,
             fileUrl: item.fileUrl,
             fileSize: item.fileSize
            }
        }),
        registerEntrust: state[0].commissionFileList[0]? state[0].commissionFileList[0].fileUrl : '',
        /**第二页 */
        firstPublishCity: state[1].proofPublishPlace[1]? state[1].proofPublishPlace[1].name : '',
        firstPublishDate: state[1].proofPublishDate,
        firstPublishProvince: state[1].proofPublishPlace[0]? state[1].proofPublishPlace[0].name : '',
        opusCategoryId: state[1].proofType.value,
        opusCompleteCity: state[1].proofFinishPlace[1]? state[1].proofFinishPlace[1].name : '',
        opusCompleteDate: state[1].proofFinishDate,
        opusCompleteProvince: state[1].proofFinishPlace[0]? state[1].proofFinishPlace[0].name : '',
        opusName: state[1].proofName,
        opusProperty: state[1].proofFeature.name,
        contentSynopsis: state[1].proofDesc,
        createProcess: state[1].proofCreateProgress,
        publishState: state[1].proofPublishStatus,
        /**第三页 */
        authorityAcquireMode: state[2].authGetWay.name || '',
        authorityAcquireProve: state[2].uploadAuthCer[0]? state[2].uploadAuthCer[0].fileUrl : '',
        authorityAscriptionMode: state[2].authBelongWay.name || '',
        authorityAscriptionProve: state[2].authBelongCer[0]? state[2].authBelongCer[0].fileUrl : '',
        opusPowerGuarantee: state[2].authGuaranteeCer[0]? state[2].authGuaranteeCer[0].fileUrl : '',
        /**第四页 */
        authors: state[3].authorList.map((item:{id: number, name: string, aliasType: {name: string}, alias: string})=>{
            return {
               name: item.name,
               sign: item.alias,
               signType: item.aliasType.name
            }
        }),
        authorityIds: state[3].rightList.map((item: {name: string, selected: boolean, value: number})=>{
            return item.value
        }),
        ownerIds: state[3].copyrightOwnerList.map((item: any)=>{
            return item.id
        }),
        content:'',
    }
}

/**这个是之前已经保存过数据，再次修改时，有些数据如果没修改，则传[] */
export const mapFilterDraft = (state: any, draft: any) => {
    return {
        /**第一页 */
        nftHash: state[0].trace.nftHash,
        nftName: state[0].trace.name,
        files: JSON.stringify(state[0].fileList) != JSON.stringify(draft[0].fileList)? state[0].fileList.map((item: {fileName: string, type: string, fileUrl: string, fileHash: string, fileSize:number})=>{
            return {
             fileHash: item.fileHash,
             fileName: item.fileName,
             fileSuffix: item.type,
             fileUrl: item.fileUrl,
             fileSize: item.fileSize
            }
        }) : [],
        registerEntrust: state[0].commissionFileList[0]? state[0].commissionFileList[0].fileUrl : '',
        /**第二页 */
        firstPublishCity: state[1].proofPublishPlace[1]? state[1].proofPublishPlace[1].name : '',
        firstPublishDate: state[1].proofPublishDate,
        firstPublishProvince: state[1].proofPublishPlace[0]? state[1].proofPublishPlace[0].name : '',
        opusCategoryId: state[1].proofType.value,
        opusCompleteCity: state[1].proofFinishPlace[1]? state[1].proofFinishPlace[1].name : '',
        opusCompleteDate: state[1].proofFinishDate,
        opusCompleteProvince: state[1].proofFinishPlace[0]? state[1].proofFinishPlace[0].name : '',
        opusName: state[1].proofName,
        opusProperty: state[1].proofFeature.name,
        contentSynopsis: state[1].proofDesc,
        createProcess: state[1].proofCreateProgress,
        publishState: state[1].proofPublishStatus,
        /**第三页 */
        authorityAcquireMode: state[2].authGetWay.name || '',
        authorityAcquireProve: state[2].uploadAuthCer[0]? state[2].uploadAuthCer[0].fileUrl : '',
        authorityAscriptionMode: state[2].authBelongWay.name || '',
        authorityAscriptionProve: state[2].authBelongCer[0]? state[2].authBelongCer[0].fileUrl : '',
        opusPowerGuarantee: state[2].authGuaranteeCer[0]? state[2].authGuaranteeCer[0].fileUrl : '',
        /**第四页 */
        authors: JSON.stringify(state[3].authorList) != JSON.stringify(draft[3].authorList)? state[3].authorList.map((item:{id: number, name: string, aliasType: {name: string}, alias: string})=>{
            return {
               name: item.name,
               sign: item.alias,
               signType: item.aliasType.name
            }
        }):[],
        authorityIds: JSON.stringify(state[3].rightList) != JSON.stringify(draft[3].rightList)? state[3].rightList.map((item: {name: string, selected: boolean, value: number})=>{
            return item.value
        }):[],
        ownerIds: JSON.stringify(state[3].copyrightOwnerList) != JSON.stringify(draft[3].copyrightOwnerList)? state[3].copyrightOwnerList.map((item: any)=>{
            return item.id
        }):[],
        content: '',
        id: '',
    }
}