lilei 1 miesiąc temu
rodzic
commit
8be9a409fd

+ 3 - 1
src/views/reportData/dailyReport/index.vue

@@ -45,7 +45,9 @@ export default {
         this.tabsList.push({ id: 3, name: '分区销售日报' })
       }
       this.activeKey = 0
-      this.$refs['table' + this.activeKey][0].pageInit(this.activeKey)
+      this.$nextTick(() => {
+        this.$refs['table' + this.activeKey][0].pageInit(this.activeKey)
+      })
     }
   },
   mounted () {

+ 12 - 5
src/views/reportData/dailyReport/table.vue

@@ -171,7 +171,7 @@ export default {
       })
       // 表格0
       if (this.activeKey == 0) {
-        const ri = [5, 10, 19, 22]
+        const ri = [6, 11, 20, 23]
         this.columns.forEach((item, i) => {
           if (i > 1) {
             const cols = zim[i]
@@ -188,7 +188,7 @@ export default {
       if (this.activeKey == 1 || this.activeKey == 2) {
         const cols = zim[this.columns.length - 1]
         Array(this.totalNums).fill().forEach((item, i) => {
-          const a = ws[cols + (i + 2)]
+          const a = ws[cols + (i + 3)]
           if (a) {
             a.z = (a.v * 100) + '%' // 设置单元格格式为百分比
           }
@@ -200,7 +200,7 @@ export default {
         ci.forEach((row) => {
           const cols = zim[row]
           Array(this.totalNums).fill().forEach((item, i) => {
-            const a = ws[cols + (i + 3)]
+            const a = ws[cols + (i + 4)]
             if (a) {
               a.z = (a.v * 100) + '%' // 设置单元格格式为百分比
             }
@@ -209,9 +209,10 @@ export default {
       }
       // 4. 设置列宽
       ws['!cols'] = Array(this.columns.length).fill().map(() => ({ wch: this.activeKey == 3 ? 15 : 35 }))
-
+      const timeStr = moment().format('YYYYMMDDHHmmss')
+      // 5. 写入文件
       XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')
-      XLSX.writeFile(wb, this.queryParam.month + title + '.xlsx')
+      XLSX.writeFile(wb, this.queryParam.month.split('-')[1] + '月' + title + '-' + timeStr + '.xlsx')
     },
     //  导出
     handleExport () {
@@ -258,6 +259,12 @@ export default {
         if (this.activeKey == 3 && this.$refs.table3) {
           this.columns = this.$refs.table3.columns
         }
+        // 初始化页面
+        this.$nextTick(() => {
+          if (this.$refs['table' + this.activeKey]) {
+            this.$refs['table' + this.activeKey].pageInit()
+          }
+        })
         this.spinning = false
       }
     },

+ 13 - 7
src/views/reportData/dailyReport/table0.vue

@@ -1,9 +1,13 @@
 <template>
   <div>
     <!-- 全国销售日报 -->
-    <h2 class="table-title" v-if="tableData.length">{{ month.replace('-','年')+'月' }} 全国销售日报 <span v-if="showDz">(截止{{ nowDate }})</span></h2>
     <table class="table-box" id="day-table-0" v-if="tableData.length">
       <thead class="ant-table-thead">
+        <tr>
+          <th :colspan="columns.length">
+            <div class="table-title">{{ dateStr }} 全国销售日报 <span v-if="showDz">(截止{{ nowDate }})</span></div>
+          </th>
+        </tr>
         <tr>
           <th v-for="(item,index) in columns" :key="index">{{ item }}</th>
         </tr>
@@ -16,7 +20,7 @@
             :width="cols==2?350:150"
             v-if="item['col'+cols]!==''"
             :rowspan="hasRowspan(item['col'+cols])[1]"
-            :align="typeof item['col'+cols] == 'number' ? (hasRate(item)&&cols>2?'center':'right'):'center'"
+            :align="item['col'+cols].indexOf('.')>=0 ? (hasRate(item)&&cols>2?'center':'right'):'center'"
             :class="item.key=='currRealFinish'||item.key=='currRealTireFinish'?'red':''"
           >
             {{ hasRowspan(item['col'+cols])[1] ? hasRowspan(item['col'+cols])[0] : item['col'+cols] }}{{ hasRate(item)&&cols>2?'%':'' }}
@@ -55,12 +59,14 @@ export default {
     return {
       months: '',
       list: [],
-      showDz: false
+      showDz: false,
+      dateStr: ''
     }
   },
   methods: {
     getmonths () {
       this.months = this.month.split('-')[1]
+      this.dateStr = this.month.replace('-', '年') + '月'
     },
     getshowDz () {
       const nowMonths = new Date().getMonth() + 1
@@ -121,7 +127,8 @@ export default {
         this.tableData.forEach((cols, i) => {
           for (const key in cols) {
             if (key === item.key) {
-              item['col' + (i + 3)] = cols[key]
+              const data = item.col2.indexOf('条数') >= 0 ? String(cols[key]) : Number(cols[key]).toFixed(2)
+              item['col' + (i + 3)] = data
             }
           }
         })
@@ -148,11 +155,10 @@ export default {
 
 <style lang="less" scoped>
   .table-title{
-    margin-bottom: 10px;
     font-size: 16px;
     font-weight: bold;
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     text-align: center;
   }
   .noData{
@@ -165,7 +171,7 @@ export default {
   }
   .table-box{
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     font-size: 14px;
     .red{
       color: red;

+ 41 - 14
src/views/reportData/dailyReport/table1.vue

@@ -1,9 +1,13 @@
 <template>
   <div>
     <!-- 项目销售日报 -->
-    <h2 class="table-title" v-if="tableData.length">{{ month.replace('-','年')+'月' }} 项目销售日报(截止{{ nowDate }})</h2>
     <table class="table-box" id="day-table-1" v-if="tableData.length">
       <thead class="ant-table-thead">
+        <tr>
+          <th :colspan="columns.length">
+            <div class="table-title">{{ dateStr }} 项目销售日报1 <span v-if="showDz">(截止{{ nowDate }})</span></div>
+          </th>
+        </tr>
         <tr>
           <th v-for="item in columns" :key="item">{{ item }}</th>
         </tr>
@@ -16,9 +20,9 @@
             :key="tdi+'td'"
             :rowspan="hasRowspan(td)[1]"
             :align="typeof td == 'number' ? 'right':'center'"
-            :class="hasRed(td)?'red':''"
+            :class="hasRed(td)||hasHj(sitem,index,td,tdi)?'red':''"
           >
-            {{ hasRowspan(td)[1] ? hasRowspan(td)[0] : td }}
+            {{ hasRowspan(td)[1] ? hasRowspan(td)[0] : tdi > 0 ? Number(td).toFixed(2) : td }}
           </td>
         </tr>
       </tbody>
@@ -50,28 +54,52 @@ export default {
       default: () => ''
     }
   },
-  computed: {
-    list () {
+  data () {
+    return {
+      months: '',
+      list: [],
+      showDz: false,
+      dateStr: ''
+    }
+  },
+  methods: {
+    getmonths () {
+      this.months = this.month.split('-')[1]
+      this.dateStr = this.month.replace('-', '年') + '月'
+    },
+    getshowDz () {
+      const nowMonths = new Date().getMonth() + 1
+      this.showDz = this.months == nowMonths
+    },
+    getlist () {
       let rets = []
       this.tableData.forEach((item, i) => {
         if (i > 0) {
-          item.detailList[0].push(item.bymb + 'rowspan' + item.detailList.length, item.wcl + 'rowspan' + item.detailList.length)
+          item.detailList[0].push(Number(item.bymb).toFixed(2) + 'rowspan' + item.detailList.length, item.wcl + 'rowspan' + item.detailList.length)
           rets = rets.concat(item.detailList)
         }
       })
-      return rets
-    }
-  },
-  methods: {
+      this.list = rets
+    },
     hasRowspan (row) {
       return row.toString().split('rowspan')
     },
-    hasRed (row) {
+    hasHj (a, b, c, d) {
+      const hj = this.columns.findIndex(item => item == '销售额合计')
+      const arr = ['合计', '箭牌喇叭', '制动系统']
+      return (d == hj && arr.find(item => a.toString().indexOf(item) >= 0))
+    },
+    hasRed (row, tdi) {
       const arr = ['合计', '箭牌喇叭', '制动系统']
       return arr.find(item => row.toString().indexOf(item) >= 0)
     },
     getTable () {
       return document.getElementById('day-table-1')
+    },
+    pageInit () {
+      this.getmonths()
+      this.getshowDz()
+      this.getlist()
     }
   }
 }
@@ -79,11 +107,10 @@ export default {
 
 <style lang="less" scoped>
   .table-title{
-    margin-bottom: 10px;
     font-size: 16px;
     font-weight: bold;
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     text-align: center;
   }
   .noData{
@@ -96,7 +123,7 @@ export default {
   }
   .table-box{
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     font-size: 14px;
     .red{
       color: red;

+ 33 - 9
src/views/reportData/dailyReport/table2.vue

@@ -2,9 +2,13 @@
   <div>
     <div v-if="tableData.length">
       <!-- 全国销售日报 -->
-      <h2 class="table-title">{{ month.replace('-','年')+'月' }}全国销售日报2(截止{{ nowDate }})</h2>
       <table class="table-box" id="day-table-2" >
         <thead class="ant-table-thead">
+          <tr>
+            <th :colspan="cloumns.length">
+              <div class="table-title">{{ dateStr }} 项目销售日报2 <span v-if="showDz">(截止{{ nowDate }})</span></div>
+            </th>
+          </tr>
           <tr>
             <th v-for="item in cloumns" :key="item">{{ item }}</th>
           </tr>
@@ -13,8 +17,8 @@
           <tr v-for="(item,index) in list" :key="index">
             <td align="center">{{ item.proName }}</td>
             <td align="center">{{ item.userName }}</td>
-            <td align="center">{{ item.bymb }}</td>
-            <td align="center">{{ item.amount }}</td>
+            <td align="center">{{ Number(item.bymb).toFixed(2) }}</td>
+            <td align="center">{{ Number(item.amount).toFixed(2) }}</td>
             <td align="center" class="red">{{ item.wcl }}</td>
           </tr>
         </tbody>
@@ -43,18 +47,39 @@ export default {
       default: () => ''
     }
   },
+  data () {
+    return {
+      months: '',
+      list: [],
+      showDz: false,
+      dateStr: ''
+    }
+  },
   computed: {
-    list () {
-      return this.tableData
-    },
     cloumns () {
       const m = this.month.split('-')
       return ['项目', '品类经理', m[1] + '月业绩目标', m[1] + '月销售额截止达成', '达成率']
     }
   },
   methods: {
+    getmonths () {
+      this.months = this.month.split('-')[1]
+      this.dateStr = this.month.replace('-', '年') + '月'
+    },
+    getshowDz () {
+      const nowMonths = new Date().getMonth() + 1
+      this.showDz = this.months == nowMonths
+    },
+    getlist () {
+      this.list = this.tableData
+    },
     getTable () {
       return document.getElementById('day-table-2')
+    },
+    pageInit () {
+      this.getmonths()
+      this.getshowDz()
+      this.getlist()
     }
   }
 }
@@ -62,11 +87,10 @@ export default {
 
 <style lang="less" scoped>
   .table-title{
-    margin-bottom: 10px;
     font-size: 16px;
     font-weight: bold;
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     text-align: center;
   }
   .noData{
@@ -79,7 +103,7 @@ export default {
   }
   .table-box{
     width: 100%;
-    max-width: 1024px;
+    max-width: 1400px;
     font-size: 14px;
     .red{
       color: red;

+ 42 - 42
src/views/reportData/dailyReport/table3.vue

@@ -1,10 +1,13 @@
 <template>
   <div>
     <!-- 分区销售日报 -->
-    <h2 class="table-title" v-if="tableData.length">{{ month.replace('-','年')+'月' }} 分区销售日报(截止{{ nowDate }})</h2>
     <table class="table-box" id="day-table-3" v-if="tableData.length">
-      <colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup>
       <thead class="ant-table-thead">
+        <tr>
+          <th :colspan="columns.length">
+            <div class="table-title">{{ dateStr }} 分区销售日报 <span v-if="showDz">(截止{{ nowDate }})</span></div>
+          </th>
+        </tr>
         <tr>
           <th key="managerNameList" rowspan="2" style="text-align: center;">
             <span class="ant-table-header-column"><div><span class="ant-table-column-title">区域负责人</span><span class="ant-table-column-sorter"></span></div></span>
@@ -18,18 +21,18 @@
         </tr>
         <tr>
           <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">年度目标</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">截止1-4月完成</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">5月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">累计5月截止完成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">截止1-{{ months-1 }}月完成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">{{ months }}月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">累计{{ months }}月截止完成</span><span class="ant-table-column-sorter"></span></div></span></th>
           <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title red">年度完成率</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">5月业绩目标</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">{{ months }}月业绩目标</span><span class="ant-table-column-sorter"></span></div></span></th>
           <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title red">达成率</span><span class="ant-table-column-sorter"></span></div></span></th>
           <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">今日销售额</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">截止1-4月销售额</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">5月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">累计5月截止完成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">截止1-{{ months-1 }}月销售额</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">{{ months }}月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">累计{{ months }}月截止完成</span><span class="ant-table-column-sorter"></span></div></span></th>
           <th style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">今日销售额</span><span class="ant-table-column-sorter"></span></div></span></th>
-          <th class="ant-table-align-center ant-table-row-cell-break-word ant-table-row-cell-last" style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">5月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
+          <th class="ant-table-align-center ant-table-row-cell-break-word ant-table-row-cell-last" style="text-align: center;"><span class="ant-table-header-column"><div><span class="ant-table-column-title">{{ months }}月销售额截止达成</span><span class="ant-table-column-sorter"></span></div></span></th>
         </tr>
       </thead>
       <tbody>
@@ -43,7 +46,7 @@
             :colspan="index==list.length-1&&si==1?2:1"
             :style="index==list.length-1?'color: red;font-weight:bold;background:#dfdeff;border-color:#c7c7ff;':''"
           >
-            {{ item[sitem.dataIndex].toString() }}{{ sitem.title.indexOf('率')>=0?'%':'' }}
+            {{ si>1 ? Number(item[sitem.dataIndex]).toFixed(2) : item[sitem.dataIndex].toString() }}{{ sitem.title.indexOf('率')>=0?'%':'' }}
           </td>
         </tr>
       </tbody>
@@ -71,30 +74,15 @@ export default {
       default: () => ''
     }
   },
-  watch: {
-    tableData: {
-      handler (val) {
-        this.$nextTick(() => {
-          this.tableHeight = window.innerHeight - 360
-        })
-      },
-      deep: true
-    }
-  },
-  mounted () {
-    this.$nextTick(() => {
-      this.tableHeight = window.innerHeight - 360
-    })
-  },
   data () {
     return {
-      tableHeight: 300
+      months: '',
+      list: [],
+      showDz: false,
+      dateStr: ''
     }
   },
   computed: {
-    list () {
-      return this.tableData
-    },
     hjRow () {
       const ret = []
       this.list.forEach((item, index) => {
@@ -104,9 +92,6 @@ export default {
       })
       return ret
     },
-    months () {
-      return this.month.split('-')[1]
-    },
     columns () {
       return [
         {
@@ -128,17 +113,17 @@ export default {
           width: '100'
         },
         {
-          title: '截止1-' + (this.months[1] - 1) + '月完成',
+          title: '截止1-' + (this.months - 1) + '月完成',
           dataIndex: 'histSalesReal',
           align: 'center',
           width: '100'
         }, {
-          title: this.months[1] + '月销售额截止达成',
+          title: this.months + '月销售额截止达成',
           dataIndex: 'currSalesReal',
           align: 'center',
           width: '130'
         }, {
-          title: '累计' + this.months[1] + '月截止完成',
+          title: '累计' + this.months + '月截止完成',
           dataIndex: 'accuSalesReal',
           align: 'center',
           width: '100'
@@ -148,7 +133,7 @@ export default {
           align: 'center',
           width: '100'
         }, {
-          title: this.months[1] + '月业绩目标',
+          title: this.months + '月业绩目标',
           dataIndex: 'currTarget',
           align: 'center',
           width: '100'
@@ -164,17 +149,17 @@ export default {
           width: '100'
         },
         {
-          title: '截止1-' + (this.months[1] - 1) + '月销售额',
+          title: '截止1-' + (this.months - 1) + '月销售额',
           dataIndex: 'histSalesRealTireAmount',
           align: 'center',
           width: '100'
         }, {
-          title: this.months[1] + '月销售额截止达成',
+          title: this.months + '月销售额截止达成',
           dataIndex: 'currSalesTireReal',
           align: 'center',
           width: '130'
         }, {
-          title: '累计' + this.months[1] + '月截止完成',
+          title: '累计' + this.months + '月截止完成',
           dataIndex: 'accuSalesRealTireAmount',
           align: 'center',
           width: '100'
@@ -185,7 +170,7 @@ export default {
           width: '100'
         },
         {
-          title: this.months[1] + '月销售额截止达成',
+          title: this.months + '月销售额截止达成',
           dataIndex: 'totalCurrSalesTireReal',
           align: 'center',
           width: '130'
@@ -194,8 +179,24 @@ export default {
     }
   },
   methods: {
+    getmonths () {
+      this.months = this.month.split('-')[1]
+      this.dateStr = this.month.replace('-', '年') + '月'
+    },
+    getshowDz () {
+      const nowMonths = new Date().getMonth() + 1
+      this.showDz = this.months == nowMonths
+    },
+    getlist () {
+      this.list = this.tableData
+    },
     getTable () {
       return document.getElementById('day-table-3')
+    },
+    pageInit () {
+      this.getmonths()
+      this.getshowDz()
+      this.getlist()
     }
   }
 }
@@ -203,7 +204,6 @@ export default {
 
 <style lang="less" scoped>
   .table-title{
-    margin-bottom: 10px;
     font-size: 16px;
     font-weight: bold;
     width: 100%;