Browse Source

Merge branch 'master' of http://gogs.gisvg.com/YDM/museums-ui

wwj 2 months ago
parent
commit
a9b60f1f5f

+ 17 - 0
src/components/UploadFile/src/UploadFile.vue

@@ -36,7 +36,18 @@
         <div class="flex items-center">
           <span>{{ row.file.name }}</span>
           <div class="ml-10px">
+
+<!--            pdf或者图片       -->
+            <el-link  v-if="isPdfOrImage(row.file)"
+                      type="success"
+                     :href="row.file.url"
+                     :underline="false"
+                     target="_blank">
+              预览
+            </el-link>
+<!--            其他文件    -->
             <el-link
+              v-else
               :href="row.file.url"
               :underline="false"
               download
@@ -127,6 +138,12 @@ const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
 // const handleFileChange = (uploadFile: UploadFile): void => {
 //   uploadRef.value.data.path = uploadFile.name
 // }
+
+// 判断是否为 PDF 或图片
+const isPdfOrImage = (file: UploadUserFile): boolean => {
+  const fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1).toLowerCase()
+  return ['pdf', 'png', 'jpg', 'jpeg'].includes(fileExtension)
+}
 // 文件上传成功
 const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
   message.success('上传成功')

+ 49 - 8
src/views/museums/specimeninfo/index.vue

@@ -861,7 +861,8 @@ const onSubmit = async () => {
         .filter(Boolean) // 过滤掉空字符串
         .join('\n') // 每个内容项换行
       console.log('content',content)
-      const subtitle = formData.value.content2  ? '(' + item[formData.value.content2] + ')' : ''
+      const subtitle = formData.value.content2  ? item[formData.value.content2] : undefined
+      console.log('subtitle',subtitle)
       return {
         title: item[formData.value.content],
         subtitle:subtitle, // 添加副标题
@@ -876,12 +877,21 @@ const onSubmit = async () => {
       const canvas = document.createElement('canvas')
       const ctx = canvas.getContext('2d')
       if (ctx) {
+        //内容项数量
+        const lines = label.content.split('\n')
+        console.log('lines',lines)
         const size = formData.value.sizeMap[formData.value.size]
         canvas.width = size.width
         canvas.height = size.height
         ctx.fillStyle = 'white'
         ctx.fillRect(0, 0, canvas.width, canvas.height)
 
+        // 绘制黑色边框
+        ctx.strokeStyle = 'black'
+        ctx.lineWidth = 0.5
+        ctx.strokeRect(0, 0, canvas.width, canvas.height)
+
+
         // 设置文本对齐方式为居中
         ctx.textAlign = 'center'
         // 设置字体样式
@@ -889,19 +899,41 @@ const onSubmit = async () => {
         // 设置文本颜色
         ctx.fillStyle = 'black'
         // 绘制标题
-        if (label.subtitle && label.subtitle !== '') {
-          ctx.fillText(label.title, canvas.width / 2, size.height * 0.2)
+        if (lines.length>3){
+          if (label.subtitle && label.subtitle !== '') {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.2)
+          }else {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.3)
+          }
+        }else if (lines.length>2){
+          if (label.subtitle && label.subtitle !== '') {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.25)
+          }else {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.32)
+          }
         }else {
-          ctx.fillText(label.title, canvas.width / 2, size.height * 0.3)
+          if (label.subtitle && label.subtitle !== '') {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.3)
+          }else {
+            ctx.fillText(label.title, canvas.width / 2, size.height * 0.35)
+          }
         }
 
 
+
+
         // 添加副标题
         if (label.subtitle && label.subtitle !== '') {
         ctx.textAlign = 'center'
-        ctx.font = `${(size.width + size.height) * 0.03}px Times New Roman`
+        ctx.font = `${(size.width + size.height) * 0.037}px Times New Roman`
         ctx.fillStyle = 'black'
-        ctx.fillText(label.subtitle, canvas.width / 2, size.height * 0.3)
+          if (lines.length>3) {
+            ctx.fillText('(' + label.subtitle + ')', canvas.width / 2, size.height * 0.3)
+          }else if (lines.length>2){
+            ctx.fillText('(' + label.subtitle + ')', canvas.width / 2, size.height * 0.35)
+          }else {
+            ctx.fillText('(' + label.subtitle + ')', canvas.width / 2, size.height * 0.40)
+          }
         }
 
 
@@ -910,8 +942,15 @@ const onSubmit = async () => {
         // 设置字体样式
         ctx.font = `${(size.width+size.height) * 0.03}px 方正黑体简`
         // 绘制内容
-        const lines = label.content.split('\n')
-        let y = size.height * 0.45
+        let y
+        if (lines.length>3) {
+          y = size.height * 0.46
+        }else if (lines.length>2){
+          y = size.height * 0.50
+        }else {
+          y = size.height * 0.55
+        }
+
         for (const line of lines) {
           ctx.fillText(line, size.width * 0.15, y)
           y += Math.min(size.width, size.height) * 0.15 // 每行间隔
@@ -938,6 +977,8 @@ const onSubmit = async () => {
     dialogTableVisible.value = false
   }
 }
+
+
 </script>
 
 

+ 1 - 1
src/views/museums/specimenoutbound/ApproalProcess.vue

@@ -116,7 +116,7 @@
 
         <el-table-column label="借用起止时间" align="center" prop="sampleStatus" width="200px">
           <template #default="scope">
-            {{formatDate(scope.row.approvalTime, 'YYYY-MM-DD')}}--{{formatDate(scope.row.twoApprovalTime, 'YYYY-MM-DD')}}
+            {{formatDate(scope.row.startTime, 'YYYY-MM-DD')}}--{{formatDate(scope.row.endTime, 'YYYY-MM-DD')}}
           </template>
         </el-table-column>
         <el-table-column label="附件" align="center" prop="attachments">

+ 15 - 17
src/views/museums/specimenoutbound/OutboundForm/ApproalDetails.vue

@@ -49,20 +49,19 @@
                     outboundData.projectName
                   }}
                 </el-descriptions-item>
