From 86f25d70256ea1d6727ed22d3cde4b945d6ac684 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Wed, 9 Feb 2022 13:44:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E6=96=B0=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/examination/option/index.tsx | 121 ++++++++++++++++--- 1 file changed, 101 insertions(+), 20 deletions(-) diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index 0dd291c..9b71551 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -6,7 +6,8 @@ import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form } 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, ProFormColumnsType, ProFormText, ProFormTextArea } from '@ant-design/pro-form'; +import type { ProFormColumnsType } from '@ant-design/pro-form'; +import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } 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'; @@ -109,36 +110,60 @@ const ExaminationList: React.FC = () => { hideInTable: false, hideInForm: false, hideInSearch: false, + formItemProps: { + rules: [ + { + required: true, + message: '请填写考试名称', + }, + ] + }, }, + // { + // title: '创建日期', + // dataIndex: 'create_time', + // valueType: 'dataTimeRange', + // sorter: false, + // hideInTable: false, + // hideInForm: true, + // hideInSearch: true, + // renderText: (val: string) => `${val}`, + // }, { - title: '创建日期', - dataIndex: 'create_time', - valueType: 'text', - sorter: false, - hideInTable: false, - hideInForm: true, - hideInSearch: true, - renderText: (val: string) => `${val}`, - }, - { - title: '报名日期', - dataIndex: 'apply_start_time', - valueType: 'datetimeRange', + title: '报名时间', + dataIndex: 'apply_time', + valueType: 'dateTimeRange', sorter: false, hideInTable: false, hideInForm: false, hideInSearch: true, + formItemProps: { + rules: [ + { + required: true, + message: '请选择报名时间', + }, + ] + }, render: (dom, entity) => { return entity.apply_start_time + " - " + entity.apply_end_time; }, }, { title: '考试时间', - valueType: 'datetimeRange', - dataIndex: 'examination_start_time', + valueType: 'dateTimeRange', + dataIndex: 'examination_time', sorter: false, hideInTable: false, hideInForm: false, + formItemProps: { + rules: [ + { + required: true, + message: '请选择考试时间', + }, + ] + }, hideInSearch: true, render: (dom, entity) => { return entity.examination_start_time + " - " + entity.examination_end_time; @@ -153,7 +178,7 @@ const ExaminationList: React.FC = () => { hideInForm: false, hideInSearch: true, request: async () => { - const { data: Items } = await querySubjectList({page_size:1000}); + const { data: Items } = await querySubjectList({ page_size: 1000 }); // console.log(Items, ')))'); const sinfo = [] @@ -184,7 +209,7 @@ const ExaminationList: React.FC = () => { dependencies: ['subject_id'], request: async (params) => { console.log(params, 'params::::'); - const { table_List: Items } = await queryRulesList({rules_type: 1, subject_id: params.subject_id || 0,}); + 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 }) @@ -200,12 +225,47 @@ const ExaminationList: React.FC = () => { ] }, }, + + { + title: '在线学习时长(分钟)', + dataIndex: 'learning_time', + sorter: false, + valueType: 'text', + hideInForm: false, + renderText: (val: string) => `${val}`, + formItemProps: { + rules: [ + { + required: true, + message: '请填写在线时长', + }, + ] + }, + + }, + { + title: '课程主题开放时间', + dataIndex: 'course_time', + sorter: false, + valueType: 'dateTimeRange', + hideInForm: false, + renderText: (val: string) => `${val}`, + formItemProps: { + rules: [ + { + required: true, + message: '请选择主题开放时间', + }, + ] + }, + }, + { title: '试卷数量', dataIndex: 'paper_count', sorter: false, valueType: 'text', - hideInForm: false, + hideInForm: true, renderText: (val: string) => `${val}`, }, { @@ -213,7 +273,7 @@ const ExaminationList: React.FC = () => { dataIndex: 'apply_person_count', sorter: false, valueType: 'text', - hideInForm: false, + hideInForm: true, renderText: (val: string) => `${val}`, }, { @@ -412,12 +472,33 @@ const ExaminationList: React.FC = () => { onValuesChange={(values: any) => { console.log('values:', values); const { subject_id } = values + if (subject_id) { + schemaForm.setFieldsValue({ rule_id: "" }) + } }} onFinish={async (values: any) => { // 表单处理 console.log('columns:', columns); console.log('values:', values); + // 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; + + + }} submitter={{ render: (props, doms) => (