Commit 11b8315a56b8390838cc04e810e7c2d6dccfa2bb

Authored by boyang
1 parent ab8e1402

fix: 修复预警请求数据无法刷新

src/pages/Order/OrderWarning/index.tsx
... ... @@ -192,7 +192,9 @@ const OrderPage = () => {
192 192 const [subOrderCount, setSubOrderCount] = useState(0);
193 193 const [sorted] = useState(false);
194 194 const mainTableRef = useRef<ActionType>();
  195 + const mainTableSecondRef = useRef<ActionType>();
195 196 const mainTableFormRef = useRef<ProFormInstance>();
  197 + const mainTableSecondFormRef = useRef<ProFormInstance>();
196 198 let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储
197 199 console.log(searchParams);
198 200 const [messageApi, contextHolder] = message.useMessage();
... ... @@ -4210,7 +4212,8 @@ const OrderPage = () =&gt; {
4210 4212 // 监听 calDate 变化,触发请求
4211 4213 useEffect(() => {
4212 4214 if (calDate2) {
4213   - mainTableRef.current?.reload();
  4215 + // mainTableRef.current?.reload();
  4216 + mainTableSecondRef.current?.reload();
4214 4217 }
4215 4218 }, [calDate2]);
4216 4219  
... ... @@ -4234,8 +4237,9 @@ const OrderPage = () =&gt; {
4234 4237 * 以params中的id为主,如果params没id,则取url中的id
4235 4238 * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来
4236 4239 */
4237   - let orderIds = mainTableFormRef.current?.getFieldValue('id');
4238   - let subOrderId = mainTableFormRef.current?.getFieldValue('subOrderId');
  4240 + let orderIds = mainTableSecondFormRef.current?.getFieldValue('id');
  4241 + let subOrderId =
  4242 + mainTableSecondFormRef.current?.getFieldValue('subOrderId');
4239 4243 params.id = params.id || orderIds;
4240 4244 params.subOrderId = params.subOrderId || subOrderId;
4241 4245 if (params.id !== '') {
... ... @@ -4919,8 +4923,8 @@ const OrderPage = () =&gt; {
4919 4923 id="main-table"
4920 4924 // tableStyle={{backgroundColor:'red'}}
4921 4925  
4922   - actionRef={mainTableRef}
4923   - formRef={mainTableFormRef}
  4926 + actionRef={mainTableSecondRef}
  4927 + formRef={mainTableSecondFormRef}
4924 4928 expandIconColumnIndex={-1}
4925 4929 columns={mainOrdersColumns}
4926 4930 rowKey="id"
... ...