Browse Source

Squashed commit of the following:
解决冲突
commit 1a470f4635675e68aa40084af49ebd0bb53aa834
Author: Renxy <18510891294@163.com>
Date: Fri Dec 22 17:53:25 2023 +0800

替换lucksheet

commit 4b3ee993f354859f77cce231976ccc20b45a9f8f
Author: Renxy <18510891294@163.com>
Date: Fri Dec 22 15:50:13 2023 +0800

cad评论功能

commit 211b58120cca483190e9ab1e54d28f2a302dd37d
Author: Renxy <18510891294@163.com>
Date: Thu Dec 21 09:57:09 2023 +0800

cad评论

commit a43d8aa0debc6cb8c00d302ef4abab818401b94d
Author: Renxy <18510891294@163.com>
Date: Mon Dec 18 11:40:34 2023 +0800

替换ws地址

commit 889553ca4a6fc9d9a95a59e0d095ce1a69df03a1
Author: Renxy <18510891294@163.com>
Date: Mon Dec 18 11:21:11 2023 +0800

修改cad ws地址

commit d9435420779e49c4d7362f81ba564d6c6136fcc2
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 17:34:24 2023 +0800

修改bug

commit 8dcd6fc3fe2bf4fe830c51e2b5a8c24380d286c5
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 16:54:31 2023 +0800

Squashed commit of the following:
merge
commit 268df583cd9a3da2590d6bc3474c2c6539d51a84
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 16:54:09 2023 +0800

修改项目接口

commit e52c9a5f2d65695e78b62ef288bde6b67845c9b3
Merge: bc4916b 949eef2
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 15:55:35 2023 +0800

Merge branch 'master' into develop
解决冲突
# Conflicts:
# src/pages/Cad/components/CadOADetail.js

commit bc4916bbb2c50bcc02a1468dc6992fc248e92ca9
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 15:12:37 2023 +0800

修改url

commit 04540d19c6cdd277570ff1d3c72e0d1678d915d3
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 15:06:47 2023 +0800

修改url

commit b633368b1438411d08ec3ed2c79ceb0df8caff8c
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 14:51:08 2023 +0800

Squashed commit of the following:
merge
commit 67c1c249be25266e723c85d0528c4a763faa9cd7
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 14:49:14 2023 +0800

修改路由

commit 15967b6a4cf9296166be9d7db40292a111b1b18d
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 14:25:48 2023 +0800

修改域名

commit ba0dd0d66eea0b451a292c64480cfa31ef2c2fa5
Author: Renxy <18510891294@163.com>
Date: Thu Dec 14 09:22:21 2023 +0800

Squashed commit of the following:
cad
commit 8957b0fefd2d65de8b96e307bb7f8826fa9bef0a
Author: Renxy <18510891294@163.com>
Date: Wed Dec 13 09:58:52 2023 +0800

上传图纸添加path字段

commit 7ee0e51cbd578e252205b76f30dc99a08bd1b3d2
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 17:34:30 2023 +0800

修改bug

commit 44539389d68a26a8e5484d403694d8d1ccd30093
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 17:02:44 2023 +0800

修改bug

commit b4798de286df4e15cd179483a1595282e48b468f
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 16:36:31 2023 +0800

修改cadbug

commit 4851121dc2c2ccf4d409c19ec46ec768e6494a67
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 14:13:24 2023 +0800

创建子审批

commit b8e82187be7101126ec928b3c5fb6579faa8ee5e
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 17:16:32 2023 +0800

update

commit 7ac00c0961f3fe94597ce02eb58334ec227d0ecc
Merge: b2ba74b 879f068
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 16:17:58 2023 +0800

Merge branch 'cad' into develop
解决冲突
# Conflicts:
# src/pages/Home/index.js

commit 879f068f14d5e4fa58cb677a86a7b27021247882
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 16:15:05 2023 +0800

修改cad修改antd前缀

commit a63c9413d969e359e621ff32ccb5246b0e574416
Author: Renxy <18510891294@163.com>
Date: Thu Dec 7 17:48:01 2023 +0800

cad审批

# Conflicts:
# src/pages/Cad/components/CreateChildrenModal.js
# src/pages/Cad/components/CreateModal.js

