From d1f8c8ac06c1ab4aeae74c6e0d8ffdacf6704647 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Wed, 26 Jan 2022 10:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=80=83=E8=AF=95=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/config/config.ts | 28 +- admin/src/pages/course/option/index.tsx | 59 +- admin/src/pages/course/option/service.ts | 23 +- admin/src/pages/course/subject/step/index.tsx | 586 +++++++++--------- .../examinationrules/attestation/index.tsx | 134 ++-- .../examinationrules/attestation/service.ts | 19 + .../attestation/step/index.less | 27 + .../attestation/step/index.tsx | 248 ++++++++ .../pages/examinationrules/normal/index.tsx | 136 ++-- .../pages/examinationrules/normal/service.ts | 19 + .../examinationrules/normal/step/index.tsx | 471 +++++++------- admin/src/pages/examinationrules/service.ts | 57 +- 12 files changed, 1119 insertions(+), 688 deletions(-) create mode 100644 admin/src/pages/examinationrules/attestation/step/index.less create mode 100644 admin/src/pages/examinationrules/attestation/step/index.tsx diff --git a/admin/config/config.ts b/admin/config/config.ts index ece75a2..11f6fc6 100644 --- a/admin/config/config.ts +++ b/admin/config/config.ts @@ -5,7 +5,7 @@ import defaultSettings from './defaultSettings'; import proxy from './proxy'; const { REACT_APP_ENV } = process.env; export default defineConfig({ - history:{ + history: { type: 'hash' }, hash: true, @@ -86,6 +86,13 @@ export default defineConfig({ { name: '新建主题', icon: 'smile', + path: '/course/subject/step/update/', + component: './course/subject/step', + hideInMenu: true, + }, + { + name: '编辑主题', + icon: 'smile', path: '/course/subject/step/update/:id', component: './course/subject/step', hideInMenu: true, @@ -145,7 +152,7 @@ export default defineConfig({ { name: '创建模拟考试', icon: 'smile', - path: '/examinationrules/normal/step', + path: '/examinationrules/normal/step/:id', component: './examinationrules/normal/step', hideInMenu: true, }, @@ -156,6 +163,13 @@ export default defineConfig({ path: '/examinationrules/attestation', component: './examinationrules/attestation', }, + { + name: '创建资质考试规则维护', + icon: 'smile', + path: '/examinationrules/attestation/step', + component: './examinationrules/attestation/step', + hideInMenu: true, + }, ], }, { @@ -163,7 +177,7 @@ export default defineConfig({ name: '考试管理', icon: 'profile', routes: [ - { + { name: '考试维护', path: '/examination/option', component: './examination/option', @@ -182,7 +196,7 @@ export default defineConfig({ component: './examination/certificate', }, ], - }, + }, { path: '/history', icon: 'table', @@ -195,7 +209,7 @@ export default defineConfig({ component: './history/analysis', }, ], - }, + }, { path: '/demo', icon: 'table', @@ -291,8 +305,8 @@ export default defineConfig({ component: './profile/advanced', }, ], - }, - + }, + { name: 'exception', icon: 'warning', diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 51ee834..4cd3dc0 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -26,7 +26,7 @@ const uuid = uuidv4(); const handleAdd = async (fields: TableListItem) => { const hide = message.loading('正在添加'); try { - await saveCourse({ ...fields, attachment_filesize:0, }); + await saveCourse({ ...fields, attachment_filesize: 0, }); hide(); message.success('添加成功'); return true; @@ -111,9 +111,8 @@ const CourseList: React.FC = () => { valueType: 'indexBorder', render: (text: React.ReactNode, _: any, index: number) => { if (actionRef && actionRef?.current && actionRef?.current?.pageInfo) { - return `${ - (actionRef?.current?.pageInfo?.current - 1) * actionRef.current.pageInfo?.pageSize + (index + 1) - }`; + return `${(actionRef?.current?.pageInfo?.current - 1) * actionRef.current.pageInfo?.pageSize + (index + 1) + }`; } else { return ''; } @@ -218,11 +217,11 @@ const CourseList: React.FC = () => { valueType: 'select', hideInForm: false, request: async () => { - const {data: Items} = await queryTagList({}); + const { data: Items } = await queryTagList({}); const tags = [] - for(let i=0; i { renderFormItem: (item, { defaultRender, ...rest }, form) => ( { + defaultFileList={item.initialValue ? [item.initialValue] : []} + beforeUpload={(file) => { console.log('file', file) // 获取文件名 - SetUploadFileName(file?.name) ; + SetUploadFileName(file?.name); // 获取最后一个.的位置 const index = file?.name.lastIndexOf("."); // 获取后缀 - SetUploadFileExt(file?.name.substr(index+1)); + SetUploadFileExt(file?.name.substr(index + 1)); }} data={{ - name: uploadFileName, - chunk: 0, - chunks: 1, - key: `down/Syzx/${uuid?.substr(0,2)}/${uuid}.${uploadFileExt}` + name: uploadFileName, + chunk: 0, + chunks: 1, + key: `down/Syzx/${uuid?.substr(0, 2)}/${uuid}.${uploadFileExt}` }} - maxCount={1} + maxCount={1} multiple={false} > @@ -329,10 +328,10 @@ const CourseList: React.FC = () => { > 编辑 , - { - handleRemove([{key: record?.course_id}]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + { + handleRemove([{ key: record?.course_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> @@ -388,11 +387,11 @@ const CourseList: React.FC = () => { request={async (value) => { console.log('value', value) const { create_time } = value; - if(create_time){ - value['begin_time'] = create_time[0] - value['end_time'] = create_time[1] - } - const {data} = await queryCourseList({ + if (create_time) { + value.begin_time = create_time[0] + value.end_time = create_time[1] + } + const { data } = await queryCourseList({ ...value, page_number: value?.current || 1, page_size: value?.pageSize, @@ -554,12 +553,12 @@ const CourseList: React.FC = () => { // 表单处理 //console.log('columns:', columns); console.log('values:', values); - console.log('uploadFileName',uploadFileName) + console.log('uploadFileName', uploadFileName) //return false; // values.attachment_json.response.file.response.url await handleAdd({ - ...values, - attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0,2)}/${uuid}.m3u8"}` + ...values, + attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0, 2)}/${uuid}.m3u8"}` }); handleCreateModalVisible(false); actionRef.current?.reloadAndRest?.(); @@ -575,7 +574,7 @@ const CourseList: React.FC = () => { }} // action = '' title="新建" - columns={columns||[]} + columns={columns || []} /> diff --git a/admin/src/pages/course/option/service.ts b/admin/src/pages/course/option/service.ts index 2619b74..749f773 100644 --- a/admin/src/pages/course/option/service.ts +++ b/admin/src/pages/course/option/service.ts @@ -28,6 +28,25 @@ export async function queryCourseList( }); } + +/** + * 获取主题列表 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ +export async function querySubjectList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', { + params, + }); +} + + + + /** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/course/save */ export async function saveCourse(data: Record, options?: Record) { return request('/dsideal_yy/ypt/careerTraining/course/save', { @@ -39,10 +58,10 @@ export async function saveCourse(data: Record, options?: Record) { +export async function removeCourse(data: { key: number[] }, options?: Record) { console.log('data:::', data); return request>('/dsideal_yy/ypt/careerTraining/course/delete', { - data: {course_id: data?.key[0]}, // 当前接口不支持批量操作 + data: { course_id: data?.key[0] }, // 当前接口不支持批量操作 method: 'POST', requestType: 'form', ...(options || {}), diff --git a/admin/src/pages/course/subject/step/index.tsx b/admin/src/pages/course/subject/step/index.tsx index c63537e..07ddf64 100644 --- a/admin/src/pages/course/subject/step/index.tsx +++ b/admin/src/pages/course/subject/step/index.tsx @@ -1,6 +1,7 @@ import React, { useRef, useState } from 'react'; import { history } from 'umi'; -import { BetaSchemaForm, ProFormInstance, ProFormRadio, ProFormUploadButton } from '@ant-design/pro-form'; +import type { ProFormInstance } from '@ant-design/pro-form'; +import { BetaSchemaForm, ProFormRadio, ProFormUploadButton } from '@ant-design/pro-form'; import ProForm, { StepsForm, ProFormText, @@ -19,87 +20,88 @@ import { MailOutlined, AppstoreOutlined, PlusOutlined, TagsOutlined } from '@ant import ReactQuill from 'react-quill'; import 'react-quill/dist/quill.snow.css' import ProFormRichEdit from '../components/ProFormRichEdit'; -import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; -import { TableListItem, TableListPagination } from '../../option/data'; +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'; /** 列表项定义 */ const columns: ProColumns[] = [ - { - title: '序号', - key: 'index', - valueType: 'indexBorder', - width: 48, - }, - { - title: '章节名称', - dataIndex: 'course_name', - valueType: 'text', - hideInTable: false, - hideInDescriptions: false, - hideInForm: false, - hideInSearch: true, - }, - { - title: '简介', - dataIndex: 'lecture_teacher', - valueType: 'text', - sorter: false, - hideInTable: false, - hideInForm: false, - hideInSearch: true, - renderText: (val: string) => `${val}`, - }, - { - title: '课程', - valueType: 'textarea', - dataIndex: 'course_describe', - sorter: false, - hideInTable: false, - hideInForm: false, - hideInSearch: true, - renderText: (val: string) => `${val}`, - }, - { - title: '学时', - dataIndex: 'course_minutes', - valueType: 'text', - sorter: false, - hideInTable: false, - hideInForm: false, - hideInSearch: true, - renderText: (val: string) => `${val}`, - }, - { - title: '操作', - dataIndex: 'option', - valueType: 'option', - render: (_dom: any, record: React.SetStateAction) => [ - { - //console.log('entity', entity); - //setCurrentRow(record); - //handleDetailModalVisible(true); - }} - > - 查看 - , - { - //setCurrentRow(record); - //handleUpdateModalVisible(true); - }} - > - 编辑 - , - { }}> - 删除 - , - ], - }, - ]; + { + title: '序号', + key: 'index', + valueType: 'indexBorder', + width: 48, + }, + { + title: '章节名称', + dataIndex: 'course_name', + valueType: 'text', + hideInTable: false, + hideInDescriptions: false, + hideInForm: false, + hideInSearch: true, + }, + { + title: '简介', + dataIndex: 'lecture_teacher', + valueType: 'text', + sorter: false, + hideInTable: false, + hideInForm: false, + hideInSearch: true, + renderText: (val: string) => `${val}`, + }, + { + title: '课程', + valueType: 'textarea', + dataIndex: 'course_describe', + sorter: false, + hideInTable: false, + hideInForm: false, + hideInSearch: true, + renderText: (val: string) => `${val}`, + }, + { + title: '学时', + dataIndex: 'course_minutes', + valueType: 'text', + sorter: false, + hideInTable: false, + hideInForm: false, + hideInSearch: true, + renderText: (val: string) => `${val}`, + }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + render: (_dom: any, record: React.SetStateAction) => [ + { + //console.log('entity', entity); + //setCurrentRow(record); + //handleDetailModalVisible(true); + }} + > + 查看 + , + { + //setCurrentRow(record); + //handleUpdateModalVisible(true); + }} + > + 编辑 + , + { }}> + 删除 + , + ], + }, +]; const waitTime = (time: number = 100) => { return new Promise((resolve) => { @@ -109,243 +111,245 @@ const waitTime = (time: number = 100) => { }); }; const numbers = []; -for(let i=0;i<50;i++){ - numbers.push({id: `${i}`}) +for (let i = 0; i < 50; i++) { + numbers.push({ id: `${i}` }) } export default () => { const formRef = useRef(); const actionRef = useRef(); - /** 更新窗口的弹窗 */ - const [createModalVisible, handleCreateModalVisible] = useState(false); - const [detailModalVisible, handleDetailModalVisible] = useState(false); - const [updateModalVisible, handleUpdateModalVisible] = useState(false); + /** 更新窗口的弹窗 */ + const [createModalVisible, handleCreateModalVisible] = useState(false); + const [detailModalVisible, handleDetailModalVisible] = useState(false); + const [updateModalVisible, handleUpdateModalVisible] = useState(false); return ( - + - formRef={formRef} - onFinish={async () => { + formRef={formRef} + onFinish={async () => { await waitTime(1000); message.success('提交成功'); + }} + formProps={{ + layout: "horizontal", + labelCol: { span: 8 }, + wrapperCol: { span: 12 }, + validateMessages: { + required: '此项为必填项', + }, + }} + > + + name="base" + title="主题基本信息" + stepProps={{ + description: false, }} - formProps={{ - layout: "horizontal", - labelCol: { span: 8 }, - wrapperCol: { span: 12 }, - validateMessages: { - required: '此项为必填项', - }, + onFinish={async (value) => { + console.log(value, "vvvvv"); + + console.log(formRef.current?.getFieldsValue()); + await waitTime(2000); + return true; }} - > - - name="base" - title="主题基本信息" - stepProps={{ - description: false, - }} - onFinish={async () => { - console.log(formRef.current?.getFieldsValue()); - await waitTime(2000); - return true; + > + + + + + + + + + + + + name="object" + title="章节信息" + stepProps={{ + description: false, + }} + onFinish={async () => { + console.log(formRef.current?.getFieldsValue()); + return true; + }} + > +
+ { + return Promise.resolve({ + success: true, + data: { id: '这是一段文本', object: '', date: '2020-07-30 08:00', duration: '', grade: 100, through: '>60', learn: '>20 min', times: 2 }, + }); }} - > - - - - - - - - - + extra={false} + > + + + + - - name="object" - title="章节信息" - stepProps={{ - description: false, + + headerTitle={false} + actionRef={actionRef} + rowKey="course_id" + options={false} + search={false} + toolBarRender={() => [ + , + ]} + request={async (value) => { + const _data = await queryCourseList(value); + return { + current: _data?.page_number, + data: _data?.data?.list, + pageSize: _data?.page_size, + total: _data?.total_row || 0, + }; }} - onFinish={async () => { - console.log(formRef.current?.getFieldsValue()); - return true; + // dataSource={list} + columns={columns} + rowSelection={false} + /> + { + handleCreateModalVisible(false); }} - > -
- { - return Promise.resolve({ - success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); - }} - extra={false} - > - - - - + footer={null} + > + + layout="horizontal" + layoutType="Form" + labelCol={{ span: 8 }} + wrapperCol={{ span: 12 }} + onFinish={async (values: any) => { + // 表单处理 + console.log('columns:', columns); + console.log('values:', values); - - headerTitle={false} - actionRef={actionRef} - rowKey="course_id" - options={false} - search={false} - toolBarRender={() => [ - , - ]} - request={async (value) => { - const _data = await queryCourseList(value); - return { - current: _data?.page_number, - data: _data?.data?.list, - pageSize: _data?.page_size, - total: _data?.total_row || 0, - }; - }} - // dataSource={list} - columns={columns} - rowSelection={false} - /> - { - handleCreateModalVisible(false); - }} - footer={null} - > - - layout="horizontal" - layoutType="Form" - labelCol={{ span: 8 }} - wrapperCol={{ span: 12 }} - onFinish={async (values: any) => { - // 表单处理 - console.log('columns:', columns); - console.log('values:', values); + }} + submitter={{ + render: (props, doms) => ( + + + {doms} + + + ), + }} + // action = '' + title="新建" + columns={columns} + /> + +
+ - }} - submitter={{ - render: (props, doms) => ( - - - {doms} - - - ), - }} - // action = '' - title="新建" - columns={columns} - /> -
-
- + { + console.log(formRef.current?.getFieldsValue()); + // 跳转到指定路由 + history.push('/course/subject'); + return true; + }} + > - { - console.log(formRef.current?.getFieldsValue()); - // 跳转到指定路由 - history.push('/course/subject'); - return true; - }} - > - - - - { - return Promise.resolve({ - success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); - }} - extra={false} - > - - - - + + + { + return Promise.resolve({ + success: true, + data: { id: '这是一段文本', object: '', date: '2020-07-30 08:00', duration: '', grade: 100, through: '>60', learn: '>20 min', times: 2 }, + }); + }} + extra={false} + > + + + + - + - - - - - - + + + + + + -
+
); diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index b6bab54..8b64c62 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -11,9 +11,9 @@ 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 { queryTagList, saveExamination, removeExamination, queryExaminationRules } from '../service'; +import { queryTagList, saveExamination, removeExamination, queryRulesList } 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'; /** @@ -89,7 +89,7 @@ const ExaminationRules: React.FC = () => { const [detailModalVisible, handleDetailModalVisible] = useState(false); const [updateModalVisible, handleUpdateModalVisible] = useState(false); //const [registrationModalVisible, handleRegistrationModalVisible] = useState(false); - + const actionRef = useRef(); const [currentRow, setCurrentRow] = useState(); const [selectedRowsState, setSelectedRows] = useState([]); @@ -99,21 +99,29 @@ const ExaminationRules: React.FC = () => { { title: '序号', key: 'index', - valueType: 'indexBorder', + valueType: 'indexBorder', + render: (text: React.ReactNode, _: any, index: number) => { + if (actionRef && actionRef?.current && actionRef?.current?.pageInfo) { + return `${(actionRef?.current?.pageInfo?.current - 1) * actionRef.current.pageInfo?.pageSize + (index + 1) + }`; + } else { + return ''; + } + }, width: 48, }, { title: '考试名称', - dataIndex: 'examination_name', + dataIndex: 'subject_name', valueType: 'text', hideInTable: false, hideInForm: false, hideInSearch: true, }, { - title: '考试时间', - dataIndex: 'examination_start_time', - valueType: 'text', + title: '考试时长', + dataIndex: 'examination_time', + valueType: 'text', sorter: false, hideInTable: false, hideInForm: false, @@ -121,8 +129,8 @@ const ExaminationRules: React.FC = () => { renderText: (val: string) => `${val}`, }, { - title: '关联培训', - dataIndex: 'examination_name', + title: '关联主题', + dataIndex: 'subject_name', valueType: 'text', hideInTable: false, hideInForm: false, @@ -131,24 +139,17 @@ const ExaminationRules: React.FC = () => { { title: '创建日期', dataIndex: 'create_time', - valueType: 'text', + valueType: 'text', sorter: false, hideInTable: false, hideInForm: false, hideInSearch: true, renderText: (val: string) => `${val}`, }, - { - title: '试卷数量', - dataIndex: 'paper_count', - sorter: false, - valueType: 'text', - hideInForm: false, - renderText: (val: string) => `${val}`, - }, + { title: '总分', - dataIndex: 'paper_count', + dataIndex: 'sum_score', sorter: false, valueType: 'text', hideInForm: false, @@ -156,7 +157,7 @@ const ExaminationRules: React.FC = () => { }, { title: '通过线', - dataIndex: 'apply_person_count', + dataIndex: 'pass_score', sorter: false, valueType: 'text', hideInForm: false, @@ -166,39 +167,42 @@ const ExaminationRules: React.FC = () => { title: '操作', dataIndex: 'option', valueType: 'option', - render: (_dom: any, record: React.SetStateAction) => [ - { - //console.log('entity', entity); - setCurrentRow(record); - handleDetailModalVisible(true); - }} - > - 查看 - , - { - handleUpdateModalVisible(true); - setCurrentRow(record); - }} - > - 编辑 - , - - 删除 - , - { - history.push(`/examination/option/registration/${record.examination_id}`); - //setCurrentRow(record); - }} - > - 名单 - , - ], + render: (_dom: any, record: React.SetStateAction) => { + console.log(record, 'record') + return [ + // { + // //console.log('entity', entity); + // setCurrentRow(record); + // handleDetailModalVisible(true); + // }} + // > + // 查看 + // , + { + handleUpdateModalVisible(true); + setCurrentRow(record); + }} + > + 编辑 + , + + 删除 + , + { + history.push(`/examination/option/registration/${record.examination_id}`); + //setCurrentRow(record); + }} + > + 发布 + , + ] + }, }, ]; @@ -217,19 +221,27 @@ const ExaminationRules: React.FC = () => { type="primary" key="primary" onClick={() => { - handleCreateModalVisible(true); + history.push('/examinationrules/attestation/step') }} > 新建考试 , ]} request={async (value) => { - const _data = await queryExaminationList(value); + const _data = await queryRulesList( + { + ...value, + rules_type: 1, + page_number: value.current, + page_size: value.pageSize + } + ); + 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} @@ -274,7 +286,7 @@ const ExaminationRules: React.FC = () => { }} footer={null} centered - >{ console.log('currentRow',currentRow)} + >{console.log('currentRow', currentRow)} {currentRow?.name && ( column={2} diff --git a/admin/src/pages/examinationrules/attestation/service.ts b/admin/src/pages/examinationrules/attestation/service.ts index 4aa8f8d..8dcef12 100644 --- a/admin/src/pages/examinationrules/attestation/service.ts +++ b/admin/src/pages/examinationrules/attestation/service.ts @@ -5,6 +5,25 @@ type ParamsType = { count?: number; } & Partial; + + + +/** + * 获取主题列表 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ +export async function querySubjectList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', { + params, + }); +} + + export async function queryFakeList( params: ParamsType, ): Promise<{ data: { list: BasicListItemDataType[] } }> { diff --git a/admin/src/pages/examinationrules/attestation/step/index.less b/admin/src/pages/examinationrules/attestation/step/index.less new file mode 100644 index 0000000..74c6c5b --- /dev/null +++ b/admin/src/pages/examinationrules/attestation/step/index.less @@ -0,0 +1,27 @@ +@import '~antd/es/style/themes/default.less'; + +.error_icon { + color: @highlight-color; +} +.title { + margin-bottom: 16px; + color: @heading-color; + font-weight: 500; + font-size: 16px; +} +.examinationrules{ + + :global { + .ant-pro-steps-form-step{ + min-width: 960px; + } + .ant-space-align-center{ + padding:24px; + display: block; + text-align: center; + .ant-space-item{ + display: inline-block; + } + } + } +} diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx new file mode 100644 index 0000000..5f134d8 --- /dev/null +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -0,0 +1,248 @@ +import React, { useRef } from 'react'; +import { history, useParams } from 'umi'; +import type { ProFormInstance } from '@ant-design/pro-form'; +import { ProFormRadio } from '@ant-design/pro-form'; +import ProForm, { + StepsForm, + ProFormText, + ProFormDatePicker, + ProFormSelect, + ProFormTextArea, + ProFormCheckbox, + ProFormDateRangePicker, +} from '@ant-design/pro-form'; +import ProCard from '@ant-design/pro-card'; +import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space, Typography } from 'antd'; +import { PageContainer } from '@ant-design/pro-layout'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import styles from './index.less' +import { queryProvince, querySubjectList } from '../service'; + + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; +const numbers = []; +for (let i = 0; i < 50; i++) { + numbers.push({ id: `${i}` }) +} +export default () => { + const formRef = useRef(); + const params = useParams(); + console.log(params, 'params'); + + return ( + + + + formRef={formRef} + onFinish={async () => { + await waitTime(1000); + message.success('提交成功'); + }} + formProps={{ + layout: "horizontal", + labelCol: { span: 8 }, + wrapperCol: { span: 12 }, + validateMessages: { + required: '此项为必填项', + }, + }} + > + + name="base" + title="模拟考试基本信息" + stepProps={{ + description: false, + }} + onFinish={async () => { + console.log(formRef.current?.getFieldsValue()); + await waitTime(2000); + return true; + }} + > + + + + + { + return querySubjectList().then(({ data }) => { + console.log(data) + return data.list.map((item) => { + return { + label: item.subject_name, + value: item.subject_id, + }; + }); + }); + }} + rules={[{ required: true, message: '请选择主题' }]} + name="unusedMode" + label="关联主题" + /> + + + + + + + + + name="object" + title="组卷" + stepProps={{ + description: false, + }} + onFinish={async () => { + console.log(formRef.current?.getFieldsValue()); + return true; + }} + > +
+ 生涯规划师初级认证考试 + {/** 一旦录入另一项将禁用,清空组卷后可选另一项 */} + { }} style={{ marginBottom: 16 }}> + 手动组卷 + 系统组卷 + + + + + + + + + 4. 以下哪些是符合法律规定的 ? + + { return true }} value={0} size="large"> + + A. 单位在试用期辞退员工 + B. 社会中介收取中介费 + C. 单位不缴纳五险一金 + D. 要求员工支付押金 + + + + + 5. 以下哪些是不符合法律规定的(多选) ? + + { return true }}> + + A. 单位在试用期辞退员工 + B. 社会中介收取中介费 + C. 单位不缴纳五险一金 + D. 要求员工支付押金 + + + + + 6. 单位在试用期辞退员工是符合法律规定的 ? + + { return true }} value={0} size="large"> + + 正确 + 错误 + + + + + + +
+ + 试卷信息与设置 + 共 { } 题 { } 分 + + + 单选题 共 { } 题 { } 分 + 多选题 共 { } 题 { } 分 + 判断题 共 { } 题 { } 分 + + + + + +
+ +
+
+ + + { + console.log(formRef.current?.getFieldsValue()); + // 跳转到指定路由 + history.push('/examinationrules/normal'); + return true; + }} + > + + + + { + return Promise.resolve({ + success: true, + data: { id: '这是一段文本', object: '', date: '2020-07-30 08:00', duration: '', grade: 100, through: '>60', learn: '>20 min', times: 2 }, + }); + }} + extra={false} + > + + + + + + + + + + + + + + +
+
+ + ); +}; \ No newline at end of file diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 7e1fce4..e582299 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -11,9 +11,9 @@ 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 { queryTagList, saveExamination, removeExamination, queryExaminationRules } from '../service'; +import { queryTagList, saveExamination, removeExamination, queryExaminationList } 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'; /** @@ -89,7 +89,7 @@ const ExaminationRules: React.FC = () => { const [detailModalVisible, handleDetailModalVisible] = useState(false); const [updateModalVisible, handleUpdateModalVisible] = useState(false); //const [registrationModalVisible, handleRegistrationModalVisible] = useState(false); - + const actionRef = useRef(); const [currentRow, setCurrentRow] = useState(); const [selectedRowsState, setSelectedRows] = useState([]); @@ -99,21 +99,29 @@ const ExaminationRules: React.FC = () => { { title: '序号', key: 'index', - valueType: 'indexBorder', + valueType: 'indexBorder', + render: (text: React.ReactNode, _: any, index: number) => { + if (actionRef && actionRef?.current && actionRef?.current?.pageInfo) { + return `${(actionRef?.current?.pageInfo?.current - 1) * actionRef.current.pageInfo?.pageSize + (index + 1) + }`; + } else { + return ''; + } + }, width: 48, }, { - title: '考试名称', - dataIndex: 'examination_name', + title: '规则名称', + dataIndex: 'rules_name', valueType: 'text', hideInTable: false, hideInForm: false, hideInSearch: true, }, { - title: '考试时间', - dataIndex: 'examination_start_time', - valueType: 'text', + title: '考试时长', + dataIndex: 'examination_time', + valueType: 'text', sorter: false, hideInTable: false, hideInForm: false, @@ -121,8 +129,8 @@ const ExaminationRules: React.FC = () => { renderText: (val: string) => `${val}`, }, { - title: '关联培训', - dataIndex: 'examination_name', + title: '关联主题', + dataIndex: 'subject_name', valueType: 'text', hideInTable: false, hideInForm: false, @@ -131,24 +139,17 @@ const ExaminationRules: React.FC = () => { { title: '创建日期', dataIndex: 'create_time', - valueType: 'text', + valueType: 'text', sorter: false, hideInTable: false, hideInForm: false, hideInSearch: true, renderText: (val: string) => `${val}`, }, - { - title: '试卷数量', - dataIndex: 'paper_count', - sorter: false, - valueType: 'text', - hideInForm: false, - renderText: (val: string) => `${val}`, - }, + { title: '总分', - dataIndex: 'paper_count', + dataIndex: 'sum_score', sorter: false, valueType: 'text', hideInForm: false, @@ -156,7 +157,7 @@ const ExaminationRules: React.FC = () => { }, { title: '通过线', - dataIndex: 'apply_person_count', + dataIndex: 'pass_score', sorter: false, valueType: 'text', hideInForm: false, @@ -166,39 +167,42 @@ const ExaminationRules: React.FC = () => { title: '操作', dataIndex: 'option', valueType: 'option', - render: (_dom: any, record: React.SetStateAction) => [ - { - //console.log('entity', entity); - setCurrentRow(record); - handleDetailModalVisible(true); - }} - > - 查看 - , - { - handleUpdateModalVisible(true); - setCurrentRow(record); - }} - > - 编辑 - , - - 删除 - , - { - history.push(`/examination/option/registration/${record.examination_id}`); - //setCurrentRow(record); - }} - > - 名单 - , - ], + render: (_dom: any, record: React.SetStateAction) => { + console.log(record, 'record') + return [ + // { + // //console.log('entity', entity); + // setCurrentRow(record); + // handleDetailModalVisible(true); + // }} + // > + // 查看 + // , + { + history.push('/examinationrules/normal/step/' + record.id) + + }} + > + 编辑 + , + + 删除 + , + { + history.push(`/examination/option/registration/${record.examination_id}`); + //setCurrentRow(record); + }} + > + {record.b_use == 0 ? "未发布" : "已发布"} + , + ] + }, }, ]; @@ -220,16 +224,24 @@ const ExaminationRules: React.FC = () => { history.push('/examinationrules/normal/step') }} > - 新建考试 + 新建考试规则 , ]} request={async (value) => { - const _data = await queryExaminationList(value); + const _data = await queryExaminationList( + { + ...value, + rules_type: 0, + page_number: value.current, + page_size: value.pageSize + } + ); + 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} @@ -274,7 +286,7 @@ const ExaminationRules: React.FC = () => { }} footer={null} centered - >{ console.log('currentRow',currentRow)} + >{console.log('currentRow', currentRow)} {currentRow?.name && ( column={2} diff --git a/admin/src/pages/examinationrules/normal/service.ts b/admin/src/pages/examinationrules/normal/service.ts index 36439c5..c8c4457 100644 --- a/admin/src/pages/examinationrules/normal/service.ts +++ b/admin/src/pages/examinationrules/normal/service.ts @@ -13,6 +13,25 @@ export async function queryFakeList( }); } +/** + * 获取主题列表 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ +export async function querySubjectList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', { + params, + }); +} + + + + + export async function removeFakeList( params: ParamsType, ): Promise<{ data: { list: BasicListItemDataType[] } }> { diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx index 96d069e..95b4396 100644 --- a/admin/src/pages/examinationrules/normal/step/index.tsx +++ b/admin/src/pages/examinationrules/normal/step/index.tsx @@ -1,239 +1,268 @@ import React, { useRef } from 'react'; -import { history } from 'umi'; -import { ProFormInstance, ProFormRadio } from '@ant-design/pro-form'; +import { history, useParams, useRequest } from 'umi'; +import type { ProFormInstance } from '@ant-design/pro-form'; +import { ProFormRadio } from '@ant-design/pro-form'; import ProForm, { - StepsForm, - ProFormText, - ProFormDatePicker, - ProFormSelect, - ProFormTextArea, - ProFormCheckbox, - ProFormDateRangePicker, + StepsForm, + ProFormText, + ProFormDatePicker, + ProFormSelect, + ProFormTextArea, + ProFormCheckbox, + ProFormDateRangePicker, } from '@ant-design/pro-form'; import ProCard from '@ant-design/pro-card'; import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space, Typography } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; import ProDescriptions from '@ant-design/pro-descriptions'; import styles from './index.less' -import { MailOutlined, AppstoreOutlined } from '@ant-design/icons'; +import { saveExamination, querySubjectList, queryRulesView } from '../../service'; + const waitTime = (time: number = 100) => { - return new Promise((resolve) => { - setTimeout(() => { - resolve(true); - }, time); - }); + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); }; const numbers = []; -for(let i=0;i<50;i++){ - numbers.push({id: `${i}`}) +for (let i = 0; i < 50; i++) { + numbers.push({ id: `${i}` }) } export default () => { - const formRef = useRef(); - - return ( - - - - formRef={formRef} - onFinish={async () => { - await waitTime(1000); - message.success('提交成功'); - }} - formProps={{ - layout: "horizontal", - labelCol: { span: 8 }, - wrapperCol: { span: 12 }, - validateMessages: { - required: '此项为必填项', - }, - }} - > - - name="base" - title="模拟考试基本信息" - stepProps={{ - description: false, - }} - onFinish={async () => { - console.log(formRef.current?.getFieldsValue()); - await waitTime(2000); - return true; - }} - > - - - - - - - - - - - - - (); + const params = useParams(); + console.log(params, 'params'); + if (params) { + const data = useRequest(async () => { + return await queryRulesView(params); + }); + + console.log(data, 'data1`11'); + + } + return ( + + + - name="object" - title="组卷" - stepProps={{ - description: false, - }} - onFinish={async () => { - console.log(formRef.current?.getFieldsValue()); - return true; - }} - > -
- 生涯规划师初级认证考试 - {/** 一旦录入另一项将禁用,清空组卷后可选另一项 */} - {}} style={{ marginBottom: 16 }}> - 手动组卷 - 系统组卷 - - - - - - - - - 4. 以下哪些是符合法律规定的 ? - - {return true}} value={0} size="large"> - - A. 单位在试用期辞退员工 - B. 社会中介收取中介费 - C. 单位不缴纳五险一金 - D. 要求员工支付押金 - - + formRef={formRef} + + + + onFinish={async (e) => { + console.log(e, 'eeeeeeeeeee'); + + await waitTime(1000); + message.success('提交成功'); + }} + formProps={{ + layout: "horizontal", + labelCol: { span: 8 }, + wrapperCol: { span: 12 }, + validateMessages: { + required: '此项为必填项', + }, + }} + > + + name="base" + title="模拟考试基本信息" + stepProps={{ + description: false, + }} + onFinish={async (fileds) => { + console.log(fileds, 'fileds'); + await saveExamination({ + ...fileds, + b_use: 0, + rules_type: 0, + }); + + await waitTime(2000); + return true; + + }} + + > + + + + + - 5. 以下哪些是不符合法律规定的(多选) ? - - {return true}}> - - A. 单位在试用期辞退员工 - B. 社会中介收取中介费 - C. 单位不缴纳五险一金 - D. 要求员工支付押金 - - - - - 6. 单位在试用期辞退员工是符合法律规定的 ? - - {return true}} value={0} size="large"> - - 正确 - 错误 - + request={async () => { + return querySubjectList().then(({ data }) => { + console.log(data, 'querySubjectList') + return data.list.map((item) => { + return { + label: item.subject_name, + value: item.subject_id, + }; + }); + }); + }} + rules={[{ required: true, message: '请选择主题' }]} + name="subject_id" + label="关联主题" + /> + + + + + + + + + name="object" + title="组卷" + stepProps={{ + description: false, + }} + onFinish={async () => { + console.log(formRef.current?.getFieldsValue()); + return true; + }} + > +
+ 生涯规划师初级认证考试 + {/** 一旦录入另一项将禁用,清空组卷后可选另一项 */} + { }} style={{ marginBottom: 16 }}> + 手动组卷 + 系统组卷 - - - - -
- - 试卷信息与设置 - 共 {} 题 {} 分 - - - 单选题 共 {} 题 {} 分 - 多选题 共 {} 题 {} 分 - 判断题 共 {} 题 {} 分 - - - - - -
- - -
- - - { - console.log(formRef.current?.getFieldsValue()); - // 跳转到指定路由 - history.push('/examinationrules/normal'); - return true; - }} - > - - - - { - return Promise.resolve({ - success: true, - data: { id: '这是一段文本', object:'', date: '2020-07-30 08:00', duration:'', grade:100, through:'>60', learn: '>20 min', times: 2 }, - }); - }} - extra={false} - > - - - - - - - - - - - - - - -
- - - ); + + + + + + + + 4. 以下哪些是符合法律规定的 ? + + { return true }} value={0} size="large"> + + A. 单位在试用期辞退员工 + B. 社会中介收取中介费 + C. 单位不缴纳五险一金 + D. 要求员工支付押金 + + + + + 5. 以下哪些是不符合法律规定的(多选) ? + + { return true }}> + + A. 单位在试用期辞退员工 + B. 社会中介收取中介费 + C. 单位不缴纳五险一金 + D. 要求员工支付押金 + + + + + 6. 单位在试用期辞退员工是符合法律规定的 ? + + { return true }} value={0} size="large"> + + 正确 + 错误 + + + + + + +
+ + 试卷信息与设置 + 共 { } 题 { } 分 + + + 单选题 共 { } 题 { } 分 + 多选题 共 { } 题 { } 分 + 判断题 共 { } 题 { } 分 + + + + + +
+ +
+
+ + + { + console.log(formRef.current?.getFieldsValue()); + // 跳转到指定路由 + history.push('/examinationrules/normal'); + return true; + }} + > + + + + { + return Promise.resolve({ + success: true, + data: { id: '这是一段文本', object: '', date: '2020-07-30 08:00', duration: '', grade: 100, through: '>60', learn: '>20 min', times: 2 }, + }); + }} + extra={false} + > + + + + + + + + + + + + + + +
+
+ + ); }; \ No newline at end of file diff --git a/admin/src/pages/examinationrules/service.ts b/admin/src/pages/examinationrules/service.ts index b6738be..1a97b54 100644 --- a/admin/src/pages/examinationrules/service.ts +++ b/admin/src/pages/examinationrules/service.ts @@ -1,8 +1,8 @@ import { request } from 'umi'; -import { TableListItem } from './data'; +import type { TableListItem } from './data'; -/** 获取考试列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ -export async function queryExaminationList( +/** 获取考试规则列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ +export async function queryRulesList( params: { // query /** 当前的页码 */ @@ -10,7 +10,7 @@ export async function queryExaminationList( /** 页面的容量 */ pageSize?: number; }, - options?: { [key: string]: any }, + options?: Record, ) { return request<{ data: TableListItem[]; @@ -19,7 +19,7 @@ export async function queryExaminationList( /** 页面的容量 */ page_size?: number; success?: boolean; - }>('/api/zygh/training/examination/getExaminationList', { + }>('/dsideal_yy/zygh/training/rules/getRulesList', { method: 'GET', params: { ...params, @@ -37,7 +37,7 @@ export async function queryCertificateList( /** 页面的容量 */ pageSize?: number; }, - options?: { [key: string]: any }, + options?: Record, ) { return request<{ data: TableListItem[]; @@ -55,17 +55,46 @@ export async function queryCertificateList( }); } -/** 新建/修改考试 POST /dsideal_yy/ypt/careerTraining/course/save */ -export async function saveExamination(data: { [key: string]: any }, options?: { [key: string]: any }) { - return request('/dsideal_yy/ypt/careerTraining/course/save', { - data, - method: 'POST', + + +/** 获取考试规则列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ +export async function queryRulesView( + params: { + // query + /** 当前的页码 */ + id?: number; + }, + options?: Record, +) { + return request('/dsideal_yy/zygh/training/rules/getRulesById', { + method: 'GET', + params: { + ...params, + }, ...(options || {}), }); } + + + + + + + + + + + + + + + + + + /** 删除考试 POST /dsideal_yy/ypt/careerTraining/course/delete */ -export async function removeExamination(data: { key: number[] }, options?: { [key: string]: any }) { +export async function removeExamination(data: { key: number[] }, options?: Record) { return request>('/dsideal_yy/ypt/careerTraining/course/delete', { data, method: 'POST', @@ -74,7 +103,7 @@ export async function removeExamination(data: { key: number[] }, options?: { [ke } /** 查看考试(仅仅获取考试详情,不标记浏览量)GET /dsideal_yy/ypt/careerTraining/course/view */ -export async function queryExaminationView(data: { [key: string]: any }, options?: { [key: string]: any }) { +export async function queryExaminationView(data: Record, options?: Record) { return request('/dsideal_yy/ypt/careerTraining/course/view', { data, method: 'POST', @@ -91,7 +120,7 @@ export async function queryRegistrationList( /** 页面的容量 */ pageSize?: number; }, - options?: { [key: string]: any }, + options?: Record, ) { return request<{ data: TableListItem[];