Просмотр исходного кода

update: 减少guid方法定义

cfort 2 лет назад
Родитель
Сommit
f6c3195f0a

+ 0 - 10
src/api/platform/file/attachment.js

@@ -202,13 +202,3 @@ export function snapshoot(params) {
     params: params
   })
 }
-
-export function generateUUID() {
-  var d = new Date().getTime();
-  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
-    var r = (d + Math.random() * 16) % 16 | 0;
-    d = Math.floor(d / 16);
-    return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
-  });
-  return uuid;
-};

+ 2 - 12
src/api/platform/form/seal.js

@@ -2,6 +2,7 @@ import request from '@/utils/request'
 import { FORM_URL } from '@/api/baseUrl'
 import { BASE_SEAL_API } from '@/constant'
 import axios from 'axios'
+import Utils from '@/utils/util'
 
 const BASE_URL = process.env.VUE_APP_BASE_URL
 
@@ -76,7 +77,7 @@ export function seal (url, fileType, type) {
         // "ruleName": "6aqR57yd56ug6KeE5YiZLOmmlumhteeblueroA==",
         'ruleName': type,
         'provideSigFile': Base64.encode(url),
-        'fileKey': Base64.encode(generateUUID() + '.' + fileType)
+        'fileKey': Base64.encode(Utils.guid() + '.' + fileType)
     }
     return axios({
         url: `${BASE_URL}doSeal/`,
@@ -110,14 +111,3 @@ export function getSigPageUrl (sigFile) {
     const sigUrl = `${BASE_SEAL_API}manualSig/manualSigPage/?signKey=V1FTMjAyMTEyMjFkOTVjNWM=&signSecret=YWQwMmY3ZjQ4ZDJmMmYwNDA=&sigFile=${sigFile}`
     return sigUrl
 }
-
-export function generateUUID () {
-    var d = new Date().getTime()
-    var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
-        var r = (d + Math.random() * 16) % 16 | 0
-        d = Math.floor(d / 16)
-        return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
-    })
-    return uuid
-}
-

+ 2 - 2
src/utils/common.js

@@ -9,7 +9,7 @@ import { getNextIdByAlias } from '@/api/platform/system/identity'
 import { save as sendMsg } from '@/api/platform/message/innerMessage'
 import { save as saveNews } from '@/api/platform/system/news'
 import { bpmTaskSave } from '@/api/platform/bpmn/bpmTask'
-import { onlyOfficeToPdf, generateUUID } from '@/api/platform/form/seal'
+import { onlyOfficeToPdf } from '@/api/platform/form/seal'
 import { downloadFile as download } from '@/business/platform/file/utils'
 import { removeFormData } from '@/api/platform/data/dataTemplate'
 // 引入工具类
@@ -171,7 +171,7 @@ export default {
     getDateNow,
     getFormatDate,
     onlyOfficeToPdf,
-    generateUUID,
+    generateUUID: Utils.guid,
     download,
     removeFormData,
     replaceNullWithEmpty,

+ 2 - 4
src/views/platform/message/inner/detail/dialog.vue

@@ -32,9 +32,7 @@
 </template>
 <script>
 import InnerMessage from './index'
-import {
-    generateUUID
-} from '@/api/platform/file/attachment'
+
 export default {
     components: { InnerMessage },
     props: {
@@ -160,7 +158,7 @@ export default {
                     }
                     if (!cont2.length) {
                         const tempObj = {
-                            id_: generateUUID(),
+                            id_: this.$utils.guid(),
                             parent_id_: this.tableId,
                             tong_zhi_bu_men_: position,
                             que_ren_qian_ming: JSON.stringify([{