<template>
  <div>
    <!-- 搜索工作栏 -->
    <Search
      :schema="allSchemas.searchSchema"
      labelWidth="0"
      expand
      expand-field="name"
      @search="setSearchParams"
      @reset="setSearchParams"
    />
    <!-- 列表 -->
    <SSTable
      class="mt-20px"
      v-model:tableObject="tableObject"
      :tableColumns="allSchemas.tableColumns"
      @get-list="getTableList"
    >
      <el-table-column
        v-for="item in allSchemas.tableColumns"
        :key="item.table?.field || item.field"
        :prop="item.table?.field || item.field"
        :label="item.label"
        :fixed="item.fixed"
        min-width="150px"
        showOverflowTooltip
      />
      <el-table-column prop="count" label="库存数量">
        <!-- <template #default="{ row }">
          <el-button v-if="row.count" type="primary" text @click="handleDetail">{{
            row.count
          }}</el-button>
          <span v-else>{{ row.count }}</span>
        </template> -->
      </el-table-column>
    </SSTable>
  </div>
</template>

<script setup>
import { allSchemas } from './InventoryDetail.data.js'

const tableObject = ref({
  tableList: [],
  loading: false,
  total: 1,
  pageSize: 20,
  currentPage: 1
})

function setSearchParams() {
  tableObject.value.tableList = []
}

function getTableList() {
  tableObject.value.tableList = []
}
</script>

<style lang="scss" scoped></style>
