diff --git a/admin/src/global.less b/admin/src/global.less index 0d6eb49..918553c 100644 --- a/admin/src/global.less +++ b/admin/src/global.less @@ -64,4 +64,7 @@ ol { } .ant-pro-field-index-column-border{ background-color: #999 !important; +} +main{ + min-width: 1024px; } \ No newline at end of file diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 78ebaac..6ea760c 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -275,6 +275,7 @@ const CourseList: React.FC = () => { message.error('视频编码格式不正确(视频采用AVC,音频采用AAC)') return false; } + console.log('filename', file?.name) // 获取文件名 SetUploadFileName(file?.name); // 获取最后一个.的位置 @@ -609,9 +610,12 @@ const CourseList: React.FC = () => { //return false; await handleAdd({ ...values, - //course_id: currentRow?.course_id, - attachment_json: `{"img":"", "name": "${values?.attachment_json?.file?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, - attachment_filesize: values?.attachment_json?.file?.size, // 字节 + ////course_id: currentRow?.course_id, + //attachment_json: `{"img":"", "name": "${values?.attachment_json?.file?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, + //attachment_filesize: values?.attachment_json?.file?.size, // 字节 + + attachment_json: `{"img":"", "name": "${values?.attachment_json[0]?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, + attachment_filesize: values?.attachment_json[0]?.size, // 字节 }); handleCreateModalVisible(false); // 隐藏创建窗口 actionRef.current?.reloadAndRest?.(); diff --git a/admin/src/pages/examinationrules/attestation/components/AutoSelector.tsx b/admin/src/pages/examinationrules/attestation/components/AutoSelector.tsx index 41d215e..082f4c4 100644 --- a/admin/src/pages/examinationrules/attestation/components/AutoSelector.tsx +++ b/admin/src/pages/examinationrules/attestation/components/AutoSelector.tsx @@ -92,8 +92,9 @@ console.log('props---', props) return ( <> - 生成试卷数量:{ - setPaperCount(value) + 生成试卷数量:{ + const value = e.currentTarget.value; + setPaperCount(value || 0) }} />试卷数量与学生重复考试次数一致 题库选择 diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 328c01d..7f245c9 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -43,6 +43,7 @@ export default () => { const [questionTypeValues, setQuestionTypeValues] = useState([]); // 题型数据[{count:0, score:0, score_harf:0}] const [questionType, setQuestionType] = useState([]); // 题型 + const [passScore, setPassScore] = useState(0) const [rulesId, setRulesId] = useState(0); // 规则id, 保存新建的rules_id const [subjectId, setSubjectId] = useState(0); // 关联主题id @@ -398,7 +399,7 @@ export default () => { 限制考试时长的情况下,用户考试中离开,倒计时不会停止。 - + {/* { 试卷数量与学生重复考试次数一致 + */} {console.log('###', ruleData)} @@ -477,7 +479,19 @@ export default () => { 请选择试题组卷并设置分值后保存} placement="bottom" color='#108ee9'> @@ -733,9 +778,15 @@ export default () => { const passSocre = setterRef.current?.getValue() // 获取通过分数线 const sumCore = setterRef.current?.getSum() // 获取总分 if(passSocre > sumCore){ - message.error('通过分数线不能大于总分,请修改通过分数线'); + message.error('“通过分数线”不能大于总分,请修改“通过分数线”'); return false; } + + if(values.filter(item=>(item?.score_harf > item?.score)).length > 0){ + message.error('“错选漏选分数”不能大于该题型分,请修改“通错选漏选得分”'); + return false; + } + console.log('批量设置分值v::::2', values); // 题型分数 const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) }) @@ -749,7 +800,7 @@ export default () => { return true; }} > - + 0 ? questionTypeValues : questionType?.map((item,key)=>({...item, count: typeQuestionCount[key]}))} passScore={passScore} /> diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 7aa76a7..906f56d 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -62,7 +62,6 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat } }); - const {data: examinationData, run } = useRequest(() => { return getExaminationStatistics({ bureau_id:typeof (school)===number?school:0, diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx index 269853e..0f7dd37 100644 --- a/admin/src/pages/questionbank/index.tsx +++ b/admin/src/pages/questionbank/index.tsx @@ -34,6 +34,7 @@ console.log('first'); * @param fields */ const handleAdd = async (fields: TableListItem) => { + console.log('handleadd...') const hide = message.loading('正在添加'); try { await saveQuestion({ ...fields }); @@ -292,7 +293,7 @@ const QuestionBank = () => { hideInForm: false, hideInSearch: true, formItemProps: { - rules: [ + rules: [ { required: true, message: '请填写试题解析', @@ -784,8 +785,6 @@ const QuestionBank = () => { onFinish={async (values: any) => { //console.log('formRef.current', formRef.current.getFieldsValue(['answertrue'])) console.log(values); - return - // 表单处理 console.log('columns:', columns); console.log('values:', values); diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index 06a0715..be72b04 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -1,6 +1,6 @@ import { PlusOutlined } from '@ant-design/icons'; import { Button, message, Input, Drawer, Row, Col, Space, Modal, Popconfirm } from 'antd'; -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, Children } 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'; @@ -8,11 +8,12 @@ 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 UpdateForm from './components/UpdateForm'; -import { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList, querySubjectView } from './service'; +//import UpdateForm from './components/UpdateForm'; +import { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList, querySubjectView, getAsyncOrgTree, getEduUnitList } from './service'; import type { TableListItem, TableListPagination } from './data'; import { useRequest } from 'umi'; - +import cookie from 'react-cookies'; +import Item from 'antd/lib/list/Item'; /** * 添加培训 * @@ -106,11 +107,12 @@ const getJsonTree = (data: [], pId: number) => { //console.log('f') //console.log('node?.pId',node?.pId) //console.log('pId',pId) - if (node?.pId === Number(pId)) { + if (Number(node?.pId) === Number(pId)) { console.log('if') const treeNode: children = {}; treeNode.value = node?.id; - treeNode.label = node?.name; + treeNode.name = node?.name; + treeNode.children = node?.children; //treeNode.url = node.url; //treeNode.icon = node.icon; @@ -124,6 +126,8 @@ const getJsonTree = (data: [], pId: number) => { const TableList: React.FC = () => { + const provinceId = cookie.load('background_province_id') // 获取省份id + const { data, loading } = useRequest(() => { return queryValueByKey({}); }); @@ -170,10 +174,18 @@ const TableList: React.FC = () => { }, { title: '培训对象', - valueType: 'select', + valueType: 'treeSelect', hideInSearch: true, fieldProps: { - mode: "multiple" + //mode: "multiple", + multiple: true, + treeNodeFilterProp: 'name', + labelInValue: true, + fieldNames: { + label: 'name', + key: 'id', + value: 'id' + }, }, formItemProps: { rules: [ @@ -185,6 +197,7 @@ const TableList: React.FC = () => { }, dataIndex: 'org_names', request: async () => { + /* const Value = await queryValueByKey({}); const orgId = Value['common.org.id'] ? Value['common.org.id'] : 0; // 平台全局设置 const tree = await queryOrgTree({ @@ -192,10 +205,52 @@ const TableList: React.FC = () => { org_type: 2, //school_type: 1, }) - setOrgTree(tree.table_List) + //setOrgTree(tree.table_List) console.log('orgId', orgId) console.log('tree.table_List', tree.table_List) - return getJsonTree(tree.table_List, orgId) + return getJsonTree(tree.table_List, orgId) + */ + let treeData = [] + // 获取省级以下的全部机构单位 + const {table_List} = await getEduUnitList({ + area_id: provinceId, + edu_type: -1, + org_type: 2, + pageNumber: 1, + pageSize: 10000, + school_type: -1, + }) + // 格式化机构单位数据 + const unitData = table_List?.map(item=>{ + return {pId: item?.AREA_ID, name:item?.ORG_NAME, id: item?.ORG_ID} + }) + console.log('unit:', unitData) + + // 获取市 + const cityData = await getAsyncOrgTree({ + org_id: provinceId, + org_type: 1, + get_next: 1 + }); + const areaData = [] + //const areaIds = []; // 区域Id数组,用于过滤接口返回的非区下单位的垃圾数据 + for(let i=0; i< cityData?.length; i++){ + const _areaData = await getAsyncOrgTree({ + org_id: cityData[i]?.id, + org_type: 2, + get_next: 1 + }); + treeData.push({name:cityData[i]?.name, id:cityData[i]?.id, + children: _areaData?.map(item=>({ + pId: Number(item?.pId), + name: item?.name, + id: Number(item?.id), + children: unitData?.filter(unit=>(Number(unit?.pId) === Number(item?.id))) + })) + }) + } + console.log('tree',treeData) + return treeData }, sorter: false, hideInForm: false, @@ -278,7 +333,6 @@ const TableList: React.FC = () => { dataIndex: 'option', valueType: 'option', render: (_, record) => [ - { @@ -288,9 +342,6 @@ const TableList: React.FC = () => { > 编辑 , - - - { handleRemove([{ key: record?.train_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) @@ -300,8 +351,6 @@ const TableList: React.FC = () => { > 删除 - - ], }, ]; @@ -347,10 +396,7 @@ const TableList: React.FC = () => { } // delete value.date_time console.log('search', value); - const _data = await queryTrainList(value); - - return { current: _data?.page_number, data: _data?.data?.list, @@ -414,20 +460,14 @@ const TableList: React.FC = () => { // 表单处理 //console.log('columns:', columns); console.log('values1:', values, orgTree); - - const tree = orgTree.filter((item, idx, self) => { - return (values.org_names.indexOf(item.id) !== -1) - }); - - 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 + const tree = [] + values.org_names.map((e) => { + tree.push({ + org_type: 2, + org_id: e.value, + org_name: e.label + }) }) - console.log(321); - console.log(tree, 'tree'); const _data = { ...values, end_time: values.date_time[1], @@ -482,10 +522,7 @@ const TableList: React.FC = () => { labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} 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) => { @@ -497,57 +534,24 @@ const TableList: React.FC = () => { }) console.log("edit", data); - return data }} onFinish={async (values: any) => { // 表单处理 - //console.log('columns:', columns); console.log('values1:', values, values.org_names.value); - //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, 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) => { - tree.push({ - org_type: 2, - org_id: e.value, - org_name: e.label - }) + const tree = [] + values.org_names.map((e) => { + tree.push({ + org_type: 2, + org_id: e.value, + org_name: e.label }) - - } - - - - - 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), @@ -555,20 +559,16 @@ const TableList: React.FC = () => { } 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?.(); } else { message.error(res.msg); } - }} submitter={{ render: (props, doms) => ( diff --git a/admin/src/pages/training/option/service.ts b/admin/src/pages/training/option/service.ts index 54fb8c5..15c81e7 100644 --- a/admin/src/pages/training/option/service.ts +++ b/admin/src/pages/training/option/service.ts @@ -109,3 +109,48 @@ export async function querySubjectView(params: { }); } +/** + * 获取省市区 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ + export async function getAsyncOrgTree(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/org/getAsyncOrgTree', { + params, + }); +} + +/** + * 获取学校 + * http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426 + * @param params + * @returns + */ + export async function getOrgList(params: { + org_id: number; + org_type: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/intellioa/thirdlib/get_org_list', { + params, + }); +} + +/** + * 获取学校列表 + * /dsideal_yy/ypt/sys/org/getEduUnitList + * @param params + * @returns + */ + export async function getEduUnitList(params: { + page_size: number; + //count: number; +}): Promise<{ data: { list: CardListItemDataType[] } }> { + return request('/dsideal_yy/ypt/sys/org/getEduUnitList', { + params, + }); +} \ No newline at end of file