From 15a15ded10ce55b327d8930b5145df0f4cf2e4f8 Mon Sep 17 00:00:00 2001
From: sd <shidong@jhsoft.cc>
Date: 星期一, 11 八月 2025 17:25:23 +0800
Subject: [PATCH] 问搜万物-卡片布局优化;模型优化数据添加按钮调整触发方式;历史会话样式调整。

---
 src/pages/datapush/index/RightEvent.vue |   74 ++++++++++++++++++++++++++----------
 1 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/src/pages/datapush/index/RightEvent.vue b/src/pages/datapush/index/RightEvent.vue
index e07f0c5..062a47a 100644
--- a/src/pages/datapush/index/RightEvent.vue
+++ b/src/pages/datapush/index/RightEvent.vue
@@ -15,9 +15,9 @@
 
         <div>
           <span style="line-height: 38px;margin-right: 20px;">鎺ㄩ�佹柟寮�</span>
-          <el-radio :disabled="urls.length > 0" v-model="pushType" label="1">UDP</el-radio>
-          <el-radio :disabled="urls.length > 0" v-model="pushType" label="2">HTTP</el-radio>
-          <el-radio disabled v-model="pushType" label="3">MQTT</el-radio>
+          <el-radio :disabled="urls.length > 0" v-model="taskEditData.pushType" label="1">UDP</el-radio>
+          <el-radio :disabled="urls.length > 0" v-model="taskEditData.pushType" label="2">HTTP</el-radio>
+          <el-radio disabled v-model="taskEditData.pushType" label="3">MQTT</el-radio>
         </div>
         <span style="line-height: 38px">鎺ㄩ�佹湇鍔″櫒</span>
         <div class="icon-btn" v-if="urls.length < 1" @click="addUrl()">
@@ -28,13 +28,14 @@
           <div>
             <el-checkbox v-model="item.enable"></el-checkbox>
             <span class="ml20">{{ "URL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" }}</span>
-            <el-input v-if="pushType === '1'" v-model="item.ip" style="width: 180px; margin-left: 0px;margin-right: 30px" size="small"
+            <el-input v-if="taskEditData.pushType === '1'" v-model="item.server_ip"
+              style="width: 180px; margin-left: 0px;margin-right: 30px" size="small"
               placeholder="192.168.1.100"></el-input>
-              绔彛  <el-input v-if="pushType === '1'" v-model="item.sort" style="width: 70px; margin-left: 10px" size="small"
-              placeholder="8030"></el-input>
-              <el-input v-if="pushType === '2'" v-model="item.url" style="width: 360px; margin-left: 0px" size="small"
-              placeholder="http://10.10.10.10:8000/dataApi"></el-input>
-              <!-- <el-input v-if="pushType === '3'" v-model="item.url" style="width: 360px; margin-left: 0px" size="small"
+            绔彛 <el-input v-if="taskEditData.pushType === '1'" v-model="item.port" style="width: 70px; margin-left: 10px"
+              size="small" placeholder="8030"></el-input>
+            <el-input v-if="taskEditData.pushType === '2'" v-model="item.url" style="width: 360px; margin-left: 0px"
+              size="small" placeholder="http://10.10.10.10:8000/dataApi"></el-input>
+            <!-- <el-input v-if="taskEditData.pushType === '3'" v-model="item.url" style="width: 360px; margin-left: 0px" size="small"
               placeholder="MQTT"></el-input> -->
           </div>
           <div class="server-add">
@@ -110,10 +111,15 @@
               <el-input v-model="rule.rule_value" placeholder="璇疯緭鍏ュ唴瀹�" size="small"></el-input>
             </div>
             <div v-else>
-              <el-select v-model="rule.rule_values" multiple collapse-tags placeholder="璇烽�夋嫨" size="small"
-                @change="selectValue(rule, $event)">
+              <el-select v-if="!isWarningSelect" v-model="rule.rule_values" multiple collapse-tags placeholder="璇烽�夋嫨"
+                size="small" @change="selectValue(rule, $event)">
                 <el-option v-for="item in rule.ruleValueOptions" :key="item.id" :label="item.name"
                   :disabled="item.disabled" :value="item.value"></el-option>
+              </el-select>
+              <el-select v-else v-model="rule.rule_values" collapse-tags placeholder="璇烽�夋嫨" size="small"
+                @change="selectValue(rule, $event)">
+                <el-option v-for="item in rule.ruleValueOptions" :key="item.id" :label="item.name"
+                  :value="item.value"></el-option>
               </el-select>
             </div>
           </el-col>
@@ -135,7 +141,8 @@
       </div>
       <div class="config-item">
         <b>鎺ㄩ�佸瓧娈�</b>
-        <el-button v-if="pushType === '1'" type="primary" size="mini" @click="openPushImsDialog">鏌ョ湅</el-button>
+        <el-button v-if="taskEditData.pushType === '1'" type="primary" size="mini"
+          @click="openPushImsDialog">鏌ョ湅</el-button>
         <el-button v-else type="primary" size="mini" @click="openPushSetDialog">璁剧疆</el-button>
       </div>
       <div class="save-btn">