commit 8957b0fefd2d65de8b96e307bb7f8826fa9bef0a
Author: Renxy <18510891294@163.com>
Date: Wed Dec 13 09:58:52 2023 +0800

上传图纸添加path字段

commit 7ee0e51cbd578e252205b76f30dc99a08bd1b3d2
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 17:34:30 2023 +0800

修改bug

commit 44539389d68a26a8e5484d403694d8d1ccd30093
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 17:02:44 2023 +0800

修改bug

commit b4798de286df4e15cd179483a1595282e48b468f
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 16:36:31 2023 +0800

修改cadbug

commit 4851121dc2c2ccf4d409c19ec46ec768e6494a67
Author: Renxy <18510891294@163.com>
Date: Tue Dec 12 14:13:24 2023 +0800

创建子审批

commit b8e82187be7101126ec928b3c5fb6579faa8ee5e
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 17:16:32 2023 +0800

update

commit 7ac00c0961f3fe94597ce02eb58334ec227d0ecc
Merge: b2ba74b 879f068
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 16:17:58 2023 +0800

Merge branch 'cad' into develop
解决冲突
# Conflicts:
# src/pages/Home/index.js

commit 879f068f14d5e4fa58cb677a86a7b27021247882
Author: Renxy <18510891294@163.com>
Date: Mon Dec 11 16:15:05 2023 +0800

修改cad修改antd前缀

commit a63c9413d969e359e621ff32ccb5246b0e574416
Author: Renxy <18510891294@163.com>
Date: Thu Dec 7 17:48:01 2023 +0800

cad审批

# Conflicts:
# src/pages/Cad/detail.js
# src/pages/Cad/index.js

Renxy 1 năm trước cách đây
mục cha
commit
6c6d0a5c9d

+ 1 - 0
package.json

@@ -20,6 +20,7 @@
     "exceljs": "^4.3.0",
     "file-saver": "^2.0.5",
     "luckyexcel": "^1.0.1",
+    "md5": "^2.3.0",
     "moment": "^2.29.4",
     "qs": "^6.11.1",
     "react-file-viewer": "^1.2.1",

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
public/Luckysheet/luckysheet.umd.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
public/Luckysheet/luckysheet.umd.js.map


+ 240 - 7
src/pages/Cad/detail.js

@@ -1,31 +1,264 @@
-import { useRef, useEffect } from 'react';
+import { useRef, useEffect, useMemo } from 'react';
 import PageContent from '@/components/PageContent';
