shaogen1995 11 tháng trước cách đây
mục cha
commit
5c839f377d

+ 22 - 20
src/pages/A2Blogistics/index.tsx

@@ -146,37 +146,39 @@ function A2Blogistics() {
           {
             sheetData: res.data.records.map((item: A2BListType) => ({
               num: item.num || '空',
+              type: item.type === 'CK' ? '出库' : '入库',
+              orderNum: item.orderNum || '空',
+              orderType: A2AtopTypeArr.find(v => v.key === item.orderType)?.name || '(空)',
+              dateStart1: item.type === 'CK' ? item.dateStart || '(空)' : '/',
+              dateStart2: item.type === 'RK' ? item.dateStart || '(空)' : '/',
               creatorName: item.creatorName || '空',
-              updateTime: item.updateTime || '空'
+              updateTime: item.updateTime || '空',
+              rtf: item.rtf || '空'
             })),
             sheetName: name,
             sheetFilter: [
               'num',
-              'dingNum',
-              'dateStart',
-              'dateEnd',
-              'zlName',
-              'myCity',
-              'zlUser',
-              'zlPhone',
-              'pcs',
+              'type',
+              'orderNum',
+              'orderType',
+              'dateStart1',
+              'dateStart2',
               'creatorName',
-              'updateTime'
+              'updateTime',
+              'rtf'
             ],
             sheetHeader: [
               '订单编号',
-              '钉钉审批号',
-              '租赁日期',
-              '预计归还日期',
-              '租赁方名称',
-              '地区',
-              '负责人',
-              '联系方式',
-              '设备台数',
+              '订单类型',
+              '关联业务订单号',
+              '关联业务类型',
+              '发货日期',
+              '收货日期',
               '编辑人',
-              '更新日期'
+              '更新日期',
+              '备注'
             ],
-            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
+            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 20]
           }
         ]
       }

+ 20 - 0
src/pages/B2Scene/B2DelList/index.module.scss

@@ -0,0 +1,20 @@
+.B2DelList {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  overflow: hidden;
+  :global {
+    .B2top {
+      border-radius: 0;
+      border-bottom: 1px solid #ccc;
+      .B2top2 {
+        padding-left: 90px;
+      }
+      .B2topRow2 {
+        display: flex;
+        align-items: center;
+      }
+    }
+  }
+}

+ 366 - 0
src/pages/B2Scene/B2DelList/index.tsx

