luochaofan 3 жил өмнө
parent
commit
b1bf6f6911

+ 14 - 3
src/customer/printTemp/step2.vue

@@ -13,6 +13,9 @@
         <a-form-item v-show="formState.text != null" label="内容">
           <a-input v-model:value="formState.text" @change="textChange" />
         </a-form-item>
+        <a-form-item v-show="formState.fontSize != null" label="字体大小">
+          <a-input v-model:value="formState.fontSize" @change="fontSizeChange" />
+        </a-form-item>
         <a-form-item v-show="formState.type != null" label="节点类型">
           <a-input v-model:value="formState.type" @change="typeChange" />
         </a-form-item>
@@ -80,6 +83,7 @@ const formState = ref({
   height: null,
   width: null,
   type: null,
+  fontSize:null,
 });
 const container = ref(null);
 const stencilContainer = ref(null);
@@ -150,7 +154,9 @@ const before = () =>{
 const textChange = () => {
   cellTem.attr('label/text', formState.value.text);
 };
-
+const fontSizeChange = () => {
+  cellTem.attr('label/fontSize', formState.value.fontSize);
+};
 const output = () => {
   visible.value = true;
   // console.log(graph.toJSON());
@@ -167,7 +173,7 @@ const getPng = () => {
     // DataUri.downloadDataUri(dataUri, 'temp.jpeg');
   }, {
     serializeImages: true,
-    quality: 1,
+    quality: 1,//图片质量
   });
 };
 
@@ -194,7 +200,7 @@ const heightChange = () => {
 const setGraph = () => {
   graph = new Graph({
     container: container.value,
-    width: 400,
+    width: 800,
     height: 400,
     background: {
       color: '#ddd',
@@ -253,8 +259,13 @@ const setGraph = () => {
     formState.value.border = null;
     formState.value.imgUrl = null;
     formState.value.type = null;
+    formState.value.fontSize = null;
     cellTem = null;
     cellTem = cell;
+    if (cell.attrs.label != undefined && cell.attrs.label.fontSize != null) {
+      console.log('fontSize','!!!!!!!!!!!!!!!');
+      formState.value.fontSize = cell.attrs.label.fontSize;
+    }
     if (cell.attrs.label != undefined && cell.attrs.label.text != null) {
       formState.value.text = cell.attrs.label.text;
     }