Ver código fonte

fix: 更新组件,修复代码

fan 2 anos atrás
pai
commit
14d59f3bb0

+ 20 - 6
src/components/XTUpload/src/XTUpload.vue

@@ -146,12 +146,10 @@
         if (fileList.length == 1) {
           handleFile(file);
           await handleStartUpload();
-          console.log(
-            '🚀 ~ file: XTUpload.vue:150 ~ beforeUpload ~ fileListRef.value:',
-            fileListRef.value,
-          );
         } else {
           isMultiCount.value += 1;
+          // console.log('🚀 ~ file: XTUpload.vue:155 ~ beforeUpload ~ isMultiCount:', isMultiCount);
+          // console.log('🚀 ~ file: XTUpload.vue:157 ~ beforeUpload ~ fileList:', fileList);
           if (isMultiCount.value == fileList.length) {
             console.log('上传操作');
             fileList.forEach(ele => {
@@ -246,13 +244,28 @@
           item.status =
             data.code == ResultEnum.SUCCESS ? UploadResultStatus.SUCCESS : UploadResultStatus.ERROR;
           item.responseData = data;
-          if (idx + 1 == len) {
+          // if (idx + 1 == len) {
+          if (idx <= len) {
+            // console.log('🚀 ~ file: XTUpload.vue:250 ~ uploadApiByItem ~ len:', len);
+            // console.log(
+            //   '🚀 ~ file: XTUpload.vue:259 ~ uploadApiByItem ~ fileListRef.value:',
+            //   fileListRef.value,
+            // );
+            isMultiCount.value = 0;
             fileListRef.value.forEach(ele => {
               const responseData = ele.responseData as any;
+              // console.log(
+              //   '🚀 ~ file: XTUpload.vue:258 ~ uploadApiByItem ~ responseData:',
+              //   responseData,
+              // );
               if (responseData?.code == ResultEnum.SUCCESS) {
                 fileList.value.push(responseData.data);
+                // console.log(
+                //   '🚀 ~ file: XTUpload.vue:256 ~ uploadApiByItem ~ fileList.value.push:',
+                //   fileList.value,
+                // );
               } else {
-                createMessage.error(responseData?.errorMsg);
+                responseData ? createMessage.error(responseData?.errorMsg) : '';
               }
             });
             fileListRef.value = fileListRef.value.filter(ele => {
@@ -279,6 +292,7 @@
       // 点击开始上传
       async function handleStartUpload() {
         const { maxNumber } = props;
+        console.log('🚀 ~ file: XTUpload.vue:282 ~ handleStartUpload ~ props:', props);
         if ((fileListRef.value.length + fileList.value.length ?? 0) > maxNumber) {
           return createMessage.warning(`最多只能上传${maxNumber}个文件`);
         }

+ 1 - 0
src/views/biz/archives/vascularAccess/ViewDrawerComplication.vue

@@ -185,6 +185,7 @@
     if (res) {
       tableData.value.splice(index, 1);
       setTableData(tableData.value);
+      createMessage.success('删除成功');
     } else {
       createMessage.error('删除失败');
     }

+ 2 - 2
src/views/biz/archives/vascularAccess/index.vue

@@ -232,8 +232,8 @@
           if (ele.returnBack) {
             eleC.value = `于${dayjs(ele[eleC.field]['returnTime']).format(
               'YYYY-MM-DD',
-            )}转归; 使用${dayjs().diff(
-              ele[eleC.field]['returnTime'],
+            )}转归; 使用${dayjs(ele[eleC.field]['returnTime']).diff(
+              dayjs(ele[eleC.field]['updateTime']).format('YYYY-MM-DD'),
               'day',
             )}天; ${formatDictValue(bizDictOptions.return, ele[eleC.field]['returnCause'])}; ${
               ele['updatorName']