|
@@ -0,0 +1,273 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="page-header-index-wide">
|
|
|
|
+ <a-card title="出入库数据" :loading="loading" v-show="visible" :bordered="false" :body-style="{padding: '0'}">
|
|
|
|
+ <div class="salesCard">
|
|
|
|
+ <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
|
|
|
|
+ <div class="extra-wrapper" slot="tabBarExtraContent">
|
|
|
|
+ <a-row :gutter="8">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-date-picker
|
|
|
|
+ mode="year"
|
|
|
|
+ style="width:150px"
|
|
|
|
+ :format="monthFormat"
|
|
|
|
+ v-model="queryParam.searchYear"
|
|
|
|
+ placeholder="请输入年份"
|
|
|
|
+ @panelChange="getData"
|
|
|
|
+ />
|
|
|
|
+ </a-col>
|
|
|
|
+ <!-- <a-col :md="2" :sm="24">
|
|
|
|
+ <a-button style="margin-left: 8px" type="primary" @click="handlePrint()">打印</a-button>
|
|
|
|
+ </a-col> -->
|
|
|
|
+ <!-- <a-col :md="2" :sm="24">
|
|
|
|
+ <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
|
|
|
|
+ </a-col> -->
|
|
|
|
+ </a-row>
|
|
|
|
+ </div>
|
|
|
|
+ <a-tab-pane loading="true" tab="图形统计" key="1">
|
|
|
|
+ <a-row>
|
|
|
|
+ <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
|
+ <chart-view :chartOption="chartOption" width="100%" height="600px" />
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-tab-pane>
|
|
|
|
+ <!-- <a-tab-pane loading="true" tab="表格统计" key="2">
|
|
|
|
+ <a-row>
|
|
|
|
+ <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
|
+ <div style="padding: 10px">
|
|
|
|
+ <a-table
|
|
|
|
+ bordered
|
|
|
|
+ :data-source="chartsData"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ tableLayout="auto"
|
|
|
|
+ :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
|
|
|
|
+ rowKey="month">
|
|
|
|
+ <span slot="action" slot-scope="record">
|
|
|
|
+ <template>
|
|
|
|
+ <a @click="handleView(record)">查看明细</a>
|
|
|
|
+ <a-divider type="vertical" />
|
|
|
|
+ </template>
|
|
|
|
+ </span>
|
|
|
|
+ </a-table>
|
|
|
|
+ </div>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-tab-pane> -->
|
|
|
|
+ </a-tabs>
|
|
|
|
+ </div>
|
|
|
|
+ </a-card>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { getRepairReport } from '@/api/report/repair-chart'
|
|
|
|
+import { Chart } from '@antv/g2'
|
|
|
|
+import moment from 'moment'
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: 'Analysis',
|
|
|
|
+ components: {
|
|
|
|
+ Chart
|
|
|
|
+ },
|
|
|
|
+ props: {
|
|
|
|
+ title: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: '保养任务月统计报表'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ loading: false,
|
|
|
|
+ serverData: [],
|
|
|
|
+ sbLevelMap: {},
|
|
|
|
+ treeData: [],
|
|
|
|
+ monthFormat: 'YYYY',
|
|
|
|
+ queryParam: {
|
|
|
|
+ searchYear: null
|
|
|
|
+ },
|
|
|
|
+ visible: true,
|
|
|
|
+ chart: null, // 创建一个chart变量
|
|
|
|
+ chartsData: {},
|
|
|
|
+ // 表头
|
|
|
|
+ columns: [
|
|
|
|
+ {
|
|
|
|
+ title: '月份',
|
|
|
|
+ width: 180,
|
|
|
|
+ dataIndex: 'month'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '数量',
|
|
|
|
+ width: 120,
|
|
|
|
+ dataIndex: 'totalNum'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '完成数量',
|
|
|
|
+ width: 120,
|
|
|
|
+ dataIndex: 'totalFinishNum'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '未完成数量',
|
|
|
|
+ width: 120,
|
|
|
|
+ dataIndex: 'totalWaitNum'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '完成率',
|
|
|
|
+ width: 120,
|
|
|
|
+ dataIndex: 'finishRate'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '操作',
|
|
|
|
+ key: 'action',
|
|
|
|
+ width: '200px',
|
|
|
|
+ align: 'center',
|
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ chartOption () {
|
|
|
|
+ return {
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'axis',
|
|
|
|
+ axisPointer: {
|
|
|
|
+ type: 'shadow'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ legend: {},
|
|
|
|
+ grid: {
|
|
|
|
+ left: '3%',
|
|
|
|
+ right: '4%',
|
|
|
|
+ bottom: '3%',
|
|
|
|
+ containLabel: true
|
|
|
|
+ },
|
|
|
|
+ yAxis: {
|
|
|
|
+ type: 'value',
|
|
|
|
+ boundaryGap: [0, 0.01]
|
|
|
|
+ },
|
|
|
|
+ xAxis: {
|
|
|
|
+ type: 'category',
|
|
|
|
+ data: this.chartsData.keys
|
|
|
|
+ },
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: this.chartsData.dianQiName,
|
|
|
|
+ type: 'bar',
|
|
|
|
+ data: this.chartsData.dianQiNums
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: this.chartsData.jiXiName,
|
|
|
|
+ type: 'bar',
|
|
|
|
+ data: this.chartsData.jiXiNums
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: this.chartsData.yiBiaoName,
|
|
|
|
+ type: 'bar',
|
|
|
|
+ data: this.chartsData.yiBiaoNums
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ mounted () {
|
|
|
|
+ this.$nextTick(function () {
|
|
|
|
+ this.getData()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ moment,
|
|
|
|
+ getData (val) {
|
|
|
|
+ console.log(val)
|
|
|
|
+ const params = {}
|
|
|
|
+ params.searchYear = this.BaseTool.Date.formatter(val, this.monthFormat)
|
|
|
|
+ this.queryParam.searchYear = params.searchYear
|
|
|
|
+ getRepairReport(params)
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log(res.data)
|
|
|
|
+ // 需要将数据分组:总数,完成数
|
|
|
|
+ this.chartsData = {}
|
|
|
|
+ const keys = []
|
|
|
|
+ const jiXiNums = []
|
|
|
|
+ const dianQiNums = []
|
|
|
|
+ const yiBiaoNums = []
|
|
|
|
+
|
|
|
|
+ for (const [key, value] of Object.entries(res.data)) {
|
|
|
|
+ keys.push(key)
|
|
|
|
+ jiXiNums.push(value.jiXiNum)
|
|
|
|
+ dianQiNums.push(value.dianQiNum)
|
|
|
|
+ yiBiaoNums.push(value.yiBiaoNum)
|
|
|
|
+ }
|
|
|
|
+ this.chartsData = { keys, jiXiNums, dianQiNums, yiBiaoNums }
|
|
|
|
+ this.chartsData.dianQiName = res.data[1].dianQiName
|
|
|
|
+ this.chartsData.jiXiName = res.data[1].jiXiName
|
|
|
|
+ this.chartsData.yiBiaoName = res.data[1].yiBiaoName
|
|
|
|
+ console.log(this.chartsData)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // handlePrint (record) {
|
|
|
|
+ // const modal = this.$refs.basePrintModal
|
|
|
|
+ // this.visible = false
|
|
|
|
+ // modal.base({ startMonth: this.queryParam.startMonth, endMonth: this.queryParam.endMonth, title: this.title, data: this.chartsData })
|
|
|
|
+ // },
|
|
|
|
+ // handleView (record) {
|
|
|
|
+ // const modal = this.$refs.detailModal
|
|
|
|
+ // modal.base(record)
|
|
|
|
+ // },
|
|
|
|
+ handleOk () {
|
|
|
|
+ this.visible = true
|
|
|
|
+ },
|
|
|
|
+ reset () {
|
|
|
|
+ this.queryParam = {
|
|
|
|
+ }
|
|
|
|
+ this.getData()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+.extra-wrapper {
|
|
|
|
+ line-height: 55px;
|
|
|
|
+ padding-right: 24px;
|
|
|
|
+
|
|
|
|
+ .extra-item {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ margin-right: 24px;
|
|
|
|
+
|
|
|
|
+ a {
|
|
|
|
+ margin-left: 24px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.antd-pro-pages-dashboard-analysis-twoColLayout {
|
|
|
|
+ position: relative;
|
|
|
|
+ display: flex;
|
|
|
|
+ display: block;
|
|
|
|
+ flex-flow: row wrap;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.antd-pro-pages-dashboard-analysis-salesCard {
|
|
|
|
+ height: calc(100% - 24px);
|
|
|
|
+ /deep/ .ant-card-head {
|
|
|
|
+ position: relative;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.dashboard-analysis-iconGroup {
|
|
|
|
+ i {
|
|
|
|
+ margin-left: 16px;
|
|
|
|
+ color: rgba(0,0,0,.45);
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ transition: color .32s;
|
|
|
|
+ color: black;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.analysis-salesTypeRadio {
|
|
|
|
+ position: absolute;
|
|
|
|
+ right: 54px;
|
|
|
|
+ bottom: 12px;
|
|
|
|
+}
|
|
|
|
+</style>
|