@@ -0,0 +1,366 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Cascader, Checkbox, Input, Popconfirm, Table, Tooltip } from 'antd'
+import { useDispatch, useSelector } from 'react-redux'
+import { B2_APIgetlistDel, B2_APIrecoversDel, B2_APIremoveDel } from '@/store/action/B2Scene'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { mapDataAll1 } from '@/pages/C1User/AddUser/city'
+import { LeftOutlined, QuestionCircleOutlined } from '@ant-design/icons'
+import { B2tableType } from '@/types'
+import { B2ResNum } from '../data'
+
+type TopObjType = {
+  siteArr: undefined | string[]
+  province: string
+  city: string
+  region: string
+  searchKey: string
+  roomName: string
+  isSiteEmpty: 1 | 0
+  pageSize: number
+  pageNum: number
+}
+
+const topObj: TopObjType = {
+  siteArr: undefined,
+  province: '',
+  city: '',
+  region: '',
+  searchKey: '',
+  roomName: '',
+  isSiteEmpty: 0,
+  pageSize: 10,
+  pageNum: 1
+}
+
+type Props = {
+  sonDelCloseFu: () => void
+  upTableFu: () => void
+}
+
+function B2DelList({ sonDelCloseFu, upTableFu }: Props) {
+  const dispatch = useDispatch()
+
+  // 筛选和分页
+  const [tableSelect, setTableSelect] = useState<TopObjType>(topObj)
+
+  const tableSelectRef = useRef({} as TopObjType)
+
+  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 = {
+      ...tableSelectRef.current,
+      ...objTemp
+    }
+    dispatch(B2_APIgetlistDel(obj))
+  }, [dispatch])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu, timeKey])
+
+  // 输入框的改变
+  const txtChangeFu = useCallback(
+    (txt: string, key: 'roomName' | 'searchKey') => {
+      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(topObj)
+    setTimeout(() => {
+      setTimeKey(Date.now())
+    }, 50)
+  }, [])
+
+  // 从仓库获取列表
+  const B2TableListDel = useSelector((state: RootState) => state.B2Scene.B2TableListDel)
+  // 页码变化
+  const paginationChange = useCallback(
+    () => (pageNum: number, pageSize: number) => {
+      setTableSelect({ ...tableSelect, pageNum, pageSize })
+      setTimeout(() => {
+        setTimeKey(Date.now())
+      }, 50)
+    },
+    [tableSelect]
+  )
+
+  // 点击表格里面的删除
+  const delByIdFu = useCallback(
+    async (id: number) => {
+      const res = await B2_APIremoveDel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  // 看看是点击了 恢复 并且 恢复成功
+  const isRecovers = useRef(false)
+
+  //  点击返回
+  const backFu = useCallback(() => {
+    if (isRecovers.current) upTableFu()
+    sonDelCloseFu()
+  }, [sonDelCloseFu, upTableFu])
+
+  // 点击表格里面的 恢复
+  const recoversByIdFu = useCallback(
+    async (id: number) => {
+      const res = await B2_APIrecoversDel(id)
+      if (res.code === 0) {
+        MessageFu.success('恢复成功!')
+        isRecovers.current = true
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  const columns = useMemo(() => {
+    return [
+      {
+        title: '机房编码',
+        render: (item: B2tableType) => item.roomNum || '(空)'
+      },
+      {
+        title: '站址地区',
+        render: (item: B2tableType) =>
+          !item.province && !item.city && !item.region
+            ? '(空)'
+            : `${item.province}-${item.city}-${item.region}`
+      },
+      {
+        title: '站址名称',
+        render: (item: B2tableType) => item.roomName || '(空)'
+      },
+      // {
+      //   title: '场景名称',
+      //   render: (item: B2tableType) => item.sceneName || '(空)'
+      // },
+      {
+        title: '场景链接',
+        render: (item: B2tableType) =>
+          item.link ? (
+            <a
+              target='_blank'
+              href={item.link}
+              style={{ cursor: 'pointer' }}
+              title={item.link}
+              rel='noreferrer'
+            >
+              {item.link.length >= 25 ? item.link.substring(0, 25) + '...' : item.link}
+            </a>
+          ) : (
+            '(空)'
+          )
+      },
+      {
+        title: '场景码',
+        render: (item: B2tableType) => (
+          <>
+            {item.sceneCode || '(空)'}
+
+            {/* up-只有计算失败的时候显示 ?  */}
+            {item.scheduleStatus === 2 ? (
+              <span
+                style={{ cursor: 'pointer' }}
+                hidden={!item.scheduleStatus && item.scheduleStatus !== 0}
+              >
+                <Tooltip title={Reflect.get(B2ResNum, item.scheduleStatus)}>
+                  &nbsp;
+                  <QuestionCircleOutlined rev={undefined} />
+                </Tooltip>
+              </span>
+            ) : null}
+          </>
+        )
+      },
+      {
+        title: '相机SN码',
+        render: (item: B2tableType) => item.cameraSn || '(空)'
+      },
+      {
+        title: '拍摄时间',
+        render: (item: B2tableType) => item.shootTime || '(空)'
+      },
+      {
+        title: '删除时间',
+        render: (item: B2tableType) => item.shootTime || '(空)'
+      },
+
+      {
+        title: '删除人',
+        render: (item: B2tableType) => item.creatorName || '(空)'
+      },
+      {
+        title: '操作',
+        render: (item: B2tableType) => (
+          <>
+            <Popconfirm
+              title='确定恢复吗?'
+              okText='恢复'
+              cancelText='取消'
+              onConfirm={() => recoversByIdFu(item.id)}
+              okButtonProps={{ loading: false }}
+            >
+              <Button size='small' type='text'>
+                恢复
+              </Button>
+            </Popconfirm>
+
+            <Popconfirm
+              title='删除后无法恢复,是否删除?'
+              okText='删除'
+              cancelText='取消'
+              onConfirm={() => delByIdFu(item.id)}
+              okButtonProps={{ loading: false }}
+            >
+              <Button size='small' type='text' danger>
+                彻底删除
+              </Button>
+            </Popconfirm>
+          </>
+        )
+      }
+    ]
+  }, [delByIdFu, recoversByIdFu])
+
+  return (
+    <div className={styles.B2DelList}>
+      {/* 顶部筛选 */}
+      <div className='B2top'>
+        {/* 左侧输入框 */}
+        <div className='B2top1'>
+          <div className='B2topRow'>
+            <Button icon={<LeftOutlined rev={undefined} />} onClick={backFu}>
+              返回
+            </Button>
+          </div>
+
+          <div className='B2topRow'>
+            <span>搜索项:</span>
+            <Input
+              key={inputKey}
+              maxLength={24}
+              style={{ width: 250 }}
+              placeholder='请输入机房编码/场景码,最多24字'
+              allowClear
+              onChange={e => txtChangeFu(e.target.value, 'searchKey')}
+            />
+          </div>
+
+          <div className='B2topRow'>
+            <span>站址地区:</span>
+            <Cascader
+              disabled={!!tableSelect.isSiteEmpty}
+              changeOnSelect
+              value={tableSelect.siteArr}
+              style={{ width: 250 }}
+              options={mapDataAll1}
+              placeholder='全部'
+              onChange={e => setTableSelect({ ...tableSelect, siteArr: e as string[] })}
+            />
+          </div>
+        </div>
+        {/* 右侧按钮 */}
+        <div className='B2top2'>
+          <div>
+            <div className='B2topRow'>
+              <span>站址名称:</span>
+              <Input
+                key={inputKey}
+                maxLength={10}
+                style={{ width: 250 }}
+                placeholder='请输入站址名称,最多10字'
+                allowClear
+                onChange={e => txtChangeFu(e.target.value, 'roomName')}
+              />
+            </div>
+
+            <div className='B2topRow B2topRow2'>
+              <Checkbox
+                checked={!!tableSelect.isSiteEmpty}
+                onChange={e =>
+                  setTableSelect({
+                    ...tableSelect,
+                    siteArr: e.target.checked ? undefined : tableSelect.siteArr,
+                    isSiteEmpty: e.target.checked ? 1 : 0
+                  })
+                }
+              >
+                仅查看站址地区为空的场景
+              </Checkbox>
+            </div>
+          </div>
+          <div>
+            {/* 待完善 */}
+            {/* <Button onClick={() => setLookReDo(true)}>查看重复的场景</Button> */}
+            &emsp;
+            <Button onClick={resetSelectFu}>重置</Button>&emsp;
+            <Button type='primary' onClick={clickSearch}>
+              查询
+            </Button>
+          </div>
+        </div>
+      </div>
+
+      {/* 表格主体 */}
+      <div className='tableMain'>
+        <Table
+          size='small'
+          scroll={{ y: 500 }}
+          dataSource={B2TableListDel.list}
+          columns={columns}
+          rowKey='id'
+          pagination={{
+            showQuickJumper: true,
+            position: ['bottomCenter'],
+            showSizeChanger: true,
+            current: tableSelect.pageNum,
+            pageSize: tableSelect.pageSize,
+            total: B2TableListDel.total,
+            onChange: paginationChange()
+          }}
+        />
+      </div>
+    </div>
+  )
+}
+
+const MemoB2DelList = React.memo(B2DelList)
+
+export default MemoB2DelList

+ 22 - 23
src/pages/B2Scene/index.module.scss

@@ -10,7 +10,7 @@
         color: black;
       }
 
-      &>div {
+      & > div {
         display: flex;
 
         .B2topRow {
@@ -26,7 +26,7 @@
         margin-top: 15px;
         justify-content: space-between;
 
-        &>div {
+        & > div {
           display: flex;
         }
       }
@@ -45,7 +45,7 @@
 
         .B2audit {
           cursor: pointer;
-          color: #1677ff
+          color: #1677ff;
         }
 
         .B2auditNo {
@@ -65,14 +65,25 @@
       // 下载json
       .B2TabA {
         color: var(--themeColor);
-
       }
 
       .B2TabANo {
         color: #ccc;
         cursor: not-allowed;
       }
+    }
 
+    // 已删除的场景码=》回收站
+    .delListBox {
+      position: absolute;
+      top: 0;
+      left: 0;
+      z-index: 100;
+      width: 100%;
+      height: 100%;
+      padding: 50px;
+      background-color: rgba(0, 0, 0, 0.6);
+      border-radius: 10px;
     }
   }
 }
@@ -80,7 +91,6 @@
 // -----------审核
 .AuditMo {
   :global {
-
     .ant-modal-close {
       display: none;
     }
@@ -90,7 +100,6 @@
     }
 
     .B2Amain {
-
       .B2Arow {
         margin-top: 30px;
         display: flex;
@@ -99,8 +108,7 @@
           width: 100px;
           text-align: right;
 
-
-          &>span {
+          & > span {
             font-size: 14px;
             color: #ff4d4f;
           }
@@ -108,7 +116,6 @@
 
         .B2Arow2 {
           width: calc(100% - 100px);
-
         }
 
         &:nth-of-type(1) {
@@ -116,7 +123,6 @@
             position: relative;
             top: 3px;
           }
-
         }
       }
 
@@ -125,8 +131,6 @@
         text-align: center;
       }
     }
-
-
   }
 }
 
@@ -167,12 +171,11 @@
             right: 0px;
             bottom: 5px;
 
-            &>span {
+            & > span {
               color: var(--themeColor);
             }
           }
         }
-
       }
     }
   }
