<template>
  <xc-dialog-v2 v-model="dialog" title="合理用药提示"
                :manual-shutdown="true">
    <div style="width: 100%;height: 500px">
      <iframe :src="rationalUse.ShowUrl"/>
    </div>
    <template #footer>
      <el-button type="primary" @click="continueToSubmit">继续提交</el-button>
    </template>
  </xc-dialog-v2>
</template>

<script setup name='RationalDrugUseWindow'>
import {rationalUseOfMedicine} from "@/api/heliyongyao/rational-use";
import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";


const emit = defineEmits(['submit'])

let dialog = $ref(false)
let rationalUse = $ref({})
const check = async (patNo, times) => {
  rationalUse = await rationalUseOfMedicine(patNo, times)
  console.log(rationalUse)
  if (rationalUse.result_lv > 0) {
    dialog = true
    return false
  }
  return true
}

const continueToSubmit = () => {
  emit('submit')
  dialog = false
}

defineExpose({
  check
})

</script>

<style scoped lang="scss">
iframe {
  width: 100%;
  height: 100%;
}
</style>