-                <el-descriptions-item label="项目开始时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.startTime
-                  }}
+                <el-descriptions-item label="借用起止时间:" label-align="right"
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.startTime, 'YYYY-MM-DD')}}--{{formatDate(outboundData.endTime, 'YYYY-MM-DD')}}
                 </el-descriptions-item>
-                <el-descriptions-item label="项目结束时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.endTime
+                <el-descriptions-item label="申请备注:" label-align="right"
+                                      label-class-name="my-label">
+                  {{
+                    outboundData.outboundRemarks
                   }}
                 </el-descriptions-item>
                 <el-descriptions-item label="一级审批时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.approvalTime
-                  }}
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.approvalTime)}}
                 </el-descriptions-item>
                 <el-descriptions-item label="一级审批员:" label-align="right"
                                       label-class-name="my-label">{{
@@ -83,9 +82,8 @@
                 :size="size"
                 border>
                 <el-descriptions-item label="二级审批时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.twoApprovalTime
-                  }}
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.twoApprovalTime)}}
                 </el-descriptions-item>
                 <el-descriptions-item label="二级审批员:" label-align="right"
                                       label-class-name="my-label">{{
@@ -98,16 +96,16 @@
                   }}
                 </el-descriptions-item>
                 <el-descriptions-item label="出库时间:" label-align="right"
-                                      label-class-name="my-label">{{ outboundData.outgoingTime }}
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.outgoingTime)}}
                 </el-descriptions-item>
                 <el-descriptions-item label="出库员:" label-align="right" label-class-name="my-label">
                   {{ outboundData.operator }}
                 </el-descriptions-item>
 
                 <el-descriptions-item label="退还日期:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.returnDate
-                  }}
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.returnDate)}}
                 </el-descriptions-item>
                 <el-descriptions-item label="退还人:" label-align="right"
                                       label-class-name="my-label">{{

+ 7 - 7
src/views/museums/specimenoutbound/OutboundForm/outboundDetail.vue

@@ -40,14 +40,14 @@
                     outboundData.projectName
                   }}
                 </el-descriptions-item>
-                <el-descriptions-item label="项目开始时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.startTime
-                  }}
+                <el-descriptions-item label="借用起止时间:" label-align="right"
+                                      label-class-name="my-label">
+                  {{formatDate(outboundData.startTime, 'YYYY-MM-DD')}}--{{formatDate(outboundData.endTime, 'YYYY-MM-DD')}}
                 </el-descriptions-item>
-                <el-descriptions-item label="项目结束时间:" label-align="right"
-                                      label-class-name="my-label">{{
-                    outboundData.endTime
+                <el-descriptions-item label="申请备注:" label-align="right"
+                                      label-class-name="my-label">
+                  {{
+                    outboundData.outboundRemarks
                   }}
                 </el-descriptions-item>
                 <el-descriptions-item label="一级审批时间:" label-align="right"

+ 1 - 1
src/views/museums/specimenoutbound/OutboundManagement.vue

@@ -120,7 +120,7 @@
       </el-table-column>
       <el-table-column label="借用起止时间" align="center" prop="sampleStatus" width="200px">
         <template #default="scope">
-          {{formatDate(scope.row.approvalTime, 'YYYY-MM-DD')}}--{{formatDate(scope.row.twoApprovalTime, 'YYYY-MM-DD')}}
+          {{formatDate(scope.row.startTime, 'YYYY-MM-DD')}}--{{formatDate(scope.row.endTime, 'YYYY-MM-DD')}}
         </template>
       </el-table-column>
       <el-table-column

+ 1 - 1
src/views/museums/specimenoutbound/SpecimenOutboundForm.vue

@@ -60,8 +60,8 @@
           v-model="formData.attachments"
           :limit="1"
           class="min-w-80px"
+          :fileSize="20"
         />
-
       </el-form-item>
 
       <el-form-item label="借用开始时间" prop="outgoingTime" label-width="150px">