PicForm.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <a-modal
  3. :title="title"
  4. :width="1600"
  5. :height="1600"
  6. :visible="visible"
  7. :confirmLoading="confirmLoading"
  8. @cancel="handleCancel"
  9. cancelText="关闭"
  10. :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  11. switchFullscreen
  12. >
  13. <a-spin :spinning="confirmLoading" style="text-align: center;">
  14. <img :src="imgsrc" max-width="1600" max-height="1600"/>
  15. </a-spin>
  16. </a-modal>
  17. </template>
  18. <script>
  19. import {httpAction, httpActionBlob, postAction} from '@/api/manage'
  20. export default {
  21. name: 'PicForm',
  22. components: { },
  23. data() {
  24. return {
  25. imgsrc:'',
  26. title: '新增',
  27. visible: false,
  28. dataForm: {},
  29. confirmLoading: false,
  30. disaform: false,
  31. disableSubmit: false,
  32. dataRule: {
  33. name: [{ required: true, message: '请输入模型名称!' }],
  34. key: [{ required: true, message: '请输入模型key!' }]
  35. },
  36. url:{
  37. getPic:"/service/act/showResource"
  38. }
  39. }
  40. },
  41. computed: {
  42. },
  43. created() {
  44. },
  45. mounted() {
  46. },
  47. methods: {
  48. add () {
  49. this.visible = true
  50. },
  51. edit (record) {
  52. var that = this;
  53. var pid = record.id;
  54. var httpurl = this.url.getPic;
  55. var method = "GET";
  56. var paramer11 = {};
  57. paramer11.pdid = pid;
  58. httpActionBlob(httpurl+"?pdid="+pid,null,method).then((res)=>{
  59. console.log(res)
  60. // // that.imgsrc = res;
  61. // // this.imgsrc = window.URL.createObjectURL(res);
  62. // that.imgsrc = "data:image/png;base64,"+res;
  63. // console.log(123)
  64. // console.log(that.imgsrc)
  65. let currentMimeType = "image/png";
  66. let blob = new Blob([res], {
  67. type: currentMimeType,
  68. });
  69. that.imgsrc = window.URL.createObjectURL(blob)
  70. }).finally(() => {
  71. })
  72. this.visible = true
  73. // this.dataForm = Object.assign({}, record)
  74. },
  75. close () {
  76. this.$emit('close')
  77. this.visible = false
  78. },
  79. // 确定
  80. handleOk() {
  81. console.log('确定', this.dataForm)
  82. this.$refs.dataForm.validate(valid => {
  83. if (valid) {
  84. let url = 'act/remodel/save'
  85. postAction(url, this.dataForm).then(res => {
  86. console.log('res', res)
  87. if (res.success) {
  88. this.$message.success(res.message)
  89. } else {
  90. this.$message.error(res.message)
  91. }
  92. this.visible = false
  93. this.$emit('getModels')
  94. })
  95. } else {
  96. return false
  97. }
  98. })
  99. },
  100. // 关闭
  101. handleCancel() {
  102. this.close()
  103. }
  104. }
  105. }
  106. </script>
  107. <style>
  108. </style>