<template>
  <c-content>
  <div class="eibs-tab">  
        <template >
                <el-form
                    class="m-table-search-form"
                    ref="paramsForm"
                    :inline="true"
                    label-position="left"
                    label-width="110px"
                    size="small"
                >
          
        <el-row>  
         <c-col :span="24">                                              
            <c-col :span="8">
                <el-form-item label="资产发布编号" prop="assposref" style="width:100%">
                    <c-input  v-model="model.assposref" maxlength="50"  placeholder="请输入资产发布编号" style="width:330px"></c-input>
                </el-form-item>
            </c-col>

             <c-col :span="8" >
                <el-form-item label="起始日期" style="width:100%">
                  <c-col :span="11" >
                    <c-date-picker type="date"   v-model="model.fromdate"  placeholder="请选择Opening between" style="width:100%"></c-date-picker>
                   </c-col>
                  <c-col :span="2" style="text-align: center">
                      <label style="display: inline-block; width: 100%">-</label>
                  </c-col>
                   <c-col :span="11" >
                    <c-date-picker type="date"  v-model="model.todate"  placeholder="请选择Open Date to" style="width:100%"></c-date-picker>
                  </c-col>
                </el-form-item>
            </c-col>
            <c-col :span="8">
                <el-form-item label="资产业务类型" prop="assbustyp" style="width:100%">
                    <c-select
                        v-model="model.assbustyp"
                        style="width:100%"
                        placeholder="请选择业务类型"
                      >
                        <el-option
                        v-for="item in type"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                         </el-option>
                    </c-select>

                </el-form-item>
            </c-col>
          </c-col> 
        </el-row>
        <c-col :span="24" style="text-align: right; height: 36.8px">
          
             <el-button size="small" @click="handleReset">重置</el-button>
             <el-button
            type="primary"
            icon="el-icon-search"
            size="small"
            @click="handleSearch()"
            >查询</el-button >
          
          </c-col>                 
  </el-form>
   <c-col :span="24">
      <div style="border-bottom: 10px solid rgb(232, 232, 232)"></div>
    </c-col>
 
 </template>

 <c-col :span="24">
   <div class="table">
    <!-- <c-istream-table :list="itemList"> -->

     <el-table :data="itemList.slice((currentPage-1)*PageSize,currentPage*PageSize)" :border="true" style="width:80%,text-align:center" :header-cell-style="{background:'rgb(235, 235, 235)',color:'#000'}">
       <el-table-column label="资产发布编号" width="240px" prop="assposref"></el-table-column>'center'
       <el-table-column label="承付金额" width="200px" prop="accamt" align="right"></el-table-column>
     <el-table-column label="承付日期" width="200px" prop="accdat"></el-table-column>
     <el-table-column label="资产业务类型" width="200px" prop="assbustyp"></el-table-column>
     <el-table-column label="资产登记编号" width="240px" prop="assregref"></el-table-column>
     <el-table-column label="资产登记类型" width="200px" prop="assregtyp"></el-table-column>
     <el-table-column label="资产状态" width="200px" prop="asssta"></el-table-column>
     <el-table-column label="资产交易状态" width="200px" prop="asstrasta"></el-table-column>
     <el-table-column label="信用证兑付类型" width="200px" prop="avbby"></el-table-column>
     <el-table-column label="单据状态" width="200px" prop="docsta"></el-table-column>
     <el-table-column label="业务归属机构" width="200px" prop="ownbch"></el-table-column>
     <el-table-column label="业务经办机构" width="200px" prop="usrbch"></el-table-column>
     <el-table-column fixed="right" prop="op" label="操作" width="200px">
        <template slot-scope="scope">
            <el-button
              style="margin-left: 0"
              size="small"            
              @click="Detail(scope)"
            >
              详情
            </el-button>

            <c-button
              style="margin-left: 0"
              size="small"
              type="primary"
              @click="Edit(scope)"
            >
              处理
            </c-button>
            <c-button
              style="margin-left: 0"
              size="small"
              type="primary"
              @click="Del(scope.$index)"
            >
              删除
            </c-button>
          </template>
        </el-table-column>
        </el-table>    
      <!-- </c-istream-table>      -->
      <div class="tabListPage">
           <el-pagination @size-change="handleSizeChange" 
                          @current-change="handleCurrentChange" 
                          :current-page="currentPage" 
                          :page-sizes="pageSizes" 
                          :page-size="PageSize" layout="total, sizes, prev, pager, next, jumper" 
                          :total="itemList.length">
             </el-pagination>
       </div>
      </div>
    </c-col>  
    <el-dialog :visible.sync="showPanel" :title="opttitle" append-to-body :before-close="cancel">
      <el-form
          class="m-table-search-form"
          ref="paramsForm"
          :inline="true"
          label-position="right"
          label-width="110px"
          size="small"
        >
        
          <c-row>
            <c-col :span="24">
              <c-col :span="24">
                <el-form-item label="资产发布编号" prop="edit.assposref" style="width: 100%" >
                 <c-input
                    v-model="model.edit.assposref"
                    placeholder="请输入assposref"
                    type="textarea"
                    :rows="4"
                    maxlength="200"
                    show-word-limit
                    :disabled="isDetail"
                    style="width: 95%"
                  ></c-input>
                </el-form-item>     
              </c-col>
              <c-col :span="24">
                <c-input v-if="showIndex" style="visibility: hidden" v-model="model.edit.accamt" ></c-input>
                <el-form-item label="承付金额" prop="edit.accamt" style="width: 100%">
                  <c-input
                    v-model="model.edit.accamt"
                    placeholder="请输入accamt"
                    type="textarea"
                    :rows="4"
                    maxlength="200"
                    show-word-limit
                    :disabled="isDetail"
                    style="width: 95%"
                  ></c-input>
                </el-form-item>
              </c-col>
              <c-col :span="24">
                <el-form-item label="承付日期" prop="edit.accdat" style="width: 100%">
                  <c-date-picker
                    type="date"
                    v-model="model.edit.accdat"
                    style="width: 95%"
                    placeholder="请选择"
                    :disabled="isDetail"
                    ></c-date-picker>
                </el-form-item>
              </c-col>
              <c-col :span="24">
                <el-form-item label="资产业务类型" prop="edit.assbustyp" style="width: 100%">
                 <c-input
                    v-model="model.edit.assbustyp"
                    placeholder="请输入assbustyp"
                    type="textarea"
                    :rows="4"
                    maxlength="200"
                    show-word-limit
                    :disabled="isDetail"
                    style="width: 95%"
                  ></c-input>
                </el-form-item>
              </c-col>
              <c-col :span="24">
                <el-form-item label="资产登记编号 " prop="edit.assregref" style="width: 100%">
                  <c-input
                    v-model="model.edit.assregref"
                    placeholder="请输入assregref"
                    type="textarea"
                    :rows="4"
                    maxlength="200"
                    show-word-limit
                    :disabled="isDetail"
                    style="width: 95%"
                  ></c-input>
                </el-form-item>
              </c-col>
            </c-col>
          <c-col :span="24" style="text-align: center; height: 36.8px">
            <el-button
              type="primary"
              size="small"
              @click="submitData"
              v-if="optType"
              >提交</el-button
            >
            <el-button style="margin-left: 0" size="small" @click="cancel">
              返回
            </el-button> 
          </c-col>
          </c-row>
        </el-form>
    </el-dialog>
  

  </div>
  </c-content>  
