shaogen1995 преди 2 години
родител
ревизия
2b113dc9e6

+ 1 - 0
src/components/Z1upImgs/index.tsx

@@ -159,6 +159,7 @@ function Z1upImgs(
               okText="删除"
               cancelText="取消"
               onConfirm={() => delImgListFu(v.id!)}
+              okButtonProps={{ loading: false }}
             >
               <div className="clearCover" hidden={isLook}>
                 <CloseOutlined />

+ 1 - 0
src/components/Z2upVideos/index.tsx

@@ -150,6 +150,7 @@ function Z2upVideos(
                 okText="删除"
                 cancelText="取消"
                 onConfirm={() => delImgListFu(v.id!)}
+                okButtonProps={{ loading: false }}
               >
                 <div className="clearCover" hidden={isLook}>
                   <CloseOutlined />

+ 1 - 0
src/components/Z3upFiles/index.tsx

@@ -139,6 +139,7 @@ function Z3upFiles(
                   okText="删除"
                   cancelText="取消"
                   onConfirm={() => delImgListFu(v.id)}
+                  okButtonProps={{ loading: false }}
                 >
                   <CloseOutlined title="删除" hidden={isLook} />
                 </Popconfirm>

+ 5 - 1
src/pages/A2Dict/A2Tab1/A2Tab1Add/index.tsx

@@ -66,7 +66,11 @@ function A2Tab1Add({ info, closeFu, addFu }: Props) {
           <span className="bs rowSpan">字典名称:</span>
           <div className="inputBox">
             <Input
-              disabled={info.name === "未分类"}
+              disabled={
+                info.name === "未分类" ||
+                info.name === "项目经理" ||
+                info.name === "商务经理"
+              }
               maxLength={10}
               value={name}
               onChange={(e) => setName(e.target.value.replace(/\s+/g, ""))}

+ 10 - 4
src/pages/A2Dict/A2Tab1/A2Table1.tsx

@@ -78,7 +78,10 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
         title: "操作",
         render: (item: A2Tab1_1, _: any, index: number) => (
           <>
-            {index !== 0 && item.name !== "未分类" ? (
+            {index !== 0 &&
+            item.name !== "未分类" &&
+            item.name !== "项目经理" &&
+            item.name !== "商务经理" ? (
               <Button
                 size="small"
                 type="text"
@@ -88,7 +91,8 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
               </Button>
             ) : null}
 
-            {index < tableArr.length - 2 && item.name !== "未分类" ? (
+            {index < tableArr.length - (type === "job" ? 4 : 2) &&
+            item.name !== "未分类" ? (
               <Button
                 size="small"
                 type="text"
@@ -102,7 +106,9 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
               编辑
             </Button>
 
-            {item.name !== "未分类" ? (
+            {item.name !== "未分类" &&
+            item.name !== "项目经理" &&
+            item.name !== "商务经理" ? (
               <Popconfirm
                 title="删除后无法恢复,是否删除?"
                 okText="删除"
@@ -119,7 +125,7 @@ function A2Table1({ editFu, upTaleFu, type }: Props) {
         ),
       },
     ];
-  }, [delById, editFu, sortFu, tableArr.length]);
+  }, [delById, editFu, sortFu, tableArr.length, type]);
 
   return (
     <div className={styles.A2Table1}>

+ 28 - 4
src/pages/A3User/UserAdd/index.module.scss

@@ -4,16 +4,40 @@
       display: none;
     }
 
+    .ant-modal {
+      width: 800px !important;
+    }
+
     .userAddMain {
       border-top: 1px solid #999999;
-      padding-top: 15px;
+      padding-top: 20px;
       width: 100%;
 
-      .passTit {
-        color: #ff4d4f;
+      .e_row {
+        padding-right: 50px;
+        display: flex;
         font-size: 14px;
-        padding-left: 98px;
+        margin-bottom: 24px;
+
+        .e_rowL {
+          width: 158px;
+          text-align: right;
+
+          &>span {
+            color: #ff4d4f;
+            position: relative;
+            top: 3px;
+          }
+        }
+
+        .e_rowR {
+          width: calc(100% - 158px);
+        }
+
+
       }
+
+
     }
   }
 }

+ 93 - 18
src/pages/A3User/UserAdd/index.tsx

@@ -4,6 +4,7 @@ import { SaveUserType } from "@/types";
 import { MessageFu } from "@/utils/message";
 import {
   Button,
+  Cascader,
   Form,
   FormInstance,
   Input,
@@ -11,7 +12,7 @@ import {
   Popconfirm,
   Select,
 } from "antd";
-import React, { useCallback, useEffect, useRef } from "react";
+import React, { useCallback, useEffect, useRef, useState } from "react";
 import { useSelector } from "react-redux";
 import styles from "./index.module.scss";
 
@@ -28,7 +29,11 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
 
   const getInfoInAPIFu = useCallback(async (id: number) => {
     const res = await getUserInfoByIdAPI(id);
-    FormBoxRef.current?.setFieldsValue(res.data);
+
+    FormBoxRef.current?.setFieldsValue({
+      ...res.data,
+      // deptId: ["1", "2", "51", "52"],
+    });
     console.log("是编辑,在这里发请求拿数据", res);
   }, []);
 
@@ -44,16 +49,21 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
     }
   }, [getInfoInAPIFu, id]);
 
+  // 密码提示
+  const [passFlag, setPassFlag] = useState("");
+
   // 从仓库获取角色下拉列表信息
-  const roleList = useSelector(
-    (state: RootState) => state.A3User.roleList
-  );
+  const roleList = useSelector((state: RootState) => state.A3User.roleList);
+
+  // 从仓库获取部门 级联 信息
+  const deptList = useSelector((state: RootState) => state.A5Section.tableList);
 
   // 通过校验点击确定
   const onFinish = useCallback(
     async (values: any) => {
       const obj: SaveUserType = {
         ...values,
+        deptId: values.deptId[values.deptId.length - 1],
         id: id ? id : null,
       };
 
@@ -66,7 +76,7 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
 
         closePage();
       }
-      console.log("通过校验,点击确定");
+      // console.log("通过校验,点击确定");
     },
     [addTableList, closePage, id, upTableList]
   );
@@ -91,34 +101,95 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
           autoComplete="off"
         >
           <Form.Item
-            label="账号名"
+            label="用户名"
             name="userName"
-            rules={[{ required: true, message: "请输入账号名!" }]}
+            rules={[
+              { required: true, message: "请输入用户名!" },
+              {
+                validator: (_: any, value: any) => {
+                  if (value) {
+                    const reg = new RegExp(/^[a-zA-Z0-9_]{6,15}$/);
+                    const flag = reg.test(value);
+                    if (flag) {
+                      setPassFlag(value);
+                      return Promise.resolve(value);
+                    } else {
+                      setPassFlag("");
+                      return Promise.reject(
+                        "用户名只包含字母、数字和下划线,最少 6 个字符!"
+                      );
+                    }
+                  } else {
+                    setPassFlag("");
+                    return Promise.resolve(value);
+                  }
+                },
+              },
+            ]}
             getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
           >
             <Input
+              style={{ width: 400 }}
               disabled={id}
               maxLength={15}
               showCount
-              placeholder="请输入内容"
+              placeholder="请输入内容,6-15字;不能重复"
             />
           </Form.Item>
 
+          <div className="e_row" hidden={id}>
+            <div className="e_rowL">
+              <span> </span>初始密码:
+            </div>
+            <div className="e_rowR">
+              {passFlag ? `${passFlag}4dage` : "请先输入合法用户名"}
+            </div>
+          </div>
+
           <Form.Item
-            label="用户昵称"
-            name="nickName"
-            rules={[{ required: true, message: "请输入用户昵称!" }]}
+            label="手机号"
+            name="phone"
+            rules={[
+              { required: true, message: "请输入手机号!" },
+              // { max: 11, min: 11, message: "长度为11!" },
+              {
+                pattern: /^1[3-9][0-9]{9}$/,
+                message: "请输入正确格式的手机号!",
+              },
+            ]}
             getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
           >
-            <Input maxLength={8} showCount placeholder="请输入内容" />
+            <Input
+              style={{ width: 400 }}
+              maxLength={11}
+              showCount
+              placeholder="请输入11位手机号"
+            />
+          </Form.Item>
+
+          <Form.Item
+            label="所属部门"
+            name="deptId"
+            rules={[{ required: true, message: "请选择部门!" }]}
+          >
+            <Cascader
+              style={{ width: 300 }}
+              options={deptList}
+              fieldNames={{ label: "name", value: "id" }}
+              placeholder="请选择"
+            />
           </Form.Item>
 
           <Form.Item
-            label="用户角色"
+            label="角色"
             name="roleId"
             rules={[{ required: true, message: "请选择角色!" }]}
           >
-            <Select placeholder="请选择" options={roleList} />
+            <Select
+              style={{ width: 300 }}
+              placeholder="请选择"
+              options={roleList}
+            />
           </Form.Item>
 
           <Form.Item
@@ -127,11 +198,14 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
             rules={[{ required: true, message: "请输入真实姓名!" }]}
             getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
           >
-            <Input maxLength={8} showCount placeholder="请输入内容" />
+            <Input
+              style={{ width: 400 }}
+              maxLength={8}
+              showCount
+              placeholder="请输入内容"
+            />
           </Form.Item>
 
-          {id ? null : <div className="passTit">* 默认密码 123456</div>}
-
           {/* 确定和取消按钮 */}
           <br />
           <Form.Item wrapperCol={{ offset: 9, span: 16 }}>
@@ -144,6 +218,7 @@ function UserAdd({ id, closePage, upTableList, addTableList }: Props) {
               okText="放弃"
               cancelText="取消"
               onConfirm={closePage}
+              okButtonProps={{ loading: false }}
             >
               <Button>取消</Button>
             </Popconfirm>

+ 14 - 9
src/pages/A3User/index.tsx

@@ -1,7 +1,6 @@
 import { RootState } from "@/store";
 import {
   getUserListAPI,
-  getUserRoleAPI,
   userPassResetAPI,
   userRemoveAPI,
 } from "@/store/action/A3User";
@@ -34,13 +33,14 @@ function A3User() {
     searchKey: "",
   });
 
-  // 进来用户管理页面获取角色的下拉列表
-  useEffect(() => {
-    dispatch(getUserRoleAPI());
-  }, [dispatch]);
+  // 获取 部门 列表下拉框数据
+  const selectData1 = useSelector(
+    (state: RootState) => state.A5Section.tableList
+  );
+  // 获取 角色 列表下拉框数据
+  const selectData2 = useSelector((state: RootState) => state.A3User.roleList);
 
   // 封装发送请求的函数
-
   const getList = useCallback(async () => {
     const data = {
       ...tableSelect,
@@ -179,10 +179,11 @@ function A3User() {
           ) : (
             <>
               <Popconfirm
-                title="密码重制后为123456,是否重置?"
+                title="密码重制后为用户名+4dage,是否重置?"
                 okText="重置"
                 cancelText="取消"
                 onConfirm={() => resetPassFu(item.id!)}
+                okButtonProps={{ loading: false }}
               >
                 <Button size="small" type="text">
                   重置密码
@@ -201,6 +202,7 @@ function A3User() {
                 okText="删除"
                 cancelText="取消"
                 onConfirm={() => delTableFu(item.id!)}
+                okButtonProps={{ loading: false }}
               >
                 <Button size="small" type="text" danger>
                   删除
@@ -237,7 +239,10 @@ function A3User() {
               placeholder="请选择"
               value={tableSelect.deptId}
               onChange={(e) => setTableSelect({ ...tableSelect, deptId: e })}
-              options={[{ value: "", label: "全部" }]}
+              options={[
+                { value: "", label: "全部" },
+                ...selectData1.map((v) => ({ value: v.id, label: v.name })),
+              ]}
             />
           </div>
 
@@ -248,7 +253,7 @@ function A3User() {
               placeholder="请选择"
               value={tableSelect.roleId}
               onChange={(e) => setTableSelect({ ...tableSelect, roleId: e })}
-              options={[{ value: "", label: "全部" }]}
+              options={[{ value: "", label: "全部" }, ...selectData2]}
             />
           </div>
 

+ 1 - 0
src/pages/A4Role/RoleAdd/index.tsx

@@ -102,6 +102,7 @@ function RoleAdd({ id, closePage, upTableList, addTableList }: Props) {
             okText="放弃"
             cancelText="取消"
             onConfirm={closePage}
+            okButtonProps={{ loading: false }}
           >
             <Button>取消</Button>
           </Popconfirm>

+ 1 - 0
src/pages/A4Role/index.tsx

@@ -169,6 +169,7 @@ function A4Role() {
                   okText="删除"
                   cancelText="取消"
                   onConfirm={() => delTableFu(item.id!)}
+                  okButtonProps={{ loading: false }}
                 >
                   <Button size="small" type="text" danger>
                     删除

+ 1 - 1
src/pages/Layout/index.module.scss

@@ -61,7 +61,7 @@
         display: flex;
         justify-content: flex-end;
         position: relative;
-        z-index: 100;
+        z-index: 1000;
 
         .user {
           margin-right: 40px;

+ 7 - 3
src/pages/Layout/index.tsx

@@ -24,6 +24,7 @@ import { useDispatch } from "react-redux";
 import { A5_APIgetList } from "@/store/action/A5Section";
 import { A4_APIgetRoleAll } from "@/store/action/A4Role";
 import { A2_APIgetListFile } from "@/store/action/A2Dict";
+import { A3_APIgetRole } from "@/store/action/A3User";
 
 const NotFound = React.lazy(() => import("@/components/NotFound"));
 
@@ -32,13 +33,16 @@ function Layout() {
   const dispatch =useDispatch()
 
   useEffect(()=>{
-    // 进页面获取 部门 列表 信息
+    // 进页面获取 部门 列表 信息(给 用户管理、字段管理、项目管理 页面使用)
     dispatch(A5_APIgetList())
 
-    // 获取权限信息
+    // 获取角色 列表 信息(给 用户管理、项目管理 页面使用)
+    dispatch(A3_APIgetRole());
+
+    // 获取权限信息(整个项目的关于权限的信息)
     dispatch(A4_APIgetRoleAll())
 
-    // 获取字典的 -内控文件属性
+    // 获取字典的 -内控文件属性(角色管理等页面使用)
     dispatch(A2_APIgetListFile());
 
   },[dispatch])

+ 1 - 1
src/store/action/A3User.ts

@@ -21,7 +21,7 @@ export const getUserListAPI = (data: UserTableAPIType) => {
 /**
  * 获取用户管理-角色列表
  */
-export const getUserRoleAPI = () => {
+export const A3_APIgetRole = () => {
   return async (dispatch: AppDispatch) => {
     const res = await http.get("sys/user/getRole");
     if (res.code === 0) {