Browse Source

相机列表修改一小波

shaogen1995 1 year ago
parent
commit
5383316863

+ 12 - 0
.editorconfig

@@ -0,0 +1,12 @@
+root = true # 控制配置文件 .editorconfig 是否生效的字段
+ 
+[**] # 匹配全部文件
+indent_style = space # 缩进风格,可选space|tab
+indent_size = 2 # 缩进的空格数
+charset = utf-8 # 设置字符集
+trim_trailing_whitespace = true # 删除一行中的前后空格
+insert_final_newline = true # 设为true表示使文件以一个空白行结尾
+end_of_line = lf
+ 
+[**.md] # 匹配md文件
+trim_trailing_whitespace = false

+ 11 - 0
.prettierrc.js

@@ -0,0 +1,11 @@
+module.exports = {
+  printWidth: 100, // 一行的字符数,如果超过会进行换行
+  tabWidth: 2, // 一个tab代表几个空格数,默认就是2
+  useTabs: false, // 是否启用tab取代空格符缩进,.editorconfig设置空格缩进,所以设置为false
+  semi: false, // 行尾是否使用分号,默认为true
+  singleQuote: true, // 字符串是否使用单引号
+  trailingComma: 'none', // 对象或数组末尾是否添加逗号 none| es5| all
+  jsxSingleQuote: true, // 在jsx里是否使用单引号,你看着办
+  bracketSpacing: true, // 对象大括号直接是否有空格,默认为true,效果:{ foo: bar }
+  arrowParens: 'avoid' // 箭头函数如果只有一个参数则省略括号
+}

+ 39 - 0
.vscode/settings.json

@@ -0,0 +1,39 @@
+{
+  "search.exclude": {
+    "/node_modules": true,
+    "dist": true,
+    "pnpm-lock.sh": true
+  },
+  "editor.formatOnSave": true,
+  "[javascript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[javascriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescript]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[typescriptreact]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[json]": {
+    "editor.defaultFormatter": "vscode.json-language-features"
+  },
+  "[html]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[markdown]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[css]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[less]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "[scss]": {
+    "editor.defaultFormatter": "esbenp.prettier-vscode"
+  },
+  "liveServer.settings.port": 5502
+}

File diff suppressed because it is too large
+ 5504 - 5862
public/myEnv.js


BIN
public/xlsx/相机列表导入模板.xlsx


+ 19 - 3
src/pages/A1Camera/AddCamera/index.module.scss

@@ -23,9 +23,25 @@
         bottom: 0px;
         left: 50%;
         transform: translateX(-50%);
-   
       }
-
+      .formBox {
+        display: flex;
+        align-items: center;
+        margin-bottom: 24px;
+        .formBoxLL {
+          width: 100px;
+          text-align: right;
+          & > span {
+            color: #ff4d4f;
+          }
+        }
+        .formBoxRR {
+          width: calc(100% - 100px);
+          .ant-btn {
+            margin-right: 20px;
+          }
+        }
+      }
     }
   }
-}
+}

+ 72 - 95
src/pages/A1Camera/AddCamera/index.tsx

@@ -1,131 +1,108 @@
-import React, { useCallback, useEffect, useRef } from "react";
-import styles from "./index.module.scss";
-import { A1addType, options1 } from "../data";
-import { Button, Form, FormInstance, Input, Popconfirm, Select } from "antd";
-import { A1_APIadd, A1_APIgetInfo } from "@/store/action/A1Camera";
-import { getTokenInfo } from "@/utils/storage";
-import TextArea from "antd/es/input/TextArea";
-import { MessageFu } from "@/utils/message";
-import { useDispatch, useSelector } from "react-redux";
-import { RootState } from "@/store";
-import { C1_APIgetlist } from "@/store/action/C1User";
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1addType } from '../data'
+import { Button, Form, FormInstance, Input, Popconfirm } from 'antd'
+import { A1_APIadd, A1_APIgetInfo } from '@/store/action/A1Camera'
+import TextArea from 'antd/es/input/TextArea'
+import { MessageFu } from '@/utils/message'
+
+const cameraTypeList: { name: string; key: 'KK' | 'KJ' }[] = [
+  { name: '看见', key: 'KJ' },
+  { name: '看看', key: 'KK' }
+]
 
 type Props = {
-  openInfo: A1addType;
-  closeFu: () => void;
-  upTableFu: () => void;
-  addTableFu: () => void;
-};
+  openInfo: A1addType
+  closeFu: () => void
+  upTableFu: () => void
+  addTableFu: () => void
+}
 
 function AddCamera({ openInfo, closeFu, upTableFu, addTableFu }: Props) {
-  const dispatch = useDispatch();
-
-  useEffect(() => {
-    // 获取用户列表所有用户信息
-    dispatch(
-      C1_APIgetlist(
-        {
-          pageSize: 99999,
-          pageNum: 1,
-        },
-        true
-      )
-    );
-  }, [dispatch]);
-
   // 表单的ref
-  const FormBoxRef = useRef<FormInstance>(null);
-
-  // 获取用户列表的所有用户,用于表单的  项目经理 的下拉
-  const { C1TableListAll } = useSelector((state: RootState) => state.C1User);
+  const FormBoxRef = useRef<FormInstance>(null)
 
   // 通过id获取详情
   const getInfoFu = useCallback(async (id: number) => {
-    const res = await A1_APIgetInfo(id);
+    const res = await A1_APIgetInfo(id)
     if (res.code === 0) {
-      FormBoxRef.current?.setFieldsValue(res.data);
+      FormBoxRef.current?.setFieldsValue(res.data)
+      setCameraType(res.data.cameraType || 'KJ')
     }
-  }, []);
+  }, [])
 
   useEffect(() => {
-    if (openInfo.txt === "新增") {
-      FormBoxRef.current?.setFieldsValue({
-        status: "使用中",
-        pmUserId: getTokenInfo().user.id,
-      });
-    } else getInfoFu(openInfo.id);
-  }, [getInfoFu, openInfo]);
+    if (openInfo.txt === '新增') {
+    } else getInfoFu(openInfo.id)
+  }, [getInfoFu, openInfo])
+
+  // 相机类型
+  const [cameraType, setCameraType] = useState<'KK' | 'KJ'>('KJ')
 
   // 没有通过校验
-  const onFinishFailed = useCallback(() => {}, []);
+  const onFinishFailed = useCallback(() => {}, [])
 
   // 通过校验点击确定
   const onFinish = useCallback(
     async (value: any) => {
       const res = await A1_APIadd({
         ...value,
-        id: openInfo.txt === "新增" ? null : openInfo.id,
-        typeIn: "pc",
-      });
+        id: openInfo.txt === '新增' ? null : openInfo.id,
+        cameraType,
+        typeIn: 'pc'
+      })
       if (res.code === 0) {
-        MessageFu.success(openInfo.txt + "成功!");
-        openInfo.txt === "新增" ? addTableFu() : upTableFu();
-        closeFu();
+        MessageFu.success(openInfo.txt + '成功!')
+        openInfo.txt === '新增' ? addTableFu() : upTableFu()
+        closeFu()
       }
     },
