| 
					
				 | 
			
			
				@@ -51,22 +51,34 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <table0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           v-if="activeKey == 0" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ref="table0" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          :totalData="totalData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :month="queryParam.month" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :columns="columns" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :tableData="tableData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :nowDate="nowDate" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ></table0> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <table1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           v-if="activeKey == 1" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ref="table1" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          :totalData="totalData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :month="queryParam.month" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :columns="columns" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :tableData="tableData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :nowDate="nowDate" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ></table1> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <table2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           v-if="activeKey == 2" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ref="table2" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          :totalData="totalData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :month="queryParam.month" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :columns="columns" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :tableData="tableData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :nowDate="nowDate" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ></table2> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <table3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           v-if="activeKey == 3" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           ref="table3" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          :totalData="totalData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :month="queryParam.month" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :columns="columns" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :tableData="tableData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :nowDate="nowDate" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ></table3> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </a-card> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </a-spin> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,9 +87,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { commonMixin } from '@/utils/mixin' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { hdExportExcel } from '@/libs/exportExcel' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import XLSX from 'xlsx-js-style' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 组件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import rangeDate from '@/views/common/rangeDate.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import moment from 'moment' 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,7 +96,7 @@ import table1 from './table1' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import table2 from './table2' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import table3 from './table3' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { subareaAreaReportTitle } from '@/api/reportData.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { salesReportDailyList } from '@/api/reportData.js' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: 'RegionTypeSalesReportList', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   mixins: [commonMixin], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,14 +111,16 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tableHeight: 0, // 表格高度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tabsList: [{ id: 0, name: '全国销售日报' }, { id: 1, name: '项目销售日报1' }, { id: 2, name: '项目销售日报2' }, { id: 3, name: '分区销售日报' }], // tab切换data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       columns: [], // 表头数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      totalData: null, // 统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      tableData: [], // 表格数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      totalNums: 0, // 总条数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 查询参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       queryParam: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         month: moment().format('YYYY-MM') // 月份默认值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       rules: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'month': [{ required: true, message: '请选择月份', trigger: 'change' }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      nowDate: '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,8 +137,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.activeKey = key 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       _this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.getTableData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.setTableH() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.resetSearchForm() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 查询 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,7 +145,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.ruleForm.validate(valid => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          _this.$refs.table.refresh(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          _this.getTableData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           _this.$message.error('请选择月份') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return false 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -146,9 +157,10 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.ruleForm.resetFields() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.queryParam.time = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.rangeDate.resetDate(this.queryParam.time) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.$refs.table.clearTable() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.tableData = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     exportTable (dom, title) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const zim = 'A、B、C、D、E、F、G、H、I、J、K、L、M、N、O、P、Q、R、S、T、U、V、W、X、Y、Z'.split('、') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       var ws = XLSX.utils.table_to_sheet(dom) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       var wb = XLSX.utils.book_new() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.log(ws) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -163,9 +175,19 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ws['C5'].z = (ws['C5'].v * 100) + '%' // 设置单元格格式为百分比 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 表格1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (this.activeKey == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const cols = zim[this.columns.length - 1] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Array(this.totalNums).fill().forEach((item, i) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const a = ws[cols + (i + 2)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log(cols + (i + 2)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (a) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            a.z = (a.v * 100) + '%' // 设置单元格格式为百分比 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 4. 设置列宽 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ws['!cols'] = Array(5).fill().map(() => ({ wch: 35 })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      ws['!cols'] = Array(this.columns.length).fill().map(() => ({ wch: 35 })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       XLSX.writeFile(wb, this.queryParam.month + title + '.xlsx') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -175,43 +197,45 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const excelTitle = this.tabsList.find(item => item.id == this.activeKey) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (this.$refs.table0 && this.activeKey == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.exportTable(this.$refs.table0.getTable(), excelTitle.name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (this.$refs.table1 && this.activeKey == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.totalNums = this.$refs.table1.list.length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.exportTable(this.$refs.table1.getTable(), excelTitle.name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (this.$refs.table2 && this.activeKey == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.exportTable(this.$refs.table2.getTable(), excelTitle.name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (this.$refs.table3 && this.activeKey == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.exportTable(this.$refs.table3.getTable(), excelTitle.name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // const url = [subareaAreaReportTitle, subareaAreaReportTitle, subareaAreaReportTitle, subareaAreaReportTitle] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // const excelTitle = this.tabsList.find(item => item.id == _this.activeKey) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // this.$refs.ruleForm.validate(valid => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   if (valid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     const params = _this.queryParam 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     _this.exportLoading = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     _this.spinning = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     hdExportExcel(url[this.activeKey], params, excelTitle.name, function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //       _this.exportLoading = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //       _this.spinning = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //       _this.$store.state.app.curActionPermission = '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 获取表格数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async getTableData () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const url = [subareaAreaReportTitle, subareaAreaReportTitle, subareaAreaReportTitle, subareaAreaReportTitle] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const data = await url[this.activeKey](this.queryParam).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const url = [salesReportDailyList, salesReportDailyList, salesReportDailyList, salesReportDailyList] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const reportType = ['DailyPL', 'DailyPL', 'DailyPL', 'DailyPL'][this.activeKey] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const reportDate = this.queryParam.month + '-01 00:00:00' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.nowDate = moment().format('DD日HH点mm分') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.spinning = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const data = await url[this.activeKey]({ reportType, reportDate }).then(res => res.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.tableData = data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.columns = this.getColumns() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.spinning = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    getColumns () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const row = this.tableData[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const ret = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        row.detailList[0].forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ret.push(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ret.push(row.bymb) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ret.push(row.wcl) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return ret 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 初始化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     pageInit () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.activeKey = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.getTableData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.setTableH() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 计算表格高度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    setTableH () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const tableSearchH = this.$refs.tableSearch.offsetHeight 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.tableHeight = window.innerHeight - tableSearchH - 250 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.tableData = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   mounted () { 
			 |