408249787 2 years ago
parent
commit
a82951abb4

+ 31 - 0
src/api/report/instoredetail.js

@@ -125,3 +125,34 @@ export function exportInStoreDetail (parameter) {
     responseType: 'blob'
   })
 }
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getInStoreFormReport (parameter) {
+  return axios({
+    url: '/store/in-store-forms/getInStoreFormReport?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getOutStoreFormReport (parameter) {
+  return axios({
+    url: '/store/out-store-forms/getOutStoreFormReport?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}

+ 2 - 2
src/router/generator-platform-routers.js

@@ -271,7 +271,6 @@ const constantRouterComponents = {
   'MyTransferStoreForm': () => import('@/views/store/transferstoreform/MyTransferStoreForm'),
   'MySparePickForm': () => import('@/views/store/sparepickform/MySparePickForm'),
   'FastOutStore': () => import('@/views/store/fastoutstore/FastOutStore'),
-  'StoreStatistics': () => import('@/views/store/storestatistics/StoreStatistics'),
   'MySbInfo': () => import('@/views/sb/info/MySbInfo'),
   'ProjectSbInfo': () => import('@/views/sb/info/ProjectSbInfo'),
   'BanzuSbInfo': () => import('@/views/sb/info/BanzuSbInfo'),
@@ -332,7 +331,8 @@ const constantRouterComponents = {
   'RepairReportSbInfoFee': () => import('@/views/dashboard/RepairReportSbInfoFee'), // 设备维修费用报表
   'RepairReportMttr': () => import('@/views/dashboard/RepairReportMttr'), // MTTR月统计报表
   'RepairReportFee': () => import('@/views/dashboard/RepairReportFee'), // 费用按月统计
-
+  'OutStoreStatistics': () => import('@/views/dashboard/OutStoreStatistics'), // 出库统计报表
+  'InStoreStatistics': () => import('@/views/dashboard/InStoreStatistics'), // 入库统计报表
   // 自定义管理
   'CustomizeReport': () => import('@/views/customize/report/CustomizeReport') // 自定义报表
 }

+ 267 - 0
src/views/dashboard/InStoreStatistics.vue

@@ -0,0 +1,267 @@
+<template>
+  <div class="page-header-index-wide">
+    <a-card :title="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-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultStartMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.startMonth"
+              placeholder="开始月份"
+              @change="onStartChange" />
+            <a-month-picker
+              style="margin-left: 8px"
+              :default-value="moment(defaultEndMonth, monthFormat)"
+              :format="monthFormat"
+              v-model="queryParam.endMonth"
+              placeholder="结束月份"
+              @change="onEndChange" />
+            <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 :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
+                <div style="padding: 10px">
+                  <div id="container" style="width: 100%;overflow-x:auto"></div>
+                </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="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" />
+                        <a @click="doExportDetail(record)">导出</a>
+                      </template>
+                    </span> -->
+                  </a-table>
+                </div>
+              </a-col>
+            </a-row>
+          </a-tab-pane>
+        </a-tabs>
+      </div>
+    </a-card>
+    <print-in-repair-report ref="basePrintModal" @ok="handleOk"/>
+    <!-- <detail-repair-report ref="detailModal" @ok="handleOk"/> -->
+  </div>
+</template>
+
+<script>
+import { getOutStoreFormReport, getInStoreFormReport } from '@/api/report/instoredetail'
+import { Chart } from '@antv/g2'
+import PrintInRepairReport from '@/views/dashboard/modules/PrintInRepairReport'
+// import DetailRepairReport from '@/views/dashboard/modules/DetailRepairReport'
+import moment from 'moment'
+
+export default {
+  name: 'Analysis',
+  components: {
+    PrintInRepairReport,
+    Chart
+    // DetailRepairReport
+  },
+  props: {
+    /**
+     * 检查类型: 1->24小时非计划性维修 2-全部维修(不包括其他临时完善维修)
+     */
+    searchType: {
+      type: Number,
+      default: 1
+    },
+    title: {
+      type: String,
+      default: '入库报表'
+    }
+  },
+  data () {
+    return {
+      loading: false,
+      serverData: [],
+      monthFormat: 'YYYY-MM',
+      defaultStartMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01',
+      defaultEndMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12',
+      queryParam: {
+        // year: 2021,
+        startMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-01-01',
+        endMonth: this.BaseTool.Moment().format(this.BaseTool.Date.PICKER_NORM_YEAR) + '-12-01',
+        searchType: this.searchType
+      },
+      visible: true,
+      chart: null, // 创建一个chart变量
+      chartsData: [],
+      // 表头
+      columns: [
+        {
+          title: '月份',
+          width: 180,
+          dataIndex: 'month'
+        },
+        {
+          title: '数量',
+          width: 120,
+          dataIndex: 'num'
+        }
+        // {
+        //   title: '操作',
+        //   key: 'action',
+        //   width: '200px',
+        //   align: 'center',
+        //   scopedSlots: { customRender: 'action' }
+        // }
+      ]
+    }
+  },
+  created () {
+  },
+  mounted () {
+    this.$nextTick(function () {
+      this.getData()
+    })
+  },
+  methods: {
+    moment,
+    onStartChange (date, dateString) {
+      this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+    },
+    onEndChange (date, dateString) {
+      this.queryParam.endMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+    },
+    getData () {
+      if (this.queryParam.startMonth == null) {
+        this.$message.error('请选择起始月份')
+        return
+      }
+      if (this.queryParam.endMonth == null) {
+        this.$message.error('请选择结束月份')
+        return
+      }
+      if (this.searchType === 1) {
+        getInStoreFormReport(this.queryParam)
+          .then(res => {
+            this.chartsData = res.data
+            this.getCharts('container', this.chartsData)// 调用统计图
+          })
+      } else {
+        getOutStoreFormReport(this.queryParam)
+          .then(res => {
+            this.chartsData = res.data
+            this.getCharts('container', this.chartsData)// 调用统计图
+          })
+      }
+    },
+    getCharts (id, data) {
+      this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
+      this.chart = new Chart({
+        container: 'container',
+        autoFit: true,
+        height: 400
+      })
+      this.chart.data(data)
+      this.chart.scale('num', {
+        nice: true
+      })
+      this.chart.tooltip({
+        showMarkers: true,
+        shared: true
+      })
+      this.chart.interval().position('month*num')
+      this.chart.interaction('active-region')
+      this.chart.legend({
+        position: 'bottom'
+      })
+      this.chart.render()
+    },
+    // doExport () {
+    //   const parameter = {
+    //     ...this.queryParam
+    //   }
+    //   exportMonthReportBig24(parameter).then(file => {
+    //     this.BaseTool.UPLOAD.downLoadExportExcel(file)
+    //   })
+    // },
+    // doExportDetail (record) {
+    //   const parameter = {
+    //     ...this.queryParam,
+    //     month: record.month,
+    //     year: record.year
+    //   }
+    //   exportMonthReportBig24Month(parameter).then(file => {
+    //     this.BaseTool.UPLOAD.downLoadExportExcel(file)
+    //   })
+    // },
+    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
+    }
+  }
+}
+</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>

+ 22 - 0
src/views/dashboard/OutStoreStatistics.vue

@@ -0,0 +1,22 @@
+<template>
+  <InStoreStatistics :title="title" :search-type="2"/>
+</template>
+
+<script>
+import InStoreStatistics from './InStoreStatistics'
+export default {
+  name: 'OutStoreStatistics',
+  components: {
+    InStoreStatistics
+  },
+  data () {
+    return {
+      title: '出库报表'
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>