zhangxiaoxu123
2022-09-13 08b5ddfa9a0a2ed52bd7d7b98ca16ef4dcc610a6
src/pages/show/shehuiBaozhang/shehuiBaozhangChildren/shebaoShouzhiZongbiao.vue
@@ -71,98 +71,148 @@
          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>
@@ -180,7 +230,7 @@
    return {
      tableHead:[],
      tableData:[],
      headerArry:[],
      headerArry:{},
      echartsSeries:{}
    }
  },
@@ -192,50 +242,14 @@
      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 +357,7 @@
              myEchart.resize()
          })
      },
      handleCellStyle({rowIndex, columnIndex}) {
      handleCellStyle({row, column, rowIndex, columnIndex}) {
          if(columnIndex == 0) {
              return { background:'#51D2FF' }
          }