Procházet zdrojové kódy

feat:事件-打开弹框

ananzhusen před 10 měsíci
rodič
revize
d5130518c9
1 změnil soubory, kde provedl 59 přidání a 0 odebrání
  1. 59 0
      src/views/components/Actions.vue

+ 59 - 0
src/views/components/Actions.vue

@@ -208,6 +208,46 @@
             <label>画面URL</label>
             <t-input v-model="a.params" placeholder="窗口画面URL" />
           </div>
+          <div class="form-item mt-8">
+            <label>弹框位置</label>
+            <t-input
+              class="ml-4"
+              label="X"
+              placeholder="X"
+              v-model.number="a.extend.x"
+              style="width: 80px"
+              :format="decimalPlaces"
+            />
+            <t-input
+              class="ml-4"
+              label="Y"
+              placeholder="Y"
+              v-model.number="a.extend.y"
+              style="width: 80px"
+              :format="decimalPlaces"
+            />
+          </div>
+          <div class="form-item mt-8">
+            <label>弹框大小</label>
+            <t-input
+              class="ml-4"
+              label="W"
+              v-model.number="a.extend.width"
+              placeholder="宽"
+              min="1"
+              style="width: 80px"
+              :format="decimalPlaces"
+            />
+            <t-input
+              class="ml-4"
+              label="H"
+              placeholder="高"
+              v-model.number="a.extend.height"
+              min="1"
+              style="width: 80px"
+              :format="decimalPlaces"
+            />
+          </div>
         </template>
         <template v-else-if="a.action == 7">
           <div class="form-item mt-8">
@@ -484,6 +524,13 @@ onBeforeMount(() => {
   if (!data.actions) {
     data.actions = [];
   }
+  data.actions.forEach((action: any) => {
+    if(action.action === 14){
+      if(!action.extend){
+        action.extend = {};
+      }
+    }
+  });
 
   penTree.value = getPenTree();
   iframeTree.value = getIframeTree();
@@ -520,6 +567,11 @@ const onChangeAction = (action: any) => {
       action.value = '';
       action.targetType = 'id';
       break;
+    case 14:
+      if(!action.extend){
+        action.extend = {};
+      }
+      break;
     case 15:
       action.network = {type: 'publish',protocol: 'mqtt', options: {}};
       action.params = '';
@@ -675,6 +727,13 @@ const codeChange = (e:any,a:any)=>{
   a.fn = null;
 }
 
+const decimalPlaces = (val: number) => {
+  if (!val) {
+    return undefined;
+  }
+  return Math.round(+val * 100) / 100;
+};
+
 </script>
 <style lang="postcss" scoped>
 .props {