Jelajahi Sumber

feat:conflict

ananzhusen 10 bulan lalu
induk
melakukan
06ef9b89a3

+ 1 - 1
src/views/components/Header.vue

@@ -924,7 +924,7 @@ const openZip = async (file: File) => {
           const ret:any = await addCollection('v',{
             data:idata,
             image:idata.image||'xxx',
-            name:idata.name,
+            name:idata.name||'新建项目',
             folder:idata.folder,
             // userFlag:2,
             system:false,

+ 139 - 47
src/views/components/PenEvents.vue

@@ -73,7 +73,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onBeforeMount, onUnmounted, ref } from 'vue';
+import { onBeforeMount, onUnmounted, ref, computed } from 'vue';
 
 import Actions from './Actions.vue';
 import Conditions from './Conditions.vue';
@@ -83,52 +83,144 @@ const props = defineProps<{
   pen: any;
 }>();
 
-const options = ref<any>([
-  {
-    value: 'click',
-    content: '单击',
-  },
-  {
-    value: 'dblclick',
-    content: '双击',
-    divider: true,
-  },
-  {
-    value: 'contextmenu',
-    content: '鼠标右键',
-  },
-  {
-    value: 'enter',
-    content: '鼠标移入',
-  },
-  {
-    value: 'leave',
-    content: '鼠标移出',
-    divider: true,
-  },
-  {
-    value: 'active',
-    content: '获得焦点',
-  },
-  {
-    value: 'inactive',
-    content: '失去焦点',
-    divider: true,
-  },
-  {
-    value: 'mousedown',
-    content: '鼠标按下',
-  },
-  {
-    value: 'mouseup',
-    content: '鼠标抬起',
-    divider: true,
-  },
-  {
-    value: 'message',
-    content: '监听全局消息',
-  },
-]);
+// const options = ref<any>([
+//   {
+//     value: 'click',
+//     content: '单击',
+//   },
+//   {
+//     value: 'dblclick',
+//     content: '双击',
+//     divider: true,
+//   },
+//   {
+//     value: 'change',
+//     content: '输入完成',
+//   },
+//   {
+//     value: 'input',
+//     content: '输入',
+//     divider: true,
+//   },
+//   {
+//     value: 'contextmenu',
+//     content: '鼠标右键',
+//   },
+//   {
+//     value: 'enter',
+//     content: '鼠标移入',
+//   },
+//   {
+//     value: 'leave',
+//     content: '鼠标移出',
+//     divider: true,
+//   },
+//   {
+//     value: 'active',
+//     content: '获得焦点',
+//   },
+//   {
+//     value: 'inactive',
+//     content: '失去焦点',
+//     divider: true,
+//   },
+//   {
+//     value: 'mousedown',
+//     content: '鼠标按下',
+//   },
+//   {
+//     value: 'mouseup',
+//     content: '鼠标抬起',
+//     divider: true,
+//   },
+//   {
+//     value: 'message',
+//     content: '监听全局消息',
+//   },
+// ]);
+
+const options: any = computed(() => {
+  const options = [
+    {
+      value: 'click',
+      content: '单击',
+    },
+    {
+      value: 'dblclick',
+      content: '双击',
+      divider: true,
+    },
+  ];
+  if (props.pen.dropdownList) {
+    options.push({
+      value: 'change',
+      content: '选择完成',
+      divider: true,
+    });
+  } else if (props.pen.name === 'inputDom') {
+    options.push({
+      value: 'input',
+      content: '输入',
+      divider: true,
+    });
+  } else if (props.pen.input) {
+    options.push(
+      ...[
+        {
+          value: 'change',
+          content: '输入完成',
+        },
+        {
+          value: 'input',
+          content: '输入',
+          divider: true,
+        },
+      ]
+    );
+  }
+
+  options.push(
+    ...[
+      {
+        value: 'contextmenu',
+        content: '鼠标右键',
+      },
+      {
+        value: 'enter',
+        content: '鼠标移入',
+      },
+      {
+        value: 'leave',
+        content: '鼠标移出',
+        divider: true,
+      },
+      {
+        value: 'active',
+        content: '获得焦点',
+      },
+      {
+        value: 'inactive',
+        content: '失去焦点',
+        divider: true,
+      },
+      {
+        value: 'mousedown',
+        content: '鼠标按下',
+      },
+      {
+        value: 'mouseup',
+        content: '鼠标抬起',
+        divider: true,
+      },
+      {
+        value: 'message',
+        content: '监听全局消息',
+      },
+    ]
+  );
+
+  return options;
+});
 
 const openedCollapses = ref([0]);
 

+ 18 - 1
src/views/components/PensProps.vue

@@ -1031,6 +1031,17 @@ onBeforeMount(() => {
   if (!data.tags) {
     data.tags = [];
   }
+  let tags = selections.pens[0].tags;
+  if(tags.length){
+    tags.forEach((tag: string) => {
+      let common = selections.pens.every((item: Pen) => {
+        return item.tags.includes(tag);
+      });
+      if (common) {
+        data.tags.push(tag);
+      }
+    });
+  }
 });
 
 const lock = (v: LockState) => {
@@ -1102,13 +1113,19 @@ const onSelectTag = (tag: string) => {
     return;
   }
   data.tags.push(tag);
-  changeValue('tags');
+  // changeValue('tags');
+  selections.pens.forEach((pen: Pen) => {
+    pen.tags.push(tag);
+  });
 };
 
 const onChangeInputTag = (currentTags: any, context: any) => {
   const { trigger, index, item } = context;
   if (['tag-remove', 'backspace'].includes(trigger)) {
     data.tags.splice(index, 1);
+    selections.pens.forEach((pen: Pen) => {
+      pen.tags.splice(pen.tags.indexOf(item), 1);
+    });
   }
   if (trigger === 'enter') {
     onSelectTag(item);

+ 16 - 1
src/views/components/View.vue

@@ -968,7 +968,7 @@ import {
 } from '@/services/common';
 import { useSelection } from '@/services/selections';
 import { defaultFormat, fromArrows, toArrows, rootDomain } from '@/services/defaults';
-import { checkData, localStorageName, Meta2dBackData } from '@/services/utils';
+import { checkData, localStorageName, Meta2dBackData, noLoginTip } from '@/services/utils';
 import { debounce } from '@/services/debouce';
 import { s8 } from '@/services/random';
 import { setCookie, deleteCookie } from '@/services/cookie';
@@ -981,6 +981,7 @@ import { AddIcon, EditIcon, SaveIcon, RootListIcon,SlashIcon, RefreshIcon, Serve
 import {transformData} from '@/services/utils';
 import { importExcel, saveAsExcel } from '@/services/excel';
 import { typeOptions } from '@/services/common';
+import { upload } from '@/services/file';
 
 const router = useRouter();
 const route = useRoute();
@@ -1011,6 +1012,20 @@ const meta2dOptions: Options = {
   // color: '#bdc7db',
   disableAnchor: true,
   defaultFormat: { ...defaultFormat },
+  uploadFn: async (file: File) => {
+    if (!(user&&user.id)) {
+      MessagePlugin.warning(noLoginTip);
+      return;
+    }
+    const res:any = await upload(
+      file,
+      true,
+      file.name,
+      `/大屏/图片/默认`,
+      'new'
+    );
+    return res.url;
+  },
 };
 
 let timer: any = 0;