<style>
  @import "css/cssReset.css";

  .page_EasyReport_set {
    position: relative;
    padding: 15px
  }

  .page_EasyReport_set .page_EasyReport_export {
    position: absolute;
    right: 0;
    top: 15px;
  }

  .page_EasyReport_set button.page_EasyReport_search {
    position: absolute;
    bottom: 27px;
    left: 1020px;
  }

  .page_EasyReport_form {
    width: 1000px;
    float: left;
  }

  .page_EasyReport_form .el-date-editor.el-input,
  .page_EasyReport_form .el-date-editor.el-input__inner {
    width: 100% !important;
  }

  .easyUpdateTime {
    position: absolute;
    top: 30px;
    right: 0;
  }

  .column-cell-class-name-test-lan-s .v-table-body-cell {
    background-color: #9cf;
  }

</style>
<template>
  <div class="page_EasyReport My_table_tell page-body" v-loading="AALloading">
    <div class="page_EasyReport_set clearfix">
      <el-form class="clearfix page_EasyReport_form" label-width="110px">
        <el-row style="padding:15px 0 0 0;">
          <el-col :span="6">
            <el-form-item label="年份：">
              <el-date-picker v-model="year" type="year" @change="getData(2)" value-format="yyyy" placeholder="选择年">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="校区：">
              <el-select class="w150" v-model="msg.BranchId" filterable :placeholder="$t('pub.pleaseSel')"
                @change="getData(2)">
                <el-option label="不限" :value="-1"></el-option>
                <el-option v-for="item in BranchList" :label="item.SName" :key="item.SId" :value="item.SId">
                  {{item.SName}}</el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item>
            <!-- <button class="normalBtn page_EasyReport_search" @click="getData(2)">查询</button> -->
            <q-btn color="primary" size="11px" label="查询" @click="getData(2)" style="marginRight:10px"/>
            <q-btn color="primary" size="11px" label="导出EXCEL" @click="exportExcel"/>
            <q-btn color="primary" size="11px" label="保存损失" @click="getData(1)" v-if="userId==1" style="marginLeft:10px"/>
             </el-form-item>
          </el-col>
         
        </el-row>
      </el-form>
     
        <!-- <button class="normalBtn page_EasyReport_search" v-if="userId==1" @click="getData(1)">保存损失</button> -->
        <p class="easyUpdateTime" v-if="UpdateStaus==1">正在更新,更新开始时间 {{UpdateStartTime}}</p>
        <p class="easyUpdateTime" v-if="UpdateStaus==2">上次更新时间 {{UpdateStartTime}}<br />每日8点、12点、19点、22点数据更新~</p>
     
      
    </div>
    <div style="margin-bottom:25px;" v-loading='loading'>
      <v-table is-horizontal-resize column-width-drag :show-vertical-border="true" style="width:100%" :columns="columns"
        :table-data="DataList" :filter-method="filterMethod" :row-height="30" :column-cell-class-name="columnCellClass"
        @on-custom-comp="customCompFunc" @sort-change="sortChange" :row-click="rowClick" :row-dblclick="rowDbClick">
      </v-table>
    </div>
  </div>
