diff --git a/admin/src/pages/examinationrules/normal/components/AutoSelector.tsx b/admin/src/pages/examinationrules/normal/components/AutoSelector.tsx index da15405..529d902 100644 --- a/admin/src/pages/examinationrules/normal/components/AutoSelector.tsx +++ b/admin/src/pages/examinationrules/normal/components/AutoSelector.tsx @@ -111,6 +111,7 @@ const AutoSelector = (props: any, ref: any) => { headerTitle={false} columns={columns} rowKey="id" + key="id" // value={dataSource} request={async (value) => { const { data } = await queryListChapterBySubject({ diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx index 6a75724..16657db 100644 --- a/admin/src/pages/examinationrules/normal/step/index.tsx +++ b/admin/src/pages/examinationrules/normal/step/index.tsx @@ -5,11 +5,11 @@ import { ModalForm } 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, Dropdown, Form, Input, List, Menu, message, Modal, Radio, Row, Space, Table, Typography, Upload, Empty, Tooltip } from 'antd'; +import { Button, Checkbox, Col, Divider, Dropdown, Form, Input, List, Menu, message, Modal, Radio, Row, Space, Table, Typography, Upload, Empty, Tooltip, Popconfirm } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; import ProDescriptions from '@ant-design/pro-descriptions'; import styles from './index.less' -import { saveRules, querySubjectList, queryRulesView, queryTempQuestionList, saveQuestionTypeScore, queryRulesPaper, updateScore } from '../../service'; +import { saveRules, querySubjectList, queryRulesView, queryTempQuestionList, saveQuestionTypeScore, queryRulesPaper, updateScore, delTempQuestion, exchangeSortNum } from '../../service'; import { queryCourseView } from '@/pages/course/option/service'; import { queryQuestionList, queryQuestionById, queryQuestionType } from '@/pages/questionbank/service'; import { PlusOutlined, DownOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EyeInvisibleOutlined, EyeOutlined, EditOutlined, ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons'; @@ -79,6 +79,62 @@ const handleUpdatePaper = async (rules_id: number, paper_uuid: number, paper_id: } }; +/** + * 删除临时表试题(接口不支持批量) + * 参数为记录数组 + * @param ids + */ + const handleRemoveTempQuestion = async (paper_uuid: number, question_ids: [{question_id: number}]) => { + const hide = message.loading('正在删除'); + console.log('uuidPaper', paper_uuid) + if (!question_ids || !paper_uuid) return true; + try { + const {code, msg} = await delTempQuestion({ + paper_uuid: paper_uuid, + question_ids: JSON.stringify(question_ids) + }); + hide(); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } + return true; + } catch (error) { + hide(); + message.error('删除失败,请重试'); + return false; + } +}; + +/** + * 组卷交换临时表试题顺序 + * @param paper_uuid + * @param question_ids + * @param rules_id + * @returns bool + */ +const handleExchangeSortNum = async (paper_uuid: number, question_ids: string, rules_id: number) => { + const hide = message.loading('正在保存修改'); + try { + const data = { + rules_id: Number(rules_id), + paper_uuid: paper_uuid, + question_ids: question_ids + } + const success = await exchangeSortNum(data); + hide(); + if(success){ + message.success('修改成功'); + } + return true; + } catch (error) { + hide(); + message.error('修改失败请重试!'); + return false; + } +}; + const labels = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'] // 模拟考试规则维护 export default () => { @@ -284,10 +340,11 @@ export default () => { // value="锦书" // disabled /> - +{console.log(1111)} { return querySubjectList().then(({ data }) => { console.log(data, 'querySubjectList') @@ -342,7 +399,7 @@ export default () => { )} - +{console.log(2222)} { ))} } -
- +
+ + + { + const success = await handleRemoveTempQuestion(uuidPaper, [{ question_id: item?.id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) + if (success) { + run({ + paper_uuid: uuidPaper, + page_size: 1000, + page_number: 1 + }); // 获取当前选题列表 + } + }} + > + +
))} @@ -470,7 +560,7 @@ export default () => { console.log('typeQuestionCount', typeQuestionCount); handleScoreModalVisible(true) }}>批量设置分值 - 请选择试题组卷并设置分值后保存} placement="bottom" visible={questions ? false : true} color='#108ee9'> + 请选择试题组卷并设置分值后保存} placement="bottom" color='#108ee9'>