Commit 919e9ffa authored by alwayOnlie's avatar alwayOnlie

修改bug

parent 9ef47d94
...@@ -35,6 +35,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -35,6 +35,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
/* 执行请款的选中 */ /* 执行请款的选中 */
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据 const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [value, setvalue] = useState('');
/* 搜素 */ /* 搜素 */
const onSearch = (values) => { const onSearch = (values) => {
const data = { const data = {
...@@ -216,6 +217,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -216,6 +217,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
current: page, current: page,
pageSize: size, pageSize: size,
} }
setvalue('')
getContracInfoList(data) getContracInfoList(data)
} }
useEffect(() => { useEffect(() => {
...@@ -241,6 +243,8 @@ const situationList: React.FC<Iprops> = ({ contractId }) => { ...@@ -241,6 +243,8 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
placeholder="搜素" placeholder="搜素"
allowClear allowClear
onSearch={onSearch} onSearch={onSearch}
value={value}
onChange={(e) => setvalue(e.target.value)}
/> />
<Button style={{ paddingLeft: 10, paddingRight: 10, marginLeft: 10, marginRight: 10 }} onClick={Reset}> 重置 </Button> <Button style={{ paddingLeft: 10, paddingRight: 10, marginLeft: 10, marginRight: 10 }} onClick={Reset}> 重置 </Button>
</div> </div>
......
...@@ -313,6 +313,7 @@ const table = (props: any) => { ...@@ -313,6 +313,7 @@ const table = (props: any) => {
PlanList.map((item) => { PlanList.map((item) => {
item.applyNo = item.orderNO; item.applyNo = item.orderNO;
item.outerStatusName = item.orderStatusName; item.outerStatusName = item.orderStatusName;
item.orderTime = item.orderTime ? moment().format('YYYY-MM-DD') : '';
// item.isHasTax = item.isHasTax == '是' ? 1 : 0; // item.isHasTax = item.isHasTax == '是' ? 1 : 0;
}) })
setPlanList(PlanList) setPlanList(PlanList)
......
...@@ -10,39 +10,22 @@ import { goodcolumns } from '../Table' ...@@ -10,39 +10,22 @@ import { goodcolumns } from '../Table'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
const { Option } = Select; const { Option } = Select;
const { Text } = Typography; const { Text } = Typography;
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
const FormList = (props: any) => { const FormList = (props: any) => {
const { currentRef, Row, sourceType } = props; const { currentRef, Row, sourceType } = props;
const refs = useRef({}); const refs = useRef({});
/* 显示模态框 */ /* 显示模态框 */
const [isModalVisible, setIsModalVisible] = useState(false);// 显示模态框 const [isModalVisible, setIsModalVisible] = useState(false);// 显示模态框
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) // 选中的 const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [dataList, setData] = useState<Array<any>>([]) // 列表数据 const [dataList, setData] = useState<Array<any>>([]) // 列表数据
/* 选中 */
const rowSelectionGood: any = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectedRowKeys(selectedRowKeys)
setSelectRow(selectedRows)
console.log(setSelectedRowKeys)
}
};
const [columnsTab, setcolumnsTab] = useState<any>([]); const [columnsTab, setcolumnsTab] = useState<any>([]);
/* 确定 */ /* 确定 */
const handleOk = () => { const handleOk = () => {
console.log(dataList) let list = RowCtl.selectRow;
let dataArr = dataList.length != 0 ? dataList.concat(selectRow) : selectRow; list.map((item: any, index: number) => {
const hash = {}
let templateList = dataArr.reduceRight((item, next) => {
if (!hash[next.id]) hash[next.id] = true && item.push(next)
return item
}, [])
templateList.map((item: any, index: number) => {
item.rowId = index + 1 item.rowId = index + 1
dataArr.push(item);
}) })
setData(templateList) setData(list)
setIsModalVisible(false); setIsModalVisible(false);
}; };
/* 获取商品 */ /* 获取商品 */
...@@ -59,11 +42,9 @@ const FormList = (props: any) => { ...@@ -59,11 +42,9 @@ const FormList = (props: any) => {
/* 删除 */ /* 删除 */
const handleDelete = (id) => { const handleDelete = (id) => {
const dataSource = [...dataList]; const dataSource = [...dataList];
const RowKeys = [...selectedRowKeys]
let List = dataSource.filter((item) => item.id !== id); let List = dataSource.filter((item) => item.id !== id);
const RowKeysList = RowKeys.filter(item => item !== id);
setData(List) setData(List)
setSelectedRowKeys(RowKeysList) // setSelectedRowKeys(RowKeysList)
}; };
/* 获取物料信息 */ /* 获取物料信息 */
const getList = () => { const getList = () => {
...@@ -439,7 +420,7 @@ const FormList = (props: any) => { ...@@ -439,7 +420,7 @@ const FormList = (props: any) => {
}} }}
columns={goodcolumns} columns={goodcolumns}
currentRef={refs} currentRef={refs}
rowSelection={rowSelectionGood} rowSelection={rowSelection}
fetchTableData={(params: any) => getGoodsList(params)} fetchTableData={(params: any) => getGoodsList(params)}
/> />
</Modal> </Modal>
......
...@@ -3,7 +3,7 @@ import { Button, Card, Tabs, message } from 'antd' ...@@ -3,7 +3,7 @@ import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Information from './components/Information' import Information from './components/Information'
import FormList from './components/FormList' import FormList from './components/FormList'
import Fromtable from './components/fromtable' import Fromtable from './components/Fromtable'
import ContractText from './components/ContractText' import ContractText from './components/ContractText'
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { history } from 'umi' import { history } from 'umi'
......
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