-import { useLocation, useNavigate } from '@umijs/max';
+import { useLocation, useNavigate, useRequest } from '@umijs/max';
+import { Button, message } from 'antd';
+import md5 from 'md5';
+import {
+  queryCadCommitCreate,
+  queryCadCommitDel,
+  queryCadCommitList,
+} from '../../services/cad';
+import moment from 'moment';
 
 const CadDeTail = () => {
+  const navigate = useNavigate();
   const cadRef = useRef();
   const location = useLocation();
   const {
-    state: { path },
+    state: { path, user = {}, project_id },
   } = location;
 
-  console.log('-----path-------', path);
+  //当前登录的用户信息
+  let currentUser = {
+    userId: user.ID,
+    userName: user.CName,
+    phone: user.Mobile,
+    email: user.Email,
+    description: '',
+    type: 'FREE',
+  };
+  const doc_id = useMemo(() => md5(path), [path]);
+
+  //添加、编辑评论
+  const { run: runAdd, loading: loadingAdd } = useRequest(
+    queryCadCommitCreate,
+    {
+      manual: true,
+      onSuccess: (data) => {
+        message.success('新建成功');
+        setCommitList(data);
+      },
+    },
+  );
+  //删除评论
+  const { run: runDel, loading: loadingDel } = useRequest(queryCadCommitDel, {
+    manual: true,
+    onSuccess: (data) => {
+      message.success('删除成功');
+      run();
+    },
+  });
+  //请求评论列表
+  const { run: run, loading } = useRequest(
+    () => queryCadCommitList({ doc_id }),
+    {
+      manual: true,
+      onSuccess: (data) => {
+        setCommitList(data);
+      },
+    },
+  );
+
+  // let commentList = {
+  //   msg: '操作成功',
+  //   code: 0,
+  //   data: {
+  //     total: 2,
+  //     rows: [
+  //       {
+  //         createBy: 1317,
+  //         creator: '皮卡丘',
+  //         createTime: 1672040045000,
+  //         id: '1737299871415943168',
+  //         docId: '1703039467897',
+  //         handleId: '34',
+  //         parentId: '0',
+  //         level: 0,
+  //         withAt: 'NO',
+  //         withMark: 'NO',
+  //         content: '###梵蒂冈梵蒂冈发的',
+  //         mark: '',
+  //         replyList: [],
+  //       },
+  //       {
+  //         createBy: 1317,
+  //         creator: '柯南',
+  //         createTime: 1672040002000,
+  //         id: '1737299871415943169',
+  //         docId: '1703039467897',
+  //         handleId: '34',
+  //         parentId: '1737299871415943168',
+  //         level: 0,
+  //         withAt: 'NO',
+  //         withMark: 'YES',
+  //         content: '对符合法规和法国###',
+  //         mark: '[{"id":"7a4f4b9f-992d-15ef-9b17-7ca8abe833df","pt":[532.2265851288126,664.973293757502,0],"color":"red","type":0},{"id":"8bac4935-2e0b-444c-212e-bfca607c4f8e","points":[614.8609930415427,634.9244181528729,0,813.1835720320946,678.495287779585,0,834.217784955335,418.5725137995435,0,811.6811282518631,329.9283307658877,0],"color":"red","type":3},{"id":"a664f1ab-359b-87a0-7db9-f758e0e9e958","center":[294.8404678522429,338.9429934472764,0],"endPt":[365.45532552312125,275.84035467755535,0],"color":"cyan","type":1}]',
+  //         replyList: [],
+  //       },
+  //     ],
+  //   },
+  // };
+  //设置群组成员列表,作为@用户列表供用户选择
+  let memberList = {
+    msg: '操作成功',
+    code: 0,
+    data: {
+      total: 2,
+      rows: [
+        // {
+        //   memberId: '2138',
+        //   phone: '',
+        //   email: '',
+        //   memberName: '何为',
+        //   memberType: 'USER',
+        //   lastTime: 1672039449000,
+        //   roleId: '1607272382833942531',
+        //   roleName: '查看者',
+        //   color: '#87CEFA',
+        // },
+        // {
+        //   memberId: '1317',
+        //   phone: '',
+        //   email: '',
+        //   memberName: '柯南',
+        //   memberType: 'PROJECT_ADMIN',
+        //   lastTime: 1672038572000,
+        //   roleId: '1607272382833942528',
+        //   roleName: '管理员',
+        //   color: '#87CEFA',
+        // },
+      ],
+    },
+  };
 
   useEffect(() => {
     const content = document.getElementById('container');
     ZwCloud2D.ZwEditor.ZwInit(content);
-
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
       'https://cad.greentech.com.cn',
-      'ws://47.111.24.13:5121',
+      'wss://cad.greentech.com.cn:5121',
       'https://cad.greentech.com.cn',
     );
+    //加载图纸
     ZwCloud2D.ZwDataProcessor.ZwSetLoadDwg(path);
     ZwCloud2D.ZwDataProcessor.ZwLoad();
+    //请求评论内容并注入cad评论列表
+    setTimeout(() => {
+      run();
+    }, 1000);
+
+    //拦截cad评论面板方法,调用后端接口处理
+    ZwCloud2D.ZwMessageCallback.ZwEvtUpdateCommentData = function (data) {
+      console.log('------------------', data);
+      switch (data.type) {
+        case 'create':
+          // 补充data.data中缺失的参数,保存新增的评论数据\
+          const paramsAdd = {
+            id: 0,
+            project_id,
+            user_name: user.CName,
+            content: data.data.content,
+            doc_id,
+            parent_id: 0,
+          };
+          runAdd(paramsAdd);
+          break;
+        case 'reply':
+          const paramsReply = {
+            project_id,
+            user_name: user.CName,
+            content: data.data.content,
+            doc_id,
+            parent_id: data.data.parentId,
+          };
+          runAdd(paramsReply);
+          break;
+        case 'delete':
+          // 删除评论数据
+          const paramsDel = {
+            project_id,
+            id: data.data.id,
+          };
+          runDel(paramsDel);
+          break;
+        case 'edit':
+          // 编辑评论数据
+          const paramsEdit = {
+            project_id,
+            id: data.data.id,
+            user_name: user.CName,
+            content: data.data.content,
+            doc_id,
+            parent_id: 0,
+          };
+          runAdd(paramsEdit);
+          break;
+        default:
+          break;
+      }
+    };
   }, []);
