ananzhusen 1 年之前
父節點
當前提交
be68232607
共有 2 個文件被更改,包括 32 次插入10 次删除
  1. 10 10
      src/services/common.ts
  2. 22 0
      src/views/components/PenDatas.vue

+ 10 - 10
src/services/common.ts

@@ -372,18 +372,18 @@ const tree = reactive({
 });
 
 export const getPenTree = () => {
-  if (tree.patch) {
-    tree.patch = false;
-    const list = [];
-    for (const item of meta2d.store.data.pens) {
-      if (item.parentId) {
-        continue;
-      }
-      const elem = calcElem(item);
-      elem && list.push(elem);
+  // if (tree.patch) {
+  tree.patch = false;
+  const list = [];
+  for (const item of meta2d.store.data.pens) {
+    if (item.parentId) {
+      continue;
     }
-    tree.list = list;
+    const elem = calcElem(item);
+    elem && list.push(elem);
   }
+  tree.list = list;
+  // }
 
   return tree.list;
 };

+ 22 - 0
src/views/components/PenDatas.vue

@@ -428,6 +428,7 @@ import axios from 'axios';
 import { debounce } from '@/services/debouce';
 import { getPenTree, typeOptions } from '@/services/common';
 import { updatePen } from './pen';
+import { getter, setter } from '@meta2d/core/src/utils/object';
 
 import CodeEditor from '@/views/components/common/CodeEditor.vue';
 import Actions from './Actions.vue';
@@ -735,6 +736,8 @@ const onSelectBindsChange = (value: string[], options: any) => {
 
     dataBindDialog.selectedIds = value;
     dataBindDialog.data.binds = toRaw(options.selectedRowData[0]);
+    doBindInit();
+    //
   } else if (options.type === 'uncheck') {
     // if (options.currentRowKey === 'CHECK_ALL_BOX') {
     //   for (const data of dataBindDialog.dataSet) {
@@ -758,6 +761,25 @@ const onSelectBindsChange = (value: string[], options: any) => {
   }
 };
 
+const doBindInit = () => {
+  let { key } = dataBindDialog.data;
+  if (props.pen.name === 'echarts' && key.includes('echarts.option.series')) {
+    const { replaceMode } = props.pen.echarts;
+    const { xAxis } = props.pen.echarts.option;
+
+    let beforeV = getter(props.pen, key);
+    if (Array.isArray(beforeV) && replaceMode === 0) {
+      //追加
+      setter(props.pen, key, []);
+      let _key = 'echarts.option.xAxis.data';
+      if (Array.isArray(xAxis) && xAxis.length) {
+        _key = 'echarts.option.xAxis.0.data';
+      }
+      setter(props.pen, _key, []);
+    }
+  }
+};
+
 const dataBindonConfirm = () => {
   dataBindDialog.show = false;
   meta2d.initBinds();