@@ -197,7 +200,7 @@
           display: flex;
           align-items: center;
 
-          &>div {
+          & > div {
             &:nth-of-type(1) {
               width: 100px;
               text-align: right;
@@ -210,7 +213,7 @@
         }
 
         .B2Ebox1Err {
-          &>div {
+          & > div {
             &:nth-of-type(1) {
               opacity: 0;
             }
@@ -221,14 +224,11 @@
           }
         }
 
-
         .B2Ebtn {
           margin-top: 20px;
           text-align: center;
           position: relative;
-
         }
-
       }
     }
   }
@@ -248,16 +248,15 @@
         border-top: 1px solid #ccc;
         padding-top: 15px;
 
-        textarea{
+        textarea {
           height: 400px !important;
         }
-  
+
         .B2mBtn {
           display: flex;
           justify-content: space-between;
         }
-
       }
     }
   }
-}
+}

+ 241 - 268
src/pages/B2Scene/index.tsx

@@ -1,181 +1,160 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import {
-  Button,
-  Cascader,
-  Checkbox,
-  Input,
-  Popconfirm,
-  Select,
-  Table,
-  Tooltip,
-} from "antd";
-import { useDispatch, useSelector } from "react-redux";
-import { B2FromDataType, B2ResNum } from "./data";
-import { B1options1, B1options1Obj } from "../B1Plan/data";
-import {
-  B2_APIgetlist,
-  B2_APIgetlistAll,
-  B2_APIremove,
-  B2_APIreset,
-} from "@/store/action/B2Scene";
-import store, { RootState } from "@/store";
-import { B2tableType } from "@/types";
-import { MessageFu } from "@/utils/message";
-import { QuestionCircleOutlined } from "@ant-design/icons";
-import ExportJsonExcel from "js-export-excel";
-import dayjs from "dayjs";
-import AuditMo from "./AuditMo";
-import clasNames from "classnames";
-import { mapDataAll1 } from "../C1User/AddUser/city";
-import LookReDo from "./LookReDo";
-import EditNum from "./EditNum";
-import MateNum from "./MateNum";
-import { getTokenInfo } from "@/utils/storage";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Cascader, Checkbox, Input, Popconfirm, Select, Table, Tooltip } from 'antd'
+import { useDispatch, useSelector } from 'react-redux'
+import { B2FromDataType, B2ResNum } from './data'
+import { B1options1, B1options1Obj } from '../B1Plan/data'
+import { B2_APIgetlist, B2_APIgetlistAll, B2_APIremove, B2_APIreset } from '@/store/action/B2Scene'
+import store, { RootState } from '@/store'
+import { B2tableType } from '@/types'
+import { MessageFu } from '@/utils/message'
+import { QuestionCircleOutlined } from '@ant-design/icons'
+import ExportJsonExcel from 'js-export-excel'
+import dayjs from 'dayjs'
+import AuditMo from './AuditMo'
+import clasNames from 'classnames'
+import { mapDataAll1 } from '../C1User/AddUser/city'
+import LookReDo from './LookReDo'
+import EditNum from './EditNum'
+import MateNum from './MateNum'
+import { getTokenInfo } from '@/utils/storage'
+import B2DelList from './B2DelList'
 
 function B2Scene() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   // 筛选和分页
   const [tableSelect, setTableSelect] = useState<B2FromDataType>({
     siteArr: undefined,
-    province: "",
-    city: "",
-    region: "",
-    auditStatus: "",
-    roomName: "",
-    searchKey: "",
+    province: '',
+    city: '',
+    region: '',
+    auditStatus: '',
+    roomName: '',
+    searchKey: '',
     pageSize: 10,
     pageNum: 1,
-    isSiteEmpty: 0,
-  });
+    isSiteEmpty: 0
+  })
 
