master
xialiang 3 years ago
parent 7fe3c44792
commit ac947135e6

@ -6,7 +6,7 @@ import { Column, TinyColumn } from '@ant-design/charts';
import numeral from 'numeral';
import type { DataItem } from '../data';
import styles from '../style.less';
import { InfoCircleOutlined } from '@ant-design/icons';
import { InfoCircleOutlined, AlignLeftOutlined } from '@ant-design/icons';
import { ChartCard } from './Charts';
import { courseBrowseTimesStatistics } from '../service';
import { useRequest } from 'umi';
@ -27,10 +27,11 @@ const TrainingRow = () => {
<Col {...topColResponsiveProps}>
<div className={styles.salesBar}>
<ChartCard loading={courseBrowseTimesLoading} bordered={false} bodyStyle={{ padding: '20px 24px 8px', marginBottom: '24px' }} title="课程浏览量">
<div className={styles.salesBar}>
<div className={styles.salesBar}>111
<Column
height={300}
forceFit
padding={[10, 10, 120, 20]}
data={courseBrowseTimesData as any}
xField="course_name"
yField="browse_times"
@ -47,9 +48,18 @@ const TrainingRow = () => {
text: '课程名称',
visible: false,
},
label: {
interval: 0,//横轴信息全部显示
rotate: 0.3,
autoEllipsis: true,
style: {
textAlign: 'left'
}
}
}}
yAxis={{
visible: true,
title: {
text: '课程浏览量',
visible: false,

@ -55,6 +55,7 @@ const IntroduceRow = () => {
data={trainNumberBySubjectData?.subject_train_list || [] as any}
xField="subject_name"
yField="train_number"
tooltip={{
formatter: (name, value: number) => {
// const {name, value} = args;
@ -68,6 +69,14 @@ const IntroduceRow = () => {
text: '主题名称',
visible: false,
},
label: {
interval: 0,//横轴信息全部显示
rotate: 0.3,//-30度角倾斜显示 \
autoEllipsis: true,
style: {
textAlign: 'left'
}
}
}}
yAxis={{
visible: true,

@ -1,338 +1,338 @@
import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm, Menu, Radio } from 'antd';
import { Fragment, useEffect, useRef, useState } from 'react';
import { GridContent } from '@ant-design/pro-layout';
import { getInfo } from 'react-mediainfo';
import { Line } from '@ant-design/charts';
import { DualAxes } from "@ant-design/charts";
import styles from './index.less';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css'
import ProDescriptions, { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import { TableListItem } from '../ListTableList2';
import { v4 as uuidv4 } from 'uuid';
import { queryCourseList } from '../course/option/service';
import { useRequest } from 'umi';
// import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
// import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm, Menu, Radio } from 'antd';
// import { Fragment, useEffect, useRef, useState } from 'react';
// import { GridContent } from '@ant-design/pro-layout';
// import { getInfo } from 'react-mediainfo';
// import { Line } from '@ant-design/charts';
// import { DualAxes } from "@ant-design/charts";
// import styles from './index.less';
// import ReactQuill from 'react-quill';
// import 'react-quill/dist/quill.snow.css'
// import ProDescriptions, { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
// import { TableListItem } from '../ListTableList2';
// import { v4 as uuidv4 } from 'uuid';
// import { queryCourseList } from '../course/option/service';
// import { useRequest } from 'umi';
const { Step } = Steps;
// const { Step } = Steps;
// 秒数转化为时分秒
const formatSeconds= (value)=>{
// 秒
let second = parseInt(value)
// 分
let minute = 0
// 小时
let hour = 0
// 天
// let day = 0
// 如果秒数大于60将秒数转换成整数
if (second > 60) {
// 获取分钟除以60取整数得到整数分钟
minute = parseInt(second / 60)
// 获取秒数,秒数取佘,得到整数秒数
second = parseInt(second % 60)
// 如果分钟大于60将分钟转换成小时
if (minute > 60) {
// 获取小时获取分钟除以60得到整数小时
hour = parseInt(minute / 60)
// 获取小时后取佘的分获取分钟除以60取佘的分
minute = parseInt(minute % 60)
// 如果小时大于24将小时转换成天
// if (hour > 23) {
// // 获取天数获取小时除以24得到整天数
// day = parseInt(hour / 24)
// // 获取天数后取余的小时获取小时除以24取余的小时
// hour = parseInt(hour % 24)
// }
}
}
// // 秒数转化为时分秒
// const formatSeconds= (value)=>{
// // 秒
// let second = parseInt(value)
// // 分
// let minute = 0
// // 小时
// let hour = 0
// // 天
// // let day = 0
// // 如果秒数大于60将秒数转换成整数
// if (second > 60) {
// // 获取分钟除以60取整数得到整数分钟
// minute = parseInt(second / 60)
// // 获取秒数,秒数取佘,得到整数秒数
// second = parseInt(second % 60)
// // 如果分钟大于60将分钟转换成小时
// if (minute > 60) {
// // 获取小时获取分钟除以60得到整数小时
// hour = parseInt(minute / 60)
// // 获取小时后取佘的分获取分钟除以60取佘的分
// minute = parseInt(minute % 60)
// // 如果小时大于24将小时转换成天
// // if (hour > 23) {
// // // 获取天数获取小时除以24得到整天数
// // day = parseInt(hour / 24)
// // // 获取天数后取余的小时获取小时除以24取余的小时
// // hour = parseInt(hour % 24)
// // }
// }
// }
let result = '' + parseInt(second) + ' 秒 '
if (minute > 0) {
result = '' + parseInt(minute) + ' 分 ' + result
}
if (hour > 0) {
result = '' + parseInt(hour) + ' 小时 ' + result
}
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
//console.log('result', result)
return result
}
export default () => {
const uuid = uuidv4()
//console.log('uuid', uuidv4());
const data = [
{
year: "1991",
value: 3,
count: 10
},
{
year: "1992",
value: 4,
count: 4
},
{
year: "1993",
value: 3.5,
count: 5
},
{
year: "1994",
value: 5,
count: 5
},
{
year: "1995",
value: 4.9,
count: 4.9
},
{
year: "1996",
value: 6,
count: 35
},
{
year: "1997",
value: 7,
count: 7
},
{
year: "1998",
value: 9,
count: 1
},
{
year: "1999",
value: 13,
count: 20
}
];
const data2 = [
{
year: "1991",
value: 30,
count: 100
},
{
year: "1992",
value: 40,
count: 40
},
{
year: "1993",
value: 3.5,
count: 50
},
{
year: "1994",
value: 5,
count: 50
},
{
year: "1995",
value: 40.9,
count: 24.9
},
{
year: "1996",
value: 6,
count: 395
},
{
year: "1997",
value: 7,
count: 79
},
{
year: "1998",
value: 99,
count: 1
},
{
year: "1999",
value: 193,
count: 20
}
];
// let result = '' + parseInt(second) + ' 秒 '
// if (minute > 0) {
// result = '' + parseInt(minute) + ' 分 ' + result
// }
// if (hour > 0) {
// result = '' + parseInt(hour) + ' 小时 ' + result
// }
// // if (day > 0) {
// // result = '' + parseInt(day) + '天' + result
// // }
// //console.log('result', result)
// return result
// }
// export default () => {
// const uuid = uuidv4()
// //console.log('uuid', uuidv4());
// const data = [
// {
// year: "1991",
// value: 3,
// count: 10
// },
// {
// year: "1992",
// value: 4,
// count: 4
// },
// {
// year: "1993",
// value: 3.5,
// count: 5
// },
// {
// year: "1994",
// value: 5,
// count: 5
// },
// {
// year: "1995",
// value: 4.9,
// count: 4.9
// },
// {
// year: "1996",
// value: 6,
// count: 35
// },
// {
// year: "1997",
// value: 7,
// count: 7
// },
// {
// year: "1998",
// value: 9,
// count: 1
// },
// {
// year: "1999",
// value: 13,
// count: 20
// }
// ];
// const data2 = [
// {
// year: "1991",
// value: 30,
// count: 100
// },
// {
// year: "1992",
// value: 40,
// count: 40
// },
// {
// year: "1993",
// value: 3.5,
// count: 50
// },
// {
// year: "1994",
// value: 5,
// count: 50
// },
// {
// year: "1995",
// value: 40.9,
// count: 24.9
// },
// {
// year: "1996",
// value: 6,
// count: 395
// },
// {
// year: "1997",
// value: 7,
// count: 79
// },
// {
// year: "1998",
// value: 99,
// count: 1
// },
// {
// year: "1999",
// value: 193,
// count: 20
// }
// ];
const [modalVisible, handleModalVisible] = useState<boolean>(false);
const saveInputRef = useRef();
const radioRef = useRef();
// const [modalVisible, handleModalVisible] = useState<boolean>(false);
// const saveInputRef = useRef();
// const radioRef = useRef();
//const currentRow = {course_name:'课程0001'};
const currentRow = {course_name1:'课程0001'};
const columns = [
{title: "序号", key: "index", valueType: "indexBorder", width: 48},
//{title: "课程名称", dataIndex: "course_name", valueType: "text", hideInTable: false, hideInDescriptions: false},
{dataIndex: "course_name", hideInDescriptions: false, hideInForm: false,hideInSearch: true,hideInTable: false, title: "课程名称1", valueType: "text"},
{}
];
const [chartData, setChartData] = useState([data, data]);
// //const currentRow = {course_name:'课程0001'};
// const currentRow = {course_name1:'课程0001'};
// const columns = [
// {title: "序号", key: "index", valueType: "indexBorder", width: 48},
// //{title: "课程名称", dataIndex: "course_name", valueType: "text", hideInTable: false, hideInDescriptions: false},
// {dataIndex: "course_name", hideInDescriptions: false, hideInForm: false,hideInSearch: true,hideInTable: false, title: "课程名称1", valueType: "text"},
// {}
// ];
// const [chartData, setChartData] = useState([data, data]);
const [selectedCourse, setSelectedCourse] = useState(0);
const [menu, setMenu] = useState();
// const [selectedCourse, setSelectedCourse] = useState(0);
// const [menu, setMenu] = useState();
const [timeData, setTimeData] = useState(0);
// const [timeData, setTimeData] = useState(0);
useEffect(() => {
let secondValue = 3000; // 秒 截至时间 - 服务器当前时间
setTimeData(secondValue)
const timer = setInterval(() => { //
setTimeData((secondValue > 1) ? secondValue-- : 0);
}, 1000);
return ()=>{
clearInterval(timer) // 清理计算器
}
},[])
// useEffect(() => {
// let secondValue = 3000; // 秒 截至时间 - 服务器当前时间
// setTimeData(secondValue)
// const timer = setInterval(() => { //
// setTimeData((secondValue > 1) ? secondValue-- : 0);
// }, 1000);
// return ()=>{
// clearInterval(timer) // 清理计算器
// }
// },[])
/** 获取课程数据 */
const { data: listData } = useRequest(() => {
return queryCourseList();
});
useEffect(() => {
//console.log('listData', listData)
/*
setInterval(() => {
setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
}, 1000);*/
// /** 获取课程数据 */
// const { data: listData } = useRequest(() => {
// return queryCourseList();
// });
// useEffect(() => {
// //console.log('listData', listData)
// /*
// setInterval(() => {
// setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
// }, 1000);*/
/** 生成菜单 */
const menuItems = [];
// /** 生成菜单 */
// const menuItems = [];
if(listData?.length > 0){
//console.log('push');
listData.list.forEach((item: {code: number, name: string})=>{
menuItems.push(<Menu.Item key={item?.course_id}>{item?.course_name}</Menu.Item>)
})
}
setMenu(
<Menu onClick={(value)=>{
console.log('menu11', value);
console.log('menu11', value.key);
//setMenu({ name: listData[Number(value?.key)]?.name, value: Number(value?.key)});
}}
>
{menuItems}
</Menu>
);
}, [listData, selectedCourse]);
// if(listData?.length > 0){
// //console.log('push');
// listData.list.forEach((item: {code: number, name: string})=>{
// menuItems.push(<Menu.Item key={item?.course_id}>{item?.course_name}</Menu.Item>)
// })
// }
// setMenu(
// <Menu onClick={(value)=>{
// console.log('menu11', value);
// console.log('menu11', value.key);
// //setMenu({ name: listData[Number(value?.key)]?.name, value: Number(value?.key)});
// }}
// >
// {menuItems}
// </Menu>
// );
// }, [listData, selectedCourse]);
const config = {
data: chartData,
xField: "year",
yField: ["value", "count"]
};
// const config = {
// data: chartData,
// xField: "year",
// yField: ["value", "count"]
// };
return(
<>
{menu}
<Input value={123} ref={saveInputRef} />
<a onClick={()=>{
saveInputRef.current.focus({})
//console.log('ref', saveInputRef.current)
}}></a>
<a onClick={()=>{handleModalVisible(true)}}></a>
<p>uuid: {uuidv4()}</p>
<ReactQuill
theme="snow"
value=''
onChange={(val)=>{
// val === 转化出来的html
}}
/>
<p>
<div dangerouslySetInnerHTML={{__html: '<h3>hello</h3>'}} />
</p>
<p>
/dsideal_yy/html/down/Syzx/{uuid?.substr(0,2)}/{uuid}.jpg
/dsideal_yy/html/down/Material/BC/BCFFEA09-9660-9D40-8D11-EF7D7110F7A2.jpg
urlurl /dsideal_yy/wkds/getwkdsInfo
</p>
<Upload
showUploadList={false}
action="/dsideal_yy/res/plupload/"
beforeUpload={async (file)=>{
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
console.log('General:', General)
console.log('Video:', Video)
console.log('Video:', Video.format) // AVC
console.log('Audio:', Audio.format) // AAC
/*
console.log('info:', media)
console.log('track[0]:', media.track[0])
console.log('track[1]:', media.track[1])
console.log('track[2]:', media.track[2])*/
}}
data={
{
name: '4.jpg',
chunk: 0,
chunks: 1,
key: 'down/Material/BC/BCFFEA09-9660-9D40-8D11-EF7D7110F7A2.jpg'
}
}
>
<div className={styles.button_view}>
<Button>
<UploadOutlined />
</Button>
</div>
</Upload>
// return(
// <>
// {menu}
// <Input value={123} ref={saveInputRef} />
// <a onClick={()=>{
// saveInputRef.current.focus({})
// //console.log('ref', saveInputRef.current)
// }}>焦点</a>
// <a onClick={()=>{handleModalVisible(true)}}>课程</a>
// <p>uuid: {uuidv4()}</p>
// <ReactQuill
// theme="snow"
// value=''
// onChange={(val)=>{
// // val === 转化出来的html
// }}
// />
// <p>
// <div dangerouslySetInnerHTML={{__html: '<h3>hello</h3>'}} />
// </p>
// <p>
// /dsideal_yy/html/down/Syzx/{uuid?.substr(0,2)}/{uuid}.jpg
// /dsideal_yy/html/down/Material/BC/BCFFEA09-9660-9D40-8D11-EF7D7110F7A2.jpg
// 获取文件详情下载url播放url /dsideal_yy/wkds/getwkdsInfo
// </p>
// <Upload
// showUploadList={false}
// action="/dsideal_yy/res/plupload/"
// beforeUpload={async (file)=>{
// const {media: {track:[General, Video, Audio]}} = await getInfo(file)
// console.log('General:', General)
// console.log('Video:', Video)
// console.log('Video:', Video.format) // AVC
// console.log('Audio:', Audio.format) // AAC
// /*
// console.log('info:', media)
// console.log('track[0]:', media.track[0])
// console.log('track[1]:', media.track[1])
// console.log('track[2]:', media.track[2])*/
// }}
// data={
// {
// name: '4.jpg',
// chunk: 0,
// chunks: 1,
// key: 'down/Material/BC/BCFFEA09-9660-9D40-8D11-EF7D7110F7A2.jpg'
// }
// }
// >
// <div className={styles.button_view}>
// <Button>
// <UploadOutlined />
// 更换头像
// </Button>
// </div>
// </Upload>
<Modal
title={currentRow?.course_name || '课程详细'}
width="60%"
visible={modalVisible}
onCancel={() => {
// setCurrentRow(undefined); // 设置当前行
handleModalVisible(false);
}}
footer={null}
centered
>
// <Modal
// title={currentRow?.course_name || '课程详细'}
// width="60%"
// visible={modalVisible}
// onCancel={() => {
// // setCurrentRow(undefined); // 设置当前行
// handleModalVisible(false);
// }}
// footer={null}
// centered
// >
<ProDescriptions<TableListItem>
column={2}
/* title={currentRow?.name} */
dataSource={currentRow}
/*
request={async () => ({
data: currentRow || {},
})}*/
params={{
id: currentRow?.id,
}}
columns={
columns.slice(0, columns.length - 1) as ProDescriptionsItemProps<TableListItem>[]
}
/>
// <ProDescriptions<TableListItem>
// column={2}
// /* title={currentRow?.name} */
// dataSource={currentRow}
// /*
// request={async () => ({
// data: currentRow || {},
// })}*/
// params={{
// id: currentRow?.id,
// }}
// columns={
// columns.slice(0, columns.length - 1) as ProDescriptionsItemProps<TableListItem>[]
// }
// />
</Modal>
<Popconfirm title="Are you sure" okText="Yes" cancelText="No">
<a href="#">Delete</a>
</Popconfirm>
{/*
<DualAxes {...config} />
*/}
<Radio.Group onChange={()=>{
}}>
<Radio value={1}>A</Radio>
<Radio value={2}>B</Radio>
<Radio value={3}>C</Radio>
<Radio value={4} defaultChecked>D</Radio>
</Radio.Group>
<a onClick={()=>{}}>rrrrr</a>
// </Modal>
// <Popconfirm title="Are you sure" okText="Yes" cancelText="No">
// <a href="#">Delete</a>
// </Popconfirm>
// {/*
// <DualAxes {...config} />
// */}
// <Radio.Group onChange={()=>{
// }}>
// <Radio value={1}>A</Radio>
// <Radio value={2}>B</Radio>
// <Radio value={3}>C</Radio>
// <Radio value={4} defaultChecked>D</Radio>
// </Radio.Group>
// <a onClick={()=>{}}>rrrrr</a>
<div style={{padding:24,fontSize:30}}>{formatSeconds(timeData)}</div>
</>
)
};
// <div style={{padding:24,fontSize:30}}>{formatSeconds(timeData)}</div>
// </>
// )
// };

@ -119,14 +119,16 @@ const CourseList: React.FC = () => {
renderText: (val: string) => `${val}`,
},
{
title: '报名开始日期',
title: '报名日期',
dataIndex: 'apply_start_time',
valueType: 'text',
sorter: false,
hideInTable: false,
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
render: (dom, entity) => {
return entity.apply_start_time + " - " + entity.apply_end_time
},
},
{
title: '考试时间',
@ -136,6 +138,7 @@ const CourseList: React.FC = () => {
hideInTable: false,
hideInForm: false,
hideInSearch: false,
colSize: 2,
render: (dom, entity) => {
return entity.examination_start_time + " - " + entity.examination_end_time
},
@ -176,6 +179,9 @@ const CourseList: React.FC = () => {
valueType: 'text',
hideInForm: false,
hideInSearch: false,
fieldProps: {
allowClear: false
},
renderFormItem: (_, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
if (type === 'form') {
return null;
@ -185,6 +191,7 @@ const CourseList: React.FC = () => {
return (
// value 和 onchange 会通过 form 自动注入。
<Select defaultValue="" allowClear={true} >
<Option value=""></Option>
<Option value="0"></Option>
<Option value="1"></Option>
</Select>
@ -205,18 +212,36 @@ const CourseList: React.FC = () => {
valueType: 'option',
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => [
<a
<Button
key="detail"
type="text"
onClick={() => {
history.push('/examination/certificate/person/' + record.examination_id + "/" + record.accreditation_status + "/" + encodeURIComponent(record.examination_name))
}}
disabled={record.status_type === 4 ? false : true}
>
{record.status_type}
</Button>,
<Button key="subscribeAlert"
type="text"
disabled={record.status_type === 4 ? false : true}
onClick={() => {
console.log(window.location.host);
window.location.href = `http://${window.location.host}/dsideal_yy/zygh/training/person/exportPersonApplyDataModifyStatus?examination_id=${record.examination_id}`
setTimeout(pushurl, 300);
function pushurl() {
actionRef.current?.reloadAndRest?.();
}
// history.push(`/dsideal_yy/zygh/training/person/exportPersonApplyDataModifyStatus?examination_id=${record.examination_id}`)
}}
>
</a>,
<a key="subscribeAlert" href={`/dsideal_yy/zygh/training/person/exportPersonApplyDataModifyStatus?examination_id=${record.examination_id}`}>
</a>,
</Button>,
],
},
];
@ -231,6 +256,7 @@ const CourseList: React.FC = () => {
options={false}
search={{
labelWidth: 120,
defaultCollapsed: false
}}
// toolBarRender={() => [
// <Button

@ -36,51 +36,6 @@ const handleAdd = async (fields: TableListItem) => {
}
};
/**
*
*
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
try {
await saveCourse({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
return false;
}
};
/**
*
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
try {
await removeCourse({
key: selectedRows.map((row) => row.key),
});
hide();
message.success('删除成功,即将刷新');
return true;
} catch (error) {
hide();
message.error('删除失败,请重试');
return false;
}
};
const CourseList: React.FC = () => {
/** 更新窗口的弹窗 */
@ -127,6 +82,7 @@ const CourseList: React.FC = () => {
valueType: 'text',
hideInSearch: true,
},
{
title: '证书类型',
dataIndex: 'examination_name',
@ -138,6 +94,9 @@ const CourseList: React.FC = () => {
dataIndex: 'city_id',
valueType: 'select',
hideInTable: true,
fieldProps: {
allowClear: false
},
hideInForm: false,
hideInSearch: false,
request: async () => {
@ -146,7 +105,7 @@ const CourseList: React.FC = () => {
org_type: 1,
get_next: 1
}).then();
const option = []
const option = [{ label: "全部", value: 0 }]
data?.map((e, i) => {
option.push({ label: e.name, value: e.id })
})
@ -161,12 +120,16 @@ const CourseList: React.FC = () => {
hideInTable: true,
hideInForm: false,
hideInSearch: false,
fieldProps: {
allowClear: false
},
dependencies: ['city_id'],
request: async (params) => {
if (params.city_id) {
console.log(params, 'params::::');
console.log(formRef, 'formRef::::');
console.log(formRef.current?.getFieldsValue(['district_id']));
const option = [{ label: "全部", value: 0 }]
const data = await getAsyncOrgTree({
@ -174,8 +137,7 @@ const CourseList: React.FC = () => {
org_type: 2,
get_next: 1
}).then();
formRef.current?.setFieldsValue({ district_id: {} })
const option = []
formRef.current?.setFieldsValue({ district_id: 0 })
data?.map((e, i) => {
console.log(e, i);
@ -187,8 +149,23 @@ const CourseList: React.FC = () => {
// for (let i = 0; i < Items.length; i++) {
// tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
// }
return option;
}
const option = [{ label: "全部", value: 0 }]
return option;
},
},
{
title: '考试时间',
valueType: 'dateTimeRange',
dataIndex: 'examination_time',
sorter: false,
hideInTable: false,
hideInForm: false,
hideInSearch: false,
render: (dom, entity) => {
return entity.examination_start_time + " - " + entity.examination_end_time
},
},
{
@ -205,11 +182,20 @@ const CourseList: React.FC = () => {
];
/** 获取列数据初始值 */
const getInitialValues = (cols: any[], vals: any) => {
const initialValues: any[] = [];
cols.forEach((column: { dataIndex: string }) => {
const key: any = column?.dataIndex || '';
initialValues.push({ ...column, initialValue: key ? vals[key] : '' });
});
return initialValues || [];
};
return (
<PageContainer
header={{
breadcrumbRender: (props, originBreadcrumb)=>{
breadcrumbRender: (props, originBreadcrumb) => {
return <Breadcrumb>
<Breadcrumb.Item>
<Link to="/examination/option"></Link>
@ -218,7 +204,7 @@ const CourseList: React.FC = () => {
<Link to="/examination/certificate"></Link>
</Breadcrumb.Item>
<Breadcrumb.Item>
<Link to="">{decodeURIComponent(params?.name)}</Link>
<Link to="">{decodeURIComponent(params?.name)}</Link>
</Breadcrumb.Item>
</Breadcrumb>
}
@ -233,17 +219,7 @@ const CourseList: React.FC = () => {
search={{
labelWidth: 120,
}}
// toolBarRender={() => [
// <Button
// type="primary"
// key="primary"
// onClick={() => {
// handleCreateModalVisible(true);
// }}
// >
// <PlusOutlined /> 新建课程
// </Button>,
// ]}
request={async (value) => {
console.log(value, 'form value')
const { create_time } = value;
@ -268,7 +244,7 @@ const CourseList: React.FC = () => {
};
}}
// dataSource={list}
columns={columns}
columns={getInitialValues(columns, { city_id: 0, district_id: 0 })}
rowSelection={false}
/>

@ -104,6 +104,10 @@ const ExaminationList: React.FC = () => {
required: true,
message: '请填写考试名称',
},
{
pattern: /^[^\s]*$/,
message: '禁止输入空格'
}
]
},
},
@ -148,10 +152,11 @@ const ExaminationList: React.FC = () => {
{
title: '创建时间',
dataIndex: 'create_time',
valueType: 'dateTime',
valueType: 'dateTimeRange',
hideInTable: false,
hideInForm: true,
hideInSearch: false,
colSize: 2,
},
{
title: '关联主题',
@ -164,6 +169,7 @@ const ExaminationList: React.FC = () => {
const { data: Items } = await querySubjectList({ page_size: 1000 });
// console.log(Items, ')))');
const sinfo = []
for (let i = 0; i < Items.list.length; i++) {
// console.log(Items.list[i], ">>>")
@ -178,12 +184,12 @@ const ExaminationList: React.FC = () => {
{
required: true,
message: '此项为必填项',
},
}
]
},
},
{
title: '关联规则',
title: '关联考试规则',
dataIndex: 'rules_id',
valueType: 'select',
hideInTable: true,
@ -191,13 +197,13 @@ const ExaminationList: React.FC = () => {
hideInSearch: true,
dependencies: ['subject_id'],
request: async (params) => {
console.log(params, 'params::::');
console.log(params, 'params::::', schemaForm);
const { table_List: Items } = await queryRulesList({ rules_type: 1, subject_id: params.subject_id || 0, });
const rules = [];
for (let i = 0; i < Items.length; i++) {
rules.push({ label: Items[i].rules_name, value: Items[i].id })
}
schemaForm.setFieldsValue({ rules_id: "" });
return rules;
},
formItemProps: {
@ -227,12 +233,16 @@ const ExaminationList: React.FC = () => {
required: true,
message: '请填写在线时长',
},
{
pattern: /^[^\s]*$/,
message: '禁止输入空格'
}
]
},
},
{
title: '课程开放时间',
title: '课程主题开放时间',
dataIndex: 'course_time',
valueType: 'dateTimeRange',
@ -245,7 +255,7 @@ const ExaminationList: React.FC = () => {
{
required: true,
message: '请选择主题开放时间',
},
}
]
},
},
@ -320,14 +330,14 @@ const ExaminationList: React.FC = () => {
handleUpdateModalVisible(true);
record.apply_time = [record.apply_start_time, record.apply_end_time]
record.examination_time = [record.examination_end_time, record.examination_end_time]
record.apply_time = [record.apply_start_time, record.apply_end_time]
record.course_time = [record.course_start_time, record.course_end_time]
setCurrentRow(record);
}}
style={{ padding: '0 2px 0 0' }}
>
</Button>,
<Popconfirm key="popconfirm" title={`确认删除当前吗?`} okText="是" cancelText="否"
<Popconfirm key="popconfirm" title={`确认删除当前考试吗?`} okText="是" cancelText="否"
onConfirm={async () => {
handleRemove([{ key: record?.examination_id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
@ -370,6 +380,7 @@ const ExaminationList: React.FC = () => {
options={false}
search={{
labelWidth: 120,
defaultCollapsed: false
}}
toolBarRender={() => [
<Button
@ -532,10 +543,16 @@ const ExaminationList: React.FC = () => {
delete params.course_time
delete params.examination_time
await handleUpdate(params);
handleCreateModalVisible(false);
schemaForm.resetFields()
const success = await handleUpdate(params);
if (success) {
if (actionRef.current) {
actionRef.current.reload();
handleCreateModalVisible(false);
schemaForm.resetFields()
}
}
}}

@ -139,6 +139,9 @@ const RegistrationList: React.FC = () => {
hideInTable: false,
hideInForm: false,
hideInSearch: false,
fieldProps: {
allowClear: false
},
colSize: 1,
request: async (params) => {
@ -148,7 +151,7 @@ const RegistrationList: React.FC = () => {
get_next: 1
});
console.log('queryCourseListByTag...', Items)
const courses = [{ label: "全部", value: "0" }]
const courses = [{ label: "全部", value: 0 }]
for (let i = 0; i < Items?.length; i++) {
courses.push({ label: Items[i]?.name, value: Items[i]?.id })
}
@ -164,9 +167,12 @@ const RegistrationList: React.FC = () => {
hideInTable: false,
hideInForm: false,
hideInSearch: false,
fieldProps: {
allowClear: false
},
dependencies: ['city_name'],
request: async (params) => {
const courses = [{ label: "全部", value: "0" }]
const courses = [{ label: "全部", value: 0 }]
if (params.city_name) {
console.log(params, 'params')
@ -271,7 +277,7 @@ const RegistrationList: React.FC = () => {
};
}}
// dataSource={list}
columns={getInitialValues(columns, { city_name: cityId, area_name: areaId })}
columns={getInitialValues(columns, { city_name: 0, district_name: 0 })}
// rowSelection={{
// onChange: (_, selectedRows) => {
// setSelectedRows(selectedRows);

@ -64,7 +64,7 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
@ -159,7 +159,7 @@ const ExaminationRules: React.FC = () => {
},
},
{
title: '创建日期',
title: '创建时间',
dataIndex: 'create_time',
valueType: 'dateRange',
sorter: false,
@ -229,7 +229,7 @@ const ExaminationRules: React.FC = () => {
</a>,
<a
key="remove"
onClick={ () => {
onClick={() => {
handleRemove([{ key: record?.id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();

@ -44,9 +44,9 @@ const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
*
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
console.log('fields',fields)
console.log('fields', fields)
try {
await updateRules({
...currentRow,
@ -93,7 +93,7 @@ const ExaminationRules: React.FC = () => {
hideInSearch: true,
},
{
title: '考试时',
title: '考试时',
dataIndex: 'examination_time',
valueType: 'text',
sorter: false,
@ -133,7 +133,7 @@ const ExaminationRules: React.FC = () => {
},
},
{
title: '创建日期',
title: '创建时间',
dataIndex: 'create_time',
valueType: 'dateRange',
sorter: false,
@ -186,20 +186,20 @@ const ExaminationRules: React.FC = () => {
onClick={() => {
history.push('/examinationrules/normal/step/' + record.id)
}}
style={{padding: '0 2px 0 0'}}
style={{ padding: '0 2px 0 0' }}
>
</Button>,
</Button>,
<Button type="link"
key="remove"
disabled={record.b_use ? true : false}
onClick={ () => {
onClick={() => {
handleRemove([{ key: record?.id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}
style={{padding: '0 2px 0 0'}}
>
style={{ padding: '0 2px 0 0' }}
>
<Typography.Text disabled={record.b_use ? true : false} type={"danger"}></Typography.Text>
</Button>,
<a
@ -207,8 +207,8 @@ const ExaminationRules: React.FC = () => {
onClick={async () => {
//history.push(`/examination/option/registration/${record.examination_id}`);
//setCurrentRow(record);
console.log('record', {...record, b_use: !record.b_use})
await handleUpdate({b_use: record?.b_use === 0 ? 1 : 0}, record);
console.log('record', { ...record, b_use: !record.b_use })
await handleUpdate({ b_use: record?.b_use === 0 ? 1 : 0 }, record);
actionRef.current?.reloadAndRest?.();
}}
>

@ -7,7 +7,7 @@ import { PageContainer } from '@ant-design/pro-layout';
import moment from 'moment';
import EditableLinkGroup from './components/EditableLinkGroup';
import styles from './style.less';
import type { ActivitiesType, CurrentUser } from './data.d';
import ProTable from '@ant-design/pro-table';
import { personLastLearning, personLearningDayStatistics, getPersonExaminationList, getExaminationList } from './service';
import cookie from 'react-cookies';
import OfflineData from './components/OfflineData';
@ -212,7 +212,7 @@ const Workplace: FC = () => {
() => getPersonExaminationList(
{
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id')
person_id: cookie.load('person_id'),
}), {
formatResult: (result) => {
return result.table_List;
@ -286,17 +286,48 @@ const Workplace: FC = () => {
bordered={false}
bodyStyle={{ padding: 0 }}
>
<div className={styles.chart}><Table dataSource={examinationList} columns={examinationColumns} pagination={false} /></div>
<div className={styles.chart} style={{ height: 300, overflowY: "scroll" }}><Table dataSource={examinationList} columns={examinationColumns} pagination={false} /></div>
</Card>
<Card
style={{ marginBottom: 24 }}
bordered={false}
title="证书查询<分页没做数据多了再做>"
title="证书查询"
// loading={data?.radarData?.length === 0}
>
<div className={styles.chart}>
<Table dataSource={personExaminationList} columns={certificateColumns} pagination={true} />
<ProTable
style={{ marginBottom: 24 }}
pagination={true}
search={false}
// loading={loading}
options={false}
toolBarRender={false}
request={async (value) => {
const { create_time } = value;
if (create_time) {
value.start_time = create_time[0]
value.end_time = create_time[1]
}
console.log('form _data', value)
delete value.create_time
const _data = await getPersonExaminationList(
{
...value,
identity_id: cookie.load('identity_id'),
person_id: cookie.load('person_id'),
});
return {
current: _data?.pageNumber,
data: _data?.table_List,
pageSize: _data?.pageSize,
total: _data?.totalRow || 0,
};
}}
columns={certificateColumns}
rowKey="id"
/>
{/* <Table dataSource={personExaminationList} columns={certificateColumns} pagination={true} /> */}
</div>
</Card>
</Col>

@ -105,7 +105,7 @@ const CardList = () => {
setLastBtnShow(questionNowNum == 1 ? true : false)
setNextBtnShow(questionNowNum == questionNum ? true : false)
}, [questionNowNum])
}, [questionNowNum, questionNum])
const content = (
<div className={styles.pageHeaderContent}>

@ -138,7 +138,7 @@ const CardList = () => {
useEffect(() => {
setLastBtnShow(questionNowNum == 1 ? true : false)
setNextBtnShow(questionNowNum == questionNum ? true : false)
}, [questionNowNum])
}, [questionNowNum, questionNum])
const content = (
<div className={styles.pageHeaderContent}>

@ -86,7 +86,7 @@ const CardList = () => {
const [lastBtnShow, setLastBtnShow] = useState(true)
const [nextBtnShow, setNextBtnShow] = useState(false)
const [nextBtnShow, setNextBtnShow] = useState(true)
// 当前题号
const [questionNowNum, setQuestionNowNum] = useState(0)
@ -236,10 +236,10 @@ const CardList = () => {
}, [questionNow]);
useEffect(() => {
console.log(questionNowNum, questionNum);
console.log(questionNowNum, questionNum, 'questionNowNum');
setLastBtnShow(questionNowNum == 1 ? true : false)
setNextBtnShow(questionNowNum == questionNum ? true : false)
}, [questionNowNum])
}, [questionNowNum, questionNum])
const content = (
<div className={styles.pageHeaderContent}>

Loading…
Cancel
Save