songxy hace 1 año
padre
commit
91b86b4962

+ 2 - 2
client/.env.dev

@@ -5,8 +5,8 @@ VITE_DEV=false
 
 # 请求路径
 # VITE_BASE_URL='http://10.10.9.113:48080'
-# VITE_BASE_URL='http://10.10.10.7:18080'
-VITE_BASE_URL='http://oa.zjugis.com:28080'
+VITE_BASE_URL='http://10.10.10.7:18080'
+# VITE_BASE_URL='http://oa.zjugis.com:28080'
 
 # VITE_BASE_URL='http://10.10.9.168:48080'
 

+ 13 - 3
client/src/components/Tinymce/Tinymce.vue

@@ -67,7 +67,14 @@ function buildShortUUID(prefix = '') {
   const random = Math.floor(Math.random() * 1000000000)
   return prefix + '_' + random + String(time)
 }
-
+function buildUUID() {
+  const date = new Date()
+  const uuid =
+    Math.random().toString().replace('.', '') +
+    Math.random().toString().replace('.', '') +
+    date.getTime()
+  return uuid
+}
 function onMountedOrActivated(hook) {
   let mounted
   onMounted(() => {
@@ -146,10 +153,13 @@ const initOptions = computed(() => {
     content_css: '/resource/tinymce/skins/ui/oxide/content.min.css',
     images_upload_handler(blobInfo, succFun, failFun) {
       const file = blobInfo.blob()
-      console.log(file)
       const url = import.meta.env.VITE_UPLOAD_URL
       const formData = new FormData()
-      formData.append('path', file['name'])
+      const arr = file.name.split('.')
+      if (arr.length > 1) {
+        const suffix = arr[arr.length - 1]
+        formData.append('path', `${buildUUID()}.${suffix}`)
+      }
       formData.append('file', file)
       request.upload({ url: url, data: formData }).then((result) => {
         succFun(result['data'])

+ 11 - 0
client/src/utils/index.ts

@@ -138,6 +138,17 @@ export const generateUUID = () => {
   })
 }
 
+/**
+ * 获取文件格式
+ */
+export const getFileSuffix = (fileName: string) => {
+  if (!fileName) return
+  const arr = fileName.split('.')
+  if (arr.length > 1) {
+    return arr[arr.length - 1]
+  }
+  return
+}
 /**
  * element plus 的文件大小 Formatter 实现
  *

+ 1 - 1
client/src/views/OaSystem/marketCenter/contractSubOut/applyIndex.vue

@@ -121,7 +121,7 @@
           </el-table-column>
           <el-table-column label="状态" width="120">
             <template #default="scope">{{
-              scope.row.contractSubFlowStatus === 90 ? '已付清' : '未付清'
+              (scope.row.contractSubFlowStatus != 90 && isSignType[scope.row.isSign] === '是') ? '未签' : ((scope.row.contractAmount - (scope.row.payAmount ?? 0)) === 0 ? '已付清' : '未付清') 
             }}</template>
           </el-table-column>
           <el-table-column label="操作" fixed="right" align="center" width="200">

+ 5 - 1
client/src/views/OaSystem/newsCenter/newsSetting/editor.vue

@@ -261,7 +261,11 @@ async function uploadFileAjax(file: any): Promise<void> {
     Math.random().toString().replace('.', '') +
     Math.random().toString().replace('.', '') +
     date.getTime()
-  sendFData.append('path', uuid)
+  const arr = file.name.split('.')
+  if (arr.length > 1) {
+    const suffix = arr[arr.length - 1]
+    sendFData.append('path', `${uuid}.${suffix}`)
+  }
   sendFData.append('file', file)
   const result = await request.upload({ url: url, data: sendFData })
   formData.value.imgurl = coverImg.value = result['data']

+ 1 - 1
client/src/views/OaSystem/officeCenter/noticeAndLearn/add.vue

@@ -48,7 +48,7 @@ import { useRoute } from 'vue-router'
 import { ElMessage, FormRules, FormInstance } from 'element-plus'
 import request from '@/config/axios'
 import router from '@/router'
-import { useFiles } from './mixins.ts'
+import { useFiles } from './mixins'
 
 const { fileUrls, downloadFile, uploadFile, deleteFile } = useFiles(request)
 

+ 2 - 2
client/src/views/OaSystem/officeCenter/noticeAndLearn/detail.vue

@@ -12,7 +12,7 @@
           <ul class="prviewFile">
             <li v-for="(item, index) in fileUrls" :key="index">
               <span>
-                <a href="javascript:void(0);" @click="downloadFile(item['url'])">{{
+                <a href="javascript:void(0);" @click="previewFile(item['url'])">{{
                   item['name']
                 }}</a>
               </span>
@@ -44,7 +44,7 @@ const detailForm = ref<{
 })
 const preVisiable = ref<boolean>(false)
 const currentUrl = ref<string>()
-const downloadFile = (url) => {
+const previewFile = (url) => {
   preVisiable.value = true
   // currentUrl.value = 'http://localhost:3000/test.pdf'
   currentUrl.value = url

+ 1 - 1
client/src/views/OaSystem/officeCenter/noticeAndLearn/editor.vue

@@ -48,7 +48,7 @@ import { useRoute } from 'vue-router'
 import { ElMessage, FormRules, FormInstance } from 'element-plus'
 import request from '@/config/axios'
 import router from '@/router'
-import { useFiles } from './mixins.ts'
+import { useFiles } from './mixins'
 
 const { fileUrls, downloadFile, queryFiles, uploadFile, deleteFile } = useFiles(request)
 

+ 6 - 1
client/src/views/OaSystem/officeCenter/noticeAndLearn/mixins.ts

@@ -1,3 +1,4 @@
+import { generateUUID, getFileSuffix } from '@/utils/index'
 interface FileInterface {
   id: number
   name: string
@@ -14,10 +15,13 @@ export const useFiles = (request: any) => {
       fileUrls.value = result
     }
   }
+  async function downloadFile(fileUrl: string): Promise<void> {
+    window.open(fileUrl)
+  }
   async function uploadFile(file: any): Promise<void> {
     const url = `${import.meta.env.VITE_FILE_BASE_URI}/upload-and-get-id`
     const sendFData = new FormData()
-    sendFData.append('path', file.name)
+    sendFData.append('path', `${generateUUID()}.${getFileSuffix(file.name)}`)
     sendFData.append('file', file)
     const result = await request.upload({ url: url, data: sendFData })
     const resultData = result.data
@@ -51,6 +55,7 @@ export const useFiles = (request: any) => {
     fileUrls,
     queryFiles,
     uploadFile,
+    downloadFile,
     deleteFile
   }
 }