-  const tableSelectRef = useRef({} as B2FromDataType);
+  const tableSelectRef = useRef({} as B2FromDataType)
 
   useEffect(() => {
-    tableSelectRef.current = { ...tableSelect };
-  }, [tableSelect]);
+    tableSelectRef.current = { ...tableSelect }
+  }, [tableSelect])
 
   // 点击搜索的 时间戳
-  const [timeKey, setTimeKey] = useState(-1);
+  const [timeKey, setTimeKey] = useState(-1)
 
   // 发送接口的函数
   const getListFu = useCallback(() => {
-    const objTemp: any = {};
+    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 temp = tableSelectRef.current.siteArr
+      objTemp.province = temp[0] || ''
+      objTemp.city = temp[1] || ''
+      objTemp.region = temp[2] || ''
     }
 
     const obj = {
       ...tableSelectRef.current,
-      ...objTemp,
-    };
-    dispatch(B2_APIgetlist(obj));
-  }, [dispatch]);
+      ...objTemp
+    }
+    dispatch(B2_APIgetlist(obj))
+  }, [dispatch])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu, timeKey]);
+    getListFu()
+  }, [getListFu, timeKey])
 
   // 输入框的改变
   const txtChangeFu = useCallback(
-    (txt: string, key: "roomName" | "searchKey") => {
-      setTableSelect({ ...tableSelect, [key]: txt });
+    (txt: string, key: 'roomName' | 'searchKey') => {
+      setTableSelect({ ...tableSelect, [key]: txt })
     },
     [tableSelect]
-  );
+  )
 
   // 点击搜索
   const clickSearch = useCallback(() => {
-    setTableSelect({ ...tableSelect, pageNum: 1 });
+    setTableSelect({ ...tableSelect, pageNum: 1 })
     setTimeout(() => {
-      setTimeKey(Date.now());
-    }, 50);
-  }, [tableSelect]);
+      setTimeKey(Date.now())
+    }, 50)
+  }, [tableSelect])
 
   // 点击重置
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
   const resetSelectFu = useCallback(() => {
     // 把2个输入框和时间选择器清空
-    setInputKey(Date.now());
+    setInputKey(Date.now())
     setTableSelect({
       siteArr: undefined,
-      province: "",
-      city: "",
-      region: "",
-      auditStatus: "",
-      roomName: "",
-      searchKey: "",
+      province: '',
+      city: '',
+      region: '',
+      auditStatus: '',
+      roomName: '',
+      searchKey: '',
       pageSize: 10,
       pageNum: 1,
-      isSiteEmpty: 0,
-    });
+      isSiteEmpty: 0
+    })
     setTimeout(() => {
-      setTimeKey(Date.now());
-    }, 50);
-  }, []);
+      setTimeKey(Date.now())
+    }, 50)
+  }, [])
 
   // 从仓库获取列表
-  const B2TableList = useSelector(
-    (state: RootState) => state.B2Scene.B2TableList
-  );
+  const B2TableList = useSelector((state: RootState) => state.B2Scene.B2TableList)
   // 页码变化
   const paginationChange = useCallback(
     () => (pageNum: number, pageSize: number) => {
-      setTableSelect({ ...tableSelect, pageNum, pageSize });
+      setTableSelect({ ...tableSelect, pageNum, pageSize })
       setTimeout(() => {
-        setTimeKey(Date.now());
-      }, 50);
+        setTimeKey(Date.now())
+      }, 50)
     },
     [tableSelect]
-  );
+  )
 
