|
@@ -33,60 +33,90 @@ import dayjs from "dayjs";
|
|
|
import AuditMo from "./AuditMo";
|
|
|
import clasNames from "classnames";
|
|
|
import { mapDataAll1 } from "../C1User/AddUser/city";
|
|
|
+import LookReDo from "./LookReDo";
|
|
|
|
|
|
function B2Scene() {
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
// 筛选和分页
|
|
|
const [tableSelect, setTableSelect] = useState<B2FromDataType>({
|
|
|
+ siteArr: undefined,
|
|
|
+ province: "",
|
|
|
+ city: "",
|
|
|
+ region: "",
|
|
|
auditStatus: "",
|
|
|
pmUser: "",
|
|
|
searchKey: "",
|
|
|
- siteLevel: 2,
|
|
|
- site: undefined,
|
|
|
pageSize: 10,
|
|
|
pageNum: 1,
|
|
|
});
|
|
|
|
|
|
+ const tableSelectRef = useRef({} as B2FromDataType);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ tableSelectRef.current = { ...tableSelect };
|
|
|
+ }, [tableSelect]);
|
|
|
+
|
|
|
+ // 点击搜索的 时间戳
|
|
|
+ const [timeKey, setTimeKey] = useState(-1);
|
|
|
+
|
|
|
// 发送接口的函数
|
|
|
const getListFu = useCallback(() => {
|
|
|
+ const objTemp: any = {};
|
|
|
+
|
|
|
+ if (tableSelectRef.current.siteArr) {
|
|
|
+ const temp = tableSelectRef.current.siteArr;
|
|
|
+ objTemp.province = temp[0] || "";
|
|
|
+ objTemp.city = temp[1] || "";
|
|
|
+ objTemp.region = temp[2] || "";
|
|
|
+ }
|
|
|
+
|
|
|
const obj = {
|
|
|
- ...tableSelect,
|
|
|
- site: tableSelect.site ? tableSelect.site[1] : null,
|
|
|
+ ...tableSelectRef.current,
|
|
|
+ ...objTemp,
|
|
|
};
|
|
|
dispatch(B2_APIgetlist(obj));
|
|
|
- }, [dispatch, tableSelect]);
|
|
|
+ }, [dispatch]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
getListFu();
|
|
|
- }, [getListFu]);
|
|
|
+ }, [getListFu, timeKey]);
|
|
|
|
|
|
// 输入框的改变
|
|
|
- const txtTimeRef = useRef(-1);
|
|
|
const txtChangeFu = useCallback(
|
|
|
(txt: string, key: "pmUser" | "searchKey") => {
|
|
|
- clearTimeout(txtTimeRef.current);
|
|
|
- txtTimeRef.current = window.setTimeout(() => {
|
|
|
- setTableSelect({ ...tableSelect, [key]: txt, pageNum: 1 });
|
|
|
- }, 500);
|
|
|
+ setTableSelect({ ...tableSelect, [key]: txt });
|
|
|
},
|
|
|
[tableSelect]
|
|
|
);
|
|
|
|
|
|
+ // 点击搜索
|
|
|
+ const clickSearch = useCallback(() => {
|
|
|
+ setTableSelect({ ...tableSelect, pageNum: 1 });
|
|
|
+ setTimeout(() => {
|
|
|
+ setTimeKey(Date.now());
|
|
|
+ }, 50);
|
|
|
+ }, [tableSelect]);
|
|
|
+
|
|
|
// 点击重置
|
|
|
const [inputKey, setInputKey] = useState(1);
|
|
|
const resetSelectFu = useCallback(() => {
|
|
|
// 把2个输入框和时间选择器清空
|
|
|
setInputKey(Date.now());
|
|
|
setTableSelect({
|
|
|
+ siteArr: undefined,
|
|
|
+ province: "",
|
|
|
+ city: "",
|
|
|
+ region: "",
|
|
|
auditStatus: "",
|
|
|
pmUser: "",
|
|
|
searchKey: "",
|
|
|
- siteLevel: 2,
|
|
|
- site: undefined,
|
|
|
pageSize: 10,
|
|
|
pageNum: 1,
|
|
|
});
|
|
|
+ setTimeout(() => {
|
|
|
+ setTimeKey(Date.now());
|
|
|
+ }, 50);
|
|
|
}, []);
|
|
|
|
|
|
// 从仓库获取列表
|
|
@@ -97,6 +127,9 @@ function B2Scene() {
|
|
|
const paginationChange = useCallback(
|
|
|
() => (pageNum: number, pageSize: number) => {
|
|
|
setTableSelect({ ...tableSelect, pageNum, pageSize });
|
|
|
+ setTimeout(() => {
|
|
|
+ setTimeKey(Date.now());
|
|
|
+ }, 50);
|
|
|
},
|
|
|
[tableSelect]
|
|
|
);
|
|
@@ -134,9 +167,9 @@ function B2Scene() {
|
|
|
{
|
|
|
title: "站址地区",
|
|
|
render: (item: B2tableType) =>
|
|
|
- !item.province && !item.city
|
|
|
+ !item.province && !item.city && !item.region
|
|
|
? "(空)"
|
|
|
- : `${item.province} - ${item.city}`,
|
|
|
+ : `${item.province}-${item.city}-${item.region}`,
|
|
|
},
|
|
|
// 待完善
|
|
|
{
|
|
@@ -297,13 +330,24 @@ function B2Scene() {
|
|
|
return MessageFu.warning("当前搜索条件没有数据!");
|
|
|
const name = "场景审核" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
|
|
|
|
|
|
+ const objTemp: any = {};
|
|
|
+
|
|
|
+ if (tableSelectRef.current.siteArr) {
|
|
|
+ const temp = tableSelectRef.current.siteArr;
|
|
|
+ objTemp.province = temp[0] || "";
|
|
|
+ objTemp.city = temp[1] || "";
|
|
|
+ objTemp.region = temp[2] || "";
|
|
|
+ }
|
|
|
+
|
|
|
const res = await B2_APIgetlistAll({
|
|
|
...tableSelect,
|
|
|
- site: tableSelect.site ? tableSelect.site[1] : null,
|
|
|
+ ...objTemp,
|
|
|
pageNum: 1,
|
|
|
pageSize: 99999,
|
|
|
});
|
|
|
if (res.code === 0) {
|
|
|
+ if (res.data.records.length <= 0)
|
|
|
+ return MessageFu.warning("当前搜索条件没有数据!");
|
|
|
const option = {
|
|
|
fileName: name,
|
|
|
datas: [
|
|
@@ -311,7 +355,9 @@ function B2Scene() {
|
|
|
sheetData: res.data.records.map((v: B2tableType) => ({
|
|
|
roomNum: v.roomNum || "(空)",
|
|
|
myCity:
|
|
|
- !v.province && !v.city ? "(空)" : `${v.province} - ${v.city}`,
|
|
|
+ !v.province && !v.city && !v.region
|
|
|
+ ? "(空)"
|
|
|
+ : `${v.province}-${v.city}-${v.region}`,
|
|
|
pmName: v.creatorId === 1 ? "管理员" : v.pmName || "(空)",
|
|
|
sceneName: v.sceneName || "(空)",
|
|
|
link: v.link || "(空)",
|
|
@@ -371,6 +417,9 @@ function B2Scene() {
|
|
|
auditDesc: "",
|
|
|
});
|
|
|
|
|
|
+ // 查看重复的场景
|
|
|
+ const [lookReDo, setLookReDo] = useState(false);
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.B2Scene}>
|
|
|
<div className="pageTitle">场景审核</div>
|
|
@@ -383,7 +432,7 @@ function B2Scene() {
|
|
|
<Input
|
|
|
key={inputKey}
|
|
|
maxLength={24}
|
|
|
- style={{ width: 246 }}
|
|
|
+ style={{ width: 250 }}
|
|
|
placeholder="请输入机房编码/场景码,最多24字"
|
|
|
allowClear
|
|
|
onChange={(e) => txtChangeFu(e.target.value, "searchKey")}
|
|
@@ -393,53 +442,63 @@ function B2Scene() {
|
|
|
<div className="B2topRow">
|
|
|
<span>站址地区:</span>
|
|
|
<Cascader
|
|
|
- value={tableSelect.site}
|
|
|
- style={{ width: 180 }}
|
|
|
+ changeOnSelect
|
|
|
+ value={tableSelect.siteArr}
|
|
|
+ style={{ width: 250 }}
|
|
|
options={mapDataAll1}
|
|
|
placeholder="全部"
|
|
|
onChange={(e) =>
|
|
|
- setTableSelect({ ...tableSelect, site: e as string[] })
|
|
|
- }
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className="B2topRow">
|
|
|
- <span>项目经理:</span>
|
|
|
- <Input
|
|
|
- key={inputKey}
|
|
|
- maxLength={10}
|
|
|
- style={{ width: 180 }}
|
|
|
- placeholder="请输入姓名,最多10字"
|
|
|
- allowClear
|
|
|
- onChange={(e) => txtChangeFu(e.target.value, "pmUser")}
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className="B2topRow">
|
|
|
- <span>审核状态:</span>
|
|
|
- <Select
|
|
|
- style={{ width: 140 }}
|
|
|
- value={tableSelect.auditStatus}
|
|
|
- onChange={(e) =>
|
|
|
- setTableSelect({ ...tableSelect, auditStatus: e, pageNum: 1 })
|
|
|
+ setTableSelect({ ...tableSelect, siteArr: e as string[] })
|
|
|
}
|
|
|
- options={B1options1}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
{/* 右侧按钮 */}
|
|
|
<div className="B2top2">
|
|
|
- <Button onClick={resetSelectFu}>重置</Button> 
|
|
|
- <Button type="primary" onClick={deriveFu}>
|
|
|
- 导出表格
|
|
|
- </Button>
|
|
|
+ <div>
|
|
|
+ <div className="B2topRow">
|
|
|
+ <span>项目经理:</span>
|
|
|
+ <Input
|
|
|
+ key={inputKey}
|
|
|
+ maxLength={10}
|
|
|
+ style={{ width: 235 }}
|
|
|
+ placeholder="请输入姓名,最多10字"
|
|
|
+ allowClear
|
|
|
+ onChange={(e) => txtChangeFu(e.target.value, "pmUser")}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="B2topRow">
|
|
|
+ <span>审核状态:</span>
|
|
|
+ <Select
|
|
|
+ style={{ width: 250 }}
|
|
|
+ value={tableSelect.auditStatus}
|
|
|
+ onChange={(e) =>
|
|
|
+ setTableSelect({ ...tableSelect, auditStatus: e })
|
|
|
+ }
|
|
|
+ options={B1options1}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <Button onClick={() => setLookReDo(true)}>查看重复的场景</Button>
|
|
|
+  
|
|
|
+ <Button onClick={resetSelectFu}>重置</Button> 
|
|
|
+ <Button type="primary" onClick={clickSearch}>
|
|
|
+ 查询
|
|
|
+ </Button>
|
|
|
+  
|
|
|
+ <Button type="primary" onClick={deriveFu}>
|
|
|
+ 导出表格
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
{/* 表格主体 */}
|
|
|
<div className="tableMain">
|
|
|
<Table
|
|
|
- scroll={{ y: 625 }}
|
|
|
+ scroll={{ y: 578 }}
|
|
|
dataSource={B2TableList.list}
|
|
|
columns={columns}
|
|
|
rowKey="id"
|
|
@@ -478,6 +537,14 @@ function B2Scene() {
|
|
|
}}
|
|
|
/>
|
|
|
) : null}
|
|
|
+
|
|
|
+ {/* 查看重复的场景 */}
|
|
|
+ {lookReDo ? <LookReDo closePageFu={() => setLookReDo(false)} /> : null}
|
|
|
+
|
|
|
+ {/* 右下角的列表数量 */}
|
|
|
+ <div className="tableNumBox">
|
|
|
+ 共 <span>{B2TableList.total}</span> 条数据
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|