<template>
  <div class="content-main">
    <div class="title-name">
      资产负债表
    </div>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <div class="flexBox">
      <div class="floatLeft">填报单位：{{formInline.dwmc}}</div>
      <div class="floatRight">
        <span style="color: #FF0000;">*</span>填报期数：<el-date-picker
                :disabled="type == 'ck'"
                v-model="formInline.bbsj"
                type="month"
                placeholder="选择期数"
                format="yyyyMM"
                value-format="yyyyMM">
              </el-date-picker>
			  <span style="margin-left: 10px;">单位：元</span>
      </div>
    </div>

      <div style="display: flex;width: 100%;" class="recordsDetailsTable">
        <div style="flex: 4;">
          <table>
           <!-- <thead>
              <tr>
                <th>资产</th>
                <th>期末余额</th>
                <th>年初余额</th>
              </tr>
            </thead> -->
              <tbody>
                  <tr v-for="item in zcList">
                     <td>{{item.zbmc}}</td>
					 <td v-if="item.zbz1 == '期末余额'">{{item.zbz1}}</td>
                     <td v-else>
                       <span v-if="type == 'ck' || item.zbmc == ''">
                         {{item.zbz1}}
                       </span>
                     <!-- <el-input v-else clearable v-model="item.zbz1" placeholder="请输入"></el-input> -->
                     </td>
					 <td v-if="item.zbz2 == '年初余额'">{{item.zbz2}}</td>
                     <td v-else>
                     <span v-if="type == 'ck' || item.zbmc == ''">{{item.zbz2}}</span>
                     <!-- <el-input v-else clearable v-model="item.zbz2" placeholder="请输入"></el-input> -->
                     </td>
                   </tr>
              </tbody>
          </table>
        </div>
        <div style="float: right;flex: 5;" class="recordsDetailsTable">
          <table>
            <!-- <thead>
              <tr>
                <th>负债和所有者权益（或股东权益）</th>
                <th>期末余额</th>
                <th>年初余额</th>
              </tr>
            </thead> -->
              <tbody>
                  <tr v-for="item in fzList">
                     <td>{{item.zbmc}}</td>
					 <td v-if="item.zbz1 == '期末余额'">{{item.zbz1}}</td>
                     <td v-else>
                       <span v-if="type == 'ck' || item.zbmc == ''">
                         {{item.zbz1}}
                       </span>
                     <!-- <el-input v-else clearable v-model="item.zbz1" placeholder="请输入"></el-input> -->
                     </td>
					 <td v-if="item.zbz2 == '年初余额'">{{item.zbz2}}</td>
                     <td v-else>
                     <span v-if="type == 'ck' || item.zbmc == ''">{{item.zbz2}}</span>
                     <!-- <el-input v-else clearable v-model="item.zbz2" placeholder="请输入"></el-input> -->
                     </td>
                   </tr>
              </tbody>
          </table>
        </div>
      </div>
      <div style="text-align: center; margin-top: 20px">
        <!-- <el-button  v-if="type != 'ck'" type="primary"
          icon="iconfont iconchucun iconbaocun" @click="saveZc('0')">保存</el-button>
        <el-button v-if="type != 'ck'" type="primary"
          icon="iconfont icontijiao" @click="saveZc('1')">提交</el-button> -->
        <el-button @click="cancelClick" type="primary"
          icon="iconfont iconfanhui">返回</el-button>
      </div>

    </el-form>
  </div>
</template>

