NoPhotoStats.vue 6.17 KB
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { Search, Download } from '@element-plus/icons-vue'
import * as echarts from 'echarts'

const queryForm = reactive({
    dateRange: [],
    city: ''
})

const cities = ['南京市', '无锡市', '徐州市', '常州市', '苏州市', '南通市', '连云港市', '淮安市', '盐城市', '扬州市', '镇江市', '泰州市', '宿迁市']

const cityTableData = ref([
    { city: '南京市', count1: 100, count1p: '50%', count2: 50, count2p: '25%', count3: 30, count3p: '15%', count4: 20, count4p: '10%', total: 200, rate: '2.5%' },
    { city: '苏州市', count1: 90, count1p: '45%', count2: 60, count2p: '30%', count3: 30, count3p: '15%', count4: 20, count4p: '10%', total: 200, rate: '2.2%' },
])

const deviceTableData = ref([
    { device: '光猫', count1: 50, count1p: '50%', count2: 25, count2p: '25%', count3: 15, count3p: '15%', count4: 10, count4p: '10%', total: 100, rate: '1.2%' },
])

const chartRef = ref<HTMLElement>()

const initChart = () => {
    if (chartRef.value) {
        const chart = echarts.init(chartRef.value)
        chart.setOption({
            title: { text: '地市不能拍次数占比统计' },
            tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
            legend: { data: ['1次', '2次', '3次', '4次及以上'], bottom: 0 },
            grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
            xAxis: { type: 'category', data: ['南京', '无锡', '徐州', '常州', '苏州', '南通', '连云港', '淮安', '盐城', '扬州', '镇江', '泰州', '宿迁'], axisLabel: { interval: 0, rotate: 30 } },
            yAxis: { type: 'value', name: '占比%' },
            series: [
                { name: '1次', type: 'bar', stack: 'total', label: { show: true }, data: [50, 45, 60, 55, 40, 50, 60, 50, 55, 45, 60, 50, 40] },
                { name: '2次', type: 'bar', stack: 'total', label: { show: true }, data: [25, 30, 20, 25, 30, 25, 20, 25, 20, 30, 20, 25, 30] },
                { name: '3次', type: 'bar', stack: 'total', label: { show: true }, data: [15, 15, 10, 10, 20, 15, 10, 15, 15, 15, 10, 15, 20] },
                { name: '4次及以上', type: 'bar', stack: 'total', label: { show: true }, data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] }
            ]
        })
    }
}

onMounted(() => {
    initChart()
})
</script>

<template>
  <div class="nophoto-stats-page">
     <!-- Filter -->
    <el-card shadow="never" class="mb-4">
      <el-form :inline="true" :model="queryForm">
        <el-form-item label="日期">
           <el-date-picker
            v-model="queryForm.dateRange"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
          />
        </el-form-item>
        <el-form-item label="地区">
            <el-select v-model="queryForm.city" placeholder="请选择" class="!w-40" clearable>
                <el-option v-for="c in cities" :key="c" :label="c" :value="c" />
            </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" :icon="Search">查询</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- Chart -->
    <el-card shadow="never" class="mb-4">
        <div ref="chartRef" style="height: 400px"></div>
    </el-card>

    <!-- Tables -->
    <div class="grid grid-cols-1 gap-4">
        <el-card shadow="never">
            <template #header>
                <div class="flex justify-between">
                    <span class="font-bold">地市不能拍次数统计</span>
                    <el-button link type="primary" :icon="Download">导出</el-button>
                </div>
            </template>
            <el-table :data="cityTableData" border stripe>
                <el-table-column prop="city" label="地市" />
                <el-table-column label="1次不能拍">
                    <template #default="{row}">{{row.count1}} ({{row.count1p}})</template>
                </el-table-column>
                <el-table-column label="2次不能拍">
                    <template #default="{row}">{{row.count2}} ({{row.count2p}})</template>
                </el-table-column>
                <el-table-column label="3次不能拍">
                    <template #default="{row}">{{row.count3}} ({{row.count3p}})</template>
                </el-table-column>
                <el-table-column label="4次及以上">
                    <template #default="{row}">{{row.count4}} ({{row.count4p}})</template>
                </el-table-column>
                <el-table-column prop="total" label="不能拍总次数" sortable />
                <el-table-column prop="rate" label="占比(本市)" sortable />
            </el-table>
        </el-card>

        <el-card shadow="never">
             <template #header>
                <div class="flex justify-between">
                    <span class="font-bold">设备不能拍次数统计</span>
                    <el-button link type="primary" :icon="Download">导出</el-button>
                </div>
            </template>
             <el-table :data="deviceTableData" border stripe>
                <el-table-column prop="device" label="设备名称" />
                <el-table-column label="1次不能拍">
                    <template #default="{row}">{{row.count1}} ({{row.count1p}})</template>
                </el-table-column>
                <el-table-column label="2次不能拍">
                    <template #default="{row}">{{row.count2}} ({{row.count2p}})</template>
                </el-table-column>
                <el-table-column label="3次不能拍">
                    <template #default="{row}">{{row.count3}} ({{row.count3p}})</template>
                </el-table-column>
                <el-table-column label="4次及以上">
                    <template #default="{row}">{{row.count4}} ({{row.count4p}})</template>
                </el-table-column>
                <el-table-column prop="total" label="不能拍总次数" sortable />
                <el-table-column prop="rate" label="占比(设备)" sortable />
            </el-table>
        </el-card>
    </div>
  </div>
</template>