Browse Source

数据质量统计

chenrui  1 year ago
parent
commit
249e8c8b3e

+ 1 - 0
src/config/config.js

@@ -184,6 +184,7 @@ window.SERVICE_ID = {
   averagepassroute: 2003024,//平均旅客行李量-航线
   transferBaggageDirection: 2003025,//中转4个流向
   specialbaggageanalysis: 2003026,//特殊行李分析
+  squalityStatisticsis: 20015,//数据质量统计
 }
 
 window.AIRPORT_ID = {

+ 12 - 0
src/router/routes/routes-file-temp.js

@@ -734,6 +734,18 @@ const statisticsChartsRoutes = {
             title: '中转专项统计',
           },
         },
+        {
+          path: 'qualityStatistics',
+          name: 'qualityStatistics',
+          hidden: true,
+          component: () =>
+            import(
+              '@/views/statisticsCharts/views/qualityStatistics'
+            ),
+          meta: {
+            title: '数据质量统计',
+          },
+        },
       ],
     },
   ],

+ 4 - 0
src/views/statisticsCharts/components/statisticsTabs.vue

@@ -336,6 +336,10 @@ export default {
           path: '/statisticsCharts/transitTables',
           title: '中转专项统计',
         },
+        {
+          path: '/statisticsCharts/qualityStatistics',
+          title: '数据质量统计',
+        },
       ],
       activeIndex: null,
     }

+ 3 - 1
src/views/statisticsCharts/index.vue

@@ -1,7 +1,9 @@
 <template>
   <div class="statistics-charts-wrapper">
     <!--导航-->
-    <StatisticsTabs />
+    <!-- <el-scrollbar> -->
+      <StatisticsTabs />
+    <!-- </el-scrollbar> -->
     <router-view />
   </div>
 </template>

+ 148 - 0
src/views/statisticsCharts/views/qualityStatistics.vue

@@ -0,0 +1,148 @@
+<template>
+  <CommonBarStatisticsCharts charts-title="数据质量" :query-settings="querySettings" :form-data="formData" :form-items="formItems" />
+</template>
+
+<script>
+import CommonBarStatisticsCharts from '../components/newBarStatisticsCharts.vue'
+import { Query } from '@/api/webApi'
+import { parseTime } from '@/utils'
+
+export default {
+  name: 'WorkloadStatisticsCharts',
+  components: { CommonBarStatisticsCharts },
+  data () {
+    const that = this
+    return {
+      querySettings: {
+        serviceId: SERVICE_ID.qualityStatistics,
+        seriesKey: 'qualityStatistics',
+        xAxisKey: 'fd',
+      },
+      formData: {
+        td: '日',
+        agent_number: '',
+        airport: '',
+        dateTime: [],
+      },
+      formItems: [
+        {
+          prop: 'td',
+          inputType: 'select',
+          placeholder: '时间维度',
+          requiredWarning: '请先选择统计时间维度',
+          options: [
+            {
+              value: '日',
+              label: '按日统计',
+            },
+            {
+              value: '月',
+              label: '按月统计',
+            },
+            {
+              value: '年',
+              label: '按年统计',
+            },
+          ],
+          changeHandler (value, oldValue) {
+            const typeMap = {
+              日: 'datePicker',
+              月: 'monthPicker',
+              年: 'yearPicker',
+            }
+            const dateTimeItem = this.formItems.find(
+              item => item.prop === 'dateTime'
+            )
+            const formData = this._.cloneDeep(this.formData)
+            if (dateTimeItem) {
+              dateTimeItem.inputType = typeMap[value]
+              const dateTime = formData.dateTime
+              if (dateTime && dateTime[0] && dateTime[1]) {
+                if (value === '年') {
+                  this.formData.dateTime[0] = dateTime[0].split('-')[0]
+                  this.formData.dateTime[1] = dateTime[1].split('-')[0]
+                }
+                if (value === '月') {
+                  if (oldValue === '年') {
+                    this.formData.dateTime[0] = `${dateTime[0].split('-')[0]
+                      }-01`
+                    this.formData.dateTime[1] = `${dateTime[1].split('-')[0]
+                      }-12`
+                  }
+                  if (oldValue === '日') {
+                    this.formData.dateTime[0] = dateTime[0]
+                      .split('-')
+                      .slice(0, 2)
+                      .join('-')
+                    this.formData.dateTime[1] = dateTime[1]
+                      .split('-')
+                      .slice(0, 2)
+                      .join('-')
+                  }
+                }
+                if (value === '日') {
+                  if (oldValue === '年') {
+                    this.formData.dateTime[0] = `${dateTime[0].split('-')[0]
+                      }-01-01`
+                    this.formData.dateTime[1] = `${dateTime[1].split('-')[0]
+                      }-12-31`
+                  }
+                  if (oldValue === '月') {
+                    this.formData.dateTime[0] = `${dateTime[0]
+                      .split('-')
+                      .slice(0, 2)
+                      .join('-')}-01`
+                    let [year, month] = dateTime[1].split('-')
+                    if (month === '12') {
+                      year = Number(year) + 1
+                      month = 1
+                    } else {
+                      month = Number(month) + 1
+                    }
+                    const day = 24 * 60 * 60 * 1000
+                    this.formData.dateTime[1] = parseTime(
+                      new Date(`${year}-${month}-01`) - day * 1,
+                      '{y}-{m}-{d}'
+                    )
+                  }
+                }
+              }
+            }
+          },
+        },
+        {
+          prop: 'dateTime',
+          inputType: 'datePicker',
+          width: '240px',
+          requiredWarning: '请先选择时间范围',
+        },
+      ],
+    }
+  },
+  methods: {
+    async getAgentOptions (airport) {
+      try {
+        const { code, returnData, message } = await Query({
+          serviceId: SERVICE_ID.agentCode,
+          dataContent: [
+            {
+              airport,
+            },
+          ],
+        })
+        if (String(code) === '0') {
+          const listValues = returnData.listValues || returnData
+          this.formItems[2].options = listValues.map(element => ({
+            label: element.agent_number,
+            value: element.agent_number,
+          }))
+        } else {
+          this.$message.error(message)
+        }
+      } catch (error) {
+        this.$message.error('失败')
+      }
+    },
+  },
+}
+</script>