Commit 00ae188b by yuananting

feat:试卷优化

parent 833adc93
...@@ -34,20 +34,27 @@ function AddExam(props: any) { ...@@ -34,20 +34,27 @@ function AddExam(props: any) {
const [getData, setGetData] = useState(false); const [getData, setGetData] = useState(false);
const [preview, setPreview] = useState(false); const [preview, setPreview] = useState(false);
const [examTotal, setExamTotal] = useState(0); const [examTotal, setExamTotal] = useState(0);
const timer = useRef({});
const request = useRef(false); const request = useRef(false);
const { match } = props; const { match } = props;
const [examDuration, setExamDuration] = useState(undefined); const [examDuration, setExamDuration] = useState(undefined);
useEffect(() => { useEffect(() => {
if (props.type === 'edit' || props.type === 'copy') { switch (props.type) {
queryExamDetail() case "copy": // 考试列表-复制考试进入
case "edit": // 考试列表-编辑考试进入
queryExamDetail();
break;
case "organizeExam": // 试卷列表-组织考试进入
case "newPaperToAddExam": // 组卷页面-新建保存试卷并组织考试
case "editPaperToAddExam": // 组卷页面-编辑保存试卷并组织考试
setGetData(true);
setPaperInfo(props.paperInfo);
break;
} }
}, []) }, [])
useEffect(() => { useEffect(() => {
console.log(paperInfo)
setPaperId(paperInfo.paperId) setPaperId(paperInfo.paperId)
setPassRate(paperInfo.passRate) setPassRate(paperInfo.passRate)
...@@ -172,8 +179,18 @@ function AddExam(props: any) { ...@@ -172,8 +179,18 @@ function AddExam(props: any) {
Service.Hades(props.type === 'edit' ? 'public/hades/editExam' : "public/hades/createExam", param).then((res) => { Service.Hades(props.type === 'edit' ? 'public/hades/editExam' : "public/hades/createExam", param).then((res) => {
message.success(props.type === 'edit' ? '编辑成功' : '创建成功'); message.success(props.type === 'edit' ? '编辑成功' : '创建成功');
switch (props.type) {
case "organizeExam": // 试卷列表-组织考试进入
case "newPaperToAddExam": // 组卷保存组织考试
case "editPaperToAddExam":
window.RCHistory.push("/examination-manage-index")
break;
case "add":
case "edit": // 考试列表-新建或编辑
props.freshList() props.freshList()
props.history.goBack(); props.history.goBack();
break;
}
}) })
} }
...@@ -228,6 +245,9 @@ function AddExam(props: any) { ...@@ -228,6 +245,9 @@ function AddExam(props: any) {
let title = ''; let title = '';
switch (props.type) { switch (props.type) {
case 'add': case 'add':
case "organizeExam":
case "newPaperToAddExam":
case "editPaperToAddExam":
title = '新建考试'; title = '新建考试';
break; break;
case 'edit': case 'edit':
......
...@@ -207,7 +207,6 @@ function ExamData(props: any) { ...@@ -207,7 +207,6 @@ function ExamData(props: any) {
return <div className="rr"> return <div className="rr">
<a <a
target="_blank"
download download
id="load-play-back-excel" id="load-play-back-excel"
style={{ position: "absolute", left: "-10000px" }} style={{ position: "absolute", left: "-10000px" }}
......
...@@ -302,7 +302,6 @@ function ExaminationManager(props: any) { ...@@ -302,7 +302,6 @@ function ExaminationManager(props: any) {
function onChange(pagination: any, filters: any, sorter: any, extra: any) { function onChange(pagination: any, filters: any, sorter: any, extra: any) {
setfield(sorter.field); setfield(sorter.field);
setOrder(sorter.order) setOrder(sorter.order)
console.log(sorter.field, sorter.order, (orderEnum as any)[sorter.field])
let _query: any = { ...queryRef.current }; let _query: any = { ...queryRef.current };
_query.order = (orderEnum as any)[sorter.field][sorter.order] || 'EXAM_START_TIME_DESC' _query.order = (orderEnum as any)[sorter.field][sorter.order] || 'EXAM_START_TIME_DESC'
setQuery(_query) setQuery(_query)
...@@ -421,7 +420,6 @@ function ExaminationManager(props: any) { ...@@ -421,7 +420,6 @@ function ExaminationManager(props: any) {
total={total} total={total}
onShowSizeChange={onShowSizeChange} onShowSizeChange={onShowSizeChange}
toPage={(page: any) => { toPage={(page: any) => {
console.log(page)
let _query: any = { ...queryRef.current }; let _query: any = { ...queryRef.current };
_query.current = page + 1; _query.current = page + 1;
setQuery(_query) setQuery(_query)
...@@ -445,8 +443,6 @@ function ExaminationManager(props: any) { ...@@ -445,8 +443,6 @@ function ExaminationManager(props: any) {
} else { } else {
getList() getList()
} }
}} />; }} />;
}} /> }} />
<Route path={`${match.url}/edit/:id`} render={() => { <Route path={`${match.url}/edit/:id`} render={() => {
......
...@@ -182,7 +182,6 @@ function DataAnalysic(props: any) { ...@@ -182,7 +182,6 @@ function DataAnalysic(props: any) {
return <div className="rr"> return <div className="rr">
<a <a
target="_blank"
download download
id="load-play-back-excel" id="load-play-back-excel"
style={{ position: "absolute", left: "-10000px" }} style={{ position: "absolute", left: "-10000px" }}
......
/* /*
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 16:15:13 * @Date: 2021-03-27 16:15:13
* @LastEditors: zhangleyuan * @LastEditors: yuananting
* @LastEditTime: 2021-05-10 10:16:31 * @LastEditTime: 2021-05-30 21:22:25
* @Description: 助学工具-新建/复制/编辑试卷 * @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -29,6 +29,8 @@ import PaperPreviewModal from "./modal/PreviewPaperModal"; ...@@ -29,6 +29,8 @@ import PaperPreviewModal from "./modal/PreviewPaperModal";
import User from "@/common/js/user"; import User from "@/common/js/user";
import AidToolService from "@/domains/aid-tool-domain/AidToolService"; import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import Bus from "@/core/bus"; import Bus from "@/core/bus";
import { Route, withRouter } from "react-router-dom";
import AddExam from "@/modules/teach-tool/examination-manager/AddExam";
const questionTypeEnum = { const questionTypeEnum = {
SINGLE_CHOICE: "单选题", SINGLE_CHOICE: "单选题",
...@@ -127,11 +129,10 @@ class OperatePaper extends Component { ...@@ -127,11 +129,10 @@ class OperatePaper extends Component {
const { paperName, passRate } = result; const { paperName, passRate } = result;
this.setState( this.setState(
{ {
selectQuestionList: result.questionList.sort( selectQuestionList: result.questionList,
(a, b) => b.updateTime - a.updateTime
),
formData: { formData: {
...result, ...result,
paperId: getParameterByName("paperId"),
paperName: paperName:
currentOperate === "copy" ? paperName + "(复制)" : paperName, currentOperate === "copy" ? paperName + "(复制)" : paperName,
}, },
...@@ -222,11 +223,6 @@ class OperatePaper extends Component { ...@@ -222,11 +223,6 @@ class OperatePaper extends Component {
case "descend": case "descend":
currentQuestionList = sortedTableData.reverse(); currentQuestionList = sortedTableData.reverse();
break; break;
case "default":
currentQuestionList = _selectQuestionList.sort(
(a, b) => b.updateTime - a.updateTime
);
break;
default: default:
currentQuestionList = _selectQuestionList; currentQuestionList = _selectQuestionList;
break; break;
...@@ -261,7 +257,7 @@ class OperatePaper extends Component { ...@@ -261,7 +257,7 @@ class OperatePaper extends Component {
getSelectedQuestion={this.state.selectQuestionList} getSelectedQuestion={this.state.selectQuestionList}
setSelectedQuestion={(list) => { setSelectedQuestion={(list) => {
this.setState({ selectQuestionModal: null }, () => { this.setState({ selectQuestionModal: null }, () => {
this.setFormData(list.sort((a, b) => b.updateTime - a.updateTime)); this.setFormData(list);
}); });
}} }}
close={() => { close={() => {
...@@ -332,10 +328,11 @@ class OperatePaper extends Component { ...@@ -332,10 +328,11 @@ class OperatePaper extends Component {
}; };
// 保存试卷 // 保存试卷
savePaper = async () => { savePaper = (saveType) => {
this.setState({ check: true }); this.setState({ check: true });
const { selectQuestionList, formData, currentOperate } = this.state; const { selectQuestionList, formData, currentOperate } = this.state;
const categoryId = getParameterByName("categoryId"); const categoryId = getParameterByName("categoryId");
const { match } = this.props;
let questionList = []; let questionList = [];
if ( if (
!formData.passRate || !formData.passRate ||
...@@ -370,6 +367,13 @@ class OperatePaper extends Component { ...@@ -370,6 +367,13 @@ class OperatePaper extends Component {
AidToolService.createPaper(this.state.formData) AidToolService.createPaper(this.state.formData)
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
if (saveType === "saveToAddExam") {
this.setState({formData:{ ...formData, paperId: res.result}},() => {
window.RCHistory.push({
pathname: `${match.url}/exam-operate-page`,
});
})
} else {
message.success( message.success(
currentOperate === "new" ? "新建成功" : "复制成功" currentOperate === "new" ? "新建成功" : "复制成功"
); );
...@@ -383,6 +387,7 @@ class OperatePaper extends Component { ...@@ -383,6 +387,7 @@ class OperatePaper extends Component {
); );
Bus.trigger("queryCategoryTree", "remain"); Bus.trigger("queryCategoryTree", "remain");
} }
}
}) })
.catch((e) => { .catch((e) => {
window.RCHistory.push({ window.RCHistory.push({
...@@ -402,6 +407,11 @@ class OperatePaper extends Component { ...@@ -402,6 +407,11 @@ class OperatePaper extends Component {
}) })
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
if (saveType === "saveToAddExam") {
window.RCHistory.push({
pathname: `${match.url}/exam-operate-page`,
});
} else {
message.success("编辑成功"); message.success("编辑成功");
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `/paper-manage-index?categoryId=${categoryId}`,
...@@ -412,6 +422,7 @@ class OperatePaper extends Component { ...@@ -412,6 +422,7 @@ class OperatePaper extends Component {
selectQuestionList.length selectQuestionList.length
); );
} }
}
}) })
.catch((e) => { .catch((e) => {
window.RCHistory.push({ window.RCHistory.push({
...@@ -469,7 +480,7 @@ class OperatePaper extends Component { ...@@ -469,7 +480,7 @@ class OperatePaper extends Component {
sortByQuestionType = (pagination, filters, sorter) => { sortByQuestionType = (pagination, filters, sorter) => {
const { columnKey, order } = sorter; const { columnKey, order } = sorter;
if (columnKey === "questionType") { if (columnKey === "questionType") {
this.setFormData(this.state.selectQuestionList, order || "default"); this.setFormData(this.state.selectQuestionList, order);
} }
}; };
...@@ -680,6 +691,7 @@ class OperatePaper extends Component { ...@@ -680,6 +691,7 @@ class OperatePaper extends Component {
formData, formData,
loading, loading,
check, check,
currentOperate,
} = this.state; } = this.state;
const { const {
singleChoiceCnt, singleChoiceCnt,
...@@ -698,10 +710,14 @@ class OperatePaper extends Component { ...@@ -698,10 +710,14 @@ class OperatePaper extends Component {
questionCnt, questionCnt,
totalScore, totalScore,
} = formData; } = formData;
const { match } = this.props;
return ( return (
<div>
<div className="page operate-paper-page"> <div className="page operate-paper-page">
<Breadcrumbs navList={currentNav} goBack={() => this.handleGoBack()} /> <Breadcrumbs
navList={currentNav}
goBack={() => this.handleGoBack()}
/>
<Spin spinning={loading}> <Spin spinning={loading}>
<div className="box"> <div className="box">
<div className="show-tips"> <div className="show-tips">
...@@ -712,7 +728,9 @@ class OperatePaper extends Component { ...@@ -712,7 +728,9 @@ class OperatePaper extends Component {
name="paperName" name="paperName"
label="试卷名称:" label="试卷名称:"
required required
validateStatus={this.validatePaperName(paperName) ? "error" : ""} validateStatus={
this.validatePaperName(paperName) ? "error" : ""
}
help={this.validatePaperName(paperName)} help={this.validatePaperName(paperName)}
> >
<Input <Input
...@@ -775,8 +793,12 @@ class OperatePaper extends Component { ...@@ -775,8 +793,12 @@ class OperatePaper extends Component {
自选题目 自选题目
</Button> </Button>
{questionCnt > 0 && ( {questionCnt > 0 && (
<div className="paper-info-tip" style={{ margin: "0 auto 12px" }}> <div
总计<span>{totalScore}</span>分,共<span>{questionCnt}</span> className="paper-info-tip"
style={{ margin: "0 auto 12px" }}
>
总计<span>{totalScore}</span>分,共
<span>{questionCnt}</span>
题。{" "} 题。{" "}
{singleChoiceCnt > 0 && {singleChoiceCnt > 0 &&
`单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`} `单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`}
...@@ -805,7 +827,10 @@ class OperatePaper extends Component { ...@@ -805,7 +827,10 @@ class OperatePaper extends Component {
<div className="footer"> <div className="footer">
<Button onClick={this.handleGoBack}>取消</Button> <Button onClick={this.handleGoBack}>取消</Button>
<Button onClick={this.previewPaper}>预览</Button> <Button onClick={this.previewPaper}>预览</Button>
<Button type="primary" onClick={this.savePaper}> <Button onClick={() => this.savePaper("saveToAddExam")}>
保存并组织考试
</Button>
<Button type="primary" onClick={() => this.savePaper()}>
保存 保存
</Button> </Button>
</div> </div>
...@@ -813,8 +838,24 @@ class OperatePaper extends Component { ...@@ -813,8 +838,24 @@ class OperatePaper extends Component {
{selectQuestionModal} {selectQuestionModal}
{paperPreviewModal} {paperPreviewModal}
</div> </div>
<Route
path={`${match.url}/exam-operate-page`}
render={() => {
return (
<AddExam
paperInfo={formData}
type={
currentOperate === "edit"
? "editPaperToAddExam"
: "newPaperToAddExam"
}
/>
);
}}
/>
</div>
); );
} }
} }
export default OperatePaper; export default withRouter(OperatePaper);
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 11:23:47 * @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-05-20 11:37:40 * @LastEditTime: 2021-05-30 21:29:46
* @Description: 助学工具-题库-试卷列表数据 * @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -20,11 +20,11 @@ import { ...@@ -20,11 +20,11 @@ import {
ConfigProvider, ConfigProvider,
Empty, Empty,
} from "antd"; } from "antd";
import { DownOutlined } from '@ant-design/icons';
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import "./PaperList.less"; import "./PaperList.less";
import { Route, withRouter } from "react-router-dom"; import { Route, withRouter } from "react-router-dom";
import OperatePaper from "@/modules/teach-tool/paper-manage/OperatePaper"; import OperatePaper from "@/modules/teach-tool/paper-manage/OperatePaper";
import AddExam from "@/modules/teach-tool/examination-manager/AddExam";
import User from "@/common/js/user"; import User from "@/common/js/user";
import AidToolService from "@/domains/aid-tool-domain/AidToolService"; import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import Service from "@/common/js/service"; import Service from "@/common/js/service";
...@@ -53,6 +53,7 @@ class PaperList extends Component { ...@@ -53,6 +53,7 @@ class PaperList extends Component {
paperPreviewModal: null, // 试卷预览模态框 paperPreviewModal: null, // 试卷预览模态框
loading: false, loading: false,
selectedPaperKeys: [], selectedPaperKeys: [],
paperInfo: {}, // 选择的某份试卷用于组织考试
}; };
} }
...@@ -122,7 +123,6 @@ class PaperList extends Component { ...@@ -122,7 +123,6 @@ class PaperList extends Component {
// 查询试卷列表 // 查询试卷列表
queryPaperPageList = async () => { queryPaperPageList = async () => {
const res = await AidToolService.queryPaperPageList(this.state.query); const res = await AidToolService.queryPaperPageList(this.state.query);
Bus.trigger("queryCategoryTree", "remain");
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total, loading: false }); this.setState({ dataSource: records, total, loading: false });
}; };
...@@ -174,6 +174,20 @@ class PaperList extends Component { ...@@ -174,6 +174,20 @@ class PaperList extends Component {
} }
}; };
organizeExam = (record) => {
const { match } = this.props;
this.setState(
{
paperInfo: record,
},
() => {
window.RCHistory.push({
pathname: `${match.url}/exam-operate-page`,
});
}
);
};
// 删除试卷 // 删除试卷
deletePaper = (record) => { deletePaper = (record) => {
let params = { let params = {
...@@ -195,6 +209,7 @@ class PaperList extends Component { ...@@ -195,6 +209,7 @@ class PaperList extends Component {
} }
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryPaperPageList(); this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
}); });
} }
}); });
...@@ -380,6 +395,9 @@ class PaperList extends Component { ...@@ -380,6 +395,9 @@ class PaperList extends Component {
<Menu.Item key="edit"> <Menu.Item key="edit">
<span onClick={() => this.editPaper(item)}>编辑</span> <span onClick={() => this.editPaper(item)}>编辑</span>
</Menu.Item> </Menu.Item>
<Menu.Item key="organizeExam">
<span onClick={() => this.organizeExam(item)}>组织考试</span>
</Menu.Item>
<Menu.Item key="del"> <Menu.Item key="del">
<span onClick={() => this.confirmDeletePaper(item)}>删除</span> <span onClick={() => this.confirmDeletePaper(item)}>删除</span>
</Menu.Item> </Menu.Item>
...@@ -426,6 +444,7 @@ class PaperList extends Component { ...@@ -426,6 +444,7 @@ class PaperList extends Component {
if (res.success) { if (res.success) {
message.success('移动成功'); message.success('移动成功');
this.queryPaperPageList(); this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
this.clearSelect(); this.clearSelect();
} else { } else {
message.error('移动失败'); message.error('移动失败');
...@@ -494,6 +513,7 @@ class PaperList extends Component { ...@@ -494,6 +513,7 @@ class PaperList extends Component {
selectedPaperKeys, selectedPaperKeys,
openMoveModal, openMoveModal,
paperData, paperData,
paperInfo,
} = this.state; } = this.state;
const { current, size, categoryId, paperName } = query; const { current, size, categoryId, paperName } = query;
const paperRowSelection = { const paperRowSelection = {
...@@ -594,7 +614,7 @@ class PaperList extends Component { ...@@ -594,7 +614,7 @@ class PaperList extends Component {
<Table <Table
rowKey={(record) => record.paperId} rowKey={(record) => record.paperId}
dataSource={dataSource} dataSource={dataSource}
size={this.props.type == "modal-select"?'small':'middle'} size={this.props.type == "modal-select" ? "small" : "middle"}
rowKey={(item) => { rowKey={(item) => {
return item.paperId; return item.paperId;
}} }}
...@@ -612,7 +632,7 @@ class PaperList extends Component { ...@@ -612,7 +632,7 @@ class PaperList extends Component {
current={current - 1} current={current - 1}
pageSize={size} pageSize={size}
total={total} total={total}
size={this.props.type == "modal-select"?'small':'middle'} size={this.props.type == "modal-select" ? "small" : "middle"}
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 }; const _query = { ...query, current: page + 1 };
this.setState({ query: _query }, () => this.setState({ query: _query }, () =>
...@@ -643,6 +663,17 @@ class PaperList extends Component { ...@@ -643,6 +663,17 @@ class PaperList extends Component {
path={`${match.url}/paper-operate-page`} path={`${match.url}/paper-operate-page`}
component={OperatePaper} component={OperatePaper}
/> />
<Route
path={`${match.url}/exam-operate-page`}
render={() => {
return (
<AddExam
paperInfo={paperInfo}
type="organizeExam"
/>
);
}}
/>
</div> </div>
); );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 11:23:47 * @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-05-20 11:43:21 * @LastEditTime: 2021-05-30 18:17:05
* @Description: 助学工具-新建试卷-选择题目列表 * @Description: 助学工具-新建试卷-选择题目列表
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
Select, Select,
Tooltip, Tooltip,
message, message,
DatePicker,
} from "antd"; } from "antd";
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import "./SelectQuestionList.less"; import "./SelectQuestionList.less";
...@@ -23,8 +24,10 @@ import User from "@/common/js/user"; ...@@ -23,8 +24,10 @@ import User from "@/common/js/user";
import AidToolService from "@/domains/aid-tool-domain/AidToolService"; import AidToolService from "@/domains/aid-tool-domain/AidToolService";
import _ from "underscore"; import _ from "underscore";
import Bus from "@/core/bus"; import Bus from "@/core/bus";
import moment from 'moment';
const { Search } = Input; const { Search } = Input;
const { RangePicker } = DatePicker;
const questionTypeEnum = { const questionTypeEnum = {
SINGLE_CHOICE: "单选题", SINGLE_CHOICE: "单选题",
...@@ -68,12 +71,15 @@ class SelectQuestionList extends Component { ...@@ -68,12 +71,15 @@ class SelectQuestionList extends Component {
categoryId: null, // 当前题库分类Id categoryId: null, // 当前题库分类Id
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
source: 0, source: 0,
tenantId: User.getStoreId(), tenantId: User.getStoreId(),
userId: User.getStoreUserId(), userId: User.getStoreUserId(),
}, },
dataSource: [], dataSource: [],
selectQuestionKeys: [], selectQuestionKeys: [],
expandFilter: false,
}; };
} }
...@@ -98,6 +104,8 @@ class SelectQuestionList extends Component { ...@@ -98,6 +104,8 @@ class SelectQuestionList extends Component {
order: "UPDATED_DESC", // 排序规则 order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
}; };
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryQuestionPageListWithContent(); this.queryQuestionPageListWithContent();
...@@ -134,6 +142,8 @@ class SelectQuestionList extends Component { ...@@ -134,6 +142,8 @@ class SelectQuestionList extends Component {
order: "UPDATED_DESC", // 排序规则 order: "UPDATED_DESC", // 排序规则
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
updateDateStart: null,
updateDateEnd: null,
}; };
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryQuestionPageListWithContent(); this.queryQuestionPageListWithContent();
...@@ -215,11 +225,23 @@ class SelectQuestionList extends Component { ...@@ -215,11 +225,23 @@ class SelectQuestionList extends Component {
// 改变搜索条件 // 改变搜索条件
handleChangeQuery = (searchType, value) => { handleChangeQuery = (searchType, value) => {
const _query = this.state.query;
switch (searchType) {
case "questionName":
_query.questionName = value;
break;
case "updatedTime":
_query.updateDateStart = value && value[0]?.startOf('day').valueOf();
_query.updateDateEnd = value && value[1]?.endOf('day').valueOf();
break;
case "questionType":
_query.questionType = value;
break
}
this.setState( this.setState(
{ {
query: { query: {
...this.state.query, ..._query,
[searchType]: value || null,
current: 1, current: 1,
}, },
}, },
...@@ -281,6 +303,7 @@ class SelectQuestionList extends Component { ...@@ -281,6 +303,7 @@ class SelectQuestionList extends Component {
total, total,
query, query,
selectQuestionKeys = [], selectQuestionKeys = [],
expandFilter,
} = this.state; } = this.state;
const { current, size, questionName, questionType } = query; const { current, size, questionName, questionType } = query;
const rowSelection = { const rowSelection = {
...@@ -375,8 +398,24 @@ class SelectQuestionList extends Component { ...@@ -375,8 +398,24 @@ class SelectQuestionList extends Component {
&#xe61b;{" "} &#xe61b;{" "}
</span> </span>
</Tooltip> </Tooltip>
<span style={{ cursor: 'pointer' }} className="fold-btn" onClick={() => {
this.setState({expandFilter:!expandFilter})
}}>{expandFilter ? <span><span>收起</span><span className="iconfont icon fold-icon" >&#xe82d; </span> </span> : <span>展开<span className="iconfont icon fold-icon" >&#xe835; </span></span>}</span>
</div> </div>
</Row> </Row>
{expandFilter && <Row>
<div className="search-condition__item">
<span className="search-label">更新时间:</span>
<RangePicker
value={[
query.updateDateStart ? moment(Number(query.updateDateStart)) : null,
query.updateDateEnd ? moment(Number(query.updateDateEnd)) : null
]}
onChange={(value) => {
this.handleChangeQuery("updatedTime", value)
}} />
</div>
</Row>}
</div> </div>
<div className="select-tip-box"> <div className="select-tip-box">
<div> <div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment