Browse Source

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审批

Renxy 1 year ago
parent
commit
ba0dd0d66e

+ 5 - 6
.umirc.ts

@@ -39,11 +39,11 @@ export default defineConfig({
   //   { src: '/ZwCloud2DSDK/ZwWasmJs.js' },
   //   { src: '/ZwCloud2DSDK/ZwCloud2DAPI.js' },
   // ],
-  // headScripts: [
-  //   `${publicPath}ZwCloud2DSDK/ZwCloud2D.js`,
-  //   `${publicPath}ZwCloud2DSDK/ZwWasmJs.js`,
-  //   `${publicPath}ZwCloud2DSDK/ZwCloud2DPrivateAPI.js`,
-  // ],
+  headScripts: [
+    `${publicPath}ZwCloud2DSDK/ZwCloud2D.js`,
+    `${publicPath}ZwCloud2DSDK/ZwWasmJs.js`,
+    `${publicPath}ZwCloud2DSDK/ZwCloud2DPrivateAPI.js`,
+  ],
   proxy: {
     '/api': {
       // target: 'http://192.168.20.232:1007/',
@@ -177,7 +177,6 @@ export default defineConfig({
       name: 'CAD实例',
       path: '/cad',
       component: './Cad',
-      hideInMenu: true,
       icon: 'https://water-service-test.oss-cn-hangzhou.aliyuncs.com/doc/contract/2023-07-31/3f72fccf-4f9c-4891-a6ec-f04fe4b1d9a2.png',
     },
     {

File diff suppressed because it is too large
+ 0 - 0
public/ZwCloud2DSDK/ZwCloud2D.js


+ 1050 - 265
public/ZwCloud2DSDK/ZwCloud2DPrivateAPI.js

@@ -1,7 +1,69 @@
 let baseUrl = 'http://192.168.51.174:5199';
 let wsUrl = '';
 let dwgPath = '';
+let docId = '';
 let javaUrl = '';
+let curHandleId = '';
+// 用户自定义:成员列表,用于评论图纸时@人员,其中memberId和memberName字段名称不能修改
+let memberList = {
+  code: 0,
+  data: {
+    rows: [
+      {
+        memberId: '12',
+        memberName: '张三',
+        email: '',
+        phone: '',
+        role: '',
+        avatarUrl: '/assets/ZwCloud2DSDK/text.png',
+      },
+      {
+        memberId: '32',
+        memberName: '李四',
+        email: '',
+        phone: '',
+        role: '',
+        avatarUrl: '/assets/ZwCloud2DSDK/image1.png',
+      },
+      {
+        memberId: '34',
+        memberName: '王五',
+        email: '',
+        phone: '',
+        role: '',
+        avatarUrl: '/assets/ZwCloud2DSDK/image2.png',
+      },
+    ],
+  },
+};
+// 用户自定义:当前用户,指定当前评论图纸的用户,其中userId和userName字段名称不能修改
+let user = {
+  userId: '12',
+  userName: '张三',
+  email: '',
+  phone: '',
+  role: '',
+};
+
+let req = null;
+
+let sourcePath = '';
+let compareFilePath = '';
+
+const enableSign = false;
+
+const signBlockOper = {
+  GetBlockData: 0,
+  UploadSign: 1,
+  UploadCert: 2,
+  UploadDwg: 3,
+  ConFirmEdit: 4,
+};
+
+const refType = {
+  plotMsg: 1,
+  signaturePic: 2,
+};
 
 class Request {
   constructor() {}
@@ -31,6 +93,14 @@ class Request {
           }
         }
       };
+      ajax.onreadystatechange = function () {
+        if (ajax.readyState === 4 && ajax.status !== 200) {
+          rej(ajax.status);
+        }
+      };
+      ajax.onerror = function (error) {
+        rej(error);
+      };
     });
   }
 
@@ -49,10 +119,13 @@ class Request {
           if (ajax.status === 200) {
             res(ajax.response);
           } else {
-            rej();
+            rej(ajax.status);
           }
         }
       };
+      ajax.onerror = function (error) {
+        rej(error);
+      };
     });
   }
 
@@ -70,18 +143,56 @@ class Request {
     return this.get('/sdk/font/download', { fontName }, 'blob');
   }
 
