|
@@ -1,4 +1,10 @@
|
|
|
-import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
+import React, {
|
|
|
+ useCallback,
|
|
|
+ useEffect,
|
|
|
+ useMemo,
|
|
|
+ useRef,
|
|
|
+ useState,
|
|
|
+} from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import {
|
|
|
Button,
|
|
@@ -47,6 +53,9 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
const info = res.data.entity;
|
|
|
setLookInfo(info);
|
|
|
|
|
|
+ // 创建人编辑的 提示 回显
|
|
|
+ setCreatorIdValue(info.creatorId);
|
|
|
+
|
|
|
const province = info.province ? info.province.split("-") : "";
|
|
|
|
|
|
const dateScope = info.dateScope ? info.dateScope.split(" 至 ") : "";
|
|
@@ -122,7 +131,26 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
[addFu, closeFu, editFu, pageType.id, pageType.txt]
|
|
|
);
|
|
|
|
|
|
-
|
|
|
+ // 从仓库中获取 用户列表数据(全部)
|
|
|
+ const userListTemp = useSelector(
|
|
|
+ (state: RootState) => state.A3User.tableInfo.list
|
|
|
+ );
|
|
|
+
|
|
|
+ const userList = useMemo(() => {
|
|
|
+ return userListTemp.map((v: any) => ({
|
|
|
+ value: v.id,
|
|
|
+ label: `${v.userName} - ${v.roleName}${
|
|
|
+ v.realName ? " - " + v.realName : ""
|
|
|
+ }`,
|
|
|
+ }));
|
|
|
+ }, [userListTemp]);
|
|
|
+
|
|
|
+ // 创建人 的 值
|
|
|
+ const [creatorIdValue, setCreatorIdValue] = useState(userInfo.id);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ console.log("---------", creatorIdValue);
|
|
|
+ }, [creatorIdValue]);
|
|
|
|
|
|
return (
|
|
|
<div className={styles.A1Add}>
|
|
@@ -140,7 +168,8 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
onFinishFailed={onFinishFailed}
|
|
|
autoComplete="off"
|
|
|
initialValues={{
|
|
|
- snapPmUser: userInfo.realName
|
|
|
+ snapPmUser: userInfo.realName,
|
|
|
+ creatorId: userInfo.id,
|
|
|
}}
|
|
|
>
|
|
|
<Form.Item
|
|
@@ -214,10 +243,7 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
|
|
|
- <Form.Item
|
|
|
- label="项目经理"
|
|
|
- name="snapPmUser"
|
|
|
- >
|
|
|
+ <Form.Item label="项目经理" name="snapPmUser">
|
|
|
<Input
|
|
|
style={{ width: 600 }}
|
|
|
maxLength={30}
|
|
@@ -228,10 +254,7 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
|
|
|
- <Form.Item
|
|
|
- label="商务经理"
|
|
|
- name="snapBmUser"
|
|
|
- >
|
|
|
+ <Form.Item label="商务经理" name="snapBmUser">
|
|
|
<Input
|
|
|
style={{ width: 600 }}
|
|
|
maxLength={30}
|
|
@@ -299,9 +322,37 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
</Form.Item>
|
|
|
)}
|
|
|
|
|
|
+ {/* 新加的项目 创建人 */}
|
|
|
+ <Form.Item
|
|
|
+ label="创建人"
|
|
|
+ name="creatorId"
|
|
|
+ rules={[{ required: true, message: "请选择创建人!" }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ value={creatorIdValue}
|
|
|
+ onChange={(e) => setCreatorIdValue(e)}
|
|
|
+ placeholder={
|
|
|
+ isOk ? (pageType.txt === "look" ? "(空)" : "请选择") : ""
|
|
|
+ }
|
|
|
+ style={{ width: 300 }}
|
|
|
+ options={userList}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ {pageType.txt === "look" ? null : (
|
|
|
+ <div
|
|
|
+ className={classNames(
|
|
|
+ "A1AtitTxt",
|
|
|
+ creatorIdValue !== userInfo.id ? "A1AtitTxtShow" : ""
|
|
|
+ )}
|
|
|
+ >
|
|
|
+ 创建人与当前用户不一致,请谨慎选择
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+
|
|
|
{/* 确定和取消按钮 */}
|
|
|
<div className="A1AddBtn">
|
|
|
- {pageType.txt === "look" ? null : ( // <Button onClick={closeFu}>关 闭</Button>
|
|
|
+ {pageType.txt === "look" ? null : (
|
|
|
<>
|
|
|
<Popconfirm
|
|
|
title="放弃编辑后,信息将不会保存!"
|
|
@@ -312,7 +363,8 @@ function A1Add({ pageType, closeFu, addFu, editFu }: Props) {
|
|
|
>
|
|
|
<Button>取消</Button>
|
|
|
</Popconfirm>{" "}
|
|
|
-   
|
|
|
+ <br />
|
|
|
+ <br />
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
保存
|
|
|
</Button>
|