tanyanfei 3 years ago
parent
commit
d51a8d18e3
1 changed files with 10 additions and 4 deletions
  1. 10 4
      upload.html

+ 10 - 4
upload.html

@@ -62,7 +62,7 @@
     }
 </style>
 <body>
-    <div id="upload">
+    <div id="upload" v-loading='showloading'>
         <!-- <h1>数据上传</h1> -->
         <el-form v-if='!loading' class="form" ref="form" label-position='top' :model="form" :rules="rules">
             <el-form-item label="" style="margin-bottom: 0;">
@@ -131,6 +131,7 @@
             el: '#upload',
             data: {
                 loading:true,
+                showloading:false,
                 form:{
                     today_stock_img:[],
                     today_stock:[{code: "", name:"",fund:''}],
@@ -180,11 +181,16 @@
                                     this.$message('请添加股票');
                                     return
                                 }else{
-                                    if((!form.today_stock[0].name || isNaN(Number(form.today_stock[0].fund)) || Number(form.today_stock[0].fund)<=0)){
-                                        this.$message('请输入股票代码并输入资金额');
-                                        return
+                                    for (let i = 0; i < form.today_stock.length;i++){
+                                        if (!form.today_stock[i].name || isNaN(Number(form.today_stock[i].fund)) || Number(form.today_stock[i].fund)<=0) {
+                                            this.$message('请输入股票代码并输入资金额');
+                                            return;
+                                            // break;
+                                        }
                                     }
                                 }
+                            }else{
+                                form.today_stock=[]
                             }
                             $.ajax({
                                 type: 'POST',