From c47ee5664549dbee93474b0d35b9d228b19ef0a2 Mon Sep 17 00:00:00 2001
From: WuFeiyang <1029384756wfy@sina.com>
Date: Mon, 7 Oct 2019 20:34:36 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9wave=20=E6=9C=AA=E6=88=90?=
 =?UTF-8?q?=E5=8A=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/App.vue                                |  1 +
 src/components/Status/Status.vue           |  1 -
 src/components/WaveView/WaveView.vue       |  8 ++++++--
 src/components/WaveView/setBasicParams.vue | 21 ++++++++++++++++++++-
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 860ec37..235523f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -159,6 +159,7 @@ export default class App extends Vue {
       fragment = fragment.substring(1, fragment.length);
       var customViewURL = "/customView/template" + fragment;
       var isCustomview: boolean = false;
+      //axios之前出现过cache过多刷不出来的问题,所以本项目的axios都加上了禁止cache的头文件
       axios
         .get(customViewURL, {
           headers: {
diff --git a/src/components/Status/Status.vue b/src/components/Status/Status.vue
index fc4538b..13fea87 100644
--- a/src/components/Status/Status.vue
+++ b/src/components/Status/Status.vue
@@ -101,7 +101,6 @@ export default class Status extends Widget {
   };
 
   created() {
-    // this.config.data.userInputData = this.userInputData;
     this.config.data.userInputData = this.strMapObjChange.strMapToObj(
       this.userInputData
     );
diff --git a/src/components/WaveView/WaveView.vue b/src/components/WaveView/WaveView.vue
index 47bfffb..e387ce9 100644
--- a/src/components/WaveView/WaveView.vue
+++ b/src/components/WaveView/WaveView.vue
@@ -37,6 +37,7 @@ export default class waveView extends Widget {
     pathId: string = '';
     strMapObjChange = new StrMapObjChange();
     userInputData = new Map<string, string>();
+    sampleVal!:any;
     config: WidgetConfig = {
         WidgetComponentName: 'WaveView',
         data: {
@@ -84,7 +85,10 @@ export default class waveView extends Widget {
         (this.$refs.setBasicParams as setBasicParams).refresh();
     }
     updateUI() {
-        (this.$refs.setBasicParams as setBasicParams).getPathIdParams();
+        (this.$refs.setBasicParams as setBasicParams).getSampleParams(this.config.data.url.path);
+        if(Array.isArray(this.sampleVal)) {
+            (this.$refs.setBasicParams as setBasicParams).sampleLoad(this.sampleVal);
+        }
     }
     getPathId(pathId: string) {
         this.pathId = pathId;
@@ -98,6 +102,7 @@ export default class waveView extends Widget {
     samplePoke(sample:any)
     {
         var samplePath = sample.CFET2CORE_SAMPLE_PATH;
+        this.sampleVal = sample.CFET2CORE_SAMPLE_VAL;
         var pokedPath:string;
         pokedPath = samplePath;
         var count:number = 0;
@@ -123,7 +128,6 @@ export default class waveView extends Widget {
             pokedPath = pokedPath.substring(0,pokedPath.length-1);
         }
         this.config.data.url.path = pokedPath;
-        (this.$refs.setBasicParams as setBasicParams).getPathIdParams();
     }
     samplePokeWith(sample:any)
     {
diff --git a/src/components/WaveView/setBasicParams.vue b/src/components/WaveView/setBasicParams.vue
index f3d7b23..4968e33 100644
--- a/src/components/WaveView/setBasicParams.vue
+++ b/src/components/WaveView/setBasicParams.vue
@@ -66,6 +66,7 @@ export default class setBasicParams extends Vue {
 
   created() {
     this.config.data.userInputData = this.userInputData;
+    this.getConfig = this.config;
   }
   refresh(){
     var Args: UpdatePayload = {
@@ -98,6 +99,14 @@ export default class setBasicParams extends Vue {
     this.getConfig = this.config;
     this.$emit("updateConfig", this.getConfig);
   }
+  getSampleParams(url:any){
+    (this.$refs.WidgetParams as WidgetParams).setVariableList(
+      this.pathProcessor.extractVarFromPath(url)
+    );
+    this.config.data.url.path = url;
+    this.isShowLoad = true;
+    this.isShowCog = false;
+  }
   getPathIdParams() {
     if (this.tempUrl != this.config.data.url.path) {
       this.config.data.userInputData.clear();
@@ -132,6 +141,16 @@ export default class setBasicParams extends Vue {
       this.isShowCog = !this.isShowCog;
     }
   }
+  sampleLoad(sampleVal: any){
+    var myPlot = this.wave;
+    var data_initial = [
+      {
+        x: this.temp.dataTimeAxis,
+        y: sampleVal
+      }
+    ];
+    this.createChannelChart(myPlot, data_initial);
+  }
   async viewLoad(Args: UpdatePayload) {
     this.getConfig.data.position.x1 = "";
     this.getConfig.data.position.x2 = "";
@@ -152,7 +171,7 @@ export default class setBasicParams extends Vue {
     var third = url.indexOf("/", second+1)
     var fouth = url.indexOf("/", third+1)
     this.pathId = url.slice(third+1, fouth);
-    var thingPath = url.slice(0, url.indexOf('/', 2))
+    var thingPath = url.slice(0, url.indexOf('/', 2));
     var path = this.pathId;
     var dealPath = {
       thingPath:thingPath,
-- 
GitLab