hanbaoshan
2020-10-15 355de6d28489e9ff3d17138575c2fef32266930e
src/pages/settings/components/BasicSetting.vue
@@ -232,6 +232,7 @@
              style="position: absolute; left: 330px;"
              :disabled="syncType === '2'"
              @click="testNTP"
              :loading="ntpTestLoading"
            >测试</el-button>
          </el-form-item>
@@ -310,7 +311,7 @@
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-tab-pane> -->
      </el-tab-pane>-->
      <el-tab-pane label="权限管理" name="user">
        <authority-management v-if="activeName === 'user'"></authority-management>
      </el-tab-pane>
@@ -469,8 +470,9 @@
        cityOptions: [],
        countyOptions: []
      },
      webPort: 0,
      ntpTestLoading: false
    };
    webPort: 0;
  },
  mounted() {
    this.$nextTick(() => {
@@ -505,7 +507,7 @@
            this.sysinfo.cpuInfo = devInfo.cpu[0].modelName;
            this.sysinfo.disks = devInfo.disk;
            this.sysinfo.mem = (devInfo.mem.total / 1024 / 1024 / 1024).toFixed(2) + "KB";
            this.sysinfo.mem = (devInfo.mem.total / 1024 / 1024 / 1024).toFixed(2) + "GB";
            // this.sysinfo.arch = devInfo.host.kernelArch;
            this.sysinfo.uptime = this.secondsFormat(devInfo.host.uptime);
          }
@@ -529,11 +531,13 @@
      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;
@@ -690,9 +694,12 @@
            message: "设置成功"
          });
        }
        this.initClockConf();
      })
    },
    testNTP() {
      this.ntpTestLoading = true;
      testNTPserver({ server: this.ntpServer }).then(rsp => {
        if (rsp && rsp.success) {
          this.$notify({
@@ -705,11 +712,15 @@
            message: "时间同步失败"
          });
        }
        this.ntpTestLoading = false;
        this.initClockConf(true);
      }).catch(err => {
        this.$notify({
          type: "error",
          message: "时间同步失败,请检查服务器ip"
        });
        this.ntpTestLoading = false;
      })
    },
    submitAlarm() {