DownLoadModal.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <BasicModal
  3. v-bind="$attrs"
  4. @register="register"
  5. title="系统正在为您打包数据"
  6. :minHeight="0"
  7. @visible-change="handleVisibleChange"
  8. @cancel="hundleCancel"
  9. @ok="handleSubmit"
  10. >
  11. <div class="pt-2px pr-3px">
  12. <div class="warp">
  13. <p>正在打包场景离线数据{{ downloadPercent }}</p>
  14. <span>{{ modelRef.sceneName }}.zip</span>
  15. <Progress :percent="downloadOption.percent" />
  16. <p>* 打包完成后将关闭弹窗自动下载。</p>
  17. </div>
  18. </div>
  19. </BasicModal>
  20. </template>
  21. <script lang="ts">
  22. import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
  23. import { BasicModal, useModalInner } from '/@/components/Modal';
  24. import { useMessage } from '/@/hooks/web/useMessage';
  25. import { useI18n } from '/@/hooks/web/useI18n';
  26. import { Progress } from 'ant-design-vue';
  27. const { t } = useI18n();
  28. export default defineComponent({
  29. components: { BasicModal, Progress },
  30. props: {
  31. userData: { type: Object },
  32. downloadOption: { type: Object },
  33. },
  34. emits: ['update', 'register', 'cancelDownload'],
  35. setup(props, { emit }) {
  36. const modelRef = ref({});
  37. const { createMessage } = useMessage();
  38. onMounted(() => {});
  39. let addListFunc = () => {};
  40. const [register, { closeModal }] = useModalInner((data) => {
  41. // data && onDataReceive(data);
  42. modelRef.value = data;
  43. });
  44. const handleSubmit = async () => {
  45. console.log(props.downloadOption);
  46. if (props.downloadOption.url) {
  47. window.open(props.downloadOption.url);
  48. }
  49. };
  50. const hundleCancel = async () => {
  51. emit('cancelDownload');
  52. };
  53. return {
  54. register,
  55. modelRef,
  56. handleSubmit,
  57. hundleCancel,
  58. addListFunc,
  59. t,
  60. };
  61. },
  62. });
  63. </script>
  64. <style lang="less" scoped>
  65. .pt-2px {
  66. }
  67. .warp {
  68. display: flex;
  69. align-items: flex-start;
  70. justify-content: flex-start;
  71. flex-flow: column;
  72. }
  73. </style>