|
|
@ -131,6 +131,7 @@ |
|
|
|
import { format } from '../uilts/String'; |
|
|
|
import * as Tiff from 'browser-tiff.js'; |
|
|
|
import { SynergyEvaluationConfig } from '../uilts/Config'; |
|
|
|
import { post } from '../uilts/axios'; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'SynergyEvaluation', |
|
|
@ -238,18 +239,15 @@ |
|
|
|
} |
|
|
|
|
|
|
|
const initImage = (tabName, elementName, type, index, values) => { |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
xhr.responseType = 'arraybuffer'; |
|
|
|
xhr.open('GET', SynergyEvaluationConfig.getUrl(tabName, elementName, type)); |
|
|
|
xhr.onload = function (e) { |
|
|
|
let tiff = new Tiff({buffer: xhr.response}); |
|
|
|
let canvas = tiff.toCanvas(); |
|
|
|
let image = new Image(); |
|
|
|
image.src = canvas.toDataURL("image/png"); |
|
|
|
values[index].imgUrl = image.src; |
|
|
|
values[index].preview = [image.src]; |
|
|
|
}; |
|
|
|
xhr.send(); |
|
|
|
post("/image/convert", {url: SynergyEvaluationConfig.getUrl(tabName, elementName, type)}).then((response: any) => { |
|
|
|
if (response.error != 0){ |
|
|
|
console.log("发生错误") |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
values[index].imgUrl = response.data; |
|
|
|
values[index].preview = [response.data]; |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const onTabClick = (name) => { |
|
|
|