-    [addTableFu, closeFu, openInfo.id, openInfo.txt, upTableFu]
-  );
+    [addTableFu, cameraType, closeFu, openInfo.id, openInfo.txt, upTableFu]
+  )
 
   return (
     <div className={styles.AddCamera}>
-      <div className="A1addMain">
+      <div className='A1addMain'>
         <Form
           scrollToFirstError={true}
           ref={FormBoxRef}
           labelCol={{ span: 3 }}
-          name="basic"
+          name='basic'
           onFinish={onFinish}
           onFinishFailed={onFinishFailed}
-          autoComplete="off"
+          autoComplete='off'
         >
-          <Form.Item
-            label="SN编码"
-            name="cameraSn"
-            rules={[{ required: true, message: "请输入SN编码!" }]}
-            getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
-          >
-            <Input maxLength={20} showCount placeholder="请输入内容" />
-          </Form.Item>
+          <div className='formBox'>
+            <div className='formBoxLL'>
+              <span>* </span>相机类型:
+            </div>
+            <div className='formBoxRR'>
+              {cameraTypeList.map(item => (
+                <Button
+                  onClick={() => setCameraType(item.key)}
+                  type={item.key === cameraType ? 'primary' : 'default'}
+                  key={item.key}
+                >
+                  {item.name}
+                </Button>
+              ))}
+            </div>
+          </div>
 
           <Form.Item
-            label="相机工况"
-            name="status"
-            rules={[{ required: true, message: "请选择相机工况!" }]}
+            label='SN编码'
+            name='cameraSn'
+            rules={[{ required: true, message: '请输入SN编码!' }]}
+            getValueFromEvent={e => e.target.value.replace(/\s+/g, '')}
           >
-            <Select
-              style={{ width: 300 }}
-              placeholder="请选择"
-              options={options1.filter((v) => v.label !== "全部")}
-            />
-          </Form.Item>
-
-          <Form.Item
-            label="项目经理"
-            name="pmUserId"
-            rules={[{ required: true, message: "请选择项目经理!" }]}
-          >
-            <Select
-              style={{ width: 300 }}
-              placeholder="请选择"
-              options={C1TableListAll}
-            />
+            <Input maxLength={20} showCount placeholder='请输入内容' />
           </Form.Item>
 
-          <Form.Item label="备注" name="remark">
+          <Form.Item label='备注' name='remark'>
             <TextArea
               style={{ width: 600 }}
               autoSize
-              placeholder="请输入内容"
+              placeholder='请输入内容'
               showCount
               maxLength={200}
             />
@@ -133,15 +110,15 @@ function AddCamera({ openInfo, closeFu, upTableFu, addTableFu }: Props) {
 
           {/* 确定和取消按钮 */}
           <br />
-          <Form.Item className="A1addBtn">
-            <Button type="primary" htmlType="submit">
+          <Form.Item className='A1addBtn'>
+            <Button type='primary' htmlType='submit'>
               提交
             </Button>
             &emsp;
             <Popconfirm
-              title="放弃编辑后,信息将不会保存!"
-              okText="放弃"
-              cancelText="取消"
+              title='放弃编辑后,信息将不会保存!'
+              okText='放弃'
+              cancelText='取消'
               onConfirm={closeFu}
               okButtonProps={{ loading: false }}
             >
@@ -151,9 +128,9 @@ function AddCamera({ openInfo, closeFu, upTableFu, addTableFu }: Props) {
         </Form>
       </div>
     </div>
-  );
+  )
 }
 
-const MemoAddCamera = React.memo(AddCamera);
+const MemoAddCamera = React.memo(AddCamera)
 
-export default MemoAddCamera;
+export default MemoAddCamera

+ 0 - 112
src/pages/A1Camera/LogCamera/index.module.scss

@@ -1,112 +0,0 @@
-.LogCamera {
-  position: absolute;
-  z-index: 10;
-  top: 0;
-  left: 0;
-  width: 100%;
-  height: 100%;
-  background-color: #fff;
-  border-radius: 10px;
-  padding: 24px;
-
-  :global {
-    .A1Ltop {
-      display: flex;
-      align-items: center;
-      margin-bottom: 20px;
-      position: relative;
-
-      &>div {
-        font-weight: 700;
-        font-size: 24px;
-      }
-
-      &>span {
-        font-size: 14px;
-        color: #ff4d4f;
-      }
-
-      .A1LtopBack {
-        position: absolute;
-        right: 0;
-        top: 0;
-      }
-    }
-
-    .A1Ltable {
-      border-radius: 10px;
-      margin-top: 15px;
-      height: calc(100% - 32px);
-      background-color: #fff;
-
-      .ant-table-body {
-        height: 670px;
-        overflow-y: auto !important;
-        overflow-y: overlay !important;
-
-      }
-    }
-  }
-}
-
-// 表单弹窗
-.LogCameraModal {
-  :global {
-    .ant-modal-close {
-      display: none;
-    }
-
-    .ant-modal {
-      width: 800px !important;
-    }
-
-    .A1LMmain {
-      margin-top: 20px;
-      padding-right: 40px;
-
-      .A1LMrow {
-        display: flex;
-        align-items: center;
-        margin-bottom: 20px;
-
-        .A1LMrow1 {
-          width: 100px;
-          text-align: right;
-
-          &>span {
-            color: #ff4d4f;
-          }
-
-        }
-
-        .A1LMrow2 {
-          width: calc(100% - 100px);
-
-          .A1LMrow2tit {
-            position: relative;
-            top: -3px;
-            opacity: 0;
-            color: #ff4d4f;
-            transition: all .3s;
-          }
-
-          .A1LMrow2titShow {
-            opacity: 1;
-            top: 0;
-          }
-        }
-
-
-      }
-
-      .A1LMrowLast {
-        margin-top: -16px;
-      }
-
-      .A1LMbtn {
-        margin-top: 20px;
-        text-align: center;
-      }
-    }
-  }
-}

+ 0 - 287
src/pages/A1Camera/LogCamera/index.tsx

