From f548e09dfb5861b7b6aaa1f45815ee2ffbe74a9b Mon Sep 17 00:00:00 2001
From: wuhao930406 <1148547900@qq.com>
Date: Tue, 27 Dec 2022 10:40:41 +0800
Subject: [PATCH] asder

---
 config/proxy.js                          |   2 +-
 mock/listTableList.ts                    |   2 +-
 src/components/DetailPro/index.jsx       |   2 +-
 src/components/ExtendField/index.jsx     |   2 +-
 src/components/InitForm/FormItems.jsx    |   9 +-
 src/components/InitForm/index.jsx        |   6 +-
 src/components/NoticeIcon/NoticeIcon.tsx |   2 +-
 src/components/NoticeIcon/index.tsx      |   2 +-
 src/components/TagView/index.jsx         |   2 +-
 src/e2e/baseLayout.e2e.spec.ts           |   4 +-
 src/global.jsx                           |   4 +-
 src/global.less                          |  11 +-
 src/pages/device/account/index.jsx       |   4 +-
 src/pages/device/supplier/index.jsx      |   4 +-
 src/pages/spare/setting/columns.js       | 202 ++++++++++----
 src/pages/spare/setting/index.jsx        | 319 ++++++++++++-----------
 src/pages/spare/supplier/columns.js      |  47 ++--
 src/pages/spare/supplier/index.jsx       |  15 +-
 src/pages/system/rules/index.jsx         |   4 +-
 src/utils/extraColumns.js                |   4 +
 src/utils/fieldsDetail.js                |   2 +-
 src/wrappers/auth.jsx                    |   2 +-
 22 files changed, 392 insertions(+), 259 deletions(-)

