|
|
@ -29,6 +29,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import {DataItem} from "@antv/data-set/lib/transform/tag-cloud";
|
|
|
|
import {DataItem} from "@antv/data-set/lib/transform/tag-cloud";
|
|
|
|
import {removeTrain} from "@/pages/training/option/service";
|
|
|
|
import {removeTrain} from "@/pages/training/option/service";
|
|
|
|
import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service";
|
|
|
|
import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service";
|
|
|
|
|
|
|
|
import course from "../../../../../../web/mock/course";
|
|
|
|
|
|
|
|
|
|
|
|
const { confirm } = Modal;
|
|
|
|
const { confirm } = Modal;
|
|
|
|
|
|
|
|
|
|
|
@ -42,8 +43,9 @@ const { confirm } = Modal;
|
|
|
|
const handleAddChapter = async (fields: TableListItem) => {
|
|
|
|
const handleAddChapter = async (fields: TableListItem) => {
|
|
|
|
const hide = message.loading('正在添加');
|
|
|
|
const hide = message.loading('正在添加');
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const {course_ids} = fields
|
|
|
|
const {course_ids} = fields;
|
|
|
|
const {code, msg} = await saveChapter({ ...fields, course_ids: course_ids.toString()});
|
|
|
|
const {tag_ids} = fields;
|
|
|
|
|
|
|
|
const {code, msg} = await saveChapter({ ...fields, course_ids: course_ids.toString(),tag_ids: tag_ids.toString()});
|
|
|
|
if(code === 2000){
|
|
|
|
if(code === 2000){
|
|
|
|
hide();
|
|
|
|
hide();
|
|
|
|
message.success('添加成功');
|
|
|
|
message.success('添加成功');
|
|
|
@ -140,7 +142,7 @@ export default () => {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '标签',
|
|
|
|
title: '标签',
|
|
|
|
valueType: 'select',
|
|
|
|
valueType: 'select',
|
|
|
|
dataIndex: 'tags',
|
|
|
|
dataIndex: 'tag_ids',
|
|
|
|
sorter: false,
|
|
|
|
sorter: false,
|
|
|
|
hideInTable: true,
|
|
|
|
hideInTable: true,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInForm: false,
|
|
|
@ -148,10 +150,18 @@ export default () => {
|
|
|
|
fieldProps: {
|
|
|
|
fieldProps: {
|
|
|
|
mode: "multiple"
|
|
|
|
mode: "multiple"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
formItemProps: {
|
|
|
|
|
|
|
|
rules: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
|
|
message: '请填选择标签',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
request: async () => {
|
|
|
|
request: async () => {
|
|
|
|
const { data: Items } = await queryTagList({});
|
|
|
|
const { data: Items } = await queryTagList({});
|
|
|
|
console.log('queryTagList...')
|
|
|
|
console.log('queryTagList..Items标签.',Items)
|
|
|
|
const tags = []
|
|
|
|
const tags = []
|
|
|
|
for (let i = 0; i < Items.length; i++) {
|
|
|
|
for (let i = 0; i < Items.length; i++) {
|
|
|
|
tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
|
|
|
|
tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
|
|
|
@ -180,12 +190,29 @@ export default () => {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => [
|
|
|
|
dependencies: ['tags'],
|
|
|
|
<div>
|
|
|
|
request: async (params) => {
|
|
|
|
{console.log('record.course_names',record.course_names)}
|
|
|
|
const {tags} = params;
|
|
|
|
{
|
|
|
|
const { data: Items } = await queryCourseListByTag({tag_ids: tags?.toString()});
|
|
|
|
record.course_names.length!==0?record.course_names.map((i,index)=>{
|
|
|
|
console.log('queryCourseListByTag...')
|
|
|
|
if(index+1===record.course_names.length){
|
|
|
|
|
|
|
|
return i
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
return i+','
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}):'--'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// renderText: (val: string) => `${val}`,
|
|
|
|
|
|
|
|
dependencies: ['tag_ids'],
|
|
|
|
|
|
|
|
request: async (arr) => {
|
|
|
|
|
|
|
|
console.log('arr',arr)
|
|
|
|
|
|
|
|
const {tags} = arr;
|
|
|
|
|
|
|
|
const { data: Items } = await queryCourseListByTag({tag_ids:arr?.tag_ids?.toString()});
|
|
|
|
|
|
|
|
console.log('queryCourseListByTag...Items课程列表',Items)
|
|
|
|
const courses = []
|
|
|
|
const courses = []
|
|
|
|
for (let i = 0; i < Items?.length; i++) {
|
|
|
|
for (let i = 0; i < Items?.length; i++) {
|
|
|
|
courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id })
|
|
|
|
courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id })
|
|
|
@ -236,7 +263,6 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const params = useParams();
|
|
|
|
const params = useParams();
|
|
|
|
console.log('params', params);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {data:subjectInfo} = useRequest(() => {
|
|
|
|
const {data:subjectInfo} = useRequest(() => {
|
|
|
|
return getSubjectInfo({subject_id: params?.id});
|
|
|
|
return getSubjectInfo({subject_id: params?.id});
|
|
|
@ -272,7 +298,6 @@ export default () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
// console.log('error', error)
|
|
|
|
|
|
|
|
hide();
|
|
|
|
hide();
|
|
|
|
message.error('删除失败,请重试');
|
|
|
|
message.error('删除失败,请重试');
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -280,8 +305,6 @@ export default () => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
console.log('getSubjectInfo', subjectInfo);
|
|
|
|
|
|
|
|
console.log('url', subjectInfo?.attachment_json?.url);
|
|
|
|
|
|
|
|
// 编辑场景下需要使用formMapRef循环设置formData
|
|
|
|
// 编辑场景下需要使用formMapRef循环设置formData
|
|
|
|
formMapRef.current.forEach((formInstanceRef) => {
|
|
|
|
formMapRef.current.forEach((formInstanceRef) => {
|
|
|
|
let fieldsValue;
|
|
|
|
let fieldsValue;
|
|
|
@ -311,14 +334,11 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取列数据初始值 */
|
|
|
|
/** 获取列数据初始值 */
|
|
|
|
const getInitialValues = (cols: any[], vals: any) => {
|
|
|
|
const getInitialValues = (cols: any[], vals: any) => {
|
|
|
|
console.log('getInitialValues-columns', columns);
|
|
|
|
|
|
|
|
console.log('getInitialValues-values', vals);
|
|
|
|
|
|
|
|
const initialValues: any[] = [];
|
|
|
|
const initialValues: any[] = [];
|
|
|
|
cols.forEach((column: { dataIndex: string }) => {
|
|
|
|
cols.forEach((column: { dataIndex: string }) => {
|
|
|
|
const key: any = column?.dataIndex || '';
|
|
|
|
const key: any = column?.dataIndex || '';
|
|
|
|
initialValues.push({ ...column, initialValue: key ? vals[key] : '' });
|
|
|
|
initialValues.push({ ...column, initialValue: key ? vals[key] : '' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log('initialValues::', initialValues);
|
|
|
|
|
|
|
|
return initialValues || [];
|
|
|
|
return initialValues || [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -331,7 +351,6 @@ export default () => {
|
|
|
|
formMapRef={formMapRef}
|
|
|
|
formMapRef={formMapRef}
|
|
|
|
formRef={formRef}
|
|
|
|
formRef={formRef}
|
|
|
|
onFinish={async (values) => {
|
|
|
|
onFinish={async (values) => {
|
|
|
|
console.log('values::', values)
|
|
|
|
|
|
|
|
message.success('提交成功');
|
|
|
|
message.success('提交成功');
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
formProps={{
|
|
|
|
formProps={{
|
|
|
@ -361,7 +380,6 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
|
|
}}*/
|
|
|
|
}}*/
|
|
|
|
onFinish={async (value: any) => {
|
|
|
|
onFinish={async (value: any) => {
|
|
|
|
console.log(value, "vvvvv");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const url = value?.upload[0]?.url?.replace('/dsideal_yy/html/','') || value?.upload[0]?.response?.url;
|
|
|
|
const url = value?.upload[0]?.url?.replace('/dsideal_yy/html/','') || value?.upload[0]?.response?.url;
|
|
|
|
const { data } = await saveSubject({
|
|
|
|
const { data } = await saveSubject({
|
|
|
@ -406,7 +424,6 @@ export default () => {
|
|
|
|
listType: 'picture-card',
|
|
|
|
listType: 'picture-card',
|
|
|
|
maxCount: 1,
|
|
|
|
maxCount: 1,
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
console.log('file', file)
|
|
|
|
|
|
|
|
// 获取文件名
|
|
|
|
// 获取文件名
|
|
|
|
SetUploadFileName(file?.name);
|
|
|
|
SetUploadFileName(file?.name);
|
|
|
|
// 获取最后一个.的位置
|
|
|
|
// 获取最后一个.的位置
|
|
|
@ -505,6 +522,15 @@ export default () => {
|
|
|
|
page_number: value?.current || 1,
|
|
|
|
page_number: value?.current || 1,
|
|
|
|
page_size: value?.pageSize,
|
|
|
|
page_size: value?.pageSize,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if(data.list.length!==0){
|
|
|
|
|
|
|
|
data.list.forEach((i)=>{
|
|
|
|
|
|
|
|
i.course_ids=parseInt(i.course_ids.split(','))
|
|
|
|
|
|
|
|
i.course_names=i.course_names.split(',')
|
|
|
|
|
|
|
|
i.tag_ids=parseInt(i.tag_ids.split(','))
|
|
|
|
|
|
|
|
i.tag_names=i.tag_names.split(',')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log('data.list.',data.list)
|
|
|
|
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
current: data?.page_number,
|
|
|
|
current: data?.page_number,
|
|
|
|
data: data?.list,
|
|
|
|
data: data?.list,
|
|
|
@ -536,7 +562,12 @@ export default () => {
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
// 表单处理
|
|
|
|
// 表单处理
|
|
|
|
console.log('columns:', columns);
|
|
|
|
console.log('columns:', columns);
|
|
|
|
console.log('values:', values);
|
|
|
|
console.log('values:新建', values);
|
|
|
|
|
|
|
|
// values['tag_ids']=values.tags;
|
|
|
|
|
|
|
|
values.tag_ids=values.tag_names.toString();
|
|
|
|
|
|
|
|
values.course_ids=values.course_names.toString();
|
|
|
|
|
|
|
|
delete values.course_names;
|
|
|
|
|
|
|
|
delete values.tag_names;
|
|
|
|
const success = await handleAddChapter({
|
|
|
|
const success = await handleAddChapter({
|
|
|
|
...values,
|
|
|
|
...values,
|
|
|
|
subject_id: params?.id || 0,
|
|
|
|
subject_id: params?.id || 0,
|
|
|
@ -571,7 +602,7 @@ export default () => {
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
footer={null}
|
|
|
|
footer={null}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{console.log('currentRow',currentRow)}
|
|
|
|
{/*{console.log('currentRow',currentRow)}*/}
|
|
|
|
{currentRow?.chapter_id && (
|
|
|
|
{currentRow?.chapter_id && (
|
|
|
|
<BetaSchemaForm<DataItem>
|
|
|
|
<BetaSchemaForm<DataItem>
|
|
|
|
layout="horizontal"
|
|
|
|
layout="horizontal"
|
|
|
@ -579,7 +610,7 @@ export default () => {
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
onFinish={async (values) => {
|
|
|
|
onFinish={async (values) => {
|
|
|
|
console.log('values', values)
|
|
|
|
console.log('values编辑', values)
|
|
|
|
console.log('currentRow', currentRow)
|
|
|
|
console.log('currentRow', currentRow)
|
|
|
|
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
|
|
|
|
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
|
|
|
|
//console.log('url', url)
|
|
|
|
//console.log('url', url)
|
|
|
@ -589,7 +620,7 @@ export default () => {
|
|
|
|
// course_id: currentRow?.course_id,
|
|
|
|
// course_id: currentRow?.course_id,
|
|
|
|
// attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
|
|
|
|
// attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
handleUpdateModalVisible(false); // 隐藏编辑窗口
|
|
|
|
// handleUpdateModalVisible(false); // 隐藏编辑窗口
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
console.log(values);
|
|
|
|
console.log(values);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|