Browse Source

downloadProcess

tangning 3 tháng trước cách đây
mục cha
commit
b7d370415e

+ 18 - 14
src/views/account/product/index.vue

@@ -475,26 +475,30 @@
               if (timer.value) {
               if (timer.value) {
                 afterClose();
                 afterClose();
               }
               }
-              timer.value = setInterval(() => {
-                downloadProcess(params).then((processres) => {
-                  console.log('processres', res);
-                  if (processres.percent >= 100) {
-                    canDownload.value = false;
-                    afterClose();
-                    window.open(res.url);
-                    closeModal();
-                    cancelDownload();
-                  }
-                  downloadOption.value = processres;
-                  console.log(processres);
-                });
-              }, 1000);
+              getProcess(params);
             }
             }
           } else {
           } else {
             window.open(res.downloadUrl);
             window.open(res.downloadUrl);
           }
           }
         });
         });
       }
       }
+      function getProcess(params) {
+        timer.value = setTimeout(() => {
+          downloadProcess(params).then((processres) => {
+            console.log('processres', processres, params);
+            if (processres.percent >= 100) {
+              canDownload.value = false;
+              afterClose();
+              window.open(processres.url);
+              closeModal();
+              cancelDownload();
+            } else {
+              getProcess(params);
+            }
+            downloadOption.value = processres;
+          });
+        }, 1000);
+      }
       function afterClose() {
       function afterClose() {
         clearInterval(timer.value);
         clearInterval(timer.value);
         timer.value = null;
         timer.value = null;

+ 18 - 14
src/views/customer/scene.vue

@@ -352,26 +352,30 @@
               if (timer.value) {
               if (timer.value) {
                 afterClose();
                 afterClose();
               }
               }
-              timer.value = setInterval(() => {
-                downloadProcess(params).then((processres) => {
-                  console.log('processres', res);
-                  if (processres.percent >= 100) {
-                    canDownload.value = false;
-                    afterClose();
-                    window.open(res.url);
-                    closeModal();
-                    cancelDownload();
-                  }
-                  downloadOption.value = processres;
-                  console.log(processres);
-                });
-              }, 1000);
+              getProcess(params);
             }
             }
           } else {
           } else {
             window.open(res.downloadUrl);
             window.open(res.downloadUrl);
           }
           }
         });
         });
       }
       }
