1.增加告警组件

2.上传失败或者异常时,进行告警显示
This commit is contained in:
jijunyun 2024-03-01 09:47:10 +08:00
parent 2a77606996
commit 80f67c751a
3 changed files with 25 additions and 14 deletions

View File

@ -37,7 +37,7 @@
mounted() {
let _this = this;
//HttpwebSocket
}
};
</script>
@ -62,7 +62,7 @@
// position: relative;
color: rgba(0, 0, 0, 0.85);
}
.webContent {
//margin-top: 7.5vh;
//position: absolute;
@ -72,5 +72,4 @@
width: 100vw;
overflow: hidden;
}
</style>
</style>

View File

@ -21,7 +21,8 @@ import {
TabPane,
Upload,
Loading,
Message
Message,
Alert
} from 'element-ui';
Vue.use(Input);
@ -40,7 +41,7 @@ Vue.use(DatePicker);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Upload);
Vue.use(Alert);
Vue.use(Loading.directive);
Vue.prototype.$loading = Loading.service;

View File

@ -367,7 +367,7 @@
</div>
<div style="width: 100%;">
<!-- multiple 暂时去除多文件上传功能 -->
<el-upload class="upload-demo" drag action="/uploadFireWare" accept=".bin" :limit="1"
<el-upload ref="upload" class="upload-demo" drag action="/uploadFireWare" accept=".bin" :limit="1"
:on-progress="beginUpload" :on-success="uploadSuccessFinish" :on-error="uploadErrorFinish"
v-loading="uploadLoading" element-loading-text="上传中...">
<i class="el-icon-upload"></i>
@ -376,7 +376,10 @@
</div>
</el-upload>
</div>
<div style="margin-top: 0px;">
<el-alert title="固件上传失败,请重试." type="error" show-icon v-show="uploadAlertShow">
</el-alert>
</div>
</div>
</el-main>
<el-dialog title="修改密码" width="30%" center :visible.sync="pwdModelShow" top="35vh">
@ -686,7 +689,10 @@
},
//
selectMenuName: '系统设置'
selectMenuName: '系统设置',
//
uploadAlertShow: false
}
},
@ -703,7 +709,8 @@
index: 0
}, null);
} else if (name == '固件升级') {
this.querySysFrom();
this.$refs['upload'].clearFiles();
this.uploadAlertShow = false;
}
},
@ -918,7 +925,7 @@
}
const loading = this.$loading({
lock: true,
text: '查询中...',
text: '保存中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
@ -1066,10 +1073,7 @@
* 登出
*/
loginOut: function() {
this.logoutSys();
this.$router.push({
name: 'home'
});
@ -1088,6 +1092,8 @@
*/
beginUpload: function() {
this.uploadLoading = true;
//
_this.uploadAlertShow = false;
},
/**
@ -1101,20 +1107,25 @@
//
if (response.result == 'success') {
_this.$message.success('上传成功,稍后重启。');
_this.uploadAlertShow = false;
} else {
_this.$message.error(response.message);
_this.$refs['upload'].clearFiles();
_this.uploadAlertShow = true;
}
// setTimeout(function() {
// _this.uploadLoading = false;
// }, 5000);
},
/**
* 上传失败处
*/
uploadErrorFinish: function() {
this.uploadLoading = false;
this.$message.error('上传失败,请重启设备后重试。');
this.uploadAlertShow = true;
},
/**