zhangxiaoxu123
2022-09-14 77536cfa95b1e3c5e60f94dce3a53aa2e93f121a
src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue
@@ -3,6 +3,7 @@
    <div class="shebaoShouzhiZongbiao-table">
      <h1>社会保障基金统计表</h1>
      <el-table
        :max-height="tableHeight"
        :data="tableData"
        :cell-style="handleCellStyle"
        style="width: 100%">
@@ -71,101 +72,155 @@
          prop="item"
          label="项目">
        </el-table-column>
        <el-table-column :label="month1" align="center">
        <el-table-column v-if="tableData[0]" :label="tableData[0].month1" align="center">
          <el-table-column
            align="center"
            prop="totalIncome1"
            label="总收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.totalIncome1) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome1}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="taxesIncome1"
            label="征集收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.taxesIncome1) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome1}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="pay1"
            label="本月支出">
            <template slot-scope="scope">
              <span :class="Number(scope.row.pay1) < 0 ? 'fontColorRed' : ''">{{scope.row.pay1}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="balance1"
            label="本月结余">
            <template slot-scope="scope">
              <span :class="Number(scope.row.balance1) < 0 ? 'fontColorRed' : ''">{{scope.row.balance1}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column :label="month2" align="center">
        <el-table-column v-if="tableData[0]" :label="tableData[0].month2" align="center">
          <el-table-column
            align="center"
            prop="totalIncome2"
            label="总收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.totalIncome2) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome2}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="taxesIncome2"
            label="征集收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.taxesIncome2) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome2}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="pay2"
            label="本月支出">
            <template slot-scope="scope">
              <span :class="Number(scope.row.pay2) < 0 ? 'fontColorRed' : ''">{{scope.row.pay2}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="balance2"
            label="本月结余">
            <template slot-scope="scope">
              <span :class="Number(scope.row.balance2) < 0 ? 'fontColorRed' : ''">{{scope.row.balance2}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column :label="month3" align="center">
        <el-table-column v-if="tableData[0]" :label="tableData[0].month3" align="center">
          <el-table-column
            align="center"
            prop="totalIncome3"
            label="总收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.totalIncome3) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome3}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="taxesIncome3"
            label="征集收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.taxesIncome3) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome3}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="pay3"
            label="本月支出">
            <template slot-scope="scope">
              <span :class="Number(scope.row.pay3) < 0 ? 'fontColorRed' : ''">{{scope.row.pay3}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="balance3"
            label="本月结余">
            <template slot-scope="scope">
              <span :class="Number(scope.row.balance3) < 0 ? 'fontColorRed' : ''">{{scope.row.balance3}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column :label="month4" align="center">
        <el-table-column v-if="tableData[0]" :label="tableData[0].month4" align="center">
          <el-table-column
            align="center"
            prop="totalIncome4"
            label="总收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.totalIncome4) < 0 ? 'fontColorRed' : ''">{{scope.row.totalIncome4}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="taxesIncome4"
            label="征集收入">
            <template slot-scope="scope">
              <span :class="Number(scope.row.taxesIncome4) < 0 ? 'fontColorRed' : ''">{{scope.row.taxesIncome4}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="pay4"
            label="本月支出">
            <template slot-scope="scope">
              <span :class="Number(scope.row.pay4) < 0 ? 'fontColorRed' : ''">{{scope.row.pay4}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="balance4"
            label="本月结余">
            <template slot-scope="scope">
              <span :class="Number(scope.row.balance4) < 0 ? 'fontColorRed' : ''">{{scope.row.balance4}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column
          align="center"
          prop="surplus"
          label="累计结余">
          <template slot-scope="scope">
            <span :class="Number(scope.row.surplus) < 0 ? 'fontColorRed' : ''">{{scope.row.surplus}}</span>
          </template>
        </el-table-column>
      </el-table>
      <div class="shebaoShouzhiZongbiaoEcharts" id="shebaoShouzhiZongbiaoEcharts"></div>
      <div v-show="echartsShow" class="shebaoShouzhiZongbiaoEcharts" id="shebaoShouzhiZongbiaoEcharts"></div>
      <div class="yincang-box">
        <el-button @click="showEchartsBtn" v-show="echartsShow" type="primary">隐藏</el-button>
        <el-button @click="showEchartsBtn" v-show="!echartsShow" type="primary">显示</el-button>
      </div>
    </div>
  </div>
</template>
@@ -180,8 +235,10 @@
    return {
      tableHead:[],
      tableData:[],
      headerArry:[],
      echartsSeries:{}
      headerArry:{},
      echartsSeries:{},
      tableHeight: window.innerHeight - nowSize(960),
        echartsShow: true
    }
  },
  mounted() {
@@ -189,53 +246,25 @@
     this.getStatisticsChart()
  },
  methods: {
      showEchartsBtn() {
          this.echartsShow = !this.echartsShow
          if(this.echartsShow) {
              this.tableHeight = window.innerHeight - nowSize(960)
          }else {
              this.tableHeight = window.innerHeight - nowSize(320)
          }
      },
      getStatisticsTable() {
          getStatisticsTable().then(res => {
              if(res.code == 1000) {
                  let result = res.list
                  // this.tableData = result
                  this.headerArry = result
                  console.log('this.headerArry====',this.headerArry)
                  // this.getData(result)
                  let data = []
                  result.forEach((item,index) => {
                      let row = item.dataList
                      row.forEach((e,i) => {
                          let a = Object.assign({},e,{name: item.item})
                          data.push(a)
                      })
                  this.tableData = res.list
                  res.list.forEach((item,index) => {
                      if(index == 0) {
                          this.headerArry = item
                          console.log(this.headerArry,'this.headerArry====')
                      }
                  })
                  this.tableData = result
                  console.log( this.tableData,' this.tableData===========')
                  console.log( this.headerArry,'this.headerArry===========')
              }
          })
      },
      getData(result) {
          let row = []
          this.tableData.forEach((e,index) => {
              // row.push({
              //     name: e.item
              // })
              if(index == 0) {
                  this.headerArry = e
              }
              e.dataList.forEach((c,i) => {
                  row.push({
                      name: e.item,
                      "month": c.month ,
                      "totalIncome": c.totalIncome,
                      "taxesIncome": c.taxesIncome,
                      "pay": c.pay,
                      "balance": c.balance,
                      "surplus": c.surplus || null
                  })
              })
              // this.headerArry = row
              // this.tableData = row
              console.log(this.headerArry)
          })
      },
      shebaoShouzhiZongbiaoEcharts() {
@@ -343,7 +372,7 @@
              myEchart.resize()
          })
      },
      handleCellStyle({rowIndex, columnIndex}) {
      handleCellStyle({row, column, rowIndex, columnIndex}) {
          if(columnIndex == 0) {
              return { background:'#51D2FF' }
          }
@@ -441,4 +470,12 @@
    height: calc(100% - 640px - 0.33203125rem  /* 85/256 */);
  }
}
.shebaoShouzhiZongbiao-table{
  position: relative;
  .yincang-box{
    position: absolute;
    right: 0.078125rem  /* 20/256 */;
    bottom: 0.078125rem  /* 20/256 */;
  }
}
</style>