+      function getProcess(params) {
+        timer.value = setTimeout(() => {
+          downloadProcess(params).then((processres) => {
+            console.log('processres', processres, params);
+            if (processres.percent >= 100) {
+              canDownload.value = false;
+              afterClose();
+              window.open(processres.url);
+              closeModal();
+              cancelDownload();
+            } else {
+              getProcess(params);
+            }
+            downloadOption.value = processres;
+          });
+        }, 1000);
+      }
       function afterClose() {
       function afterClose() {
         clearInterval(timer.value);
         clearInterval(timer.value);
         timer.value = null;
         timer.value = null;

+ 59 - 26
src/views/productOperation/cameraScene.vue

@@ -21,7 +21,18 @@
         :rowSelection="tableType == 3 ? false : rowSelection"
         :rowSelection="tableType == 3 ? false : rowSelection"
       >
       >
         <template #toolbar>
         <template #toolbar>
-          <a-button type="primary" @click="handleMoveAll" v-if="tableType != 3 && tableType != 57 && tableType != 58 && getCheckPerm('scenes-move-batch')"> 批量迁移</a-button>
+          <a-button
+            type="primary"
+            @click="handleMoveAll"
+            v-if="
+              tableType != 3 &&
+              tableType != 57 &&
+              tableType != 58 &&
+              getCheckPerm('scenes-move-batch')
+            "
+          >
+            批量迁移</a-button
+          >
         </template>
         </template>
         <template #status="{ record }">
         <template #status="{ record }">
           <span v-if="record.status != '-1'">{{ record.statusString }}</span>
           <span v-if="record.status != '-1'">{{ record.statusString }}</span>
@@ -55,7 +66,11 @@
               {
               {
                 label: '迁移',
                 label: '迁移',
                 disabled: !(record.status == 1 || record.status == -2),
                 disabled: !(record.status == 1 || record.status == -2),
-                ifShow: getTypeCheckPerm('scenes-move') && tableType != 3 && tableType != 57 && tableType != 58,
+                ifShow:
+                  getTypeCheckPerm('scenes-move') &&
+                  tableType != 3 &&
+                  tableType != 57 &&
+                  tableType != 58,
                 onClick: handleMove.bind(null, record),
                 onClick: handleMove.bind(null, record),
               },
               },
               {
               {
@@ -80,7 +95,11 @@
                 label: '重算',
                 label: '重算',
                 disabled: record.status == 0 || (record.status == -2 && record.payStatus != 1),
                 disabled: record.status == 0 || (record.status == -2 && record.payStatus != 1),
                 ifShow:
                 ifShow:
-                  getTypeCheckPerm('scenes-recalculate') && tableType != 3 && record.status != -4 && tableType != 57 && tableType != 58,
+                  getTypeCheckPerm('scenes-recalculate') &&
+                  tableType != 3 &&
+                  record.status != -4 &&
+                  tableType != 57 &&
+                  tableType != 58,
                 popConfirm: {
                 popConfirm: {
                   title: '是否重算?',
                   title: '是否重算?',
                   confirm: handleReset.bind(null, record),
                   confirm: handleReset.bind(null, record),
@@ -89,7 +108,11 @@
               {
               {
                 label: '复制',
                 label: '复制',
                 disabled: !(record.status == 1 || (record.status == -2 && record.payStatus == 1)),
                 disabled: !(record.status == 1 || (record.status == -2 && record.payStatus == 1)),
-                ifShow: getTypeCheckPerm('scenes-copy') && tableType != 3 && tableType != 57 && tableType != 58,
+                ifShow:
+                  getTypeCheckPerm('scenes-copy') &&
+                  tableType != 3 &&
+                  tableType != 57 &&
+                  tableType != 58,
                 onClick: handleCopy.bind(null, record),
                 onClick: handleCopy.bind(null, record),
               },
               },
               {
               {
@@ -209,7 +232,6 @@
           percent: 0,
           percent: 0,
         };
         };
         console.log('取消下载', downloadOption.value);
         console.log('取消下载', downloadOption.value);
-
       }
       }
       const [registerPriority, { openModal: openPriorityModal }] = useModal();
       const [registerPriority, { openModal: openPriorityModal }] = useModal();
       const [registerDownModal, { openModal: openDownModal, closeModal }] = useModal();
       const [registerDownModal, { openModal: openDownModal, closeModal }] = useModal();
@@ -222,15 +244,17 @@
         title: `场景列表`,
         title: `场景列表`,
         columns: getColumns(false),
         columns: getColumns(false),
         // rowSelection: { type: 'checkbox' },
         // rowSelection: { type: 'checkbox' },
-        searchInfo: props.userName?{ type: tableType, userName: props.userName }:{type: tableType},
+        searchInfo: props.userName
+          ? { type: tableType, userName: props.userName }
+          : { type: tableType },
         useSearchForm: true,
         useSearchForm: true,
         formConfig: searchFormSs,
         formConfig: searchFormSs,
         showTableSetting: true,
         showTableSetting: true,
         beforeFetch: (T) => {
         beforeFetch: (T) => {
           loading.value = true;
           loading.value = true;
           if (T.shootCounts) {
           if (T.shootCounts) {
-            let min = T.shootCounts[0]<T.shootCounts[1]?T.shootCounts[0]:T.shootCounts[1];
-            let max = T.shootCounts[0]>T.shootCounts[1]?T.shootCounts[0]:T.shootCounts[1];
+            let min = T.shootCounts[0] < T.shootCounts[1] ? T.shootCounts[0] : T.shootCounts[1];
+            let max = T.shootCounts[0] > T.shootCounts[1] ? T.shootCounts[0] : T.shootCounts[1];
             T.shootCountMin = min;
             T.shootCountMin = min;
             T.shootCountMax = max;
             T.shootCountMax = max;
           }
           }
@@ -261,9 +285,9 @@
       function changeTable(val: string) {
       function changeTable(val: string) {
         tableType.value = val;
         tableType.value = val;
         let sgetForm = getForm();
         let sgetForm = getForm();
-        if(sgetForm){
-          sgetForm.resetFields()
-          sgetForm.updateSchema(getSchemas(val, props.userName))
+        if (sgetForm) {
+          sgetForm.resetFields();
+          sgetForm.updateSchema(getSchemas(val, props.userName));
         }
         }
         console.log('sgetForm', sgetForm, val);
         console.log('sgetForm', sgetForm, val);
         setColumns(getColumns(val));
         setColumns(getColumns(val));
@@ -339,7 +363,12 @@
       function handleDownload(record: Recordable) {
       function handleDownload(record: Recordable) {
         let isObj = tableType.value == 5 || tableType.value == 7 || tableType.value == 58 ? 1 : 0;
         let isObj = tableType.value == 5 || tableType.value == 7 || tableType.value == 58 ? 1 : 0;
         let params = { num: record.num, isObj: 0 };
         let params = { num: record.num, isObj: 0 };
-        if (tableType.value == 4 || tableType.value == 5 || tableType.value == 7 || tableType.value == 58) {
+        if (
+          tableType.value == 4 ||
+          tableType.value == 5 ||
+          tableType.value == 7 ||
+          tableType.value == 58
+        ) {
           params.isObj = isObj;
           params.isObj = isObj;
         }
         }
         canDownload.value = true;
         canDownload.value = true;
@@ -357,20 +386,7 @@
               if (timer.value) {
               if (timer.value) {
                 afterClose();
                 afterClose();
               }
               }
-              timer.value = setInterval(() => {
-                downloadProcess(params).then((processres) => {
-                  console.log('processres', res, params);
-                  if (processres.percent >= 100) {
-                    canDownload.value = false;
-                    afterClose();
-                    window.open(res.url);
-                    closeModal();
-                    cancelDownload();
-                  }
-                  downloadOption.value = processres;
-                  console.log(processres);
-                });
-              }, 1000);
+              getProcess(params);
             }
             }
           } else {
           } else {
             window.open(res.downloadUrl);
             window.open(res.downloadUrl);
@@ -381,6 +397,23 @@
         clearInterval(timer.value);
         clearInterval(timer.value);
         timer.value = null;
         timer.value = null;
       }
       }
+      function getProcess(params) {
+        timer.value = setTimeout(() => {
+          downloadProcess(params).then((processres) => {
+            console.log('processres', processres, params);
+            if (processres.percent >= 100) {
+              canDownload.value = false;
+              afterClose();
+              window.open(processres.url);
+              closeModal();
+              cancelDownload();
+            } else {
+              getProcess(params);
+            }
+            downloadOption.value = processres;
+          });
+        }, 1000);
+      }
       function handleReset(record: Recordable) {
       function handleReset(record: Recordable) {
         console.log('handleReset', record);
         console.log('handleReset', record);
         rebuildScene({ num: record.num }).then(() => {
         rebuildScene({ num: record.num }).then(() => {

+ 18 - 14
src/views/productOperation/viewKankan.vue

@@ -361,20 +361,7 @@
               if (timer.value) {
               if (timer.value) {
                 afterClose();
                 afterClose();
               }
               }
-              timer.value = setInterval(() => {
-                downloadProcess(params).then((processres) => {
-                  console.log('processres', res);
-                  if (processres.percent >= 100) {
-                    canDownload.value = false;
-                    afterClose();
-                    window.open(res.url);
-                    closeModal();
-                    cancelDownload();
-                  }
-                  downloadOption.value = processres;
-                  console.log(processres);
-                });
-              }, 1000);
+              getProcess(params);
             }
             }
           } else {
           } else {
             window.open(res.downloadUrl);
             window.open(res.downloadUrl);
@@ -385,6 +372,23 @@
         clearInterval(timer.value);
         clearInterval(timer.value);
         timer.value = null;
         timer.value = null;
       }
       }
+      function getProcess(params) {
+        timer.value = setTimeout(() => {
+          downloadProcess(params).then((processres) => {
+            console.log('processres', processres, params);
+            if (processres.percent >= 100) {
+              canDownload.value = false;
+              afterClose();
+              window.open(processres.url);
+              closeModal();
+              cancelDownload();
+            } else {
+              getProcess(params);
+            }
+            downloadOption.value = processres;
+          });
+        }, 1000);
+      }
       function handleReset(record: Recordable) {
       function handleReset(record: Recordable) {
         console.log('handleReset', record);
         console.log('handleReset', record);
         rebuildScene({ num: record.num }).then(() => {
         rebuildScene({ num: record.num }).then(() => {