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