zhangzengfei
2020-10-14 261e25074b7f35010efccb86bf82f6fe36e4b10d
src/pages/settings/components/BasicSetting.vue
@@ -5,7 +5,7 @@
      v-model="activeName"
      v-loading="loading"
      :element-loading-text="loadingText"
      type="card"
      type="border-card"
    >
      <!-- 本机信息 -->
      <el-tab-pane label="本机信息" name="first">
@@ -76,7 +76,7 @@
            <template slot="title">
              <b class="tree-font">详细信息</b>
            </template>
            <el-menu-item-group class="item-group">
            <el-menu-item-group class="item-group desc-info">
              <el-row :gutter="gutter">
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">ID</div>
@@ -109,6 +109,22 @@
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">硬盘个数</div>
                  <div class="xiangqing-info">{{sysinfo.diskCount}}</div>
                </el-col>
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">硬盘信息</div>
                  <div class="xiangqing-info">{{sysinfo.disks}}</div>
                </el-col>
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">CPU</div>
                  <div class="xiangqing-info">{{sysinfo.cpuInfo}}</div>
                </el-col>
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">内存</div>
                  <div class="xiangqing-info">{{sysinfo.mem}}</div>
                </el-col>
                <el-col :span="12" class="flex-box">
                  <div class="xiangqin-label">运行时间</div>
                  <div class="xiangqing-info">{{sysinfo.uptime}}</div>
                </el-col>
              </el-row>
            </el-menu-item-group>
@@ -159,102 +175,6 @@
            </el-menu-item-group>
          </el-submenu>
          <!-- 对外服务IP 改名为外部网络(新tab)-->
          <!-- 文件音视频 -->
          <!-- <el-submenu index="4">
            <template slot="title">
              <b class="tree-font">文件音视频</b>
            </template>
            <el-menu-item-group class="item-group">
              <el-row :gutter="20">
                <el-col :span="8">
                  <div class="p5">
                    <span class="iconfont iconpicture" style="margin-right: 5px;"></span>
                    <span class="mr10">图片端口</span>
                    <el-input v-model="localFile.picPort" style="width:300px;" placeholder="请输入内容"></el-input>
                  </div>
                  <div class="p5">
                    <span class="iconfont iconshipin" style="margin-right: 5px;"></span>
                    <span class="mr10">视频端口</span>
                    <el-input v-model="localFile.videoPort" style="width:300px;" placeholder="请输入内容"></el-input>
                  </div>
                  <div class="p5">
                    <span class="iconfont iconyinpinx" style="margin-right: 5px;"></span>
                    <span class="mr10">音频端口</span>
                    <el-input v-model="localFile.audioPort" style="width:300px;" placeholder="请输入内容"></el-input>
                  </div>
                </el-col>
                <el-col :span="16">
                  <el-table
                    :data="localFile.fileTable"
                    border
                    style="width: 100%">
                    <el-table-column
                      type="index"
                      label="序号"
                      align="center"
                      width="50">
                    </el-table-column>
                    <el-table-column
                      prop="date"
                      label="名称"
                      align="center"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="ID"
                      align="center"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="IP"
                      align="center"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="在线状态"
                      align="center"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      label="类别"
                      align="center"
                      width="100">
                      <template>
                        <span class="iconfont iconpicture" style="margin-right: 5px;"></span>
                        <span class="iconfont iconshipin" style="margin-right: 5px;"></span>
                        <span class="iconfont iconyinpinx" style="margin-right: 5px;"></span>
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="address"
                      align="center"
                      label="备注">
                      <template slot-scope="{row}">
                        <div v-if="row.edit">
                          <el-input :autofocus="row.edit" v-focus v-model="row.address" size="small" />
                          <el-button size="mini" type="info" @click="handleCancel(row)">取消</el-button>
                          <el-button size="mini" type="primary" @click="handleSave(row)">保存</el-button>
                        </div>
                        <div v-else>
                          <span>{{ row.address }}</span>
                          <el-button
                            type="text"
                            style="color: black;font-size:16px"
                            @click="handleEdit(row)"
                            icon="iconfont iconbianji"
                          ></el-button>
                        </div>
                      </template>
                    </el-table-column>
                  </el-table>
                </el-col>
              </el-row>
            </el-menu-item-group>
          </el-submenu>-->
        </el-menu>
      </el-tab-pane>
@@ -266,12 +186,13 @@
            {{ equipmentTime }}
          </el-form-item>
          <el-form-item label="时区" prop="timezone">
          <!-- <el-form-item label="时区" prop="timezone">
            <el-select
              v-model="timezone"
              placeholder="请选择"
              style="width: 360px; height: 32px"
              size="small"
              @change="checkTimeZone"
            >
              <el-option
                v-for="item in timeZoneOption"
@@ -280,7 +201,7 @@
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          </el-form-item>-->
          <div style="text-align: left;padding: 10px 0px">
            <div class="time-type">NTP校时</div>
            <div style="padding: 10px 0px;">
@@ -328,7 +249,6 @@
              placeholder="选择日期时间"
              size="small"
              value-format="yyyy-MM-dd HH:mm:ss"
              :readonly="settimeRadio"
              :disabled="syncType === '1'"
            ></el-date-picker>
            <el-checkbox
