Commit 647356273f3ccf59f9c37163cc9de24afba7c02b

Authored by xp.Huang
2 parents f32bc2c4 583f7e8d

Merge branch 'ww' into 'main'

fix: configuration center init draw.io default xml

See merge request huang/yun-teng-iot-front!441
... ... @@ -22,5 +22,6 @@ export interface ConfigurationCenterParams {
22 22 createTime: string;
23 23 creator: string;
24 24 remark: string;
  25 + defaultContent?: string;
25 26 }
26 27 export type ConfigurationCenterInfo = ConfigurationCenterParams;
... ...
... ... @@ -13,7 +13,7 @@
13 13 <script lang="ts">
14 14 import { defineComponent, ref, computed, unref } from 'vue';
15 15 import { BasicForm, useForm } from '/@/components/Form';
16   - import { formSchema } from './center.data';
  16 + import { formSchema, PC_DEFAULT_CONTENT, PHONE_DEFAULT_CONTENT, Platform } from './center.data';
17 17 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
18 18 import { useMessage } from '/@/hooks/web/useMessage';
19 19 import { saveOrUpdateConfigurationCenter } from '/@/api/configuration/center/configurationCenter';
... ... @@ -54,6 +54,13 @@
54 54
55 55 const getTitle = computed(() => (!unref(isUpdate) ? '新增组态中心' : '编辑组态中心'));
56 56
  57 + const getDefaultContent = (platform: Platform) => {
  58 + if (platform === Platform.PC) {
  59 + return PC_DEFAULT_CONTENT;
  60 + }
  61 + return PHONE_DEFAULT_CONTENT;
  62 + };
  63 +
57 64 async function handleSubmit() {
58 65 try {
59 66 const { createMessage } = useMessage();
... ... @@ -65,6 +72,7 @@
65 72 setDrawerProps({ confirmLoading: true });
66 73 let saveMessage = '添加成功';
67 74 let updateMessage = '修改成功';
  75 + values.defaultContent = getDefaultContent(values.platform);
68 76 await saveOrUpdateConfigurationCenter(values, unref(isUpdate));
69 77 closeDrawer();
70 78 emit('success');
... ...
... ... @@ -9,6 +9,11 @@ export enum Platform {
9 9 PC = 'pc',
10 10 }
11 11
  12 +export const PC_DEFAULT_CONTENT =
  13 + '<mxfile><diagram>dZHBDsIgDIafhvuEzOh5Tr142sEzGXWQsHVhmKFP7xbAidMT5fv/UtoSVrTuZHgvLyhAE5oJR9iBUMrybT4dM3l4stnTzJPGKBHYAir1hACj7a4EDInRImqr+hTW2HVQ24RxY3BMbTfUadWeN7ACVc31ml6VsPK7jVk4g2pkLJ3tgtLy6A5gkFzg+IFYSVhhEK2PWleAnscXB+Pzjn/U988MdPZHwhQsb0+XZEesfAE=</diagram></mxfile>';
  14 +
  15 +export const PHONE_DEFAULT_CONTENT =
  16 + '<mxfile><diagram>dZHBEoIgEEC/hru6lXU2q0snD50Z2YQZdB2k0fr6dMCMsU4sb9+ysDDI6uFseCuvJFCzJBIDgyNLkjjdw7hM5OnIYRc5UBklvLSAQr3Qw1l7KIFdIFoibVUbwpKaBksbMG4M9aF2Jx12bXmFK1CUXK/pTQkrHd3E24VfUFXSd04hdYmaz65/SCe5oP4LQc4gM0TWRfWQoZ5mN4/F1Z3+ZD/3MtjYHwVjsJw9boIPgvwN</diagram></mxfile>';
12 17 // 表格列数据
13 18 export const columns: BasicColumn[] = [
14 19 {
... ...
... ... @@ -153,7 +153,7 @@
153 153 enableBasicAutocompletion: true,
154 154 enableLiveAutocompletion: true,
155 155 });
156   - // aceEditor.value.setValue();
  156 + aceEditor.value.setValue('');
157 157 beautify(aceEditor.value.session);
158 158 // scriptForm.convertJs = aceEditor.value.getValue();
159 159 };
... ...