|
@@ -0,0 +1,271 @@
|
|
|
+<template>
|
|
|
+ <a-card :loading="loading" title="筹建统计报表">
|
|
|
+
|
|
|
+ <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-date-picker
|
|
|
+ style="margin-left: 8px"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
+ v-model="queryParam.applyTimeStart"
|
|
|
+ placeholder="开始时间"
|
|
|
+ />
|
|
|
+ <a-date-picker
|
|
|
+ style="margin-left: 8px"
|
|
|
+ :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
|
|
|
+ v-model="queryParam.applyTimeEnd"
|
|
|
+ placeholder="结束时间"
|
|
|
+ />
|
|
|
+ <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
|
|
|
+ <!-- <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>-->
|
|
|
+ <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
|
|
|
+ </div>
|
|
|
+ <a-tab-pane loading="true" tab="图形统计" key="1">
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="24">
|
|
|
+ <div style="padding: 10px">
|
|
|
+ <chart-view :chartOption="chartOption1" width="100%" height="600px" />
|
|
|
+ </div>
|
|
|
+ </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="chartsData1"
|
|
|
+ :columns="columns1"
|
|
|
+ tableLayout="auto"
|
|
|
+ :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
|
|
|
+ rowKey="month">
|
|
|
+ <span slot="action" slot-scope="record">
|
|
|
+ <a @click="handleView(record)">查看明细</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a @click="doExportDetail(record)">导出</a>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ </div>
|
|
|
+ <Detail ref="detail" />
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getPreparationPositionReport, exportAllPreparationPositionReport, exportPreparationPositionDetailReport } from '@/api/preparation/preparation'
|
|
|
+import Detail from './modules/Detail.vue'
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ Detail
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ queryParam: {
|
|
|
+ applyTimeStart: this.BaseTool.Date.formatter(new Date(), this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
|
|
|
+ applyTimeEnd: this.BaseTool.Date.formatter(new Date(), this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+ },
|
|
|
+ chartsData1: [],
|
|
|
+ chartsData2: [],
|
|
|
+ columns1: [
|
|
|
+ {
|
|
|
+ title: '车间',
|
|
|
+ width: 180,
|
|
|
+ dataIndex: 'positionName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '次数',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'preparationNum'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '费用(元)',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'totalFee'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ width: '200px',
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ columns2: [
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ width: 180,
|
|
|
+ dataIndex: 'statusName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '个数',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'num'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ chartOption1 () {
|
|
|
+ return {
|
|
|
+ // tooltip: {
|
|
|
+ // trigger: 'axis',
|
|
|
+ // axisPointer: {
|
|
|
+ // type: 'shadow'
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ legend: {},
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '次数'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'value',
|
|
|
+ name: '费用',
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value} 元'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: this.chartsData1.map(item => item.positionName)
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '次数',
|
|
|
+ type: 'bar',
|
|
|
+ data: this.chartsData1.map(item => item.preparationNum),
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ label: {
|
|
|
+ show: true, // 开启显示
|
|
|
+ position: 'top', // 在上方显示
|
|
|
+ textStyle: { // 数值样式
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '费用',
|
|
|
+ type: 'line',
|
|
|
+ data: this.chartsData1.map(item => item.totalFee),
|
|
|
+ yAxisIndex: 1,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ label: {
|
|
|
+ show: true, // 开启显示
|
|
|
+ position: 'top', // 在上方显示
|
|
|
+ textStyle: { // 数值样式
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ chartOption2 () {
|
|
|
+ return {
|
|
|
+ tooltip: {
|
|
|
+
|
|
|
+ },
|
|
|
+ legend: {},
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'pie',
|
|
|
+ center: ['50%', '50%'],
|
|
|
+ roseType: 'area',
|
|
|
+ itemStyle: {
|
|
|
+ borderRadius: 8
|
|
|
+ },
|
|
|
+ data: this.chartsData2.map(item => {
|
|
|
+ return {
|
|
|
+ value: item.num,
|
|
|
+ name: item.statusName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getData () {
|
|
|
+ if (this.queryParam.applyTimeStart) {
|
|
|
+ this.queryParam.applyTimeStart = this.BaseTool.Date.formatter(this.queryParam.applyTimeStart, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 00:00:00'
|
|
|
+ }
|
|
|
+ if (this.queryParam.applyTimeEnd) {
|
|
|
+ this.queryParam.applyTimeEnd = this.BaseTool.Date.formatter(this.queryParam.applyTimeEnd, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 23:59:59'
|
|
|
+ }
|
|
|
+ getPreparationPositionReport(this.queryParam).then(res => {
|
|
|
+ this.chartsData1 = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleView (record) {
|
|
|
+ console.log(record)
|
|
|
+ this.$refs.detail.base(record)
|
|
|
+ },
|
|
|
+ doExport () {
|
|
|
+ if (this.queryParam.applyTimeStart) {
|
|
|
+ this.queryParam.applyTimeStart = this.BaseTool.Date.formatter(this.queryParam.applyTimeStart, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 00:00:00'
|
|
|
+ }
|
|
|
+ if (this.queryParam.applyTimeEnd) {
|
|
|
+ this.queryParam.applyTimeEnd = this.BaseTool.Date.formatter(this.queryParam.applyTimeEnd, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 23:59:59'
|
|
|
+ }
|
|
|
+ const parameter = {
|
|
|
+ ...this.queryParam
|
|
|
+ }
|
|
|
+ exportAllPreparationPositionReport(parameter).then(file => {
|
|
|
+ this.BaseTool.UPLOAD.downLoadExportExcel(file)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ doExportDetail (record) {
|
|
|
+ if (this.queryParam.applyTimeStart) {
|
|
|
+ this.queryParam.applyTimeStart = this.BaseTool.Date.formatter(this.queryParam.applyTimeStart, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 00:00:00'
|
|
|
+ }
|
|
|
+ if (this.queryParam.applyTimeEnd) {
|
|
|
+ this.queryParam.applyTimeEnd = this.BaseTool.Date.formatter(this.queryParam.applyTimeEnd, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 23:59:59'
|
|
|
+ }
|
|
|
+ const parameter = {
|
|
|
+ ...this.queryParam,
|
|
|
+ positionId: record.positionId
|
|
|
+ }
|
|
|
+ exportPreparationPositionDetailReport(parameter).then(file => {
|
|
|
+ this.BaseTool.UPLOAD.downLoadExportExcel(file)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+</style>
|