</template>

<script>
import Api from "~/service/Api"
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable"
import Event from "~/model/AssetInfo/Event"
// import  BusNavbar from "~/views/Business//BusNavbar"
import {assInfo} from "~/service/elec"
import {assQueryId} from "~/service/elec"

export default {
    inject: ['root'],
    props:["model","codes"],
    mixins: [commonProcess],
   
    data(){
        return {
            // curinr:"",
            //curownref:"",

            showPanel: false,
            opttitle:"",
            isDetail:true,
            optType:true,
            showIndex:false,
            type:[
              {label:"一级福费廷",value:"OLFT"},
              {label:"二级福费廷",value:"SLFT"},
              {label:"代理福费廷",value:"AGFT"},
            ],
      

            

            // 总数据
            itemList:[],
           // 默认显示第几页
           currentPage:1,
           // 总条数，根据接口获取数据长度(注意：这里不能为空)
           total:0,
           // 个数选择器（可修改）
           pageSizes:[5,10,15,20,25],
           // 默认每页显示的条数（可修改）
           PageSize:5,

            
             
        }
    },
    created(){
        assInfo().then(res=>{
            this.itemList=res;
         
            
        })

    },
    
    methods:{...Event,
      
        
       handleReset: function () {
        this.model.assposref='';
        this.model.fromdate='';
        this.model.todate='';
        this.model.assbustyp='';
        
        
      },
      handleSearch(){
        // if(this.model.query.assposref==scope.row.assposref)
        // {
        //   assQueryId().then(res=>{
        //     this.itemList=res;
         
            
        // })
        // }
          
        assQueryId({
          "assposref":this.model.assposref,
          "fromdate":this.model.fromdate,
          "todate":this.model.todate,
          "assbustyp":this.model.assbustyp  
        }).then(res=>{
           this.itemList=res;
        })
        // console.log(this.model.assbustyp)
    
      
        
       
      },
     

      Detail(scope){
      
      this.model.edit.accamt = scope.row.accamt;
      this.model.edit.accdat = scope.row.accdat;
      this.model.edit.assbustyp = scope.row.assbustyp;
      this.model.edit.assposref = scope.row.assposref;
      this.isDetail = true;
      this.opttitle = "资产信息详情";
      this.optType = false;
      this.showPanel = true;
    },
    
    Edit(scope){
     this.model.edit.accamt = scope.row.accamt;
      this.model.edit.accdat = scope.row.accdat;
      this.model.edit.assbustyp = scope.row.assbustyp;
      this.model.edit.assposref = scope.row.assposref;
      this.isDetail = false;
      this.opttitle = "资产信息修改";
      this.optType = true;
      this.showPanel = true;
    },
    cancel(){
      this.showPanel=false;
    },

    submitData(){},
// 每页显示的条数
       handleSizeChange(size) {
           // 改变每页显示的条数 
           this.PageSize=size;
           // 注意：在改变每页显示的条数时，要将页码显示到第一页
           this.currentPage=1;
                  

       },
         // 显示第几页
       handleCurrentChange(currentPage) {
           // 改变默认的页数
           this.currentPage=currentPage;
           
       },
    }
}
  


</script>
<style>
.table {
  margin-top: 20px;
}

.el-table .cell {
  line-height: 18px; 
}



</style>
