From b4dd4c4dae62ca9cbe50e858cec5277088022608 Mon Sep 17 00:00:00 2001
From: wuhao930406 <1148547900@qq.com>
Date: Mon, 5 Sep 2022 11:24:36 +0800
Subject: [PATCH] sadare

---
 src/pages/platform/Provide/index.jsx |   4 +-
 src/pages/system/Staff/index.jsx     | 426 +++++++++++++--------------
 2 files changed, 215 insertions(+), 215 deletions(-)

diff --git a/src/pages/platform/Provide/index.jsx b/src/pages/platform/Provide/index.jsx
index e1f849c..447a371 100644
--- a/src/pages/platform/Provide/index.jsx
+++ b/src/pages/platform/Provide/index.jsx
@@ -15,7 +15,7 @@ import { useRequest } from "umi";
 import defaultFields from "./fields";
 import { doFetch } from "@/utils/doFetch";
 import { deviceprovideDetail, deleteProvideCheck } from "@/services/device";
-import { usercusDetails } from "@/utils/detailTotalCard";
+import { deviceprovideDetails } from "@/utils/detailTotalCard";
 import Details from "@/components/Details";
 import { useAsyncEffect } from "ahooks";
 import tempfields from "@/utils/tempfields";
@@ -81,7 +81,7 @@ function reducer(state, action) {
         ...state,
         details: {
           dataSource: action.dataSource,
-          totalCard: [...usercusDetails, ...extraspecial],
+          totalCard: [...deviceprovideDetails, ...extraspecial],
         },
         visible: true,
       };
diff --git a/src/pages/system/Staff/index.jsx b/src/pages/system/Staff/index.jsx
index 1a58b39..b6b89dd 100644
--- a/src/pages/system/Staff/index.jsx
+++ b/src/pages/system/Staff/index.jsx
@@ -10,19 +10,19 @@ import { userDetails, userCheckDetails } from "@/utils/detailTotalCard";
 import Details from "@/components/Details";
 import { userSelect } from "@/services/system";
 const initState = {
-  vs: false,
-  fields: {},
-  iftype: {},
-  curitem: {},
-  detail: {
-    dataSource: {},
-    totalCard: [],
-  },
-  visible: false,
-  extraparams: {
-    orderType: "1",
+    vs: false,
+    fields: {},
+    iftype: {},
+    curitem: {},
+    detail: {
+      dataSource: {},
+      totalCard: [],
+    },
+    visible: false,
+    extraparams: {
+      orderType: "1",
+    },
   },
-},
   tabList = [
     {
       key: "1",
@@ -36,78 +36,78 @@ const initState = {
 function reducer(state, action) {
   let { type } = action,
     newState = {};
-  switch (type) {
-    case "add":
-      newState = {
-        ...state,
-        vs: true,
-        iftype: {
-          title: "新增用户",
-          val: type,
-        },
-        fields: { ...action.fields },
-      };
-      break;
-    case "edit":
-      newState = {
-        ...state,
-        vs: true,
-        iftype: {
-          title: "编辑用户",
-          val: type,
-        },
-        fields: { ...action.fields },
-        curitem: action.curitem,
-      };
-      break;
-    case "audit":
-      newState = {
-        ...state,
-        vs: true,
-        iftype: {
-          title: "审批用户",
-          val: type,
-        },
-        fields: { ...action.fields },
-        curitem: action.curitem,
-      };
-      break;
-    case "see":
-      newState = {
-        ...state,
-        detail: {
-          dataSource: action.dataSource,
-          totalCard: action.totalCard,
-        },
-        visible: true,
-      };
-      break;
-    case "start":
-      newState = {
-        ...state,
-        extraparams: {
-          orderType: action.tabKey,
-        },
-      };
-      break;
-    case "close":
-      newState = {
-        ...state,
-        vs: false,
-        fields: {},
-        iftype: {},
-        curitem: {},
-        detail: {
-          dataSource: {},
-          totalCard: [],
-        },
-        visible: false,
-      };
-      break;
-  }
-
+    switch (type) {
+      case "add":
+        newState = {
+          ...state,
+          vs: true,
+          iftype: {
+            title: "新增用户",
+            val: type,
+          },
+          fields: { ...action.fields },
+        };
+        break;
+      case "edit":
+        newState = {
+          ...state,
+          vs: true,
+          iftype: {
+            title: "编辑用户",
+            val: type,
+          },
+          fields: { ...action.fields },
+          curitem: action.curitem,
+        };
+        break;
+      case "audit":
+        newState = {
+          ...state,
+          vs: true,
+          iftype: {
+            title: "审批用户",
+            val: type,
+          },
+          fields: { ...action.fields },
+          curitem: action.curitem,
+        };
+        break;
+      case "see":
+        newState = {
+          ...state,
+          detail: {
+            dataSource: action.dataSource,
+            totalCard: action.totalCard,
+          },
+          visible: true,
+        };
+        break;
+      case "start":
+        newState = {
+          ...state,
+          extraparams: {
+            orderType: action.tabKey,
+          },
+        };
+        break;
+      case "close":
+        newState = {
+          ...state,
+          vs: false,
+          fields: {},
+          iftype: {},
+          curitem: {},
+          detail: {
+            dataSource: {},
+            totalCard: [],
+          },
+          visible: false,
+        };
+        break;
+    }
   return newState;
 }
+
 const Staff = (props) => {
   let actionRef = useRef(),
     ChildRef = null;
@@ -116,15 +116,15 @@ const Staff = (props) => {
     ChildRef?.onRefresh();
   }
   const { run, loading } = useRequest(doFetch, {
-    manual: true,
-    formatResult: (res) => res,
-    onSuccess: (result, params) => {
-      if (result.code == "0000") {
-        reload();
-        dispatch({ type: "close" });
-      }
-    },
-  }),
+      manual: true,
+      formatResult: (res) => res,
+      onSuccess: (result, params) => {
+        if (result.code == "0000") {
+          reload();
+          dispatch({ type: "close" });
+        }
+      },
+    }),
     [state, dispatch] = useReducer(reducer, initState),
     { vs, fields, iftype, curitem, detail, visible, extraparams } = state,
     columns = [
@@ -154,8 +154,8 @@ const Staff = (props) => {
                         dataSource.gender == 1
                           ? "ç”·"
                           : dataSource.gender == 2
-                            ? "女"
-                            : "-";
+                          ? "女"
+                          : "-";
                       dispatch({ type: "see", dataSource, totalCard });
                     }
                   });
@@ -228,8 +228,8 @@ const Staff = (props) => {
                         dataSource.gender == 1
                           ? "ç”·"
                           : dataSource.gender == 2
-                            ? "女"
-                            : "-";
+                          ? "女"
+                          : "-";
                       dispatch({ type: "see", dataSource, totalCard });
                     }
                   });