@@ -145,7 +152,8 @@
     </div>
     <el-dialog :visible="pushImageDialog" :append-to-body="false" :close-on-click-modal="false"
       class="dialog-push-field" @close="pushImageDialog = false">
-      <el-image fit="fill" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image>
+      <!-- <el-image fit="fill" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></el-image> -->
+      <img src="@/assets/img/UDP閰嶇疆.png" style="width: 100%;">
     </el-dialog>
     <el-dialog :visible="pushFieldDialog" :append-to-body="false" :close-on-click-modal="false"
       class="dialog-push-field" @close="pushFieldDialog = false">
@@ -203,7 +211,7 @@
   },
   data() {
     return {
-      pushType: '1',
+      isWarningSelect: true,
       taskEditData: {},
       dataList: [],
       dictionary: [],
@@ -226,7 +234,7 @@
         ruleValueOptions: [],
       },
       pushFieldDialog: false,
-      pushImageDialog:false,
+      pushImageDialog: false,
       tempPushSet: [],
       pushFields: [],
       allFieldChecked: false,
@@ -252,7 +260,7 @@
             this.taskEditData.lineWay = newVal.link_type;
             this.taskEditData.eventTxt = newVal.rule_text;
             this.taskEditData.radioValue = newVal.is_satisfy_all ? "1" : "2";
-            this.pushType = '2'
+            this.taskEditData.pushType = newVal.push_type + ""
 
             if (!this.taskEditData.urls) {
               this.$set(this.taskEditData, "urls", []);
@@ -426,6 +434,8 @@
         checked: true,
         hash: Math.random().toString(36).substr(2),
         url: "",
+        server_ip: "",
+        port: ""
       });
     },
     delUrl(index) {
@@ -434,6 +444,7 @@
     },
     // 淇濆瓨
     async eventPushsSave() {
+      console.log(this.taskEditData.urls)
       if (this.taskEditData.name.length < 1) {
         this.$notify({
           type: "warning",
@@ -450,7 +461,7 @@
         return;
       }
       for (let i = 0; i < this.taskEditData.urls.length; i++) {
-        if (this.taskEditData.urls[i].url.length < 1) {
+        if (this.taskEditData.urls[i].url.length < 1 && this.taskEditData.urls[i].server_ip.length < 1) {
           this.$notify({
             type: "warning",
             message: "鎺ュ彛URL鍦板潃涓嶅厑璁镐负绌�",
@@ -511,11 +522,16 @@
         rules: ruleList,
         time_start: this.taskEditData.time[0],
         time_end: this.taskEditData.time[1],
-        urls: this.taskEditData.urls,
+        urls: this.taskEditData.urls.map(item => {
+          return {
+            ...item,
+            port: item.port ? Number(item.port) : 0
+          }
+        }),
         is_satisfy_all: this.taskEditData.radioValue === "1",
         link_type: this.taskEditData.lineWay,
         push_set: this.taskEditData.push_set,
-        pushType:this.pushType
+        push_type: Number(this.taskEditData.pushType)
       };
 
       let res = await eventPushsSave(json);
@@ -536,6 +552,12 @@
         this.baseRule.topicTypeOptions = this.dictionary.EVENTRULETOPIC;
         this.baseRule.operatorTypeOpionts = this.dictionary.EVENTTYPECOMPUTE;
         this.dictionary["alarmLevel"] = this.dictionary.ALARMLEVEL.map((el) => {
+          return {
+            name: el.name,
+            value: el.name,
+          };
+        });
+        this.dictionary["warning"] = this.dictionary.WARNING.map((el) => {
           return {
             name: el.name,
             value: el.name,
@@ -578,6 +600,7 @@
     // 鏂板缓閰嶇疆
     createSet() {
       this.dataList.push(JSON.parse(JSON.stringify(this.baseRule)));
+      console.log(this.dataList, "dataList")
     },
     cleanSet() {
       this.dataList.splice(0, this.dataList.length);
@@ -602,6 +625,11 @@
           }
         }
       });
+      if (rule.topic_type && rule.topic_type === 'warning') {
+        this.isWarningSelect = true
+      } else {
+        this.isWarningSelect = false
+      }
     },
     selectArg(rule, resetNext = false) {
       let argInfo = rule.topicArgOptions.filter((arg) => {
@@ -668,8 +696,12 @@
           return;
         }
       }
+      if (this.isWarningSelect) {
+        rule.rule_value = val
+      } else {
+        rule.rule_value = val.join(",");
+      }
 
-      rule.rule_value = val.join(",");
     },
     setOptionsDisable(rule) {
       console.log(rule);
@@ -729,9 +761,9 @@
         radioValue: "1",
         eventTxt: "",
         push_set: this.pushFields,
+        pushType: '1'
       };
       this.dataList = [];
-      this.pushType ='1'
     },
     onCancle() {
       this.$emit("onCancle");

--
Gitblit v1.8.0