|
@@ -6,6 +6,7 @@ import BuildSelect from '../../../components/SelectButton/BuildSelect'
|
6
|
6
|
import apis from '../../../services/apis';
|
7
|
7
|
import request from '../../../utils/request'
|
8
|
8
|
import AuthButton from '../../../components/AuthButton';
|
|
9
|
+import Prompt from 'umi/prompt';
|
9
|
10
|
|
10
|
11
|
/**
|
11
|
12
|
@param {*} props
|
|
@@ -34,12 +35,27 @@ function record(props) {
|
34
|
35
|
const [visible, setVisible] = useState(false)
|
35
|
36
|
|
36
|
37
|
useEffect(() => {
|
37
|
|
- getList(formData);
|
|
38
|
+ if (localStorage.getItem("consultantPageParams")) {
|
|
39
|
+ props.form.setFieldsValue(JSON.parse(localStorage.getItem("consultantPageParams")));
|
|
40
|
+ const consultantPageParams = JSON.parse(localStorage.getItem("consultantPageParams"))
|
|
41
|
+ updateRadioVal(moment(consultantPageParams.endDate).diff(moment(consultantPageParams.startDate), 'day'))
|
|
42
|
+ updateFormData({
|
|
43
|
+ ...formData,
|
|
44
|
+ startDate: consultantPageParams.startDate,
|
|
45
|
+ endDate: consultantPageParams.endDate,
|
|
46
|
+ buildingId: consultantPageParams.buildingId,
|
|
47
|
+ pageNum:consultantPageParams.pageNum
|
|
48
|
+ })
|
|
49
|
+ getList(JSON.parse(localStorage.getItem("consultantPageParams")))
|
|
50
|
+ } else {
|
|
51
|
+ getList(formData);
|
|
52
|
+ }
|
38
|
53
|
}, [])
|
39
|
54
|
|
40
|
55
|
// 查询列表
|
41
|
56
|
const getList = (params) => {
|
42
|
57
|
updataLoading(true)
|
|
58
|
+ localStorage.setItem("consultantPageParams", JSON.stringify(params));
|
43
|
59
|
request({ ...apis.stats.consultantKPI, params: { ...params }, }).then((data) => {
|
44
|
60
|
setData(data.paged)
|
45
|
61
|
setTotalRow(data.total)
|
|
@@ -448,6 +464,10 @@ function record(props) {
|
448
|
464
|
< div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
449
|
465
|
<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
450
|
466
|
</div>
|
|
467
|
+ <Prompt message={location =>
|
|
468
|
+ location.pathname.startsWith("/statistical/consultant")
|
|
469
|
+ ? true
|
|
470
|
+ : localStorage.removeItem("consultantPageParams")} />
|
451
|
471
|
</>
|
452
|
472
|
)
|
453
|
473
|
}
|