
<template>
  <div>
    <basicLayout 
      ref="list" 
      formPath="AccountMoney" 
      tableName="accountMoneyTable" 
      :apiId="{query:20221008145903}"
      :options="options"
      @listCreate="list">
      <template #custom>
<!--        <div class="mt-10">
          <label class="search__label">企业:</label>
          <el-select 
              class="inline-16"
              v-model="sys_enterpriseid" 
              placeholder="企业筛选" 
              size="small" 
              @change="enterpriseChange" 
              clearable 
              @clear="enterpriseChange($refs.list.param.content.where.sys_enterpriseid='')"
            >
              <el-option
                v-for="item in enterpriseList"
                :key="item.sys_enterpriseid"
                :label="item.enterprisename"
                :value="item.sys_enterpriseid">
              </el-option>
            </el-select>
        </div>-->
        <div class="mt-10">
          <span class="search__label">账户类型: </span>
            <el-select 
              class="inline-16"
              v-model="accountType" 
              placeholder="账户类型筛选" 
              size="small" 
              @change="accountChange" 
              clearable 
              @clear="accountChange($refs.list.param.content.where.accountname='')"
            >
              <el-option
                v-for="item in accountTypeList"
                :key="item.accountno"
                :label="item.accountname"
                :value="item.accountname">
              </el-option>
            </el-select>
        </div>
      </template>
      <template v-slot:tbList="scope">
        <div v-if="scope.data.column.columnname == 'province'">
          <span v-if="scope.data.column.data.province !== ''">
            {{`${scope.data.column.data[[scope.data.column.columnname]]}、${scope.data.column.data.city}、${scope.data.column.data.county}` }}
          </span>
          <span v-else>--</span>
        </div>
        <div v-else>
          {{scope.data.column.data[[scope.data.column.columnname]]}}
        </div>
      </template>
      <template v-slot:tbOpreation="scope">
        <Detail :rowData="scope.data.data"/>
      </template>
    </basicLayout>
  </div>
</template>

<script>
import Detail from './modules/detail'
export default {
  components:{Detail},
  data () {
    return {
      options:[],
      enterpriseList:'',
      accountType:'',
      sys_enterpriseid:'',
      accountTypeList:[]
    }
  },
  async created () {
    this.getEnterprise()
    this.getAccountType()
  },
  methods:{
    list (param) {
      param.content.type = 0
      // param.content.sys_enterpiseid = JSON.parse(window.sessionStorage.getItem('accountinfo')).enterprise.sys_enterpriseid
    },
    /** 获取公司数据 */
    async getEnterprise () {
      let res = await this.$api.requested({
        "id": 20221021095802,
        "content": {
            "pageNumber": 1,
            "pageSize": 99999,
            "where": {
                "condition": ""
            }
        },
      })
      this.enterpriseList = res.data
    },
    async getAccountType () {
      let res = await this.$api.requested({
        "id":20221008134803,
        "content": {

        }
      })
      this.accountTypeList = res.data
      console.log(this.accountTypeList);
      
    },
    /* 企业筛选 */
    enterpriseChange () {
      this.$refs.list.param.content.where.sys_enterpriseid = this.sys_enterpriseid
      this.$refs.list.listData()
    },
    accountChange () {
      this.$refs.list.param.content.where.accountname = this.accountType
      this.$refs.list.listData()
    }
  }
}

</script>
<style>
</style>