|
|
@@ -25,27 +25,28 @@ const textQrcodeToBase64 = text => {
|
|
|
});
|
|
|
};
|
|
|
export default function CreateJPEG(dom) {
|
|
|
+ let graph = new Graph(
|
|
|
+ {
|
|
|
+ container: dom,
|
|
|
+ width: 1,
|
|
|
+ height: 1,
|
|
|
+ background: {
|
|
|
+ color: '#ddd',
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ size: 10,
|
|
|
+ visible: true,
|
|
|
+ },
|
|
|
+ history: true,
|
|
|
+ resizing: {
|
|
|
+ enabled: true,
|
|
|
+ restricted: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ );
|
|
|
return async function (json, tempStr) {
|
|
|
let tempObj = JSON.parse(tempStr);
|
|
|
- let graph = new Graph(
|
|
|
- {
|
|
|
- container: dom,
|
|
|
- width: 1,
|
|
|
- height: 1,
|
|
|
- background: {
|
|
|
- color: '#ddd',
|
|
|
- },
|
|
|
- grid: {
|
|
|
- size: 10,
|
|
|
- visible: true,
|
|
|
- },
|
|
|
- history: true,
|
|
|
- resizing: {
|
|
|
- enabled: true,
|
|
|
- restricted: true,
|
|
|
- },
|
|
|
- },
|
|
|
- );
|
|
|
+
|
|
|
for (const key in json) {
|
|
|
// console.log(json[key]);
|
|
|
for (let index = 0; index < tempObj.cells.length; index++) {
|
|
|
@@ -55,7 +56,6 @@ export default function CreateJPEG(dom) {
|
|
|
tempObj.cells[index].attrs.image['xlink:href'] = await textQrcodeToBase64(json[key]);
|
|
|
}
|
|
|
if (tempObj.cells[index].shape == 'rect') {
|
|
|
- console.log(111);
|
|
|
tempObj.cells[index].attrs.label.text = tempObj.cells[index].attrs.label.text + json[key];
|
|
|
}
|
|
|
}
|
|
|
@@ -74,7 +74,7 @@ export default function CreateJPEG(dom) {
|
|
|
serializeImages: true,
|
|
|
quality: 1,
|
|
|
});
|
|
|
- });
|
|
|
+ },500);
|
|
|
});
|
|
|
|
|
|
|