-  // 点击删除
+  // 点击表格里面的删除
   const delByIdFu = useCallback(
     async (id: number) => {
-      const res = await B2_APIremove(id);
+      const res = await B2_APIremove(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
-  // 点击重置
+  // 点击表格里面的重置
   const resByIdFu = useCallback(
     async (id: number) => {
-      const res = await B2_APIreset(id);
+      const res = await B2_APIreset(id)
       if (res.code === 0) {
-        MessageFu.success("重置成功!");
-        getListFu();
+        MessageFu.success('重置成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   // 修改机房编码
   const [editNum, setEditNum] = useState({
     id: 0,
-    num: "",
-    name: "",
-    roomName: "",
-  });
+    num: '',
+    name: '',
+    roomName: ''
+  })
 
   const columns = useMemo(() => {
     return [
       {
-        title: "机房编码",
+        title: '机房编码',
         render: (item: B2tableType) =>
           item.roomNum ? (
             <span
@@ -184,61 +163,59 @@ function B2Scene() {
                   id: item.id,
                   num: item.roomNum,
                   name: item.sceneName,
-                  roomName: item.roomName,
+                  roomName: item.roomName
                 })
               }
-              className="B2audit"
+              className='B2audit'
             >
               {item.roomNum}
             </span>
           ) : (
-            "(空)"
-          ),
+            '(空)'
+          )
       },
       {
-        title: "站址地区",
+        title: '站址地区',
         render: (item: B2tableType) =>
           !item.province && !item.city && !item.region
-            ? "(空)"
-            : `${item.province}-${item.city}-${item.region}`,
+            ? '(空)'
+            : `${item.province}-${item.city}-${item.region}`
       },
       {
-        title: "站址名称",
-        render: (item: B2tableType) => item.roomName || "(空)",
+        title: '站址名称',
+        render: (item: B2tableType) => item.roomName || '(空)'
       },
       {
-        title: "场景名称",
-        render: (item: B2tableType) => item.sceneName || "(空)",
+        title: '场景名称',
+        render: (item: B2tableType) => item.sceneName || '(空)'
       },
       {
-        title: "场景链接",
+        title: '场景链接',
         render: (item: B2tableType) =>
           item.link ? (
             <a
-              target="_blank"
+              target='_blank'
               href={item.link}
-              style={{ cursor: "pointer" }}
+              style={{ cursor: 'pointer' }}
               title={item.link}
-              rel="noreferrer"
+              rel='noreferrer'
             >
-              {item.link.length >= 25
-                ? item.link.substring(0, 25) + "..."
-                : item.link}
+              {item.link.length >= 25 ? item.link.substring(0, 25) + '...' : item.link}
             </a>
           ) : (
-            "(空)"
-          ),
+            '(空)'
+          )
       },
       {
-        title: "场景码",
+        title: '场景码',
         render: (item: B2tableType) => (
           <>
-            {item.sceneCode || "(空)"}
+            {item.sceneCode || '(空)'}
 
             {/* up-只有计算失败的时候显示 ?  */}
             {item.scheduleStatus === 2 ? (
               <span
-                style={{ cursor: "pointer" }}
+                style={{ cursor: 'pointer' }}
                 hidden={!item.scheduleStatus && item.scheduleStatus !== 0}
               >
                 <Tooltip title={Reflect.get(B2ResNum, item.scheduleStatus)}>
@@ -248,62 +225,59 @@ function B2Scene() {
               </span>
             ) : null}
           </>
-        ),
+        )
       },
       {
-        title: "相机SN码",
-        render: (item: B2tableType) => item.cameraSn || "(空)",
+        title: '相机SN码',
+        render: (item: B2tableType) => item.cameraSn || '(空)'
       },
       {
-        title: "拍摄时间",
-        render: (item: B2tableType) => item.shootTime || "(空)",
+        title: '拍摄时间',
+        render: (item: B2tableType) => item.shootTime || '(空)'
       },
       {
-        title: "审核状态",
+        title: '审核状态',
         render: (item: B2tableType) => (
           <>
             <span
-              className={clasNames(
-                "B2audit",
-                item.auditStatus === 2 ? "B2auditNo" : ""
-              )}
+              className={clasNames('B2audit', item.auditStatus === 2 ? 'B2auditNo' : '')}
               onClick={() => {
-                if (item.auditStatus === 2) return;
+                if (item.auditStatus === 2) return
                 setAuditInfo({
                   oldState: item.auditStatus,
                   id: item.id,
                   sceneCode: item.sceneCode,
-                  auditDesc: item.auditDesc,
-                });
+                  auditDesc: item.auditDesc
+                })
               }}
             >
-              {Reflect.get(B1options1Obj, item.auditStatus) || "(空)"}
+              {Reflect.get(B1options1Obj, item.auditStatus) || '(空)'}
             </span>
-            <span style={{ cursor: "pointer" }} hidden={!item.auditDesc}>
+            <span style={{ cursor: 'pointer' }} hidden={!item.auditDesc}>
               <Tooltip title={item.auditDesc}>
                 &nbsp;
                 <QuestionCircleOutlined rev={undefined} />
               </Tooltip>
             </span>
           </>
-        ),
+        )
       },
       {
-        title: "审核时间",
-        render: (item: B2tableType) => item.auditTime || "(空)",
+        title: '审核时间',
+        render: (item: B2tableType) => item.auditTime || '(空)'
       },
       {
-        title: "操作",
+        title: '操作',
         render: (item: B2tableType) => (
           <>
             <Popconfirm
-              title="将重置该场景的审核状态,推送状态,请谨慎操作。"
-              okText="重置"
-              cancelText="取消"
+              title='将重置该场景的审核状态,推送状态,请谨慎操作。'
+              okText='重置'
+              cancelText='取消'
               onConfirm={() => resByIdFu(item.id)}
               okButtonProps={{ loading: false }}
             >
-              <Button size="small" type="text">
+              <Button size='small' type='text'>
                 重置
               </Button>
             </Popconfirm>
@@ -323,152 +297,149 @@ function B2Scene() {
             )} */}
 
             <Popconfirm
-              title="删除后无法恢复,是否删除?"
-              okText="删除"
-              cancelText="取消"
+              title='删除后无法恢复,是否删除?'
+              okText='删除'
+              cancelText='取消'
               onConfirm={() => delByIdFu(item.id)}
               okButtonProps={{ loading: false }}
             >
-              <Button size="small" type="text" danger>
+              <Button size='small' type='text' danger>
                 删除
               </Button>
             </Popconfirm>
           </>
-        ),
-      },
-    ];
-  }, [delByIdFu, resByIdFu]);
+        )
+      }
+    ]
+  }, [delByIdFu, resByIdFu])
 
   // 点击导出
   const deriveFu = useCallback(async () => {
     if (B2TableList.total > 30000)
-      return MessageFu.warning(
-        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
-      );
+      return MessageFu.warning('只支持导出最多30000条数据。请增加筛选条件,并重新尝试')
 
-    if (B2TableList.list.length === 0)
-      return MessageFu.warning("当前搜索条件没有数据!");
-    const name = "场景审核" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
+    if (B2TableList.list.length === 0) return MessageFu.warning('当前搜索条件没有数据!')
+    const name = '场景审核' + dayjs(new Date()).format('YYYY-MM-DD HH:mm')
 
-    const objTemp: any = {};
+    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 temp = tableSelectRef.current.siteArr
+      objTemp.province = temp[0] || ''
+      objTemp.city = temp[1] || ''
+      objTemp.region = temp[2] || ''
     }
 
     const res = await B2_APIgetlistAll({
       ...tableSelect,
       ...objTemp,
       pageNum: 1,
-      pageSize: 99999,
-    });
+      pageSize: 99999
+    })
     if (res.code === 0) {
-      if (res.data.records.length <= 0)
-        return MessageFu.warning("当前搜索条件没有数据!");
+      if (res.data.records.length <= 0) return MessageFu.warning('当前搜索条件没有数据!')
       const option = {
         fileName: name,
         datas: [
           {
             sheetData: res.data.records.map((v: B2tableType) => ({
-              roomName: v.roomName || "(空)",
-              roomNum: v.roomNum || "(空)",
+              roomName: v.roomName || '(空)',
+              roomNum: v.roomNum || '(空)',
               myCity:
                 !v.province && !v.city && !v.region
-                  ? "(空)"
+                  ? '(空)'
                   : `${v.province}-${v.city}-${v.region}`,
-              pmName: v.creatorId === 1 ? "管理员" : v.pmName || "(空)",
-              sceneName: v.sceneName || "(空)",
-              link: v.link || "(空)",
-              sceneCode: v.sceneCode || "(空)",
-              cameraSn: v.cameraSn || "(空)",
-              shootTime: v.shootTime || "(空)",
-              snapUseDept: v.snapUseDept || "(空)",
-              snapUseName: v.snapUseName || "(空)",
-              auditStatus:
-                Reflect.get(B1options1Obj, v.auditStatus) || "(空)",
-              auditTime: v.auditTime || "(空)",
+              pmName: v.creatorId === 1 ? '管理员' : v.pmName || '(空)',
+              sceneName: v.sceneName || '(空)',
+              link: v.link || '(空)',
+              sceneCode: v.sceneCode || '(空)',
+              cameraSn: v.cameraSn || '(空)',
+              shootTime: v.shootTime || '(空)',
+              snapUseDept: v.snapUseDept || '(空)',
+              snapUseName: v.snapUseName || '(空)',
+              auditStatus: Reflect.get(B1options1Obj, v.auditStatus) || '(空)',
+              auditTime: v.auditTime || '(空)'
             })),
             sheetName: name,
             sheetFilter: [
-              "roomNum",
-              "myCity",
-              "roomName",
-              "sceneName",
-              "link",
-              "sceneCode",
-              "cameraSn",
-              "shootTime",
-              "auditStatus",
-              "auditTime",
+              'roomNum',
+              'myCity',
+              'roomName',
+              'sceneName',
+              'link',
+              'sceneCode',
+              'cameraSn',
+              'shootTime',
+              'auditStatus',
+              'auditTime'
             ],
             sheetHeader: [
-              "机房编码",
-              "站址地区",
-              "站址名称",
-              "场景名称",
-              "场景链接",
-              "场景码",
-              "相机SN码",
-              "拍摄时间",
-              "审核状态",
-              "审核时间",
+              '机房编码',
+              '站址地区',
+              '站址名称',
+              '场景名称',
+              '场景链接',
+              '场景码',
+              '相机SN码',
+              '拍摄时间',
+              '审核状态',
+              '审核时间'
             ],
-            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
-          },
-        ],
-      };
+            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
+          }
+        ]
+      }
 