-  transferDoc() {
-    return this.get('/sdk/transfer', {
-      projectId: 0,
-      dwgPath: dwgPath,
-      type: 1,
+  transferDoc(dwgPath) {
+    if (enableSign) {
+      return this.transferDocV2();
+    }
+    return this.get('/sdk/transfer', { projectId: 0, dwgPath: dwgPath });
+  }
+
+  transferDocV2() {
+    // {
+    //     "dwgPath": "sdk-014_rotate.dwg",
+    // "useCache": false,
+    // "showBlock": true,
+    // "search": {
+    //   "blockPre": "",
+    //   "attrSignSuf": "_机打信息",
+    //   "attrImageSuf": "_签章图",
+    //   "officialSignSuf": "_公章"
+    // }
+    //   }
+    let useCache = getParams('useCache');
+    if (useCache === 'false') {
+      useCache = false;
+    } else {
+      useCache = true;
+    }
+    return this.post(
+      '/sdk/v2/transfer',
+      JSON.stringify({
+        dwgPath: dwgPath,
+        useCache: useCache,
+        showBlock: true,
+        search: {
+          blockPre: getParams('blockPre') || '标准图框_',
+          attrSignSuf: getParams('attrSignSuf') || '_机打信息',
+          // attrImageSuf: "_签章图",
+          officialSignSuf: getParams('officialSignSuf') || '_签章图',
+          dwgSignSuf: '_DWG签名',
+        },
+      }),
+    ).then((res) => {
+      let { code, data } = JSON.parse(res);
+      if (code === 0) return data;
     });
   }
 
   getDisplayData(handleId = 34) {
+    //电子签章中下载lmf不使用缓存, 正常开图下载lmf优先使用缓存
     return this.get(
       '/sdk/layout/lmf',
-      { projectId: 0, handleId, dwgPath: dwgPath },
+      { handleId, dwgPath: dwgPath, useCache: !enableSign },
       'arraybuffer',
     );
   }
@@ -92,7 +203,7 @@ class Request {
     return this.post('/sdk/xref', params, 'arraybuffer');
   }
 
-  getXrefRelation() {
+  getXrefRelation(dwgPath) {
     return this.get('/sdk/xref/list', { dwgPath: dwgPath });
   }
 
@@ -110,6 +221,14 @@ class Request {
     let data = JSON.stringify(params);
     return this.post('/sdk/print', data, 'arraybuffer');
   }
+  getSignPlotData(params) {
+    let data = JSON.stringify(params);
+    return this.post('/sdk/api/print', data, 'arraybuffer');
+  }
+  getSignBatchPlotData(params) {
+    let data = JSON.stringify(params);
+    return this.post('/sdk/api/batchPrint', data, 'arraybuffer');
+  }
   getImageSrc(filePath) {
     return this.get(
       '/sdk/image/download',
@@ -121,11 +240,7 @@ class Request {
     });
   }
   getImageData(filePath) {
-    return this.get(
-      '/sdk/image/download',
-      { filePath: filePath },
-      'arraybuffer',
-    );
+    return this.get('/sdk/image/download', { filePath: filePath }, 'blob');
   }
   getImageList() {
     return this.get('/sdk/image/list');
@@ -138,6 +253,58 @@ class Request {
     let data = JSON.stringify(params);
     return this.post('/sdk/regen', data, 'arraybuffer');
   }
+  getBlockData(params) {
+    return this.get('/sdk/api/sign/properties', params);
+  }
+  uploadSign(params) {
+    let url = '/sdk/api/sign/upload';
+    let { signId, file, uploadId } = params;
+    let formData = new FormData();
+    formData.append('dwgPath', dwgPath);
+    formData.append('signId', signId);
+    formData.append('file', file);
+    formData.append('uploadId', uploadId);
+    return this.post(url, formData).then((res) => {
+      let response = JSON.parse(res);
+      let { code, data } = response;
+      if (code === 0) {
+        return { fileId: data.fileId, signId };
+      } else {
+        return { fileId: '', signId };
+      }
+    });
+  }
+  downloadSign(signFileId) {
+    let url = '/sdk/api/sign/download/' + signFileId;
+    return this.get(url, {}, 'arraybuffer').then((res) => {
+      if (res) {
+        let url = this.arrayBufferToBase64(res);
+        return 'data:image/jpeg;base64,' + url;
+      }
+      return '';
+    });
+  }
+  saveBlockData(data) {
+    let params = { dwgPath, data };
+    params = JSON.stringify(params);
+    return this.post('/sdk/api/sign/save', params)
+      .then((res) => {
+        let response = JSON.parse(res);
+        let { code } = response;
+        if (code === 0) {
+          return true;
+        } else {
+          return false;
+        }
+      })
+      .catch(() => false);
+  }
+  deleteSign(signId) {
+    return this.post('/sdk/api/sign/delete?signId=' + signId);
+  }
+  getSignHistoryData(params) {
+    return this.get('/sdk/api/sign/signRecords', params).catch(() => []);
+  }
   getDwgFile() {
     return this.get(
       '/sdk/doc/download',
@@ -149,60 +316,376 @@ class Request {
   uploadFile(file) {
     let formData = new FormData();
     formData.append('file', file);
-    return this.post('/sdk/doc/upload', formData, 'json', 'java');
+    return this.post('/sdk/doc/upload', formData, 'json', 'java').catch(() => {
+      alert('上传接口 /sdk/doc/upload 调用失败 请联系管理员');
+    });
+  }
+  getDwgFile() {
+    return this.get(
+      '/sdk/doc/download',
+      { dwgPath: dwgPath },
+      'arraybuffer',
+      'java',
+    );
+  }
+  getTextStyleFont(path) {
+    let params = { path: path };
+    params = JSON.stringify(params);
+    return this.post('/sdk/font/fetchName', params, 'json', 'java');
+  }
+
+  getAbout() {
+    return this.get('/about');
+  }
+
+  addComment(params) {
+    return this.post(
+      '/sdk/doc/comment/add',
+      JSON.stringify({
+        docId,
+        handleId: curHandleId,
+        ...params,
+      }),
+    ).then((res) => {
+      let { code, data } = JSON.parse(res);
+      if (code === 0) return data;
+    });
   }
-}
 
-function resizeCheck() {
-  if (Date.now() - timer > 400) {
-    const windowInfo = {
-      width: window.innerWidth,
-      height: window.innerHeight,
+  editComment(params) {
+    return this.post(
+      '/sdk/doc/comment/edit',
+      JSON.stringify({
+        docId,
+        handleId: curHandleId,
+        ...params,
+      }),
+    ).then((res) => {
+      let { code, data } = JSON.parse(res);
+      if (code === 0) return data;
+    });
+  }
+
+  deleteComment(params) {
+    return this.post(
+      '/sdk/doc/comment/delete?id=' + params.id,
+      JSON.stringify({}),
+    ).then((res) => {
+      let { code, data } = JSON.parse(res);
+      if (code === 0) return data;
+    });
+  }
+
+  replyComment(params) {
+    return this.post(
+      '/sdk/doc/comment/reply',
+      JSON.stringify({
+        docId,
+        handleId: curHandleId,
+        ...params,
+      }),
+    ).then((res) => {
+      let { code, data } = JSON.parse(res);
+      if (code === 0) return data;
+    });
+  }
+
+  getComment(data) {
+    return this.get('/sdk/doc/comment/listPage', {
+      docId,
+      handleId: curHandleId,
+      pageNum: data.pageNum,
+      pageSize: data.pageSize,
+    });
+  }
+
+  /**
+   * 图纸对比, 调用转换服务
+   * @returns  fcmpInfo
+   */
+  transferFcmp(inputParams) {
+    let params = {
+      sourcePath: inputParams.sourcePath,
+      compareFilePath: inputParams.compareFilePath,
+      data: inputParams.hasOwnProperty('data')
+        ? inputParams.data
+        : {
+            fcmpRcShape: 0,
+            fcmpRcMargin: 5,
+            fcmpHatch: 1,
+            fcmpText: 1,
+          },
+      viewport: inputParams.hasOwnProperty('viewport')
+        ? inputParams.viewport
+        : '',
+      handleId: inputParams.hasOwnProperty('handleId')
+        ? inputParams.handleId
+        : '',
     };
-    console.log(windowInfo);
-    if (windowInfo.width <= 1190 || windowInfo.height <= 620) {
-      mainMobile.style.display = 'unset';
-      main.style.display = 'none';
-    } else {
-      mainMobile.style.display = 'none';
-      main.style.display = 'unset';
+    !params.viewport && delete params.viewport;
+    !params.handleId && delete params.handleId;
+
+    let isTimeout = false;
+    let timerTimeout = setTimeout(() => {
+      isTimeout = true;
+      alert('等待时间已经超过2分钟, 是否退出');
+      ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
+      ZwCloud2D.ZwDataProcessor.ZwLoad();
+    }, 120000);
+
+    return this.post('/sdk/fcmp', JSON.stringify(params), 'json').then(
+      (res) => {
+        clearTimeout(timerTimeout);
+        if (res.code !== 0) {
+          alert(res.msg);
+          resizeCheck();
+          return Promise.reject(res.code);
+        }
+        if (isTimeout) {
+          return Promise.reject('transferFcmp request timeout!');
+        }
+        let data = res.data;
+
+        docId = data.docId || new Date().getTime().toString();
+
+        let layouts = [];
+        (data.layouts || []).forEach((layout) => {
+          let res = {
+            handleId: layout.handleId,
+            isDefault: layout.isDefault === 1 ? 'YES' : 'NO',
+            name: layout.layoutName,
+            tabOrder: layout.order,
+          };
+          layouts.push(res);
+          if (layout.isDefault === 1) {
+            curHandleId = layout.handleId;
+          }
+        });
+        let fcmpInfo = {
+          baseFileName: data.baseFileName,
+          baseFileInfo: [
+            { lable: '名称', value: sourcePath },
+            { lable: '所有者', value: '未知' },
+            { lable: '创建时间', value: '未知' },
+            { lable: '文件路径', value: '未知' },
+          ],
+          compareFileName: data.compareFileName,
+          compareFileInfo: [
+            { lable: '名称', value: compareFilePath },
+            { lable: '所有者', value: '未知' },
+            { lable: '创建时间', value: '未知' },
+            { lable: '文件路径', value: '未知' },
+          ],
+          fcmpDiffExt: data.fcmpDiffExt,
+          fcmpErrorFlag: data.fcmpErrorFlag,
+          fonts: data.fontList || [],
+          layouts: layouts,
+          fcmpRcShape: params.data.fcmpRcShape,
+          fcmpRcMargin: params.data.fcmpRcMargin,
+          fcmpHatch: params.data.fcmpHatch,
+          fcmpText: params.data.fcmpText,
+        };
+        return fcmpInfo;
+      },
+    );
+  }
+
+  /**
+   * 下载图纸转换的显示数据
+   * @param {string} compareFilePath
+   * @param {string} sourcePath
+   * @returns
+   */
+  getFcmpDisplayData(compareFilePath, sourcePath) {
+    return this.get(
+      '/sdk/layout/lmf',
+      {
+        handleId: compareFilePath.replace(/\.dwg/gi, '_fcmp'),
+        dwgPath: sourcePath,
+        useCache: true,
+      },
+      'arraybuffer',
+    );
+  }
+
+  /**
+   * 获取文件列表
+   * @returns
+   */
+  getFileList() {
+    return this.get('/sdk/dwg/list').catch(() => {
+      alert('获取文件列表接口 /sdk/dwg/list 调用失败 请联系管理员');
+    });
+  }
+}
+req = new Request();
+
+// 生成Guid
+function randomFour() {
+  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
+}
+function guid() {
+  return (
+    randomFour() +
+    randomFour() +
+    '-' +
+    randomFour() +
+    '-' +
+    randomFour() +
+    '-' +
+    randomFour() +
+    '-' +
+    randomFour() +
+    randomFour() +
+    randomFour()
+  );
+}
+function getCommentFunc(data) {
+  // 每次切换布局需要重新获取评论数据
+  let commentList = {
+    code: 0,
+    data: {
+      rows: [],
+    },
+  };
+  req
+    .getComment(data)
+    .then((res) => {
+      if (res) {
+        let data = JSON.parse(JSON.stringify(res));
+        commentList.data.total = data.total;
+        commentList.data.rows = data.rows;
+      }
+      if (data.initial) {
+        ZwCloud2D.ZwDataManager.ZwSetCommentData({
+          commentList: commentList,
+          memberList,
+          user,
+        });
+      } else {
+        ZwCloud2D.ZwDataManager.ZwSetCommentData({
+          commentList: commentList,
+          pageNum: data.pageNum,
+        });
+      }
+    })
+    .catch((error) => {
+      if (data.initial) {
+        ZwCloud2D.ZwDataManager.ZwSetCommentData({
+          commentList: commentList,
+          memberList,
+          user,
+        });
+      } else {
+        ZwCloud2D.ZwDataManager.ZwSetCommentData({
+          commentList: commentList,
+          pageNum: data.pageNum,
+        });
+      }
+      console.error(error);
+    });
+}
+function saveCommentFunc(data) {
+  let params = { pageNum: 1, pageSize: data.data.pageSize };
+  if (data.data) {
+    // 根据不同场景组织数据并保存
+    switch (data.type) {
+      case 'delete':
+        req
+          .deleteComment({
+            id: data.data.id,
+          })
+          .then(() => {
+            this.getCommentFunc(params);
+          });
+        break;
+      case 'edit':
+        // 编辑评论时需要更新数据
+        req
+          .editComment({
+            id: data.data.id,
+            content: data.data.content,
+            realContent: data.data.realContent,
+            mark: data.data.mark,
+            withMark: data.data.withMark,
+            withAt: data.data.withMark,
+            createBy: user.userId,
+            creator: user.userName,
+          })
+          .then(() => {
+            this.getCommentFunc(params);
+          });
+        break;
+      default:
+        {
+          //新增评论、回复评论的场景
+          data.data.id = guid();
+          data.data.createTime = new Date().getTime();
+          data.data.createBy = user.userId;
+          data.data.creator = user.userName;
+          // 有parentId表示是回复评论
+          if (data.data.parentId) {
+            req
+              .replyComment({
+                parentId: data.data.parentId,
+                content: data.data.content,
+                realContent: data.data.realContent,
+                mark: data.data.mark,
+                withMark: data.data.withMark,
+                withAt: data.data.withMark,
+                createBy: user.userId,
+                creator: user.userName,
+              })
+              .then(() => {
+                this.getCommentFunc(params);
+              });
+          } else {
+            // 新增评论
+            req
+              .addComment({
+                content: data.data.content,
+                realContent: data.data.realContent,
+                mark: data.data.mark,
+                withMark: data.data.withMark,
+                withAt: data.data.withMark,
+                createBy: user.userId,
+                creator: user.userName,
+              })
+              .then(() => {
+                this.getCommentFunc(params);
+              });
+          }
+        }
+        break;
     }
-    timer = Date.now();
   }
 }
 
 ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl = (url1, url2, url3) => {
-  javaUrl = url1;
-  baseUrl = url2;
-  wsUrl = url3;
+  baseUrl = url1;
+  wsUrl = url2;
+  javaUrl = url3;
 };
-
 ZwCloud2D.ZwDataProcessor.ZwSetLoadDwg = (path) => {
   dwgPath = path;
 };
-
 ZwCloud2D.ZwDataProcessor.uploadDwg = (file) => {
   let req = new Request();
-  return new Promise((resolve, reject) => {
-    req.uploadFile(file).then((res) => {
-      resolve(res);
-    });
-  });
 
-  // req.uploadFile(file).then(res => {
-  //     dwgPath = res.data.path;
-  //     ZwCloud2D.ZwDataProcessor.ZwLoad();
-  //     let main = document.getElementById('main');
-  //     main.style.display = "none"
-  //     let mainMobile = document.getElementById('main-mobile');
-  //     mainMobile.style.display = "none"
-  //     let showDwgBtn = document.getElementById('showDwgBtn');
-  //     let showFontBtn = document.getElementById('showFontBtn');
-  //     showDwgBtn.style.display = "unset"
-  //     showFontBtn.style.display = "unset"
-  // })
+  return req.uploadFile(file);
+  //   .then((res) => {
+  //       dwgPath = res.data.path;
+  //       ZwCloud2D.ZwDataProcessor.ZwLoad();
+  //   let main = document.getElementById('main');
+  //   main.style.display = 'none';
+  //   let mainMobile = document.getElementById('main-mobile');
+  //   mainMobile.style.display = 'none';
+  //   let showDwgBtn = document.getElementById('showDwgBtn');
+  //   let showFontBtn = document.getElementById('showFontBtn');
+  //   showDwgBtn.style.display = 'unset';
+  //   showFontBtn.style.display = 'unset';
+  // });
 };
-
 ZwCloud2D.ZwDataProcessor.uploadFont = (file) => {
   let req = new Request();
   let pArray = new Array();
@@ -227,88 +710,230 @@ ZwCloud2D.ZwDataProcessor.uploadFont = (file) => {
       alert('上传失败');
     });
 };
-
-ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
-  let docId = new Date().getTime().toString();
-  let req = new Request();
-
-  // 切换布局时候触发回调
-  ZwCloud2D.ZwMessageCallback.ZwEvtChangeLayout = (layout) => {
-    req
-      .getDisplayData(layout.handleId)
-      .then((data) => {
-        let timestamp = new Date().getTime();
-        ZwCloud2D.ZwDataManager.ZwSetDwgData(layout.handleId, data, timestamp);
-      })
-      .catch((error) => {
-        console.error(error);
-      });
-  };
-  ZwCloud2D.ZwMessageCallback.ZwEvtLoadXrefData = (data) => {
-    req
-      .getXrefData(data.handleId, data.xrefIds)
-      .then((res) => {
-        ZwCloud2D.ZwDataManager.ZwSetXrefData(res);
-      })
-      .catch(() => {
-        ZwCloud2D.ZwDataManager.ZwSetXrefData();
+ZwCloud2D.ZwDataProcessor.selectBaseDwgAndCompareDwg = () => {
+  return new Promise((res, rej) => {
+    req.getFileList().then((array) => {
+      new Modal({
+        title: '选择两个进行对比的图纸',
+        fcmpInfoContent: array,
+        onOk: () => {
+          res();
+        },
       });
-  };
-  ZwCloud2D.ZwMessageCallback.ZwEvtDrawEnd = () => {};
+    });
+  });
+};
+ZwCloud2D.ZwDataProcessor.ZwProcessAboutVersionData = () => {
+  return req.getAbout().then((res) => {
+    let aboutVersion = '';
+    aboutVersion +=
+      'Front side VERNUM: ' + ZwCloud2D.version.commitId + '<br/>';
+    aboutVersion +=
+      'Front side COMMIT TIME: ' + ZwCloud2D.version.commitTime + '<br/>';
+    aboutVersion +=
+      'Middleware VERNUM: ' + (res['git.commit.id'] || '') + '<br/>';
+    aboutVersion +=
+      'Middleware COMMIT TIME: ' + (res['git.commit.time'] || '') + '<br/>';
+    aboutVersion +=
+      'Core service VERNUM: ' + (res['cloud2d.server'] || '') + '<br/>';
 
-  ZwCloud2D.ZwMessageCallback.ZwEvtGetRegenData = (data) => {
-    req
-      .getRegenData(data)
-      .then((res) => {
-        ZwCloud2D.ZwDataManager.ZwSetRegenData(res);
-      })
-      .catch(() => {
-        ZwCloud2D.ZwDataManager.ZwSetRegenData(null);
-      });
-  };
-  ZwCloud2D.ZwMessageCallback.ZwEvtLoadImageData = (data) => {
-    let pArr = new Array();
-    let imageMap = new Map();
-    data.forEach((imageUrl) => {
-      pArr.push(
-        new Promise((res, rej) => {
-          req
-            .getImageData(imageUrl)
-            .then((result) => {
-              imageMap.set(imageUrl, result);
-              res(true);
-            })
-            .catch((err) => {
-              res(true);
-            });
-        }),
-      );
+    ZwCloud2D.ZwSetting.ZwSetAbout({ version: aboutVersion });
+  });
+};
+ZwCloud2D.ZwDataProcessor.ZwProcessPermissionData = () => {
+  return req
+    .getPermissionList()
+    .then((data) => {
+      //启用电子签章功能
+      if (enableSign) {
+        ZwCloud2D.ZwEditor.ZwSetUserOptions({
+          panel: { signPanel: true },
+          commandButton: { Sign: true, Fcmp: true },
+          command: { FCMP: true },
+        });
+      } else {
+        //启用文件对比功能
+        ZwCloud2D.ZwEditor.ZwSetUserOptions({
+          commandButton: { Fcmp: true },
+          command: { FCMP: true },
+        });
+      }
+      ZwCloud2D.ZwDataManager.ZwSetSdkPermission(data);
+    })
+    .catch((error) => {
+      console.error(error);
     });
-    Promise.all(pArr)
-      .then(() => {
-        ZwCloud2D.ZwDataManager.ZwSetImageData(imageMap);
-      })
-      .catch((error) => {
-        console.error(error);
+};
+ZwCloud2D.ZwDataProcessor.ZwProcessFontData = (missingFonts) => {
+  let pArr = [];
+  let fontArr = [];
+  missingFonts.forEach((fontName) => {
+    let arr = fontName.split('.');
+    let type = (arr[arr.length - 1] || '').toUpperCase();
+
+    pArr.push(
+      req.fontDownload(fontName).then(async (data) => {
+        if (data.type === 'application/octet-stream') {
+          let arraybuffer = await data.arrayBuffer();
+          fontArr.push({
+            name: fontName,
+            type: type,
+            data: arraybuffer,
+          });
+        }
+      }),
+    );
+  });
+  return Promise.all(pArr).then(() => {
+    return ZwCloud2D.ZwDataManager.ZwSetFontDataList(fontArr);
+  });
+};
+ZwCloud2D.ZwDataProcessor.ZwProcessXrefData = (dwgPath, docName) => {
+  return req
+    .getXrefRelation(dwgPath)
+    .then((xrefRelations) => {
+      let xrefPromises = [];
+      let srcMap = new Map();
+      xrefRelations.forEach((xrefRelation) => {
+        if (xrefRelation.foundPath) {
+          xrefPromises.push(
+            new Promise((res, rej) => {
+              req.getXrefThumb(xrefRelation.foundPath).then((xrefThumb) => {
+                srcMap.set(xrefRelation.foundPath, xrefThumb);
+                res(true);
+              });
+            }),
+          );
+        }
       });
-  };
-  ZwCloud2D.ZwMessageCallback.ZwEvtLoadImageList = () => {
-    req.getImageList().then((res) => {
-      res.forEach((image) => {
-        let path = image.completePath + image.name;
-        req.getImageSrc(path).then((imageData) => {
-          let item = {
-            name: image.name,
-            data: imageData,
-            completePath: image.completePath,
+      return Promise.all(xrefPromises)
+        .then(() => {
+          let params = {
+            docName: docName,
+            xrefRelations: xrefRelations,
+            srcMap: srcMap,
+          };
+          ZwCloud2D.ZwDataManager.ZwSetXrefList(params);
+        })
+        .catch(() => {
+          let params = {
+            docName: docName,
+            xrefRelations: xrefRelations,
+            srcMap: srcMap,
           };
-          ZwCloud2D.ZwDataManager.ZwSetImageList(item);
+          ZwCloud2D.ZwDataManager.ZwSetXrefList(params);
         });
+    })
+    .catch((error) => {
+      console.error(error);
+    });
+};
+
+//ZwCloud SDK 回调
+ZwCloud2D.ZwMessageCallback.ZwEvtChangeLayout = (layout) => {
+  req
+    .getDisplayData(layout.handleId)
+    .then((data) => {
+      let timestamp = new Date().getTime();
+      ZwCloud2D.ZwDataManager.ZwSetDwgData(layout.handleId, data, timestamp);
+    })
+    .catch((error) => {
+      console.error(error);
+    });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadXrefData = (data) => {
+  req
+    .getXrefData(data.handleId, data.xrefIds)
+    .then((res) => {
+      ZwCloud2D.ZwDataManager.ZwSetXrefData(res);
+    })
+    .catch(() => {
+      ZwCloud2D.ZwDataManager.ZwSetXrefData();
+    });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtDrawEnd = () => {};
+ZwCloud2D.ZwMessageCallback.ZwEvtGetRegenData = async (data) => {
+  req
+    .getRegenData(data)
+    .then((res) => {
+      ZwCloud2D.ZwDataManager.ZwSetRegenData(res);
+    })
+    .catch(() => {
+      ZwCloud2D.ZwDataManager.ZwSetRegenData(null);
+    });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadImageData = (data) => {
+  let pArr = new Array();
+  let imageMap = new Map();
+  data.forEach((imageUrl) => {
+    pArr.push(
+      new Promise((res, rej) => {
+        req
+          .getImageData(imageUrl)
+          .then(async (result) => {
+            if (result.type === 'application/octet-stream') {
+              let arraybuffer = await result.arrayBuffer();
+              imageMap.set(imageUrl, arraybuffer);
+            }
+            res(true);
+          })
+          .catch((err) => {
+            res(true);
+          });
+      }),
+    );
+  });
+  Promise.all(pArr)
+    .then(() => {
+      ZwCloud2D.ZwDataManager.ZwSetImageData(imageMap);
+    })
+    .catch((error) => {
+      console.error(error);
+    });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadImageList = () => {
+  req.getImageList().then((res) => {
+    res.forEach((image) => {
+      let path = image.completePath + image.name;
+      image.completePath = path;
+      req.getImageSrc(path).then((imageData) => {
+        let item = {
+          name: image.name,
+          data: imageData,
+          completePath: image.completePath,
+        };
+        ZwCloud2D.ZwDataManager.ZwSetImageList(item);
       });
     });
-  };
-  ZwCloud2D.ZwMessageCallback.ZwEvtPlotDwg = (data) => {
-    let params = Object.assign(data.params, { dwgPath: dwgPath });
+  });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtPlotDwg = (data) => {
+  let params = Object.assign(data.params, { dwgPath: dwgPath });
+  if (enableSign) {
+    params.docId = 0;
+    let { isZwPlot } = data.params;
+    if (isZwPlot) {
+      req
+        .getSignBatchPlotData(params)
+        .then((res) => {
+          ZwCloud2D.ZwDataManager.ZwSetPlotData(data, res);
+          ZwCloud2D.ZwEditor.ZwSetLoadingState(false);
+        })
+        .catch((error) => {
+          console.error(error);
+        });
+    } else {
+      req
+        .getSignPlotData(params)
+        .then((res) => {
+          ZwCloud2D.ZwDataManager.ZwSetPlotData(data, res);
+          ZwCloud2D.ZwEditor.ZwSetLoadingState(false);
+        })
+        .catch((error) => {
+          console.error(error);
+        });
+    }
+  } else {
     req
       .getPlotData(params)
       .then((res) => {
@@ -318,148 +943,308 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
       .catch((error) => {
         console.error(error);
       });
-  };
-  ZwCloud2D.ZwEditor.ZwSetUserOptions({ panel: { commentPanel: false } });
-  req
-    .getPermissionList()
-    .then((data) => {
-      ZwCloud2D.ZwDataManager.ZwSetSdkPermission(data);
-    })
-    .catch((error) => {
-      console.error(error);
-    });
-  if (!dwgPath) return;
-  req
-    .transferDoc()
-    .then((data) => {
-      // 显示当前布局的数据
-      let layouts = [];
-      data.layouts.forEach((layout) => {
-        let res = {
-          handleId: layout.handleId,
-          isDefault: layout.isDefault === 1 ? 'YES' : 'NO',
-          name: layout.layoutName,
-          tabOrder: layout.order,
-        };
-        layouts.push(res);
+  }
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtSignBlockData = (res) => {
+  let { type, data } = res;
+  switch (type) {
+    case signBlockOper.GetBlockData:
+      req.getBlockData({ dwgPath, drawFramePrefix: '' }).then((res) => {
+        ZwCloud2D.ZwDataManager.ZwSignBlockData({ type, data: res });
       });
-      ZwCloud2D.ZwDataManager.ZwSetDwgInfo({
-        id: docId,
-        fonts: data.fontList,
-        layouts: layouts,
-        name: data.name,
-      }).then((res) => {
-        let pArr = [];
-        let fontArr = [];
-        res.missingFonts.forEach((fontName) => {
-          let arr = fontName.split('.');
-          let type = (arr[arr.length - 1] || '').toUpperCase();
-
-          pArr.push(
-            req.fontDownload(fontName).then(async (data) => {
-              if (data.type === 'application/octet-stream') {
-                let arraybuffer = await data.arrayBuffer();
-                fontArr.push({
-                  name: fontName,
-                  type: type,
-                  data: arraybuffer,
-                });
-              }
-            }),
-          );
-        });
-        Promise.all(pArr)
-          .then(() => {
-            ZwCloud2D.ZwDataManager.ZwSetFontDataList(fontArr).then(() => {
-              req
-                .getDisplayData(res.layout.handleId)
-                .then((lmfInfo) => {
-                  if (res.timestamp === '')
-                    res.timestamp = new Date().getTime();
-                  ZwCloud2D.ZwDataManager.ZwSetDwgData(
-                    res.layout.handleId,
-                    lmfInfo,
-                    res.timestamp,
-                  );
-                })
-                .catch((error) => {
-                  console.error(error);
-                });
-
-              req
-                .getXrefRelation()
-                .then((xrefRelations) => {
-                  let xrefPromises = [];
-                  let srcMap = new Map();
-                  xrefRelations.forEach((xrefRelation) => {
-                    if (xrefRelation.foundPath) {
-                      xrefPromises.push(
-                        new Promise((res, rej) => {
-                          req
-                            .getXrefThumb(xrefRelation.foundPath)
-                            .then((xrefThumb) => {
-                              srcMap.set(xrefRelation.foundPath, xrefThumb);
-                              res(true);
-                            });
-                        }),
-                      );
-                    }
-                  });
-                  Promise.all(xrefPromises)
-                    .then(() => {
-                      let params = {
-                        docName: data.name,
-                        xrefRelations: xrefRelations,
-                        srcMap: srcMap,
-                      };
-                      ZwCloud2D.ZwDataManager.ZwSetXrefList(params);
-                    })
-                    .catch(() => {
-                      let params = {
-                        docName: data.name,
-                        xrefRelations: xrefRelations,
-                        srcMap: srcMap,
-                      };
-                      ZwCloud2D.ZwDataManager.ZwSetXrefList(params);
-                    });
-                })
-                .catch((error) => {
-                  console.error(error);
-                });
-
-              if (wsUrl) {
-                let url =
-                  wsUrl +
-                  '/CadService?sub=' +
-                  Math.floor(Math.random() * 1000) +
-                  '&docId=' +
-                  docId +
-                  '&dwgPath=' +
-                  dwgPath;
-                ZwCloud2D.ZwDataManager.ZwEntryEdit(url);
-              }
+      break;
+    case signBlockOper.UploadSign:
+    case signBlockOper.UploadCert:
+    case signBlockOper.UploadDwg:
+      req.uploadSign(data).then((res) => {
+        ZwCloud2D.ZwDataManager.ZwSignBlockData({ type, data: res });
+      });
+      break;
+    case signBlockOper.ConFirmEdit:
+      req.saveBlockData(data).then((res) => {
+        ZwCloud2D.ZwDataManager.ZwSignBlockData({ type, data: res });
+      });
+      break;
+    default:
+      break;
+  }
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtSignPanelOperation = (signId) => {
+  req.deleteSign(signId).then((result) => {
+    ZwCloud2D.ZwDataManager.ZwDeleteSignCallback(result);
+  });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadSignHistoryData = async (data) => {
+  req.getSignHistoryData({ dwgPath }).then((signHistory) => {
+    if (signHistory.length === 0) {
+      ZwCloud2D.ZwDataManager.ZwSetSignHistoryData([]);
+      return;
+    }
+    let attrs = [];
+    let promiseList = [];
+    for (let i = 0; i < signHistory.length; i++) {
+      let block = signHistory[i];
+      let handleId = block.layoutHandle;
+      for (let j = 0; j < block.blockData.length; j++) {
+        let ref = block.blockData[j];
+        for (let k = 0; k < ref.refData.length; k++) {
+          let attr = ref.refData[k];
+          let vv = attr.attrVvector;
+          let uv = attr.attrUvector;
+          let lb = attr.attrInsertPoint;
+          let lt = [lb[0] + vv[0], lb[1] + vv[1], lb[2] + vv[2]];
+          let rb = [lb[0] + uv[0], lb[1] + uv[1], lb[2] + uv[2]];
+          let preAttr = attrs.find((atr) => atr.signId === attr.signId);
+          if (preAttr) {
+            preAttr.position.push({
+              id: attr.signId + '-' + handleId,
+              ptLeftBottom: lb,
+              ptLeftTop: lt,
+              ptRightBottom: rb,
             });
-          })
-          .catch((error) => {
-            console.error(error);
-          });
+          } else {
+            attrs.push({
+              signId: attr.signId,
+              signTime: attr.signTime,
+              name: attr.attrName,
+              signType: attr.type,
+              creator: '',
+              position: [
+                {
+                  id: attr.signId + '-' + handleId,
+                  ptLeftBottom: lb,
+                  ptLeftTop: lt,
+                  ptRightBottom: rb,
+                },
+              ],
+              signFileId: attr.signFileId,
+            });
+          }
+        }
+      }
+    }
+    promiseList = attrs.map((attr) => {
+      return req.downloadSign(attr.signFileId).then((imageData) => {
+        return {
+          ...attr,
+          signData: imageData,
+        };
       });
-    })
-    .catch((error) => {
-      ZwCloud2D.ZwEditor.ZwSetLoadingState(false);
-
-      alert(error);
-      let main = document.getElementById('main');
-      main.style.display = 'unset';
-      let mainMobile = document.getElementById('main-mobile');
-      mainMobile.style.display = 'unset';
-      let showDwgBtn = document.getElementById('showDwgBtn');
-      let showFontBtn = document.getElementById('showFontBtn');
-      showDwgBtn.style.display = 'none';
-      showFontBtn.style.display = 'none';
-
-      resizeCheck();
-      window.addEventListener('resize', resizeCheck);
-      console.error(error);
     });
+
+    Promise.all(promiseList).then((res) => {
+      ZwCloud2D.ZwDataManager.ZwSetSignHistoryData(res);
+    });
+  });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadDwgFile = () => {
+  req.getDwgFile().then((dwgFile) => {
+    ZwCloud2D.ZwDataManager.ZwSetDwgFileData(dwgFile);
+  });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtGetTextStyleFont = (data) => {
+  req.getTextStyleFont(data).then((res) => {
+    ZwCloud2D.ZwDataManager.ZwSetTextStyleFont(res.data.name);
+  });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtUpdateCommentData = async (data) => {
+  let commentList = {
+    code: 0,
+    data: {
+      rows: [data.data],
+    },
+  };
+  ZwCloud2D.ZwDataManager.ZwSetCommentData({ commentList: commentList });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtFileOperate = async () => {
+  //模拟在移动端触发文件对比功能
+  ZwCloud2D.ZwMessageCallback.ZwEvtFileCompare({ state: 'enterFcmp' });
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtFileCompare = async (data) => {
+  if (data.state === 'enterFcmp') {
+    await ZwCloud2D.ZwDataProcessor.selectBaseDwgAndCompareDwg();
+
+    ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
+
+    await req.getXrefRelation(sourcePath);
+
+    let fcmpInfo = await req
+      .transferFcmp({ sourcePath, compareFilePath })
+      .catch(() => {
+        ZwCloud2D.ZwMessageCallback.ZwEvtFileCompare({ state: 'exitFcmp' });
+        return Promise.reject('');
+      });
+
+    dwgPath = sourcePath;
+
+    let res = await ZwCloud2D.ZwDataManager.ZwSetFcmpDwgInfo(fcmpInfo);
+
+    await ZwCloud2D.ZwDataProcessor.ZwProcessFontData(res.missingFonts);
+
+    ZwCloud2D.ZwDataProcessor.ZwProcessXrefData(
+      sourcePath,
+      fcmpInfo.baseFileName,
+    );
+
+    let fcmpLmfArrayBuffer = await req.getFcmpDisplayData(
+      compareFilePath,
+      sourcePath,
+    );
+
+    ZwCloud2D.ZwDataManager.ZwSetFcmpDwgData(
+      res.layout.handleId,
+      fcmpLmfArrayBuffer,
+      res.timestamp || new Date().getTime(),
+    );
+  }
+  if (data.state === 'getFcmpRegenData') {
+    let fcmpInfo = await req.transferFcmp({
+      sourcePath,
+      compareFilePath,
+      ...data.params,
+    });
+
+    let fcmpLmfArrayBuffer = await req.getFcmpDisplayData(
+      compareFilePath,
+      sourcePath,
+    );
+
+    ZwCloud2D.ZwDataManager.ZwSetFcmpRegenData({
+      lmfData: fcmpLmfArrayBuffer,
+      ...fcmpInfo,
+      fcmpErrorFlag: 0,
+    });
+  }
+  if (data.state === 'exitFcmp') {
+    ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
+
+    ZwCloud2D.ZwDataProcessor.ZwLoad();
+  }
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtGetLayoutHandle = async (data) => {
+  // 获取布局id
+  curHandleId = data;
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtLoadCommentData = async (data) => {
+  getCommentFunc(data);
+};
+ZwCloud2D.ZwMessageCallback.ZwEvtUpdateCommentData = async (data) => {
+  // 评论数据添加到评论面板样例
+  saveCommentFunc(data);
+};
+
+ZwCloud2D.ZwDataProcessor.ZwLoad = async () => {
+  try {
+    ZwCloud2D.ZwDataProcessor.ZwProcessAboutVersionData();
+
+    ZwCloud2D.ZwDataProcessor.ZwProcessPermissionData();
+
+    if (!dwgPath) return;
+
+    let data = await req.transferDoc(dwgPath);
+
+    docId = new Date().getTime().toString();
+
+    let layouts = [];
+    data.layouts.forEach((layout) => {
+      let res = {
+        handleId: layout.handleId,
+        isDefault: layout.isDefault === 1 ? 'YES' : 'NO',
+        name: layout.layoutName,
+        tabOrder: layout.order,
+      };
+      layouts.push(res);
+      if (layout.isDefault === 1) {
+        curHandleId = layout.handleId;
+      }
+    });
+
+    let res = await ZwCloud2D.ZwDataManager.ZwSetDwgInfo({
+      id: docId,
+      fonts: data.fontList,
+      layouts: layouts,
+      name: data.name,
+    });
+
+    await ZwCloud2D.ZwDataProcessor.ZwProcessFontData(res.missingFonts);
+
+    ZwCloud2D.ZwDataProcessor.ZwProcessXrefData(dwgPath, data.name);
+
+    req
+      .getDisplayData(res.layout.handleId)
+      .then((lmfInfo) => {
+        ZwCloud2D.ZwDataManager.ZwSetDwgData(
+          res.layout.handleId,
+          lmfInfo,
+          res.timestamp || new Date().getTime(),
+        );
+      })
+      .catch((error) => {
+        console.error(error);
+      });
+
+    if (wsUrl) {
+      let url =
+        wsUrl +
+        '/CadService?sub=' +
+        Math.floor(Math.random() * 1000) +
+        '&docId=' +
+        docId +
+        '&dwgPath=' +
+        dwgPath;
+      ZwCloud2D.ZwDataManager.ZwEntryEdit(url);
+    }
+  } catch (error) {
+    ZwCloud2D.ZwEditor.ZwSetLoadingState(false);
+
+    alert(error);
+    // let main = document.getElementById('main');
+    // main.style.display = 'unset';
+    // let mainMobile = document.getElementById('main-mobile');
+    // mainMobile.style.display = 'unset';
+    // let showDwgBtn = document.getElementById('showDwgBtn');
+    // let showFontBtn = document.getElementById('showFontBtn');
+    // showDwgBtn.style.display = 'none';
+    // showFontBtn.style.display = 'none';
+
+    // resizeCheck();
+    // window.addEventListener('resize', resizeCheck);
+    console.error(error);
+  }
+};
+ZwCloud2D.ZwDataProcessor.ZwFcmpLoad = async () => {
+  ZwCloud2D.ZwDataProcessor.ZwProcessAboutVersionData();
+
+  ZwCloud2D.ZwDataProcessor.ZwProcessPermissionData();
+
+  await req.getXrefRelation(sourcePath);
+
+  let fcmpInfo = await req
+    .transferFcmp({ sourcePath, compareFilePath })
+    .catch(() => {
+      ZwCloud2D.ZwMessageCallback.ZwEvtFileCompare({ state: 'exitFcmp' });
+      return Promise.reject('');
+    });
+
+  dwgPath = sourcePath;
+
+  let res = await ZwCloud2D.ZwDataManager.ZwSetFcmpDwgInfo(fcmpInfo);
+
+  await ZwCloud2D.ZwDataProcessor.ZwProcessFontData(res.missingFonts);
+
+  ZwCloud2D.ZwDataProcessor.ZwProcessXrefData(
+    sourcePath,
+    fcmpInfo.baseFileName,
+  );
+
+  let fcmpLmfArrayBuffer = await req.getFcmpDisplayData(
+    compareFilePath,
+    sourcePath,
+  );
+
+  ZwCloud2D.ZwDataManager.ZwSetFcmpDwgData(
+    res.layout.handleId,
+    fcmpLmfArrayBuffer,
+    res.timestamp || new Date().getTime(),
+  );
 };

+ 41 - 17
public/ZwCloud2DSDK/ZwCloud2DRestfulAPI.js

@@ -3,6 +3,7 @@ let userUrl = 'http://192.168.51.174:9091'
 let appKey = ''
 
 let docId = ''
+let sourceFileId = ''
 
 let fullVersionPermissions = {
     'productName': 'ZW2D_CLOUD_FULL_2024',
@@ -378,10 +379,10 @@ class Request {
         return this.get('/api/js/v1/font/gzip', { fileId: fileId, projectId: 0 }, 'arraybuffer')
     }
 
-    getTransferStatus(){
+    getTransferStatus() {
         let params = { id: docId }
         params = JSON.stringify(params)
-        return this.post('/api/js/v1/doc/transferStatus', params,'json')
+        return this.post('/api/js/v1/doc/transferStatus', params, 'json')
     }
 
     transferDoc() {
@@ -445,6 +446,10 @@ class Request {
         let data = JSON.stringify(params)
         return this.post('/api/js/v1/layout/regen', data, 'arraybuffer')
     }
+
+    getDwgFile(fileId) {
+        return this.get('/api/js/v1/file/download', { id: fileId }, 'arraybuffer')
+    }
 }
 
 ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl = (url1, url2) => {
@@ -560,20 +565,39 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
             ZwCloud2D.ZwDataManager.ZwSetRegenData(null);
         });
     };
-    let ZwMain=()=>{
+    ZwCloud2D.ZwMessageCallback.ZwEvtLoadDwgFile = () => {
+        ZwCloud2D.ZwEditor.ZwSetLoadingState(true)
+        
+        req.getDwgFile(sourceFileId).then(dwgFile => {
+            ZwCloud2D.ZwDataManager.ZwSetDwgFileData(dwgFile);
+            ZwCloud2D.ZwEditor.ZwSetLoadingState(false)
+        })
+    };
+    ZwCloud2D.ZwMessageCallback.ZwEvtUpdateCommentData = async(data) => {
+        let commentList = {
+            code: 0,
+            data: {
+                rows: [data.data]
+            }
+        };
+        ZwCloud2D.ZwDataManager.ZwSetCommentData({ commentList: commentList });
+    };
+    let ZwMain = () => {
         req.transferDoc().then(data => {
 
+            sourceFileId = data.sourceFileId
+
             ZwCloud2D.ZwDataManager.ZwSetSdkPermission(fullVersionPermissions);
-    
+
             // 显示当前布局的数据
             ZwCloud2D.ZwDataManager.ZwSetDwgInfo({ fonts: data.fonts, layouts: data.layouts, name: data.name }).then(res => {
                 let pArr = []
                 let fontArr = []
-    
+
                 res.missingFonts.forEach(font => {
                     let arr = font.name.split('.');
                     let type = (arr[arr.length - 1] || '').toUpperCase();
-    
+
                     pArr.push(req.fontDownload(font.fileId).then(data => {
                         if (data.byteLength > 0) {
                             fontArr.push(
@@ -586,12 +610,12 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
                         }
                     }));
                 });
-    
+
                 Promise.all(pArr).then(() => {
                     ZwCloud2D.ZwDataManager.ZwSetFontDataList(fontArr).then(() => {
-    
+
                         req.getDisplayData(res.layout.handleId).then(result => {
-    
+
                             req.getXrefRelation().then(xrefRelations => {
                                 let xrefPromises = [];
                                 let srcMap = new Map();
@@ -613,7 +637,7 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
                                     ZwCloud2D.ZwDataManager.ZwSetXrefList(params);
                                 });
                             });
-    
+
                             req.getFileInfo(result.lmfId).then(lmfInfo => {
                                 let curTimestamp = new Date(lmfInfo.updateTime || lmfInfo.createTime).getTime();
                                 if (res.hasCache && res.timestamp === curTimestamp.toString()) {
@@ -626,7 +650,7 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
                             }).catch(error => {
                                 console.error(error)
                             })
-    
+
                         }).catch(error => {
                             console.error(error)
                         })
@@ -639,20 +663,20 @@ ZwCloud2D.ZwDataProcessor.ZwLoad = () => {
             console.error(error)
         });
     }
-    let getTransferStatus=()=>{
-        req.getTransferStatus().then(fileInfo=>{
-            let status=fileInfo.data.status
+    let getTransferStatus = () => {
+        req.getTransferStatus().then(fileInfo => {
+            let status = fileInfo.data.status
             if (status === 1) {
                 let timer = setTimeout(() => {
                     clearTimeout(timer)
                     getTransferStatus()
                 }, 3000);
-            } else if(status === 2) {
+            } else if (status === 2) {
                 ZwMain()
-            }else if(status === 3){
+            } else if (status === 3) {
                 console.error(fileInfo.failedReason)
             }
-        }).catch(err=>{
+        }).catch(err => {
             console.error(err)
         })
     }

File diff suppressed because it is too large
+ 0 - 0
public/ZwCloud2DSDK/ZwWasmJs.js


BIN
public/ZwCloud2DSDK/ZwWasmJs.wasm


BIN
public/ZwCloud2DSDK/ieHelper/setup.zip


File diff suppressed because it is too large
+ 0 - 0
public/ZwCloud2DSDK/readLMFData.js


+ 6 - 2
src/app.tsx

@@ -1,6 +1,6 @@
 // 运行时配置
 import { RunTimeLayoutConfig, RequestConfig } from '@umijs/max';
-import { message } from 'antd';
+import { ConfigProvider, message } from 'antd';
 import UserDropdown from '@/components/UserDropdown';
 import { getToken } from '@/utils/utils';
 import { history } from 'umi';
@@ -9,6 +9,7 @@ import { useModel } from '@umijs/max';
 import { queryCurrentV2 } from './services/user';
 import dayjs from 'dayjs';
 import 'dayjs/locale/zh-cn';
+import React from 'react';
 
 dayjs.locale('zh-cn');
 
@@ -61,7 +62,10 @@ export const layout: RunTimeLayoutConfig = (initialState) => {
     logo: logo,
   };
 };
-
+//修改交给 react-dom 渲染时的根组件 修改antd样式前缀
+export function rootContainer(container) {
+  return React.createElement(ConfigProvider, { prefixCls: 'antd5' }, container);
+}
 // axios配置
 export const request: RequestConfig = {
   errorConfig: {

+ 1 - 1
src/components/Flow/node/control-map-service/components/style.less

@@ -92,7 +92,7 @@
     grid-gap: 8px;
   }
 
-  .ant-input-number {
+  .antd5-input-number {
     width: 100%;
   }
 }

+ 9 - 11
src/components/InputSelect/index.less

@@ -1,33 +1,31 @@
-.noData{
+.noData {
   position: relative;
   text-align: center;
   color: #fff;
   font-size: 24px;
-  .noDataText{
+  .noDataText {
     position: absolute;
     left: 50%;
     bottom: 15px;
     transform: translateX(-50%);
   }
-  .noDataImg{
+  .noDataImg {
     display: block;
     margin: auto;
   }
 }
-.down{
+.down {
   :global {
-    .ant-input-group-addon{
+    .antd5-input-group-addon {
       padding: 0;
       font-size: 18px;
     }
-    
   }
 }
-.main{
+.main {
   position: relative;
-  
 }
-.downUl{
+.downUl {
   width: 100%;
   height: 300px;
   overflow-y: scroll;
@@ -39,11 +37,11 @@
   border: 1px solid #eee;
   border-radius: 5px;
   padding: 4px 0 4px 10px;
-  & >li{
+  & > li {
     cursor: pointer;
     padding: 4px 0;
   }
-  & >li:hover{
+  & > li:hover {
     background-color: #eee;
   }
 }

+ 22 - 22
src/components/ModuleTitle/index.less

@@ -1,56 +1,56 @@
-.icon{
+.icon {
   float: left;
   width: 8px;
   height: 22px;
-  background-color: #366CDA;
+  background-color: #366cda;
 }
-.title{
+.title {
   font-size: 16px;
   padding-left: 14px;
 }
-.right{
-  color: #366CDA;
+.right {
+  color: #366cda;
   float: right;
   font-size: 20px;
   cursor: default;
 }
 
-.leftArrow{
-  border: solid 20px ;
-  border-color: transparent #366CDA transparent  transparent ;
+.leftArrow {
+  border: solid 20px;
+  border-color: transparent #366cda transparent transparent;
 }
-.rightArrow{
-  border: solid 20px ;
-  border-color: transparent transparent  transparent #366CDA ;
+.rightArrow {
+  border: solid 20px;
+  border-color: transparent transparent transparent #366cda;
 }
-.typeList{
+.typeList {
   flex-grow: 1;
   display: flex;
 }
 
-.content{
+.content {
   height: 100%;
-  :global{
-    .ant-tabs-nav-wrap{
+  :global {
+    .antd5-tabs-nav-wrap {
       background: none;
     }
-    .ant-tabs-nav .ant-tabs-tab{
+    .antd5-tabs-nav .antd5-tabs-tab {
       padding: 2px 16px;
       background-color: #2196f330;
       border: none;
       margin: 0 6px;
     }
-    .ant-tabs-tab-active{
+    .antd5-tabs-tab-active {
       color: #fff !important;
-      background-color: #366CDA !important;
+      background-color: #366cda !important;
     }
-    .ant-tabs-tab:hover{
+    .antd5-tabs-tab:hover {
       color: #fff !important;
     }
-    .ant-tabs-bar{
+    .antd5-tabs-bar {
       margin: 0;
     }
-    // .ant-tabs-tab-prev-icon{
+    // .antd5-tabs-tab-prev-icon{
     //   border: solid 20px ;
     //   border-color: transparent #366CDA transparent  transparent ;
     //   i{
@@ -59,4 +59,4 @@
     //   }
     // }
   }
-}
+}

+ 1 - 1
src/components/UserDropdown/index.less

@@ -53,7 +53,7 @@
   }
   .root {
     :global {
-      .ant-dropdown {
+      .antd5-dropdown {
         padding-left: 14px;
         min-width: 102px;
       }

+ 24 - 24
src/global.less

@@ -101,7 +101,7 @@ input[type='reset'] {
   width: 100% !important;
   height: unset !important;
 }
-.ant-pro-global-header {
+.antd5-pro-global-header {
   background: transparent;
   background-image: url(@/assets/header.png);
   background-size: cover;
@@ -109,80 +109,80 @@ input[type='reset'] {
   margin-inline: 0;
   height: 79px;
 }
-.ant-pro-layout .ant-layout-header.ant-pro-layout-header {
+.antd5-pro-layout .antd5-layout-header.antd5-pro-layout-header {
   background-color: transparent;
   height: 79px;
 }
-.ant-layout .ant-layout-header {
+.antd5-layout .antd5-layout-header {
   height: 79px !important;
   line-height: 79px !important;
 }
-.ant-pro-global-header-logo img {
+.antd5-pro-global-header-logo img {
   height: 40px;
 }
-.ant-pro-global-header-logo-mix {
+.antd5-pro-global-header-logo-mix {
   margin-left: 62px;
 }
 
-.ant-layout-sider {
+.antd5-layout-sider {
   height: calc(100% - 79px) !important;
   inset-block-start: 79px !important;
   background-size: 132% 100% !important;
   background-image: url(@/assets/SideMenu/background.png) !important;
 }
 
-.ant-menu-title-content {
+.antd5-menu-title-content {
   font-size: 18px;
   color: #e8f7fc;
 }
 
-.ant-pro-base-menu-icon {
+.antd5-pro-base-menu-icon {
   height: 20px;
   width: 20px;
 }
-.ant-pro-base-menu-item-icon {
+.antd5-pro-base-menu-item-icon {
   margin-right: 10px;
 }
 
-.ant-menu-item,
-.ant-menu-submenu {
+.antd5-menu-item,
+.antd5-menu-submenu {
   margin-top: 15px !important;
   margin-bottom: 15px !important;
 }
 
-.ant-menu-item,
-.ant-menu-submenu-title {
+.antd5-menu-item,
+.antd5-menu-submenu-title {
   border-bottom: 1px solid !important;
   border-image: linear-gradient(#3e6ab4, #5bbdfa) 2 2 2 2 !important;
 }
 
-.ant-menu-sub {
+.antd5-menu-sub {
   margin-left: 32px !important;
-  .ant-menu-item {
+  .antd5-menu-item {
     margin-top: 10px !important;
     margin-bottom: 10px !important;
   }
-  .ant-menu-title-content {
+  .antd5-menu-title-content {
     font-size: 16px;
     color: #e8f7fc;
   }
 }
 
-.ant-menu-submenu-arrow {
+.antd5-menu-submenu-arrow {
   color: #e8f7fc !important;
 }
 
-.ant-menu-item-selected,
-.ant-pro-base-menu-collapsed
-  .ant-menu-submenu-selected
-  > .ant-menu-submenu-title,
-.ant-menu-item:active {
+.antd5-menu-item-selected,
+.antd5-pro-base-menu-collapsed
+  .antd5-menu-submenu-selected
+  > .antd5-menu-submenu-title,
+.antd5-menu-item:active {
   background-image: url(@/assets/SideMenu/selectedBackground.png);
   background-color: transparent !important;
 }
 
-.ant-menu-submenu-popup {
-  .ant-menu {
+.antd5-menu-submenu-popup {
+  .antd5-menu {
     background-color: #1b366f !important;
   }
 }

+ 56 - 0
src/pages/Cad/components/CadOADetail.js

@@ -0,0 +1,56 @@
+import AttachmentTable from '@/components/AttachmentTable';
+import { Card, Row, Col, Table } from 'antd';
+import { useRequest, useNavigate } from '@umijs/max';
+
+const CadOADetail = (props) => {
+  let navigate = useNavigate();
+  const { data, fileList } = props;
+
+  const cadData = data?.cad_path?.split(',').map((item) => {
+    //item是 地址/图纸名称
+    const names = item.split('/');
+    const name = names?.length > 1 ? names[1] : names[0];
+    return { path: item, name };
+  });
+
+  const columns = [
+    {
+      title: '图纸',
+      dataIndex: 'name',
+      key: 'name',
+    },
+    {
+      title: '操作',
+      render: (record) => (
+        <a
+          onClick={() =>
+            navigate('/cad/detail', {
+              state: {
+                path: record.path,
+              },
+            })
+          }
+        >
+          查看
+        </a>
+      ),
+    },
+  ];
+
+  return (
+    <Card title="图纸信息">
+      <div>所属项目:{data?.project_name}</div>
+      <div>图纸名称:{data?.name}</div>
+      <div>版本:{data?.version}</div>
+      <Row gutter={20}>
+        <Col span={12}>
+          <Table dataSource={cadData} columns={columns} />
+        </Col>
+        <Col span={12}>
+          <AttachmentTable excelFileList={fileList} />
+        </Col>
+      </Row>
+    </Card>
+  );
+};
+export default CadOADetail;

+ 94 - 0
src/pages/Cad/components/CreateChildrenModal.js

@@ -0,0 +1,94 @@
+import { CloudUploadOutlined } from '@ant-design/icons';
+import { Modal, Form, Input, Button } from 'antd';
+import { useEffect, useState } from 'react';
+
+const CreateChildrenModal = ({
+  loading,
+  parentId,
+  open,
+  onOk,
+  handleCancel,
+}) => {
+  const [form] = Form.useForm();
+  const layout = {
+    labelCol: { span: 6 },
+    wrapperCol: { span: 16 },
+  };
+  const [upLoading, setUpLoading] = useState([]);
+
+  useEffect(() => {
+    if (!open) return;
+    form.resetFields();
+  }, [open]);
+
+  function dwgUpload() {
+    let uploadDwg = document.getElementById('uploadDwg');
+    uploadDwg.click();
+  }
+
+  function uploadDwg(event) {
+    const selectedFile = event.target.files[0];
+    if (selectedFile) {
+      setUpLoading(true);
+      ZwCloud2D.ZwDataProcessor.uploadDwg(selectedFile).then((res) => {
+        if (res.code == 200) {
+          const oldPath = form.getFieldValue('cad_path');
+          const cad_path = oldPath
+            ? oldPath + ',' + res.data.path
+            : res.data.path;
+          form.setFieldsValue({ cad_path });
+        }
+        setUpLoading(false);
+      });
+    }
+  }
+
+  const handleOk = () => {
+    form.validateFields().then((values) => {
+      if (!values.cad_path) values.cad_path = 'test';
+      values.parent_id = parentId;
+      console.log(values);
+      onOk(values);
+    });
+  };
+
+  return (
+    <Modal
+      title="新建版本"
+      width={800}
+      open={open}
+      confirmLoading={loading}
+      onOk={handleOk}
+      onCancel={handleCancel}
+    >
+      <Form {...layout} name="basic" form={form}>
+        <Form.Item name="version" label="版本:" rules={[{ required: true }]}>
+          <Input />
+        </Form.Item>
+        <Form.Item name="cad_path" label="上传:">
+          <Button
+            loading={upLoading}
+            icon={<CloudUploadOutlined />}
+            onClick={dwgUpload}
+          >
+            上传
+          </Button>
+          {form.getFieldValue('cad_path')}
+        </Form.Item>
+        <Form.Item name="remark" label="备注:">
+          <Input.TextArea />
+        </Form.Item>
+      </Form>
+
+      <input
+        // multiple
+        style={{ display: 'none' }}
+        id="uploadDwg"
+        type="file"
+        onChange={uploadDwg}
+        accept=".dwg, .dxf"
+      />
+    </Modal>
+  );
+};
+export default CreateChildrenModal;

+ 251 - 0
src/pages/Cad/components/CreateModal.js

@@ -0,0 +1,251 @@
+import { advanceSubmitNextNode } from '@/services/boom';
+import { CloudUploadOutlined } from '@ant-design/icons';
+import { useModel, useRequest } from '@umijs/max';
+import {
+  Modal,
+  Form,
+  Input,
+  Upload,
+  Select,
+  Button,
+  Steps,
+  Row,
+  Col,
+  Cascader,
+} from 'antd';
+import { useEffect, useState } from 'react';
+import ApprovalProcess from '@/pages/Flow/components/ApprovalProcess';
+import { getRandomString } from '@/utils/utils';
+//计算审批流数据
+const advance = {
+  flow_id: 67,
+  form_list: null,
+  formComponentValues: '',
+};
+const formItemValues = [
+  {
+    name: '是否PID图和平面图',
+    id: 'DDSelectField_b8169258-d569-442e-a7b0-e2bd171aaac2',
+    type: 'DDSelectField',
+    value: [],
+  },
+  // {
+  //   name: '图纸审批"',
+  //   id: 'TextField_eb5b191b-6135-48ba-a01c-5609ed367d83"',
+  //   type: 'TextField',
+  //   value: [],
+  // },
+];
+
+const CreateModal = ({
+  loading,
+  projectList,
+  dirList,
+  open,
+  onOk,
+  handleCancel,
+}) => {
+  const { userList, run: userListRun } = useModel('userList');
+  const [form] = Form.useForm();
+  const layout = {
+    labelCol: { span: 6 },
+    wrapperCol: { span: 16 },
+  };
+  const [upLoading, setUpLoading] = useState([]);
+  const [auditCheck, setAuditCheck] = useState([]);
+  const [approvalProcess, setApprovalProcess] = useState([]);
+  const pic_type = Form.useWatch('pic_type', form);
+  const [cadPath, setCadPath] = useState([]);
+
+  useEffect(() => {
+    if (!open) return;
+    form.resetFields();
+    setApprovalProcess([]);
+    userListRun();
+    const params = { ...advance };
+    runAuditList(params);
+  }, [open]);
+
+  useEffect(() => {
+    const formComponentValues = [...formItemValues];
+    formComponentValues[0].value = [pic_type];
+    runAuditList({ ...advance, formComponentValues });
+  }, [pic_type]);
+
+  //填写表单时计算审批流接口
+  const { run: runAuditList } = useRequest(
+    (data) => advanceSubmitNextNode(data),
+    {
+      debounceInterval: 500,
+      manual: true,
+      formatResult(res) {
+        setApprovalProcess(res.data[0]);
+      },
+    },
+  );
+
+  function dwgUpload() {
+    let uploadDwg = document.getElementById('uploadDwg');
+    uploadDwg.click();
+  }
+
+  function uploadDwg(event) {
+    const selectedFile = event.target.files[0];
+    if (selectedFile) {
+      // ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
+      setUpLoading(true);
+      ZwCloud2D.ZwDataProcessor.uploadDwg(selectedFile).then((res) => {
+        if (res.code == 200) {
+          const oldPath = form.getFieldValue('cad_path');
+          const cad_path = oldPath
+            ? oldPath + ',' + res.data.path
+            : res.data.path;
+          form.setFieldsValue({ cad_path });
+        }
+        setUpLoading(false);
+      });
+    }
+  }
+  const UploadProps = {
+    action: `http://47.111.24.13:5121/sdk/doc/upload`,
+    multiple: true,
+    data: { path: getRandomString() },
+    headers: {
+      'JWT-TOKEN': localStorage.getItem('JWT-TOKEN'),
+    },
+    onChange({ file, fileList }) {
+      if (file.status !== 'uploading') {
+        setCadPath([...cadPath, file.response.data.path]);
+      }
+    },
+  };
+
+  const handleOk = () => {
+    let audit_list = [];
+    let cc_list = [];
+    approvalProcess?.forEach((item, index) => {
+      let arr = item[0].is_cc === 1 ? cc_list : audit_list;
+
+      if (item[0].type === 'role') arr.push(auditCheck[index]);
+      else if (item[0].type === 'leader')
+        arr.push(
+          ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
+        );
+      else arr.push(item.map((cur) => cur.value));
+    });
+
+    form.validateFields().then((values) => {
+      if (values.project_id)
+        values.project_name = projectList.find(
+          (item) => item.value == values.project_id,
+        )?.label;
+      if (values.dir_id) values.dir_name = values.dir_id.join(',');
+      values.dir_id = 0;
+      if (!values.cad_path) values.cad_path = cadPath.join(',');
+      console.log(values, audit_list);
+      onOk(values, { audit_list: audit_list.flat(), cc_list: cc_list.flat() });
+    });
+  };
+
+  return (
+    <Modal
+      title="新建图纸"
+      width={1200}
+      open={open}
+      confirmLoading={loading}
+      onOk={handleOk}
+      onCancel={handleCancel}
+    >
+      <Row gutter={24}>
+        <Col span={16}>
+          <Form {...layout} name="basic" form={form}>
+            <Form.Item
+              name="name"
+              label="图纸名称:"
+              rules={[{ required: true }]}
+            >
+              <Input />
+            </Form.Item>
+            <Form.Item
+              name="project_id"
+              label="所属项目:"
+              rules={[{ required: true }]}
+            >
+              <Select options={projectList} />
+            </Form.Item>
+            <Form.Item
+              name="dir_id"
+              label="归档目录:"
+              rules={[{ required: true }]}
+            >
+              <Cascader
+                options={dirList}
+                fieldNames={{
+                  label: 'value',
+                  value: 'value',
+                  children: 'children',
+                }}
+              />
+            </Form.Item>
+            <Form.Item
+              name="pic_type"
+              label="是否PID图和平面图"
+              rules={[{ required: true }]}
+            >
+              <Select
+                options={[
+                  {
+                    value: '是',
+                  },
+                  {
+                    value: '否',
+                  },
+                ]}
+              />
+            </Form.Item>
+            <Form.Item
+              name="version"
+              label="版本:"
+              rules={[{ required: true }]}
+            >
+              <Input />
+            </Form.Item>
+            <Form.Item label="上传:">
+              {/* <Button
+                loading={upLoading}
+                icon={<CloudUploadOutlined />}
+                onClick={dwgUpload}
+              >
+                上传
+              </Button> */}
+              <Upload {...UploadProps}>
+                <Button icon={<CloudUploadOutlined />}>Upload</Button>
+              </Upload>
+              {form.getFieldValue('cad_path')}
+            </Form.Item>
+            <Form.Item name="remark" label="备注:">
+              <Input.TextArea />
+            </Form.Item>
+          </Form>
+        </Col>
+        <Col span={8}>
+          <ApprovalProcess
+            leaderData={[]}
+            approvalProcess={approvalProcess}
+            onChange={setAuditCheck}
+          />
+        </Col>
+      </Row>
+
+      {/* <input
+        // multiple
+        style={{ display: 'none' }}
+        id="uploadDwg"
+        type="file"
+        onChange={uploadDwg}
+        accept=".dwg, .dxf"
+      /> */}
+    </Modal>
+  );
+};
+export default CreateModal;

+ 3 - 0
src/pages/Cad/components/index.less

@@ -0,0 +1,3 @@
+.modelItem {
+  margin: 0 40px;
+}

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

@@ -9,18 +9,19 @@ const CadDeTail = () => {
     state: { path },
   } = location;
 
+  console.log('-----path-------', path);
+
   useEffect(() => {
-    console.log(window);
     const content = document.getElementById('container');
-    window.ZwCloud2D.ZwEditor.ZwInit(content);
+    ZwCloud2D.ZwEditor.ZwInit(content);
 
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
-      'http://222.130.26.205:9080',
-      'http://222.130.26.205:5121',
-      'ws://222.130.26.205:5121',
+      'http://47.111.24.13:5121',
+      'ws://47.111.24.13:5121',
+      'http://47.111.24.13:5121',
     );
     ZwCloud2D.ZwDataProcessor.ZwSetLoadDwg(path);
-    window.ZwCloud2D.ZwDataProcessor.ZwLoad();
+    ZwCloud2D.ZwDataProcessor.ZwLoad();
   }, []);
   return (
     <PageContent>

+ 202 - 88
src/pages/Cad/index.js

@@ -1,145 +1,259 @@
 import { useRef, useEffect, useState } from 'react';
 import PageContent from '@/components/PageContent';
-import { queryCadList, queryCreateCad } from '@/services/cad';
+import {
+  queryCadDirList,
+  queryCadList,
+  queryCreateCad,
+  queryProject,
+} from '@/services/cad';
 import { useRequest, useNavigate } from '@umijs/max';
-import { Table, Button, message, Space } from 'antd';
+import { Table, Button, message, Space, Select, Input } from 'antd';
+import CreateModal from './components/CreateModal';
+import { createAduit } from '@/services/boom';
+import CreateChildrenModal from './components/CreateChildrenModal';
+import { queryCreateCadVer } from '../../services/cad';
 
 const CadDemo = () => {
   let navigate = useNavigate();
+  const [createLoading, setCreateLoading] = useState(false);
+  const [visible, setVisible] = useState(false);
+  const [childrenVisible, setChildrenVisible] = useState(false);
+  const [parentId, setParentId] = useState();
+  const [params, setParams] = useState({
+    // project_name: '',
+    // name: '',
+    page: 1,
+    page_size: 20,
+  });
+
+  const auditListRef = useRef();
+
   const columns = [
     {
       title: '名称',
       dataIndex: 'name',
       key: 'name',
-      align: 'center',
       width: 160,
     },
     {
-      title: '创建人',
-      dataIndex: 'created_by',
-      key: 'created_by',
-      align: 'center',
+      title: '所属项目',
+      dataIndex: 'project_name',
+      key: 'project_name',
       width: 120,
     },
-    {
-      title: '创建时间',
-      dataIndex: 'created_on',
-      key: 'created_on',
-      align: 'center',
-      width: 100,
-    },
     {
       title: '状态',
-      dataIndex: 'status',
-      key: 'status',
-      align: 'center',
+      // dataIndex: 'cad_status',
+      // key: 'cad_status',
       width: 100,
-      render: (status) => {
+      render: (record) => {
         let str = '';
         let color = 'black';
-        switch (status) {
+        switch (record.cad_status) {
           case 1:
-            str = '待审核';
-            color = 'blue';
+            str = '已归档';
+            color = 'green';
             break;
           case 2:
-            str = '审核通过';
-            color = 'red';
-            break;
-          case 3:
             str = '审核拒绝';
-            color = 'green';
+            color = 'red';
             break;
+          case 0:
+            str = '待审核';
+            color = 'blue';
         }
-        return <div style={{ color }}>{str}</div>;
+        return record.parent_id ? <div style={{ color }}>{str}</div> : '';
       },
     },
     {
       title: '操作',
-      align: 'center',
       width: '10%',
-      render: (record) => (
-        <Space>
-          <a
-            onClick={() =>
-              navigate('/cad/detail', {
-                state: {
-                  path: record.path,
-                },
-              })
-            }
-          >
-            详情
-          </a>
-          <a onClick={() => {}}>提审</a>
-        </Space>
-      ),
+      render: (record) => {
+        return (
+          <Space>
+            {record.canShow && (
+              <a
+                onClick={() =>
+                  navigate('/cad/detail', {
+                    state: {
+                      path: record.path,
+                    },
+                  })
+                }
+              >
+                查看
+              </a>
+            )}
+            {record.showCreate && (
+              <a
+                onClick={() => {
+                  setParentId(record.id);
+                  setChildrenVisible(true);
+                }}
+              >
+                新建
+              </a>
+            )}
+          </Space>
+        );
+      },
     },
   ];
-  const [uploading, setUpLoading] = useState(false);
+
+  const { data: projectList } = useRequest(queryProject, {
+    formatResult: (res) => {
+      return res?.data?.list?.map((item) => {
+        return { label: item.Name, value: item.ID };
+      });
+    },
+  });
+
+  //请求归档目录
+  const { data: dirList } = useRequest(queryCadDirList, {
+    formatResult: (res) => {
+      return res.data;
+    },
+  });
 
   //请求列表
-  const { data, run, loading } = useRequest(queryCadList);
+  const { data, run, loading } = useRequest(queryCadList, {
+    defaultParams: [params],
+    formatResult: (res) => {
+      res.data?.list?.forEach((item) => {
+        item.children?.forEach((cur) => {
+          cur.name = item.name + cur.version;
+          item.showCreate = cur.cad_status == 2 ? true : false;
+          if (cur.cad_path) {
+            const pathList = cur.cad_path.split(',');
+            cur.children = pathList.map((item) => {
+              const names = item.split('/');
+              const name = names?.length > 1 ? names[1] : names[0];
+              return {
+                name: name,
+                path: item,
+                canShow: true,
+                parent_id: cur.parent_id,
+              };
+            });
+          }
+        });
+      });
+      return res.data?.list;
+    },
+  });
 
-  //上传
-  const { run: runCreate } = useRequest((data) => queryCreateCad(data), {
+  //创建审批
+  const { run: runCreate } = useRequest(queryCreateCad, {
     manual: true,
-    onSuccess: () => {
-      run();
-      message.success('上传成功');
-      setUpLoading(false);
+    onSuccess: (data) => {
+      createOARun({
+        ...auditListRef.current,
+        extend_code: data.cad_id + '',
+        extend_type: 2, //2图纸
+      });
     },
   });
 
+  //创建子审批
+  const { run: runCreateVer, loading: loadingCreateVer } = useRequest(
+    queryCreateCadVer,
+    {
+      manual: true,
+      onSuccess: (data) => {
+        message.success('新建成功');
+        setChildrenVisible(false);
+        // createOARun({
+        //   ...auditListRef.current,
+        //   extend_code: data.cad_id + '',
+        //   extend_type: 2, //2图纸
+        // });
+      },
+    },
+  );
+
+  //发起OA审批
+  const { run: createOARun } = useRequest(
+    (data) => createAduit({ ...data, flow_id: 67, files: '' }),
+    {
+      manual: true,
+      onSuccess: () => {
+        run();
+        message.success('新建成功');
+        setVisible(false);
+        setCreateLoading(false);
+      },
+    },
+  );
+
   useEffect(() => {
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
-      'http://222.130.26.205:9080',
-      'http://222.130.26.205:5121',
-      'ws://222.130.26.205:5121',
+      'http://47.111.24.13:5121', //47.111.24.13
+      'ws://47.111.24.13:5121',
+      'http://47.111.24.13:5121',
     );
   }, []);
 
-  function uploadDwg(event) {
-    const selectedFile = event.target.files[0];
-    if (selectedFile) {
-      // ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
-      setUpLoading(true);
-      ZwCloud2D.ZwDataProcessor.uploadDwg(selectedFile).then((res) => {
-        if (res.code == 200) {
-          runCreate({ name: res.data.name, path: res.data.path });
-        }
-        setUpLoading(false);
-      });
-    }
-  }
-  function dwgUpload() {
-    let uploadDwg = document.getElementById('uploadDwg');
-    uploadDwg.click();
-  }
+  const handleCreate = (values, audit_list) => {
+    setCreateLoading(true);
+    auditListRef.current = audit_list;
+    runCreate(values);
+  };
 
   return (
     <PageContent>
-      <Button type="primary" onClick={dwgUpload}>
-        上传
-      </Button>
+      <Space>
+        <Button type="primary" onClick={() => setVisible(true)}>
+          新建图纸
+        </Button>
+        <div>
+          项目名称:
+          <Select
+            style={{ width: 130 }}
+            allowClear
+            options={projectList}
+            onChange={(value) => {
+              const project_name = projectList?.find(
+                (item) => item.value == value,
+              )?.label;
+              setParams({ ...params, project_name });
+            }}
+          />
+        </div>
+        <div>
+          图纸名称:
+          <Input
+            allowClear
+            style={{ width: '200px' }}
+            onChange={(e) => {
+              setParams({ ...params, name: e.target.value });
+            }}
+          />
+        </div>
+        <Button type="primary" onClick={() => run(params)}>
+          查询
+        </Button>
+      </Space>
       <Table
+        rowKey="id"
         loading={loading}
         columns={columns}
-        dataSource={data?.list}
+        dataSource={data}
         indentSize={70}
-        // pagination={{
-        //   ...pagination,
-        //   showSizeChanger: false,
-        //   onChange: onPageChange,
-        // }}
       />
-      {/* <div id="container"></div> */}
-      <input
-        style={{ display: 'none' }}
-        id="uploadDwg"
-        type="file"
-        onChange={uploadDwg}
-        accept=".dwg, .dxf"
+      <CreateModal
+        loading={createLoading}
+        dirList={dirList}
+        projectList={projectList}
+        open={visible}
+        onOk={handleCreate}
+        handleCancel={() => setVisible(false)}
+      />
+      <CreateChildrenModal
+        parentId={parentId}
+        loading={loadingCreateVer}
+        open={childrenVisible}
+        onOk={runCreateVer}
+        handleCancel={() => setChildrenVisible(false)}
       />
     </PageContent>
   );

+ 3 - 0
src/pages/FileManagement/index.js

@@ -550,6 +550,9 @@ function FileManagement(props) {
     } else if (node.id == 7) {
       //合同归档走合同接口
       runContract(req);
+    } else if (node.dir_type == 3) {
+      //图纸文件走 部门文件 接口
+      run({ ...req, dir_id: node.id });
     } else if (node.is_limit) {
       //其他受控文件走classify_id
       runOA({ ...req, classify_id: node.classify_id });

+ 1 - 1
src/pages/Flow/Audit.less

@@ -9,7 +9,7 @@
   align-items: center;
   margin-bottom: 20px;
   :global {
-    .ant-btn {
+    .antd5-btn {
       margin-right: 20px;
     }
   }

+ 133 - 23
src/pages/Flow/OaAuditDetail.js

@@ -1,37 +1,56 @@
 // 审批详情
 import React, { useState, useMemo, useEffect } from 'react';
-import { Steps, Button, Tooltip, message, Spin } from 'antd';
+import { Steps, Button, Tooltip, message, Spin, Upload } from 'antd';
 import { useRequest, useModel, useLocation } from 'umi';
 import AuditModal from './components/AuditModal';
+import AddCCModal from './components/AddCCModal';
 import FormAndFilesNode from './components/FormAndFilesNode';
-import { queryAuditDetail, updateAuditList } from '@/services/boom';
+import {
+  queryAuditDetail,
+  updateAuditList,
+  updateCCList,
+  uploadAttachment,
+} from '@/services/boom';
 import { queryGetContractList } from '@/services/contract';
 import PageContent from '@/components/PageContent';
 import SignModal from './components/SignModal';
 import ContractDetail from '../ContractManager/detail';
 import { Type } from '../Profile';
 import { queryContractDetail } from '../../services/contract';
+import { queryCadInfo } from '../../services/cad';
+import CadOADetail from '../Cad/components/CadOADetail';
 
 function OaAuditDetail(props) {
   const { initialState } = useModel('@@initialState');
   const user = initialState?.user || {};
+  const { userList, run: runUserList } = useModel('userList');
   const [auditVisible, setAuditVisible] = useState(false);
   const [visible, setVisible] = useState(false);
+  const [ccVisible, setCCVisible] = useState(false);
 
   const location = useLocation();
   const queryParams = new URLSearchParams(location.search);
   // 使用queryParams来获取特定查询参数
   const id = queryParams.get('id');
   const code = queryParams.get('code');
+  const type = queryParams.get('type') * 1 || Type.OA;
   const token = queryParams.get('JWT-TOKEN');
   if (!localStorage['JWT-TOKEN']) {
     localStorage['JWT-TOKEN'] = token;
   }
 
-  const type = code ? Type.CON : Type.OA;
+  // const type = code ? Type.CON : Type.OA;
 
   useEffect(() => {
-    if (type == Type.CON) runCon({ code });
+    runUserList();
+  }, []);
+
+  useEffect(() => {
+    if (type == Type.CON) {
+      runCon({ code });
+    } else if (type == Type.CAD) {
+      runCad({ cad_id: code * 1 });
+    }
   }, [type]);
 
   const { data, loading, refresh } = useRequest(queryAuditDetail, {
@@ -41,13 +60,13 @@ function OaAuditDetail(props) {
     current_seq,
     form,
     OaAuditList,
+    OaCcs = [],
     Files = [],
     audit_status,
     AuditorInfo,
   } = data || {};
   // if (OaAuditList) console.log(JSON.stringify(OaAuditList));
 
-  //请求列表
   const {
     data: conData,
     run: runCon,
@@ -57,18 +76,31 @@ function OaAuditDetail(props) {
     formatResult: (res) => {
       return res?.data?.detail;
     },
-    onSuccess: (res) => {},
   });
-  // console.log(conData);
 
-  const getDescription = (node) => {
+  const {
+    data: cadData,
+    run: runCad,
+    loading: loadingCad,
+  } = useRequest(queryCadInfo, {
+    manual: true,
+    formatResult: (res) => {
+      console.log(res);
+      return res?.data?.info;
+    },
+  });
+
+  const getDescription = (node, idx) => {
     let str = node?.AuditRoleInfo
       ? `审批人:${node?.AuditRoleInfo.Name || '-'}`
       : `审批人:${node?.AuditorUser.CName || '-'}`;
-    if (node.desc) {
-      return (
-        <div>
-          {str}
+
+    //最后一个审批节点显示抄送人信息
+    const showCCList = idx == OaAuditList?.length - 1 && OaCcs.length > 0;
+    return (
+      <div>
+        {str}
+        {node.desc && (
           <div>
             <Tooltip title={node.desc}>
               <span style={{ color: '#1A73E8', textDecoration: 'undeline' }}>
@@ -76,10 +108,15 @@ function OaAuditDetail(props) {
               </span>
             </Tooltip>
           </div>
-        </div>
-      );
-    }
-    return str;
+        )}
+        {showCCList && (
+          <div>
+            抄送人:
+            {OaCcs?.map((item) => item.User?.CName).join(',')}
+          </div>
+        )}
+      </div>
+    );
   };
   const updateRes = useRequest(
     (values) => {
@@ -107,6 +144,49 @@ function OaAuditDetail(props) {
     },
   );
 
+  //加抄送人
+  const { run: runCC, loading: loadingCC } = useRequest(
+    (ids) =>
+      updateCCList({
+        oa_id: Number(id),
+        audit_list: ids,
+      }),
+    {
+      manual: true,
+      onSuccess() {
+        message.success('添加抄送人成功');
+        setCCVisible(false);
+        refresh();
+      },
+    },
+  );
+
+  //上传附件
+  const { run: runAttach, loading: loadingAttach } = useRequest(
+    uploadAttachment,
+    {
+      manual: true,
+      onSuccess() {
+        message.success('上传成功');
+      },
+    },
+  );
+
+  const handleUploadClick = () => {};
+  const UploadProps = {
+    showUploadList: false,
+    action: `/api/v1/oa/attachment/${id}`,
+    headers: {
+      'JWT-TOKEN': localStorage.getItem('JWT-TOKEN'),
+    },
+    onChange({ file, fileList }) {
+      if (file.status !== 'uploading') {
+        console.log(fileList);
+        message.success('上传成功');
+      }
+    },
+  };
+
   const btns = useMemo(() => {
     if (!user || !data) return;
     if (
@@ -129,27 +209,56 @@ function OaAuditDetail(props) {
         <Button key={3} onClick={() => setVisible(true)}>
           加签
         </Button>,
+        <Button key={4} onClick={() => setCCVisible(true)}>
+          加抄送人
+        </Button>,
+        <Upload {...UploadProps}>
+          <Button>上传附件</Button>
+        </Upload>,
+        // <Button key={5} onClick={handleUploadClick}>
+        //   上传附件
+        // </Button>,
       ];
     }
     return [];
   }, [user, data]);
 
+  const renderDetail = () => {
+    let content = '';
+    switch (type) {
+      case Type.CAD:
+        content = <CadOADetail data={cadData} fileList={Files} />;
+        break;
+      case Type.CON:
+        content = <ContractDetail data={conData} />;
+        break;
+      default:
+        content = <FormAndFilesNode formData={form} fileList={Files} />;
+    }
+    return content;
+  };
+
   return (
     <PageContent extra={btns} loading={loading && conLoading}>
       <Steps
         style={{ marginBottom: 20 }}
         current={audit_status == 3 ? OaAuditList?.length : current_seq - 1}
         status={audit_status == 2 ? 'error' : 'process'}
-        items={OaAuditList?.map((item) => ({
+        items={OaAuditList?.map((item, idx) => ({
           title: item.seq_name,
-          description: getDescription(item),
+          description: getDescription(item, idx),
         }))}
       ></Steps>
-      {type == Type.OA ? (
-        <FormAndFilesNode formData={form} fileList={Files} />
-      ) : (
-        <ContractDetail data={conData} />
-      )}
+
+      {renderDetail()}
+
+      <AddCCModal
+        userList={userList}
+        visible={ccVisible}
+        onCancel={() => setCCVisible(false)}
+        onCreate={runCC}
+        loading={loadingCC}
+      />
 
       <AuditModal
         id={id}
@@ -158,6 +267,7 @@ function OaAuditDetail(props) {
         onOk={refresh}
       />
       <SignModal
+        userList={userList}
         visible={visible}
         onCancel={() => setVisible(false)}
         onCreate={(values) => updateRes.run(values)}

+ 47 - 0
src/pages/Flow/components/AddCCModal.js

@@ -0,0 +1,47 @@
+import { useState } from 'react';
+import { Modal, Form, Radio, Select, Button, message } from 'antd';
+import { useModel, useRequest } from '@umijs/max';
+
+const { Option } = Select;
+
+const AddCCModal = ({ userList, visible, onCancel, onCreate, loading }) => {
+  const [ids, setIds] = useState([]);
+
+  const handleOk = () => {
+    if (ids.length == 0) message.error('请选择抄送人');
+    onCreate(ids);
+  };
+
+  return (
+    <Modal
+      open={visible}
+      title="添加抄送人"
+      onCancel={onCancel}
+      onOk={handleOk}
+      destroyOnClose
+      confirmLoading={loading}
+    >
+      <div>
+        抄送人:
+        <Select
+          style={{ width: 200 }}
+          mode="multiple"
+          showSearch
+          filterOption={(input, option) =>
+            (option.children ?? '').toLowerCase().includes(input.toLowerCase())
+          }
+          placeholder="请选择抄送人"
+          onChange={(values) => setIds(values)}
+        >
+          {userList?.map((item) => (
+            <Option value={item.ID} key={item.ID}>
+              {item.CName}
+            </Option>
+          ))}
+        </Select>
+      </div>
+    </Modal>
+  );
+};
+
+export default AddCCModal;

+ 4 - 3
src/pages/Flow/components/SignModal.js

@@ -4,9 +4,8 @@ import { useModel, useRequest } from '@umijs/max';
 
 const { Option } = Select;
 
-const SignModal = ({ visible, onCancel, onCreate, loading }) => {
+const SignModal = ({ userList, visible, onCancel, onCreate, loading }) => {
   const [form] = Form.useForm();
-  const { userList } = useModel('userList');
 
   const handleOk = () => {
     form.validateFields().then((values) => {
@@ -43,7 +42,9 @@ const SignModal = ({ visible, onCancel, onCreate, loading }) => {
           <Select
             showSearch
             filterOption={(input, option) =>
-              (option.children ?? '').toLowerCase().includes(input.toLowerCase())
+              (option.children ?? '')
+                .toLowerCase()
+                .includes(input.toLowerCase())
             }
             placeholder="请选择审批人"
           >

+ 12 - 11
src/pages/Home/index.js

@@ -106,15 +106,16 @@ function HomePage(props) {
       },
       Icon: require('@/assets/UnityMenu/userCenter.png'),
     },
-    // {
-    //   id: 10,
-    //   name: 'cad管理',
-    //   active: true,
-    //   click: () => {
-    //     navigate('/cad');
-    //   },
-    //   Icon: require('@/assets/UnityMenu/cad.png'),
-    // },
+    {
+      id: 11,
+      name: 'cad管理',
+      active: true,
+      permission: true,
+      click: () => {
+        navigate('/cad');
+      },
+      Icon: require('@/assets/UnityMenu/cad.png'),
+    },
     {
       id: 10,
       name: 'Scada功能',
@@ -139,8 +140,8 @@ function MenuContent({ list }) {
   const row = useMemo(() => {
     const result = [];
     const rightList = list.filter((item) => item.permission);
-    for (let i = 0; i < list.length; i += 5) {
-      result.push(rightList.slice(i, i + 5));
+    for (let i = 0; i < list.length; i += 6) {
+      result.push(rightList.slice(i, i + 6));
     }
     return result;
   }, [list]);

+ 1 - 1
src/pages/Home/index.less

@@ -15,7 +15,7 @@
 
   // align-items: flex-start;
   :global {
-    .ant-popover-inner {
+    .antd5-popover-inner {
       background: #0d1a2b;
     }
   }

+ 9 - 2
src/pages/Profile/index.js

@@ -20,6 +20,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons';
 export const Type = {
   OA: 1,
   CON: 2,
+  CAD: 3,
 };
 
 function profile(props) {
@@ -84,8 +85,14 @@ function profile(props) {
                 <a
                   style={{ color: '#4096ff' }}
                   onClick={() => {
-                    if (record.extend_code) {
-                      navigate(`/profile/detail?id=${record.id}&code=${record.extend_code}`);
+                    if (record.extend_type == 2) {
+                      navigate(
+                        `/profile/detail?id=${record.id}&code=${record.extend_code}&type=${Type.CAD}`,
+                      );
+                    } else if (record.extend_code) {
+                      navigate(
+                        `/profile/detail?id=${record.id}&code=${record.extend_code}&type=${Type.CON}`,
+                      );
                     } else {
                       navigate(`/profile/detail?id=${record.id}`);
                     }

+ 17 - 0
src/services/boom.js

@@ -261,3 +261,20 @@ export async function updateAuditList(data, isAfter) {
   }
   return res;
 }
+//添加抄送人
+export async function updateCCList(data) {
+  let res = await request(`/api/v1/oa/submit/add-cc`, {
+    method: 'POST',
+    data,
+  });
+  return res;
+}
+
+//审批时上传附加
+export async function uploadAttachment(data) {
+  let res = await request(`/api/v1/oa/attachment/184`, {
+    method: 'POST',
+    data,
+  });
+  return res;
+}

+ 38 - 2
src/services/cad.js

@@ -1,10 +1,46 @@
 import { request } from 'umi';
-export const queryCadList = async () => {
-  return await request('/api/contract/v1/cad');
+export const queryCadList = async (data) => {
+  return await request('/api/archive/v1/cad/list', {
+    method: 'POST',
+    data,
+  });
 };
+//创建审批
 export async function queryCreateCad(data) {
+  return request(`/api/archive/v1/cad/create`, {
+    method: 'POST',
+    data,
+  });
+}
+
+//创建子审批
+export async function queryCreateCadVer(data) {
+  return request(`/api/archive/v1/cad/create/ver`, {
+    method: 'POST',
+    data,
+  });
+}
+export const queryProject = async () => {
+  return await request('/api/v2/project');
+};
+
+export async function queryCreateCadOld(data) {
   return request(`/api/contract/v1/cad`, {
     method: 'POST',
     data,
   });
 }
+//请求审批详情
+export async function queryCadInfo(data) {
+  return request(`/api/archive/v1/cad/info`, {
+    method: 'POST',
+    data,
+  });
+}
+//请求归档目录列表
+export async function queryCadDirList(data) {
+  return request(`/api/archive/v1/cad/dir-list`, {
+    method: 'POST',
+    data,
+  });
+}

+ 14 - 5
src/utils/utils.js

@@ -4,7 +4,7 @@ export const clearToken = () => {
   localStorage.setItem('JWT-TOKEN', '');
 };
 
-export const storeToken = token => {
+export const storeToken = (token) => {
   localStorage.setItem('JWT-TOKEN', token);
 };
 
@@ -20,7 +20,6 @@ export const getToken = () => {
  * <a href="url" download/>
  */
 export const downloadFile = (url, fileName, encode = true) => {
-  
   const downloadLink = document.createElement('a');
   const body = document.documentElement || document.body;
   body.appendChild(downloadLink);
@@ -49,7 +48,9 @@ export function IsImageFile(fileName) {
 }
 
 export function IsVedio(fileName) {
-  return fileName.lastIndexOf('.mp4') !== -1 || fileName.lastIndexOf('.avi') !== -1;
+  return (
+    fileName.lastIndexOf('.mp4') !== -1 || fileName.lastIndexOf('.avi') !== -1
+  );
 }
 
 export function GetTokenFromUrl() {
@@ -96,7 +97,7 @@ export function getUser(params) {
     return;
   } else {
     return (arr = params
-      .map(item => {
+      .map((item) => {
         return item.Operator?.CName;
       })
       .join(','));
@@ -124,7 +125,7 @@ export const UnityAction = {
   emit(type, e) {
     if (!UnityAction.event[type]) return;
     console.log('emit====== type:', type, '====== event:', e);
-    UnityAction.event[type].forEach(item => {
+    UnityAction.event[type].forEach((item) => {
       item && item(e);
     });
   },
@@ -215,3 +216,11 @@ export function getData(key) {
 export function clearData(key) {
   localStorage.setItem(key, '');
 }
+
+export function getRandomString(length = 6) {
+  var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+  var result = '';
+  for (var i = length; i > 0; --i)
+    result += str[Math.floor(Math.random() * str.length)];
+  return result;
+}

Some files were not shown because too many files changed in this diff