<!-- 我的仓储-我的仓库 -->
<template>
    <app-view>
        <app-table :data="dataList" v-model:columns="columns" :loading="loading">
            <template #header>
                <app-auth-operation :menus="['add']" @closed="getWarehouseList" />
            </template>
            <template #address="{ row }">
                {{ [row.provincename, row.cityname, row.districtname, row.address].join(' ') }}
            </template>
            <!-- 操作 -->
            <template #operate="{ row }">
                <app-auth-operation :menus="['edit']" :options="{ selectedRow: row }" @closed="getWarehouseList" />
            </template>
            <template #footer>
                <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"
                    @change="getWarehouseList" />
            </template>
        </app-table>
    </app-view>
</template>

<script lang="ts" setup>
import { ElMessage } from 'element-plus'
import { useWarehouse } from '@/business/warehouse'
import AppAuthOperation from '@pc/components/modules/auth-operation/index.vue'
import AppTable from '@pc/components/base/table/index.vue'
import AppPagination from '@pc/components/base/pagination/index.vue'

const { loading, dataList, columns, total, pageIndex, pageSize, getWarehouseList } = useWarehouse()

getWarehouseList().catch((err) => ElMessage.error(err))
</script>