运维优化

master
fanluyan 7 months ago
parent 8df2d446fd
commit 373915f2b7

@ -13,7 +13,11 @@ export default {
this.initWebSocket(); this.initWebSocket();
window.addEventListener("onmessageWS", this.getSocketData); window.addEventListener("onmessageWS", this.getSocketData);
}, },
data() {
return {
recentAlerts: [], //
};
},
methods: { methods: {
...mapActions("cache", ["addCache", "removeCache"]), ...mapActions("cache", ["addCache", "removeCache"]),
// //
@ -56,12 +60,39 @@ export default {
}, },
getSocketData(res) { getSocketData(res) {
console.log(res); console.log(res);
this.$notify({ const newAlert = res.detail.data;
title: "告警",
message: res.detail.data, //
position: "bottom-right", this.recentAlerts.push(newAlert);
type: "warning",
duration: 0, // 3
if (this.recentAlerts.length > 3) {
this.recentAlerts.shift(); //
}
// 使
this.showAlerts();
// this.$notify({
// title: "",
// message: res.detail.data,
// position: "bottom-right",
// type: "warning",
// duration: 0,
// });
},
showAlerts() {
//
this.recentAlerts.forEach((alert, index) => {
// 便
setTimeout(() => {
this.$notify({
title: "告警",
message: alert,
position: "bottom-right",
type: "warning",
duration: 0, // 0
});
}, index * 1000); // 1
}); });
}, },
}, },

@ -79,18 +79,14 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="规约" class="gybox"> <el-form-item label="规约" class="gybox">
<el-select <el-select v-model="formdata.protocol" @change="changeprotocol">
v-model="formdata.protocol"
filterable
@keyup.enter.native="onSubmit()"
>
<el-option <el-option
v-for="item in protocolOptions" v-for="item in protocolOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
> >
{{ item.name }}-{{ item.id }} {{ item.name }} - {{ item.id }}
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -227,7 +223,7 @@
@keyup.enter.native="onSubmit()" @keyup.enter.native="onSubmit()"
v-model="formdata.activityId" v-model="formdata.activityId"
filterable filterable
@change="changeActive" @change="changeActive2"
> >
<el-option <el-option
v-for="item in activityOptions" v-for="item in activityOptions"
@ -502,6 +498,7 @@ export default {
getProtocolList() getProtocolList()
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.protocolOptions = [{ id: -1, name: "全部" }];
this.protocolOptions = this.protocolOptions.concat(res.data.list); this.protocolOptions = this.protocolOptions.concat(res.data.list);
this.formdata.protocol = this.protocolOptions[0].id; this.formdata.protocol = this.protocolOptions[0].id;
}) })
@ -528,11 +525,20 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
changeprotocol(val) {
console.log(val);
this.formdata.protocol = val;
},
changeActive(val) { changeActive(val) {
console.log(this.activityOptions); console.log(this.activityOptions);
console.log(val); console.log(val);
localStorage.setItem("activeId", JSON.stringify(val)); localStorage.setItem("activeId", JSON.stringify(val));
}, },
changeActive2(val) {
console.log(this.activityOptions);
console.log(val);
localStorage.setItem("activeId", JSON.stringify(val));
},
onSubmit() { onSubmit() {
this.tableLoaidng = true; this.tableLoaidng = true;

@ -150,8 +150,14 @@
>apk版本{{ item.cmdMap.fileName }}</b >apk版本{{ item.cmdMap.fileName }}</b
> >
<b v-else>cmd{{ item.cmdMap }}</b> <b v-else>cmd{{ item.cmdMap }}</b>
<el-popover placement="left" width="480" trigger="click"> <el-popover placement="left" width="480" trigger="click">
<el-table :data="JSON.parse(item.content)" height="520px"> <p>{{ item.content }}</p>
<!-- <el-table
v-else
:data="JSON.parse(item.content)"
height="520px"
>
<el-table-column <el-table-column
property="n" property="n"
label="名称" label="名称"
@ -173,13 +179,13 @@
{{ $moment(scope.row.m).format("YYYY-MM-DD HH:mm:ss") }} {{ $moment(scope.row.m).format("YYYY-MM-DD HH:mm:ss") }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table> -->
<el-button <el-button
type="parimary" type="parimary"
size="mini" size="mini"
v-if="item.content !== null" v-if="item.content !== null"
slot="reference" slot="reference"
>查看目录</el-button >查看内容</el-button
> >
</el-popover> </el-popover>
</span> </span>
@ -370,6 +376,7 @@ export default {
//this.endCommand = res.data; //this.endCommand = res.data;
//this.endCommand = res.data.list //this.endCommand = res.data.list
this.rightCommand = res.data.list; this.rightCommand = res.data.list;
//
this.rightComLoading = false; this.rightComLoading = false;
this.updateTime = new Date(); this.updateTime = new Date();

Loading…
Cancel
Save