@@ -1,287 +0,0 @@
-import React, { useCallback, useEffect, useMemo, useState } from "react";
-import styles from "./index.module.scss";
-import { Button, DatePicker, Input, Modal, Popconfirm, Table } from "antd";
-import {
-  A1_APIaddBySn,
-  A1_APIgetInfoBySn,
-  A1_APIgetListBySn,
-  A1_APIremoveBySn,
-} from "@/store/action/A1Camera";
-import dayjs from "dayjs";
-import { MessageFu } from "@/utils/message";
-import classNames from "classnames";
-
-const { RangePicker } = DatePicker;
-
-type TableType = {
-  cameraSn: string;
-  createTime: string;
-  creatorId: number;
-  creatorName: string;
-  dept: string;
-  endTime: string;
-  id: number;
-  startTime: string;
-  updateTime: string;
-  user: string;
-};
-
-type Props = {
-  closeFu: () => void;
-  logSn: string;
-};
-
-function LogCamera({ logSn, closeFu }: Props) {
-  const [tableList, setTableList] = useState([] as TableType[]);
-
-  const getListFu = useCallback(async () => {
-    const res = await A1_APIgetListBySn(logSn);
-    if (res.code === 0) {
-      setTableList(res.data);
-    }
-  }, [logSn]);
-
-  useEffect(() => {
-    getListFu();
-  }, [getListFu]);
-
-  // 点击外面表格的删除
-  const delByIdFu = useCallback(
-    async (id: number) => {
-      const res = await A1_APIremoveBySn(id);
-      if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
-      }
-    },
-    [getListFu]
-  );
-
-  const columns = useMemo(() => {
-    return [
-      {
-        title: "领用部门",
-        render: (item: TableType) => (item.dept ? item.dept : "(空)"),
-      },
-      {
-        title: "领用人员",
-        render: (item: TableType) => (item.user ? item.user : "(空)"),
-      },
-      {
-        title: "领用日期",
-        render: (item: TableType) => `${item.startTime} 至 ${item.endTime}`,
-      },
-      {
-        title: "操作",
-        render: (item: TableType) => (
-          <>
-            <Button
-              size="small"
-              type="text"
-              onClick={() => setModelId(item.id)}
-            >
-              编辑
-            </Button>
-            <Popconfirm
-              title="删除后无法恢复,是否删除?"
-              okText="删除"
-              cancelText="取消"
-              onConfirm={() => delByIdFu(item.id)}
-              okButtonProps={{ loading: false }}
-            >
-              <Button size="small" type="text" danger>
-                删除
-              </Button>
-            </Popconfirm>
-          </>
-        ),
-      },
-    ];
-  }, [delByIdFu]);
-
-  // 表单弹窗
-  const [modelId, setModelId] = useState(0);
-
-  // modelId 改变的时候 把表单里面的数据 初始化
-
-  const getInfoBySnFu = useCallback(async (id: number) => {
-    const res = await A1_APIgetInfoBySn(id);
-    if (res.code === 0) {
-      const { dept, user, startTime, endTime } = res.data;
-      // console.log(123, res);
-      setDept(dept);
-      setUser(user);
-      setTime([startTime, endTime]);
-    }
-  }, []);
-
-  useEffect(() => {
-    if (modelId === 0) {
-      setDept("");
-      setUser("");
-      setTime(null);
-      setIsOk(false);
-    } else if (modelId > 0) getInfoBySnFu(modelId);
-  }, [getInfoBySnFu, modelId]);
-
-  // 表单信息
-  const [dept, setDept] = useState("");
-  const [user, setUser] = useState("");
-  const [time, setTime] = useState<null | string[]>(null);
-
-  const [isOk, setIsOk] = useState(false);
-
-  // 点击确定
-  const btnOkFu = useCallback(async () => {
-    setIsOk(true);
-    if (!dept && !user) return;
-    const res = await A1_APIaddBySn({
-      cameraSn: logSn,
-      dept,
-      user,
-      startTime: time![0],
-      endTime: time![1],
-      id: modelId > 0 ? modelId : null,
-    });
-
-    if (res.code === 0) {
-      MessageFu.success(modelId > 0 ? "编辑成功!" : "新增成功!");
-      getListFu();
-      setModelId(0);
-    }
-  }, [dept, getListFu, logSn, modelId, time, user]);
-
-  return (
-    <div className={styles.LogCamera}>
-      <div className="A1Ltop">
-        <div>{logSn} - 领用记录</div>&emsp;&emsp;
-        <Button
-          type="primary"
-          onClick={() => setModelId(-1)}
-          disabled={tableList.length >= 20}
-        >
-          登记领用信息
-        </Button>
-        &emsp;&emsp;
-        <span hidden={tableList.length < 20}>最多只能添加20条记录</span>
-        <div className="A1LtopBack" onClick={closeFu}>
-          <Button>返回</Button>
-        </div>
-      </div>
-      <div className="A1Ltable">
-        <Table
-          scroll={{ y: 670 }}
-          dataSource={tableList}
-          columns={columns}
-          rowKey="id"
-          pagination={false}
-        />
-      </div>
-
-      {/* 新增和编辑领用信息的弹窗 */}
-      <Modal
-        wrapClassName={styles.LogCameraModal}
-        open={!!modelId}
-        title={`${modelId > 0 ? "编辑" : "登记"}领用信息`}
-        footer={
-          [] // 设置footer为空,去掉 取消 确定默认按钮
-        }
-      >
-        <div className="A1LMmain">
-          <div className="A1LMrow">
-            <div className="A1LMrow1">领用部门:</div>
-            <div className="A1LMrow2">
-              <Input
-                value={dept}
-                onChange={(e) => setDept(e.target.value.replace(/\s+/g, ""))}
-                maxLength={20}
-                showCount
-                placeholder="请输入内容,如采集部门等"
-              />
-            </div>
-          </div>
-
-          <div className="A1LMrow">
-            <div className="A1LMrow1">领用人员:</div>
-            <div className="A1LMrow2">
-              <Input
-                value={user}
-                onChange={(e) => setUser(e.target.value.replace(/\s+/g, ""))}
-                maxLength={20}
-                showCount
-                placeholder="请输入内容,如人员姓名,联系方式等"
-              />
-            </div>
-          </div>
-
-          <div className="A1LMrow">
-            <div className="A1LMrow1">
-              <span>* </span> 领用日期:
-            </div>
-            <div className="A1LMrow2">
-              <RangePicker
-                value={
-                  time
-                    ? [
-                        dayjs(time[0], "YYYY-MM-DD"),
-                        dayjs(time[1], "YYYY-MM-DD"),
-                      ]
-                    : null
-                }
-                onChange={(e) => {
-                  if (e && e.length && e.length > 1) {
-                    const str1 = dayjs(e[0]).format("YYYY-MM-DD");
-                    const str2 = dayjs(e[1]).format("YYYY-MM-DD");
-                    setTime([str1, str2]);
-                  } else setTime(null);
-                }}
-              />
-            </div>
-          </div>
-
-          <div className="A1LMrow A1LMrowLast">
-            <div className="A1LMrow1"></div>
-            <div className="A1LMrow2">
-              <div
-                className={classNames(
-                  "A1LMrow2tit",
-                  !time && isOk ? "A1LMrow2titShow" : ""
-                )}
-              >
-                请选择领用日期!
-              </div>
-              <div
-                className={classNames(
-                  "A1LMrow2tit",
-                  !dept && !user && isOk ? "A1LMrow2titShow" : ""
-                )}
-              >
-                部门和人员至少填入一项
-              </div>
-            </div>
-          </div>
-
-          <div className="A1LMbtn">
-            <Button type="primary" onClick={btnOkFu}>
-              提交
-            </Button>
-            &emsp;
-            <Popconfirm
-              title="放弃编辑后,信息将不会保存!"
-              okText="放弃"
-              cancelText="取消"
-              onConfirm={() => setModelId(0)}
-              okButtonProps={{ loading: false }}
-            >
-              <Button>取消</Button>
-            </Popconfirm>
-          </div>
-        </div>
-      </Modal>
-    </div>
-  );
-}
-
-const MemoLogCamera = React.memo(LogCamera);
-
-export default MemoLogCamera;

+ 84 - 28
src/pages/A1Camera/data.ts