</template>
<script>
  import {
    getSchoolDropdown, //获取校区列表
  } from '../../api/school/index';
  import Vue from "vue";
  //一月
  Vue.component("YiYueJump", {
    //  团队跳转
    template: `
  <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',1,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.YiYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.YiYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //二月
  Vue.component("ErYueJump", {
    //  团队跳转
    template: `
   <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',2,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.ErYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.ErYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //三月
  Vue.component("SanYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',3,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.SanYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.SanYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //四月
  Vue.component("SiYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',4,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.SiYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.SiYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //五月
  Vue.component("WuYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',5,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.WuYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.WuYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //六月
  Vue.component("LiuYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer;" v-if="rowData.CostIds" @click="goUrl('JumpReport',6,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.LiuYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.LiuYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //七月
  Vue.component("QiYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',7,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.QiYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.QiYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //八月
  Vue.component("BaYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',8,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.BaYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.BaYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //九月
  Vue.component("JiuYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',9,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.JiuYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.JiuYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //十月
  Vue.component("ShiYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',10,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.ShiYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.ShiYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //十一月
  Vue.component("ShiYiYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',11,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.ShiYiYue}}</span>
  <span style="cursor: pointer" v-else>{{rowData.ShiYiYue}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  //十二月
  Vue.component("ShiErYueJump", {
    //  团队跳转
    template: ` <div class="gourl_span">
  <span style="cursor: pointer" v-if="rowData.CostIds" @click="goUrl('JumpReport',12,rowData.Year,rowData.BranchId,rowData.CostIds)">{{rowData.ShiEr}}</span>
  <span style="cursor: pointer" v-else>{{rowData.ShiEr}}</span>
  </div>`,
    props: {
      rowData: {
        type: Object
      },
      field: {
        type: String
      },
      index: {
        type: Number
      }
    },
    methods: {
      goUrl(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      }
    }
  });
  import {
    getEasyReportList,
    outToExcelEasyReportList
  } from '../../api/finance/index'
  import {
    EduDownLoad,
  } from '../../api/common/common';
  export default {
    data() {
      return {
        year: '',
        monthList: [],
        msg: {
          Year: '',
          Month: 0,
          Money: '',
          sharelist: [],
          BranchId: -1,
        },
        data: [],
        DataList: [],
        UpdateStaus: 0,
        UpdateStartTime: '',
        UpdateEndTime: '',
        BranchList: [],
        MonthIndex: 0,
        pageSize: 18,
        pageIndex: 1,
        multipleSort: false,
        loading: false,
        AALloading: false,
        userId: -2,
        columns: [{
            field: "Sort",
            title: "合计",
            width: 80,
            titleAlign: "left",
            columnAlign: "left",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "ZhaiYao",
            title: "摘要",
            width: 150,
            titleAlign: "left",
            columnAlign: "left",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
          },
          {
            field: "YiYue",
            title: "一月",
            start: "01-01",
            end: "01-31",
            month: 1,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "YiYueJump"
          },
          {
            field: "ErYue",
            title: "二月",
            start: "02-01",
            end: "02",
            month: 2,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "ErYueJump"
          },
          {
            field: "SanYue",
            title: "三月",
            start: "03-01",
            end: "03-31",
            month: 3,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "SanYueJump"
          },
          {
            field: "DiYiJiDu",
            title: "第一季度",
            start: "01-01",
            end: "03-31",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "SiYue",
            title: "四月",
            start: "04-01",
            end: "04-30",
            month: 4,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "SiYueJump"
          },
          {
            field: "WuYue",
            title: "五月",
            start: "05-01",
            end: "05-31",
            month: 5,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "WuYueJump"
          },
          {
            field: "LiuYue",
            title: "六月",
            start: "06-01",
            end: "06-30",
            month: 6,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "LiuYueJump"
          },
          {
            field: "DiErJiDu",
            title: "第二季度",
            start: "04-01",
            end: "06-30",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "ShangBanNianBao",
            title: "上半年报",
            start: "01-01",
            end: "06-30",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "QiYue",
            title: "七月",
            start: "07-01",
            end: "07-31",
            month: 7,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "QiYueJump"
          },
          {
            field: "BaYue",
            title: "八月",
            start: "08-01",
            end: "08-31",
            month: 8,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "BaYueJump"
          },
          {
            field: "JiuYue",
            title: "九月",
            start: "09-01",
            end: "09-30",
            month: 9,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "JiuYueJump"
          },
          {
            field: "DiSanJiDu",
            title: "第三季度",
            start: "06-01",
            end: "09-30",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "ShiYue",
            title: "十月",
            start: "10-01",
            end: "10-31",
            month: 10,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "ShiYueJump"
          },
          {
            field: "ShiYiYue",
            title: "十一月",
            start: "11-01",
            end: "11-30",
            month: 11,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "ShiYiYueJump"
          },
          {
            field: "ShiErYue",
            title: "十二月",
            start: "12-01",
            end: "12-31",
            month: 12,
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false,
            // componentName: "ShiErYueJump"
          },
          {
            field: "DiSiJiDu",
            title: "第四季度",
            start: "10-01",
            end: "12-31",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "XiaBanNianBao",
            title: "下半年报",
            start: "10-01",
            end: "12-31",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
          {
            field: "ZongJi",
            title: "总计",
            start: "01-01",
            end: "12-31",
            width: 80,
            titleAlign: "left",
            columnAlign: "right",
            isResize: true,
            result: [],
            type: "select",
            isFrozen: false
          },
        ],
        BranchStatus: true,
      }
    },
    created() {
      if (this.$route.query.year) {
        this.year = this.$route.query.year
      } else {
        this.year = new Date().getFullYear().toString()
      }
      let arr = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
      for (let i = 0; i < 12; i++) {
        this.monthList.push({
          id: i + 1,
          name: arr[i],
          value: 0,
        })
      }
      let userInfo = this.getLocalStorage();
      this.userId = userInfo.EmployeeId;
    },
    mounted() {
      this.getData(2);
      this.getCompanyList()
    },
    methods: {
      goUrl(path, startDate, endDate, BranchId, tab) {
        this.$router.push({
          name: path,
          query: {
            "startDate": startDate,
            "endDate": endDate,
            BranchId: BranchId,
            blank: 'y',
            tab: tab
          }
        })
      },
      GoUrlFan(path, month, year, BranchId, ids) {
        this.$router.push({
          path: "/financial/" + path,
          query: {
            year: year,
            month: month,
            BranchId: BranchId,
            CostIds: ids,
            blank: "y"
          }
        });
      },
      rowDbClick(rowIndex, rowData, column) {

      },
      rowClick(rowIndex, rowData, column) {
        var that = this;
        let startDate = that.year + "-" + column.start;
        let endDate = "";
        let BranchId = that.msg.BranchId;
        let month = column.month;

        if (column.field == "ErYue") {
          endDate = that.getFirstAndLastMonthDay(that.year, "02");
        } else {
          endDate = that.year + "-" + column.end
        }
        if (rowIndex < 8) {
          // 联运收入
          // if(rowData.ZhaiYao=="联运收入"){
          //   that.goUrl("CombinedRevenueReport",startDate,endDate,BranchId,"联运收入")
          // }
          // // 跳转到应收团款查询
          // else if(rowData.ZhaiYao=="营业总收入"){
          //   that.goUrl("RecPayQueryTeam",startDate,endDate,BranchId,"应收团款查询")
          // }
          // else if(rowData.ZhaiYao=="营业总成本"){
          //   that.goUrl("RecPayQueryTeamV2",startDate,endDate,BranchId,"应付团款查询")
          // }
          that.$router.push({
            path: "/financial/TeamRevenueReport",
            query: {
              StartTime: startDate,
              EndTime: endDate,
              BranchId: BranchId,
              blank: "y"
            }
          });
        } else {
          if (rowData.ZhaiYao == "员工提成") {
            if (Number(this.year) == 2019) {

              if (column.title == "十月" || column.title == "十一月" || column.title == "十二月") {
                let CostIds = "";
                CostIds = rowData.CostIds.replace('112,', '');
                CostIds = CostIds.replace('16,', '');
                that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, CostIds)
              } else {
                that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, rowData.CostIds)
              }
            } else if (Number(this.year) > 2019) {
              let CostIds = "";
              CostIds = rowData.CostIds.replace('112,', '');
              CostIds = CostIds.replace('16,', '');
              that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, CostIds)
            } else {
              that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, rowData.CostIds)
            }
          } else if (rowData.ZhaiYao == "歐洲與南亞損失分攤") {
            that.goUrl("AirTicketLoss", startDate, endDate, BranchId, "机票分摊")
          } else if (rowData.ZhaiYao == "营业外收入" || rowData.ZhaiYao == "其他营业支出" || rowData.ZhaiYao == "应收应付款") {
            if (that.msg.BranchId == 1218) {
              this.$router.push({
                path: "/JumpReport",
                query: {
                  year: rowData.Year,
                  month: month,
                  BranchId: rowData.BranchId,
                  CostIds: rowData.CostIds,
                  "IsJapanNonbusinessIncome": 1,
                  blank: "y"
                }
              });
            }
            //网络印象
            if (that.msg.BranchId == 1224) {
              this.$router.push({
                path: "/fxOrderProfitLossList",
                query: {
                  year: rowData.Year,
                  month: month,
                  BranchId: rowData.BranchId,
                  CostIds: rowData.CostIds,
                  "IsJapanNonbusinessIncome": 1,
                  blank: "y"
                }
              });
            } else {
              that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, rowData.CostIds)
            }

          } else {
            that.GoUrlFan('JumpReport', month, rowData.Year, rowData.BranchId, rowData.CostIds)
          }
        }
      },
      getFirstAndLastMonthDay(year, month) {
        var firstdate = year + '-' + month + '-01';
        var day = new Date(year, month, 0);
        var lastdate = year + '-' + month + '-' + day.getDate(); //获取当月最后一天日期
        return lastdate;
      },
      togbu: function () {
        this.AALloading = true
        let msg = {
          Year: this.year,
          sharelist: [],
        }
        this.monthList.forEach(x => {
          let obj = {
            ID: 0,
            Money: x.value,
            Month: x.id,
            Year: this.year
          }
          msg.sharelist.push(obj)
        })
        this.apipost('financestatistics_post_InsertBatchSimple', msg, res => {
          if (res.data.resultCode == 1) {
            this.$message.success(res.data.message)
          } else {
            this.AALloading = false
            this.$message.error(res.data.message)
          }
        })
      },
      filterMethod: function (filters) {

      },
      sortChange: function (param) {

      },
      customCompFunc: function (param) {
      },
      columnCellClass: function (rowIndex, columnName, rowData) {
        if (rowData.YiYue < 0 && columnName == "YiYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ErYue < 0 && columnName == "ErYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.SanYue < 0 && columnName == "SanYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.DiYiJiDu < 0 && columnName == "DiYiJiDu") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.SiYue < 0 && columnName == "SiYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.WuYue < 0 && columnName == "WuYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.LiuYue < 0 && columnName == "LiuYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.DiErJiDu < 0 && columnName == "DiErJiDu") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ShangBanNianBao < 0 && columnName == "ShangBanNianBao") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.QiYue < 0 && columnName == "QiYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.BaYue < 0 && columnName == "BaYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.JiuYue < 0 && columnName == "JiuYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ShiYue < 0 && columnName == "ShiYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ShiYiYue < 0 && columnName == "ShiYiYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ShiErYue < 0 && columnName == "ShiErYue") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.DiSiJiDu < 0 && columnName == "DiSiJiDu") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.XiaBanNianBao < 0 && columnName == "XiaBanNianBao") {
          return "column-cell-class-name-test-red"
        }
        if (rowData.ZongJi < 0 && columnName == "ZongJi") {
          return "column-cell-class-name-test-red"
        }

        if (rowData.ZhaiYao == '以下项均不计入计算') {
          if (rowData.YiYue == 0) {
            rowData.YiYue = '';
          }
          if (rowData.ErYue == 0) {
            rowData.ErYue = '';
          }
          if (rowData.SanYue == 0) {
            rowData.SanYue = '';
          }
          if (rowData.DiYiJiDu == 0) {
            rowData.DiYiJiDu = '';
          }
          if (rowData.SiYue == 0) {
            rowData.SiYue = '';
          }
          if (rowData.WuYue == 0) {
            rowData.WuYue = '';
          }
          if (rowData.LiuYue == 0) {
            rowData.LiuYue = '';
          }
          if (rowData.DiErJiDu == 0) {
            rowData.DiErJiDu = '';
          }
          if (rowData.ShangBanNianBao == 0) {
            rowData.ShangBanNianBao = '';
          }
          if (rowData.QiYue == 0) {
            rowData.QiYue = '';
          }
          if (rowData.BaYue == 0) {
            rowData.BaYue = '';
          }
          if (rowData.JiuYue == 0) {
            rowData.JiuYue = '';
          }
          if (rowData.DiSanJiDu == 0) {
            rowData.DiSanJiDu = '';
          }
          if (rowData.ShiYue == 0) {
            rowData.ShiYue = '';
          }
          if (rowData.ShiYiYue == 0) {
            rowData.ShiYiYue = '';
          }
          if (rowData.ShiErYue == 0) {
            rowData.ShiErYue = '';
          }
          if (rowData.DiSiJiDu == 0) {
            rowData.DiSiJiDu = '';
          }
          if (rowData.XiaBanNianBao == 0) {
            rowData.XiaBanNianBao = '';
          }
          if (rowData.ZongJi == 0) {
            rowData.ZongJi = '';
          }
        }

        // 设置列class
        if (columnName === "ZongJi") {
          return "column-cell-class-name-test-pink";
        }
        if (columnName === "DiYiJiDu" || columnName === "DiErJiDu" || columnName === "ShangBanNianBao" ||
          columnName === "DiSanJiDu" || columnName === "DiSiJiDu" || columnName === "XiaBanNianBao") {
          return "column-cell-class-name-test";
        }
        if (rowIndex === 1 && (columnName === "DiYiJiDu" || columnName === "DiErJiDu" || columnName ===
            "ShangBanNianBao" || columnName === "DiSanJiDu" || columnName === "DiSiJiDu" || columnName ===
            "XiaBanNianBao")) {
          return "column-cell-class-name-test";
        }
        if (rowData.ZhaiYao === '营业总毛利' || rowData.ZhaiYao === '歐洲與南亞損失分攤' || rowData.ZhaiYao === '营业税金及附加' || rowData
          .ZhaiYao === '管销费用' || rowData.ZhaiYao === '财务费用' || rowData.ZhaiYao === '营业外收入' || rowData.ZhaiYao ===
          '其他营业支出') {
          return "column-cell-class-name-test-greed";
        }
        if (rowData.ZhaiYao === '社保') {
          return "column-cell-class-name-test-gray";
        }
        if (rowData.ZhaiYao === '营业利润 (亏损)') {
          return "column-cell-class-name-test-pink-t";
        }
        if (rowData.ZhaiYao === '净利润 (亏损)') {
          return "column-cell-class-name-test-t";
        }
        if (rowData.ZhaiYao === '所得税费用') {
          return "column-cell-class-name-test-greed-s";
        }
        if (rowData.ZhaiYao == '以下项均不计入计算') {
          return "column-cell-class-name-test-lan-s"
        }
      },
      exportExcel: function () {
        let msg = {
          EmployeeId: this.userId,
          Year: this.year,
          sharelist: [],
          BranchId: this.msg.BranchId,
        }
        this.monthList.forEach(x => {
          let obj = {
            ID: 0,
            Money: x.value,
            Month: x.id,
            Year: this.year
          }
          msg.sharelist.push(obj)
        })
        EduDownLoad("/finance/OutToExcelEasyReportList", msg, "简易报表.xls")
      },
      getData: function (type) {
        this.msg.sharelist = []
        this.loading = true;
        if (type == 1) {
          this.monthList.forEach(x => {
            let obj = {
              ID: 0,
              Money: x.value,
              Month: x.id,
              Year: this.year
            }
            this.msg.sharelist.push(obj)
          })
        }
        this.msg.Year = parseInt(this.year)
        getEasyReportList(this.msg)
          .then(res => {
            this.loading = false;
            if (res.Code == 1) {
              let data = res.Data
              let tichengList = [];
              this.DataList = [];
              data.list.forEach(item => {
                if (item.ZhaiYao != "销售提成" && item.ZhaiYao != "原始提成") {
                  this.DataList.push(item)
                } else {
                  tichengList.push(item);
                }
              })
              this.UpdateStaus = data.Status;
              this.UpdateStartTime = data.UpdateStartTime;
              this.UpdateEndTime = data.UpdateEndTime;
              this.loading = false
              this.$forceUpdate()
              return
              for (let i = 0; i <= 18; i++) {
                this.DataList.push({
                  ID: i + 1,
                  ZhaiYao: parseInt(Math.random(1000) * 1000 + 1),
                  YiYue: parseInt(Math.random(1000) * 1000 + 1),
                  ErYue: parseInt(Math.random(1000) * 1000 + 1),
                  SanYue: parseInt(Math.random(1000) * 1000 + 1),
                  DiYiJiDu: parseInt(Math.random(1000) * 1000 + 1),
                  SiYue: parseInt(Math.random(1000) * 1000 + 1),
                  WuYue: parseInt(Math.random(1000) * 1000 + 1),
                  LiuYue: parseInt(Math.random(1000) * 1000 + 1),
                  DiErJiDu: parseInt(Math.random(1000) * 1000 + 1),
                  ShangBanNianBao: parseInt(Math.random(1000) * 1000 + 1),
                  QiYue: parseInt(Math.random(1000) * 1000 + 1),
                  BaYue: parseInt(Math.random(1000) * 1000 + 1),
                  JiuYue: parseInt(Math.random(1000) * 1000 + 1),
                  DiSanJiDu: parseInt(Math.random(1000) * 1000 + 1),
                  ShiYue: parseInt(Math.random(1000) * 1000 + 1),
                  ShiYiYue: parseInt(Math.random(1000) * 1000 + 1),
                  ShiErYue: parseInt(Math.random(1000) * 1000 + 1),
                  DiSiJiDu: parseInt(Math.random(1000) * 1000 + 1),
                  XiaBanNianBao: parseInt(Math.random(1000) * 1000 + 1),
                  ZongJi: parseInt(Math.random(1000) * 1000 + 1),
                })
              }
            } else {
              this.loading = false
              this.$message.error(res.Message)
            }
          })
          .catch(() => {
            this.loading = false;
          });
      },
      //初始化学校
      getCompanyList() {
        let userInfo = this.getLocalStorage();
        var RB_Group_id = userInfo.RB_Group_id;
        let msg = {
          Status: 0,
          is_show: 0,
          RB_Group_Id: RB_Group_id
        };
        getSchoolDropdown({}).then(res => {
          if (res.Code == 1) {
            var tempArray = res.Data;
            this.BranchList = tempArray;
          }
        })
      },
    }
  }

</script>
