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

const emit = defineEmits<{
  (e: "reject", params: any);
  (e: "viewrepeat");
}>();

const cardStyle = {
  width: "450px",
  "--n-padding-bottom": "10px",
  "--n-padding-left": "0px",
};

const show = ref(false);

function showModal() {
  show.value = true;
}

function closeModal() {
  show.value = false;
}

async function reject() {
  emit("reject", { a: "todo" });
  closeModal();
}

async function viewRepeat(e: MouseEvent) {
  emit("viewrepeat");
  e.preventDefault();
  closeModal();
}

defineExpose({
  showModal,
});
</script>

<template>
  <n-modal v-model:show="show" transform-origin="center" class="modal_wrap">
    <div class="wrapper">
      <div class="closed">
        <SvgIcon style="cursor: pointer" name="cut-down" width="32" @click="closeModal"/>
      </div>
      <div class="wrapper-hearder">
        <div class="wrapper-title">智能AI审批工具</div>
        <div class="wrapper-mark">某某有限公司-某某事业部-张小凡</div>
      </div>
      <div class="wrapper-content">
        <n-scrollbar style="height: 200px">
          <div v-for="i in 1" :key="i" class="item">
            <div class="imgwrapper" />
            <div class="content">
              <div class="task_id">任务ID：YPW34567890-2995</div>
              <div class="tag_box">
                <div class="tag_item">基线任务</div>
                <div class="tag_item">中日友好医院</div>
              </div>
              <div class="time_box">2023-09-17 13:09:10</div>
            </div>
          </div>
        </n-scrollbar>
        <div class="mark_text">
          智能识别：图片与拜访终端名称不相符，建议审批不通过，或
          移至可疑收藏夹！
        </div>
        <div class="footer">
          <SvgIcon
            style="cursor: pointer"
            name="r1"
            width="162"
            height="54"
            @click="reject"
          />
          <SvgIcon
            style="cursor: pointer"
            name="r5"
            width="162"
            height="54"
            @click="viewRepeat"
          />
        </div>
      </div>
    </div>
  </n-modal>
</template>

<style lang="less" scoped>
.modal_wrap {
  background-image: url(../../../assets/images/approval_modal_bg.png);
  background-repeat: no-repeat;
  background-size: 100%;
  width: 700px;
  height: 500px;
  box-shadow: none !important;
}
.wrapper {
  position: absolute;
  left: calc(50% - 350px);
  .closed{
    position: relative;
    top: 0px;
    left: 90%;
  }
  .wrapper-hearder {
    margin-top: 40px;
    .wrapper-title {
      text-align: center;
      font-size: 16px;
      font-family: PingFang SC, PingFang SC-Semibold;
      font-weight: Semibold;
      text-align: center;
      color: #333333;
      line-height: 32px;
    }
    .wrapper-mark {
      text-align: center;
      font-size: 13px;
      font-family: HarmonyOS Sans SC, HarmonyOS Sans SC-Regular;
      font-weight: Regular;
      text-align: center;
      color: #666666;
      line-height: 18px;
    }
  }
  .wrapper-content {
    flex: 1;
    border-radius: 8px;
    margin: 35px 60px 35px 120px;
    .item{
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      margin: 20px 0;
    }

    .imgwrapper {
      width: 200px;
      height: 120px;
      margin-right: 20px;
      border-radius: 8px;
      background-image: url("../../../assets/images/test.png");
      background-repeat: no-repeat;
      background-size: cover;
    }
    .content {
      .task_id {
        font-size: 14px;
        font-family: PingFang SC, PingFang SC-Regular;
        font-weight: Regular;
        text-align: left;
        color: #333333;
        line-height: 20px;
      }
      .tag_box {
        display: flex;
        flex-flow: row nowrap;
        margin: 8px 0;
        .tag_item {
          background: rgba(80, 122, 253, 0.1);
          border-radius: 2px;
          font-size: 12px;
          font-family: PingFang SC, PingFang SC-Regular;
          font-weight: Regular;
          text-align: left;
          color: #507afd;
          line-height: 16px;
          margin-right: 10px;
        }
      }
      .time_box {
        font-size: 14px;
        font-family: PingFang SC, PingFang SC-Regular;
        font-weight: Regular;
        text-align: left;
        color: #333333;
        line-height: 20px;
      }
    }
    .mark_text {
      font-size: 13px;
      font-family: PingFang SC, PingFang SC-Regular;
      font-weight: Regular;
      text-align: left;
      color: #666666;
      line-height: 16px;
    }
    .footer{
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: center;
      margin: 20px 30px 0 0;
    }
  }
}
</style>