@@ -351,35 +271,46 @@
      <el-tab-pane label="集群管理" name="third">
        <cluster-management></cluster-management>
      </el-tab-pane>
      <el-tab-pane label="外部网络" name="fourth">
        <div class="flex-box">
          <label>设置外部IP</label>
          <div style="width:300px;">
            <ip-input :ip="ipServer.ip" @on-blur="ipServer.ip = arguments[0]"></ip-input>
          </div>
          <el-checkbox label="选用本机IP" size="small" style="margin-left: 20px"></el-checkbox>
        </div>
        <div class="flex-box">
          <label>域名</label>
          <el-input size="small" v-model="ipServer.localhost"></el-input>
        </div>
        <div class="flex-box">
          <label>本地文件端口</label>
          <el-input size="small" v-model="ipServer.localFilePort"></el-input>
        </div>
        <div class="mt15 save-btn" style="width:460px; margin-bottom:20px; float:left;">
          <el-button type="primary" @click="submitResource" size="small">保存</el-button>
        </div>
        <div>
          <el-table :data="ipServer.fileTable" border fit style="width: 100%">
            <el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
            <el-table-column prop="date" label="名称" align="center"></el-table-column>
            <el-table-column prop="name" label="ID" align="center"></el-table-column>
            <el-table-column prop="name" label="IP" align="center"></el-table-column>
            <el-table-column prop="name" label="在线状态" align="center"></el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
      <!-- <el-tab-pane label="外部访问" name="fourth">
        <el-menu
          :default-openeds="openeds"
          background-color="#fff"
          text-color="#303133"
          active-text-color="#409EFF"
          style="height: 100%;"
          class="menu-css"
          @open="menuOpen"
          @close="menuClose"
        >
          <el-submenu index="0">
            <template slot="title">
              <b class="tree-font">外部访问设置</b>
            </template>
            <el-menu-item-group class="item-group">
              <el-form :model="sysinfo" :rules="rules" ref="sysinfo" label-width="100px">
                <div class="flex-box">
                  <label>设置外部IP</label>
                  <div style="width:300px;">
                    <ip-input :ip="ipServer.ip" @on-blur="ipServer.ip = arguments[0]"></ip-input>
                  </div>
                  <el-checkbox label="选用本机IP" size="small" style="margin-left: 20px"></el-checkbox>
                </div>
                <div class="flex-box">
                  <label>域名</label>
                  <el-input size="small" v-model="ipServer.localhost"></el-input>
                </div>
                <div class="flex-box">
                  <label>本地文件端口</label>
                  <el-input size="small" v-model="ipServer.localFilePort"></el-input>
                </div>
                <div class="mt15 mb10 save-btn">
                  <el-button type="primary" @click="submitSysinfo" size="small">保存</el-button>
                </div>
              </el-form>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-tab-pane> -->
      <el-tab-pane label="权限管理" name="user">
        <authority-management v-if="activeName === 'user'"></authority-management>
      </el-tab-pane>
@@ -529,29 +460,6 @@
        ip: "",
        localhost: "",
        localFilePort: "",
        fileTable: [
          {
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄',
            edit: false
          }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄',
            edit: false
          }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄',
            edit: false
          }, {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄',
            edit: false
          }
        ]
      },
      locationCity: {
        province: '',
@@ -570,6 +478,8 @@
      // this.initAlarmConf();
      this.initResourceConfig();
      this.initClockConf();
      //this.markStartTime();
    });
  },
  beforeDestroy() {
@@ -590,6 +500,16 @@
          this.alarmConf.min_video_len = rsp.data.min_video_len;
          this.alarmConf.max_video_len = rsp.data.max_video_len;
          if (this.sysinfo.deviceInfo) {
            let devInfo = this.sysinfo.deviceInfo;
            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.arch = devInfo.host.kernelArch;
            this.sysinfo.uptime = this.secondsFormat(devInfo.host.uptime);
          }
          if (!this.sysinfo.server_port) {
            this.sysinfo.server_port = 7003;
          }
@@ -601,6 +521,13 @@
      }).catch(err => {
        this.loading = false;
      });
    },
    secondsFormat(s) {
      var day = Math.floor(s / (24 * 3600)); // Math.floor()向下取整
      var hour = Math.floor((s - day * 24 * 3600) / 3600);
      var minute = Math.floor((s - day * 24 * 3600 - hour * 3600) / 60);
      var second = s - day * 24 * 3600 - hour * 3600 - minute * 60;
      return day + "天" + hour + "时" + minute + "分" + second + "秒";
    },
    initClockConf() {
      getClockInfo().then(rsp => {
@@ -651,6 +578,10 @@
          this.settime = this.formatTime(timestamp, 'Y-M-D h:m:s')
        }, 1000)
      }
    },
    markStartTime() {
      let timestamp = new Date().getTime() / 1000;
      this.settime = this.formatTime(timestamp, 'Y-M-D h:m:s')
    },
    submitSysinfo() {
      this.$refs["sysinfo"].validate(valid => {
@@ -720,6 +651,10 @@
          return false;
        }
      });
    },
    checkTimeZone(val) {
      debugger;
    },
    submitClock() {
      if (this.syncType === '1') {
@@ -889,8 +824,8 @@
    // margin-left: -80px;
    .el-form-item {
      text-align: left;
      &.is-required:not(.is-no-asterisk)>.el-form-item__label:before{
        margin-left:-8px;
      &.is-required:not(.is-no-asterisk) > .el-form-item__label:before {
        margin-left: -8px;
      }
      .el-button {
        float: right;
@@ -1039,6 +974,16 @@
    width: 300px;
  }
}
.desc-info {
  margin-bottom: 14px;
  .flex-box {
    height: 40px;
    line-height: 40px;
    .xiangqin-label {
      width: 80px;
    }
  }
}
.menu-css,
.el-menu {
  border-right: none;