<script lang="ts" setup>
import { defineOptions, ref } from 'vue';
import { useRouter } from 'vue-router';

defineOptions({ name: 'ShortcutModal' })

const props = defineProps({
  id: {
    type: String,
    default: '',
  },
});

const show = ref(false)
const router = useRouter()

const cardStyle = {
  'width': '29vw',
  '--n-padding-bottom': '10px',
  '--n-padding-left': '10px',
}

function showModal() {
  show.value = true
}

function closeModal(path) {
  show.value = false
  if(props.id) {
    router.push(path + '?id=' + props.id)
  }else {
    router.push(path)
  }
}

function closeIconModal() {
  show.value = false
}

defineExpose({
  showModal,
})
</script>

<template>
  <div class="finish-package-modal" v-if="show">
    <!-- <n-modal v-model:show="show" :mask-closable="false" transform-origin="center" style="padding: 8px;">
      <n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
        <div style="display: flex;">
          <div><svg-icon size="80" name="robot2" /></div>
          <div style="height: 130px;text-align: center;margin-left: 20px;">
            <div class="msg-title">生成任务提示</div>
            <div class="msg-text">AI已根据您的配置要求生成任务包。</div>
          </div>
        </div>

        <template #footer>
          <div class="wrapper-footer">
            <n-button type="info" @click="closeModal('/worksheet')">
              进入AI工单
            </n-button>
            <n-button style="margin-left:10px;color: #666666;" @click="closeModal('/task')">
              进入任务审批
            </n-button>
          </div>
        </template>
      </n-card>
    </n-modal> -->
    <div class="header-box">
      <div class="robot-box"><svg-icon size="80" name="robot2" /></div>
      <div class="text-box">
        <div class="msg-title">生成成功提示</div>
        <div class="msg-text">AI已根据您的配置要求生成任务包。</div>
      </div>
      <div class="close-box" @click="closeIconModal">
        <svg-icon size="30" name="close-none-border" />
      </div>
    </div>
    <div class="wrapper-footer">
      <div @click="closeModal('/worksheet')">
        <svg-icon size="80" name="copy-select" />
        <div class="footer-text">
          进入AI工单
        </div>
      </div>
      <div @click="closeModal('/task')">
        <svg-icon size="80" name="task-approval-select" />
        <div class="footer-text">
          进入任务审批
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="less" scoped>
.finish-package-modal {
  position: fixed;
  width: 400px;
  height: 250px;
  top: 50%;
  left: 50%;
  margin-left: -200px;
  margin-top: -150px;
  background: linear-gradient(to right, #fff, #f0f3ff, #e4e9ff);
  opacity: 0.95;
  border-radius: 5px;
  z-index: 99999;
}

.wrapper-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-around;
  >div {
    cursor: pointer;
  }
}

.msg-title {
  font-size: 16px;
  font-family: PingFang SC, PingFang SC-Medium;
  font-weight: Medium;
  text-align: left;
  color: #333333;
  line-height: 24px;
  margin: 12px 0;
}

.msg-text {
  font-size: 14px;
  font-family: PingFang SC, PingFang SC-Regular;
  font-weight: Regular;
  text-align: left;
  color: #666666;
  line-height: 22px;
}

.header-box {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}

.robot-box {
  margin-left: 10px;
  margin-right: 20px;
}

.msg-title {
  color: #333333;
  font-weight: bold;
}

.msg-text {
  color: #666666;
}

.close-box {
  margin-right: 20px;
  cursor: pointer;
}

.text-box {
  margin-right: auto;
}

.footer-text {
  font-size: 18px;
  color: #507AFD;
}
</style>