@@ -1,48 +1,104 @@
 export type TableSelectType = {
-  cameraSn: string;
-  searchKey: string;
-  status: "全部" | "使用中" | "已回收" | "检修中";
-  typeIn: "全部" | "系统" | "移动端";
-  pageSize: number;
-  pageNum: number;
-};
+  siteArr: string[] | undefined
+  cameraType: '' | 'KK' | 'KJ' //相机类型
+  cameraSn: string //SN码
+  zlProvince: string
+  zlCity: string //所在地区 省/市
+  zlUser: string //城市负责人
+  zlPhone: string //联系方式
+  statusSale: '' | '租赁中' | '已归还' | '已销售' //租售状态
+  statusSupport: '' | '报修' | '定损' | '维修' //售后状态
+  statusStock: '' | '在库' | '出库' //库存状态
+  typeIn: '' | '系统' | '移动端' //相机来源
+  pageSize: number
+  pageNum: number
+}
 
-export const options1 = [
+export const cameraTypeOptions = [
   {
-    value: "",
-    label: "全部",
+    value: '',
+    label: '全部'
   },
   {
-    value: "使用中",
-    label: "使用中",
+    value: 'KK',
+    label: '看看'
   },
   {
-    value: "已回收",
-    label: "已回收",
+    value: 'KJ',
+    label: '看见'
+  }
+]
+
+export const statusSaleOptions = [
+  {
+    value: '',
+    label: '全部'
+  },
+  {
+    value: '租赁中',
+    label: '租赁中'
+  },
+  {
+    value: '已归还',
+    label: '已归还'
+  },
+  {
+    value: '已销售',
+    label: '已销售'
+  }
+]
+
+export const statusSupportOptions = [
+  {
+    value: '',
+    label: '全部'
+  },
+  {
+    value: '报修',
+    label: '报修'
   },
   {
-    value: "检修中",
-    label: "检修中",
+    value: '定损',
+    label: '定损'
   },
-];
+  {
+    value: '维修',
+    label: '维修'
+  }
+]
 
-export const options2 = [
+export const statusStockOptions = [
   {
-    value: "",
-    label: "全部",
+    value: '',
+    label: '全部'
   },
   {
-    value: "pc",
-    label: "系统",
+    value: '在库',
+    label: '在库'
   },
   {
-    value: "app",
-    label: "移动端",
+    value: '出库',
+    label: '出库'
+  }
+]
+
+export const typeInOptions = [
+  {
+    value: '',
+    label: '全部'
+  },
+  {
+    value: 'pc',
+    label: '系统'
   },
-];
+  {
+    value: 'app',
+    label: '移动端'
+  }
+]
 
 // 新增编辑的 type
 export type A1addType = {
-  id: number;
-  txt: "" | "新增" | "编辑";
-};
+  id: number
+  txt: '' | '新增' | '编辑'
+}

+ 9 - 9
src/pages/A1Camera/index.module.scss

@@ -2,33 +2,33 @@
   position: relative;
   :global {
     .A1top {
-      display: flex;
-      justify-content: space-between;
       border-radius: 10px;
       background-color: #fff;
-      padding: 15px 24px;
+      padding: 15px 24px 1px 24px;
 
-      &>div {
+      .A1topSon {
         display: flex;
-
+        margin-bottom: 15px;
         .A1topRow {
           margin-right: 20px;
         }
       }
+      .A1topSon2 {
+        justify-content: flex-end;
+      }
     }
 
     .tableMain {
       border-radius: 10px;
       margin-top: 15px;
-      height: calc(100% - 80px);
+      height: calc(100% - 175px);
       background-color: #fff;
 
       .ant-table-body {
-        height: 625px;
+        height: 530px;
         overflow-y: auto !important;
         overflow-y: overlay !important;
-
       }
     }
   }
-}
+}

+ 291 - 219
src/pages/A1Camera/index.tsx

@@ -1,373 +1,448 @@
-import React, {
-  useCallback,
-  useEffect,
-  useMemo,
-  useRef,
-  useState,
-} from "react";
-import styles from "./index.module.scss";
-import { Button, Input, Popconfirm, Select, Table } from "antd";
-import { A1addType, TableSelectType, options1, options2 } from "./data";
-import { useDispatch, useSelector } from "react-redux";
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Cascader, Input, Popconfirm, Select, Table } from 'antd'
 import {
-  A1_APIgetlist,
-  A1_APIgetlistDerive,
-  A1_APIremove,
-} from "@/store/action/A1Camera";
-import { RootState } from "@/store";
-import { A1ListType } from "@/types";
-import ExportJsonExcel from "js-export-excel";
-import { MessageFu } from "@/utils/message";
-import dayjs from "dayjs";
-import AddCamera from "./AddCamera";
-import LogCamera from "./LogCamera";
+  A1addType,
+  TableSelectType,
+  cameraTypeOptions,
+  statusSaleOptions,
+  statusStockOptions,
+  statusSupportOptions,
+  typeInOptions
+} from './data'
+import { useDispatch, useSelector } from 'react-redux'
+import { A1_APIgetlist, A1_APIgetlistDerive, A1_APIremove } from '@/store/action/A1Camera'
+import { RootState } from '@/store'
+import { A1ListType } from '@/types'
+import ExportJsonExcel from 'js-export-excel'
+import { MessageFu } from '@/utils/message'
+import dayjs from 'dayjs'
+import AddCamera from './AddCamera'
+import { mapDataAll2 } from '../C1User/AddUser/city'
+
+const tableSelectBase: TableSelectType = {
+  siteArr: undefined,
+  cameraType: '', //相机类型
+  cameraSn: '', //SN码
+  zlProvince: '',
+  zlCity: '', //所在地区 省/市
+  zlUser: '', //城市负责人
+  zlPhone: '', //联系方式
+  statusSale: '', //租售状态
+  statusSupport: '', //售后状态
+  statusStock: '', //库存状态
+  typeIn: '', //相机来源
+  pageSize: 10,
+  pageNum: 1
+}
 
 function A1Camera() {
-  const dispatch = useDispatch();
+  const dispatch = useDispatch()
 
   // 筛选和分页
-  const [tableSelect, setTableSelect] = useState<TableSelectType>({
-    cameraSn: "",
-    searchKey: "",
-    status: "全部",
-    typeIn: "全部",
-    pageSize: 10,
-    pageNum: 1,
-  });
+  const [tableSelect, setTableSelect] = useState(tableSelectBase)
 
-  const tableSelectRef = useRef({} as TableSelectType);
+  const tableSelectRef = useRef({} as TableSelectType)
 
   useEffect(() => {
-    tableSelectRef.current = { ...tableSelect };
-  }, [tableSelect]);
+    tableSelectRef.current = { ...tableSelect }
+  }, [tableSelect])
 
   // 输入框的改变
   const txtChangeFu = useCallback(
-    (txt: string, key: "cameraSn" | "searchKey") => {
-      setTableSelect({ ...tableSelect, [key]: txt });
+    (txt: string, key: 'cameraSn' | 'zlUser' | 'zlPhone') => {
+      setTableSelect({ ...tableSelect, [key]: txt })
     },
     [tableSelect]
-  );
+  )
 
   // 点击搜索的 时间戳
