<template>
    <fieldset>
        <legend>
            <el-tag type="info">按需操作</el-tag>
        </legend>
        <div class="op-header">
            <div class="left-panel">
                <el-button type="primary" icon="el-icon-plus" @click="table_add()">新建价格</el-button>
                <!-- <el-button type="primary" icon="el-icon-download" @click="table_export()">导出</el-button> -->
            </div>
        </div>
    </fieldset>
    <formMain ref="formMain" @success="handleSuccess"></formMain>
</template>

<script>
import formMain from './form';
export default {
    components: {
        formMain
    },
    props: {
        type: { type: String, default: "1" },
        dataSelect: { type: Array, default: () => [] },
        dataSelectFull: { type: Array, default: () => [] }
    },
    data(){
        return {

        }
    },
    methods: {
        handleSuccess(){
            this.$emit("success");
        },
        table_add(){
            this.$nextTick(() => {
                this.$refs.formMain.open("add",this.type)
            })
        },
        table_audit(){
            if (this.dataSelect.length == 0) {
                return this.$message.error("请选择修改数据")
            }
            this.$nextTick(() => {
                this.$refs.formMain.open("batch").setData(this.dataSelect)
            })
        },
    }
}
</script>