zhengpengju 4 years ago
commit 96036f5a47

@ -82,6 +82,15 @@ export async function queryCourseView(data: Record<string, any>, options?: Recor
/** 新建/修改主题 POST /dsideal_yy/ypt/careerTraining/subject/saveSubject */
export async function saveSubject(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/subject/saveSubject', {
data,
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
@ -90,8 +99,7 @@ export async function queryCourseView(data: Record<string, any>, options?: Recor
/** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */
/** 新建/修改课程标签 POST /dsideal_yy/ypt/careerTraining/course/save */
export async function saveTag(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/tag/save', {
data,

@ -23,7 +23,7 @@ import ProFormRichEdit from '../components/ProFormRichEdit';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import type { TableListItem, TableListPagination } from '../../option/data';
import { queryCourseList } from '../../option/service';
import { queryCourseList, saveSubject } from '../../option/service';
/** 列表项定义 */
const columns: ProColumns<TableListItem>[] = [
@ -213,9 +213,23 @@ export default () => {
stepProps={{
description: false,
}}
onFinish={async () => {
console.log(formRef.current?.getFieldsValue());
onFinish={async (fileds) => {
if (params.id) {
fileds = { ...fileds, id: params.id }
}
console.log(fileds, 'fileds', params);
// return false
await saveRules({
...fileds,
b_use: 0,
rules_type: 1,
start_time: fileds.dateRange[0],
end_time: fileds.dateRange[1]
});
// await waitTime(2000);
return true;
}}
>
<div style={{ margin: '0' }}>
@ -255,7 +269,11 @@ export default () => {
</Button>,
]}
request={async (value) => {
const _data = await queryCourseList(value);
const _data = await saveSubject({
...value,
attachment_json: `{ "url": "${value.upload[0].response.url}"}`
});
return {
current: _data?.page_number,
data: _data?.data?.list,

@ -1,7 +1,7 @@
import React, { useState, useRef } from 'react';
import { useRequest } from 'umi';
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd';
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Select } from 'antd';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import type { ProColumns, ActionType } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
@ -12,13 +12,14 @@ import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm';
import { saveCertificate, removeCertificate, queryCertificateList } from '../service';
import type { TableListItem, TableListPagination } from '../data';
import { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
/**
*
*
* @param fields
*/
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
@ -86,7 +87,7 @@ const CourseList: React.FC = () => {
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
const actionRef = useRef<ActionType>();
const [currentRow, setCurrentRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
@ -96,21 +97,21 @@ const CourseList: React.FC = () => {
{
title: '序号',
key: 'index',
valueType: 'indexBorder',
valueType: 'indexBorder',
width: 48,
},
{
title: '考试名称',
title: '证件名称',
dataIndex: 'examination_name',
valueType: 'text',
hideInTable: false,
hideInForm: false,
hideInSearch: true,
hideInSearch: false,
},
{
title: '创建日期',
dataIndex: 'create_time',
valueType: 'text',
valueType: 'text',
sorter: false,
hideInTable: false,
hideInForm: false,
@ -120,7 +121,7 @@ const CourseList: React.FC = () => {
{
title: '报名开始日期',
dataIndex: 'apply_start_time',
valueType: 'text',
valueType: 'text',
sorter: false,
hideInTable: false,
hideInForm: false,
@ -128,14 +129,16 @@ const CourseList: React.FC = () => {
renderText: (val: string) => `${val}`,
},
{
title: '考试开始时间',
valueType: 'text',
title: '考试时间',
valueType: 'dateTimeRange',
dataIndex: 'examination_start_time',
sorter: false,
hideInTable: false,
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
hideInSearch: false,
render: (dom, entity) => {
return entity.examination_start_time + " - " + entity.examination_end_time
},
},
{
title: '试卷数量',
@ -143,6 +146,7 @@ const CourseList: React.FC = () => {
sorter: false,
valueType: 'text',
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
},
{
@ -151,17 +155,73 @@ const CourseList: React.FC = () => {
sorter: false,
valueType: 'text',
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`,
},
{
title: '通过人数',
dataIndex: 'apply_person_count',
sorter: false,
valueType: 'text',
hideInForm: false,
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'status_type',
sorter: false,
hideInForm: true,
hideInSearch: true,
renderText: (val: string) => `${val}`,
valueType: 'text',
hideInForm: false,
hideInSearch: false,
renderFormItem: (_, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
if (type === 'form') {
return null;
}
const status = form.getFieldValue('state');
if (status !== 'open') {
return (
// value 和 onchange 会通过 form 自动注入。
<Select defaultValue="0" >
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
<Option value="4"></Option>
</Select>
);
}
return defaultRender(_);
},
render: (dom, entity) => {
switch (entity.status_type) {
case 0:
return "待报名"
break;
case 1:
return "报名中"
break;
case 2:
return "待考试"
break;
case 3:
return "考试中"
break;
case 4:
return "考试完成";
break;
default:
return ""
break;
}
// return entity.status_type;
},
},
{
title: '操作',
dataIndex: 'option',
@ -203,24 +263,31 @@ const CourseList: React.FC = () => {
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
handleCreateModalVisible(true);
}}
>
<PlusOutlined />
</Button>,
]}
// toolBarRender={() => [
// <Button
// type="primary"
// key="primary"
// onClick={() => {
// handleCreateModalVisible(true);
// }}
// >
// <PlusOutlined /> 新建课程
// </Button>,
// ]}
request={async (value) => {
const _data = await queryCertificateList(value);
console.log(value, 'form value')
const { create_time } = value;
if (create_time) {
value.start_time = create_time[0]
value.end_time = create_time[1]
}
const _data = await queryCertificateList();
return {
current: _data?.page_number,
data: _data?.data?.list,
pageSize: _data?.page_size,
total: _data?.total_row || 0,
current: _data?.pageNumber,
data: _data?.table_List,
pageSize: _data?.pageSize,
total: _data?.totalRow || 0,
};
}}
// dataSource={list}
@ -265,7 +332,7 @@ const CourseList: React.FC = () => {
}}
footer={null}
centered
>{ console.log('currentRow',currentRow)}
>{console.log('currentRow', currentRow)}
{currentRow?.name && (
<ProDescriptions<TableListItem>
column={2}

@ -2,7 +2,7 @@
import React, { useState, useRef } from 'react';
import { useRequest, history } from 'umi';
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd';
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form } from 'antd';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import type { ProColumns, ActionType } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
@ -11,7 +11,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
import UpdateForm from './components/UpdateForm';
import { querySubjectList, saveExamination, removeExamination, queryExaminationList } from '../service';
import { querySubjectList, saveExamination, removeExamination, queryExaminationList, queryRulesList } from '../service';
import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import RegistrationList from '../registration';
@ -89,7 +89,7 @@ const ExaminationList: React.FC = () => {
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
//const [registrationModalVisible, handleRegistrationModalVisible] = useState<boolean>(false);
const [schemaForm] = Form.useForm();
const actionRef = useRef<ActionType>();
const [currentRow, setCurrentRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
@ -146,7 +146,7 @@ const ExaminationList: React.FC = () => {
},
{
title: '关联1主题',
title: '关联主题',
dataIndex: 'subject_id',
valueType: 'text',
hideInTable: true,
@ -165,6 +165,45 @@ const ExaminationList: React.FC = () => {
return sinfo;
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
]
},
},
{
title: '关联的规则',
dataIndex: 'subject_id2',
valueType: 'text',
hideInTable: true,
hideInForm: false,
hideInSearch: true,
request: async (e, a) => {
console.log(e, a, 'OOOOOOOOO');
const { data: Items } = await queryRulesList({});
// console.log(Items, ')))');
const sinfo = []
for (let i = 0; i < Items.list.length; i++) {
// console.log(Items.list[i], ">>>")
sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id })
}
console.log(sinfo, 'sinfo');
return sinfo;
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
]
},
},
{
title: '试卷数量',
@ -370,10 +409,16 @@ const ExaminationList: React.FC = () => {
footer={null}
>
<BetaSchemaForm<DataItem>
form={schemaForm}
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onValuesChange={(values: any) => {
console.log('values:', values);
const { subject_id } = values
schemaForm.setFields({ subject_id2: [{ name: "1", value: "1" }, { name: "2", value: "2" }] })
}}
onFinish={async (values: any) => {
// 表单处理
console.log('columns:', columns);

@ -62,7 +62,7 @@ export async function queryCertificateList(
/** 页面的容量 */
page_size?: number;
success?: boolean;
}>('/api/zygh/training/examination/getCertificateList', {
}>('/dsideal_yy/zygh/training/examination/getExaminationList', {
method: 'GET',
params: {
...params,
@ -137,4 +137,32 @@ export async function queryRegistrationList(
},
...(options || {}),
});
}
/** 获取考试规则列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */
export async function queryRulesList(
params: {
// query
/** 当前的页码 */
current?: number;
/** 页面的容量 */
pageSize?: number;
},
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
/** 列表的内容总数 */
total_row?: number;
/** 页面的容量 */
page_size?: number;
success?: boolean;
}>('/dsideal_yy/zygh/training/rules/getRulesList', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
Loading…
Cancel
Save