-  const [timeKey, setTimeKey] = useState(-1);
+  const [timeKey, setTimeKey] = useState(-1)
 
   // 点击搜索
   const clickSearch = useCallback(() => {
-    setTableSelect({ ...tableSelect, pageNum: 1 });
+    setTableSelect({ ...tableSelect, pageNum: 1 })
     setTimeout(() => {
-      setTimeKey(Date.now());
-    }, 50);
-  }, [tableSelect]);
+      setTimeKey(Date.now())
+    }, 50)
+  }, [tableSelect])
 
   // 发送接口的函数
   const getListFu = useCallback(() => {
+    const objTemp: any = {}
+
+    if (tableSelectRef.current.siteArr) {
+      const temp = tableSelectRef.current.siteArr
+      objTemp.zlProvince = temp[0] || ''
+      objTemp.zlCity = temp[1] || ''
+    }
+
     const obj = {
       ...tableSelectRef.current,
-      status:
-        tableSelectRef.current.status === "全部"
-          ? ""
-          : tableSelectRef.current.status,
-      typeIn:
-        tableSelectRef.current.typeIn === "全部"
-          ? ""
-          : tableSelectRef.current.typeIn,
-    };
-    dispatch(A1_APIgetlist(obj));
-  }, [dispatch]);
+      ...objTemp
+    }
+
+    dispatch(A1_APIgetlist(obj))
+  }, [dispatch])
 
   useEffect(() => {
-    getListFu();
-  }, [getListFu, timeKey]);
+    getListFu()
+  }, [getListFu, timeKey])
 
   // 从仓库获取列表
-  const A1TableList = useSelector(
-    (state: RootState) => state.A1Camera.A1TableList
-  );
+  const A1TableList = useSelector((state: RootState) => state.A1Camera.A1TableList)
   // 页码变化
   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 A1_APIremove(id);
+      const res = await A1_APIremove(id)
       if (res.code === 0) {
-        MessageFu.success("删除成功!");
-        getListFu();
+        MessageFu.success('删除成功!')
+        getListFu()
       }
     },
     [getListFu]
-  );
+  )
 
   // 点击导出
   const deriveFu = useCallback(async () => {
     if (A1TableList.total > 30000)
-      return MessageFu.warning(
-        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
-      );
+      return MessageFu.warning('只支持导出最多30000条数据。请增加筛选条件,并重新尝试')
 
-    if (A1TableList.list.length === 0)
-      return MessageFu.warning("当前搜索条件没有数据!");
-    const name = "相机管理" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
+    if (A1TableList.list.length === 0) 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.zlProvince = temp[0] || ''
+      objTemp.zlCity = temp[1] || ''
+    }
 
     const res = await A1_APIgetlistDerive({
       ...tableSelect,
-      status: tableSelect.status === "全部" ? "" : tableSelect.status,
-      typeIn: tableSelect.typeIn === "全部" ? "" : tableSelect.typeIn,
+      ...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: A1ListType) => ({
-              ...v,
-              typeIn: v.typeIn === "pc" ? "系统" : "移动端",
-              remark: v.remark || "(空)",
-              pmName: v.id === 1 ? "管理员" : v.pmName || "(空)",
+            sheetData: res.data.records.map((item: A1ListType) => ({
+              cameraType: item.cameraType ? (item.cameraType === 'KK' ? '看看' : '看见') : '空',
+              cameraSn: item.cameraSn,
+              myCity:
+                !item.zlProvince && !item.zlCity ? '(空)' : `${item.zlProvince}-${item.zlCity}`,
+              zlUser: item.zlUser || '空',
+              zlPhone: item.zlPhone || '空',
+              statusSale: item.statusSale || '空',
+              statusSupport: item.statusSupport || '空',
+              statusStock: item.statusStock || '空',
+              typeIn: item.typeIn ? (item.typeIn === 'pc' ? '系统' : '移动端') : '空',
+              creatorName: item.creatorName || '空',
+              updateTime: item.updateTime || '空'
             })),
             sheetName: name,
             sheetFilter: [
-              "cameraSn",
-              "pmName",
-              "status",
-              "typeIn",
-              "updateTime",
-              "remark",
+              'cameraType',
+              'cameraSn',
+              'myCity',
+              'zlUser',
+              'zlPhone',
+              'statusSale',
+              'statusSupport',
+              'statusStock',
+              'typeIn',
+              'creatorName',
+              'updateTime'
             ],
             sheetHeader: [
-              "相机SN码",
-              "项目经理",
-              "相机工况",
-              "录入方式",
-              "最近编辑时间",
-              "备注",
+              '相机类型',
+              '相机SN码',
+              '当前所在地区',
+              '城市负责人',
+              '联系方式',
+              '租售状态',
+              '售后状态',
+              '库存状态',
+              '相机来源',
+              '编辑人',
+              '更新日期'
             ],
-            columnWidths: [10, 10, 10, 10, 10, 20],
-          },
-        ],
-      };
+            columnWidths: [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() //保存
     }
-  }, [A1TableList.list.length, A1TableList.total, tableSelect]);
+  }, [A1TableList.list.length, A1TableList.total, tableSelect])
 
   const columns = useMemo(() => {
     return [
       {
-        title: "相机SN码",
-        dataIndex: "cameraSn",
+        title: '相机类型',
+        render: (item: A1ListType) =>
+          item.cameraType ? (item.cameraType === 'KK' ? '看看' : '看见') : '(空)'
       },
       {
-        title: "项目经理",
-        render: (item: A1ListType) => {
-          if (item.id === 1) return "管理员";
-          else {
-            return item.pmName || "(空)";
-          }
-        },
+        title: '相机SN码',
+        dataIndex: 'cameraSn'
       },
       {
-        title: "相机工况",
-        dataIndex: "status",
+        title: '当前所在地区',
+        render: (item: A1ListType) =>
+          !item.zlProvince && !item.zlCity ? '(空)' : `${item.zlProvince}-${item.zlCity}`
       },
       {
-        title: "录入方式",
-        render: (item: A1ListType) =>
-          item.typeIn === "pc" ? "系统" : "移动端",
+        title: '城市负责人',
+        render: (item: A1ListType) => item.zlUser || '(空)'
       },
       {
-        title: "最近编辑时间",
-        dataIndex: "updateTime",
+        title: '联系方式',
+        render: (item: A1ListType) => item.zlPhone || '(空)'
+      },
+      {
+        title: '租售状态',
+        render: (item: A1ListType) => item.statusSale || '(空)'
+      },
+      {
+        title: '售后状态',
+        render: (item: A1ListType) => item.statusSupport || '(空)'
+      },
+      {
+        title: '库存状态',
+        render: (item: A1ListType) => item.statusStock || '(空)'
       },
-
       {
-        title: "备注",
+        title: '相机来源',
         render: (item: A1ListType) =>
-          item.remark ? (
-            item.remark.length >= 25 ? (
-              <span style={{ cursor: "pointer" }} title={item.remark}>
-                {item.remark.substring(0, 25) + "..."}
-              </span>
-            ) : (
-              item.remark
-            )
-          ) : (
-            "(空)"
-          ),
+          item.typeIn ? (item.typeIn === 'pc' ? '系统' : '移动端') : '(空)'
       },
       {
-        title: "操作",
+        title: '编辑人',
+        render: (item: A1ListType) => item.creatorName || '(空)'
+      },
+      {
+        title: '更新日期',
+        render: (item: A1ListType) => item.updateTime || '(空)'
+      },
+
+      {
+        title: '操作',
         render: (item: A1ListType) => (
           <>
-            <Button
-              size="small"
-              type="text"
-              onClick={() => setLogSn(item.cameraSn)}
-            >
-              领用记录
+            <Button size='small' type='text' onClick={() => setLookId(item.id)}>
+              查看
             </Button>
             <Button
-              size="small"
-              type="text"
-              onClick={() => setOpenInfo({ id: item.id, txt: "编辑" })}
+              size='small'
+              type='text'
+              onClick={() => setOpenInfo({ id: item.id, txt: '编辑' })}
             >
               编辑
             </Button>
             <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]);
+        )
+      }
+    ]
+  }, [delByIdFu])
 
   // 点击重置
