From a284b05ab92518e6a0fec7f7d6ffb3534d55ddaa Mon Sep 17 00:00:00 2001 From: xialiang <1818147@qq.com> Date: Wed, 26 Jan 2022 15:40:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=80=83=E8=AF=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E3=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/config/config.ts | 10 +- .../examinationrules/attestation/index.tsx | 8 +- .../pages/examinationrules/normal/index.tsx | 8 +- .../examinationrules/normal/step/index.tsx | 97 +++++++++++-------- admin/src/pages/examinationrules/service.ts | 44 ++++----- 5 files changed, 94 insertions(+), 73 deletions(-) diff --git a/admin/config/config.ts b/admin/config/config.ts index 11f6fc6..a28c586 100644 --- a/admin/config/config.ts +++ b/admin/config/config.ts @@ -150,13 +150,19 @@ export default defineConfig({ component: './examinationrules/normal', }, { - name: '创建模拟考试', + name: '创建模拟考试规则', + icon: 'smile', + path: '/examinationrules/normal/step', + component: './examinationrules/normal/step', + hideInMenu: true, + }, + { + name: '编辑模拟考试规则', icon: 'smile', path: '/examinationrules/normal/step/:id', component: './examinationrules/normal/step', hideInMenu: true, }, - { name: '资质考试规则维护', icon: 'smile', diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 8b64c62..99483ab 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -116,7 +116,7 @@ const ExaminationRules: React.FC = () => { valueType: 'text', hideInTable: false, hideInForm: false, - hideInSearch: true, + hideInSearch: false, }, { title: '考试时长', @@ -143,8 +143,8 @@ const ExaminationRules: React.FC = () => { sorter: false, hideInTable: false, hideInForm: false, - hideInSearch: true, - renderText: (val: string) => `${val}`, + hideInSearch: false, + // renderText: (val: string) => `${val}`, }, { @@ -152,6 +152,7 @@ const ExaminationRules: React.FC = () => { dataIndex: 'sum_score', sorter: false, valueType: 'text', + hideInSearch: true, hideInForm: false, renderText: (val: string) => `${val}分`, }, @@ -160,6 +161,7 @@ const ExaminationRules: React.FC = () => { dataIndex: 'pass_score', sorter: false, valueType: 'text', + hideInSearch: true, hideInForm: false, renderText: (val: string) => `${val}`, }, diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 6978eeb..6436c7c 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -116,7 +116,7 @@ const ExaminationRules: React.FC = () => { valueType: 'text', hideInTable: false, hideInForm: false, - hideInSearch: true, + hideInSearch: false, }, { title: '考试时长', @@ -139,11 +139,11 @@ const ExaminationRules: React.FC = () => { { title: '创建日期', dataIndex: 'create_time', - valueType: 'text', + valueType: 'dateRange', sorter: false, hideInTable: false, hideInForm: false, - hideInSearch: true, + hideInSearch: false, renderText: (val: string) => `${val}`, }, @@ -153,6 +153,7 @@ const ExaminationRules: React.FC = () => { sorter: false, valueType: 'text', hideInForm: false, + hideInSearch: true, renderText: (val: string) => `${val}分`, }, { @@ -161,6 +162,7 @@ const ExaminationRules: React.FC = () => { sorter: false, valueType: 'text', hideInForm: false, + hideInSearch: true, renderText: (val: string) => `${val}`, }, { diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx index 518df60..8ecaf02 100644 --- a/admin/src/pages/examinationrules/normal/step/index.tsx +++ b/admin/src/pages/examinationrules/normal/step/index.tsx @@ -16,7 +16,7 @@ import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space, import { PageContainer } from '@ant-design/pro-layout'; import ProDescriptions from '@ant-design/pro-descriptions'; import styles from './index.less' -import { saveExamination, querySubjectList, queryRulesView } from '../../service'; +import { saveRules, querySubjectList, queryRulesView } from '../../service'; const waitTime = (time: number = 100) => { @@ -34,13 +34,19 @@ export default () => { const formRef = useRef(); const params = useParams(); console.log(params, 'params'); - if (params) { - const {data} = useRequest(async () => { - const { bean } = await queryRulesView(params); - return {data:bean} + let ruleData = {} + if (params.id) { + console.log(JSON.stringify(params), "878"); + + const { data } = useRequest(async () => { + const { bean } = await queryRulesView(params); + return { data: bean } }); - console.log('data1`11', data); + ruleData = data } + console.log(ruleData, 'ruleData'); + + return ( @@ -75,14 +81,18 @@ export default () => { description: false, }} onFinish={async (fileds) => { - console.log(fileds, 'fileds'); - await saveExamination({ + if (params.id) { + fileds = { ...fileds, id: params.id } + } + console.log(fileds, 'fileds', params); + + await saveRules({ ...fileds, b_use: 0, rules_type: 0, }); - await waitTime(2000); + // await waitTime(2000); return true; }} @@ -90,39 +100,44 @@ export default () => { > - - - { - 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="关联主题" - /> - + {ruleData && ( + <> + + { + 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="关联主题" + /> + + + )} diff --git a/admin/src/pages/examinationrules/service.ts b/admin/src/pages/examinationrules/service.ts index 1a97b54..7e282f8 100644 --- a/admin/src/pages/examinationrules/service.ts +++ b/admin/src/pages/examinationrules/service.ts @@ -28,29 +28,12 @@ export async function queryRulesList( }); } -/** 获取证书列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ -export async function queryCertificateList( - params: { - // query - /** 当前的页码 */ - current?: number; - /** 页面的容量 */ - pageSize?: number; - }, - options?: Record, -) { - return request<{ - data: TableListItem[]; - /** 列表的内容总数 */ - total_row?: number; - /** 页面的容量 */ - page_size?: number; - success?: boolean; - }>('/api/zygh/training/examination/getCertificateList', { - method: 'GET', - params: { - ...params, - }, +/** 新建/修改考试 POST /dsideal_yy/zygh/training/rules/updateRules */ +export async function saveRules(data: Record, options?: Record) { + return request('/dsideal_yy/zygh/training/rules/updateRules', { + data, + method: 'POST', + requestType: "form", ...(options || {}), }); } @@ -79,7 +62,20 @@ export async function queryRulesView( - +/** + * 获取主题列表 + * 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, + }); +}