Commit a8061e0e by liuyong

修改bug

1 parent 22b58731
Showing with 29 additions and 22 deletions
......@@ -51,11 +51,13 @@
<el-table-column prop="archiBelongName" label="架构归属" align="center"></el-table-column>
<el-table-column prop="eaLevel" label="元素层级" align="center"></el-table-column>
<el-table-column prop="content" label="描述" align="center" width="200" :show-overflow-tooltip="true"></el-table-column>
<!-- <el-table-column label="图标" align="center">
<el-table-column label="图标" align="center">
<template slot-scope="scope">
<img :src="scope.row.icon" alt="" :style="{ 'width': scope.row.width, 'height': scope.row.height }">
<!-- <img :src="scope.row.icon" alt="" :style="{ 'width': scope.row.width, 'height': scope.row.height }"> -->
<img :src="scope.row.icon" alt="">
</template>
</el-table-column> -->
</el-table-column>
<el-table-column prop="version" label="版本" align="center"></el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
......@@ -979,36 +981,41 @@ export default {
this.pager.total = result.data.total;
this.pager.size = result.data.size;
if(result.data.records.length > 0) {
result.data.records.length = 1;
result.data.records.map(item => {
if(item.icon.includes("svg+xml")) {
const item_icon = item.icon.split("base64,")[1];
const decode_item_icon = window.atob(item_icon);//svg解码,为字符串
const svgDocument = new DOMParser().parseFromString(decode_item_icon, 'text/xml');//svg字符串转标签
const path = svgDocument.getElementsByTagName('path')[0];
const rect = svgDocument.getElementsByTagName('rect')[0];
const ellipse = svgDocument.getElementsByTagName('ellipse')[0];
const svgTag = svgDocument.getElementsByTagName('svg')[0];
const svgWidth = Number(svgTag.getAttribute('width').split('px')[0])/2;
const svgHeight = Number(svgTag.getAttribute('height').split('px')[0])/2;
item['width'] = svgWidth + 'px';
item['height'] = svgHeight + 'px';
// console.log(svgDocument)
// const path = svgDocument.getElementsByTagName('path')[0];
// const rect = svgDocument.getElementsByTagName('rect')[0];
// const ellipse = svgDocument.getElementsByTagName('ellipse')[0];
// const svgTag = svgDocument.getElementsByTagName('svg')[0];
// const svgWidth = Number(svgTag.getAttribute('width').split('px')[0])/2;
// const svgHeight = Number(svgTag.getAttribute('height').split('px')[0])/2;
// item['width'] = svgWidth + 'px';
// item['height'] = svgHeight + 'px';
if(path) {
path.setAttribute('fill', item.color);
}
if(rect) {
rect.setAttribute('fill', item.color);
}
if(ellipse) {
ellipse.setAttribute('fill', item.color);
}
// if(path) {
// path.setAttribute('fill', item.color);
// }
// if(rect) {
// rect.setAttribute('fill', item.color);
// }
// if(ellipse) {
// ellipse.setAttribute('fill', item.color);
// }
const svgToString = new XMLSerializer().serializeToString(svgDocument);//svg标签转化为字符串
const encode_item_icon = window.btoa(svgToString);//base64编码
item.icon = 'data:image/svg+xml;base64,'+ encode_item_icon;
}else {
item['width'] = 0;
item['height'] = 0;
const encode_item_icon = window.btoa(item.icon);//base64编码
item.icon = 'data:image/svg+xml;base64,'+ encode_item_icon;
console.log(item)
// item['width'] = 0;
// item['height'] = 0;
}
})
Promise.all([ this.get_dialog_select1(), this.get_dialog_select2() ]).then(res2 => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!