<template>
  <div>
    <el-button size="mini" type="text" @click="editBtn">明 细</el-button>
    <el-drawer title="账户流水明细" append-to-body :visible.sync="dialogFormVisible" size="1300px">
      <div class="container">
        <el-input type="text" size="small" class="inline-16" style="width:200px;margin-bottom:10px" clearable @clear="getList" v-model="params.content.where.condition" placeholder="请输入搜索内容" @keyup.native.enter="getList(params.content.pageNumber=1)"></el-input>
        <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" :fixedName="'operation'" height="600px">
          <template v-slot:customcol="scope">
            <div v-if="scope.column.columnname == 'type'">
              <span>{{scope.column.data[[scope.column.columnname]] ? '收入' : '支出'}}</span>
            </div>
            <div v-else>
              {{scope.column.data[[scope.column.columnname]]?scope.column.data[[scope.column.columnname]]:'--'}}
            </div>
          </template>
          <template v-slot:opreation="scope">
            <editPrice v-if="tool.checkAuth($route.name,'update')" class="inline-16" :data="scope.data"/>
            <delete-btn 
              @deleteCreate="deleteCreate" 
              v-if="tool.checkAuth($route.name,'delete')" 
              :id="scope.data.sa_itempriceadjust_itemsid" 
              @deleteSuccess="$refs.basicLayout.listData()" 
              nameId="20221025095404" 
              nameKey="sa_itempriceadjust_itemsids"
            />
          </template>
        </tableLayout>
        <div style="margin-top:16px;text-align:right">
          <el-pagination
            background
            small
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="params.content.pageNumber"
            :page-size="params.content.pageSize"
            layout="total, prev, pager, next, jumper"
            :total="total">
          </el-pagination>
        </div>
      </div>

    </el-drawer>
    
  </div>
</template>

<script>
export default {
  props:['rowData'],
  components:{},
  name: "index",
  data() {
    return {
      options:[],
      dialogFormVisible:false,
      total:0,
      list:[],
      tablecols:[],
      params: {
        "id":20221022161304,
        "content": {
          "pageNumber":1,
          "pageSize":100,
          "sa_accountclassid":"",
          "sys_enterpriseid":"",
          "minAmount":20,
          "maxAmount":0,
          "where": {
            "condition":""
          }
        }
      }
    }
  },
  created () {
    this.tablecols = this.tool.tabelCol(this.$route.name)['accountMoneyDetailTable'].tablecols
  },
  methods: {
    editBtn () {
      this.getList()
      this.dialogFormVisible = true
    },
    async getList () {
      this.params.content.sa_accountclassid = this.rowData.sa_accountclassid
      this.params.content.sys_enterpriseid = this.rowData.sys_enterpriseid
      let res = await this.$api.requested(this.params)
      this.list = res.data
      this.total =res.total
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.params.content.pageSize = val
      this.getList()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.params.content.pageNumber = val
      this.getList()
    },
  }
}
</script>

<style scoped>

</style>