-      const toExcel = new ExportJsonExcel(option); //new
-      toExcel.saveExcel(); //保存
+      const toExcel = new ExportJsonExcel(option) //new
+      toExcel.saveExcel() //保存
     }
-  }, [B2TableList.list.length, B2TableList.total, tableSelect]);
+  }, [B2TableList.list.length, B2TableList.total, tableSelect])
 
   // 审核弹窗的信息
   const [auditInfo, setAuditInfo] = useState({
     oldState: -1,
     id: 0,
-    sceneCode: "",
-    auditDesc: "",
-  });
+    sceneCode: '',
+    auditDesc: ''
+  })
 
   // 查看重复的场景
-  const [lookReDo, setLookReDo] = useState(false);
+  const [lookReDo, setLookReDo] = useState(false)
 
   // 场景码匹配
-  const [mateNum, setMateNum] = useState(false);
+  const [mateNum, setMateNum] = useState(false)
 
   // 场景码匹配按钮 只有管理员才会显示
-  const [mateBtnShow, setMateBtnShow] = useState(false);
+  const [mateBtnShow, setMateBtnShow] = useState(false)
 
   useEffect(() => {
-    const userInfo = getTokenInfo().user;
-    if (userInfo && userInfo.isAdmin && userInfo.isAdmin === 1)
-      setMateBtnShow(true);
-  }, []);
+    const userInfo = getTokenInfo().user
+    if (userInfo && userInfo.isAdmin && userInfo.isAdmin === 1) setMateBtnShow(true)
+  }, [])
+
+  // 已删除的场景码=》回收站
+  const [delListShow, setDelListShow] = useState(false)
 
   return (
     <div className={styles.B2Scene}>
-      <div className="pageTitle">场景审核</div>
+      <div className='pageTitle'>场景审核</div>
       {/* 顶部筛选 */}
-      <div className="B2top">
+      <div className='B2top'>
         {/* 左侧输入框 */}
-        <div className="B2top1">
-          <div className="B2topRow">
+        <div className='B2top1'>
+          <div className='B2topRow'>
             <span>搜索项:</span>
             <Input
               key={inputKey}
               maxLength={24}
               style={{ width: 250 }}
-              placeholder="请输入机房编码/场景码,最多24字"
+              placeholder='请输入机房编码/场景码,最多24字'
               allowClear
-              onChange={(e) => txtChangeFu(e.target.value, "searchKey")}
+              onChange={e => txtChangeFu(e.target.value, 'searchKey')}
             />
           </div>
 
-          <div className="B2topRow">
+          <div className='B2topRow'>
             <span>站址地区:</span>
             <Cascader
               disabled={!!tableSelect.isSiteEmpty}
@@ -476,20 +447,18 @@ function B2Scene() {
               value={tableSelect.siteArr}
               style={{ width: 250 }}
               options={mapDataAll1}
-              placeholder="全部"
-              onChange={(e) =>
-                setTableSelect({ ...tableSelect, siteArr: e as string[] })
-              }
+              placeholder='全部'
+              onChange={e => setTableSelect({ ...tableSelect, siteArr: e as string[] })}
             />
           </div>
-          <div className="B2topRow">
+          <div className='B2topRow'>
             <Checkbox
               checked={!!tableSelect.isSiteEmpty}
-              onChange={(e) =>
+              onChange={e =>
                 setTableSelect({
                   ...tableSelect,
                   siteArr: e.target.checked ? undefined : tableSelect.siteArr,
-                  isSiteEmpty: e.target.checked ? 1 : 0,
+                  isSiteEmpty: e.target.checked ? 1 : 0
                 })
               }
             >
@@ -498,33 +467,32 @@ function B2Scene() {
           </div>
         </div>
         {/* 右侧按钮 */}
-        <div className="B2top2">
+        <div className='B2top2'>
           <div>
-            <div className="B2topRow">
+            <div className='B2topRow'>
               <span>站址名称:</span>
               <Input
                 key={inputKey}
                 maxLength={10}
                 style={{ width: 235 }}
-                placeholder="请输入站址名称,最多10字"
+                placeholder='请输入站址名称,最多10字'
                 allowClear
-                onChange={(e) => txtChangeFu(e.target.value, "roomName")}
+                onChange={e => txtChangeFu(e.target.value, 'roomName')}
               />
             </div>
 
-            <div className="B2topRow">
+            <div className='B2topRow'>
               <span>审核状态:</span>
               <Select
                 style={{ width: 250 }}
                 value={tableSelect.auditStatus}
-                onChange={(e) =>
-                  setTableSelect({ ...tableSelect, auditStatus: e })
-                }
+                onChange={e => setTableSelect({ ...tableSelect, auditStatus: e })}
                 options={B1options1}
               />
             </div>
           </div>
           <div>
+            <Button onClick={() => setDelListShow(true)}>已删除的场景码</Button>&emsp;
             {mateBtnShow ? (
               <>
                 <Button onClick={() => setMateNum(true)}>场景码匹配</Button>
@@ -534,11 +502,11 @@ function B2Scene() {
             <Button onClick={() => setLookReDo(true)}>查看重复的场景</Button>
             &emsp;
             <Button onClick={resetSelectFu}>重置</Button>&emsp;
-            <Button type="primary" onClick={clickSearch}>
+            <Button type='primary' onClick={clickSearch}>
               查询
             </Button>
             &emsp;
-            <Button type="primary" onClick={deriveFu}>
+            <Button type='primary' onClick={deriveFu}>
               导出表格
             </Button>
           </div>
@@ -546,20 +514,20 @@ function B2Scene() {
       </div>
 
       {/* 表格主体 */}
-      <div className="tableMain">
+      <div className='tableMain'>
         <Table
           scroll={{ y: 578 }}
           dataSource={B2TableList.list}
           columns={columns}
-          rowKey="id"
+          rowKey='id'
           pagination={{
             showQuickJumper: true,
-            position: ["bottomCenter"],
+            position: ['bottomCenter'],
             showSizeChanger: true,
             current: tableSelect.pageNum,
             pageSize: tableSelect.pageSize,
             total: B2TableList.total,
-            onChange: paginationChange(),
+            onChange: paginationChange()
           }}
         />
       </div>
@@ -568,22 +536,20 @@ function B2Scene() {
       {auditInfo.id ? (
         <AuditMo
           auditInfo={auditInfo}
-          colseFu={() =>
-            setAuditInfo({ oldState: -1, id: 0, sceneCode: "", auditDesc: "" })
-          }
+          colseFu={() => setAuditInfo({ oldState: -1, id: 0, sceneCode: '', auditDesc: '' })}
           upTableFu={(id, newState, newDesc, newTime) => {
-            const oldObj = store.getState().B2Scene.B2TableList;
+            const oldObj = store.getState().B2Scene.B2TableList
             const newObj = {
-              list: oldObj.list.map((v) => ({
+              list: oldObj.list.map(v => ({
                 ...v,
                 auditStatus: v.id === id ? newState : v.auditStatus,
                 auditDesc: v.id === id ? newDesc : v.auditDesc,
-                auditTime: v.id === id ? newTime : v.auditTime,
+                auditTime: v.id === id ? newTime : v.auditTime
               })),
-              total: oldObj.total,
-            };
+              total: oldObj.total
+            }
 
-            store.dispatch({ type: "B2/getList", payload: newObj });
+            store.dispatch({ type: 'B2/getList', payload: newObj })
           }}
         />
       ) : null}
@@ -595,7 +561,7 @@ function B2Scene() {
       {editNum.num ? (
         <EditNum
           info={editNum}
-          closeFu={() => setEditNum({ id: 0, num: "", name: "", roomName: "" })}
+          closeFu={() => setEditNum({ id: 0, num: '', name: '', roomName: '' })}
           upTableFu={getListFu}
         />
       ) : null}
@@ -604,13 +570,20 @@ function B2Scene() {
       {mateNum ? <MateNum closeFu={() => setMateNum(false)} /> : null}
 
       {/*  右下角的列表数量 */}
-      <div className="tableNumBox">
+      <div className='tableNumBox'>
         共 <span>{B2TableList.total}</span> 条数据
       </div>
+
+      {/* 已删除的场景码=》回收站 */}
+      {delListShow ? (
+        <div className='delListBox'>
+          <B2DelList sonDelCloseFu={() => setDelListShow(false)} upTableFu={getListFu} />
+        </div>
+      ) : null}
     </div>
-  );
+  )
 }
 
-const MemoB2Scene = React.memo(B2Scene);
+const MemoB2Scene = React.memo(B2Scene)
 
-export default MemoB2Scene;
+export default MemoB2Scene

+ 31 - 0
src/store/action/B2Scene.ts

@@ -78,3 +78,34 @@ export const B2_APInumIsOk = (num: string) => {
 export const B2_APImateNum = (data: string[]) => {
   return http.post('cms/scene/getListBySceneCodes', data)
 }
+
+// -------------------回收站---------------------
+/**
+ * 回收站 获取列表
+ */
+export const B2_APIgetlistDel = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/recycle/pageList', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+      dispatch({ type: 'B2/getListDel', payload: obj })
+    }
+  }
+}
+
+/**
+ * 回收站 删除
+ */
+export const B2_APIremoveDel = (id: number) => {
+  return http.get(`cms/recycle/remove/${id}`)
+}
+
+/**
+ * 回收站 恢复
+ */
+export const B2_APIrecoversDel = (id: number) => {
+  return http.get(`cms/recycle/recovers/${id}`)
+}

+ 22 - 10
src/store/reducer/B2Scene.ts

@@ -1,27 +1,39 @@
-import { B2tableType } from "@/types";
+import { B2tableType } from '@/types'
 
 // 初始化状态
 const initState = {
   // 列表数据
   B2TableList: {
     list: [] as B2tableType[],
-    total: 0,
+    total: 0
   },
-};
+  // 回收站
+  B2TableListDel: {
+    list: [] as B2tableType[],
+    total: 0
+  }
+}
 
 // 定义 action 类型
-type Props = {
-  type: "B2/getList";
-  payload: { list: B2tableType[]; total: number };
-};
+type Props =
+  | {
+      type: 'B2/getList'
+      payload: { list: B2tableType[]; total: number }
+    }
+  | {
+      type: 'B2/getListDel'
+      payload: { list: B2tableType[]; total: number }
+    }
 
 // reducer
 export default function Reducer(state = initState, action: Props) {
   switch (action.type) {
     // 获取列表数据
-    case "B2/getList":
-      return { ...state, B2TableList: action.payload };
+    case 'B2/getList':
+      return { ...state, B2TableList: action.payload }
+    case 'B2/getListDel':
+      return { ...state, B2TableListDel: action.payload }
     default:
-      return state;
+      return state
   }
 }