|
|
|
@ -59,6 +59,7 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
|
|
|
|
|
const [info, setInfo] = useState<API.PbcBusiness>({});
|
|
|
|
|
const [form1] = Form.useForm();
|
|
|
|
|
const [form2] = Form.useForm();
|
|
|
|
|
|
|
|
|
|
const getInfo = () => {
|
|
|
|
|
if (params.id) {
|
|
|
|
@ -78,13 +79,17 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
activationConstraint: { distance: 10 },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const onDragEnd = ({ active, over }: DragEndEvent, fieldName: string) => {
|
|
|
|
|
const onDragEnd = ({ active, over }: DragEndEvent, fieldName: string, type: number) => {
|
|
|
|
|
if (active.id !== over?.id) {
|
|
|
|
|
const arr = form1.getFieldValue(fieldName) || []
|
|
|
|
|
const arr = type === 1 ? form1.getFieldValue(fieldName) || [] : form2.getFieldValue(fieldName)
|
|
|
|
|
const activeIndex = arr.findIndex((i: any) => i.uid === active.id);
|
|
|
|
|
const overIndex = arr.findIndex((i: any) => i.uid === over?.id);
|
|
|
|
|
const newArr = arrayMove(arr, activeIndex, overIndex)
|
|
|
|
|
form1.setFieldValue(fieldName, newArr)
|
|
|
|
|
if (type === 1) {
|
|
|
|
|
form1.setFieldValue(fieldName, newArr)
|
|
|
|
|
} else {
|
|
|
|
|
form2.setFieldValue(fieldName, newArr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -116,9 +121,8 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
renderFormItem: (text, props: any) => {
|
|
|
|
|
console.log(props.id)
|
|
|
|
|
return (
|
|
|
|
|
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, props.id)}>
|
|
|
|
|
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, props.id, 1)}>
|
|
|
|
|
<SortableContext items={form1.getFieldValue(props.id) ? form1.getFieldValue(props.id).map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
|
|
|
|
|
<ProFormUploadButton
|
|
|
|
|
{...props}
|
|
|
|
@ -142,16 +146,14 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
return isLt2M;
|
|
|
|
|
},
|
|
|
|
|
onPreview: async (file) => {
|
|
|
|
|
console.log(file);
|
|
|
|
|
if (file.uid === '-1') {
|
|
|
|
|
window.open(file.url);
|
|
|
|
|
}
|
|
|
|
|
if (file.response && file.response.retcode) {
|
|
|
|
|
window.open(file.response.data);
|
|
|
|
|
} else {
|
|
|
|
|
window.open(file.url);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
action={'/oss/imgUpload'}
|
|
|
|
|
action={process.env.BASE_URL + '/oss/imgUpload'}
|
|
|
|
|
onChange={(a: any) => {
|
|
|
|
|
props?.fieldProps.onChange(a.fileList);
|
|
|
|
|
}}
|
|
|
|
@ -200,11 +202,10 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
) {
|
|
|
|
|
for (let i = 0; i < record[key].length; i++) {
|
|
|
|
|
const element = record[key][i];
|
|
|
|
|
if (element.uid === '-1') {
|
|
|
|
|
pbcBusinessImage.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
if (element.response && element.response.retcode) {
|
|
|
|
|
pbcBusinessImage.push(element.response.data)
|
|
|
|
|
} else {
|
|
|
|
|
pbcBusinessImage.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -215,11 +216,10 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
) {
|
|
|
|
|
for (let i = 0; i < record[key].length; i++) {
|
|
|
|
|
const element = record[key][i];
|
|
|
|
|
if (element.uid === '-1') {
|
|
|
|
|
pbcBusinessPosterUrl.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
if (element.response && element.response.retcode) {
|
|
|
|
|
pbcBusinessPosterUrl.push(element.response.data)
|
|
|
|
|
} else {
|
|
|
|
|
pbcBusinessPosterUrl.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -411,43 +411,46 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
<span></span>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
renderFormItem: (text, props) => {
|
|
|
|
|
renderFormItem: (text, props: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<ProFormUploadButton
|
|
|
|
|
{...props}
|
|
|
|
|
{...props?.fieldProps}
|
|
|
|
|
icon={<PlusCircleOutlined style={{ fontSize: 30 }} />}
|
|
|
|
|
title={<div style={{ marginTop: 10, fontSize: 12 }}>点击上传图片</div>}
|
|
|
|
|
fieldProps={{
|
|
|
|
|
name: 'file',
|
|
|
|
|
accept: 'image/*',
|
|
|
|
|
multiple: true,
|
|
|
|
|
listType: 'picture-card',
|
|
|
|
|
headers: {
|
|
|
|
|
authorization: localStorage.getItem('token') ?? '',
|
|
|
|
|
},
|
|
|
|
|
beforeUpload(file: RcFile) {
|
|
|
|
|
const isLt2M = file.size / 1024 / 1024 < 10;
|
|
|
|
|
if (!isLt2M) {
|
|
|
|
|
message.error('图片大小不能超过10MB!');
|
|
|
|
|
}
|
|
|
|
|
return isLt2M;
|
|
|
|
|
},
|
|
|
|
|
onPreview: async (file) => {
|
|
|
|
|
console.log(file);
|
|
|
|
|
if (file.uid === '-1') {
|
|
|
|
|
window.open(file.url);
|
|
|
|
|
}
|
|
|
|
|
if (file.response && file.response.retcode) {
|
|
|
|
|
window.open(file.response.data);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
action={'/oss/imgUpload'}
|
|
|
|
|
onChange={(a: any) => {
|
|
|
|
|
props?.fieldProps.onChange(a.fileList);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, props.id, 2)}>
|
|
|
|
|
<SortableContext items={form2.getFieldValue(props.id) ? form2.getFieldValue(props.id).map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
|
|
|
|
|
<ProFormUploadButton
|
|
|
|
|
{...props}
|
|
|
|
|
{...props?.fieldProps}
|
|
|
|
|
icon={<PlusCircleOutlined style={{ fontSize: 30 }} />}
|
|
|
|
|
title={<div style={{ marginTop: 10, fontSize: 12 }}>点击上传图片</div>}
|
|
|
|
|
fieldProps={{
|
|
|
|
|
name: 'file',
|
|
|
|
|
accept: 'image/*',
|
|
|
|
|
multiple: true,
|
|
|
|
|
listType: 'picture-card',
|
|
|
|
|
headers: {
|
|
|
|
|
authorization: localStorage.getItem('token') ?? '',
|
|
|
|
|
},
|
|
|
|
|
itemRender: (originNode, file) => <DraggableUploadListItem originNode={originNode} file={file} />,
|
|
|
|
|
beforeUpload(file: RcFile) {
|
|
|
|
|
const isLt2M = file.size / 1024 / 1024 < 10;
|
|
|
|
|
if (!isLt2M) {
|
|
|
|
|
message.error('图片大小不能超过10MB!');
|
|
|
|
|
}
|
|
|
|
|
return isLt2M;
|
|
|
|
|
},
|
|
|
|
|
onPreview: async (file) => {
|
|
|
|
|
if (file.response && file.response.retcode) {
|
|
|
|
|
window.open(file.response.data);
|
|
|
|
|
} else {
|
|
|
|
|
window.open(file.url);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
action={process.env.BASE_URL + '/oss/imgUpload'}
|
|
|
|
|
onChange={(a: any) => {
|
|
|
|
|
props?.fieldProps.onChange(a.fileList);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SortableContext>
|
|
|
|
|
</DndContext>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -495,7 +498,7 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
editable={
|
|
|
|
|
access.businessSave && isEdit
|
|
|
|
|
? {
|
|
|
|
|
form: form1,
|
|
|
|
|
form: form2,
|
|
|
|
|
onSave: async (key, record: any, originRow) => {
|
|
|
|
|
let pbcBusinessHeadUserNoFrontUrl = "";
|
|
|
|
|
if (
|
|
|
|
@ -523,7 +526,7 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
pbcBusinessHeadUserNoBackUrl = record[key][0].response.data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const pbcBusinessLicenseUrl = [];
|
|
|
|
|
let pbcBusinessLicenseUrl = [];
|
|
|
|
|
if (
|
|
|
|
|
key === 'pbcBusinessLicenseUrl' &&
|
|
|
|
|
record[key] &&
|
|
|
|
@ -531,11 +534,10 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
) {
|
|
|
|
|
for (let i = 0; i < record[key].length; i++) {
|
|
|
|
|
const element = record[key][i];
|
|
|
|
|
if (element.uid === '-1') {
|
|
|
|
|
pbcBusinessLicenseUrl.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
if (element.response && element.response.retcode) {
|
|
|
|
|
pbcBusinessLicenseUrl.push(element.response.data)
|
|
|
|
|
} else {
|
|
|
|
|
pbcBusinessLicenseUrl.push(element.url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -547,8 +549,7 @@ const Detail: React.FC<any> = () => {
|
|
|
|
|
key === 'pbcBusinessHeadUserNoFrontUrl' ? pbcBusinessHeadUserNoFrontUrl : info.pbcBusinessHeadUserNoFrontUrl,
|
|
|
|
|
pbcBusinessHeadUserNoBackUrl:
|
|
|
|
|
key === 'pbcBusinessHeadUserNoBackUrl' ? pbcBusinessHeadUserNoBackUrl : info.pbcBusinessHeadUserNoBackUrl,
|
|
|
|
|
pbcBusinessLicenseUrl:
|
|
|
|
|
key === 'pbcBusinessLicenseUrl' ? pbcBusinessLicenseUrl.join(',') : info.pbcBusinessLicenseUrl,
|
|
|
|
|
pbcBusinessLicenseUrl: key === 'pbcBusinessLicenseUrl' ? pbcBusinessLicenseUrl.join(',') : info.pbcBusinessLicenseUrl
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.retcode) {
|
|
|
|
|