From 33d6185c6c4e72f9aa4cae657baa6d27a89cb84b Mon Sep 17 00:00:00 2001 From: sd <shidong@jhsoft.cc> Date: 星期五, 29 八月 2025 09:25:40 +0800 Subject: [PATCH] 实时监控-没有触发预警的数据不再显示任务名称和等级(卡片和详情弹框) --- src/pages/datapush/index/RightEvent.vue | 316 ++++++++++++++++++++-------------------------------- 1 files changed, 123 insertions(+), 193 deletions(-) diff --git a/src/pages/datapush/index/RightEvent.vue b/src/pages/datapush/index/RightEvent.vue index baeaaf5..50849da 100644 --- a/src/pages/datapush/index/RightEvent.vue +++ b/src/pages/datapush/index/RightEvent.vue @@ -3,80 +3,60 @@ <div class="s-right-config"> <el-form> <el-form-item label="鍚嶇О"> - <el-input - v-model="taskEditData.name" - placeholder="璇疯緭鍏ュ悕绉�" - size="small" - style="width: 400px" - ></el-input> + <el-input v-model="taskEditData.name" placeholder="璇疯緭鍏ュ悕绉�" size="small" style="width: 400px"></el-input> </el-form-item> <el-form-item label="鏃堕棿"> - <el-date-picker - v-model="taskEditData.time" - format="yyyy-MM-dd HH:mm:ss" - value-format="yyyy-MM-dd HH:mm:ss" - type="datetimerange" - range-separator="鑷�" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - size="small" - ></el-date-picker> + <el-date-picker v-model="taskEditData.time" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" + type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" + size="small"></el-date-picker> </el-form-item> + + <div> + <span style="line-height: 38px;margin-right: 20px;">鎺ㄩ�佹柟寮�</span> + <el-radio v-model="taskEditData.pushType" label="1">UDP</el-radio> + <el-radio 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()"> <i class="el-icon-circle-plus-outline"></i> <span> 娣诲姞鎺ュ彛鍦板潃</span> </div> - <div - v-for="(item, index) in urls" - :key="item.hash" - class="flex-box server-url" - > + <div v-for="(item, index) in urls" :key="item.hash" class="flex-box server-url"> <div> <el-checkbox v-model="item.enable"></el-checkbox> - <span class="ml20">{{ "URL " }}</span> - <el-input - v-model="item.url" - style="width: 360px; margin-left: 0px" - size="small" - placeholder="http://10.10.10.10:8000/dataApi" - ></el-input> + <span v-if="taskEditData.pushType === '1'" class="ml20">{{ "鏈嶅姟鍣� " }}</span> + <span v-else class="ml20">{{ "URL " }}</span> + <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> + <span v-if="taskEditData.pushType === '1'">绔彛</span> + <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"> - <i - class="el-icon-remove-outline" - @click="delUrl(index)" - style="color: red; margin-right: 10px" - /> + <i class="el-icon-remove-outline" @click="delUrl(index)" style="color: red; margin-right: 10px" /> <i class="el-icon-circle-plus-outline" @click="addUrl()"></i> </div> </div> <el-form-item label="鑱斿姩鏂瑰紡" style="margin-top: 20px; width: 100"> - <el-select - v-model="taskEditData.lineWay" - placeholder="璇烽�夋嫨" - size="small" - > + <el-select v-model="taskEditData.lineWay" placeholder="璇烽�夋嫨" size="small"> <el-option label="璇烽�夋嫨" value=""></el-option> - <el-option - v-for="item in taskEditData.lineOptions" - :key="item.value" - :label="item.label" - :value="item.value" - ></el-option> + <el-option v-for="item in taskEditData.lineOptions" :key="item.value" :label="item.label" + :value="item.value"></el-option> </el-select> </el-form-item> <el-form-item label="鏍囩"> - <el-radio v-model="taskEditData.radioValue" label="1" - >婊¤冻鍏ㄩ儴</el-radio - > - <el-radio v-model="taskEditData.radioValue" label="2" - >婊¤冻浠绘剰涓�涓�</el-radio - > + <el-radio v-model="taskEditData.radioValue" label="1">婊¤冻鍏ㄩ儴</el-radio> + <el-radio v-model="taskEditData.radioValue" label="2">婊¤冻浠绘剰涓�涓�</el-radio> </el-form-item> </el-form> </div> @@ -94,116 +74,58 @@ </div> </div> - <div - v-for="(rule, index) in dataList" - :key="index" - style="margin-top: 10px" - > + <div v-for="(rule, index) in dataList" :key="index" style="margin-top: 10px"> <el-row :gutter="20"> <!-- 涓婚 --> <el-col :span="4"> - <el-select - v-model="rule.topic_type" - placeholder="璇烽�夋嫨" - @change="selectTopic(rule, true)" - size="small" - > - <el-option - v-for="item in rule.topicTypeOptions" - :key="item.id" - :label="item.name" - :value="item.value" - ></el-option> + <el-select v-model="rule.topic_type" placeholder="璇烽�夋嫨" @change="selectTopic(rule, true)" size="small"> + <el-option v-for="item in rule.topicTypeOptions" :key="item.id" :label="item.name" + :value="item.value"></el-option> </el-select> </el-col> <!-- 杩囨护鍊� --> <el-col :span="4"> - <el-select - v-model="rule.topic_arg" - placeholder="璇烽�夋嫨" - @change="selectArg(rule, true)" - size="small" - > - <el-option - v-for="item in rule.topicArgOptions" - :key="item.id" - :label="item.name" - :value="item.value" - ></el-option> + <el-select v-model="rule.topic_arg" placeholder="璇烽�夋嫨" @change="selectArg(rule, true)" size="small"> + <el-option v-for="item in rule.topicArgOptions" :key="item.id" :label="item.name" + :value="item.value"></el-option> </el-select> </el-col> <!-- 鎿嶄綔绗� --> <el-col :span="4"> - <el-select - v-model="rule.operator" - placeholder="璇烽�夋嫨" - size="small" - > + <el-select v-model="rule.operator" placeholder="璇烽�夋嫨" size="small"> <el-option label="==" value="="></el-option> </el-select> </el-col> <!-- 鍊肩被鍨� --> <el-col :span="4"> - <el-select - v-model="rule.operator_type" - placeholder="璇烽�夋嫨" - @change="selectOperator(rule, true)" - size="small" - > - <el-option - v-for="item in rule.operatorTypeOpionts" - :key="item.id" - :label="item.name" - :value="item.value" - ></el-option> + <el-select v-model="rule.operator_type" placeholder="璇烽�夋嫨" @change="selectOperator(rule, true)" size="small"> + <el-option v-for="item in rule.operatorTypeOpionts" :key="item.id" :label="item.name" + :value="item.value"></el-option> </el-select> </el-col> <!-- 杩囨护鍊� --> <el-col :span="4"> <div v-if="rule.operator_type === 'custom'"> - <el-input - v-model="rule.rule_value" - placeholder="璇疯緭鍏ュ唴瀹�" - size="small" - ></el-input> + <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-option - v-for="item in rule.ruleValueOptions" - :key="item.id" - :label="item.name" - :disabled="item.disabled" - :value="item.value" - ></el-option> + <el-select 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> </div> </el-col> <el-col :span="4"> <div class="rule-edit-btn"> - <i - v-show="dataList.length > 1" - class="el-icon-remove-outline" - @click="delRule(index)" - style="color: red; margin-right: 10px" - /> - <i - v-show="index === dataList.length - 1" - class="el-icon-circle-plus-outline" - @click="addRule()" - style="color: #3d68e1" - ></i> + <i v-show="dataList.length > 1" class="el-icon-remove-outline" @click="delRule(index)" + style="color: red; margin-right: 10px" /> + <i v-show="index === dataList.length - 1" class="el-icon-circle-plus-outline" @click="addRule()" + style="color: #3d68e1"></i> </div> </el-col> </el-row> @@ -216,87 +138,50 @@ </div> <div class="config-item"> <b>鎺ㄩ�佸瓧娈�</b> - <el-button type="primary" size="mini" @click="openPushSetDialog" - >璁剧疆</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"> - <el-button - type="info" - size="small" - @click="onCancle" - style="color: #222" - >鍙栨秷</el-button - > - <el-button type="primary" @click="eventPushsSave" size="small" - >淇濆瓨</el-button - > + <el-button type="info" size="small" @click="onCancle" style="color: #222">鍙栨秷</el-button> + <el-button type="primary" @click="eventPushsSave" size="small">淇濆瓨</el-button> </div> </div> - <el-dialog - :visible="pushFieldDialog" - :append-to-body="false" - :close-on-click-modal="false" - class="dialog-push-field" - @close="pushFieldDialog = false" - > + <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> --> + <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"> <div slot="title" class="slot-title"> <p>璇烽�夋嫨鎯宠鎺ㄩ�佺殑瀛楁</p> <div class="right"> - <el-checkbox - v-model="allFieldChecked" - @change="allCheckChange" - ></el-checkbox> + <el-checkbox v-model="allFieldChecked" @change="allCheckChange"></el-checkbox> </div> </div> - <div - class="check-area" - v-for="configObj in tempPushSet" - :key="configObj.id" - > + <div class="check-area" v-for="configObj in tempPushSet" :key="configObj.id"> <div class="header"> <div class="title">{{ configObj.name }}</div> <div class="right"> - <el-checkbox - v-model="configObj.checked" - @change="toggleConfigCheck(configObj)" - >鍏ㄩ��</el-checkbox - > + <el-checkbox v-model="configObj.checked" @change="toggleConfigCheck(configObj)">鍏ㄩ��</el-checkbox> </div> </div> <div class="flex-box flex-wrap"> - <div - class="param flex-box" - v-for="param in configObj.children" - :key="param.id" - > - <el-checkbox - v-model="param.checked" - @change="checkChildren" - ></el-checkbox> + <div class="param flex-box" v-for="param in configObj.children" :key="param.id"> + <el-checkbox v-model="param.checked" @change="checkChildren"></el-checkbox> <span class="param-name">{{ param.name }}</span> - <el-input - v-model="param.alias" - size="mini" - :ref="`input_${param.id}`" - @input="varifyField(param)" - :style="{ - color: param.error ? 'red' : '', - borderColor: param.error ? 'red' : '', - }" - ></el-input> + <el-input v-model="param.alias" size="mini" :ref="`input_${param.id}`" @input="varifyField(param)" :style="{ + color: param.error ? 'red' : '', + borderColor: param.error ? 'red' : '', + }"></el-input> </div> </div> </div> <div slot="footer" class="text-center"> <el-button size="small" @click="canclePushFieldSet">鍙栨秷</el-button> - <el-button - size="small" - type="primary" - :disabled="disabledPushFieldSet" - @click="submitPushFieldSet" - >淇濆瓨</el-button - > + <el-button size="small" type="primary" :disabled="disabledPushFieldSet" + @click="submitPushFieldSet">淇濆瓨</el-button> </div> </el-dialog> </div> @@ -345,6 +230,7 @@ ruleValueOptions: [], }, pushFieldDialog: false, + pushImageDialog: false, tempPushSet: [], pushFields: [], allFieldChecked: false, @@ -370,6 +256,7 @@ this.taskEditData.lineWay = newVal.link_type; this.taskEditData.eventTxt = newVal.rule_text; this.taskEditData.radioValue = newVal.is_satisfy_all ? "1" : "2"; + this.taskEditData.pushType = newVal.push_type + "" if (!this.taskEditData.urls) { this.$set(this.taskEditData, "urls", []); @@ -442,6 +329,9 @@ this.pushFieldDialog = true; this.tempPushSet = JSON.parse(JSON.stringify(this.taskEditData.push_set)); this.checkFlag(); + }, + openPushImsDialog() { + this.pushImageDialog = true; }, checkFlag() { // debugger @@ -540,6 +430,8 @@ checked: true, hash: Math.random().toString(36).substr(2), url: "", + server_ip: "", + port: "" }); }, delUrl(index) { @@ -548,6 +440,7 @@ }, // 淇濆瓨 async eventPushsSave() { + console.log(this.taskEditData.urls) if (this.taskEditData.name.length < 1) { this.$notify({ type: "warning", @@ -564,7 +457,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鍦板潃涓嶅厑璁镐负绌�", @@ -625,10 +518,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, + push_type: Number(this.taskEditData.pushType) }; let res = await eventPushsSave(json); @@ -649,6 +548,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, @@ -691,6 +596,7 @@ // 鏂板缓閰嶇疆 createSet() { this.dataList.push(JSON.parse(JSON.stringify(this.baseRule))); + console.log(this.dataList, "dataList") }, cleanSet() { this.dataList.splice(0, this.dataList.length); @@ -842,6 +748,7 @@ radioValue: "1", eventTxt: "", push_set: this.pushFields, + pushType: '1' }; this.dataList = []; }, @@ -855,9 +762,11 @@ .s-event-push-right { text-align: left; font-size: 14px; + i { cursor: pointer; } + .s-right-config { padding: 10px 40px; } @@ -876,9 +785,11 @@ .s-right-rule { padding: 20px 40px; margin-top: 17px; + .rule-title { border-bottom: 1px solid #e0e0e0; } + .rule-title2 { margin-top: 20px; } @@ -903,12 +814,15 @@ margin-left: 895px; } } + .config-item { margin: 20px 0; + b { margin-right: 10px; } } + .el-button--text { text-decoration: unset; } @@ -919,9 +833,11 @@ position: relative; top: 2px; } + span { font-size: 14px; } + display: inline; color: #3d68e1; line-height: 38px; @@ -932,71 +848,88 @@ .server-url { padding-top: 25px; } + .server-add { font-size: 18px; margin-left: 8px; color: #3d68e1; line-height: 39px; } + .dialog-push-field { + .el-button--primary.is-disabled, .el-button--primary.is-disabled:hover { background-color: #9eb4f0 !important; border-color: #9eb4f0 !important; } + .el-dialog { width: 910px; height: 700px; + .el-dialog__body { padding-top: 14px; height: 540px; overflow-y: auto; } } + .text-center { text-align: center; } + .slot-title { position: relative; + .right { position: absolute; top: 0; right: 30px; } } + .check-area { padding-bottom: 10px; + .header { position: relative; background: #efefef; line-height: 30px; margin-bottom: 14px; font-weight: bold; + .title { border-left: 3px solid #2481fa; padding-left: 10px; } + .right { position: absolute; top: 0; right: 30px; } } + .flex-box.flex-wrap { flex-wrap: wrap; } + .param.flex-box { word-break: keep-all; align-items: center; margin: 0 10px; min-width: 260px; margin-bottom: 10px; + .param-name { margin: 0 5px; } + .el-input { border-color: #dcdfe6; color: #606266; + .el-input__inner { color: inherit; border-color: inherit; @@ -1007,6 +940,3 @@ } } </style> - - - -- Gitblit v1.8.0