showViewInfo.vue 1.73 KB
Newer Older
WuFeiyang's avatar
WuFeiyang committed
1
<template>
2 3 4
    <div class="largeFont" style="float:left width:100%">
        <span>Basic Path :&nbsp;{{ basePathId }}</span><br>
        <span> Rate: {{ sampleId }}</span><br>
WuFeiyang's avatar
WuFeiyang committed
5 6 7 8
        <span>length: {{ lengthId }}</span>
        <b-button variant="primary" style="float:right">
            <span class="glyphicon glyphicon-cog" @click="showPathIdConfig"></span>
        </b-button>
WuFeiyang's avatar
WuFeiyang committed
9
        <br>
10
        <hr />
WuFeiyang's avatar
WuFeiyang committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
    </div>
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import axios from 'axios';

@Component
export default class showViewInfo extends Vue {
    @Prop() pathId!:string;
    basePathId: string = '';
    sampleId: string = '';
    lengthId: string = '';
    @Watch('pathId')
WuFeiyang's avatar
WuFeiyang committed
25
    onPathIdChanged(val:any, oldVal:any) {
WuFeiyang's avatar
WuFeiyang committed
26 27
        this.show(val);
    }
WuFeiyang's avatar
WuFeiyang committed
28 29 30 31

    showPathIdConfig(){
        this.$emit("showPathIdConfig");
    }
WuFeiyang's avatar
WuFeiyang committed
32
    async show(pathId:string) {
WuFeiyang's avatar
WuFeiyang committed
33
        this.getBasePath(pathId);
WuFeiyang's avatar
WuFeiyang committed
34 35 36
        this.getSamplerate(pathId);
        this.getLength(pathId);
    }
WuFeiyang's avatar
WuFeiyang committed
37 38
    async getBasePath(pathId:any) {
        var apiLoad = pathId.thingPath + '/basepath';
WuFeiyang's avatar
WuFeiyang committed
39 40
        await axios.get(apiLoad)
        .then((response) => {
WuFeiyang's avatar
WuFeiyang committed
41
            this.basePathId = response.data.CFET2CORE_SAMPLE_VAL;
WuFeiyang's avatar
WuFeiyang committed
42 43
        })
    }
WuFeiyang's avatar
WuFeiyang committed
44 45
    async getSamplerate(pathId:any) {
        var apiLoad = pathId.thingPath + '/samplerate/' + pathId.path;
WuFeiyang's avatar
WuFeiyang committed
46 47
        await axios.get(apiLoad)
        .then((response) => {
WuFeiyang's avatar
WuFeiyang committed
48
            this.sampleId = response.data.CFET2CORE_SAMPLE_VAL;
WuFeiyang's avatar
WuFeiyang committed
49 50
        })
    }
WuFeiyang's avatar
WuFeiyang committed
51 52
    async getLength(pathId:any) {
        var apiLoad = pathId.thingPath + '/length/' + pathId.path;
WuFeiyang's avatar
WuFeiyang committed
53 54
        await axios.get(apiLoad)
        .then((response) => {
WuFeiyang's avatar
WuFeiyang committed
55
            this.lengthId = response.data.CFET2CORE_SAMPLE_VAL;
WuFeiyang's avatar
WuFeiyang committed
56 57 58 59
        })
    }
}
</script>