Commit bccb17f8 authored by XieZhiXiong's avatar XieZhiXiong

chore: 调整 Upload 数据结构

parent a1dd8442
......@@ -242,8 +242,6 @@ export const Upload = connect({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { listType, locale, onChange, value, ...others } = this.props
console.log('this.state.value', this.state.value)
if (listType.indexOf('card') > -1) {
return (
<AntdUpload
......
......@@ -100,7 +100,7 @@ const UploadVoucher: React.FC<UploadVoucherProps> = ({
...rest,
fileList: fileList.map(item => item.status === 'done' && ({
name: item.name,
proveUrl: item.data.url,
proveUrl: item.url,
})).filter(Boolean),
},
}, 'uploadVoucher');
......
......@@ -359,7 +359,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
},
proofFileList: proofFileList.filter(item => item.status === 'done').map(item => ({
fileName: item.name,
filePath: item.data.url,
filePath: item.url,
})),
replaceGoodsList: replaceGoodsList.map(({
replaceCount,
......
......@@ -207,7 +207,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
repairAddress: repairAddress ? JSON.stringify(repairAddress) : '',
faultFileList: faultFileList.filter(item => item.status === 'done').map(item => ({
fileName: item.name,
filePath: item.data.url,
filePath: item.url,
})),
repairGoodsList: repairGoodsList.map(({
repairCount,
......
......@@ -358,7 +358,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
proofFileList: proofFileList.filter(item => item.status === 'done').map(item => ({
fileName: item.name,
filePath: item.data.url,
filePath: item.url,
})),
returnGoodsList: returnGoodsList.map(({
id,
......
......@@ -103,7 +103,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
PublicApi.postPayCreditApplyAddCreditApply({
applyId: +id,
creditId: creditId ? +creditId : 0,
fileList: fileList.map((item: any) => ({ name: item.name, fileUrl: item.data.url })),
fileList: fileList.map((item: any) => ({ name: item.name, fileUrl: item.url })),
...rest,
}).then(res => {
if (res.code === 1000) {
......
......@@ -81,17 +81,7 @@ const QuotaApplicationInfo: React.FC<QuotaApplicationInfo> = ({
applyQuota: +applyQuota,
billDay: +billDay,
repayPeriod: +repayPeriod,
fileList:
fileList
.filter(item => item.status === 'done')
.map(item => {
const { data, ...rest } = item;
return {
...rest,
url: data.url,
data: data,
}
}),
fileList: fileList.filter(item => item.status === 'done'),
...rest,
});
setModalVisible(false);
......
......@@ -315,7 +315,7 @@ class IntroduceRow extends React.Component<IntroduceRowProps, IntroduceRowState>
...repaymentValues,
payProveList: payProveList.map(item => item.status === 'done' && ({
name: item.name,
proveUrl: item.data.url,
proveUrl: item.url,
})).filter(Boolean),
}).then(res => {
if (res.code === 1000) {
......
......@@ -18,7 +18,9 @@ export const useBusinessEffects = (context, actions) => {
return `comments.${$1}.picture`
}),
state => {
state.props['x-component-props'].disabled = value.length >= 4;
// 禁用掉 或者 editable 设置成 false,删除按钮也会禁用掉的
// 所以目前先用过 rules 去限制最多可上传多少张
// state.props['x-component-props'].disabled = value.length >= 4;
}
);
});
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-21 13:47:51
* @LastEditTime: 2021-01-07 15:13:26
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -76,6 +76,12 @@ export const evaluateSchema: ISchema = {
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
},
'x-rules': [
{
len: 4,
message: '最多可上传4张图片',
},
],
'x-mega-props': {
addonAfter: '{{UploadTip}}',
},
......
......@@ -117,7 +117,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
id,
star,
comment,
pics: picture.map(item => item.status === 'done' && item.data.url).filter(Boolean),
pics: picture.map(item => item.status === 'done' && item.url).filter(Boolean),
};
});
......
......@@ -18,7 +18,9 @@ export const useBusinessEffects = (context, actions) => {
return `comments.${$1}.picture`
}),
state => {
state.props['x-component-props'].disabled = value.length >= 4;
// 禁用掉 或者 editable 设置成 false,删除按钮也会禁用掉的
// 所以目前先用过 rules 去限制最多可上传多少张
// state.props['x-component-props'].disabled = value.length >= 4;
}
);
});
......
......@@ -99,7 +99,7 @@ const EvaluateOrder: React.FC = () => {
unit: good.unit,
price: good.price,
totalPrice: good.totalPrice,
pics: picture.map(item => item.status === 'done' && item.data.url).filter(Boolean),
pics: picture.map(item => item.status === 'done' && item.url).filter(Boolean),
};
});
......
......@@ -77,6 +77,12 @@ export const evaluateSchema: ISchema = {
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
},
'x-rules': [
{
len: 4,
message: '最多可上传4张图片',
},
],
'x-mega-props': {
addonAfter: '{{UploadTip}}',
},
......
......@@ -18,7 +18,9 @@ export const useBusinessEffects = (context, actions) => {
return `comments.${$1}.picture`
}),
state => {
state.props['x-component-props'].disabled = value.length >= 4;
// 禁用掉 或者 editable 设置成 false,删除按钮也会禁用掉的
// 所以目前先用过 rules 去限制最多可上传多少张
// state.props['x-component-props'].disabled = value.length >= 4;
}
);
});
......
......@@ -76,6 +76,12 @@ export const evaluateSchema: ISchema = {
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
},
'x-rules': [
{
len: 4,
message: '最多可上传4张图片',
},
],
'x-mega-props': {
addonAfter: '{{UploadTip}}',
},
......
......@@ -116,7 +116,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
id,
star,
comment,
pics: picture.map(item => item.status === 'done' && item.data.url).filter(Boolean),
pics: picture.map(item => item.status === 'done' && item.url).filter(Boolean),
};
});
......
......@@ -18,7 +18,9 @@ export const useBusinessEffects = (context, actions) => {
return `comments.${$1}.picture`
}),
state => {
state.props['x-component-props'].disabled = value.length >= 4;
// 禁用掉 或者 editable 设置成 false,删除按钮也会禁用掉的
// 所以目前先用过 rules 去限制最多可上传多少张
// state.props['x-component-props'].disabled = value.length >= 4;
}
);
});
......
......@@ -99,7 +99,7 @@ const EvaluateOrder: React.FC = () => {
unit: good.unit,
price: good.price,
totalPrice: good.totalPrice,
pics: picture.map(item => item.status === 'done' && item.data.url).filter(Boolean),
pics: picture.map(item => item.status === 'done' && item.url).filter(Boolean),
};
});
......
......@@ -77,6 +77,12 @@ export const evaluateSchema: ISchema = {
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
},
'x-rules': [
{
len: 4,
message: '最多可上传4张图片',
},
],
'x-mega-props': {
addonAfter: '{{UploadTip}}',
},
......
......@@ -448,9 +448,6 @@ export function normalizeFiledata(url: any): any {
name: fileName,
status: 'done',
url,
data: {
url,
}, // formily Upload value 需要这个字段
};
};
......
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