Browse Source

修改bug

bill 1 năm trước cách đây
mục cha
commit
0b0b1a783c
2 tập tin đã thay đổi với 25 bổ sung13 xóa
  1. 3 1
      src/constant/caseFile.ts
  2. 22 12
      src/view/case/addCaseFile.vue

+ 3 - 1
src/constant/caseFile.ts

@@ -2,10 +2,12 @@ import { BoardType } from "@/store/caseFile";
 
 export const FileDrawType = 1;
 export const DrawFormats = [".jpg", ".jpeg", ".png"];
-export const OtherFormats = [".pdf", ".word", ".jpg", ".png"];
+export const OtherFormats = [".pdf", ".jpeg", ".doc", ".docx", ".jpg", ".png"];
 export const BoardTypeDesc = {
   [BoardType.scene]: "现场图",
   [BoardType.map]: "方位图",
 };
+export const DrawFormatDesc = "jpg、png等格式的文件";
+export const OtherFormatDesc = "pdf、word、jpg、png等格式的文件";
 
 export const maxFileSize = 100 * 1024 * 1024;

+ 22 - 12
src/view/case/addCaseFile.vue

@@ -5,14 +5,6 @@
     label-width="90px"
     class="camera-from dispatch-file-from"
   >
-    <el-form-item label="附件标题:" class="mandatory">
-      <el-input
-        v-model="caseFile.filesTitle"
-        placeholder="请输入最多不能超过50字"
-        maxlength="50"
-        show-word-limit
-      ></el-input>
-    </el-form-item>
     <el-form-item label="附件:" class="mandatory">
       <el-upload
         class="upload-demo"
@@ -29,20 +21,34 @@
           <el-icon><Upload /></el-icon>上传
         </el-button>
         <template v-slot:tip>
-          <div class="el-upload__tip">注:可上传{{ size }}以内的{{ format }}</div>
+          <div class="el-upload__tip">注:可上传{{ size }}以内的{{ formatDesc }}</div>
         </template>
       </el-upload>
     </el-form-item>
+    <el-form-item label="附件标题:" class="mandatory">
+      <el-input
+        v-model="caseFile.filesTitle"
+        placeholder="请输入最多不能超过50字"
+        maxlength="50"
+        show-word-limit
+      ></el-input>
+    </el-form-item>
   </el-form>
 </template>
 
 <script setup lang="ts">
-import { DrawFormats, FileDrawType, OtherFormats } from "@/constant/caseFile";
+import {
+  DrawFormatDesc,
+  DrawFormats,
+  FileDrawType,
+  OtherFormatDesc,
+  OtherFormats,
+} from "@/constant/caseFile";
 import { maxFileSize } from "@/constant/caseFile";
 import { useUpload } from "@/hook/upload";
 import { CaseFile, addCaseFile } from "@/store/caseFile";
 import { ElMessage } from "element-plus";
-import { ref, watchEffect } from "vue";
+import { computed, ref, watchEffect } from "vue";
 import { QuiskExpose } from "@/helper/mount";
 
 const props = defineProps<{
@@ -56,11 +62,15 @@ const caseFile = ref<CaseFile>({
   filesTitle: "",
 } as any);
 
-const { size, format, upload, removeFile, previewFile, file, accept } = useUpload({
+const { size, upload, removeFile, previewFile, file, accept } = useUpload({
   maxSize: maxFileSize,
   formats: props.fileType === FileDrawType ? DrawFormats : OtherFormats,
 });
 
+const formatDesc = computed(() =>
+  props.fileType === FileDrawType ? DrawFormatDesc : OtherFormatDesc
+);
+
 watchEffect(() => {
   if (file.value?.name) {
     caseFile.value.filesTitle = file.value?.name;