<template>
  <n-popconfirm @positive-click="handleDelete">
    <template #trigger>
      <n-icon size="20" style="cursor: pointer;">
        <Trash />
      </n-icon>
      <!-- <n-button type="error" size="small">删除</n-button> -->
    </template>
    删除操作，是否继续。
  </n-popconfirm>
</template>

<script setup>
import { deleteTaskDataClass } from "@/api";
import { Trash} from "@vicons/ionicons5";
const message = useMessage();

const props = defineProps({
  task: {
    type: Object,
    default: () => ({}),
  },
  taskClass: {
    type: Object,
    default: () => ({}),
  },
  getClassList: {
    type: Function,
    default: () => {},
  },
});

//
const handleDelete = async () => {
  try {
    const { data: res } = await deleteTaskDataClass({
      T_task_id: props.task.T_task_id,
      T_sn: props.taskClass.T_sn,
    });
    if (res.Code === 200) {
      message.success(res.Msg);
      props.getClassList();
    }
  } catch (e) {
    console.log(e);
  }
};
</script>

<style lang="scss" scoped></style>
