<!--
 * @Description : 产品目录清单 -- 语言提示
 * @Author      : jinxin
 * @Date        : 2022-11-03 16:36:14
-->

<template>
    <div>
        <el-dialog :model-value="isShowLanguageTipTool" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" :title="data.title" width="440px" center >
            <span>{{'当前修改的数据属于:' + data.name}}</span>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="editCommon('cancel')">取消</el-button>
                    <el-button type="primary" @click="editCommon('sure')">确定</el-button>
                </span>
            </template>
        </el-dialog>
    </div>
</template>
<script>
import { defineComponent,reactive,onMounted, getCurrentInstance, onUpdated } from 'vue'
import { useStore } from 'vuex'
export default defineComponent({
    name:'LanguageTiptool',
    props:{
        isShowLanguageTipTool:Boolean,
    },
    emits:['update:isShowLanguageTipTool','noticeShowBatch','closeCurrentPage'],
    setup(props,context){
        // 生命周期
        onMounted(()=>{
        })
        onUpdated(()=>{
            // 清空历史数据
            data.name = store.state.user.language.name
        })
        // 变量
        let data = reactive({
            title:'数据修改 - 提醒',
            name:''
        })
        // 获取实例
        const { proxy } = getCurrentInstance()
        let store = useStore()
        // 取消 确定
        const editCommon = (type) => {
            if(type == 'sure'){
                // console.log('click sure')
                context.emit('noticeShowBatch',true)
                context.emit('update:isShowLanguageTipTool',false)
            }else{
                // console.log('click cancel')
                context.emit('closeCurrentPage',true)
                context.emit('update:isShowLanguageTipTool',false)
            }
        }
        return {
            data,
            props,
            editCommon
        }       
    }
})
</script>
<style scoped>
::v-deep(.el-form-item__label){
    width: 120px!important;
}
</style>