+
+  const getRows = (list) => {
+    return list.map((item) => {
+      const {
+        user_id,
+        user_name,
+        id,
+        parent_id = 0,
+        content,
+        create_time,
+        children,
+      } = item;
+      return {
+        createBy: user_id,
+        creator: user_name,
+        createTime: moment(create_time).valueOf(),
+        id: id,
+        docId: path,
+        handleId: '34',
+        parentId: parent_id,
+        level: 0,
+        withAt: 'NO',
+        withMark: 'NO',
+        content,
+        mark: '',
+        replyList: children ? getRows(children) : [],
+      };
+    });
+  };
+
+  const setCommitList = (data) => {
+    const resultData = {
+      total: data.all_count,
+      rows: [],
+    };
+    resultData.rows = getRows(data.list);
+    //注入评论列表、用户列表(目前为空), 个人信息
+    ZwCloud2D.ZwDataManager.ZwSetCommentData({
+      commentList: { msg: '操作成功', code: 0, data: resultData },
+      memberList: memberList,
+      user: currentUser,
+    });
+  };
+
+  const handleBackClick = () => {
+    navigate(-1);
+  };
+
   return (
     <PageContent>
-      <div>CAD在线审批</div>
+      <div style={{ fontSize: '20px', marginBottom: '10px' }}>
+        CAD在线审批
+        <Button
+          type="primary"
+          style={{ float: 'right' }}
+          onClick={handleBackClick}
+        >
+          返回
+        </Button>
+      </div>
+
       <div
         id="container"
         style={{ width: '100%', height: '80vh' }}

+ 13 - 4
src/pages/Cad/index.js

@@ -6,7 +6,7 @@ import {
   queryCreateCad,
   queryProject,
 } from '@/services/cad';
-import { useRequest, useNavigate } from '@umijs/max';
+import { useRequest, useNavigate, useModel } from '@umijs/max';
 import { Table, Button, message, Space, Select, Input } from 'antd';
 import CreateModal from './components/CreateModal';
 import { createAduit } from '@/services/boom';
@@ -15,6 +15,8 @@ import { queryCreateCadVer } from '../../services/cad';
 import { queryApprovalProject } from '@/services/contract';
 
 const CadDemo = () => {
+  const { initialState } = useModel('@@initialState');
+  const user = initialState?.user || {};
   let navigate = useNavigate();
   const [createLoading, setCreateLoading] = useState(false);
   const [visible, setVisible] = useState(false);
@@ -77,7 +79,9 @@ const CadDemo = () => {
                 onClick={() =>
                   navigate('/cad/detail', {
                     state: {
+                      user,
                       path: record.path,
+                      project_id: record.project_id,
                     },
                   })
                 }
@@ -104,7 +108,10 @@ const CadDemo = () => {
   const { data: projectList } = useRequest(queryApprovalProject, {
     formatResult: (res) => {
       return res?.data?.map((item) => {
-        return { label: item.project_name, value: item.project_full_code };
+        return {
+          label: `${item.project_name}(${item.project_full_code})`,
+          value: item.id,
+        };
       });
     },
   });
@@ -121,6 +128,7 @@ const CadDemo = () => {
     defaultParams: [params],
     formatResult: (res) => {
       res.data?.list?.forEach((item) => {
+        const project_id = item.project_id;
         item.children?.forEach((cur) => {
           cur.name = item.name + cur.version;
           item.showCreate = cur.cad_status == 2 ? true : false;
@@ -130,9 +138,10 @@ const CadDemo = () => {
               const names = item.split('/');
               const name = names?.length > 1 ? names[1] : names[0];
               return {
-                name: name,
+                name,
                 path: item,
                 canShow: true,
+                project_id,
                 parent_id: cur.parent_id,
               };
             });
@@ -189,7 +198,7 @@ const CadDemo = () => {
   useEffect(() => {
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
       'https://cad.greentech.com.cn', //47.111.24.13
-      'ws://47.111.24.13:5121',
+      'wss://cad.greentech.com.cn:5121',
       'https://cad.greentech.com.cn',
     );
   }, []);

+ 5 - 2
src/pages/PSRManage/detail.js

@@ -368,7 +368,7 @@ const PSRDetail = () => {
         setExcelData({ ...data, name });
         setHistoryOpen(false);
         const jsonData = JSON.parse(data.json_data);
-        console.log(jsonData);
+        console.log(data);
 
         jsonData.map((item) => {
           if (item.celldata && typeof item.celldata == 'string')
@@ -467,6 +467,8 @@ const PSRDetail = () => {
       if (res.data[0].ver_type == 1) name = '原始版本';
       if (res.data[0].ver_type == 2) name = '基础版本';
 
+      console.log('------------------', res.data);
+
       const isOrigin = res.data[0].ver_type == 1 ? 1 : 0;
       setIsOriginVer(isOrigin);
       setExcelData({ ...res.data[0], name });
@@ -518,6 +520,7 @@ const PSRDetail = () => {
         json_data: JSON.stringify(luckyData.data),
         data_type: data_type,
       };
+      console.log(params);
       runSaveOther(params);
     }
   };
@@ -554,7 +557,7 @@ const PSRDetail = () => {
       psr_json_data: JSON.stringify(allData),
     };
     console.log(params);
-    runSave(params);
+    // runSave(params);
   };
 
   //获取当月发生额的月份

+ 40 - 0
src/services/cad.js

@@ -44,3 +44,43 @@ export async function queryCadDirList(data) {
     data,
   });
 }
+
+/**
+ * 添加评论
+ * @param {*} user_name
+ * @param {*} project_id
+ * @param {*} content
+ * @param {*} doc_id
+ * @param {*} parent_id
+ * @returns
+ */
+export async function queryCadCommitCreate(data) {
+  return request(`/api/archive/v1/cad/comment/create`, {
+    method: 'POST',
+    data,
+  });
+}
+
+/**
+ * 评论列表
+ * @param {*} doc_id
+ * @returns
+ */
+export async function queryCadCommitList(data) {
+  return request(`/api/archive/v1/cad/comment/list`, {
+    method: 'POST',
+    data,
+  });
+}
+/**
+ * 删除评论
+ * @param {*} project_id
+ * @param {*} id
+ * @returns
+ */
+export async function queryCadCommitDel(data) {
+  return request(`/api/archive/v1/cad/comment/del`, {
+    method: 'POST',
+    data,
+  });
+}

+ 24 - 0
yarn.lock

@@ -3895,6 +3895,11 @@ chalk@^4.0.0, chalk@^4.1.2:
     ansi-styles "^4.1.0"
     supports-color "^7.1.0"
 
+charenc@0.0.2:
+  version "0.0.2"
+  resolved "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
+  integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==
+
 chokidar@3.5.3, chokidar@^3.4.0, chokidar@^3.5.3:
   version "3.5.3"
   resolved "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
@@ -4256,6 +4261,11 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3:
     shebang-command "^2.0.0"
     which "^2.0.1"
 
+crypt@0.0.2:
+  version "0.0.2"
+  resolved "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
+  integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==
+
 crypto-browserify@^3.11.0:
   version "3.12.0"
   resolved "https://registry.npmmirror.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
@@ -6039,6 +6049,11 @@ is-boolean-object@^1.1.0, is-boolean-object@^1.1.2:
     call-bind "^1.0.2"
     has-tostringtag "^1.0.0"
 
+is-buffer@~1.1.6:
+  version "1.1.6"
+  resolved "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
+  integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
+
 is-callable@^1.0.4, is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.4, is-callable@^1.2.7:
   version "1.2.7"
   resolved "https://registry.npmmirror.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
@@ -6944,6 +6959,15 @@ md5.js@^1.3.4:
     inherits "^2.0.1"
     safe-buffer "^5.1.2"
 
+md5@^2.3.0:
+  version "2.3.0"
+  resolved "https://registry.npmmirror.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
+  integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==
+  dependencies:
+    charenc "0.0.2"
+    crypt "0.0.2"
+    is-buffer "~1.1.6"
+
 mdn-data@2.0.14:
   version "2.0.14"
   resolved "https://registry.npmmirror.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50"

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác