chart-image.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div>
  3. <preview-visible-file :height="height" :width="width" :img-url="imageUrl"></preview-visible-file>
  4. </div>
  5. </template>
  6. <script lang="ts">
  7. import {defineComponent, ref} from 'vue';
  8. import PreviewVisibleFile from "@/components/file/previewVisibleFile.vue";
  9. import {get} from "@/api/common";
  10. export default defineComponent({
  11. components: {PreviewVisibleFile},
  12. props: {
  13. height: {
  14. type: Number,
  15. default: 295
  16. },
  17. width: {
  18. type: Number,
  19. default: 500
  20. },
  21. wellname: {
  22. type: String
  23. },
  24. },
  25. name: 'ChartImage',
  26. setup(props, context) {
  27. const imageUrl = ref("")
  28. console.log("ChartImage setup", props, context);
  29. function getImageUrl (name: any) {
  30. get('/wellInfo/downFileImage', {fileName: name}).then((data: any) => {
  31. imageUrl.value = `data:image/png;base64,${data}`;
  32. })
  33. }
  34. return{
  35. imageUrl,
  36. getImageUrl
  37. }
  38. },
  39. mounted() {
  40. // this.getImageUrl()
  41. }
  42. })
  43. </script>
  44. <style lang="less" scoped></style>