408249787 2 rokov pred
rodič
commit
1067a2bc7c

+ 15 - 0
src/api/store/fastoutstore.js

@@ -43,3 +43,18 @@ export function inSqare (parameter) {
     data: parameter
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getSqareInfo (parameter) {
+  return axios({
+    url: '/sqarepartmanage/spare-part-info/getInAndOutReport?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}

+ 1 - 0
src/router/generator-platform-routers.js

@@ -271,6 +271,7 @@ 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'),

+ 43 - 7
src/views/store/fastoutstore/FastOutStore.vue

@@ -31,6 +31,15 @@
           <span slot="status" slot-scope="text, record">
             <a @click="handleStore(record)">{{ text||"无" }}</a>
           </span>
+          <span slot="num" slot-scope="record">
+            <template>
+              <a-input-number
+                v-model="record.num"
+                :min="1"
+                :formatter="value => `${value}${record.unit}`"
+                :parser="value => value.replace(record.unit, '')" />
+            </template>
+          </span>
           <span slot="action" slot-scope="record">
             <template>
               <a @click="changeStore(record,1)">出库</a>
@@ -41,19 +50,16 @@
         </s-table>
       </a-col>
     </a-row>
-    <BaseForm ref="baseForm" @ok="handleOk"/>
   </a-card>
 </template>
 
 <script>
 import { STable } from '@/components'
-import { getSqarePage } from '@/api/store/fastoutstore'
-import BaseForm from './modules/BaseForm'
+import { getSqarePage, outSqare, inSqare } from '@/api/store/fastoutstore'
 export default {
   name: 'FastOutStore',
   components: {
-    STable,
-    BaseForm
+    STable
   },
   data () {
     return {
@@ -151,10 +157,19 @@ export default {
           width: '200px',
           dataIndex: 'createdTime'
         },
+        {
+          title: '填报',
+          checked: true,
+          width: '100px',
+          fixed: 'right',
+          key: 'num',
+          align: 'center',
+          scopedSlots: { customRender: 'num' }
+        },
         {
           title: '操作',
           checked: true,
-          width: '250px',
+          width: '150px',
           fixed: 'right',
           key: 'action',
           align: 'center',
@@ -181,6 +196,7 @@ export default {
       selectedRows: [],
       levelMap: {},
       visible: true,
+      num: 1,
       options: {
         alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
         rowSelection: {
@@ -240,7 +256,27 @@ export default {
       this.$refs.table.refresh(true)
     },
     changeStore (val, type) {
-      this.$refs.baseForm.base(val, type)
+      if (!val.num) {
+        this.$message.success('请填报数量')
+        return
+      }
+      if (type === 1) {
+        outSqare({
+          spareId: val.id,
+          outNum: val.num
+        }).then(res => {
+          this.$message.success('出库成功!')
+          this.$refs.table.refresh()
+        })
+        return
+      }
+      inSqare({
+        spareId: val.id,
+        inNum: val.num
+      }).then(res => {
+        this.$message.success('入苦成功!')
+        this.$refs.table.refresh()
+      })
     }
   }
 }

+ 269 - 0
src/views/store/storestatistics/StoreStatistics.vue

@@ -0,0 +1,269 @@
+<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
+                  :format="monthFormat"
+                  v-model="queryParam.searchTimeStart"
+                  placeholder="开始时间"
+                /></a-col>
+              <a-col :md="6" :sm="24">
+                <a-date-picker
+                  :format="monthFormat"
+                  v-model="queryParam.searchTimeEnd"
+                  placeholder="结束时间"
+                /></a-col>
+              <a-col :md="6" :sm="24">
+                <a-input
+                  v-model="queryParam.spareName"
+                  placeholder="备件名称" /></a-col>
+              <a-col :md="3" :sm="24">
+                <a-button type="default" @click="reset()">重置</a-button>
+              </a-col>
+              <a-col :md="3" :sm="24">
+                <a-button type="primary" @click="getData()">查询</a-button>
+              </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">
+                <div style="padding: 10px">
+                  <div id="container"></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" />
+                      </template>
+                    </span>
+                  </a-table>
+                </div>
+              </a-col>
+            </a-row>
+          </a-tab-pane>
+        </a-tabs>
+      </div>
+    </a-card>
+    <print-in-check-job-report ref="basePrintModal" @ok="handleOk"/>
+    <detail-check-job-report ref="detailModal" @ok="handleOk"/>
+  </div>
+</template>
+
+<script>
+import { getSqareInfo } from '@/api/store/fastoutstore'
+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-MM-DD',
+      queryParam: {
+      },
+      levelMap: {},
+      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' }
+        }
+      ]
+    }
+  },
+  created () {
+
+  },
+  mounted () {
+    this.$nextTick(function () {
+      this.getData()
+    })
+  },
+  methods: {
+    moment,
+    getData () {
+      const params = { ...this.queryParam }
+      if (params.searchTimeStart) {
+        params.searchTimeStart = this.BaseTool.Date.formatter(params.searchTimeStart, this.monthFormat) + ' 00:00:00'
+      }
+      // else {
+      //   params.searchTimeStart = this.BaseTool.Date.formatter(new Date(), 'YYYY-MM') + '-01'
+      // }
+      if (params.searchTimeEnd) {
+        params.searchTimeEnd = this.BaseTool.Date.formatter(params.searchTimeEnd, this.monthFormat) + ' 23:59:59'
+      }
+
+      getSqareInfo(params)
+        .then(res => {
+          this.chartsData = res.data
+
+          // 需要将数据分组:总数,完成数
+          const groupData = []
+          this.chartsData.forEach(function (data) {
+            groupData.push({ name: '总数', month: data.month + '', num: data.totalNum })
+            groupData.push({ name: '完成数', month: data.month + '', num: data.totalFinishNum })
+          })
+          this.getCharts('container', groupData)// 调用统计图
+        })
+    },
+    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: false,
+        shared: true
+      })
+      this.chart.interval().position('month*num').color('name').adjust([
+        {
+          type: 'dodge',
+          marginRatio: 0
+        }
+      ])
+      this.chart.interaction('active-region')
+      this.chart.legend({
+        position: 'bottom'
+      })
+      this.chart.render()
+    },
+    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>