|
@@ -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>
|