<template>
  <el-dialog v-model="dialogVisible" :title="title" width="580" align-center :before-close="handleClose"
    modal-class="modalstyle">
    <div class="mb-20 mt-10">
      <span v-if="modalType === '2'">确定要删除这个项目吗？</span>
      <el-input v-else v-model="inputValue" size="large" placeholder="请输入项目名称" />
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="info" dashed @click="dialogVisible = false" style="border: none;">取消</el-button>
        <el-button type="primary" @click="dialogVisible = false" style="background-color: #5252ff;border: none;">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

const dialogVisible = ref(false)
const inputValue = ref('')
const modalType = ref('1')
const title = ref('编辑项目名称')

const open = (item:any, type: string) => {
  modalType.value = type
  title.value = type === '1' ? '编辑项目名称' : '删除项目'
  dialogVisible.value = true
}

const handleClose = (done: () => void) => {
  done()
}

defineExpose({
  open
})
</script>
<style lang="scss">
.modalstyle {
  .el-dialog {
    border-radius: 20px;
  }
}
</style>
<style scoped>
:deep(.el-input__wrapper) {
  border-radius: 8px;
}
</style>