-  const [inputKey, setInputKey] = useState(1);
+  const [inputKey, setInputKey] = useState(1)
   const resetSelectFu = useCallback(() => {
     // 把2个输入框和时间选择器清空
-    setInputKey(Date.now());
-    setTableSelect({
-      cameraSn: "",
-      searchKey: "",
-      status: "全部",
-      typeIn: "全部",
-      pageSize: 10,
-      pageNum: 1,
-    });
+    setInputKey(Date.now())
+    setTableSelect(tableSelectBase)
     setTimeout(() => {
-      setTimeKey(Date.now());
-    }, 50);
-  }, []);
+      setTimeKey(Date.now())
+    }, 50)
+  }, [])
 
   // 点击新增和编辑的数据
-  const [openInfo, setOpenInfo] = useState<A1addType>({ id: 0, txt: "" });
+  const [openInfo, setOpenInfo] = useState<A1addType>({ id: 0, txt: '' })
 
   // 左上角的 title
   const leftTitle = useMemo(() => {
     const obj = {
-      "": "相机管理",
-      新增: "新增相机",
-      编辑: "编辑相机",
-    };
-    return obj[openInfo.txt];
-  }, [openInfo.txt]);
+      '': '相机列表',
+      新增: '新增相机',
+      编辑: '编辑相机'
+    }
+    return obj[openInfo.txt]
+  }, [openInfo.txt])
 
-  // 点击 领用记录
-  const [logSn, setLogSn] = useState("");
+  // 查看 待完善
+  const [lookId, setLookId] = useState(0)
 
   return (
     <div className={styles.A1Camera}>
-      <div className="pageTitle">
-        {leftTitle}
-        {logSn ? " - 领用记录" : ""}
-      </div>
+      <div className='pageTitle'>{leftTitle}</div>
       {/* 顶部筛选 */}
-      <div className="A1top">
-        {/* 左侧输入框 */}
-        <div className="A1top1">
-          <div className="A1topRow">
+      <div className='A1top'>
+        <div className='A1topSon'>
+          <div className='A1topRow'>
+            <span>相机类型:</span>
+            <Select
+              style={{ width: 190 }}
+              value={tableSelect.cameraType}
+              onChange={e => setTableSelect({ ...tableSelect, cameraType: e })}
+              options={cameraTypeOptions}
+            />
+          </div>
+
+          <div className='A1topRow'>
             <span>SN码:</span>
             <Input
               key={inputKey}
-              maxLength={10}
+              maxLength={20}
               style={{ width: 190 }}
-              placeholder="请输入SN码,最多10字"
+              placeholder='请输入SN码,最多20字'
               allowClear
-              onChange={(e) => txtChangeFu(e.target.value, "cameraSn")}
+              onChange={e => txtChangeFu(e.target.value, 'cameraSn')}
             />
           </div>
 
-          <div className="A1topRow">
-            <span>项目经理:</span>
+          <div className='A1topRow'>
+            <span>当前所在地区:</span>
+            <Cascader
+              changeOnSelect
+              style={{ width: 240 }}
+              options={mapDataAll2}
+              value={tableSelect.siteArr}
+              placeholder='全部'
+              onChange={e =>
+                setTableSelect({
+                  ...tableSelect,
+                  siteArr: e as string[]
+                })
+              }
+            />
+          </div>
+
+          <div className='A1topRow'>
+            <span>城市负责人:</span>
             <Input
               key={inputKey}
-              maxLength={10}
+              maxLength={20}
               style={{ width: 190 }}
-              placeholder="请输入姓名,最多10字"
+              placeholder='请输入内容,最多20字'
               allowClear
-              onChange={(e) => txtChangeFu(e.target.value, "searchKey")}
+              onChange={e => txtChangeFu(e.target.value, 'zlUser')}
             />
           </div>
+        </div>
 
-          <div className="A1topRow">
-            <span>相机工况:</span>
+        <div className='A1topSon'>
+          <div className='A1topRow'>
+            <span>联系方式:</span>
+            <Input
+              key={inputKey}
+              maxLength={20}
+              style={{ width: 190 }}
+              placeholder='请输入内容,最多20字'
+              allowClear
+              onChange={e => txtChangeFu(e.target.value, 'zlPhone')}
+            />
+          </div>
+
+          <div className='A1topRow'>
+            <span>租售状态:</span>
             <Select
-              style={{ width: 150 }}
-              value={tableSelect.status}
-              onChange={(e) => setTableSelect({ ...tableSelect, status: e })}
-              options={options1}
+              style={{ width: 137 }}
+              value={tableSelect.statusSale}
+              onChange={e => setTableSelect({ ...tableSelect, statusSale: e })}
+              options={statusSaleOptions}
             />
           </div>
 
-          <div className="A1topRow">
-            <span>录入方式:</span>
+          <div className='A1topRow'>
+            <span>售后状态:</span>
+            <Select
+              style={{ width: 137 }}
+              value={tableSelect.statusSupport}
+              onChange={e => setTableSelect({ ...tableSelect, statusSupport: e })}
+              options={statusSupportOptions}
+            />
+          </div>
+          <div className='A1topRow'>
+            <span>库存状态:</span>
             <Select
-              style={{ width: 150 }}
+              style={{ width: 137 }}
+              value={tableSelect.statusStock}
+              onChange={e => setTableSelect({ ...tableSelect, statusStock: e })}
+              options={statusStockOptions}
+            />
+          </div>
+          <div className='A1topRow'>
+            <span>相机来源:</span>
+            <Select
+              style={{ width: 137 }}
               value={tableSelect.typeIn}
-              onChange={(e) => setTableSelect({ ...tableSelect, typeIn: e })}
-              options={options2}
+              onChange={e => setTableSelect({ ...tableSelect, typeIn: e })}
+              options={typeInOptions}
             />
           </div>
         </div>
-        {/* 右侧按钮 */}
-        <div className="A1top2">
+
+        <div className='A1topSon A1topSon2'>
           <Button onClick={resetSelectFu}>重置</Button>&emsp;
-          <Button type="primary" onClick={clickSearch}>
+          <Button type='primary' onClick={clickSearch}>
             查询
           </Button>
           &emsp;
-          <Button
-            type="primary"
-            onClick={() => setOpenInfo({ id: -1, txt: "新增" })}
-          >
+          <Button type='primary' onClick={() => setOpenInfo({ id: -1, txt: '新增' })}>
             新增
           </Button>
           &emsp;
-          <Button type="primary" onClick={deriveFu}>
+          <Button type='primary' onClick={deriveFu}>
             导出表格
           </Button>
         </div>
       </div>
       {/* 表格主体 */}
-      <div className="tableMain">
+      <div className='tableMain'>
         <Table
-          scroll={{ y: 625 }}
+          scroll={{ y: 530 }}
           dataSource={A1TableList.list}
           columns={columns}
-          rowKey="id"
+          rowKey='id'
           pagination={{
             showQuickJumper: true,
-            position: ["bottomCenter"],
+            position: ['bottomCenter'],
             showSizeChanger: true,
             current: tableSelect.pageNum,
             pageSize: tableSelect.pageSize,
             total: A1TableList.total,
-            onChange: paginationChange(),
+            onChange: paginationChange()
           }}
         />
       </div>
@@ -376,23 +451,20 @@ function A1Camera() {
       {openInfo.id ? (
         <AddCamera
           openInfo={openInfo}
-          closeFu={() => setOpenInfo({ id: 0, txt: "" })}
+          closeFu={() => setOpenInfo({ id: 0, txt: '' })}
           upTableFu={getListFu}
           addTableFu={resetSelectFu}
         />
       ) : null}
 
-      {/* 领用记录 */}
-      {logSn ? <LogCamera logSn={logSn} closeFu={() => setLogSn("")} /> : null}
-
       {/*  右下角的列表数量 */}
-      <div className="tableNumBox">
+      <div className='tableNumBox'>
         共 <span>{A1TableList.total}</span> 条数据
       </div>
     </div>
-  );
+  )
 }
 
