Przeglądaj źródła

bug fix:项目管理页 项目文件视图和内控文件视图之间切换功能 对接接口
等等

任一存 1 rok temu
rodzic
commit
071898fd68
2 zmienionych plików z 92 dodań i 83 usunięć
  1. 91 82
      src/pages/A1Project/index.tsx
  2. 1 1
      src/utils/http.ts

+ 91 - 82
src/pages/A1Project/index.tsx

@@ -37,8 +37,8 @@ function A1Project() {
     (state: RootState) => state.A2Dict.A2Tab1_1Obj.status
   );
 
-  // 顶部的试图切换
-  const [topType, setTopType] = useState<"outer" | "inner">("outer");
+  // 顶部的试图切换。item: 项目文件视图,inside: 内控文件视图
+  const [topType, setTopType] = useState<"item" | "inside">("item");
 
   // 表单数据
   const [fromData, setFromData] = useState({
@@ -50,7 +50,7 @@ function A1Project() {
     projectRole: "",
     pageNum: 1,
     pageSize: 10,
-    type: "inside",
+    type: "item",
     dictProjectBusinessIds: '', // 业务类型id
     dictProjectScopeIds: '', // 项目范围id
     dictProjectAppIds: '', // 客户端id
@@ -89,6 +89,9 @@ function A1Project() {
   const resetSelectFu = useCallback(() => {
     // 把2个输入框和时间选择器清空
     setInputKey(Date.now());
+    setCheckedProjectBusinessArr([])
+    setCheckedProjectScopeArr([])
+    setCheckedProjectAppArr([])
     setFromData({
       searchKey: "",
       pmName: "",
@@ -98,29 +101,33 @@ function A1Project() {
       projectRole: "",
       pageNum: 1,
       pageSize: 10,
-      type: "inside",
+      type: topType,
       dictProjectBusinessIds: '', // 业务类型id
       dictProjectScopeIds: '', // 项目范围id
       dictProjectAppIds: '', // 客户端id
     });
-  }, []);
+  }, [topType]);
 
   // 点击顶部的切换视图 按钮
   const topTypeFu = useCallback(
-    (val: "outer" | "inner") => {
+    (val: "item" | "inside") => {
       if (topType === val) return;
       setTopType(val);
-      resetSelectFu();
     },
-    [resetSelectFu, topType]
+    [topType]
   );
 
+  // 当 topType 改变时,重置筛选条件
+  useEffect(() => {
+    resetSelectFu();
+  }, [topType, resetSelectFu]); 
+
   // 权限-------项目视图 和 内控文件视图
   const authArr = useSelector((state: RootState) => state.A4Role.A4RoleAll);
 
   useEffect(() => {
     // 没有项目文件视图权限,一定有内控文件视图权限
-    if (!authArr.includes("1010")) setTopType("inner");
+    if (!authArr.includes("1010")) setTopType("inside");
   }, [authArr]);
 
   // 从仓库获取表格数据
@@ -374,7 +381,7 @@ function A1Project() {
       },
     ];
 
-    if (topType === "inner") {
+    if (topType === "inside") {
       arr.push(
         {
           title: "收集文件类型",
@@ -427,7 +434,7 @@ function A1Project() {
           >
             查看
           </Button>
-          {topType === "inner" ? (
+          {topType === "inside" ? (
             <>
               <AuthCom aId="1104">
                 <Button
@@ -515,8 +522,8 @@ function A1Project() {
           <div className="A1SearchRow" hidden={isOneTopType}>
             <AuthCom aId="1010">
               <Button
-                onClick={() => topTypeFu("outer")}
-                type={topType === "outer" ? "primary" : "default"}
+                onClick={() => topTypeFu("item")}
+                type={topType === "item" ? "primary" : "default"}
               >
                 项目文件视图
               </Button>
@@ -524,8 +531,8 @@ function A1Project() {
 
             <AuthCom aId="1020">
               <Button
-                onClick={() => topTypeFu("inner")}
-                type={topType === "inner" ? "primary" : "default"}
+                onClick={() => topTypeFu("inside")}
+                type={topType === "inside" ? "primary" : "default"}
               >
                 内控文件视图
               </Button>
@@ -584,75 +591,77 @@ function A1Project() {
             />
           </div>
 
-          <div className="A1SearchRow">
-            <span>项目类型:</span>
-            <Popover
-              trigger="click"
-              placement="bottomLeft"
-              content={
-                <div className={styles.projectTypePopOver}>
-                  <div className={styles.row}>
-                    <span className={styles.title} title="甲方的业务类型">业务类型:</span>
-                    <Checkbox
-                      indeterminate={isProjectBusinessPartiallyChecked}
-                      onChange={onProjectBusinessCheckAllChange}
-                      checked={isProjectBusinessAllChecked}
-                      className={styles.selectAll}
-                    >
-                      全选
-                    </Checkbox>
-                    <Checkbox.Group
-                      options={projectBusinessArrForCheckbox}
-                      value={checkedProjectBusinessArr}
-                      onChange={onProjectBusinessNormalCheckboxChange}
-                    />
-                  </div>
-
-                  <div className={styles.row}>
-                    <span className={styles.title} title="项目的建设范围">项目范围:</span>
-                    <Checkbox
-                      indeterminate={isProjectScopePartiallyChecked}
-                      onChange={onProjectScopeCheckAllChange}
-                      checked={isProjectScopeAllChecked}
-                      className={styles.selectAll}
-                    >
-                      全选
-                    </Checkbox>
-                    <Checkbox.Group
-                      options={projectScopeArrForCheckbox}
-                      value={checkedProjectScopeArr}
-                      onChange={onProjectScopeNormalCheckboxChange}
-                    />
-                  </div>
-
-                  <div className={styles.row}>
-                    <span className={styles.title} title="项目成果的呈现载体">客户端:</span>
-                    <Checkbox
-                      indeterminate={isProjectAppPartiallyChecked}
-                      onChange={onProjectAppCheckAllChange}
-                      checked={isProjectAppAllChecked}
-                      className={styles.selectAll}
-                    >
-                      全选
-                    </Checkbox>
-                    <Checkbox.Group
-                      options={projectAppArrForCheckbox}
-                      value={checkedProjectAppArr}
-                      onChange={onProjectAppNormalCheckboxChange}
-                    />
+          {topType === "item" ? (
+            <div className="A1SearchRow">
+              <span>项目类型:</span>
+              <Popover
+                trigger="click"
+                placement="bottomLeft"
+                content={
+                  <div className={styles.projectTypePopOver}>
+                    <div className={styles.row}>
+                      <span className={styles.title} title="甲方的业务类型">业务类型:</span>
+                      <Checkbox
+                        indeterminate={isProjectBusinessPartiallyChecked}
+                        onChange={onProjectBusinessCheckAllChange}
+                        checked={isProjectBusinessAllChecked}
+                        className={styles.selectAll}
+                      >
+                        全选
+                      </Checkbox>
+                      <Checkbox.Group
+                        options={projectBusinessArrForCheckbox}
+                        value={checkedProjectBusinessArr}
+                        onChange={onProjectBusinessNormalCheckboxChange}
+                      />
+                    </div>
+
+                    <div className={styles.row}>
+                      <span className={styles.title} title="项目的建设范围">项目范围:</span>
+                      <Checkbox
+                        indeterminate={isProjectScopePartiallyChecked}
+                        onChange={onProjectScopeCheckAllChange}
+                        checked={isProjectScopeAllChecked}
+                        className={styles.selectAll}
+                      >
+                        全选
+                      </Checkbox>
+                      <Checkbox.Group
+                        options={projectScopeArrForCheckbox}
+                        value={checkedProjectScopeArr}
+                        onChange={onProjectScopeNormalCheckboxChange}
+                      />
+                    </div>
+
+                    <div className={styles.row}>
+                      <span className={styles.title} title="项目成果的呈现载体">客户端:</span>
+                      <Checkbox
+                        indeterminate={isProjectAppPartiallyChecked}
+                        onChange={onProjectAppCheckAllChange}
+                        checked={isProjectAppAllChecked}
+                        className={styles.selectAll}
+                      >
+                        全选
+                      </Checkbox>
+                      <Checkbox.Group
+                        options={projectAppArrForCheckbox}
+                        value={checkedProjectAppArr}
+                        onChange={onProjectAppNormalCheckboxChange}
+                      />
+                    </div>
                   </div>
-                </div>
-              }
-            >
-              <Button className="projectTypeFilterButton">
-                {projectTypeCurrentText}
-                <DownOutlined />
-              </Button>
-            </Popover>
-          </div>
-
+                }
+              >
+                <Button className="projectTypeFilterButton">
+                  {projectTypeCurrentText}
+                  <DownOutlined />
+                </Button>
+              </Popover>
+            </div>
+          ) : null}
+          
           {/* 通过顶部状态 动态渲染 这3个下拉框 */}
-          {topType === "outer" ? null : (
+          {topType === "item" ? null : (
             <>
               <div className="A1SearchRow">
                 <span>是否存在待审批文件:</span>

+ 1 - 1
src/utils/http.ts

@@ -8,7 +8,7 @@ import { domShowFu } from "./domShow";
 export const baseURL =
   // 线下的图片地址需要加上/api/
   // process.env.NODE_ENV === "development"
-  //   ? "http://192.168.20.61:8054/api/"
+  //   ? "http://192.168.20.61:8054"
   //   : "";
   process.env.NODE_ENV === "development"
     ? "https://sit-projectfile.4dage.com"