Ver código fonte

费用汇总报表

lilei 2 anos atrás
pai
commit
4d4d5e97ab

+ 29 - 0
src/api/reportData.js

@@ -519,4 +519,33 @@ export const allocateReturnReportDetailExport = (params) => {
     method: 'post',
     responseType: 'blob'
   })
+}
+// 费用统计按承担方分页
+export const expenseCollectReportQueryPageByTarget = (params) => {
+  const url = `/report/expenseCollectReport/queryPageByTarget/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 费用统计按承担方汇总合计
+export const expenseCollectReportQueryCountByTarget = (params) => {
+  const url = `/report/expenseCollectReport/queryCountByTarget`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 导出费用统计按承担方
+export const expenseCollectReportExportByTarget = (params) => {
+  return axios({
+    url: '/report/expenseCollectReport/exportByTarget',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
 }

+ 50 - 0
src/config/router.config.js

@@ -2053,6 +2053,56 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/reportData/expenseAccountBearerReport',
+            redirect: '/reportData/expenseAccountBearerReport/list',
+            name: 'expenseAccountBearerReport',
+            component: BlankLayout,
+            meta: {
+              title: '费用汇总报表(按承担方)',
+              icon: 'profile'
+              // permission: 'M_expenseAccountBearerReportList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'expenseAccountBearerReportList',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/expenseAccountReport/bearerList.vue'),
+                meta: {
+                  title: '费用汇总报表(按承担方)',
+                  icon: 'profile',
+                  hidden: true
+                  // permission: 'M_expenseAccountBearerReportList'
+                }
+              }
+            ]
+          },
+          {
+            path: '/reportData/expenseAccountCategoryReport',
+            redirect: '/reportData/expenseAccountCategoryReport/list',
+            name: 'expenseAccountCategoryReport',
+            component: BlankLayout,
+            meta: {
+              title: '费用汇总报表(按品类)',
+              icon: 'profile'
+              // permission: 'M_expenseAccountCategoryReportList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'expenseAccountCategoryReportList',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/expenseAccountReport/bearerList.vue'),
+                meta: {
+                  title: '费用汇总报表(按品类)',
+                  icon: 'profile',
+                  hidden: true
+                  // permission: 'M_expenseAccountCategoryReportList'
+                }
+              }
+            ]
           }
           // {
           //   path: '/reportData/allCountryCostReport',

+ 74 - 0
src/views/common/months.js

@@ -0,0 +1,74 @@
+const Months = {
+  template: `
+      <a-select
+        placeholder="请选择月份"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        :mode="mode"
+        :disabled="disabled"
+        :maxTagCount="2"
+        @change="handleChange"
+        option-filter-prop="children"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in monthList" :key="item.val" :value="item.val" :disabled="item.disabled">{{ item.name }}</a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: [String,Array],
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    mode: {
+      type: String,
+      default: 'default'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      monthList: []
+    };
+  },
+  mounted() {
+    const year = new Date().getFullYear()
+    const curMonth = new Date().getMonth()
+    const m = ['一','二','三','四','五','六','七','八','九','十','十一','十二']
+    for(let i=1;i<=12;i++){
+      this.monthList.push({
+        val: year +"-" + (i<10?'0'+i:i),
+        name: year + '年' + (i<10?'0'+i:i) + '月',
+        disabled: (i-1)>curMonth
+      })
+    }
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    },
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      const row = this.monthList.find(item => item.val == value)
+      this.$emit('input', value);
+      this.$emit('change', value, this.id, row);
+    },
+  },
+};
+
+export default Months

+ 1 - 1
src/views/expenseManagement/expenseReimbursement/department.js

@@ -53,8 +53,8 @@ const Department = {
     },
     handleChange(value) {
       this.defaultVal = value;
-      this.$emit('change', value);
       this.$emit('input', value);
+      this.$emit('change', value);
     },
     getList () {
       departmentQueryList({}).then(res => {

+ 302 - 0
src/views/reportData/expenseAccountReport/bearerList.vue

@@ -0,0 +1,302 @@
+<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="targetType">
+                <v-select
+                  code="EXPENSE_ACCOUNT_DETAIL_SPLIT_OBJ_TYPE"
+                  allowClear
+                  style="width: 100%;"
+                  v-model="queryParam.targetType"
+                  placeholder="请选择承担方类型"
+                ></v-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="费用承担方名称" prop="targetSn">
+                <!-- 部门 -->
+                <department v-show="queryParam.targetType=='DEPARTMENT'" style="width: 100%;" placeholder="请选择承担方" v-model="queryParam.targetSn"></department>
+                <!-- 经销商 -->
+                <custList
+                  v-show="queryParam.targetType=='CUSTOMER'"
+                  cooperateFlag="1"
+                  @change="custChange"
+                  placeholder="请选择(输入名称搜索)"></custList>
+                <a-select v-if="!queryParam.targetType" placeholder="请选择承担方"></a-select>
+              </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="5" width="42%" style="text-align: right;">汇总:</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 department from '@/views/expenseManagement/expenseReimbursement/department.js'
+import custList from '@/views/common/custList.vue'
+import { expenseCollectReportQueryPageByTarget, expenseCollectReportQueryCountByTarget, expenseCollectReportExportByTarget } from '@/api/reportData'
+export default {
+  name: 'AllCountryCostReportList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, months, department, custList, reportModal },
+  data () {
+    return {
+      spinning: false,
+      open: false,
+      year: '',
+      showExport: false, // 导出弹窗初始值
+      queryParam: {
+        months: undefined,
+        targetType: undefined,
+        targetSn: undefined
+      },
+      addrProvinceList: [], //  省下拉
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      rules: {
+        'months': [{ required: true, message: '请选择月份', trigger: 'change' }]
+        // 'targetType': [{ required: true, message: '请选择费用承担方类型', trigger: 'change' }],
+        // 'targetSn': [{ 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 expenseCollectReportQueryPageByTarget(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: 'TARGET_TYPE',
+          width: '10%',
+          align: 'center',
+          customRender: function (text) {
+            return ((text || text == 0) ? text : '--')
+          }
+        },
+        {
+          title: '费用承担方名称',
+          dataIndex: 'TARGET_NAME',
+          width: '10%',
+          align: 'center',
+          customRender: function (text) {
+            return ((text || text == 0) ? text : '--')
+          }
+        },
+        {
+          title: '区域',
+          dataIndex: 'SUBAREA_NAME',
+          width: '6%',
+          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
+    },
+    custChange (v, obj, id) {
+      this.queryParam.targetSn = v.key
+      this.$refs.ruleForm.validateField('targetSn')
+    },
+    // 查询
+    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 = []
+      expenseCollectReportQueryCountByTarget(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,
+        targetType: undefined,
+        targetSn: undefined
+      }
+      this.totalData = null
+      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(expenseCollectReportExportByTarget, 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>