<template>
    <div v-bind:class="{'ap-grid-column-cascader': true,
                        'ap-grid-column-change': isChange(rowData.changeArr),
                        'ap-grid-column-error': showRuleMsg,}">
        <el-cascader v-model="rowData[opts.prop]"
                     :options="opts.cascaderOptions"
                     :show-all-levels="opts['cascaderShowAllLevels']"
                     @change="changeEvent(rowData)"></el-cascader>

        <!-- rule校验 -->
        <div v-html="ruleMsg" v-show="showRuleMsg" class="ap-grid-column-error-msg"></div>
    </div>
</template>

<script>
    import {handleDefaultParams} from 'ap-util/util/ObjectUtil'
    import ApTableColBase from './ApTableColBase'

    // input组件
    export default {
        name: "ApTableCascader",
        extends: ApTableColBase,
        data() {
            return {
                opts: {},
            }
        },
        created() {
            // 初始化组件前修改默认参数
            this.opts = handleDefaultParams(this.colOptions, {
                "cascaderShowAllLevels": false
            });
        },
        methods: {}
    }
</script>

<style scoped>
    .ap-grid-column-cascader /deep/ .el-input__inner {
        padding: 0px 2px;
        border-radius: 4px
    }

    .ap-grid-column-error /deep/ .el-input__inner {
        border: 1px solid red;
    }
</style>
