Commit 5bd9b0c0d771783d1571d2ba0071059e18857626
1 parent
9b132f20
fix(cas): 优化保养配置配件选择交互及错误提示
Showing
3 changed files
with
19 additions
and
5 deletions
src/pages/cas/afterSaleConfiguration/maintainConfig/subpages/MaintainEdit/components/MachineFilter/components/EngineFilterModal/index.tsx
... | ... | @@ -4,6 +4,7 @@ import debounce from 'lodash/debounce'; |
4 | 4 | import Search from 'antd/lib/input/Search'; |
5 | 5 | |
6 | 6 | import { getPartItems } from '../../../../../../api'; |
7 | +import st from '@/pages/cas/afterSaleConfiguration/maintainConfig/subpages/MaintainEdit/components/EngineOilSelector/components/style.less'; | |
7 | 8 | |
8 | 9 | const { Column } = Table; |
9 | 10 | |
... | ... | @@ -86,6 +87,9 @@ function EngineOilModal(props: Props) { |
86 | 87 | <Table |
87 | 88 | dataSource={data} |
88 | 89 | loading={loading} |
90 | + pagination={{ total, defaultPageSize: 10, current, pageSize, onChange: onPageChange, onShowSizeChange: onPageChange }} | |
91 | + rowClassName={st.clickableRow} | |
92 | + rowKey="partCode" | |
89 | 93 | rowSelection={{ |
90 | 94 | selectedRowKeys: selectedRow.map((item) => item.partCode), |
91 | 95 | onSelect: (row: any, _selected: boolean) => { |
... | ... | @@ -111,8 +115,15 @@ function EngineOilModal(props: Props) { |
111 | 115 | setSelectedRow(newData); |
112 | 116 | }, |
113 | 117 | }} |
114 | - pagination={{ total, defaultPageSize: 10, current, pageSize, onChange: onPageChange, onShowSizeChange: onPageChange }} | |
115 | - rowKey="partCode" | |
118 | + onRow={(record) => ({ | |
119 | + onClick: () => { | |
120 | + if (selectedRow.some((si) => si.partCode === record.partCode)) { | |
121 | + setSelectedRow([...selectedRow.filter((si) => si.partCode !== record.partCode)]); | |
122 | + } else { | |
123 | + setSelectedRow([...selectedRow, record]); | |
124 | + } | |
125 | + }, | |
126 | + })} | |
116 | 127 | > |
117 | 128 | <Column title="名称" dataIndex="partName" width={250} /> |
118 | 129 | <Column title="编号" dataIndex="partCode" /> | ... | ... |
src/pages/cas/afterSaleConfiguration/maintainConfig/subpages/MaintainEdit/components/PartFilter/index.tsx
... | ... | @@ -143,8 +143,8 @@ export default function PartFilter({ partFilters, brandId, onChange }: Props) { |
143 | 143 | <Table |
144 | 144 | dataSource={dataSource} |
145 | 145 | bordered |
146 | - rowClassName="editable-row" | |
147 | 146 | pagination={false} |
147 | + rowClassName="editable-row" | |
148 | 148 | rowKey={(row) => `${row.partCode}_${row.partName}`} |
149 | 149 | components={{ |
150 | 150 | body: { | ... | ... |
src/pages/cas/afterSaleConfiguration/maintainConfig/subpages/MaintainEdit/index.tsx
1 | 1 | import React, { useEffect, useState } from 'react'; |
2 | -import { Button, Card, Empty, Form, Input, message, Row, Select, Spin, Tabs } from 'antd'; | |
2 | +import { Button, Card, Empty, Form, Input, message, Modal, Row, Select, Spin, Tabs } from 'antd'; | |
3 | 3 | import { PageHeaderWrapper } from '@ant-design/pro-layout'; |
4 | 4 | import useInitial from '@/hooks/useInitail'; |
5 | 5 | import { ConnectProps } from '@/typing/common'; |
... | ... | @@ -411,8 +411,11 @@ export default function ConfigPage({ match }: Props) { |
411 | 411 | } |
412 | 412 | }) |
413 | 413 | .catch((e) => { |
414 | - message.error(e.message); | |
415 | 414 | setSubmitting(false); |
415 | + Modal.error({ | |
416 | + title: '提示', | |
417 | + content: e.message, | |
418 | + }); | |
416 | 419 | }); |
417 | 420 | } |
418 | 421 | ... | ... |