|
@@ -3,19 +3,18 @@ import React, {
|
|
|
} from 'react';
|
|
|
import { Input, Table,Row,Col } from 'antd';
|
|
|
import apiObj from '@api/index';
|
|
|
-import { getCookie,setCookie } from '@utils/index';
|
|
|
-import DiagContext from './Diag-context';
|
|
|
-import { useSelector } from 'react-redux'
|
|
|
const { post, api } = apiObj;
|
|
|
const { Search } = Input;
|
|
|
|
|
|
function MatchDiag(props) {
|
|
|
+ const isMapping = props.row.isMapping==="已匹配";
|
|
|
const [DiagList, setDiagList] = useState([]);//当前页列表数据
|
|
|
const [size, setSize] = useState(15);//每页显示条数
|
|
|
const [total, setTotal] = useState(0);
|
|
|
const [current, setCurrent] = useState(1);//当前页
|
|
|
- const [text,setText] = useState(props.row.name);//输入框中内容
|
|
|
+ const [text,setText] = useState(isMapping?"":props.row.name);//输入框中内容
|
|
|
const [diagId,setDiagId] = useState(props.row.id);//诊断id
|
|
|
+ const [selectedRowKeys,setselectedRowKeys] = useState([]);//选中的行id
|
|
|
const [params, setParams] = useState({
|
|
|
pages: 1,
|
|
|
current: 1,
|
|
@@ -29,18 +28,25 @@ function MatchDiag(props) {
|
|
|
{ title: '同义词', dataIndex: 'synonym',},
|
|
|
];
|
|
|
useEffect(() => {
|
|
|
- //默认显示诊断
|
|
|
- const param = {...params,name:text.trim(),current:1};
|
|
|
+ let param={};
|
|
|
+ if(isMapping){
|
|
|
+ param = {id:props.row.id};
|
|
|
+ }else{
|
|
|
+ //默认搜索诊断名称
|
|
|
+ param = {...params,name:text.trim(),current:1};
|
|
|
+ }
|
|
|
getPage(param);
|
|
|
}, []);
|
|
|
const rowSelection = {
|
|
|
+ preserveSelectedRowKeys:true,
|
|
|
+ selectedRowKeys:selectedRowKeys||[],
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
- console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
|
|
const param = {icd10:selectedRows[0].icd10,
|
|
|
standard:selectedRows[0].standard,
|
|
|
synonym:selectedRows[0].synonym,
|
|
|
id:diagId
|
|
|
};
|
|
|
+ setselectedRowKeys(selectedRowKeys);
|
|
|
//setParams(param);
|
|
|
props.onChange(param);
|
|
|
},
|
|
@@ -72,11 +78,16 @@ function MatchDiag(props) {
|
|
|
setText(val);
|
|
|
}
|
|
|
function getPage(param) {
|
|
|
- post(api.getMatchingDiseasePage, param||params).then((res) => {
|
|
|
+ //已匹配的获取已被匹配的那条数据即可
|
|
|
+ const url = isMapping?api.getDiseaseInfoById:api.getMatchingDiseasePage;
|
|
|
+ post(url, param||params).then((res) => {
|
|
|
if (res.data.code === 200) {
|
|
|
const data = res.data.data;
|
|
|
- setDiagList(data.records);
|
|
|
- setTotal(data.total)
|
|
|
+ const list = isMapping?[data]:data.records;
|
|
|
+ console.log(222,data.id)
|
|
|
+ setselectedRowKeys(isMapping?[data.id]:[]);
|
|
|
+ setDiagList(list);
|
|
|
+ setTotal(data.total||1)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -93,7 +104,7 @@ function MatchDiag(props) {
|
|
|
columns={columns}
|
|
|
scroll={{ y: 'calc(100vh - 320px)' }}
|
|
|
dataSource={DiagList}
|
|
|
- rowKey={(record,i) => {return i+record.icd10}}
|
|
|
+ rowKey={record => record.id}
|
|
|
pagination={{
|
|
|
current: current,
|
|
|
pageSize: size,
|