<template>
    <Table
        url="/ranger/inspection/api/v1/place/page"
        :rowKey="rowKey"
        :selected.sync="selected"
        addBtn
        ref="addTable"
        :otherQuery="otherQuery"
    >
        <template #search="{ query }">
            <MoreItem label="线路名称">
                <a-input v-model="query.inputValue" placeholder="请输入" />
            </MoreItem>
        </template>

        <a-table-column title="地点名称" data-index="placeName" />
        <a-table-column title="二维码" data-index="qrCode" />
        <a-table-column title="电子标签" data-index="electronicTag" />
    </Table>
</template>

<script>
import Table from '@/components/table/table.vue';
import MoreItem from '@/components/table/more_item.vue';
import { updateRouteStateApi } from '@/api';

export default {
    components: { Table, MoreItem },
    props: {
        data: Object,
        row: Object,
    },
    watch: {
        row: {
            handler(val) {
                if (val) {
                    console.log(val);
                } else {
                    const { regionId } = this.data;
                    this.otherQuery = { regionId };
                    this.rowKey = 'placeId';
                }
            },
            deep: true,
            immediate: true,
        },
    },
    data() {
        return {
            selected: {},
            otherQuery: {},
            rowKey: 'regionId',
        };
    },
    methods: {},
};
</script>
