From 781f1dcace5804d850fd63fe091978a3b2fbff4e Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Wed, 16 Feb 2022 16:57:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/training/option/index.tsx | 152 +++++++++++++++++---- admin/src/pages/training/option/service.ts | 15 ++ 2 files changed, 141 insertions(+), 26 deletions(-) diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index 78549f8..c826f68 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -9,7 +9,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 { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList } from './service'; +import { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList, querySubjectView } from './service'; import type { TableListItem, TableListPagination } from './data'; import { useRequest } from 'umi'; @@ -139,6 +139,7 @@ const TableList: React.FC = () => { title: '序号', key: 'index', 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)}`; @@ -148,14 +149,17 @@ const TableList: React.FC = () => { }, width: 48, }, + { title: '培训名称', dataIndex: 'train_name', valueType: 'text', + hideInSearch: true, }, { title: '培训对象', valueType: 'select', + hideInSearch: true, fieldProps: { mode: "multiple" }, @@ -203,22 +207,25 @@ const TableList: React.FC = () => { dataIndex: 'start_time', sorter: false, hideInForm: true, + hideInSearch: true, renderText: (val: string) => `${val}`, }, { title: '结束时间', dataIndex: 'end_time', sorter: false, + hideInSearch: true, hideInForm: true, renderText: (val: string) => `${val}`, }, { title: '培训时间', valueType: 'dateTimeRange', - dataIndex: 'datetime', + dataIndex: 'date_time', sorter: false, hideInForm: false, hideInTable: true, + hideInSearch: false, renderText: (val: string) => `${val}`, }, { @@ -227,6 +234,7 @@ const TableList: React.FC = () => { dataIndex: 'total_course_hours', valueType: 'text', hideInForm: true, + hideInSearch: true, renderText: (val: string) => `${val}小时`, }, { @@ -234,28 +242,27 @@ const TableList: React.FC = () => { dataIndex: 'option', valueType: 'option', render: (_, record) => [ - { - handleUpdateModalVisible(true); - setCurrentRow(record); - }} - > - 查看 - , + { handleUpdateModalVisible(true); - const idsArr = record?.org_ids?.split(",") - const orgName = record?.org_names?.split(",") - const idsData = [] - idsArr.map((e,i) => { - idsData.push({ - label: orgName[i], value: Number(e) - }) - }) - record.org_names = idsData + // const _record = JSON.parse(JSON.stringify(record)) + // const idsArr = _record?.org_ids?.split(",") + // const orgName = _record.org_names != "" ? _record.org_names.split(",") : "" + // const idsData = [] + // if (_record?.org_ids != false) { + // idsArr.map((e, i) => { + // idsData.push({ + // label: orgName[i], value: Number(e) + // }) + // }) + + // } + // _record.org_names = idsData + // _record.date_time = [_record.start_time, _record.end_time] + // console.log("2323", _record); + setCurrentRow(record); }} > @@ -303,7 +310,16 @@ const TableList: React.FC = () => { , ]} request={async (value) => { + if (value.date_time) { + value.begin_time = value.date_time[0] + value.end_time = value.date_time[1] + } + // delete value.date_time + console.log('search', value); + const _data = await queryTrainList(value); + + return { current: _data?.page_number, data: _data?.data?.list, @@ -387,11 +403,11 @@ const TableList: React.FC = () => { console.log(tree, 'tree'); const _data = { ...values, - end_time: values.datetime[1], - start_time: values.datetime[0], + end_time: values.date_time[1], + start_time: values.date_time[0], target_list_json: JSON.stringify(tree) } - delete _data.datetime + delete _data.date_time delete _data.org_names // delete params.course_time // delete params.examination_time @@ -436,8 +452,92 @@ const TableList: React.FC = () => { layoutType="Form" labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} - onFinish={async (values) => { - console.log(values); + request={async () => { + + const { data } = await querySubjectView({ train_id: currentRow?.train_id }); + + + data.date_time = [currentRow.start_time, currentRow.end_time] + data.org_names = [] + data.target_list.map((e) => { + console.log('1111', e); + + data.org_names.push({ + value: e.org_id, + label: e.org_name + }) + console.log("222", data); + + }) + console.log("edit", data); + + return data + }} + + onFinish={async (values: any) => { + // 表单处理 + //console.log('columns:', columns); + console.log('values1:', values, orgTree); + //return false; + // values.attachment_json.response.file.response.url + + let tree = [] + if (typeof values.org_names[0] === 'number') { + // tree = values.org_names + console.log('true values.org_names', tree, orgTree, values) + tree = orgTree?.filter((item, idx, self) => { + return (values?.org_names?.indexOf(item?.id) !== -1) + }); + console.log("tree,1111", tree); + + tree.map((e, i) => { + tree[i].org_id = e.id + tree[i].org_name = e.name + delete tree[i].id + delete tree[i].name + delete tree[i].pId + }) + } else { + values.org_names.map((e) => { + console.log(e, 'e'); + + }) + + // tree[i].org_id = e.id + // tree[i].org_name = e.name + console.log(values.org_names, 'false values.org_names') + } + + + + + console.log(321); + console.log(tree, 'tree'); + + + + const _data = { + ...values, + + end_time: values.date_time[1], + start_time: values.date_time[0], + target_list_json: JSON.stringify(tree), + train_id: currentRow.train_id + } + delete _data.date_time + delete _data.org_names + // delete params.course_time + // delete params.examination_time + + console.log('_data', _data); + + const res = await saveTrain(_data); + // console.log(res, 'ressss'); + if (res.code === 2000) { + handleUpdateModalVisible(false); + actionRef.current?.reloadAndRest?.(); + } + }} submitter={{ render: (props, doms) => ( @@ -450,7 +550,7 @@ const TableList: React.FC = () => { }} // action = '' title="编辑" - columns={getInitialValues(columns, currentRow)} + columns={columns} /> )} diff --git a/admin/src/pages/training/option/service.ts b/admin/src/pages/training/option/service.ts index 8fa2544..7ccf12c 100644 --- a/admin/src/pages/training/option/service.ts +++ b/admin/src/pages/training/option/service.ts @@ -92,3 +92,18 @@ export async function querySubjectList(params: { }); } +/** + * 获取主题列表 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ +export async function querySubjectView(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/careerTraining/train/view', { + params, + }); +} + From d8493132db77994fe0fbb37dc18bc129f6618fc1 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Wed, 16 Feb 2022 17:08:23 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E3=80=81=E9=94=99=E8=AF=AF=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/training/option/index.tsx | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index c826f68..f38c5fe 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -155,6 +155,14 @@ const TableList: React.FC = () => { dataIndex: 'train_name', valueType: 'text', hideInSearch: true, + formItemProps: { + rules: [ + { + required: true, + message: '请输入培训名称', + }, + ] + }, }, { title: '培训对象', @@ -163,6 +171,14 @@ const TableList: React.FC = () => { fieldProps: { mode: "multiple" }, + formItemProps: { + rules: [ + { + required: true, + message: '请选择培训对象', + }, + ] + }, dataIndex: 'org_names', request: async () => { const Value = await queryValueByKey({}); @@ -188,6 +204,14 @@ const TableList: React.FC = () => { hideInTable: true, hideInForm: false, hideInSearch: false, + formItemProps: { + rules: [ + { + required: true, + message: '请选择主题', + }, + ] + }, request: async () => { const { data: Items } = await querySubjectList({ page_size: 1000 }); // console.log(Items, ')))'); @@ -227,6 +251,14 @@ const TableList: React.FC = () => { hideInTable: true, hideInSearch: false, renderText: (val: string) => `${val}`, + formItemProps: { + rules: [ + { + required: true, + message: '请选择培训时间', + }, + ] + }, }, { title: '学时安排', @@ -419,6 +451,8 @@ const TableList: React.FC = () => { if (res.code === 2000) { handleModalVisible(false); actionRef.current?.reloadAndRest?.(); + } else { + message.error(res.msg); } }} @@ -536,6 +570,8 @@ const TableList: React.FC = () => { if (res.code === 2000) { handleUpdateModalVisible(false); actionRef.current?.reloadAndRest?.(); + } else { + message.error(res.msg); } }} From 2690f60e118dde64d828cac16d793397fdfca203 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Wed, 16 Feb 2022 17:34:57 +0800 Subject: [PATCH 3/9] fix --- admin/src/pages/course/option/index.tsx | 12 +++++--- .../questionbank/components/AnswersEditor.tsx | 29 +++++++------------ admin/src/pages/questionbank/style.less | 5 ++++ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 4328530..fa313e5 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -44,7 +44,7 @@ const handleAdd = async (fields: TableListItem) => { */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const hide = message.loading('正在配置'); - +console.log('fields',fields) try { await saveCourse({ ...currentRow, @@ -286,7 +286,7 @@ const CourseList: React.FC = () => { hideInForm: true, hideInSearch: true, width: 100, - renderText: (val: string) => `${val}M`, + renderText: (val: string) => `${val} 字节`, formItemProps: { // 参照 https://ant.design/components/form-cn/#Rule rules: [ @@ -600,14 +600,18 @@ const CourseList: React.FC = () => { labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onFinish={async (values) => { - alert(0) + console.log('values', values) console.log('currentRow', currentRow) + //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; + //console.log('url', url) await handleUpdate({ ...values, + attachment_filesize: attachment_json?.size || 0, // Bit 字节 course_id: currentRow?.course_id, - //attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0, 2)}/${uuid}.m3u8"}` + attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}` }); handleUpdateModalVisible(false); // 隐藏编辑窗口 + actionRef.current?.reloadAndRest?.(); console.log(values); }} submitter={{ diff --git a/admin/src/pages/questionbank/components/AnswersEditor.tsx b/admin/src/pages/questionbank/components/AnswersEditor.tsx index 62a5282..73e7558 100644 --- a/admin/src/pages/questionbank/components/AnswersEditor.tsx +++ b/admin/src/pages/questionbank/components/AnswersEditor.tsx @@ -17,7 +17,7 @@ import { queryQuestionById, queryQuestionList, queryQuestionType } from '@/pages import ProForm, { ProFormSelect } from '@ant-design/pro-form'; import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; - +const labels = ['A','B','C','D','E','F','G','H','I','J']; // 默认10个 //const { Paragraph } = Typography; const formItemLayout = { @@ -40,13 +40,14 @@ console.log('first'); const AnswersSelector = () => { return ( - { if (!names || names.length < 2) { - return Promise.reject(new Error('At least 2 passengers')); + return Promise.reject(new Error('至少填写2个选项')); } }, }, @@ -56,24 +57,24 @@ const AnswersSelector = () => { <> {fields.map((field, index) => ( - + {fields.length > 1 ? ( { - diff --git a/admin/src/pages/questionbank/style.less b/admin/src/pages/questionbank/style.less index 9c2feb3..25108de 100644 --- a/admin/src/pages/questionbank/style.less +++ b/admin/src/pages/questionbank/style.less @@ -1,4 +1,9 @@ @import '~antd/es/style/themes/default.less'; +:global { + .anticon.anticon-minus-circle.dynamic-delete-button{ + padding: 10px; + } +} .questionbank{ :global { .ant-list-split.ant-list-something-after-last-item .ant-spin-container > .ant-list-items > .ant-list-item:last-child{ From 4c1d2152a5527d86611a25217106eba22ccd0e99 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Thu, 17 Feb 2022 07:59:45 +0800 Subject: [PATCH 4/9] fix delete --- admin/src/pages/course/option/index.tsx | 16 +++++++---- admin/src/pages/course/subject/index.tsx | 21 ++++++++------ admin/src/pages/course/subject/service.ts | 11 ++++++++ admin/src/pages/examination/option/index.tsx | 17 ++++++++++- admin/src/pages/examination/service.ts | 10 +++++-- .../pages/examinationrules/normal/index.tsx | 16 ++++++++--- admin/src/pages/training/option/index.tsx | 28 +++++++++++++------ admin/src/pages/training/option/service.ts | 4 ++- 8 files changed, 92 insertions(+), 31 deletions(-) diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index fa313e5..d73c16a 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -70,11 +70,15 @@ const handleRemove = async (selectedRows: TableListItem[]) => { if (!selectedRows) return true; console.log('key', selectedRows); try { - await removeCourse({ + const {code, msg} = await removeCourse({ key: selectedRows.map((row) => row.key), }); hide(); - message.success('删除成功,即将刷新'); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } return true; } catch (error) { console.log('error', error) @@ -84,7 +88,6 @@ const handleRemove = async (selectedRows: TableListItem[]) => { } }; - const CourseList: React.FC = () => { /** 新建窗口的弹窗 */ @@ -333,7 +336,7 @@ const CourseList: React.FC = () => { , { + onClick={ () => { handleRemove([{ key: record?.course_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) setSelectedRows([]); actionRef.current?.reloadAndRest?.(); @@ -442,9 +445,12 @@ const CourseList: React.FC = () => { { - playerRef.current?.pause(); + //playerRef?.current?.ended(); + playerRef?.current?.dispose(); + //videoRef.current.play() console.log('playerRef:', playerRef.current) setCurrentRow(undefined); // 设置当前行 diff --git a/admin/src/pages/course/subject/index.tsx b/admin/src/pages/course/subject/index.tsx index aaf5596..b241e89 100644 --- a/admin/src/pages/course/subject/index.tsx +++ b/admin/src/pages/course/subject/index.tsx @@ -121,7 +121,7 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = }; /** - * 删除节点 + * 删除主题 * * @param selectedRows */ @@ -130,11 +130,15 @@ const handleRemove = async (selectedRows: TableListItem[]) => { if (!selectedRows) return true; try { - await removeSubject({ + const {code, msg} = await removeSubject({ key: selectedRows.map((row) => row.key), }); hide(); - message.success('删除成功,即将刷新'); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } return true; } catch (error) { hide(); @@ -282,11 +286,12 @@ const TableList: React.FC = () => { 复制 , { - // handleCopyItem({}); - }} - > + key="remove" + onClick={ () => { + handleRemove([{ key: record?.subject_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }}> 删除 , ], diff --git a/admin/src/pages/course/subject/service.ts b/admin/src/pages/course/subject/service.ts index e4a392c..5b4d863 100644 --- a/admin/src/pages/course/subject/service.ts +++ b/admin/src/pages/course/subject/service.ts @@ -147,3 +147,14 @@ export async function saveChapter(data: Record, options?: Record) { + console.log('data:::', data); + return request>('/dsideal_yy/ypt/careerTraining/subject/deleteSubject', { + data: { subject_id: data?.key[0] }, // 当前接口不支持批量操作 + method: 'POST', + requestType: 'form', + ...(options || {}), + }); +} \ No newline at end of file diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index f507956..87b19ea 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -317,7 +317,13 @@ const ExaminationList: React.FC = () => { > 编辑 , - + { + handleRemove([{ key: record?.examination_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }}> 删除 , { labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onFinish={async (values) => { + console.log('values', values); + //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; + //console.log('url', url) + await handleUpdate({ + ...values, + examination_id: currentRow?.examination_id, + }); + handleUpdateModalVisible(false); // 隐藏编辑窗口 + actionRef.current?.reloadAndRest?.(); console.log(values); }} submitter={{ diff --git a/admin/src/pages/examination/service.ts b/admin/src/pages/examination/service.ts index 8a5f0c3..e6577bf 100644 --- a/admin/src/pages/examination/service.ts +++ b/admin/src/pages/examination/service.ts @@ -81,14 +81,17 @@ export async function updateExamination(data: Record, options?: Rec }); } -/** 删除考试 POST /dsideal_yy/ypt/careerTraining/course/delete */ +/** 删除考试 */ export async function removeExamination(data: { key: number[] }, options?: Record) { - return request>('/dsideal_yy/ypt/careerTraining/course/delete', { - data, + console.log('data:::', data); + return request>('/dsideal_yy/zygh/training/examination/delExamination', { + data: { examination_id: data?.key[0] }, // 当前接口不支持批量操作 method: 'POST', + requestType: 'form', ...(options || {}), }); } + /** saveRegistration */ export async function saveRegistration(data: { key: number[] }, options?: Record) { return request>('/dsideal_yy/ypt/careerTraining/course/delete', { @@ -97,6 +100,7 @@ export async function saveRegistration(data: { key: number[] }, options?: Record ...(options || {}), }); } + /** removeRegistration */ export async function removeRegistration(data: { key: number[] }, options?: Record) { return request>('/dsideal_yy/ypt/careerTraining/course/delete', { diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 15a8642..321a370 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -41,7 +41,7 @@ const handleAdd = async (fields: TableListItem) => { * * @param fields */ -/* + const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { const hide = message.loading('正在配置'); @@ -51,15 +51,14 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; -*/ /** * 删除考试 @@ -394,6 +393,15 @@ const ExaminationRules: React.FC = () => { labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} onFinish={async (values) => { + console.log('currentRow', currentRow) + //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; + //console.log('url', url) + await handleUpdate({ + ...values, + examination_id: currentRow?.examination_id, + }); + handleUpdateModalVisible(false); // 隐藏编辑窗口 + actionRef.current?.reloadAndRest?.(); console.log(values); }} submitter={{ diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index f38c5fe..5a69301 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -57,29 +57,33 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = }; /** - * 删除培训 - * + * 删除培训(接口不支持批量) + * 参数为记录数组 * @param selectedRows */ -const handleRemove = async (selectedRows: TableListItem[]) => { + const handleRemove = async (selectedRows: TableListItem[]) => { const hide = message.loading('正在删除'); if (!selectedRows) return true; - + console.log('key', selectedRows); try { - await removeTrain({ + const {code, msg} = await removeTrain({ key: selectedRows.map((row) => row.key), }); hide(); - message.success('删除成功,即将刷新'); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } return true; } catch (error) { + console.log('error', error) hide(); message.error('删除失败,请重试'); return false; } }; - interface OrgTreeForOaItem { id?: number; pId?: number; @@ -300,9 +304,15 @@ const TableList: React.FC = () => { > 编辑 , - + { + handleRemove([{ key: record?.train_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }}> 删除 - , + , ], }, ]; diff --git a/admin/src/pages/training/option/service.ts b/admin/src/pages/training/option/service.ts index 7ccf12c..56f5612 100644 --- a/admin/src/pages/training/option/service.ts +++ b/admin/src/pages/training/option/service.ts @@ -41,9 +41,11 @@ export async function saveTrain(data: Record, options?: Record) { + console.log('data:::', data); return request>('/dsideal_yy/ypt/careerTraining/train/delete', { - data, + data: { train_id: data?.key[0] }, // 当前接口不支持批量操作 method: 'POST', + requestType: 'form', ...(options || {}), }); } From b4b3a2af4215258066664e2b37493eaca50b2e21 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Thu, 17 Feb 2022 09:40:25 +0800 Subject: [PATCH 5/9] fix del bug --- admin/src/pages/examination/option/index.tsx | 8 +- admin/src/pages/examination/service.ts | 5 +- .../examinationrules/attestation/index.tsx | 18 +- .../pages/examinationrules/normal/index.tsx | 181 ++---------------- .../pages/examinationrules/normal/service.ts | 13 +- admin/src/pages/examinationrules/service.ts | 11 ++ 6 files changed, 54 insertions(+), 182 deletions(-) diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index 87b19ea..68d63cb 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -16,6 +16,7 @@ import UpdateForm from './components/UpdateForm'; import { querySubjectList, updateExamination, removeExamination, queryExaminationList, queryRulesList } from '../service'; import type { TableListItem, TableListPagination } from './data'; import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud'; +import { ConsoleMessage } from 'puppeteer-core'; @@ -48,14 +49,15 @@ const handleUpdate = async (fields: FormValueType) => { * * @param selectedRows */ -const handleRemove = async (selectedRows: TableListItem[]) => { +const handleRemove = async (selectedRows: TableListItem[], currentRow) => { + console.log('selectedRows', selectedRows) const hide = message.loading('正在删除'); if (!selectedRows) return true; try { await removeExamination({ key: selectedRows.map((row) => row.key), - }); + },currentRow); hide(); message.success('删除成功,即将刷新'); return true; @@ -320,7 +322,7 @@ const ExaminationList: React.FC = () => { { - handleRemove([{ key: record?.examination_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + handleRemove([{ key: record?.examination_id }], record); // 调用批量删除函数(如果接口不支持批量需要在service中处理) setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> diff --git a/admin/src/pages/examination/service.ts b/admin/src/pages/examination/service.ts index e6577bf..a93e010 100644 --- a/admin/src/pages/examination/service.ts +++ b/admin/src/pages/examination/service.ts @@ -82,13 +82,12 @@ export async function updateExamination(data: Record, options?: Rec } /** 删除考试 */ -export async function removeExamination(data: { key: number[] }, options?: Record) { +export async function removeExamination(data: { key: number[]}, options?: Record) { console.log('data:::', data); return request>('/dsideal_yy/zygh/training/examination/delExamination', { - data: { examination_id: data?.key[0] }, // 当前接口不支持批量操作 + data: { examination_id: data?.key[0], rules_id: options?.rules_id}, // 当前接口不支持批量操作 method: 'POST', requestType: 'form', - ...(options || {}), }); } diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 67a96b6..7b2b23c 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -10,7 +10,7 @@ import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } from '@ant-de import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import ProDescriptions from '@ant-design/pro-descriptions'; import type { FormValueType } from './components/UpdateForm'; -import { querySubjectList, saveExamination, removeExamination, queryRulesList } from '../service'; +import { querySubjectList, saveExamination, removeExamination, queryRulesList, removeRules } from '../service'; import type { TableListItem, TableListPagination } from './data'; import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud'; @@ -60,18 +60,18 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = }; /** - * 删除考试 + * 删除考试规则 * * @param selectedRows */ -const handleRemove = async (selectedRows: TableListItem[]) => { + const handleRemove = async (selectedRows: TableListItem[], currentRow) => { const hide = message.loading('正在删除'); if (!selectedRows) return true; try { - await removeExamination({ + await removeRules({ key: selectedRows.map((row) => row.key), - }); + }, currentRow); hide(); message.success('删除成功,即将刷新'); return true; @@ -213,7 +213,13 @@ const ExaminationRules: React.FC = () => { > 编辑 , - + { + handleRemove([{ key: record?.id }], record); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }}> 删除 , { - const hide = message.loading('正在添加'); - - try { - await saveExamination({ ...fields }); - hide(); - message.success('添加成功'); - return true; - } catch (error) { - hide(); - message.error('添加失败请重试!'); - return false; - } -}; - -/** - * 更新考试 - * - * @param fields - */ - -const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); - - try { - await saveExamination({ - ...currentRow, - ...fields, - }); - hide(); - message.success('操作成功'); - return true; - } catch (error) { - hide(); - message.error('操作失败请重试!'); - return false; - } -}; - -/** - * 删除考试 + * 删除考试规则 * * @param selectedRows */ -const handleRemove = async (selectedRows: TableListItem[]) => { +const handleRemove = async (selectedRows: TableListItem[], currentRow) => { const hide = message.loading('正在删除'); if (!selectedRows) return true; try { - await removeExamination({ + await removeRules({ key: selectedRows.map((row) => row.key), - }); + }, currentRow); hide(); message.success('删除成功,即将刷新'); return true; @@ -84,12 +39,7 @@ const handleRemove = async (selectedRows: TableListItem[]) => { }; const ExaminationRules: React.FC = () => { - /** 更新窗口的弹窗 */ - const [createModalVisible, handleCreateModalVisible] = useState(false); - 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([]); @@ -209,12 +159,17 @@ const ExaminationRules: React.FC = () => { key="update" onClick={() => { history.push('/examinationrules/normal/step/' + record.id) - }} > 编辑 , - + { + handleRemove([{ key: record?.id }], record); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + setSelectedRows([]); + actionRef.current?.reloadAndRest?.(); + }}> 删除 , { )} - { - setCurrentRow(undefined); // 设置当前行 - handleDetailModalVisible(false); - }} - footer={null} - centered - >{console.log('currentRow', currentRow)} - {currentRow?.name && ( - - column={2} - /* title={currentRow?.name} */ - dataSource={currentRow} - /* - request={async () => ({ - data: currentRow || {}, - })}*/ - params={{ - id: currentRow?.examination_id, - }} - columns={ - columns - //columns.slice(0, columns.length - 1) as ProDescriptionsItemProps[] - } - /> - )} - - - { - 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} - /> - - - { - handleUpdateModalVisible(false); - }} - footer={null} - > - {currentRow?.name && ( - - layout="horizontal" - layoutType="Form" - labelCol={{ span: 8 }} - wrapperCol={{ span: 12 }} - onFinish={async (values) => { - console.log('currentRow', currentRow) - //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; - //console.log('url', url) - await handleUpdate({ - ...values, - examination_id: currentRow?.examination_id, - }); - handleUpdateModalVisible(false); // 隐藏编辑窗口 - actionRef.current?.reloadAndRest?.(); - console.log(values); - }} - submitter={{ - render: (props, doms) => ( - - - {doms} - - - ), - }} - // action = '' - title="编辑" - columns={getInitialValues(columns, currentRow)} - /> - )} - - ); }; diff --git a/admin/src/pages/examinationrules/normal/service.ts b/admin/src/pages/examinationrules/normal/service.ts index c8c4457..6dcc064 100644 --- a/admin/src/pages/examinationrules/normal/service.ts +++ b/admin/src/pages/examinationrules/normal/service.ts @@ -28,7 +28,7 @@ export async function querySubjectList(params: { }); } - +/dsideal_yy/zygh/training/rules/delRules @@ -67,3 +67,14 @@ export async function updateFakeList( }, }); } + +/** 删除考试规则 */ +export async function removeRules(data: { key: number[] }, options?: Record) { + console.log('data:::', data); + return request>('/dsideal_yy/zygh/training/rules/delRules', { + data: { id: data?.key[0], rules_type: options?.rules_type, subject_id: options?.subject_id}, // 当前接口不支持批量操作 + method: 'POST', + requestType: 'form', + ...(options || {}), + }); +} \ No newline at end of file diff --git a/admin/src/pages/examinationrules/service.ts b/admin/src/pages/examinationrules/service.ts index b630720..d4f6bbb 100644 --- a/admin/src/pages/examinationrules/service.ts +++ b/admin/src/pages/examinationrules/service.ts @@ -130,4 +130,15 @@ export async function queryRegistrationList( }, ...(options || {}), }); +} + +/** 删除考试规则 */ +export async function removeRules(data: { key: number[] }, options?: Record) { + console.log('data:::', data); + return request>('/dsideal_yy/zygh/training/rules/delRules', { + data: { id: data?.key[0], rules_type: options?.rules_type, subject_id: options?.subject_id}, // 当前接口不支持批量操作 + method: 'POST', + requestType: 'form', + ...(options || {}), + }); } \ No newline at end of file From 764e73196da4e43bb978e08ec27c457db82ee493 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Thu, 17 Feb 2022 11:34:43 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7charts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/package.json | 2 +- admin/src/pages/demo/index.tsx | 115 ++++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/admin/package.json b/admin/package.json index fa91771..4150cdf 100644 --- a/admin/package.json +++ b/admin/package.json @@ -49,7 +49,7 @@ "not ie <= 10" ], "dependencies": { - "@ant-design/charts": "^0.9.4", + "@ant-design/charts": "^1.3.5", "@ant-design/icons": "^4.5.0", "@ant-design/pro-card": "^1.18.23", "@ant-design/pro-descriptions": "^1.6.8", diff --git a/admin/src/pages/demo/index.tsx b/admin/src/pages/demo/index.tsx index 4f9fba5..9220aa7 100644 --- a/admin/src/pages/demo/index.tsx +++ b/admin/src/pages/demo/index.tsx @@ -1,8 +1,9 @@ import { DingdingOutlined, UploadOutlined } from '@ant-design/icons'; import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm } from 'antd'; -import { Fragment, useRef, useState } from 'react'; +import { Fragment, useEffect, useRef, useState } from 'react'; import { GridContent } from '@ant-design/pro-layout'; - +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' @@ -16,7 +17,102 @@ const { Step } = Steps; 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(false); const saveInputRef = useRef(); //const currentRow = {course_name:'课程0001'}; @@ -27,6 +123,17 @@ export default () => { {dataIndex: "course_name", hideInDescriptions: false, hideInForm: false,hideInSearch: true,hideInTable: false, title: "课程名称1", valueType: "text"}, {} ]; + const [chartData, setChartData] = useState([data, data]); + useEffect(() => { + setInterval(() => { + setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]); + }, 1000); + }, []); + const config = { + data: chartData, + xField: "year", + yField: ["value", "count"] + }; return( <> @@ -103,6 +210,8 @@ export default () => { Delete + + ) }; From c14e07b1917aae3e5e61678196b3e73fb2b5a1e1 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Fri, 18 Feb 2022 10:20:05 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/package.json | 2 +- .../analysis/components/AchievementRow.tsx | 63 ++++---- .../analysis/components/CertificateRow.tsx | 72 ++++----- .../analysis/components/IntroduceRow.tsx | 2 +- .../history/analysis/components/TrainCard.tsx | 144 ++++++++---------- admin/src/pages/history/analysis/service.ts | 30 ++++ admin/src/pages/training/option/index.tsx | 16 +- admin/src/pages/training/option/service.ts | 2 +- 8 files changed, 168 insertions(+), 163 deletions(-) diff --git a/admin/package.json b/admin/package.json index fa91771..4150cdf 100644 --- a/admin/package.json +++ b/admin/package.json @@ -49,7 +49,7 @@ "not ie <= 10" ], "dependencies": { - "@ant-design/charts": "^0.9.4", + "@ant-design/charts": "^1.3.5", "@ant-design/icons": "^4.5.0", "@ant-design/pro-card": "^1.18.23", "@ant-design/pro-descriptions": "^1.6.8", diff --git a/admin/src/pages/history/analysis/components/AchievementRow.tsx b/admin/src/pages/history/analysis/components/AchievementRow.tsx index dd929b5..5761c77 100644 --- a/admin/src/pages/history/analysis/components/AchievementRow.tsx +++ b/admin/src/pages/history/analysis/components/AchievementRow.tsx @@ -1,15 +1,13 @@ /** 历次考试成绩统计 */ import { PlusOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer } from 'antd'; +import { Button } from 'antd'; import React, { useState, useRef } from 'react'; -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 { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form'; -import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; -import ProDescriptions from '@ant-design/pro-descriptions'; -import { rule, } from '../service'; + +import { getExaminationPersonStatistics } from '../service'; //import type { TableListItem, TableListPagination } from '../data'; @@ -29,7 +27,7 @@ const TableList: React.FC = () => { { title: '序号', key: 'index', - valueType: 'indexBorder', + valueType: 'indexBorder', width: 48, }, { @@ -72,33 +70,38 @@ const TableList: React.FC = () => { hideInForm: true, renderText: (val: string) => `${val}%`, }, - + ]; return ( -
+
- headerTitle="历次考试成绩统计" - actionRef={actionRef} - rowKey="key" - search={false} - options={false} - toolBarRender={() => [ - , - ]} - request={rule} - columns={columns} - rowSelection={false} - /> -
+ headerTitle="历次考试成绩统计" + actionRef={actionRef} + rowKey="key" + search={false} + options={false} + toolBarRender={() => [ + , + ]} + request={async (value) => { + const _data = await getExaminationPersonStatistics({ sort_type: 0, sort_colum: 1 }); + return { + data: _data?.list, + }; + }} + columns={columns} + rowSelection={false} + /> +
); }; diff --git a/admin/src/pages/history/analysis/components/CertificateRow.tsx b/admin/src/pages/history/analysis/components/CertificateRow.tsx index 424b421..58f11a3 100644 --- a/admin/src/pages/history/analysis/components/CertificateRow.tsx +++ b/admin/src/pages/history/analysis/components/CertificateRow.tsx @@ -5,13 +5,12 @@ import React, { useState, useRef } from 'react'; 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 { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form'; -import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; -import ProDescriptions from '@ant-design/pro-descriptions'; +import { getCredentialPersonStatistics } from '../service'; import { rule } from '../service'; import type { TableListItem, TableListPagination } from '../data'; -import { FormValueType } from '@/pages/ListTableList2/components/UpdateForm2'; +import type { FormValueType } from '@/pages/ListTableList2/components/UpdateForm2'; +import cookie from 'react-cookies'; /** * 添加 @@ -96,54 +95,41 @@ const TableList: React.FC = () => { { title: '序号', key: 'index', - valueType: 'indexBorder', + valueType: 'indexBorder', width: 48, }, { title: '市州', - dataIndex: 'name', + dataIndex: 'city_name', valueType: 'text', }, { title: '参加学习人数', - dataIndex: 'callNo', - sorter: true, + dataIndex: 'learning_person_number', + // sorter: true, hideInForm: true, renderText: (val: string) => `${val}`, }, { title: '学习完成率', - dataIndex: 'callNo', - sorter: true, + dataIndex: 'completion_rate', + // sorter: true, hideInForm: true, renderText: (val: string) => `${val}%`, }, { title: '取得资质证书人数', - sorter: true, - dataIndex: 'callNo', + sorter: false, + dataIndex: 'count', valueType: 'text', - renderFormItem: (item, { defaultRender, ...rest }, form) => { - const status = form.getFieldValue('status'); - - if (`${status}` === '0') { - return false; - } - - if (`${status}` === '3') { - return ; - } - - return defaultRender(item); - }, }, { title: '取得资质比例', - sorter: true, - dataIndex: 'callNo', + // sorter: true, + dataIndex: 'credential_rate', valueType: 'text', - renderText: (val: string) => `${Number(val) / 10}%`, - }, + renderText: (val: string) => `${val ? val : 0}%`, + }, ]; return ( @@ -155,18 +141,22 @@ const TableList: React.FC = () => { rowKey="key" search={false} options={false} - toolBarRender={() => [ - , - ]} - request={rule} + pagination={false} + request={async (value) => { + const _data = await getCredentialPersonStatistics({ province_id: cookie.load('background_province_id') }); + return { + data: _data?.list, + }; + }} + toolBarRender={(record) => { + console.log(record, 'a]]') + return [ + + 导出名单 + , + ] + }} + columns={columns} rowSelection={false} /> diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 434504b..35fcbba 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -63,7 +63,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat // org_type: 2, // get_next: 1 // }); - console.log(areaData); + console.log(e); } diff --git a/admin/src/pages/history/analysis/components/TrainCard.tsx b/admin/src/pages/history/analysis/components/TrainCard.tsx index 3569e71..e07d584 100644 --- a/admin/src/pages/history/analysis/components/TrainCard.tsx +++ b/admin/src/pages/history/analysis/components/TrainCard.tsx @@ -1,98 +1,79 @@ -import { Card, Col, DatePicker, Row, Tabs } from 'antd'; -import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; -import type moment from 'moment'; -import { Column } from '@ant-design/charts'; +import { Card, Col, Row, Tabs } from 'antd'; +import { DualAxes } from '@ant-design/plots'; -import numeral from 'numeral'; -import type { DataItem } from '../data.d'; import styles from '../style.less'; - -type RangePickerValue = RangePickerProps['value']; +// import { useRequest } from 'react'; +import { getCredentialPersonStatistics } from '../service'; +import cookie from 'react-cookies'; +import { useRequest } from 'umi'; export type TimeType = 'today' | 'week' | 'month' | 'year'; -const { RangePicker } = DatePicker; + const { TabPane } = Tabs; +// const credentialPersonStatistics = await getCredentialPersonStatistics({ +// province_id: cookie.load('background_province_id') +// }); + + +const SalesCard = () => { + const { loading: courseBrowseTimesLoading, data: credentialPersonStatistics = null } = useRequest(() => getCredentialPersonStatistics({ + province_id: cookie.load('background_province_id') + }), { + formatResult: (result) => { + return result.list; + } + }); + const data = [] + // console.log(credentialPersonStatistics, 'credentialPersonStatistics') -const SalesCard = ({ - rangePickerValue, - salesData, - isActive, - handleRangePickerChange, - loading, - selectDate, -}: { - rangePickerValue: RangePickerValue; - isActive: (key: TimeType) => string; - salesData: DataItem[]; - loading: boolean; - handleRangePickerChange: (dates: RangePickerValue, dateStrings: [string, string]) => void; - selectDate: (key: TimeType) => void; -}) => ( - + credentialPersonStatistics?.map((e, i) => { + + data.push({ + city: e.city_name, + count: e.count, + credential_rate: e.credential_rate + }) + }) + + const config = { + data: [data, data], + xField: 'city', + yField: ['count', 'credential_rate'], + yAxis: [{ + title: { + text: '资质证书人数', + }, + }, { + title: { + text: '证书比例', + }, + }], + geometryOptions: [ + { + geometry: 'column', + }, + { + + geometry: 'line', + lineStyle: { + lineWidth: 2, + }, + }, + ], + }; + return ( - } size="large" tabBarStyle={{ marginBottom: 24 }} > - +
- + +
@@ -101,6 +82,7 @@ const SalesCard = ({
-); + ) +}; export default SalesCard; diff --git a/admin/src/pages/history/analysis/service.ts b/admin/src/pages/history/analysis/service.ts index f07cf0f..efb5cc6 100644 --- a/admin/src/pages/history/analysis/service.ts +++ b/admin/src/pages/history/analysis/service.ts @@ -65,6 +65,36 @@ export async function getMainBranchSchool(params: { params, }); } +/** + * 市获取资质证书 + * /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics + * @param params + * @returns + */ +export async function getCredentialPersonStatistics(params: { + province_id: { province_id: number }; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics', { + params, + }); +} +/** + * 市获取资质证书 + * /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics + * @param params + * @returns + */ +export async function getExaminationPersonStatistics(params: { + page_number: number, + page_size: number, + sort_colum: number, + sort_type: number, +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/zygh/training/statistics/getExaminationPersonStatistics', { + params, + }); +} /* diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index 5a69301..91986e6 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -61,20 +61,20 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = * 参数为记录数组 * @param selectedRows */ - const handleRemove = async (selectedRows: TableListItem[]) => { +const handleRemove = async (selectedRows: TableListItem[]) => { const hide = message.loading('正在删除'); if (!selectedRows) return true; console.log('key', selectedRows); try { - const {code, msg} = await removeTrain({ + const { code, msg } = await removeTrain({ key: selectedRows.map((row) => row.key), }); hide(); - if(code === 2000 ){ + if (code === 2000) { message.success('删除成功,即将刷新'); - }else{ + } else { message.warning(msg); - } + } return true; } catch (error) { console.log('error', error) @@ -217,7 +217,7 @@ const TableList: React.FC = () => { ] }, request: async () => { - const { data: Items } = await querySubjectList({ page_size: 1000 }); + const { data: Items } = await querySubjectList(); // console.log(Items, ')))'); const sinfo = [] @@ -306,13 +306,13 @@ const TableList: React.FC = () => { , { + onClick={() => { handleRemove([{ key: record?.train_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> 删除 - , + , ], }, ]; diff --git a/admin/src/pages/training/option/service.ts b/admin/src/pages/training/option/service.ts index 56f5612..54fb8c5 100644 --- a/admin/src/pages/training/option/service.ts +++ b/admin/src/pages/training/option/service.ts @@ -89,7 +89,7 @@ export async function querySubjectList(params: { page_size: number; //count: number; }): Promise<{ data: { list: CardListItemDataType[] } }> { - return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', { + return request('/dsideal_yy/ypt/careerTraining/component/listSubject', { params, }); } From 6e3021b5887d72dfe7bc804847dd87e1efe608f7 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Fri, 18 Feb 2022 16:24:41 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../analysis/components/AchievementRow.tsx | 47 +++---- .../analysis/components/CertificateRow.tsx | 73 +---------- .../analysis/components/IntroduceRow.tsx | 117 +++++++++++++----- admin/src/pages/history/analysis/service.ts | 12 +- 4 files changed, 115 insertions(+), 134 deletions(-) diff --git a/admin/src/pages/history/analysis/components/AchievementRow.tsx b/admin/src/pages/history/analysis/components/AchievementRow.tsx index 5761c77..de97dbd 100644 --- a/admin/src/pages/history/analysis/components/AchievementRow.tsx +++ b/admin/src/pages/history/analysis/components/AchievementRow.tsx @@ -1,5 +1,5 @@ /** 历次考试成绩统计 */ -import { PlusOutlined } from '@ant-design/icons'; +import { DownloadOutlined, PlusOutlined } from '@ant-design/icons'; import { Button } from 'antd'; import React, { useState, useRef } from 'react'; @@ -31,41 +31,27 @@ const TableList: React.FC = () => { width: 48, }, { - title: '生涯课程', - dataIndex: 'name', + title: '考试名称', + dataIndex: 'examination_name', valueType: 'textarea', }, { - title: '学习人数', - dataIndex: 'callNo', + title: '报名人数', + dataIndex: 'apply_count', sorter: true, hideInForm: true, renderText: (val: string) => `${val}`, }, { - title: '学习完成率', - dataIndex: 'callNo', - sorter: true, - hideInForm: true, - renderText: (val: string) => `${val}%`, - }, - { - title: '考试报名人数', - dataIndex: 'callNo', - sorter: true, - hideInForm: true, - renderText: (val: string) => `${val}`, - }, - { - title: '考试通过人数', - dataIndex: 'callNo', + title: '通过人数', + dataIndex: 'pass_count', sorter: true, hideInForm: true, renderText: (val: string) => `${val}`, }, { - title: '考试通过率', - dataIndex: 'callNo', + title: '比例', + dataIndex: 'pass_rate', sorter: true, hideInForm: true, renderText: (val: string) => `${val}%`, @@ -82,20 +68,15 @@ const TableList: React.FC = () => { search={false} options={false} toolBarRender={() => [ - , ]} request={async (value) => { - const _data = await getExaminationPersonStatistics({ sort_type: 0, sort_colum: 1 }); + console.log(value, "value11") + const _data = await getExaminationPersonStatistics({ ...value, current: value.page_number, sort_type: 2, sort_colum: 1 }); return { - data: _data?.list, + data: _data?.table_List, }; }} columns={columns} diff --git a/admin/src/pages/history/analysis/components/CertificateRow.tsx b/admin/src/pages/history/analysis/components/CertificateRow.tsx index 58f11a3..f05b242 100644 --- a/admin/src/pages/history/analysis/components/CertificateRow.tsx +++ b/admin/src/pages/history/analysis/components/CertificateRow.tsx @@ -1,5 +1,5 @@ /** 各市州资质证书统计 */ -import { PlusOutlined } from '@ant-design/icons'; +import { DownloadOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, message, Input, Drawer, Col, Row } from 'antd'; import React, { useState, useRef } from 'react'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; @@ -12,71 +12,7 @@ import type { TableListItem, TableListPagination } from '../data'; import type { FormValueType } from '@/pages/ListTableList2/components/UpdateForm2'; import cookie from 'react-cookies'; -/** - * 添加 - * - * @param fields - */ -const handleAdd = async (fields: TableListItem) => { - const hide = message.loading('正在添加'); - try { - await addRule({ ...fields }); - hide(); - message.success('添加成功'); - return true; - } catch (error) { - hide(); - message.error('添加失败请重试!'); - return false; - } -}; -/** - * 更新节点 - * - * @param fields - */ - -const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); - - try { - await updateRule({ - ...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 removeRule({ - key: selectedRows.map((row) => row.key), - }); - hide(); - message.success('删除成功,即将刷新'); - return true; - } catch (error) { - hide(); - message.error('删除失败,请重试'); - return false; - } -}; const topColResponsiveProps = { xs: 24, @@ -148,12 +84,11 @@ const TableList: React.FC = () => { data: _data?.list, }; }} - toolBarRender={(record) => { - console.log(record, 'a]]') + toolBarRender={() => { return [ - + , ] }} diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 35fcbba..a6b5e55 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -1,15 +1,16 @@ import { useEffect, useRef, useState } from 'react'; import { TinyArea, TinyColumn } from '@ant-design/charts'; -import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic } from 'antd'; +import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic, Button } from 'antd'; import numeral from 'numeral'; import { ChartCard, Field } from './Charts'; import type { DataItem } from '../data.d'; -import { getAsyncOrgTree, getMainBranchSchool } from '../service'; +import { getAsyncOrgTree, getEduUnitList } from '../service'; const { Option } = Select; import styles from '../style.less'; import ProForm, { ProFormSelect } from '@ant-design/pro-form'; +import { useRequest } from 'umi'; const { RangePicker } = DatePicker; const topColResponsiveProps = { xs: 24, @@ -20,11 +21,7 @@ const topColResponsiveProps = { offset: 1, style: { marginBottom: 24 }, }; -const cityData = await getAsyncOrgTree({ - org_id: 100025, - org_type: 1, - get_next: 1 -}); + const layout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, @@ -34,12 +31,51 @@ const layout = { const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => { + const [provinceId, setProvinceId] = useState("100007") const [cityList, setCityList] = useState([]); const [areaList, setAreaList] = useState([]); + + const [schoolList, setSchoolList] = useState([]); + + const { loading: courseBrowseTimesLoading, data: eduUnitList = null } = useRequest(() => getEduUnitList({ + random_num: 277470, + area_id: provinceId, + edu_type: -1, + // main_school_id: 200125116, + // org_name:"", + org_type: 2, + pageNumber: 1, + pageSize: 1000, + school_type: -1, + showPassWord: true, + }), { + formatResult: (result) => { + return result.table_List; + } + }); + + + + + + + const [form] = Form.useForm(); + // eslint-disable-next-line react-hooks/exhaustive-deps - useEffect(() => { + useEffect(async () => { + const cityData = await getAsyncOrgTree({ + org_id: provinceId, + org_type: 1, + get_next: 1 + }); setCityList(cityData || []); + + + + + + }, []); @@ -50,20 +86,35 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat org_type: 2, get_next: 1 }); - form.setFieldsValue({ area: "" }) - // console.log(form.setFieldsValue({ area: "" }), 'form'); - + form.setFieldsValue({ area: 0 }) setAreaList(areaData || []); + + } const getSchoolData = async (e) => { - // const areaData = await getAsyncOrgTree({ - // org_id: e, - // org_type: 2, - // get_next: 1 - // }); - console.log(e); + console.log(e) + + + console.log(form.getFieldsValue('school'), 'school') + // try { + // schoolData = await getEduUnitList({ + // random_num: 277470, + // area_id: provinceId, + // edu_type: -1, + // // main_school_id: 200125116, + // org_name: e, + // org_type: 2, + // pageNumber: 1, + // pageSize: 1000, + // school_type: -1, + // showPassWord: true, + // }).then(); + // setSchoolList(schoolData || []) + // } catch (error) { + // // error.message; // "Oops!" + // } } @@ -94,11 +145,13 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat @@ -107,12 +160,14 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat @@ -126,18 +181,22 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat // value={this.state.value} // placeholder={this.props.placeholder} // style={this.props.style} - defaultActiveFirstOption={false} - showArrow={false} - filterOption={false} + // defaultActiveFirstOption={true} + showArrow={true} + filterOption={true} // onSearch={this.handleSearch} - // onChange={this.handleChange} + // onChange={getSchoolData} + + onSearch={(value) => getSchoolData(value)} notFoundContent={null} - > - {/* {options} */} - - + options={schoolList} + + /> + {console.log(schoolList, 'schoolList')} + + diff --git a/admin/src/pages/history/analysis/service.ts b/admin/src/pages/history/analysis/service.ts index efb5cc6..41ded79 100644 --- a/admin/src/pages/history/analysis/service.ts +++ b/admin/src/pages/history/analysis/service.ts @@ -53,15 +53,15 @@ export async function getAsyncOrgTree(params: { /** * 获取学校列表 - * /dsideal_yy/admin/new_base/getMainBranchSchool + * /dsideal_yy/ypt/sys/org/getEduUnitList * @param params * @returns */ -export async function getMainBranchSchool(params: { +export async function getEduUnitList(params: { page_size: number; //count: number; }): Promise<{ data: { list: CardListItemDataType[] } }> { - return request('/dsideal_yy/admin/new_base/getMainBranchSchool', { + return request('/dsideal_yy/ypt/sys/org/getEduUnitList', { params, }); } @@ -97,11 +97,17 @@ export async function getExaminationPersonStatistics(params: { } + + + + /* 获取云南省所有市列表: http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=100025&org_type=1&get_next=1 参数:org_id(云南省ID 100025),org_type(默认传1),get_next(默认传1) +/dsideal_yy/ypt/sys/org/getEduUnitList?random_num=277470&area_id=200125116&edu_type=-1&main_school_id=200125116&org_name=&org_type=2&pageNumber=1&pageSize=20&school_type=-1&showPassWord=true + 获取市区下的区列表: http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=200265&org_type=2&get_next=1 参数:org_id(市ID),org_type(默认传2),get_next(默认传1) From 2b698813be826bbea8e2907181b9003e09f65a30 Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Mon, 21 Feb 2022 09:17:07 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../analysis/components/IntroduceRow.tsx | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index a6b5e55..67f8748 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -92,29 +92,37 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat } + let timeout: NodeJS.Timeout | null; + + const getSchoolData = async (e, callback) => { + + // timeout = setTimeout(async () => { + try { + schoolData = await getEduUnitList({ + random_num: 277470, + area_id: provinceId, + edu_type: -1, + // main_school_id: 200125116, + org_name: e, + org_type: 2, + pageNumber: 1, + pageSize: 1000, + school_type: -1, + showPassWord: true, + }).then((e) => { + callback(e.table_List) + console.log(e.table_List); + setSchoolList(e.table_List || []) + + }); + } catch (error) { + // error.message; // "Oops!" + } + + // }, 500); + + // console.log(schoolList, 'schoolList 1'); - const getSchoolData = async (e) => { - console.log(e) - - - console.log(form.getFieldsValue('school'), 'school') - // try { - // schoolData = await getEduUnitList({ - // random_num: 277470, - // area_id: provinceId, - // edu_type: -1, - // // main_school_id: 200125116, - // org_name: e, - // org_type: 2, - // pageNumber: 1, - // pageSize: 1000, - // school_type: -1, - // showPassWord: true, - // }).then(); - // setSchoolList(schoolData || []) - // } catch (error) { - // // error.message; // "Oops!" - // } } @@ -186,14 +194,14 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat filterOption={true} // onSearch={this.handleSearch} // onChange={getSchoolData} - + fieldNames={{ value: "ORG_ID", label: "ORG_NAME" }} onSearch={(value) => getSchoolData(value)} notFoundContent={null} options={schoolList} /> - {console.log(schoolList, 'schoolList')} + {console.log(schoolList, 'schoolList111')}