diff --git a/config/proxy.js b/config/proxy.js
index 9b5ec95..3e1892d 100644
--- a/config/proxy.js
+++ b/config/proxy.js
@@ -19,7 +19,7 @@ export default {
     },
     '/token': {
       // 要代理的地址
-      target: 'http://192.168.40.64:28001',
+      target: 'http://192.168.40.64:8000',
       changeOrigin: true,
     },
     '/staticfile/': {
diff --git a/mock/listTableList.ts b/mock/listTableList.ts
index 08ed86d..caf5f6a 100644
--- a/mock/listTableList.ts
+++ b/mock/listTableList.ts
@@ -52,7 +52,7 @@ function getRule(req: Request, res: Response, u: string) {
     const sorter = JSON.parse(params.sorter);
     dataSource = dataSource.sort((prev, next) => {
       let sortNumber = 0;
-      Object.keys(sorter).forEach((key) => {
+      Object.keys(sorter).forEach?.((key) => {
         if (sorter[key] === 'descend') {
           if (prev[key] - next[key] > 0) {
             sortNumber += -1;
diff --git a/src/components/DetailPro/index.jsx b/src/components/DetailPro/index.jsx
index a88c767..76b637d 100644
--- a/src/components/DetailPro/index.jsx
+++ b/src/components/DetailPro/index.jsx
@@ -22,7 +22,7 @@ function DetailPro(props) {
           let res = await doFetch({ url: props.detailpath, params: props.params });
           if (props?.extendField) {
             let obj = {};
-            res?.data?.data[props.extendField]?.forEach((it) => {
+            res?.data?.data[props.extendField]?.forEach?.((it) => {
               obj[it?.fieldId] = it?.fieldRealValue;
             });
             //console.log('extendField:', obj);
diff --git a/src/components/ExtendField/index.jsx b/src/components/ExtendField/index.jsx
index 1476759..a7f486c 100644
--- a/src/components/ExtendField/index.jsx
+++ b/src/components/ExtendField/index.jsx
@@ -68,7 +68,7 @@ const App = ({
             valueType: 'split',
           },
         ];
-        res?.data?.dataList?.forEach((el) => {
+        res?.data?.dataList?.forEach?.((el) => {
           column.push({
             ...selectValueType(el.fieldChar, el.valueList),
             title: el.fieldName,
diff --git a/src/components/InitForm/FormItems.jsx b/src/components/InitForm/FormItems.jsx
index 1b68e08..d75ba75 100644
--- a/src/components/InitForm/FormItems.jsx
+++ b/src/components/InitForm/FormItems.jsx
@@ -1,3 +1,4 @@
+/* eslint-disable react-hooks/exhaustive-deps */
 import React, { useState, useRef, memo, createElement, useEffect } from 'react';
 import {
   ProForm,
@@ -320,7 +321,7 @@ function Digit({ item, colProps }) {
         placeholder={`请输入${item.title}`}
         min={item.min}
         max={item.max}
-        fieldProps={{ precision: item.precision ?? 0, ...(item?.fieldProps ?? {}) }}
+        fieldProps={{ precision: item.precision ?? 2, ...(item?.fieldProps ?? {}) }}
       />
     </>
   );
@@ -1389,7 +1390,7 @@ function Diyrules({ item, colProps, formRef }) {
             other: {},
             value: [],
           };
-          value?.forEach((it) => {
+          value?.forEach?.((it) => {
             if (it?.noRuleCode == 'increasing_order') {
               nrList.other = it;
             } else {
@@ -1509,10 +1510,6 @@ function TableSelect({ item, value, onChange, params = {} }) {
       }
     />
   );
-  useEffect(() => {
-    onChange([]);
-    actionRef?.current?.reload?.();
-  }, [params]);
 
   const Todo = (
     <EditTable
diff --git a/src/components/InitForm/index.jsx b/src/components/InitForm/index.jsx
index 82572e2..d77378e 100644
--- a/src/components/InitForm/index.jsx
+++ b/src/components/InitForm/index.jsx
@@ -123,18 +123,18 @@ function InitForm(props) {
           let res = await doFetch({ url: detailpath, params });
           if (extendField) {
             let obj = {};
-            res?.data?.data[extendField]?.forEach((it) => {
+            res?.data?.data[extendField]?.forEach?.((it) => {
               obj[it?.fieldId] = it?.fieldRealValue;
             });
             console.log('dddddd', {
-              ...(res?.data?.data ?? {}),
               ...obj,
               ...defaultFormValue,
+              ...(res?.data?.data ?? {}),
             });
             return {
-              ...(res?.data?.data ?? {}),
               ...obj,
               ...defaultFormValue,
+              ...(res?.data?.data ?? {}),
             };
           }
           return {
diff --git a/src/components/NoticeIcon/NoticeIcon.tsx b/src/components/NoticeIcon/NoticeIcon.tsx
index 20607b5..e063cf7 100644
--- a/src/components/NoticeIcon/NoticeIcon.tsx
+++ b/src/components/NoticeIcon/NoticeIcon.tsx
@@ -47,7 +47,7 @@ const NoticeIcon: React.FC<NoticeIconProps> & {
       return null;
     }
     const panes: React.ReactNode[] = [];
-    React.Children.forEach(children, (child: React.ReactElement<NoticeIconTabProps>): void => {
+    React.Children.forEach?.(children, (child: React.ReactElement<NoticeIconTabProps>): void => {
       if (!child) {
         return;
       }
diff --git a/src/components/NoticeIcon/index.tsx b/src/components/NoticeIcon/index.tsx
index 66265c4..b922afa 100644
--- a/src/components/NoticeIcon/index.tsx
+++ b/src/components/NoticeIcon/index.tsx
@@ -55,7 +55,7 @@ const getNoticeData = (notices: API.NoticeIconItem[]): Record<string, API.Notice
 
 const getUnreadData = (noticeData: Record<string, API.NoticeIconItem[]>) => {
   const unreadMsg: Record<string, number> = {};
-  Object.keys(noticeData).forEach((key) => {
+  Object.keys(noticeData).forEach?.((key) => {
     const value = noticeData[key];
 
     if (!unreadMsg[key]) {
diff --git a/src/components/TagView/index.jsx b/src/components/TagView/index.jsx
index ceddc4a..6e66355 100644
--- a/src/components/TagView/index.jsx
+++ b/src/components/TagView/index.jsx
@@ -85,7 +85,7 @@ const TagView = ({ children, home }) => {
     const tagsCopy = tagList.map((el, i) => ({ ...el }));
 
     // 判断关闭标签是否处于打开状态
-    tagList.forEach((el, i) => {
+    tagList.forEach?.((el, i) => {
       if (el.path === tag.path && tag.active) {
         const next = tagList[i - 1];
         next.active = true;
diff --git a/src/e2e/baseLayout.e2e.spec.ts b/src/e2e/baseLayout.e2e.spec.ts
index cb14fd5..512f9e3 100644
--- a/src/e2e/baseLayout.e2e.spec.ts
+++ b/src/e2e/baseLayout.e2e.spec.ts
@@ -8,7 +8,7 @@ const BASE_URL = `http://localhost:${process.env.PORT || 8001}`;
 function formatter(routes: any, parentPath = ''): string[] {
   const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
   let result: string[] = [];
-  routes.forEach((item: { path: string; routes: string }) => {
+  routes.forEach?.((item: { path: string; routes: string }) => {
     if (item.path && !item.path.startsWith('/')) {
       result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
     }
@@ -38,7 +38,7 @@ const testPage = (path: string, page: Page) => async () => {
 
 const routers = formatter(RouterConfig);
 
-routers.forEach((route) => {
+routers.forEach?.((route) => {
   test(`test route page ${route}`, async ({ page }) => {
     await testPage(route, page);
   });
diff --git a/src/global.jsx b/src/global.jsx
index dc1fe8f..a69b3d1 100644
--- a/src/global.jsx
+++ b/src/global.jsx
@@ -11,7 +11,7 @@ const clearCache = () => {
     caches
       .keys()
       .then((keys) => {
-        keys.forEach((key) => {
+        keys.forEach?.((key) => {
           caches.delete(key);
         });
       })
@@ -78,7 +78,7 @@ if (pwa) {
   const { serviceWorker } = navigator;
   if (serviceWorker.getRegistrations) {
     serviceWorker.getRegistrations().then((sws) => {
-      sws.forEach((sw) => {
+      sws.forEach?.((sw) => {
         sw.unregister();
       });
     });
diff --git a/src/global.less b/src/global.less
index 0e954b6..a730034 100644
--- a/src/global.less
+++ b/src/global.less
@@ -492,4 +492,13 @@ ol {
   top: -162px;
   left: 74px;
   color: #1890ff;
-}
\ No newline at end of file
+}
+.ant-popover-buttons {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.ant-input-number {
+  width: 100%;
+}
diff --git a/src/pages/device/account/index.jsx b/src/pages/device/account/index.jsx
index 2be524d..668a733 100644
--- a/src/pages/device/account/index.jsx
+++ b/src/pages/device/account/index.jsx
@@ -719,7 +719,7 @@ function Model(props) {
             });
             if (res?.data?.dataList) {
               let column = [];
-              res?.data?.dataList?.forEach((el) => {
+              res?.data?.dataList?.forEach?.((el) => {
                 column.push({
                   ...selectValueType(el.fieldChar, el.valueList),
                   title: el.fieldName,
@@ -737,7 +737,7 @@ function Model(props) {
               params: { id: drawer?.item?.id },
             });
             let obj = {};
-            res?.data?.data['equipmentCharList']?.forEach((it) => {
+            res?.data?.data['equipmentCharList']?.forEach?.((it) => {
               obj[it?.fieldId] = it?.fieldRealValue;
             });
             console.log('drawerpro:', {
diff --git a/src/pages/device/supplier/index.jsx b/src/pages/device/supplier/index.jsx
index 7177b8e..41a4c03 100644
--- a/src/pages/device/supplier/index.jsx
+++ b/src/pages/device/supplier/index.jsx
@@ -199,7 +199,7 @@ function Supplier(props) {
           });
           if (res?.data?.dataList) {
             let column = [];
-            res?.data?.dataList?.forEach((el) => {
+            res?.data?.dataList?.forEach?.((el) => {
               column.push({
                 ...selectValueType(el.fieldChar, el.valueList),
                 title: el.fieldName,
@@ -216,7 +216,7 @@ function Supplier(props) {
             params: { id: drawer?.item?.id },
           });
           let obj = {};
-          res?.data?.data['equipmentSupplierCharList']?.forEach((it) => {
+          res?.data?.data['equipmentSupplierCharList']?.forEach?.((it) => {
             obj[it?.fieldId] = it?.fieldRealValue;
           });
 
diff --git a/src/pages/spare/setting/columns.js b/src/pages/spare/setting/columns.js
index 02a28f6..311f916 100644
--- a/src/pages/spare/setting/columns.js
+++ b/src/pages/spare/setting/columns.js
@@ -1,60 +1,148 @@
 function getcolumns(setdrawer) {
   return {
- "pathconfig": {
-  "enableadd": false,
-  "enableedit": false,
-  "enabledelete": false,
-  "enabledetail": false,
-  "add": "",
-  "edit": "",
-  "list": "/repair/umRepairOrder/queryRepairOrderList",
-  "delete": "",
-  "detail": ""
- },
- "columns": [
-  {
-   "title": "维修单号",
-   "dataIndex": "repairOrderNo",
-   "key": "repairOrderNo"
-  },
-  {
-   "title": "设备编号",
-   "dataIndex": "equipmentNo",
-   "key": "equipmentNo"
-  },
-  {
-   "title": "设备名称",
-   "dataIndex": "equipmentName",
-   "key": "equipmentName"
-  },
-  {
-   "title": "故障描述",
-   "dataIndex": "faultDescription",
-   "key": "faultDescription"
-  },
-  {
-   "title": "报修人员",
-   "dataIndex": "repairUserName",
-   "key": "repairUserName"
-  },
-  {
-   "title": "报修时间",
-   "dataIndex": "repairTime",
-   "key": "repairTimeList",
-   "valueType": "dateTimeRange"
-  },
-  {
-   "title": "报修单号",
-   "dataIndex": "repairNo",
-   "key": "repairNo"
-  },
-  {
-   "title": "工单状态",
-   "dataIndex": "statusName",
-   "key": "statusName"
-  }
- ]
-};
-
+    columns: [
+      {
+        title: '备件料号',
+        dataIndex: 'sparePartNo',
+        key: 'sparePartNo',
+        formItemProps: {
+          rules: [
+            {
+              required: true,
+              message: '此项为必填项',
+            },
+          ],
+        },
+      },
+      {
+        title: '备件名称',
+        dataIndex: 'sparePartName',
+        key: 'sparePartName',
+        formItemProps: {
+          rules: [
+            {
+              required: true,
+              message: '此项为必填项',
+            },
+          ],
+        },
+      },
+      {
+        title: '备件类型',
+        dataIndex: 'sparePartTypeName',
+        key: 'sparePartTypeId',
+        formItemProps: {
+          rules: [
+            {
+              required: true,
+              message: '此项为必填项',
+            },
+          ],
+        },
+        valueType: 'treeSelect',
+        options: {
+          path: '/sparepart/sparePartType/queryTreeList',
+          params: {},
+        },
+      },
+      {
+        title: '库存上限',
+        dataIndex: 'stockUpper',
+        key: 'stockUpper',
+        valueType: 'digit',
+      },
+      {
+        title: '库存下限',
+        dataIndex: 'stockLower',
+        key: 'stockLower',
+        valueType: 'digit',
+      },
+      {
+        title: '库存单位',
+        dataIndex: 'unit',
+        key: 'unit',
+        formItemProps: {
+          rules: [
+            {
+              required: true,
+              message: '此项为必填项',
+            },
+          ],
+        },
+      },
+      {
+        title: '是否寿命件',
+        dataIndex: 'isLifeName',
+        key: 'isLife',
+        valueType: 'select',
+        options: [
+          {
+            label: '是',
+            value: 1,
+          },
+          {
+            label: '否',
+            value: 2,
+          },
+        ],
+      },
+      {
+        title: '供应商信息',
+        dataIndex: 'relations',
+        key: 'relations',
+        valueType: 'split',
+      },
+      {
+        title: '选择供应商',
+        dataIndex: 'relationSupplierList',
+        key: 'relationSupplierList',
+        valueType: 'formSelectList',
+        colProps: {
+          span: 24,
+        },
+        columns: [
+          {
+            title: '供应商编号',
+            dataIndex: 'supplierNo',
+            key: 'supplierNo',
+            editable: false,
+          },
+          {
+            title: '供应商名称',
+            dataIndex: 'supplierName',
+            key: 'supplierName',
+            editable: false,
+          },
+          {
+            title: '保质期(天)',
+            dataIndex: 'qualityGuarantee',
+            valueType: 'digit',
+            precision: 2,
+            fieldProps: {
+              precision: 2,
+            },
+          },
+          {
+            title: '价值',
+            dataIndex: 'value',
+            valueType: 'money',
+          },
+        ],
+        path: '/sparepart/sparePartSupplier/queryList',
+        params: { status: 1 },
+      },
+    ],
+    pathconfig: {
+      enableadd: true,
+      enableedit: true,
+      enabledelete: true,
+      enabledetail: true,
+      add: '/sparepart/sparePart/save',
+      edit: '/sparepart/sparePart/save',
+      list: '/sparepart/sparePart/queryList',
+      delete: '/sparepart/sparePart/deleteById',
+      detail: '/sparepart/sparePart/queryDetails',
+    },
+  };
 }
-export default getcolumns;
\ No newline at end of file
+export default getcolumns;
diff --git a/src/pages/spare/setting/index.jsx b/src/pages/spare/setting/index.jsx
index dd467b9..a22c92b 100644
--- a/src/pages/spare/setting/index.jsx
+++ b/src/pages/spare/setting/index.jsx
@@ -1,166 +1,177 @@
 import * as React from 'react';
-  import { useState, useMemo, useRef } from 'react';
-  import DrawerPro from '@/components/DrawerPro';
-  import AutoTable from '@/components/AutoTable';
-  import PremButton from '@/components/PremButton';
-  import getcolumns from './columns';
-  import { useRequest } from 'ahooks';
-  import { doFetch } from '@/utils/doFetch';
+import { useState, useMemo, useRef } from 'react';
+import DrawerPro from '@/components/DrawerPro';
+import AutoTable from '@/components/AutoTable';
+import PremButton from '@/components/PremButton';
+import getcolumns from './columns';
+import { useRequest } from 'ahooks';
+import { doFetch } from '@/utils/doFetch';
+import { message } from 'antd';
 
-  function Setting(props) {
-    const actionRef = useRef(),
-      formRef = useRef();
-    const [drawer, setdrawer] = useState({
-      open: false,
-    });
-    const pathconfig = useMemo(() => {
-      let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
-      return pathconf;
-    }, []);
-    const { run, loading } = useRequest(doFetch, {
-      manual: true,
-      onSuccess: (res, params) => {
-        if (res?.code == '0000') {
-          actionRef?.current?.reload();
-          setdrawer((s) => ({
-            ...s,
-            open: false,
-          }));
-        }
-      },
-    });
+function Setting(props) {
+  const actionRef = useRef(),
+    formRef = useRef();
+  const [drawer, setdrawer] = useState({
+    open: false,
+  });
+  const pathconfig = useMemo(() => {
+    let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
+    return pathconf;
+  }, []);
+  const { run, loading } = useRequest(doFetch, {
+    manual: true,
+    onSuccess: (res, params) => {
+      if (res?.code == '0000') {
+        message.success('操作成功');
+        actionRef?.current?.reload();
+        setdrawer((s) => ({
+          ...s,
+          open: false,
+        }));
+      }
+    },
+  });
 
-    const detail = (text, row, _, action) => {
-      return (
-        <PremButton
-          btn={{
-            size: 'small',
-            type: 'link',
-            onClick: () => {
-              setdrawer((s) => ({
-                ...s,
-                open: true,
-                item: row,
-                title: '详情',
-                val: 'detail',
-                title: '详细信息',
-              }));
-            },
-          }}
-        >
-          详情
-        </PremButton>
-      );
-    };
+  const detail = (text, row, _, action) => {
+    return (
+      <PremButton
+        btn={{
+          size: 'small',
+          type: 'link',
+          onClick: () => {
+            setdrawer((s) => ({
+              ...s,
+              open: true,
+              item: row,
+              title: '详情',
+              val: 'detail',
+              title: '详细信息',
+            }));
+          },
+        }}
+      >
+        详情
+      </PremButton>
+    );
+  };
+
+  const edit = (text, row, _, action) => {
+    return (
+      <PremButton
+        btn={{
+          size: 'small',
+          onClick: () => {
+            setdrawer((s) => ({
+              ...s,
+              open: true,
+              item: row,
+              title: '编辑',
+              val: 'edit',
+            }));
+          },
+        }}
+      >
+        编辑
+      </PremButton>
+    );
+  };
+
+  const remove = (text, row, _, action) => {
+    return (
+      <PremButton
+        pop={{
+          title: '是否删除?',
+          okText: '确认',
+          cancelText: '取消',
+          onConfirm: () => {
+            run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
+          },
+        }}
+        btn={{
+          size: 'small',
+          type: 'danger',
+        }}
+      >
+        删除
+      </PremButton>
+    );
+  };
 
-    const edit = (text, row, _, action) => {
-      return (
-        <PremButton
-          btn={{
-            size: 'small',
+  const columns = useMemo(() => {
+    let defcolumn = getcolumns(setdrawer)?.columns;
+    return defcolumn.concat({
+      title: '操作',
+      valueType: 'option',
+      width: 150,
+      render: (text, row, _, action) => [
+        pathconfig?.enabledetail && detail(text, row, _, action),
+        pathconfig?.enableedit && edit(text, row, _, action),
+        pathconfig?.enabledelete && remove(text, row, _, action),
+      ],
+    });
+  }, []);
+
+  return (
+    <div style={{ position: 'relative' }}>
+      <AutoTable
+        pagetitle=" 备件设置"
+        columns={columns}
+        actionRef={actionRef}
+        path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
+        pageextra={pathconfig?.enableadd ? 'add' : null}
+        resizeable={false}
+        addconfig={{
+          // access: 'sysDepartment_save',
+          btn: {
+            disabled: false,
             onClick: () => {
               setdrawer((s) => ({
                 ...s,
                 open: true,
-                item: row,
-                title: '编辑',
-                val: 'edit',
+                item: null,
+                title: '新增',
+                val: 'add',
               }));
             },
-          }}
-        >
-          编辑
-        </PremButton>
-      );
-    };
-
-    const remove = (text, row, _, action) => {
-      return (
-        <PremButton
-          pop={{
-            title: '是否删除?',
-            okText: '确认',
-            cancelText: '取消',
-            onConfirm: () => {
-              run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
-            },
-          }}
-          btn={{
-            size: 'small',
-            type: 'danger',
-          }}
-        >
-          删除
-        </PremButton>
-      );
-    };
+          },
+        }}
+      />
 
-    const columns = useMemo(() => {
-      let defcolumn = getcolumns(setdrawer)?.columns;
-      return defcolumn.concat({
-        title: '操作',
-        valueType: 'option',
-        width: 150,
-        render: (text, row, _, action) => [
-          pathconfig?.enabledetail && detail(text, row, _, action),
-          pathconfig?.enableedit && edit(text, row, _, action),
-          pathconfig?.enabledelete && remove(text, row, _, action),
-        ],
-      });
-    }, []);
-
-    return (
-      <div style={{ position: 'relative' }}>
-        <AutoTable
-          pagetitle=" 备件设置"
-          columns={columns}
-          actionRef={actionRef}
-          path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
-          pageextra={pathconfig?.enableadd ? 'add' : null}
-          resizeable={true}
-          addconfig={{
-            // access: 'sysDepartment_save',
-            btn: {
-              disabled: false,
-              onClick: () => {
-                setdrawer((s) => ({
-                  ...s,
-                  open: true,
-                  item: null,
-                  title: '新增',
-                  val: 'add',
-                }));
-              },
-            },
-          }}
-        />
-
-        <DrawerPro
-          fields={columns}
-          params={{ id: drawer?.item?.id }}
-          formRef={formRef}
-          placement="right"
-          detailpath={pathconfig?.detail || null}
-          detailData={drawer?.item}
-          defaultFormValue={drawer?.item}
-          onClose={() => {
-            setdrawer((s) => ({
-              ...s,
-              open: false,
-            }));
-          }}
-          {...drawer}
-          onFinish={(vals) => {
-            if (drawer?.val == 'add') {
-              run({ url: pathconfig?.add || '/add', params: { ...vals } });
-            } else if (drawer?.val == 'edit') {
-              run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
-            }
-          }}
-        />
-      </div>
-    );
-  }
+      <DrawerPro
+        fields={columns}
+        params={{ id: drawer?.item?.id }}
+        formRef={formRef}
+        placement="right"
+        detailpath={pathconfig?.detail || null}
+        detailData={drawer?.item}
+        defaultFormValue={drawer?.item}
+        onClose={() => {
+          setdrawer((s) => ({
+            ...s,
+            open: false,
+          }));
+        }}
+        {...drawer}
+        onFinish={(vals) => {
+          const relationSupplierList = vals?.relationSupplierList?.map?.((it, i) => {
+            return {
+              supplierId: it?.id,
+              qualityGuarantee: it?.qualityGuarantee,
+              value: it?.value,
+            };
+          });
+          if (drawer?.val == 'add') {
+            run({ url: pathconfig?.add || '/add', params: { ...vals, relationSupplierList } });
+          } else if (drawer?.val == 'edit') {
+            run({
+              url: pathconfig?.edit || '/edit',
+              params: { ...vals, id: drawer?.item?.id, relationSupplierList },
+            });
+          }
+        }}
+      />
+    </div>
+  );
+}
 
-  export default Setting;
-  
\ No newline at end of file
+export default Setting;
diff --git a/src/pages/spare/supplier/columns.js b/src/pages/spare/supplier/columns.js
index da3ad72..d40be10 100644
--- a/src/pages/spare/supplier/columns.js
+++ b/src/pages/spare/supplier/columns.js
@@ -1,4 +1,6 @@
-function getcolumns(setdrawer) {
+import { Switch } from 'antd';
+
+function getcolumns(changeState) {
   return {
     columns: [
       {
@@ -24,6 +26,7 @@ function getcolumns(setdrawer) {
         dataIndex: 'officialWebsite',
         key: 'officialWebsite',
         hideInSearch: true,
+        hideInTable: true,
       },
       {
         title: '联系电话',
@@ -41,6 +44,22 @@ function getcolumns(setdrawer) {
         key: 'address',
         hideInSearch: true,
       },
+      {
+        title: '备注',
+        dataIndex: 'remark',
+        key: 'remark',
+        colProps: {
+          span: 24,
+        },
+        valueType: 'textarea',
+        hideInSearch: true,
+      },
+      {
+        title: '评分',
+        dataIndex: 'score',
+        key: 'score',
+        valueType: 'rate',
+      },
       {
         title: '状态',
         dataIndex: 'statusName',
@@ -65,22 +84,18 @@ function getcolumns(setdrawer) {
             },
           ],
         },
-      },
-      {
-        title: '评分',
-        dataIndex: 'score',
-        key: 'score',
-        valueType: 'rate',
-      },
-      {
-        title: '备注',
-        dataIndex: 'remark',
-        key: 'remark',
-        colProps: {
-          span: 24,
+        render: (text, row) => {
+          return (
+            <Switch
+              checked={row?.status == 1}
+              checkedChildren="启用"
+              unCheckedChildren="停用"
+              onChange={(e) => {
+                changeState({ id: row.id, status: e ? 1 : 2 });
+              }}
+            />
+          );
         },
-        valueType: 'textarea',
-        hideInSearch: true,
       },
       {
         title: '列表',
diff --git a/src/pages/spare/supplier/index.jsx b/src/pages/spare/supplier/index.jsx
index 4cae078..9bdee70 100644
--- a/src/pages/spare/supplier/index.jsx
+++ b/src/pages/spare/supplier/index.jsx
@@ -7,6 +7,7 @@ import getcolumns from './columns';
 import { useAsyncEffect, useRequest } from 'ahooks';
 import { doFetch } from '@/utils/doFetch';
 import extraColumns from '@/utils/extraColumns';
+import { message } from 'antd';
 
 function Supplier(props) {
   const actionRef = useRef(),
@@ -23,7 +24,7 @@ function Supplier(props) {
   ]);
 
   const pathconfig = useMemo(() => {
-    let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
+    let pathconf = getcolumns(changeState)?.pathconfig ?? {};
     return pathconf;
   }, []);
 
@@ -105,12 +106,21 @@ function Supplier(props) {
     );
   };
 
+  function changeState(params) {
+    doFetch({ url: '/sparepart/sparePartSupplier/stopAndStart', params }).then((res) => {
+      if (res.code == '0000') {
+        message.success('操作成功');
+        actionRef?.current?.reload();
+      }
+    });
+  }
+
   useAsyncEffect(async () => {
     let extracolumns = await extraColumns({
       url: '/base/paFormField/queryList',
       params: { formId: 4 },
     });
-    let defcolumn = getcolumns(setdrawer)?.columns;
+    let defcolumn = getcolumns(changeState)?.columns;
     setcolumns([
       ...defcolumn,
       ...extracolumns,
@@ -126,7 +136,6 @@ function Supplier(props) {
       },
     ]);
   }, []);
-  console.log(columns);
 
   return (
     <div style={{ position: 'relative' }}>
diff --git a/src/pages/system/rules/index.jsx b/src/pages/system/rules/index.jsx
index e28b58d..bce7bae 100644
--- a/src/pages/system/rules/index.jsx
+++ b/src/pages/system/rules/index.jsx
@@ -85,7 +85,7 @@ function Rules(props) {
                     (_, index) => index + 1,
                   ).filter((it) => it !== vals?.nrList.other.sort + 1);
                   params.nrList.splice(vals?.nrList.other.sort, 0, vals?.nrList.other);
-                  params.nrList.forEach((it, i) => {
+                  params.nrList.forEach?.((it, i) => {
                     it.sort = i + 1;
                   });
                 } else {
@@ -204,7 +204,7 @@ function Rules(props) {
                       (_, index) => index + 1,
                     ).filter((it) => it !== vals?.nrList.other.sort + 1);
                     params.nrList.splice(vals?.nrList.other.sort, 0, vals?.nrList.other);
-                    params.nrList.forEach((it, i) => {
+                    params.nrList.forEach?.((it, i) => {
                       it.sort = i + 1;
                     });
                   } else {
diff --git a/src/utils/extraColumns.js b/src/utils/extraColumns.js
index c7485d2..f16a2fc 100644
--- a/src/utils/extraColumns.js
+++ b/src/utils/extraColumns.js
@@ -5,20 +5,24 @@ const selectValueType = (type, options) => {
     case 1:
       return {
         valueType: 'input',
+        hideInTable: true,
       };
     case 2:
       return {
         valueType: 'select',
+        hideInTable: true,
         options,
       };
     case 3:
       return {
         valueType: 'radio',
+        hideInTable: true,
         options,
       };
     case 4:
       return {
         valueType: 'select',
+        hideInTable: true,
         fieldProps: {
           mode: 'multiple',
         },
diff --git a/src/utils/fieldsDetail.js b/src/utils/fieldsDetail.js
index eb90767..1f87168 100644
--- a/src/utils/fieldsDetail.js
+++ b/src/utils/fieldsDetail.js
@@ -53,7 +53,7 @@ export default async (fieldscolumns, setdrawer, row, formId, detailpath) => {
         valueType: 'split',
       },
     ];
-    res?.data?.dataList?.forEach((el) => {
+    res?.data?.dataList?.forEach?.((el) => {
       column.push({
         ...selectValueType(el.fieldChar, el.valueList),
         title: el.fieldName,
diff --git a/src/wrappers/auth.jsx b/src/wrappers/auth.jsx
index bcb5b3a..8d013ca 100644
--- a/src/wrappers/auth.jsx
+++ b/src/wrappers/auth.jsx
@@ -3,7 +3,7 @@ import { useEffect, useMemo } from 'react';
 
 function treeToArr(data) {
   const result = [];
-  data?.forEach((item) => {
+  data?.forEach?.((item) => {
     const loop = (data) => {
       result.push(data?.path);
       let child = data.routes;
-- 
2.21.0