| | |
| | | style="position: absolute; left: 330px;" |
| | | :disabled="syncType === '2'" |
| | | @click="testNTP" |
| | | :loading="ntpTestLoading" |
| | | >测试</el-button> |
| | | </el-form-item> |
| | | |
| | |
| | | cityOptions: [], |
| | | countyOptions: [] |
| | | }, |
| | | webPort: 0, |
| | | ntpTestLoading: false |
| | | }; |
| | | webPort: 0; |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | |
| | | var second = s - day * 24 * 3600 - hour * 3600 - minute * 60; |
| | | return day + "天" + hour + "时" + minute + "分" + second + "秒"; |
| | | }, |
| | | initClockConf() { |
| | | initClockConf(ntpTest = false) { |
| | | getClockInfo().then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | this.timezone = rsp.data.time_zone; |
| | | this.syncType = rsp.data.ntp ? "1" : "2"; |
| | | if (!ntpTest) { |
| | | this.syncType = rsp.data.ntp ? "1" : "2"; |
| | | } |
| | | if (rsp.data.ntp) { |
| | | this.ntpServer = rsp.data.ntp_server; |
| | | this.timeInterval = rsp.data.interval; |
| | |
| | | message: "设置成功" |
| | | }); |
| | | } |
| | | |
| | | this.initClockConf(); |
| | | }) |
| | | }, |
| | | testNTP() { |
| | | this.ntpTestLoading = true; |
| | | testNTPserver({ server: this.ntpServer }).then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | this.$notify({ |
| | |
| | | message: "时间同步失败" |
| | | }); |
| | | } |
| | | this.ntpTestLoading = false; |
| | | this.initClockConf(true); |
| | | |
| | | }).catch(err => { |
| | | this.$notify({ |
| | | type: "error", |
| | | message: "时间同步失败,请检查服务器ip" |
| | | }); |
| | | this.ntpTestLoading = false; |
| | | }) |
| | | }, |
| | | submitAlarm() { |