@@ -317,138 +317,138 @@ const Staff = (props) => {
   function extraAction(text, record, _, action) {
     return [
       extraparams.orderType == "1" &&
-      getPrem("sysUser_restPassword", action, "重置密码", null, {
-        title: "确认重置密码?",
-        onConfirm: () => {
+        getPrem("sysUser_restPassword", action, "重置密码", null, {
+          title: "确认重置密码?",
+          onConfirm: () => {
+            doFetch({
+              url: "/ngic-auth/sysUser/restPassword",
+              params: { id: record.id },
+            }).then((res) => {
+              if (res.code == "0000") {
+                message.success(res.msg);
+                reload();
+              }
+            });
+          },
+        }),
+      extraparams.orderType == "1" &&
+        getPrem("sysDepartment_save", action, "修改", () => {
           doFetch({
-            url: "/ngic-auth/sysUser/restPassword",
+            url: "/ngic-auth/sysUser/query/detail",
             params: { id: record.id },
           }).then((res) => {
             if (res.code == "0000") {
-              message.success(res.msg);
-              reload();
+              let data = res?.data?.data ?? {};
+              for (let i in defaultFields) {
+                defaultFields[i].value = data[i];
+                if (i == "parentId") {
+                  defaultFields[i].belinked = {
+                    options: {
+                      database: userSelect,
+                      params: { id: record.id },
+                    },
+                  };
+                }
+              }
+              dispatch({
+                type: "edit",
+                fields: { ...defaultFields },
+                curitem: data,
+              });
             }
           });
-        },
-      }),
+        }),
       extraparams.orderType == "1" &&
-      getPrem("sysDepartment_save", action, "修改", () => {
-        doFetch({
-          url: "/ngic-auth/sysUser/query/detail",
-          params: { id: record.id },
-        }).then((res) => {
-          if (res.code == "0000") {
-            let data = res?.data?.data ?? {};
-            for (let i in defaultFields) {
-              defaultFields[i].value = data[i];
-              if (i == "parentId") {
-                defaultFields[i].belinked = {
-                  options: {
-                    database: userSelect,
-                    params: { id: record.id },
-                  },
-                };
-              }
-            }
-            dispatch({
-              type: "edit",
-              fields: { ...defaultFields },
-              curitem: data,
+        getPrem("sysDepartment_deleteById", action, "删除", null, {
+          title: "确认删除该用户?",
+          onConfirm: () => {
+            run({
+              url: "/ngic-auth/sysUser/deleteById",
+              params: { id: record.id },
             });
-          }
-        });
-      }),
-      extraparams.orderType == "1" &&
-      getPrem("sysDepartment_deleteById", action, "删除", null, {
-        title: "确认删除该用户?",
-        onConfirm: () => {
-          run({
-            url: "/ngic-auth/sysUser/deleteById",
-            params: { id: record.id },
-          });
-        },
-      }),
+          },
+        }),
       extraparams.orderType == "2" &&
-      record.status == 1 &&
-      getPrem("sysDepartment_save", action, "审批", () => {
-        doFetch({
-          url: "/ngic-auth/sysAccountApply/queryById",
-          params: { id: record.id },
-        }).then((res) => {
-          if (res.code == "0000") {
-            let data = res?.data?.data ?? {};
-            for (let i in defaultFields) {
-              defaultFields[i].value = data[i];
-              if (i == "parentId") {
-                defaultFields[i].belinked = {
-                  options: {
-                    database: userSelect,
-                    params: { id: record.id },
-                  },
-                };
+        record.status == 1 &&
+        getPrem("sysDepartment_save", action, "审批", () => {
+          doFetch({
+            url: "/ngic-auth/sysAccountApply/queryById",
+            params: { id: record.id },
+          }).then((res) => {
+            if (res.code == "0000") {
+              let data = res?.data?.data ?? {};
+              for (let i in defaultFields) {
+                defaultFields[i].value = data[i];
+                if (i == "parentId") {
+                  defaultFields[i].belinked = {
+                    options: {
+                      database: userSelect,
+                      params: { id: record.id },
+                    },
+                  };
+                }
               }
-            }
-            let newParams = {
-              remark: {
-                value: data.remark,
-                type: "textarea",
-                title: "备注",
-                name: ["remark"],
-                required: false,
-                col: { span: 24 },
-              },
-              applyTime: {
-                value: data.applyTime,
-                type: "datepicker",
-                title: "申请时间",
-                name: ["applyTime"],
-                required: false,
-                disabled: true,
-              },
-              auditResult: {
-                value: null,
-                type: "select",
-                title: "审批结果",
-                name: ["auditResult"],
-                required: true,
-                options: [
-                  {
-                    label: "通过",
-                    value: 1,
-                  },
-                  {
-                    label: "不通过",
-                    value: 2,
-                  },
-                ],
-                linked: true,
-              },
-              auditOpinion: {
-                value: null,
-                type: "textarea",
-                title: "审批意见",
-                name: ["auditOpinion"],
-                required: true,
-                col: { span: 24 },
-                belinked: {
-                  hides: [
+              let newParams = {
+                remark: {
+                  value: data.remark,
+                  type: "textarea",
+                  title: "备注",
+                  name: ["remark"],
+                  required: false,
+                  col: { span: 24 },
+                },
+                applyTime: {
+                  value: data.applyTime,
+                  type: "datepicker",
+                  title: "申请时间",
+                  name: ["applyTime"],
+                  required: false,
+                  disabled: true,
+                },
+                auditResult: {
+                  value: null,
+                  type: "select",
+                  title: "审批结果",
+                  name: ["auditResult"],
+                  required: true,
+                  options: [
                     {
-                      name: "auditResult",
-                      equalvalue: [1, null],
-                      required: true,
+                      label: "通过",
+                      value: 1,
+                    },
+                    {
+                      label: "不通过",
+                      value: 2,
                     },
                   ],
+                  linked: true,
                 },
-              },
-            };
-            dispatch({
-              type: "audit",
-              fields: { ...defaultFields, ...newParams },
-              curitem: data,
-            });
-          }
-        });
-      }),
+                auditOpinion: {
+                  value: null,
+                  type: "textarea",
+                  title: "审批意见",
+                  name: ["auditOpinion"],
+                  required: true,
+                  col: { span: 24 },
+                  belinked: {
+                    hides: [
+                      {
+                        name: "auditResult",
+                        equalvalue: [1, null],
+                        required: true,
+                      },
+                    ],
+                  },
+                },
+              };
+              dispatch({
+                type: "audit",
+                fields: { ...defaultFields, ...newParams },
+                curitem: data,
+              });
+            }
+          });
+        }),
     ];
   }
   let saveData = (values, fn) => {
-- 
2.21.0