|
@@ -6,11 +6,11 @@ import React, {
|
|
|
useState,
|
|
|
} from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
-import { Button, Cascader, Input, Popconfirm, Select, Table } from "antd";
|
|
|
+import { Button, Input, Popconfirm, Select, Table } from "antd";
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
import { A2FromDataType, options1 } from "./data";
|
|
|
-import mapDataAll from "../C1User/AddUser/city";
|
|
|
import {
|
|
|
+ A2_APIgetCity,
|
|
|
A2_APIgetlist,
|
|
|
A2_APIgetlistDerive,
|
|
|
A2_APIremoves,
|
|
@@ -24,12 +24,35 @@ import dayjs from "dayjs";
|
|
|
import ExportJsonExcel from "js-export-excel";
|
|
|
|
|
|
function A2Psychz() {
|
|
|
+ // 站址地区的数据-下拉框
|
|
|
+
|
|
|
+ const [optionsCity, setOptionsCity] = useState<
|
|
|
+ { value: string; label: string }[]
|
|
|
+ >([]);
|
|
|
+
|
|
|
+ const getCityFu = useCallback(async () => {
|
|
|
+ const res = await A2_APIgetCity();
|
|
|
+ if (res.code === 0) {
|
|
|
+ const data: string[] = res.data;
|
|
|
+ const arr = data.map((v) => ({
|
|
|
+ value: v,
|
|
|
+ label: v,
|
|
|
+ }));
|
|
|
+ setOptionsCity([{ value: "", label: "全部" }, ...arr]);
|
|
|
+ // console.log(123, res);
|
|
|
+ }
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getCityFu();
|
|
|
+ }, [getCityFu]);
|
|
|
+
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
// 筛选和分页
|
|
|
const [tableSelect, setTableSelect] = useState<A2FromDataType>({
|
|
|
siteLevel: 2,
|
|
|
- site: undefined,
|
|
|
+ site: "",
|
|
|
searchKey: "",
|
|
|
pmUser: "",
|
|
|
typeIn: "",
|
|
@@ -41,7 +64,7 @@ function A2Psychz() {
|
|
|
const getListFu = useCallback(() => {
|
|
|
const obj = {
|
|
|
...tableSelect,
|
|
|
- site: tableSelect.site ? tableSelect.site[1] : null,
|
|
|
+ site: tableSelect.site ? tableSelect.site : null,
|
|
|
};
|
|
|
dispatch(A2_APIgetlist(obj));
|
|
|
}, [dispatch, tableSelect]);
|
|
@@ -69,7 +92,7 @@ function A2Psychz() {
|
|
|
setInputKey(Date.now());
|
|
|
setTableSelect({
|
|
|
siteLevel: 2,
|
|
|
- site: undefined,
|
|
|
+ site: "",
|
|
|
searchKey: "",
|
|
|
pmUser: "",
|
|
|
typeIn: "",
|
|
@@ -270,14 +293,13 @@ function A2Psychz() {
|
|
|
<div className="A2top1">
|
|
|
<div className="A2topRow">
|
|
|
<span>站址地区:</span>
|
|
|
- <Cascader
|
|
|
+ <Select
|
|
|
+ style={{ width: 130 }}
|
|
|
value={tableSelect.site}
|
|
|
- style={{ width: 160 }}
|
|
|
- options={mapDataAll}
|
|
|
- placeholder="全部"
|
|
|
onChange={(e) =>
|
|
|
- setTableSelect({ ...tableSelect, site: e as string[] })
|
|
|
+ setTableSelect({ ...tableSelect, site: e, pageNum: 1 })
|
|
|
}
|
|
|
+ options={optionsCity}
|
|
|
/>
|
|
|
</div>
|
|
|
|