Ver Fonte

Merge branch 'develop_yh51_1' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh55

# Conflicts:
#	public/version.json
#	vue.config.js
lilei há 2 meses atrás
pai
commit
48b6616b91

+ 1 - 1
public/version.json

@@ -1,4 +1,4 @@
 {
-    "version": "2.2.531",
+    "version": "2.2.551",
     "message": "发现有新版本发布,确定更新系统?"
 }

+ 27 - 0
src/api/reportData.js

@@ -1500,3 +1500,30 @@ export const brandTypeReportExport = (params) => {
     }
   })
 }
+
+// 经营分析报表
+export const manageAnalysisReportQuery = (params) => {
+  const url = `/report/manageAnalysis/query`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('各品类经营分析报表查询')
+    }
+  })
+}
+// 经营分析报表导出
+export const manageAnalysisReportExport = (params) => {
+  return axios({
+    url: '/report/manageAnalysis/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers: {
+      'module': encodeURIComponent('各品类经营分析报表导出')
+    }
+  })
+}

+ 25 - 0
src/config/report/salesReport.js

@@ -333,6 +333,31 @@ export default {
               }
             ]
           },
+          {
+            path: '/reportData/regionTypeBusinessReport',
+            redirect: '/reportData/regionTypeBusinessReport/list',
+            name: 'regionTypeBusinessReport',
+            component: BlankLayout,
+            meta: {
+              title: '各品类经营分析表',
+              icon: 'profile',
+              permission: 'M_regionTypeSalesReportList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'regionTypeBusinessReportList',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/regionTypeBusinessReport/list.vue'),
+                meta: {
+                  title: '各品类经营分析表',
+                  icon: 'profile',
+                  hidden: true,
+                  permission: 'M_regionTypeSalesReportList'
+                }
+              }
+            ]
+          },
           {
             path: '/reportData/salesPresentation',
             redirect: '/reportData/salesPresentation/list',

+ 7 - 0
src/libs/getDate.js

@@ -136,6 +136,13 @@ export default {
     obj.endtime = moment(moment().month(moment().month() - 2).endOf('month').valueOf()).format('YYYY-MM-DD 23:59:59')
     return obj
   },
+  // 获取某年某个月的开始和结束时间
+  getBeDateByMonth (str) {
+    return {
+      	beginDate: moment(str).startOf('month').format('YYYY-MM-DD 00:00:00'),
+      	endDate: moment(str).endOf('month').format('YYYY-MM-DD 23:59:59')
+    }
+  },
   // 获取某一年的开始和结束时间
   getBeDateByYear (year) {
     return {

+ 25 - 6
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -62,13 +62,21 @@
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
-            <a-form-model-item label="费用归属品牌">
-              <ProductBrand id="allocateBill-basicInfo-productBrandSn" @change="changeBrand" v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
+            <a-form-model-item
+              label="费用归属品牌"
+              prop="productBrandSn"
+              :required="form.costTypeName=='促销费用'"
+            >
+              <ProductBrand id="allocateBill-basicInfo-productBrandSn" @change="changeBrand" showAllBrand v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
-            <a-form-model-item label="费用归属品类">
-              <productTypeAll placeholder="请选择费用归属品类(单选,可选二级或三级)" @change="changeProductType" v-model="productType" id="allocateBill-basicInfo-productType"></productTypeAll>
+            <a-form-model-item
+              label="费用归属品类"
+              prop="productTypeSn2"
+              :required="form.costTypeName=='促销费用'"
+            >
+              <productTypeAll placeholder="请选择费用归属品类(单选,至少选到二级或三级)" showAllType @change="changeProductType" v-model="productType" id="allocateBill-basicInfo-productType"></productTypeAll>
             </a-form-model-item>
           </a-col>
           <a-col :md="12" :sm="24">
@@ -221,6 +229,18 @@ export default {
       this.form.costTypeName = opt && opt[0] ? opt[0].name : ''
       this.form.allocateSortName = opt && opt[1] ? opt[1].name : ''
       this.form.allocateTypeName = opt && opt[2] ? opt[2].name : ''
+      // 校验规则
+      this.$refs.ruleForm.clearValidate()
+      this.valiadBranType()
+    },
+    valiadBranType () {
+      if (this.form.costTypeName == '促销费用') {
+        this.rules.productBrandSn = [{ required: true, message: '请选择归属品牌', trigger: 'change' }]
+        this.rules.productTypeSn2 = [{ required: true, message: '请选择归属分类(至少选择到2级或3级分类)', trigger: 'change' }]
+      } else {
+        this.rules.productBrandSn = []
+        this.rules.productTypeSn2 = []
+      }
     },
     //  产品分类  change
     changeProductType (val, id, opt) {
@@ -235,7 +255,6 @@ export default {
     },
     // 品牌
     changeBrand (val, id, opt) {
-      console.log(val, opt, '------------')
       this.form.productBrandName = opt ? opt.brandName : ''
     },
     fetchUser (dealerName) {
@@ -356,7 +375,6 @@ export default {
           this.$nextTick(() => {
             this.$refs.attachList.setFileList(this.attachList)
           })
-
           this.allocateTypeVal = [this.detailData.costTypeSn, this.detailData.allocateSortSn, this.detailData.allocateTypeSn]
           if (this.detailData.productTypeSn1) {
             this.productType = [this.detailData.productTypeSn1, this.detailData.productTypeSn2, this.detailData.productTypeSn3]
@@ -367,6 +385,7 @@ export default {
           if (!this.form.productBrandSn) {
             this.form.productBrandSn = undefined
           }
+          this.valiadBranType()
         }
       }
     }

+ 0 - 193
src/views/allocationManagement/transferOut/chooseImportModal.vue

@@ -1,193 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="chooseImport-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="导入"
-    v-model="isShow"
-    @cancel="isShow=false"
-    :width="900">
-    <div class="chooseImport-con">
-      <!-- 可导入数据 -->
-      <p class="">可导入数据{{ loadData.length }}条</p>
-      <a-table
-        class="sTable"
-        ref="table"
-        size="small"
-        :rowKey="(record) => record.allocateSn"
-        :columns="nowColumns"
-        :dataSource="loadData"
-        :loading="loading"
-        :scroll="{ y: 200 }"
-        :pagination="false"
-        bordered>
-      </a-table>
-      <a-divider />
-      <!-- 不可导入数据 -->
-      <p class="red">不可导入数据{{ unLoadData.length }}条</p>
-      <a-table
-        class="unTable"
-        ref="unTable"
-        size="small"
-        :rowKey="(record) => record.errorDesc"
-        :columns="nowUnColumns"
-        :dataSource="unLoadData"
-        :loading="loading"
-        :scroll="{ y: 200 }"
-        :pagination="false"
-        bordered>
-      </a-table>
-      <!-- 按钮 -->
-      <div class="btn-con">
-        <a-button
-          type="primary"
-          id="chooseImport-submit"
-          size="large"
-          :class="loadData.length==0?'button-grey':'button-primary'"
-          @click="handleSubmit"
-          style="padding: 0 40px;">确认导入</a-button>
-        <a-button
-          id="chooseImport-cancel"
-          size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
-        <a-button
-          type="primary"
-          id="chooseImport-error"
-          size="large"
-          class="button-error"
-          @click="handleError"
-          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
-      </div>
-    </div>
-  </a-modal>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { hdExportExcel } from '@/libs/exportExcel'
-// 接口
-import { allocateBillParseProducts, allocateBillFailExcel } from '@/api/allocateBill'
-export default {
-  name: 'TransferOutChooseImportModal',
-  mixins: [commonMixin],
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    paramsData: {
-      type: Object,
-      default: () => {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      nowColumns: [ //  正品
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      nowUnColumns: [ //  促销品
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '备注', dataIndex: 'errorDesc', width: 180, align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      loadData: [], // 可导入数据
-      unLoadData: [], // 错误数据
-      loading: false// 表格加载状态
-    }
-  },
-  methods: {
-    // 获取表格数据
-    getData () {
-      const _this = this
-      this.loading = true
-      // 获取列表数据  无分页
-      allocateBillParseProducts(this.paramsData).then(res => {
-        this.loading = false
-        if (res.status == 200) {
-          if (res.data.okList && res.data.okList.length > 0) {
-            res.data.okList.map((item, index) => {
-              item.no = index + 1
-            })
-          }
-          if (res.data.failList && res.data.failList.length > 0) {
-            res.data.failList.map((item, index) => {
-              item.no = index + 1
-            })
-          }
-          _this.loadData = res.data.okList || []
-          _this.unLoadData = res.data.failList || []
-        }
-      })
-    },
-    // 确认导入
-    handleSubmit () {
-      if (this.loadData.length == 0) {
-        this.$message.warning('无可导入产品!')
-      } else {
-        this.$emit('ok', this.loadData)
-        this.isShow = false
-      }
-    },
-    // 导出
-    handleError () {
-      const _this = this
-      if (_this.unLoadData.length < 1) {
-        _this.$message.info('暂无可导出错误项~')
-        return
-      }
-      _this.spinning = true
-      hdExportExcel(allocateBillFailExcel, _this.unLoadData, '产品导入错误项', function () {
-        _this.spinning = false
-      })
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        this.loadData = []
-        this.unLoadData = []
-      } else {
-        this.getData()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less" scoped>
-  .chooseImport-modal{
-    .chooseImport-con{
-      .red{
-        color: #f30;
-      }
-      .btn-con{
-        text-align: center;
-        margin: 30px 0 20px;
-        .button-cancel,.button-error{
-          font-size: 12px;
-        }
-      }
-    }
-  }
-</style>

+ 25 - 24
src/views/allocationManagement/transferOut/edit.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="allocateBillEdit-wrap">
-    <div class="ant-spin-nested-loading">
+    <a-spin :spinning="spinning" tip="Loading...">
       <a-page-header :ghost="false" :backIcon="false" class="allocateBillEdit-back" >
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
@@ -108,7 +108,7 @@
         </div>
       </a-card>
       <!-- 选择产品 -->
-      <a-card size="small" title="选择产品" :bordered="false" class="allocateBillEdit-cont">
+      <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
         <!-- 筛选条件 -->
         <div class="table-page-search-wrapper">
           <a-form layout="inline" id="allocateBillDetail-form" @keyup.enter.native="$refs.table.refresh(true)">
@@ -327,18 +327,17 @@
           </template>
         </s-table>
       </a-card>
-    </div>
-    <div class="affix-cont" v-if="basicInfoData">
-      <a-button
-        type="primary"
-        id="allocateBillEdit-submit"
-        size="large"
-        :loading="spinning"
-        class="button-primary"
-        @click="handleOpen"
-        style="padding: 0 60px;">提交</a-button>
-    </div>
-
+      <div class="affix-cont" v-if="basicInfoData">
+        <a-button
+          type="primary"
+          id="allocateBillEdit-submit"
+          size="large"
+          :loading="spinning"
+          class="button-primary"
+          @click="handleOpen"
+          style="padding: 0 60px;">提交</a-button>
+      </div>
+    </a-spin>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" />
     <!-- 打印导出 -->
@@ -389,7 +388,7 @@ import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
 import { queryStockProductForOtherPage } from '@/api/stock'
 import { productPriceInfo } from '@/api/product'
 import { departmentQueryList } from '@/api/expenseManagement'
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
+import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
 
 export default {
   name: 'TransferOutEdit',
@@ -621,12 +620,8 @@ export default {
     },
     // 导入产品
     handleGuideOk (obj) {
-      allocateBillBatchInsert(obj).then(res => {
-        if (res.status == 200) {
-          this.$refs.chooseTable.refresh(true)
-          this.getDetail(true)
-        }
-      })
+      this.$refs.chooseTable.refresh(true)
+      this.getDetail(true)
     },
     // 已选产品  重置
     chooseResetSearchForm (flag) {
@@ -896,10 +891,13 @@ export default {
     height: 100%;
     box-sizing: border-box;
     > .ant-spin-nested-loading {
-        position: relative;
         height: 100%;
-        overflow: auto;
-        padding-bottom: 50px;
+        > .ant-spin-container{
+          position: relative;
+          height: 100%;
+          overflow: auto;
+          padding-bottom: 60px;
+        }
     }
     .allocateBillEdit-back{
       margin-bottom: 6px;
@@ -925,5 +923,8 @@ export default {
         margin-left: 15px;
       }
     }
+    .affix-cont{
+      position: fixed;
+    }
   }
 </style>

+ 225 - 43
src/views/allocationManagement/transferOut/importGuideModal.vue

@@ -4,12 +4,13 @@
     class="importGuide-modal"
     :footer="null"
     :maskClosable="false"
-    title="导入"
+    destroyOnClose
+    title="导入产品"
     v-model="isShow"
-    @cancel="isShow=false"
-    :width="750">
+    :closable="false"
+    :width="850">
     <div class="importGuide-con">
-      <div class="explain-con">
+      <div class="explain-con" v-show="step==0">
         <div class="explain-item">
           <div class="explain-tit">
             <span>1</span>准备导入
@@ -24,7 +25,7 @@
             type="link"
             icon="download"
             style="padding: 0 0 0 23px;"
-            :loading="exportLoading"
+            :loading="spinning"
             @click="handleExport">下载导入模板</a-button>
         </div>
         <div class="explain-item">
@@ -46,39 +47,97 @@
           </div>
         </div>
       </div>
+      <!-- 第二步 -->
+      <div v-show="step==1">
+        <!-- 可导入数据 -->
+        <p class="blue">可导入数据<span>{{ loadData.length }}</span>条</p>
+        <a-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.no"
+          :columns="nowColumns"
+          :dataSource="loadData"
+          :loading="spinning"
+          :scroll="{ y: 200 }"
+          :pagination="false"
+          bordered>
+        </a-table>
+        <!-- 不可导入数据 -->
+        <p class="red">不可导入数据<span>{{ unLoadData.length }}</span>条</p>
+        <a-table
+          class="unTable"
+          ref="unTable"
+          size="small"
+          :rowKey="(record) => record.no"
+          :columns="nowUnColumns"
+          :dataSource="unLoadData"
+          :loading="spinning"
+          :scroll="{ y: 200 }"
+          :pagination="false"
+          bordered>
+        </a-table>
+      </div>
       <!-- 按钮 -->
       <div class="btn-con">
+        <a-button
+          id="importGuide-cancel"
+          size="large"
+          class="button-cancel"
+          @click="handleCancel"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
         <a-button
           type="primary"
           id="importGuide-nextStep"
           size="large"
           class="button-primary"
           @click="handlerNextStep"
-          style="padding: 0 60px;">下一步</a-button>
+          v-if="step==0"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">下一步</a-button>
         <a-button
-          id="importGuide-cancel"
+          type="default"
+          id="importGuide-prevStep"
           size="large"
-          class="button-cancel"
-          @click="isShow=false"
-          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+          v-if="step==1"
+          class="button-primary"
+          @click="handlerPrevStep"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">上一步</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-submit"
+          v-if="step==1"
+          size="large"
+          class="button-primary"
+          @click="handleSubmit"
+          :disabled="spinning"
+          style="padding: 0 40px;margin-left: 15px;">确认导入</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          v-if="step==1"
+          size="large"
+          class="button-error"
+          :disabled="spinning"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
       </div>
     </div>
-    <!-- 导入 -->
-    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
   </a-modal>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-// 组件
-import ChooseImportModal from './chooseImportModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
 import { Upload } from '@/components'
 // 接口
-import { allocateBillDownload } from '@/api/allocateBill'
+import { allocateBillDownload, allocateBillParseProducts, allocateBillFailExcel, allocateBillBatchInsert } from '@/api/allocateBill'
 export default {
   name: 'TransferOutImportGuideModal',
   mixins: [commonMixin],
-  components: { ChooseImportModal, Upload },
+  components: { Upload },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -92,24 +151,35 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      openImportModal: false, //  导入
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload', // 上传文件路径
       paramsData: null, // 上传参数
       uploadParams: { // 上传参数
         savePathType: 'local'
       },
-      exportLoading: false// 导出按钮加载状态
+      spinning: false, // 导出按钮加载状态
+      step: 0,
+      nowColumns: [ //  正品
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      nowUnColumns: [ //  促销品
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'qtyText', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存', dataIndex: 'currentStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'errorDesc', width: 180, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [], // 可导入数据
+      unLoadData: [] // 错误数据
     }
   },
   methods: {
-    // 下一步
-    handlerNextStep () {
-      if (this.paramsData) {
-        this.openImportModal = true
-      } else {
-        this.$message.warning('添加文件后再进行下一步操作!')
-      }
-    },
     // 上传文件  change
     changeImport (file) {
       if (file) {
@@ -117,28 +187,122 @@ export default {
           allocateSn: this.params.allocateSn || '',
           path: file
         }
+        this.loadData = []
+        this.unLoadData = []
+        this.handlerNextStep()
+      } else {
+        this.paramsData = null
       }
     },
-    // 导入
-    hanldeOk (obj) {
-      if (obj && obj.length > 0) {
-        this.$emit('ok', obj)
-        this.isShow = false
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        if (this.loadData.length == 0 && this.unLoadData.length == 0) {
+          this.getData()
+        }
+        this.step = 1
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
       }
     },
-    // 关闭
-    handleClose () {
-      this.openImportModal = false
-      this.isShow = false
+    // 上一步
+    handlerPrevStep () {
+      const _this = this
+      if (this.loadData.length) {
+        this.$confirm({
+          title: '提示',
+          content: '当前页面数据未导入,是否返回上页?',
+          centered: true,
+          cancelText: '返回上页',
+          okText: '继续导入',
+          onOk () {
+            _this.step = 1
+          },
+          onCancel () {
+            _this.step = 0
+          }
+        })
+      } else {
+        _this.step = 0
+      }
+    },
+    // 取消或关闭
+    handleCancel () {
+      const _this = this
+      if (_this.loadData.length) {
+        this.$confirm({
+          title: '提示',
+          content: '当前页面数据未导入,是否取消导入操作?',
+          centered: true,
+          cancelText: '确认取消',
+          okText: '继续导入',
+          onOk () {
+            _this.step = 1
+          },
+          onCancel () {
+            _this.isShow = false
+          }
+        })
+      } else {
+        _this.isShow = false
+      }
+    },
+    // 获取表格数据
+    getData () {
+      const _this = this
+      this.spinning = true
+      // 获取列表数据  无分页
+      allocateBillParseProducts(this.paramsData).then(res => {
+        this.spinning = false
+        if (res.status == 200) {
+          if (res.data.okList && res.data.okList.length > 0) {
+            res.data.okList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          if (res.data.failList && res.data.failList.length > 0) {
+            res.data.failList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          _this.loadData = res.data.okList || []
+          _this.unLoadData = res.data.failList || []
+        }
+      })
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('无可导入产品!')
+      } else {
+        this.spinning = true
+        allocateBillBatchInsert(this.loadData).then(res => {
+          if (res.status == 200) {
+            this.$emit('ok')
+            this.isShow = false
+          }
+          this.spinning = false
+        })
+      }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(allocateBillFailExcel, _this.unLoadData, '产品导入错误项', function () {
+        _this.spinning = false
+      })
     },
-    //  导出
+    // 下载模板
     handleExport () {
       const _this = this
       _this.spinning = true
-      _this.exportLoading = true
       allocateBillDownload({}).then(res => {
         _this.spinning = false
-        _this.exportLoading = false
         if (res.type == 'application/json') {
           var reader = new FileReader()
           reader.addEventListener('loadend', function () {
@@ -176,8 +340,15 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+      } else {
         this.paramsData = null
-        this.$refs.importUpload.setFileList('')
+        if (this.$refs.importUpload) {
+          this.$refs.importUpload.setFileList('')
+        }
+        this.loadData = []
+        this.unLoadData = []
+        this.step = 0
+        this.spinning = false
       }
     }
   }
@@ -221,12 +392,23 @@ export default {
           width: 100%;
         }
       }
+      .blue{
+        span{
+          color: #1890ff;
+          margin: 0 5px;
+        }
+        margin: 10px 0;
+      }
+      .red{
+        span{
+          color: #f5222d;
+          margin: 0 5px;
+        }
+        margin: 10px 0;
+      }
       .btn-con{
-        margin: 10px 0 20px;
+        margin: 30px 0 20px;
         text-align: center;
-        .button-cancel{
-          font-size: 12px;
-        }
       }
     }
   }

+ 10 - 0
src/views/common/productBrand.js

@@ -34,6 +34,11 @@ const ProductBrand = {
     disabled: {
       type: Boolean,
       default: false
+    },
+    // 是否显示全品牌
+    showAllBrand:{
+      type: Boolean,
+      default: false
     }
   },
   data() {
@@ -85,6 +90,11 @@ const ProductBrand = {
       }else{
         this.productBrandList = data
       }
+      // 是否显示全品牌
+      const hasAll = this.productBrandList.find(item => item.brandSn == 'ALL')
+      if(this.showAllBrand && !hasAll){
+        this.productBrandList.unshift({brandSn:'ALL',brandName:'全品牌'})
+      }
     },
     //  产品品牌列表,
     getProductBrand () {

+ 16 - 0
src/views/common/productTypeAll.js

@@ -36,6 +36,11 @@ const ProductType = {
     isAll: {
       type: Boolean,
       default: true
+    },
+    // 是否显示全分类
+    showAllType: {
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -71,6 +76,13 @@ const ProductType = {
       this.$emit('change', this.defaultVal, this.id,row)
       this.$emit('input', this.defaultVal)
     },
+    showALLtype(){
+      // 是否显示全分类
+      const hasAll = this.productTypeList.some(item => item.productTypeSn == 'ALL')
+      if(this.showAllType&&!hasAll){
+        this.productTypeList.unshift({productTypeName:'全分类',productTypeSn:'ALL',children:[{productTypeName:'全分类',productTypeSn:'ALL'}]})
+      }
+    },
     //  产品分类  列表
     getProductType () {
       if(this.isAll){
@@ -88,6 +100,8 @@ const ProductType = {
           }
           // 缓存数据
           this.$store.state.app.productTypeAllList = this.productTypeList
+          // 是否显示全分类
+          this.showALLtype()
         })
       }else{
         productTypeQuery({}).then(res => {
@@ -96,6 +110,8 @@ const ProductType = {
           } else {
             this.productTypeList = []
           }
+          // 是否显示全分类
+          this.showALLtype()
         })
       }
     },

+ 13 - 2
src/views/expenseManagement/expenseReimbursement/add.vue

@@ -24,6 +24,17 @@
           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用归属品牌">
+            {{ (detailData&&detailData.productBrandName) || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="费用归属品类">
+            <div>
+              <span v-if="detailData&&detailData.productTypeName1">{{ detailData.productTypeName1 || '--' }}</span>
+              <span v-else>--</span>
+              <span v-if="detailData&&detailData.productTypeName2">/{{ detailData.productTypeName2 || '--' }}</span>
+              <span v-if="detailData&&detailData.productTypeName3">/{{ detailData.productTypeName3 || '--' }}</span>
+            </div>
+          </a-descriptions-item>
           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
@@ -31,8 +42,8 @@
           <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
           <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
           <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
-          <a-descriptions-item label="详细说明" :span="3">{{ detailData&&detailData.content.join(',')||'' }}</a-descriptions-item>
-          <a-descriptions-item label="附件" :span="3">
+          <a-descriptions-item label="详细说明" :span="4">{{ detailData&&detailData.content.join(',')||'' }}</a-descriptions-item>
+          <a-descriptions-item label="附件" :span="4">
             <a
               target="_blank"
               style="color: #00aaff;text-decoration: underline;margin-right: 15px;"

+ 66 - 1
src/views/expenseManagement/expenseReimbursement/baseDataModal.vue

@@ -50,6 +50,24 @@
                 style="width: 100%;"/>
             </a-form-model-item>
           </a-col>
+          <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+            <a-form-model-item
+              label="费用归属品牌"
+              prop="productBrandSn"
+              :required="form.expenseTypeName=='促销费用'"
+            >
+              <ProductBrand id="expenseReimbursementAddform-productBrandSn" @change="changeBrand" showAllBrand v-model="form.productBrandSn" placeholder="请选择费用归属品牌(单选)"></ProductBrand>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+            <a-form-model-item
+              label="费用归属品类"
+              prop="productTypeSn2"
+              :required="form.expenseTypeName=='促销费用'"
+            >
+              <productTypeAll placeholder="请选择费用归属品类(单选,至少选到二级或三级)" showAllType @change="changeProductType" v-model="productType" id="expenseReimbursementAddform-productType"></productTypeAll>
+            </a-form-model-item>
+          </a-col>
           <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
             <a-form-model-item label="主题" prop="title" :label-col="{span:3}" :wrapper-col="{span:19}">
               <a-textarea
@@ -106,10 +124,12 @@ import moment from 'moment'
 import department from './department.js'
 import employee from './employee.js'
 import expenseType from '@/views/common/expenseType.js'
+import ProductBrand from '@/views/common/productBrand.js'
+import productTypeAll from '@/views/common/productTypeAll.js'
 import { expenseAccountDetail, expenseAccountSave } from '@/api/expenseManagement.js'
 export default {
   name: 'BaseDataModal',
-  components: { VSelect, Upload, STable, department, employee, expenseType },
+  components: { VSelect, Upload, STable, department, employee, expenseType, ProductBrand, productTypeAll },
   props: {
     show: [Boolean],
     itemSn: {
@@ -131,6 +151,7 @@ export default {
       attachList: [], // 附件列表
       attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo', // 附件上传地址
       expenseTypes: [], // 费用类型值
+      productType: [],
       form: {
         applyPersonSn: undefined, // 申请人
         applyDepartmentSn: undefined, //  申请部门
@@ -140,6 +161,10 @@ export default {
         expenseTypeName: undefined, //  费用类型1
         expenseTypeName2: undefined, //  费用类型2
         expenseTypeName3: undefined, // 费用类型3
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
         expenseDate: moment().locale('zh-cn').format('YYYY-MM'), //  费用产生月
         title: '', // 主题
         content: '' // 费用说明
@@ -194,16 +219,36 @@ export default {
         expenseTypeName: undefined, //  费用类型1
         expenseTypeName2: undefined, //  费用类型2
         expenseTypeName3: undefined, // 费用类型3
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
         expenseDate: moment().locale('zh-cn').format('YYYY-MM'), //  费用产生月
         title: '', // 主题
         content: '' // 费用说明
       }
+      this.productType = []
       this.attachList = []
       this.form.expenseAccountFilesList = ''
       this.$refs.attachList.setFileList('')
       this.$refs.ruleForm.resetFields()
       this.expenseTypes = []
     },
+    //  产品分类  change
+    changeProductType (val, id, opt) {
+      console.log(val, opt, '------------')
+      this.form.productTypeSn1 = val && val[0] ? val[0] : ''
+      this.form.productTypeSn2 = val && val[1] ? val[1] : ''
+      this.form.productTypeSn3 = val && val[2] ? val[2] : ''
+      // 名称
+      this.form.productTypeName1 = opt && opt[0] ? opt[0].productTypeName : ''
+      this.form.productTypeName2 = opt && opt[1] ? opt[1].productTypeName : ''
+      this.form.productTypeName3 = opt && opt[2] ? opt[2].productTypeName : ''
+    },
+    // 品牌
+    changeBrand (val, id, opt) {
+      this.form.productBrandName = opt ? opt.brandName : ''
+    },
     // 申请人员
     employeeChange (v, r) {
       if (r.departmentSn) {
@@ -237,6 +282,19 @@ export default {
       this.form.expenseTypeName = opts && opts[0] ? opts[0].name : ''
       this.form.expenseTypeName2 = opts && opts[1] ? opts[1].name : ''
       this.form.expenseTypeName3 = opts && opts[2] ? opts[2].name : ''
+      // 校验规则
+      this.$refs.ruleForm.clearValidate()
+      this.setValidBrandType()
+    },
+    // 判断是否促销费用类型,必填品牌和分类
+    setValidBrandType () {
+      if (this.form.expenseTypeName == '促销费用') {
+        this.rules.productBrandSn = [{ required: true, message: '请选择归属品牌', trigger: 'change' }]
+        this.rules.productTypeSn2 = [{ required: true, message: '请选择归属分类(至少选择到2级或3级分类)', trigger: 'change' }]
+      } else {
+        this.rules.productBrandSn = []
+        this.rules.productTypeSn2 = []
+      }
     },
     //  附件上传
     changeAttach (file) {
@@ -257,9 +315,16 @@ export default {
         this.attachList = data.expenseAccountFilesList
         this.$refs.attachList.setFileList(this.attachList)
       }
+      if (data.productTypeSn1) {
+        this.productType = [data.productTypeSn1, data.productTypeSn2, data.productTypeSn3]
+      }
+      if (!data.productBrandSn) {
+        this.form.productBrandSn = undefined
+      }
       setTimeout(() => {
         this.expenseTypes = data.expenseType ? [this.form.expenseType, this.form.expenseType2, this.form.expenseType3] : []
       }, 500)
+      this.setValidBrandType()
     },
     //  获取详情
     getDetail () {

+ 12 - 1
src/views/expenseManagement/expenseReimbursement/detail.vue

@@ -35,11 +35,22 @@
       </a-page-header>
       <!-- 基础信息 -->
       <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-show="showDetail">
-        <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}" v-if="detailData">
+        <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 3}" v-if="detailData">
           <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用归属品牌">
+            {{ (detailData&&detailData.productBrandName) || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="费用归属品类">
+            <div>
+              <span v-if="detailData&&detailData.productTypeName1">{{ detailData.productTypeName1 || '--' }}</span>
+              <span v-else>--</span>
+              <span v-if="detailData&&detailData.productTypeName2">/{{ detailData.productTypeName2 || '--' }}</span>
+              <span v-if="detailData&&detailData.productTypeName3">/{{ detailData.productTypeName3 || '--' }}</span>
+            </div>
+          </a-descriptions-item>
           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>

+ 7 - 3
src/views/expenseManagement/expenseReimbursementDetail/list.vue

@@ -183,7 +183,7 @@
           :columns="columns"
           :data="loadData"
           :pageSize="30"
-          :scroll="{ y: tableHeight,x:2250 }"
+          :scroll="{ y: tableHeight,x:2750 }"
           :defaultLoadData="false"
           bordered>
         </s-table>
@@ -303,11 +303,15 @@ export default {
         { title: '所属城市', dataIndex: 'cityName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '记账费用', dataIndex: 'expense', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '费用承担方', dataIndex: 'splitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '财务编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '承担方财务编码', dataIndex: 'splitObjFnumber', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '费用承担金额', dataIndex: 'splitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '费用承担人', dataIndex: 'childSplitObjName', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '人员平摊费用', dataIndex: 'childSplitAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '备注', dataIndex: 'remarks', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+        // { title: '费用归属品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品类(一级)', dataIndex: 'productTypeName1', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品牌(二级)', dataIndex: 'productTypeName2', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '费用归属品牌(三级)', dataIndex: 'productTypeName3', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'remarks', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ]
     }
   },

+ 279 - 0
src/views/reportData/regionTypeBusinessReport/list.vue

@@ -0,0 +1,279 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="regionTypeBusinessReportList-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper" ref="tableSearch">
+        <a-form-model
+          id="regionTypeBusinessReportList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :rules="rules"
+          :model="queryParam">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="查询月份" prop="queryDate">
+                <a-month-picker
+                  id="regionTypeBusinessReportList-monthBox"
+                  class="monthBox"
+                  :disabled-date="disabledDate"
+                  v-model="monthVal"
+                  placeholder="请选择月份"
+                  @change="onChangeMonth" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <dealerSubareaScopeList ref="dealerSubareaScopeList" id="regionTypeBusinessReportList-dealerName" @change="custChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="地区">
+                <Area id="regionTypeBusinessReportList-areaList" v-model="queryParam.provinceSn" @change="areaChange" placeholder="请选择省份"></Area>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button
+                type="primary"
+                @click="handleSearch"
+                :disabled="disabled"
+                id="regionTypeBusinessReportList-refresh">查询</a-button>
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
+                id="regionTypeBusinessReportList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_tireFeeExport')"
+                id="regionTypeBusinessReportList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.no"
+          rowKeyName="no"
+          :style="{ height: tableHeight+70+'px' }"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-120}"
+          :defaultLoadData="false"
+          :showPagination="false"
+          bordered>
+        </s-table>
+      </a-spin>
+    </a-card>
+    <!-- 导出提示框 -->
+    <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { hdExportExcel } from '@/libs/exportExcel'
+import moment from 'moment'
+// 组件
+import { STable, VSelect } from '@/components'
+import Area from '@/views/common/area.js'
+import reportModal from '@/views/common/reportModal.vue'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import getDate from '@/libs/getDate'
+// 接口
+import { manageAnalysisReportQuery, manageAnalysisReportExport } from '@/api/reportData'
+export default {
+  name: 'RegionTypeBusinessReportList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, Area, dealerSubareaScopeList, reportModal },
+  data () {
+    return {
+      spinning: false,
+      disabled: false, //  查询、重置按钮是否可操作
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0, // 表格高度
+      exportLoading: false, // 导出按钮加载状态
+      showExport: false, // 导出弹窗
+      monthVal: moment().format('YYYY-MM'), // 初始化月份值
+      //  查询条件
+      queryParam: {
+        queryDate: moment().format('YYYYMM'), // 选择月份
+        beginDate: getDate.getCurrLastMonthDays().starttime, // 开始日期
+        endDate: getDate.getCurrLastMonthDays().endtime, // 结束日期
+        dealerName: undefined, // 客户名称
+        provinceName: undefined, // 省
+        provinceSn: undefined
+      },
+      rules: {
+        'queryDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const { beginDate, endDate, dealerName, provinceName } = this.queryParam
+        const params = Object.assign(parameter, { beginDate, endDate, dealerName, provinceName })
+        // 获取列表数据  有分页
+        return manageAnalysisReportQuery(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '类别', dataIndex: 'category', width: '20%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '成本', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '销售额', dataIndex: 'amount', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '毛利', dataIndex: 'gross', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '促销费用占比', dataIndex: 'promoRatio', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+      return arr
+    }
+  },
+  methods: {
+    // 选择月份  禁用选择当月以后日期
+    disabledDate (current) {
+      return current && current >= moment().endOf('day')
+    },
+    // 选择月份 change
+    onChangeMonth (date, dateString) {
+      this.monthVal = dateString
+      if (date && dateString != '') {
+        this.queryParam.queryDate = dateString.replace('-', '')
+        const { beginDate, endDate } = getDate.getBeDateByMonth(dateString)
+        this.queryParam.beginDate = beginDate
+        this.queryParam.endDate = endDate
+      } else {
+        this.queryParam.queryDate = void 0
+        this.queryParam.beginDate = undefined
+        this.queryParam.endDate = undefined
+      }
+    },
+    // 查询
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          _this.$message.error('请选择查询月份')
+          return false
+        }
+      })
+    },
+    // 客户名称 change
+    custChange (val) {
+      this.queryParam.dealerName = val.name
+    },
+    // 地区
+    areaChange (val, item) {
+      this.queryParam.provinceName = item.name
+    },
+    //  重置
+    resetSearchForm () {
+      this.monthVal = moment().format('YYYY-MM')
+      this.queryParam.queryDate = moment().format('YYYYMM')
+      this.queryParam.provinceName = undefined
+      this.queryParam.provinceSn = undefined
+      this.queryParam.dealerName = undefined
+      this.queryParam.beginDate = getDate.getCurrLastMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrLastMonthDays().endtime
+      if (this.$refs.dealerSubareaScopeList) {
+        this.$refs.dealerSubareaScopeList.resetForm()
+      }
+      this.$refs.ruleForm.resetFields()
+      this.handleSearch()
+    },
+    //  导出  必填判断
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.exportList()
+        } else {
+          _this.$message.error('请选择月份')
+          return false
+        }
+      })
+    },
+    // 导出
+    exportList () {
+      const _this = this
+      const params = JSON.parse(JSON.stringify(_this.queryParam))
+      _this.exportLoading = true
+      _this.spinning = true
+      _this.showExport = true
+      hdExportExcel(manageAnalysisReportExport, params, '各品类经营分析表-' + this.monthVal, function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
+    // 初始化
+    pageInit () {
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        this.setTableH()
+      })
+    },
+    // 计算表格高度
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 280
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .monthBox{
+    width: 100%;
+    /deep/.ant-calendar-picker-icon{
+      display:none !important;
+    }
+    /deep/.ant-calendar-picker input{
+      text-align:center;
+    }
+  }
+</style>