已选列表统计勾选数量的功能追加

main
hujunpeng 4 months ago
parent 0a3825a449
commit 008ca215f0
  1. 32
      packages/examination/src/views/examPaper/examPaperAdd.tsx

@ -366,7 +366,8 @@ class ExamPaperAdd extends Component<any, States> {
questionSelectList,
selectedRowKeys,
skipValidation,
questionCountSum
questionCountSum,
total
} = this.state;
const changePage = (current: number, pageSize: number) => {
@ -584,7 +585,7 @@ class ExamPaperAdd extends Component<any, States> {
<Form.Item
label="总分值:"
name="totalScore"
style={{ width: 240 }}
style={{ width: 220 }}
rules={[{ required: true, message: '请输入总分值' }]}
>
<Input type="number" style={{ textAlign: 'right' }} placeholder="请输入总分值" min={1} />
@ -689,20 +690,23 @@ class ExamPaperAdd extends Component<any, States> {
</Button>
]}
width={1100}
style={{ top: 20 }}
style={{top: 20}}
>
<div>
<h3 style={{ fontWeight: 'bold' }}></h3>
<h3 style={{fontWeight: 'bold'}}></h3>
<div style={{textAlign: 'right'}}>
{selectedQuestionList.length}/{total}
</div>
<Table
dataSource={selectedQuestionList}
columns={columns}
bordered={true}
scroll={{ y: 200 }}
scroll={{y: 200}}
size={'small'}
/>
</div>
<div style={{ marginTop: '20px' }}>
<h3 style={{ fontWeight: 'bold' }}></h3>
<div style={{marginTop: '20px'}}>
<h3 style={{fontWeight: 'bold'}}></h3>
<Form
className="filter"
layout="inline"
@ -713,10 +717,10 @@ class ExamPaperAdd extends Component<any, States> {
name="serviceTypeId"
>
<Select placeholder="请选择AQ服务类型"
style={{ width: 240 }}
style={{width: 240}}
allowClear>
{
serviceTypeDict && serviceTypeDict.length > 0?
serviceTypeDict && serviceTypeDict.length > 0 ?
(() => {
let rows = [];
for (let i = 0; i < serviceTypeDict.length; i++) {
@ -736,7 +740,7 @@ class ExamPaperAdd extends Component<any, States> {
label="题干条件:"
name="questionContent"
>
<Input placeholder="请输入题干条件" style={{ width: 400 }}/>
<Input placeholder="请输入题干条件" style={{width: 400}}/>
</Form.Item>
<Form.Item>
<Button type="default" onClick={this.handleReset}></Button>
@ -752,12 +756,12 @@ class ExamPaperAdd extends Component<any, States> {
bordered={true}
size={'small'}
rowKey="id"
scroll={{ y: 200 }}
scroll={{y: 200}}
loading={loading}
rowSelection={{
selectedRowKeys: selectedRowKeys,
onChange: (newSelectedRowKeys, selectedRows) => {
const { selectedQuestionList,questionSelectList } = this.state;
const {selectedQuestionList, questionSelectList} = this.state;
const newSelectedQuestionList = selectedRows.reduce((acc, row) => {
if (!acc.some(item => item.id === row.id)) {
acc.push(row);
@ -766,11 +770,11 @@ class ExamPaperAdd extends Component<any, States> {
}, [...selectedQuestionList]);
const deselectedIds = questionSelectList
.filter(item =>!newSelectedRowKeys.includes(item.id))
.filter(item => !newSelectedRowKeys.includes(item.id))
.map(item => item.id);
const finalSelectedQuestionList = newSelectedQuestionList.filter(
item =>!deselectedIds.includes(item.id)
item => !deselectedIds.includes(item.id)
);
const selectedRowKeys = finalSelectedQuestionList.map(item => String(item.id));

Loading…
Cancel
Save