mxd 4 жил өмнө
parent
commit
cf4b50c153

+ 1 - 1
magic-editor/src/console/src/components/common/modal/magic-confirm.vue

@@ -1,7 +1,7 @@
 <template>
   <magic-dialog ref="dialog" v-model="value" :title="title" align="right" @onClose="closeHandle">
     <template #content>
-      {{ content }}
+      <div v-html="content"/>
     </template>
     <template #buttons>
       <button class="ma-button active" @click="okHandle">{{ ok }}</button>

+ 28 - 13
magic-editor/src/console/src/components/layout/magic-header.vue

@@ -163,23 +163,38 @@ export default {
     doUpload(mode) {
       let file = this.$refs.file.files[0];
       if (file) {
-        this.showUploadDialog = false;
         let formData = new FormData();
         formData.append('file', file, this.filename);
         formData.append('mode', mode);
-        request.send('/upload', formData, {
-          method: 'post',
-          headers: {
-            'Content-Type': 'multipart/form-data'
-          }
-        }).success(() => {
-          this.$magicAlert({
-            content: '上传成功!'
+        let _upload = ()=>{
+          this.showUploadDialog = false;
+          request.send('/upload', formData, {
+            method: 'post',
+            headers: {
+              'Content-Type': 'multipart/form-data'
+            }
+          }).success(() => {
+            this.$magicAlert({
+              content: '上传成功!'
+            })
+            bus.$emit('refresh-resource')
           })
-          bus.$emit('refresh-resource')
-        })
-        this.filename = '';
-        this.$refs.file.value = '';
+          this.filename = '';
+          this.$refs.file.value = '';
+        }
+        if(mode === 'full'){
+          this.$magicConfirm({
+            title: '上传接口',
+            content: `全量模式上传时,以上传的数据为准进行覆盖更新操作,可能会删除其他接口<br>在非全量导出时,建议使用增量更新,是否继续?`,
+            ok: '继续',
+            cancel: '取消',
+            onOk: () => {
+              _upload();
+            }
+          });
+        }else{
+          _upload();
+        }
       }
     },
     switchTheme($theme) {