Przeglądaj źródła

#13 优化参数,前后端同时更新

rsbi 2 lat temu
rodzic
commit
350a9fbab4

+ 2 - 0
src/view/Login.vue

@@ -87,6 +87,8 @@
 							success:function(resp){
 								ts.fullscreenLoading = false;
 								if (resp.result == 1) {
+									//清除菜单缓存
+									localStorage.removeItem("menus");
 									ts.$router.push('Welcome')
 								}else{
 									ts.$notify.error({

+ 2 - 2
src/view/portal/LayoutParamAdd.vue

@@ -28,7 +28,7 @@
               </el-form-item>
             </template>
             <el-form-item label="默认值" label-width="100px">
-              <el-input v-model="param.defvalue"></el-input>
+              <el-input v-model="param.defvalue" :placeholder="datetype == 'dateselect' || datetype ==='monthselect' || datetype ==='yearselect'? 'now 表示当前时间, now - 1 表示前一天':'参数默认值'"></el-input>
             </el-form-item>
             <el-form-item label="隐藏参数" label-width="100px">
               <el-switch v-model="param.hiddenprm" active-value="y" inactive-value="n">
@@ -162,7 +162,7 @@ export default {
           dtformats:{
             yearselect: ['yyyy', 'yyyy年'],
             monthselect:['yyyyMM', 'yyyy-MM', 'yyyy年MM月'],
-            dateselect:['yyyyMMdd', 'yyyy-MM-dd', 'yyyy年MM月dd日']
+            dateselect:['yyyyMMdd', 'yyyy-MM-dd', 'yyyy年MM月dd日', "yyyy-MM-dd HH:mm:ss", "yyyyMMddHHmmss"]
           }
         },
         rules:{

+ 15 - 4
src/view/portal/PortalParamView.vue

@@ -118,14 +118,25 @@ export default {
     },
     //初始化参数字段
     initReportParam(urlParam, pms){
+      //把URL上的参数赋给报表参数
       $(pms).each((a, b)=>{
-        if(b.type === 'checkbox' && urlParam[b.id]){
-          let v = urlParam[b.id];
-          this.reportParam[b.id] = v.split(",");
+        if(urlParam[b.id]){
+          b.value = urlParam[b.id];
+        }
+      });
+      $(pms).each((a, b)=>{
+        if(b.type === 'checkbox' && b.value){
+          let v = b.value;
+          //this.reportParam[b.id] = v.split(",");
+          this.$set(this.reportParam,b.id, v.split(","));
         }else{
-          this.reportParam[b.id] = urlParam[b.id];
+          //this.reportParam[b.id] = b.value;
+          this.$set(this.reportParam,b.id, b.value);
         }
       });
+
+      
+
     }
   },
   mounted(){

+ 3 - 0
src/view/portal/PortalView.vue

@@ -83,6 +83,9 @@ export default {
           //渲染组件
           this.$refs['optarea'].setCompData(resp.rows);
           this.pms = resp.rows.pms;
+          let urlParam = JSON.parse(JSON.stringify(this.$route.query));
+					delete urlParam.id;
+          this.$refs['paramViewForm'].initReportParam(urlParam, this.pms);
         }
       }, this, loadingInstance);
     },