Parcourir la source

组运行列表

FinalYu il y a 2 ans
Parent
commit
efd77efb17

+ 24 - 1
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-tabs class="cy-tabs" type="border-card">
+  <el-tabs class="cy-tabs" type="border-card" @tab-click="navGroupItemEvent">
     <el-tab-pane>
       <div slot="label" class="tab-div">
         <el-image :src="require('@/assets/images/report_model.png')" fit="contain"></el-image>
@@ -325,6 +325,28 @@ export default {
     /** 数据组组配置点击事件 */
     handleNodeClick(data, node, target) {
       this.closeMenu()
+      if (data.id != -1 && !data.itemName) {
+        sessionStorage.setItem('GROUP_ID', data.id)
+        this.gotoPageByName('/groupItem')
+      }
+    },
+    /** 组菜单点击事件 */
+    navGroupItemEvent(e) {
+      sessionStorage.removeItem('GROUP_ITEM')
+      if (e.paneName == '1') {
+        this.gotoPageByName('/groupItem')
+      } else {
+        this.gotoPageByName('/index')
+      }
+    },
+    /** 页面跳转 */
+    gotoPageByName(path) {
+      this.$router.push({
+        path: path,
+        query: {
+          t: new Date().getTime()
+        }
+      })
     },
     /** 懒加载查询组配置文件 */
     loadGroupNode(node, resolve) {
@@ -334,6 +356,7 @@ export default {
       if (node.data.id == -1) {
         getAllItemGroup().then(res => {
           resolve(res.data)
+          sessionStorage.setItem('GROUP_LIST', JSON.stringify(res.data))
         }).catch((e) => {
           resolve([])
         })

+ 4 - 0
chuanyi_client2/src/router/index.js

@@ -39,6 +39,10 @@ const routes = [
             {
                 path: 'index',
                 component: () => import('@/views/home/index')
+            },
+            {
+                path: 'groupItem',
+                component: () => import('@/views/group_item/index')
             }
         ]
     }

+ 94 - 0
chuanyi_client2/src/views/group_item/index.vue

@@ -0,0 +1,94 @@
+<template>
+  <div class="cqcy-content">
+    <div style="margin-bottom: 10px;">
+      <el-select v-model="chooseGroupId" disabled size="mini">
+        <el-option
+            v-for="dict in groupDataList"
+            :key="dict.id"
+            :label="dict.groupName"
+            :value="dict.id"
+        ></el-option>
+      </el-select>
+      <el-checkbox v-model="groupRunStatus" size="mini" style="margin-left: 20px;" @change="groupRunCheckboxEvent">运行</el-checkbox>
+    </div>
+    <el-table
+        :data="itemDataList"
+        border
+        style="width: 100%">
+      <el-table-column label="序号" align="center" width="80">
+        <template slot-scope="scope">
+          {{ scope.$index + 1 }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="itemName" label="数据项名称" align="center">
+      </el-table-column>
+      <el-table-column prop="val" label="数据项值" align="center" width="120">
+      </el-table-column>
+      <el-table-column prop="dataSourceName" label="数据源名称" align="center">
+      </el-table-column>
+      <el-table-column prop="runState" label="运行状态" align="center" width="100">
+      </el-table-column>
+      <el-table-column prop="time" label="运行时间" align="center" width="120">
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+
+import {getItemGroupById} from "@/api/datasource";
+import {showLoading} from "@/utils/cqcy";
+
+export default {
+  name: "index",
+  components: {
+  },
+  data() {
+    return {
+      itemDataList: [],
+      groupDataList: [],
+      chooseGroup: null,
+      chooseGroupId: null,
+      groupRunStatus: false
+    }
+  },
+  watch: {
+    '$route'(to, from) {
+      this.readParams()
+    },
+  },
+  methods: {
+    /** 读取参数 */
+    readParams() {
+      let groupListStorage = sessionStorage.getItem('GROUP_LIST') ? sessionStorage.getItem('GROUP_LIST') : '[]'
+      this.groupDataList = JSON.parse(groupListStorage)
+      let groupId = sessionStorage.getItem('GROUP_ID') ? sessionStorage.getItem('GROUP_ID') : '-1'
+      this.chooseGroupId = parseInt(groupId)
+      this.getGroupById(this.chooseGroupId)
+    },
+    /** 运行状态值 */
+    groupRunCheckboxEvent(val) {
+      console.log(val)
+      console.log(this.chooseGroup)
+    },
+    /** 获取组详细信息 */
+    getGroupById(id) {
+      if (!id) {
+        return
+      }
+      const loading = showLoading(this, '加载中,请稍候···')
+      getItemGroupById(id).then(res => {
+        loading.close()
+        this.chooseGroup = res.data
+        this.itemDataList = this.chooseGroup.itemList
+      }).catch((e) => {
+        loading.close()
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 4 - 0
chuanyi_client2/src/views/index.vue

@@ -81,4 +81,8 @@ export default {
   opacity: unset !important;
   background: #2c3e50 !important;
 }
+
+.cqcy-content {
+  margin: 20px;
+}
 </style>

+ 1 - 1
chuanyi_client2/src/views/login.vue

@@ -105,7 +105,7 @@ export default {
   watch: {
     $route: {
       handler: function (route) {
-        this.redirect = route.query && route.query.redirect;
+        // this.redirect = route.query && route.query.redirect;
       },
       immediate: true
     }