| | |
| | | |
| | | <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()"> |
| | |
| | | <div> |
| | | <el-checkbox v-model="item.enable"></el-checkbox> |
| | | <span class="ml20">{{ "URL " }}</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"> |
| | |
| | | <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> |
| | |
| | | </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"> |
| | |
| | | </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"> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | pushType: '1', |
| | | isWarningSelect: true, |
| | | taskEditData: {}, |
| | | dataList: [], |
| | | dictionary: [], |
| | |
| | | ruleValueOptions: [], |
| | | }, |
| | | pushFieldDialog: false, |
| | | pushImageDialog:false, |
| | | pushImageDialog: false, |
| | | tempPushSet: [], |
| | | pushFields: [], |
| | | allFieldChecked: false, |
| | |
| | | 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", []); |
| | |
| | | checked: true, |
| | | hash: Math.random().toString(36).substr(2), |
| | | url: "", |
| | | server_ip: "", |
| | | port: "" |
| | | }); |
| | | }, |
| | | delUrl(index) { |
| | |
| | | }, |
| | | // 保存 |
| | | async eventPushsSave() { |
| | | console.log(this.taskEditData.urls) |
| | | if (this.taskEditData.name.length < 1) { |
| | | this.$notify({ |
| | | type: "warning", |
| | |
| | | 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地址不允许为空", |
| | |
| | | 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); |
| | |
| | | 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, |
| | |
| | | // 新建配置 |
| | | createSet() { |
| | | this.dataList.push(JSON.parse(JSON.stringify(this.baseRule))); |
| | | console.log(this.dataList, "dataList") |
| | | }, |
| | | cleanSet() { |
| | | this.dataList.splice(0, this.dataList.length); |
| | |
| | | } |
| | | } |
| | | }); |
| | | 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) => { |
| | |
| | | return; |
| | | } |
| | | } |
| | | if (this.isWarningSelect) { |
| | | rule.rule_value = val |
| | | } else { |
| | | rule.rule_value = val.join(","); |
| | | } |
| | | |
| | | rule.rule_value = val.join(","); |
| | | }, |
| | | setOptionsDisable(rule) { |
| | | console.log(rule); |
| | |
| | | radioValue: "1", |
| | | eventTxt: "", |
| | | push_set: this.pushFields, |
| | | pushType: '1' |
| | | }; |
| | | this.dataList = []; |
| | | this.pushType ='1' |
| | | }, |
| | | onCancle() { |
| | | this.$emit("onCancle"); |