浏览代码

医学术语静态知识维护

morphone1995 5 年之前
父节点
当前提交
95001cceea
共有 1 个文件被更改,包括 25 次插入15 次删除
  1. 25 15
      src/components/icss/AddMedicinePrompt.vue

+ 25 - 15
src/components/icss/AddMedicinePrompt.vue

@@ -129,15 +129,15 @@
                 }}, trigger: 'change' }
           ],
           fileList: [
-            //  { required: true, message: '请上传文件', trigger: 'change' }
-              { validator: (rule,value,callback)=>{
-                if(value.length < 1){
-                  callback(new Error('请上传文件'));
-                }else{
-                  callback()
-                }                
-                }, trigger: 'change' 
-              }
+             { required: true, message: '请上传文件', trigger: 'change' },
+              // { validator: (rule,value,callback)=>{
+              //   if(value.length < 1){
+              //     callback(new Error('请上传文件'));
+              //   }else{
+              //     callback()
+              //   }                
+              //   }, trigger: 'change' 
+              // }
           ]
         },
         saveDisable: false,  //保存按钮禁止点击
@@ -197,9 +197,9 @@
         });
       }
     },
-    beforeRouteLeave (to, from, next) {
+    beforeRouteLeave (to, from, next) {     
        if(this.isSuccessUpload === 1 ) {
-        this.$confirm('还有未保存的文件,是否确定返回?', '提示', {
+        this.$confirm('文件正在上传,是否确定返回?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           cancelButtonClass:'cancel',
@@ -209,9 +209,18 @@
         }).catch(() => {
                   
         });
-        //  this.warning('还有未保存的文件,是否确定返回?');
-        
-       }else if(this.isSuccessUpload === 0 || this.isSuccessUpload === 2) {
+        //  this.warning('还有未保存的文件,是否确定返回?');        
+       }else if( this.isSuccessUpload === 2) {
+         this.$confirm('还有未保存的文件,是否确定返回?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          cancelButtonClass:'cancel',
+          type: 'warning'
+          }).then(() => {
+            next()
+          }).catch(() => {                   
+          });
+       }else {
          next()
        }
 
@@ -422,7 +431,7 @@
              this.form.fileTitle = response.data.title
            }
            this.isSuccessUpload = 2 // 上传成功状态
-           this.$refs.upload.clearValidate()  // 清除校验
+           this.$refs.upload && this.$refs.upload.clearValidate()  // 清除校验
         }else{
           this.warning(response.msg||'上传失败')
           // this.form.fileList = []
@@ -439,6 +448,7 @@
       handleBeforeUpLoad(file){
         // 上传过程中   上传按钮 隐藏
         this.isSuccessUpload = 1  // 上传过程中
+        this.showFileList = true  // 新增 进度条  显示
         this.showUpLoad = false
         console.log('aaaaaaaaaa',file);
         if(file.size/1024/1024 >= 500){