<template>
    <BaseModal title="选择内置数据源">
        <Form :label-width="80"
            :model="data"
            :rules="rules">
            <FormItem label="数据源"
                prop="name">
                <Select v-model="data.name"
                    :disabled="disabled">
                    <Option v-for="name in datasources"
                        :value="name"
                        :key="name">{{name}}</Option>
                </Select>
            </FormItem>
            <FormItem label="过滤器使用">
                <i-Switch v-model="data.forfilter"></i-Switch>
            </FormItem>
        </Form>
    </BaseModal>
</template>
<script>
import DesignApi from '@/api/designer';

export default {
    name: 'BuildInDatasourceDialog',
    data() {
        return {
            datasources: undefined,
            disabled: false,
            rules: {
                name: [
                    { required: true, message: "数据源必须选择" }
                ]
            }
        }
    },
    components: {

    },
    mounted() {
        data.getBuildInDatasources().then((ds) => {
            this.datasources = ds;
        });
    }
};

</script>
