<template>
    <el-container style="height: 100%;width: 100%">
        <el-form :model="tableViewSet" label-width="100px" style="width: 100%">
            <el-form-item label="选择列表资源">
                <el-select v-model="tableViewSet.listViewId" style="width: 100%" filterable>
                    <el-option v-for="item in listViewArr" :label="item.label" :value="item.value" :key="item.value">

                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </el-container>
</template>

<script>
    import ColumnEventParentConfig from './columnEventParentConfig';
    export default {
        name: "list-view-config",
        extends: ColumnEventParentConfig,
        data(){
            return {
                tableViewSet:{},
                listViewArr:[],
                transToFormId:{},
            }
        },
        created() {
            this.initData();
        },
        methods:{
            /**
             * 初始化数据
             */
            initData(){
                let arr = [];
                this.axios.post(this.api.resources.find,{rSource:"form"}).then(res => {
                    (res.data||[]).forEach(item => {
                        if(arr.indexOf(item.rkey) == -1){
                            this.listViewArr.push({
                                label:item.rname,
                                value:item.rkey,
                            });
                            arr.push(item.rkey);
                            this.transToFormId[item.rkey] = item.rclassId;
                        }
                    })
                })
                this.tableViewSet = JSON.parse(JSON.stringify(this.eventSetData || {}));
            },
            /**
             * 返回事件配置数据
             * @returns {{}}
             */
            getEventDatas(){
                this.tableViewSet["formId"] = this.transToFormId[this.tableViewSet.listViewId];
                return this.tableViewSet;
            }
        }
    }
</script>

<style scoped>

</style>