zhengnaiwen_citu 1 月之前
父節點
當前提交
3481559fa0
共有 2 個文件被更改,包括 58 次插入25 次删除
  1. 2 2
      src/api/dataFactory.js
  2. 56 23
      src/views/dataFactory/productionLineMonitor/index.vue

+ 2 - 2
src/api/dataFactory.js

@@ -489,8 +489,8 @@ export function getProductionLineTasks (params) {
 }
 
 // 生产线 未调度钻取
-export function getProductionLineUnscheduled (params) {
-  return http.post('/dags/unscheduled-scripts', params)
+export function getProductionLineUnscheduled () {
+  return http.get('/dags/unscheduled-scripts')
 }
 
 // 生产线 钻取日志

+ 56 - 23
src/views/dataFactory/productionLineMonitor/index.vue

@@ -37,7 +37,7 @@
     </div>
     <m-dialog :visible.sync="dialogVisible" :title="dialogTitle" :footer="false">
       <m-table
-        :headers="table.headers"
+        :headers="headers"
         :items="table.items"
         :loading="table.loading"
         :disable-sort="true"
@@ -48,8 +48,8 @@
         :is-tools="false"
       >
         <template #actions="{ item }">
-          <template v-if="clickItem.key === 'unscheduledCount'">
-            <v-btn text color="primary">调度</v-btn>
+          <template v-if="clickKey === 'unscheduledCount'">
+            <v-btn text color="primary">启用调度</v-btn>
           </template>
           <template v-else>
             <v-btn
@@ -98,7 +98,7 @@ import {
   // productionLineLogDetail,
   // productionLineLog,
   getProductionLineTasksLogs,
-  getProductionLineList,
+  // getProductionLineList,
   getProductionLineTasks,
   getProductionLineUnscheduled
 } from '@/api/dataFactory'
@@ -113,11 +113,6 @@ export default {
       dialogVisible: false,
       dialogTitle: '',
       table: {
-        headers: [
-          { text: '名称', value: 'target_table' },
-          { text: '状态', value: 'raw_state' },
-          { text: '操作', value: 'actions' }
-        ],
         items: [],
         pageInfo: {
           size: 10,
@@ -228,22 +223,46 @@ export default {
         unscheduledCount: 0
       },
       clickItem: {},
+      clickKey: null,
       taskStatus: []
     }
   },
   computed: {
+    headers () {
+      if (this.clickKey === 'unscheduledCount') {
+        return [
+          { text: '名称', value: 'name' },
+          { text: '调度频率', value: 'schedule_frequency' },
+          { text: '操作', value: 'actions' }
+        ]
+      }
+      return [
+        { text: '名称', value: 'target_table' },
+        { text: '状态', value: 'raw_state' },
+        { text: '操作', value: 'actions' }
+      ]
+    },
     btnTitle () {
       return `查看${this.clickItem.isLine ? '最新' : ''}日志`
     },
     items () {
       return [
+        // {
+        //   title: '生产线数量',
+        //   key: 'total',
+        //   api: getProductionLineList,
+        //   isLine: true,
+        //   value: this.dictList.total,
+        //   icon: 'mdi-chart-timeline-variant',
+        //   color: 'primary'
+        // },
+
         {
-          title: '生产线数量',
-          key: 'total',
-          api: getProductionLineList,
-          isLine: true,
-          value: this.dictList.total,
-          icon: 'mdi-chart-timeline-variant',
+          title: '调度执行总数量',
+          key: 'scheduledCount',
+          api: getProductionLineTasks,
+          value: this.dictList.scheduledCount,
+          icon: 'mdi-timer-play-outline',
           color: 'primary'
         },
         {
@@ -282,14 +301,6 @@ export default {
           icon: 'mdi-timer-alert-outline',
           color: 'error'
         },
-        {
-          title: '调度执行总数量',
-          key: 'scheduledCount',
-          api: getProductionLineTasks,
-          value: this.dictList.scheduledCount,
-          icon: 'mdi-timer-play-outline',
-          color: 'primary'
-        },
         {
           title: '未调度执行数量',
           key: 'unscheduledCount',
@@ -376,12 +387,17 @@ export default {
     async handleClick (item) {
       this.dialogVisible = true
       this.dialogTitle = item.title
+      this.clickKey = item.key
       this.table.total = 0
       this.table.pageInfo.current = 1
       this.table.items = []
       if (item.value === 0) {
         return
       }
+      if (item.key === 'unscheduledCount') {
+        this.drillUnscheduled(item)
+        return
+      }
       this.table.loading = true
       try {
         const { data } = await item.api({
@@ -396,6 +412,23 @@ export default {
         this.table.loading = false
       }
     },
+    async drillUnscheduled (item) {
+      this.table.loading = true
+      try {
+        const { data } = await item.api()
+        this.table.total = data.length
+        this.table.items = data.map(e => {
+          return {
+            ...e,
+            ...e.target_table
+          }
+        })
+      } catch (error) {
+        this.$snackbar.error(error)
+      } finally {
+        this.table.loading = false
+      }
+    },
     handleSearch (val) {
       if (!val.times) {
         this.query.times = []