fan 2 лет назад
Родитель
Сommit
eea586a8b3

+ 1 - 4
src/components/XTUpload/src/XTUpload.vue

@@ -156,10 +156,6 @@
         };
         // 生成文件列表
         fileListRef.value = [...unref(fileListRef), commonItem];
-        console.log(
-          '🚀 ~ file: XTUpload.vue:114 ~ beforeUpload ~ fileListRef.value:',
-          fileListRef.value,
-        );
         await handleStartUpload();
         return false;
         // return false 会停止自动上传
@@ -271,6 +267,7 @@
               return result;
             }),
           );
+          emit('change', fileList.value);
           isUploadingRef.value = false;
           // 生产环境:抛出错误
           const errorList = data.filter((item: any) => !item.success);

+ 0 - 4
src/views/biz/archives/medicalDocuments/FormModal.vue

@@ -72,10 +72,6 @@
       const values = await validate();
       setModalProps({ confirmLoading: true });
       values.patientBasicId = patientBasicId.value;
-      console.log('🚀 ~ file: FormModal.vue:71 ~ handleSubmit ~ values:', {
-        ...values,
-        id: rowId.value,
-      });
       values.fileIds = values.files && values.files.map(ele => ele.id);
       console.log('🚀 ~ file: FormModal.vue:71 ~ handleSubmit ~ values:', {
         ...values,

+ 12 - 6
src/views/biz/archives/medicalDocuments/data.ts

@@ -47,12 +47,18 @@ export const dataFormSchema: FormSchema[] = [
     label: '文书上传',
     field: 'files',
     component: 'XTUpload',
-    componentProps: {
-      api: uploadApi,
-      maxSize: 20,
-      maxNumber: 10,
-      helpText: '文件大小不超过20M',
-      accept: ['image/*', '.pdf', '.doc', '.docx', '.ppt', '.pptx', '.xls', '.xlsx'],
+    componentProps: ({ formModel, schema }) => {
+      return {
+        api: uploadApi,
+        maxSize: 20,
+        maxNumber: 10,
+        helpText: '文件大小不超过20M',
+        accept: ['image/*', '.pdf', '.doc', '.docx', '.ppt', '.pptx', '.xls', '.xlsx'],
+        onChange: data => {
+          console.log('🚀 ~ file: data.ts:57 ~ data:', data);
+          formModel[schema.field] = data;
+        },
+      };
     },
     colProps: {
       span: 24,

+ 3 - 0
src/views/biz/archives/medicalDocuments/index.vue

@@ -125,6 +125,7 @@
   }
   // 预览文件地址
   async function handlePreview(id) {
+    console.log('🚀 ~ file: index.vue:128 ~ handlePreview ~ id:', id);
     if (id == undefined) {
       previewUrl.value = '';
       return;
@@ -138,6 +139,7 @@
   }
   // 回调
   async function callItemClick(data) {
+    console.log('🚀 ~ file: index.vue:141 ~ callItemClick ~ data:', data);
     selected.value = data.id;
     page.current = 1;
     page.total = data.attachment;
@@ -163,6 +165,7 @@
     });
   }
   async function callSuccess({ isUpdate, values }) {
+    console.log('🚀 ~ file: index.vue:166 ~ callSuccess ~ values:', values);
     if (isUpdate) {
       selected.value = values.id;
       page.current = 1;