|
@@ -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>
|