lilei %!s(int64=2) %!d(string=hai) anos
pai
achega
39a8704bb6

+ 30 - 0
src/api/reportData.js

@@ -548,4 +548,34 @@ export const expenseCollectReportExportByTarget = (params) => {
     method: 'post',
     responseType: 'blob'
   })
+}
+
+// 费用统计按品类分页
+export const expenseCollectReportQueryPageByProductType = (params) => {
+  const url = `/report/expenseCollectReport/queryPageByProductType/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 费用统计按品类汇总合计
+export const expenseCollectReportQueryCountByProductType = (params) => {
+  const url = `/report/expenseCollectReport/queryCountByProductType`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 导出费用统计按品类
+export const expenseCollectReportExportByProductType = (params) => {
+  return axios({
+    url: '/report/expenseCollectReport/exportByProductType',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
 }

+ 1 - 1
src/config/router.config.js

@@ -2094,7 +2094,7 @@ export const asyncRouterMap = [
               {
                 path: 'list',
                 name: 'expenseAccountCategoryReportList',
-                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/expenseAccountReport/bearerList.vue'),
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/expenseAccountReport/categoryList.vue'),
                 meta: {
                   title: '费用汇总报表(按品类)',
                   icon: 'profile',

+ 3 - 3
src/views/reportData/expenseAccountReport/bearerList.vue

@@ -110,9 +110,9 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
       rules: {
-        'months': [{ required: true, message: '请选择月份', trigger: 'change' }]
-        // 'targetType': [{ required: true, message: '请选择费用承担方类型', trigger: 'change' }],
-        // 'targetSn': [{ required: true, message: '请选择费用承担方名称', trigger: 'change' }]
+        'months': [{ required: true, message: '请选择月份', trigger: 'change' }],
+        'targetType': [{ required: true, message: '请选择费用承担方类型', trigger: 'change' }],
+        'targetSn': [{ required: true, message: '请选择费用承担方名称', trigger: 'change' }]
       },
       columns: [],
       // 加载数据方法 必须为 Promise 对象

+ 282 - 0
src/views/reportData/expenseAccountReport/categoryList.vue

@@ -0,0 +1,282 @@
+<template>
+  <a-card>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="returnGoodsPresentationList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :rules="rules"
+          :model="queryParam"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="统计月份" prop="months">
+                <months v-model="queryParam.months" mode="multiple" style="width: 100%;"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="费用归属品类(二级)" prop="productTypeSn2">
+                <ProductType v-model="productType" @change="changeProductType" placeholder="请选择费用归属品类"></ProductType>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="returnGoodsPresentationList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="returnGoodsPresentationList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="returnGoodsPresentationList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :defaultLoadData="false"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :showPagination="false"
+        :data="loadData"
+        bordered>
+        <template slot="footer">
+          <table v-if="totalData">
+            <tr>
+              <th colspan="4" width="32%" style="text-align: right;">{{ totalData['PRODUCT_TYPE_NAME2'] }}汇总:</th>
+              <th width="8%" style="text-align: center;"></th>
+              <th v-for="item in totalMData" width="6%" style="text-align: center;">{{ item }}</th>
+              <th width="6%" style="text-align: center;">{{ totalData['COUNT_PRICE'] }}</th>
+            </tr>
+          </table>
+        </template>
+      </s-table>
+    </a-spin>
+    <!-- 导出提示框 -->
+    <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+  </a-card>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import months from '@/views/common/months'
+import { hdExportExcel } from '@/libs/exportExcel'
+import reportModal from '@/views/common/reportModal.vue'
+import ProductType from '@/views/common/productType.js'
+import { expenseCollectReportQueryPageByProductType, expenseCollectReportQueryCountByProductType, expenseCollectReportExportByProductType } from '@/api/reportData'
+export default {
+  name: 'AllCountryCostReportList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, months, ProductType, reportModal },
+  data () {
+    return {
+      spinning: false,
+      open: false,
+      year: '',
+      showExport: false, // 导出弹窗初始值
+      productType: [],
+      queryParam: {
+        months: undefined,
+        productTypeSn2: undefined
+      },
+      addrProvinceList: [], //  省下拉
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      rules: {
+        'months': [{ required: true, message: '请选择月份', trigger: 'change' }],
+        'productTypeSn2': [{ required: true, message: '请选择费用归属品类(二级)', trigger: 'change' }]
+      },
+      columns: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const _this = this
+        _this.disabled = true
+        _this.spinning = true
+        const paramsPage = Object.assign(parameter, this.queryParam) //  有分页
+        return expenseCollectReportQueryPageByProductType(paramsPage).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+          }
+          this.spinning = false
+          this.getCount(paramsPage)
+          return data
+        })
+      },
+      totalData: null,
+      totalMData: []
+    }
+  },
+  methods: {
+    getColumns () {
+      const arr = [
+        {
+          title: '单据类型',
+          dataIndex: 'BILL_TYPE',
+          width: '8%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '费用类型',
+          dataIndex: 'COST_TYPE_NAME',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          },
+          width: '8%',
+          ellipsis: true
+        },
+        {
+          title: '费用归属品牌',
+          dataIndex: 'PRODUCT_BRAND_NAME',
+          width: '8%',
+          align: 'center',
+          customRender: function (text) {
+            return ((text || text == 0) ? text : '--')
+          }
+        },
+        {
+          title: '费用归属品类(二级)',
+          dataIndex: 'PRODUCT_TYPE_NAME2',
+          width: '8%',
+          align: 'center',
+          customRender: function (text) {
+            return ((text || text == 0) ? text : '--')
+          }
+        },
+        {
+          title: '费用归属品类(三级)',
+          dataIndex: 'PRODUCT_TYPE_NAME3',
+          width: '8%',
+          align: 'center',
+          customRender: function (text) {
+            return ((text || text == 0) ? text : '--')
+          }
+        }
+      ]
+
+      if (this.queryParam.months) {
+        for (let i = 0; i < this.queryParam.months.length; i++) {
+          const item = this.queryParam.months[i]
+          arr.push({
+            title: item.replace('-', '年') + '月',
+            dataIndex: 'M_' + item.replace('-', '_'),
+            width: '6%',
+            align: 'center',
+            customRender: function (text) {
+              return ((text || text == 0) ? text : '--')
+            }
+          })
+        }
+      }
+      arr.push({
+        title: '总计',
+        dataIndex: 'COUNT_PRICE',
+        width: '6%',
+        align: 'center',
+        customRender: function (text) {
+          return ((text || text == 0) ? text : '--')
+        }
+      })
+      this.columns = arr
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+    },
+    // 查询
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.getColumns()
+          _this.$refs.table.refresh(true)
+        } else {
+          return false
+        }
+      })
+    },
+    getCount (params) {
+      this.totalData = null
+      this.totalMData = []
+      expenseCollectReportQueryCountByProductType(params).then(res => {
+        this.totalData = res.data
+        for (var key in res.data) {
+          if (key.indexOf('M_') >= 0) {
+            this.totalMData.push(res.data[key])
+          }
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = {
+        months: undefined,
+        productTypeSn2: undefined
+      }
+      this.totalData = null
+      this.productType = []
+      this.totalMData = []
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+      this.getColumns()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.showExport = true
+          const params = _this.queryParam
+          _this.exportLoading = true
+          _this.spinning = true
+          hdExportExcel(expenseCollectReportExportByProductType, params, '费用汇总报表(按品类)', function () {
+            _this.exportLoading = false
+            _this.spinning = false
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    pageInit () {
+      this.getColumns()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style style="less">
+  .regionTypeSalesReportList-wrap{
+
+  }
+</style>