PassCalculate.vue 1.12 KB
<template>
  <BasicModal
    v-bind="$attrs"
    :title="title"
    @register="register"
    width="500px"
    :bodyStyle="{ height: '100px' }"
    @ok="handleOk"
  >
    <div style="margin-left: 10px; font-size: 16px">一次通过率:{{ num }}</div>
  </BasicModal>
</template>
<script lang="ts" setup>
  import { BasicModal, useModalInner } from '@/components/Modal';
  import { computed, ref } from 'vue';
  import { passCalculate } from '@/api/project/order';

  const [register, { closeModal }] = useModalInner(async (data) => {
    title.value = data.title;
    const id = data.check[0];
    const opinionType = ref();
    if (data.title == '确认意见') {
      opinionType.value = 'pp样品确认意见';
    } else if (data.title == '生产样品') {
      opinionType.value = 'shipment sample确认意见';
    } else if (data.title == '测试样品') {
      opinionType.value = 'Altex测试结果';
    }
    num.value = await passCalculate({ orderId: id, opinionType: opinionType.value });
  });
  const title = ref('');
  const num = ref();

  async function handleOk() {
    closeModal();
    num.value = '';
  }
</script>