|
|
|
@ -4,7 +4,7 @@ import { Button, message, Modal, Col, Row, Space, Upload, Popconfirm } from 'ant
|
|
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
|
|
|
import type { ProColumns, ActionType } from '@ant-design/pro-table';
|
|
|
|
|
import ProTable from '@ant-design/pro-table';
|
|
|
|
|
import { BetaSchemaForm, ModalForm } from '@ant-design/pro-form';
|
|
|
|
|
import { BetaSchemaForm, ModalForm, ProFormInstance } from '@ant-design/pro-form';
|
|
|
|
|
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
|
import type { FormValueType } from './components/UpdateForm';
|
|
|
|
@ -105,6 +105,16 @@ const CourseList: React.FC = () => {
|
|
|
|
|
const [uploadFileName, SetUploadFileName] = useState<string>();
|
|
|
|
|
const [uploadFileExt, SetUploadFileExt] = useState<string>();
|
|
|
|
|
|
|
|
|
|
const createFormRef = useRef<
|
|
|
|
|
ProFormInstance<{
|
|
|
|
|
date: string;
|
|
|
|
|
}>
|
|
|
|
|
>();
|
|
|
|
|
const updateFormRef = useRef<
|
|
|
|
|
ProFormInstance<{
|
|
|
|
|
date: string;
|
|
|
|
|
}>
|
|
|
|
|
>();
|
|
|
|
|
|
|
|
|
|
/** 列表项定义 */
|
|
|
|
|
const columns: ProColumns<TableListItem>[] = [
|
|
|
|
@ -273,6 +283,9 @@ const CourseList: React.FC = () => {
|
|
|
|
|
// 获取后缀
|
|
|
|
|
SetUploadFileExt(file?.name.substr(index + 1));
|
|
|
|
|
}}
|
|
|
|
|
onRemove={()=>{
|
|
|
|
|
//createFormRef?.current?.setFieldsValue({attachment_json: ""})
|
|
|
|
|
}}
|
|
|
|
|
data={{
|
|
|
|
|
name: uploadFileName,
|
|
|
|
|
chunk: 0,
|
|
|
|
@ -290,6 +303,13 @@ const CourseList: React.FC = () => {
|
|
|
|
|
),
|
|
|
|
|
formItemProps: {
|
|
|
|
|
// 参照 https://ant.design/components/form-cn/#Rule
|
|
|
|
|
getValueFromEvent:(e: any)=>{
|
|
|
|
|
console.log('Upload event:', e);
|
|
|
|
|
if (Array.isArray(e)) {
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
return e && e.fileList;
|
|
|
|
|
},
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
@ -577,6 +597,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
footer={null}
|
|
|
|
|
>
|
|
|
|
|
<BetaSchemaForm<DataItem>
|
|
|
|
|
formRef={createFormRef}
|
|
|
|
|
layout="horizontal"
|
|
|
|
|
layoutType="Form"
|
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
@ -587,7 +608,9 @@ const CourseList: React.FC = () => {
|
|
|
|
|
//return false;
|
|
|
|
|
// values.attachment_json.response.file.response.url
|
|
|
|
|
//console.log('currentRow', currentRow)
|
|
|
|
|
console.log('values00000000000ss',values)
|
|
|
|
|
console.log('values00000000000ss',values)
|
|
|
|
|
console.log('att',createFormRef?.current?.getFieldValue('attachment_json'))
|
|
|
|
|
//return false;
|
|
|
|
|
await handleAdd({
|
|
|
|
|
...values,
|
|
|
|
|
//course_id: currentRow?.course_id,
|
|
|
|
@ -596,6 +619,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
});
|
|
|
|
|
handleCreateModalVisible(false); // 隐藏创建窗口
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
submitter={{
|
|
|
|
|
render: (props, doms) => (
|
|
|
|
@ -624,6 +648,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
>
|
|
|
|
|
{currentRow?.course_id && (
|
|
|
|
|
<BetaSchemaForm<DataItem>
|
|
|
|
|
formRef={updateFormRef}
|
|
|
|
|
layout="horizontal"
|
|
|
|
|
layoutType="Form"
|
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
|