@@ -62,6 +62,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
6262 getProjectList ( )
6363 } , [ ] )
6464
65+ /**
66+ * 重置时间范围
67+ */
68+ let resetTimeRange = ( ) => { }
69+ /**
70+ * 绑定时间范围组件
71+ * @param instance
72+ */
73+ const bindRef = ( instance : any ) => {
74+ resetTimeRange = instance . reset
75+ }
6576 const getApiList = ( projectIds ?: string [ ] ) => {
6677 return fetchData < { apis : EntityItem [ ] } > ( 'simple/service/apis' , {
6778 method : 'POST' ,
@@ -146,6 +157,7 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
146157 }
147158
148159 const clearSearch = ( ) => {
160+ resetTimeRange ( )
149161 setTimeButton ( 'hour' )
150162 setDatePickerValue ( null )
151163 setQueryData ( undefined )
@@ -186,11 +198,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
186198 setDrawerOpen ( true )
187199 }
188200
201+ useEffect ( ( ) => {
202+ setQueryBtnLoading ( true )
203+ getApiTableList ( )
204+ } , [ queryData ] )
205+
189206 return (
190207 < div className = "overflow-hidden h-full pr-PAGE_INSIDE_X" >
191208 < ScrollableSection >
192209 < div className = "pl-btnbase pr-btnrbase pb-btnbase content-before" >
193210 < TimeRangeSelector
211+ bindRef = { bindRef }
194212 labelSize = "small"
195213 initialTimeButton = { timeButton }
196214 onTimeButtonChange = { setTimeButton }
@@ -235,12 +253,8 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
235253 < div className = "w-[346px] inline-block" >
236254 { /* <SearchInputGroup eoSingle={false} eoInputVal={queryData.path} eoClick={() => setQueryData({ ...queryData, path: '' })} /> */ }
237255 < Input
238- value = { queryData ?. path }
239- onChange = { ( e ) =>
240- debounce ( ( e ) => {
241- setQueryData ( ( prevData ) => ( { ...( prevData || { } ) , path : e . target . value } ) )
242- } , 100 ) ( e )
243- }
256+ value = { queryData ?. path || '' }
257+ onChange = { ( e ) => setQueryData ( ( prevData ) => ( { ...( prevData || { } ) , path : e . target . value } ) ) }
244258 allowClear
245259 placeholder = { $t ( '请输入请求路径进行搜索' ) }
246260 prefix = { < SearchOutlined className = "cursor-pointer" /> }
@@ -249,17 +263,6 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
249263 < Button className = "ml-btnybase" onClick = { clearSearch } >
250264 { $t ( '重置' ) }
251265 </ Button >
252- < Button
253- type = "primary"
254- loading = { queryBtnLoading }
255- className = "ml-btnybase"
256- onClick = { ( ) => {
257- setQueryBtnLoading ( true )
258- getApiTableList ( )
259- } }
260- >
261- { $t ( '查询' ) }
262- </ Button >
263266 < Button className = "ml-btnybase" loading = { exportLoading } onClick = { exportData } >
264267 { $t ( '导出' ) }
265268 </ Button >
0 commit comments