liyongli 2 gadi atpakaļ
vecāks
revīzija
3ab7e80e9e
2 mainītis faili ar 48 papildinājumiem un 13 dzēšanām
  1. 4 3
      src/views/History/index.vue
  2. 44 10
      src/views/RealOnline/index.vue

+ 4 - 3
src/views/History/index.vue

@@ -297,11 +297,12 @@ export default {
           });
       });
       const T = new Date(Date.now() - 86400000);
+      const lT = new Date(Date.now() - 604800000);
       this.form = {
         app: (this.cycle[0] || { value: "" }).value,
         version: [(this.version[0] || { value: "" }).value],
         channel: [(this.channel[0] || { value: "" }).value],
-        date: [T, T],
+        date: [lT, T],
       };
       this.regularData();
     },
@@ -449,7 +450,7 @@ export default {
       const r = await getRule({
         db: "authplat",
         exportMark: "0",
-        menuid: 221,
+        menuid: 399,
         roleid,
       });
       //   应用列表
@@ -508,7 +509,7 @@ export default {
       getRule({
         db: "authplat",
         exportMark: "0",
-        menuid: 221,
+        menuid: 399,
         roleid,
       }).then(rule => {
         let prvList = rule.output.data.prvRolectrl || [];

+ 44 - 10
src/views/RealOnline/index.vue

@@ -18,7 +18,6 @@
           <el-select
             v-model="form.app"
             placeholder="请选择时段"
-            @change="regularData"
           >
             <el-option
               v-for="item in cycle"
@@ -30,8 +29,23 @@
             </el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="粒度">
+          <el-select
+            v-model="form.lidu"
+            placeholder="请选择粒度"
+          >
+            <el-option
+              v-for="item in lidu"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+              :disabled="item.disabled"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item style="float: right">
-          <!-- <el-button type="primary" @click="onSubmit">查询</el-button> -->
+          <el-button type="primary" @click="regularData">查询</el-button>
         </el-form-item>
       </el-form>
     </el-card>
@@ -44,7 +58,12 @@
 
 <script>
 // @ is an alias to /src
-import { getRealAppOnline, getRule, getAppList } from "@/api/index";
+import {
+  getRealAppOnline,
+  getRule,
+  getAppList,
+  getSearchData,
+} from "@/api/index";
 
 import * as echarts from "echarts/core";
 import { LineChart } from "echarts/charts";
@@ -70,10 +89,12 @@ export default {
   data() {
     return {
       form: {
-        app: "2",
+        app: "",
+        lidu: ""
       },
       tableData: [],
       cycle: [],
+      lidu: [],
     };
   },
   mounted() {
@@ -83,7 +104,7 @@ export default {
   methods: {
     async init() {
       if (chart && chart.dispose) chart.dispose();
-      const { source, appli } = await this.getAppListFunc();
+      const { source, appli, lidu } = await this.getAppListFunc();
       appli.map(v => {
         if ((length.length && source[v.mcode]) || source.length === 0)
           this.cycle.push({
@@ -91,9 +112,15 @@ export default {
             label: v.mname,
           });
       });
-
+      this.lidu = lidu.map(v=>{
+        return {
+            value: v.mcode,
+            label: v.mname,
+        }
+      });
       this.form = {
         app: (this.cycle[0] || { value: "" }).value,
+        lidu: (this.lidu[0] || { value: "" }).value
       };
       this.regularData();
     },
@@ -121,7 +148,7 @@ export default {
       }, 60000);
     },
     onSubmit() {
-      getRealAppOnline({ appName: this.form.app })
+      getRealAppOnline({ appName: this.form.app,minute: this.form.lidu })
         .then(r => {
           if (!this.$refs.realLineChart) return;
 
@@ -200,7 +227,7 @@ export default {
       });
     },
     async getAppListFunc() {
-      const { r, li } = await this.getAppListOri();
+      const { r, li, lidu } = await this.getAppListOri();
       let source = {
           length: 0,
         },
@@ -215,6 +242,7 @@ export default {
       return {
         source,
         appli,
+        lidu,
       };
     },
     async getAppListOri() {
@@ -224,7 +252,7 @@ export default {
       const r = await getRule({
         db: "authplat",
         exportMark: "0",
-        menuid: 221,
+        menuid: 400,
         roleid,
       });
       const li = await getAppList({
@@ -233,7 +261,13 @@ export default {
         pageid: 1,
         pagesize: 1000,
       });
-      return { r, li };
+
+      const defaultAppName = li.status == "0" ? li.output.data[0].mname : "";
+      const lidu = await getSearchData({
+        gcode: "TIME_MINUTE",
+        source: defaultAppName,
+      });
+      return { r, li, lidu };
     },
   },
   components: {},