-const MemoA1Camera = React.memo(A1Camera);
+const MemoA1Camera = React.memo(A1Camera)
 
-export default MemoA1Camera;
+export default MemoA1Camera

+ 57 - 57
src/pages/Layout/data.ts

@@ -1,83 +1,83 @@
-import { RouterType } from "@/types";
-import React from "react";
+import { RouterType } from '@/types'
+import React from 'react'
 
 const tabLeftArr: RouterType = [
   {
-    id: "1",
-    name: "业务配置",
+    id: '1',
+    name: '业务配置',
     son: [
       {
-        id: "1.1",
-        name: "相机管理",
-        path: "/",
-        Com: React.lazy(() => import("../A1Camera")),
-        done: false,
+        id: '1.1',
+        name: '相机列表',
+        path: '/',
+        Com: React.lazy(() => import('../A1Camera')),
+        done: false
       },
       {
-        id: "1.2",
-        name: "机房管理",
-        path: "/psychz",
-        Com: React.lazy(() => import("../A2Psychz")),
-        done: false,
-      },
-    ],
+        id: '1.2',
+        name: '机房管理',
+        path: '/psychz',
+        Com: React.lazy(() => import('../A2Psychz')),
+        done: false
+      }
+    ]
   },
 
   {
-    id: "2",
-    name: "采集管理",
+    id: '2',
+    name: '采集管理',
     son: [
       {
-        id: "2.1",
-        name: "进度统计",
-        path: "/plan",
-        Com: React.lazy(() => import("../B1Plan")),
-        done: false,
+        id: '2.1',
+        name: '进度统计',
+        path: '/plan',
+        Com: React.lazy(() => import('../B1Plan')),
+        done: false
       },
       {
-        id: "2.2",
-        name: "场景审核",
-        path: "/scene",
-        Com: React.lazy(() => import("../B2Scene")),
-        done: false,
+        id: '2.2',
+        name: '场景审核',
+        path: '/scene',
+        Com: React.lazy(() => import('../B2Scene')),
+        done: false
       },
       {
-        id: "2.3",
-        name: "场景推送",
-        path: "/push",
-        Com: React.lazy(() => import("../B3Push")),
-        done: false,
+        id: '2.3',
+        name: '场景推送',
+        path: '/push',
+        Com: React.lazy(() => import('../B3Push')),
+        done: false
       },
       {
-        id: "2.4",
-        name: "Json推送",
-        path: "/jsonpush",
-        Com: React.lazy(() => import("../B4JsonPush")),
-        done: false,
-      },
-    ],
+        id: '2.4',
+        name: 'Json推送',
+        path: '/jsonpush',
+        Com: React.lazy(() => import('../B4JsonPush')),
+        done: false
+      }
+    ]
   },
 
   {
-    id: "3",
-    name: "系统管理",
+    id: '3',
+    name: '系统管理',
     son: [
       {
-        id: "3.1",
-        name: "用户管理",
-        path: "/user",
-        Com: React.lazy(() => import("../C1User")),
-        done: false,
+        id: '3.1',
+        name: '用户管理',
+        path: '/user',
+        Com: React.lazy(() => import('../C1User')),
+        done: false
       },
       {
-        id: "3.2",
-        name: "系统日志",
-        path: "/log",
-        Com: React.lazy(() => import("../C2Log")),
-        done: false,
-      },
-    ],
-  },
-];
+        id: '3.2',
+        name: '系统日志',
+        path: '/log',
+        Com: React.lazy(() => import('../C2Log')),
+        done: false
+      }
+    ]
+  }
+]
 
-export default tabLeftArr;
+export default tabLeftArr

+ 18 - 48
src/store/action/A1Camera.ts

@@ -1,75 +1,45 @@
-import http from "@/utils/http";
-import { AppDispatch } from "..";
+import http from '@/utils/http'
+import { AppDispatch } from '..'
 /**
- * 获取 相机管理 表格列表(存到仓库)
+ * 获取 相机列表 表格列表(存到仓库)
  */
 export const A1_APIgetlist = (data: any) => {
   return async (dispatch: AppDispatch) => {
-    const res = await http.post("cms/camera/pageList", data);
+    const res = await http.post('cms/camera/pageList', data)
     if (res.code === 0) {
       const obj = {
         list: res.data.records,
-        total: res.data.total,
-      };
-      dispatch({ type: "A1/getList", payload: obj });
+        total: res.data.total
+      }
+      dispatch({ type: 'A1/getList', payload: obj })
     }
-  };
-};
+  }
+}
 
 /**
- * 获取 相机管理 表格列表(导出表格)
+ * 获取 相机列表 表格列表(导出表格)
  */
 export const A1_APIgetlistDerive = (data: any) => {
-  return http.post("cms/camera/pageList", data);
-};
+  return http.post('cms/camera/pageList', data)
+}
 
 /**
  * 删除单个表格数据
  */
 export const A1_APIremove = (id: number) => {
-  return http.get(`cms/camera/remove/${id}`);
-};
+  return http.get(`cms/camera/remove/${id}`)
+}
 
 /**
  * 新增/修改
  */
 export const A1_APIadd = (data: any) => {
-  return http.post("cms/camera/save", data);
-};
+  return http.post('cms/camera/save', data)
+}
 
 /**
  * 通过id获取详情
  */
 export const A1_APIgetInfo = (id: number) => {
-  return http.get(`cms/camera/detail/${id}`);
-};
-
-// -------------------sn码   领用信息
-
-/**
- * 通过sn码获取领用信息列表
- */
-export const A1_APIgetListBySn = (cameraSn: string) => {
-  return http.get(`cms/cameraUse/getList/${cameraSn}`);
-};
-
-/**
- * 通过sn码新增 相机领用管理
- */
-export const A1_APIaddBySn = (data: any) => {
-  return http.post("cms/cameraUse/save", data);
-};
-
-/**
- * 通过sn码 删除里面的表格信息
- */
-export const A1_APIremoveBySn = (id: number) => {
-  return http.get(`cms/cameraUse/remove/${id}`);
-};
-
-/**
- * 通过sn码 获取领用信息详情
- */
-export const A1_APIgetInfoBySn = (id: number) => {
-  return http.get(`cms/cameraUse/detail/${id}`);
-};
+  return http.get(`cms/camera/detail/${id}`)
+}

