Procházet zdrojové kódy

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

chenrui před 2 měsíci
rodič
revize
122924fe3e

+ 47 - 21
src/views/reportData/regionTypeBusinessReport/list.vue

@@ -60,16 +60,16 @@
       <a-spin :spinning="spinning" tip="Loading...">
         <!-- 列表 -->
         <s-table
-          class="sTable fixPagination"
+          class="sTable"
           ref="table"
           size="small"
           :rowKey="(record) => record.no"
           rowKeyName="no"
           :rowClassName="(record, index) => record.category.indexOf('合计') >= 0 ? 'garyBg-row':''"
-          :style="{ height: tableHeight+70+'px' }"
+          :style="{ height: tableHeight+'px' }"
           :columns="columns"
           :data="loadData"
-          :scroll="{ y: tableHeight-120}"
+          :scroll="{ y: tableHeight}"
           :defaultLoadData="false"
           :showPagination="false"
           bordered>
@@ -90,6 +90,14 @@ import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import getDate from '@/libs/getDate'
 // 接口
 import { manageAnalysisReportQuery, manageAnalysisReportExport } from '@/api/reportData'
+const renderContent = (value, row, index) => {
+  const text = (value || value == 0) || '--'
+  const obj = {
+    children: text,
+    attrs: {}
+  }
+  return obj
+}
 export default {
   name: 'RegionTypeBusinessReportList',
   mixins: [commonMixin],
@@ -120,18 +128,26 @@ export default {
         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
+          const ret = []
           if (res.status == 200) {
             data = res.data
-            res.data.map((item, i) => {
-              item.no = i + 1
-            })
-            this.disabled = false
+            // 计算表格序号
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
+              data[i].grossMargin = data[i].grossMargin ? data[i].grossMargin + '%' : ''
+              data[i].promoRatio = data[i].promoRatio ? data[i].promoRatio + '%' : ''
+              ret.push(data[i])
+              if (data[i].category.indexOf('合计') >= 0) {
+                ret.push({ no: 'hj-' + data[i].no, 'category': 'a' })
+              }
+            }
           }
+          this.disabled = false
           this.spinning = false
-          return data
+          return { list: ret, count: 0 }
         })
       }
     }
@@ -150,14 +166,22 @@ export default {
   computed: {
     columns () {
       const arr = [
-        { title: '类别', dataIndex: 'category', width: '15%', align: 'right', 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 : '--') } }
+        { title: '类别',
+          dataIndex: 'category',
+          width: '25%',
+          align: 'center',
+          customRender: (text, row, index) => {
+            if (row.category != 'a') {
+              return row.category.indexOf('合计') < 0 ? <a-button type="link" class="button-default">{text}</a-button> : (<a-button type="link" class="button-default" style="font-weight:bold;">{text}</a-button>)
+            }
+          } },
+        { title: '成本', dataIndex: 'cost', width: '10%', align: 'right', customRender: renderContent },
+        { title: '销售额', dataIndex: 'amount', width: '10%', align: 'right', customRender: renderContent },
+        { title: '毛利', dataIndex: 'gross', width: '10%', align: 'right', customRender: renderContent },
+        { title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'center', customRender: renderContent },
+        { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'right', customRender: renderContent },
+        { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '10%', align: 'right', customRender: renderContent },
+        { title: '促销费用占比', dataIndex: 'promoRatio', width: '10%', align: 'center', customRender: renderContent }
       ]
       return arr
     }
@@ -249,7 +273,7 @@ export default {
     // 计算表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 280
+      this.tableHeight = window.innerHeight - tableSearchH - 160
     }
   },
   mounted () {
@@ -266,12 +290,14 @@ export default {
 }
 </script>
 <style lang="less">
-  .regionTypeBusinessReportList-wrap{
-    tr.garyBg-row{
+  .sTable{
+    .garyBg-row{
       td{
-        background: #ffaa00;
+        background: #f6f6f6!important;
       }
     }
+  }
+  .regionTypeBusinessReportList-wrap{
     .monthBox{
       width: 100%;
       /deep/.ant-calendar-picker-icon{

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.132/ocs-admin',
+        // target: 'http://192.168.2.132/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {