<template>
    <el-dialog title="优先级调整" append-to-body :modelValue="openShow" width="30%" @close="closeDialog">
        <el-form ref="form" :model="form" label-width="120px">
                <el-form-item label="当前优先级:">{{ priorityName }}</el-form-item>
                    <el-form-item label="设置优先级:" prop="priority" required>
                        <el-select v-model="form.priority" placeholder="请选择" >
                            <el-option
                            label="一级"
                            :value="1">
                            </el-option>
                            <el-option
                            label="二级"
                            :value="2">
                            </el-option>
                            <el-option
                            label="三级"
                            :value="3">
                            </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
        
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="closeDialog">取 消</el-button>
                <el-button type="primary" @click="submit">确 定</el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script>
 
export default {
    props: {
        showDialog: {
            type: Boolean,
            default: false
        },
        priorityName:{
            type:String,
            default:""
        }
    },
    data() {
        return {
            openShow:false,
            form:{
                priority:''
            }
        }
    },
    mounted(){
        this.openShow = this.showDialog
    },
    methods:{
        closeDialog(){
            this.openShow = false
            this.$emit('closeDialog');
        },
        submit() {
            if (!this.form.priority) {
                this.$message.warning('请选择优先级');
                return;
            }
            this.$emit('submitPriority', {
                priority: this.form.priority
            });
            this.closeDialog();
        }
    },
    
    watch:{
        showDialog(val){
            this.openShow = val
        }    }
}
</script>
<style lang="scss" scoped></style>