<template>
    <q-dialog
        v-model="persistent"
        full-height
        maximized
        position="right"
        persistent
        @hide="closeCutomer"
        transition-show="slide-left"
    >
        <div class="customMain">
            <div class="cycle_Title">市场顾问教师提成规则</div>
            <div style="margin-top: 10px;">
                <q-input
                    filled
                    stack-label
                    :dense="false"
                    v-model="addMsg.Name"
                    ref="Name"
                    class="col-12 q-pb-lg"
                    label="方案名称"
                    :rules="[val => !!val || '请填写平台名称']"
                />
            </div>
            <div style="display: flex;align-items: center;">
                类型：
                <q-radio v-model="addMsg.Type" val="1" label="市场" />
                <q-radio v-model="addMsg.Type" val="2" label="顾问" />
                <q-radio v-model="addMsg.Type" val="3" label="教师" />
            </div>
            <div style="display: flex;align-items: center;">
                课程类型：
                <q-radio v-model="addMsg.CourseType" val="1" label="包含" />
                <q-radio v-model="addMsg.CourseType" val="2" label="不包含" />
            </div>
            <q-select filled stack-label option-value="CourseId" option-label="CourseName" v-model="addMsg.CourseList"
              ref="CouseId" :options="CourseList" label="课程" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value multiple  use-input
              map-options  />

            <q-btn
                label="确认"
                color="accent q-px-md"
                size="sm"
                style="font-weight:400 !important"
                @click="setCheckStatus()"
            />

            <div class="dialog-out-close" @click="closeCutomer">
                <i class="iconfont icon-close" style="font-size:26px;" />
            </div>
        </div>
    </q-dialog>
</template>
<script>
import {
    queryEmployee
} from '../../api/users/user'


export default {
    components: {

    },
    props: {
        saveObj: {
            type: Object,
            default: null
        },
        isAdd: {// true新增 false修改
            type: Boolean,
            default: true
        },
        loyeeList: {//人员列表
            type: Array,
            default: []
        },
        CourseList: {//课程下拉列表
            type: Array,
            default: []
        }
    },
    data() {
        return {
            persistent: true,
            addMsg: null,
            //员工列表
            employeeList: [],
            myEmployeeList: [],

        }
    },
    created() {
        this.employeeList = JSON.parse(JSON.stringify(this.loyeeList))
        this.myEmployeeList = JSON.parse(JSON.stringify(this.loyeeList))
        if (this.isAdd == true) {//新增
            this.addMsg = {
                Id: 0,
                Name: '',
                Type: '1',
                SchoolIds: '',
                CourseType: 1,
                CourseIds: '',
                SchoolIds: '',
                CourseList: [],//课程列表
                CommissionType: 1,
                EmpIds: '',
                EmpList: [],
                ChildEmpIds: '',
                ChildEmpList: [],
                CourseRate: '',
                RateList: [
                    { StartValue: '', EndValue: '', Rate: '' }
                ]
            }
        } else {//修改

        }
    },
    mounted() {

    },
    methods: {

        closeCutomer() {
            this.$emit('close')
        },


        //筛选员工
        filterEmployee(val, update, abort) {
            update(() => {
                this.myEmployeeList = this.employeeList.filter(
                    v => v.EmployeeName.indexOf(val) > -1
                );
            });
        },
        changeCourse(){

        },

    },
}
</script>
<style scoped>
.cycle_Title {
    font-size: 20px;
    font-weight: 500;
    color: #1f2329;
}
.customMain {
    width: 700px !important;
    display: flex;
    flex-direction: column;
    height: 100 vh;
    padding: 15px 17px 0 17px;
    background-color: #fff;
}
</style>