<script>
  import {
    financeReportSave,financeReportUpdate,financeReportInfo
  } from "@/api/cwbb/index";

  export default{
    data() {
      return {
        type:this.$route.query.type,
        zcList:[
          {
            zbmc:'资产',
            zbz1:'期末余额',
            zbz2:'年初余额',
          },
          {
            zbmc:'流动资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'货币资金',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'交易性金融资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'衍生金融资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应收票据',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应收账款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'预付款项',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他应收款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'存货',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'合同资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'持有待售资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'一年内到期的非流动资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他流动资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'流动资产合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'非流动资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'债券投资',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他债券投资',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'长期应收款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'长期股权投资',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他权益工具投资',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他非流动金融资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'投资性房地产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'固定资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'在建工程',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'生产性生物资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'油气资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'无形资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'开发支出',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'商誉',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'长期待摊费用',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'递延所得税资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他非流动资产',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'非流动资产合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'资产总计',
            zbz1:'',
            zbz2:'',
          }
        
        ],
        fzList:[
          {
            zbmc:'负债和所有者权益（或股东权益）',
            zbz1:'期末余额',
            zbz2:'年初余额',
          },
          {
            zbmc:'流动负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'短期借款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'交易性金融负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'衍生金融负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应付票据',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应付账款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'预收款项',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'合同负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应付职工薪酬',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应交税费',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他应付款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'持有待售负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'一年内到期的非流动负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他流动负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'流动负债合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'非流动负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'长期借款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'应付债券',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其中：优先股',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'永续债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'长期应付款',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'预计负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'递延收益',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'递延所得税负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他非流动负债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'非流动负债合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'负债合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'所有者权益（或股东权益）',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'实收资本（或股本）',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他权益工具',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其中：优先股',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'永续债',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'资本公积',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'减：库存股',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'其他综合收益',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'专项储备',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'盈余公积',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'未分配利润',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'所有者权益（或股东权益）合计',
            zbz1:'',
            zbz2:'',
          },
          {
            zbmc:'负债和所有者权益（或股东权益）总计',
            zbz1:'',
            zbz2:'',
          }
        ],
        formInline:{
          bbm:'01',
          bbsj:'',
           "createDate": "",
            "creator": "",
          detailList:[],
          "dwdm":sessionStorage.getItem("tyshxydm"),
            "dwmc": sessionStorage.getItem("orgName"),
            "id": "",
            "isDelete": 0,
            "kqdm": sessionStorage.getItem("tyshxydm")+'001',
            "kqmc": sessionStorage.getItem("orgName"),
            "remark": "",
            "status": 0,
            "updateDate": "",
            "updater": ""
        },
        tbqs:'',
        id:'',
      }
    },
    created(){
      this.DetailLst(this.$route.query.id)
      this.id=this.$route.query.id
    },
    methods:{
      DetailLst(id){
        if(id){
          var data={
            id:id
          }
          financeReportInfo(data).then(res =>{
            if(res.infoCode == 200){
              this.formInline=res.data
			  this.formInline.detailList.splice(34,0,{
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  },
			  {
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  },
			  {
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  },
			  {
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  },
			  {
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  },
			  {
			    zbmc:'',
			    zbz1:'',
			    zbz2:'',
			  })
			  let len=this.formInline.detailList.length
              this.zcList = this.formInline.detailList.slice(0,len/2)
               this.fzList = this.formInline.detailList.slice(len/2,len)
               // console.log(arr1,'ooop[]',arr2)
            }else{
				   this.$message.error(res.msg);
			   }
          })
        }
      },
      cancelClick(){
        this.$router.push({
          name: "balanceSheet",
        });
      },
    }
  }
</script>
<style scoped lang="scss">
.recordsDetailsTable{
    background-color: #fff;
    font-size: 14px;
    padding-bottom: 20px;
    table {
      width: 100%;
      margin-top: 10px;
      font-size: 14px;
    }
    td,
    th {
      text-align: center;
      border: 1px solid #eaeaea;
      word-wrap: break-word;
      height: 40px;
    }
    span,
    .el-input,
    .el-textarea {
      font-size: 12px;
    }
}
.title-name{
    text-align: center;
    font-size: 22px;
    font-weight: 600;
  }
  .line-box{
    display: flex;
  }
  .flexBox{
    line-height: 40px;
    height: 40px;
    text-align: center;
  }
</style>