+ 19 - 13
src/types/api/A1Camera.d.ts

@@ -1,13 +1,19 @@
-export type A1ListType ={
-	cameraSn: string;
-	createTime: string;
-	creatorId?: any;
-	creatorName: string;
-	id: number;
-	pmName: string;
-	pmUserId?: any;
-	remark: string;
-	status: string;
-	typeIn: string;
-	updateTime: string;
-}
+export type A1ListType = {
+  cameraSn: string
+  cameraType: string
+  createTime?: any
+  creatorId?: any
+  creatorName: string
+  id: number
+  logisticsId: number
+  orderId: number
+  statusSale: string
+  statusStock: string
+  statusSupport: string
+  typeIn: string
+  updateTime?: any
+  zlCity: string
+  zlPhone: string
+  zlProvince: string
+  zlUser: string
+}

+ 48 - 52
src/utils/http.ts

@@ -1,91 +1,87 @@
-import axios from "axios";
-import history from "./history";
-import { getTokenInfo, removeTokenInfo } from "./storage";
-import store from "@/store";
-import { MessageFu } from "./message";
-import { domShowFu } from "./domShow";
+import axios from 'axios'
+import history from './history'
+import { getTokenInfo, removeTokenInfo } from './storage'
+import store from '@/store'
+import { MessageFu } from './message'
+import { domShowFu } from './domShow'
 
-const envFlag = process.env.NODE_ENV === "development";
+const envFlag = process.env.NODE_ENV === 'development'
 
-const baseUrlTemp = "https://sit-tieta3d.4dage.com"; // 测试环境
+// const baseUrlTemp = "https://sit-tieta3d.4dage.com"; // 测试环境
 // const baseUrlTemp = "https://tower3d.4dkankan.com"; // 正式环境
-// const baseUrlTemp = "http://192.168.20.61:8057"; // 线下环境
+const baseUrlTemp = 'http://192.168.20.61:8057' // 线下环境
 
-const baseFlag = baseUrlTemp.includes("https://");
+const baseFlag = baseUrlTemp.includes('https://')
 
 // 请求基地址
-export const baseURL = envFlag
-  ? `${baseUrlTemp}${baseFlag ? "" : "/api/"}`
-  : "";
+export const baseURL = envFlag ? `${baseUrlTemp}${baseFlag ? '' : '/api/'}` : ''
 
 // 处理  类型“AxiosResponse<any, any>”上不存在属性“code”
-declare module "axios" {
+declare module 'axios' {
   interface AxiosResponse {
-    code: number;
-    timestamp: string;
+    code: number
+    timestamp: string
     // 这里追加你的参数
   }
 }
 
 // 创建 axios 实例
 const http = axios.create({
-  baseURL: `${baseURL}${baseFlag ? "/api/" : ""}`,
-  timeout: 50000,
-});
+  baseURL: `${baseURL}${baseFlag ? '/api/' : ''}`,
+  timeout: 50000
+})
 
-let axajInd = 0;
+let axajInd = 0
 
 // 请求拦截器
 http.interceptors.request.use(
   function (config: any) {
     // 发请求前打开加载提示
-    domShowFu("#AsyncSpinLoding", true);
+    domShowFu('#AsyncSpinLoding', true)
 
-    axajInd++;
+    axajInd++
 
-    const { token } = getTokenInfo();
-    if (token) config.headers.token = token;
-    return config;
+    const { token } = getTokenInfo()
+    if (token) config.headers.token = token
+    return config
   },
   function (err) {
-    return Promise.reject(err);
+    return Promise.reject(err)
   }
-);
+)
 
-let timeId = -1;
+let timeId = -1
 
 // 响应拦截器
 http.interceptors.response.use(
   function (response) {
     // 请求回来的关闭加载提示
-    axajInd--;
+    axajInd--
     if (axajInd === 0) {
-      domShowFu("#AsyncSpinLoding", false);
+      domShowFu('#AsyncSpinLoding', false)
     }
     if (response.data.code === 5001 || response.data.code === 5002) {
-      removeTokenInfo();
-      history.push("/login");
-      clearTimeout(timeId);
+      removeTokenInfo()
+      history.push('/login')
+      clearTimeout(timeId)
       timeId = window.setTimeout(() => {
-        MessageFu.warning("登录失效!");
-      }, 200);
+        MessageFu.warning('登录失效!')
+      }, 200)
     } else if (response.data.code === 0) {
       // MessageFu.success(response.data.msg);
-    } else if (response.data.code !== 3014)
-      MessageFu.warning(response.data.msg);
+    } else if (response.data.code !== 3014) MessageFu.warning(response.data.msg)
 
-    return response.data;
+    return response.data
   },
   async function (err) {
-    clearTimeout(timeId);
+    clearTimeout(timeId)
     timeId = window.setTimeout(() => {
-      axajInd = 0;
-      domShowFu("#AsyncSpinLoding", false);
+      axajInd = 0
+      domShowFu('#AsyncSpinLoding', false)
       // 如果因为网络原因,response没有,给提示消息
       if (!err.response) {
-        if (store.getState().A0Layout.closeUpFile.state)
-          MessageFu.warning("取消上传!");
-        else MessageFu.error("网络繁忙,请稍后重试!");
+        if (store.getState().A0Layout.closeUpFile.state) MessageFu.warning('取消上传!')
+        else MessageFu.error('网络繁忙,请稍后重试!')
       } else {
         if (
           err.response &&
@@ -93,19 +89,19 @@ http.interceptors.response.use(
           err.response.data.msg &&
           err.response.data.msg.length < 30
         ) {
-          MessageFu.error(err.response.data.msg);
+          MessageFu.error(err.response.data.msg)
           // 没有权限
           if (err.response.data.code === 5003) {
-            removeTokenInfo();
-            history.push("/login");
+            removeTokenInfo()
+            history.push('/login')
           }
-        } else MessageFu.error("响应错误,请联系管理员!");
+        } else MessageFu.error('响应错误,请联系管理员!')
       }
-    }, 100);
+    }, 100)
 
-    return Promise.reject(err);
+    return Promise.reject(err)
   }
-);
+)
 
 // 导出 axios 实例
-export default http;
+export default http