hanbaoshan
2020-08-06 d656ff9cf8c97a01c0cc990d935e4b42b314be22
src/pages/settings/components/BasicSetting.vue
@@ -5,6 +5,7 @@
      v-model="activeName"
      v-loading="loading"
      :element-loading-text="loadingText"
      type="card"
    >
      <!-- 本机信息 -->
      <el-tab-pane label="本机信息" name="first">
@@ -158,7 +159,7 @@
            </el-menu-item-group>
          </el-submenu>
          <!-- 对外服务IP 改名为外部网络(新tab)-->
          <!-- 文件音视频 -->
          <!-- <el-submenu index="4">
            <template slot="title">
@@ -351,180 +352,39 @@
        <cluster-management></cluster-management>
      </el-tab-pane>
      <el-tab-pane label="外部网络" name="fourth">
        <el-row :gutter="20">
          <el-col :span="10">
            <div>
              <div class="flex-box">
                <div style="line-height:32px;">
                  <el-radio v-model="ipServer.diyOrLocalIP" :label="1">设置外部IP</el-radio>
                  <el-radio v-model="ipServer.diyOrLocalIP" :label="0">选用本机IP</el-radio>
                </div>
                <div class="ml10" style="width:205px;">
                  <ip-input :ip="ipServer.ip" @on-blur="ipServer.ip = arguments[0]"></ip-input>
                </div>
              </div>
              <div class="flex-box p5" >
                <span style="line-height:32px;">域名</span>
                <div style="margin-left:14px;width:205px;">
                  <el-input size="small" style v-model="ipServer.localhost"></el-input>
                </div>
              </div>
              <div class="flex-box" >
                <span style="line-height:32px;">本地文件端口</span>
                <div style="margin-left:14px;width:205px;">
                  <el-input size="small" style v-model="ipServer.localFilePort"></el-input>
                </div>
              </div>
            </div>
          </el-col>
          <!-- <el-col :span="14">
            <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-col>-->
        </el-row>
        <div class="mt15 save-btn" style="width:1000px;float:left;">
        <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="user" >
      <el-tab-pane label="权限管理" name="user">
        <authority-management v-if="activeName === 'user'"></authority-management>
      </el-tab-pane>
      <el-tab-pane label="广播设置" name="radio" >
      <el-tab-pane label="广播设置" name="radio">
        <radio-set v-if="activeName === 'radio'"></radio-set>
      </el-tab-pane>
      <!-- GB28181设置 -->
      <el-tab-pane label="GB28181设置" name="fifth">
        <el-form
          :model="gb28181"
          :rules="rules"
          label-width="140px"
          class="alarmSetting"
          ref="gb28181"
        >
          <!-- <el-form-item label="国际服务器IP" prop="ServerIp">
            <ip-input :ip="gb28181.ServerIp" @on-blur="gb28181.ServerIp = arguments[0]"></ip-input>
          </el-form-item>-->
          <div style="text-align: left;margin-bottom: 22px;">
            <el-radio-group v-model="gb28181.idType">
              <el-radio :label="0">输入已有ID</el-radio>
              <el-radio :label="1">生成新的ID</el-radio>
            </el-radio-group>
          </div>
          <el-form-item label="所在地">
            <el-select
              v-model="locationCity.province"
              @change="changeProvince"
              size="small"
              placeholder="请选择省份"
            >
              <el-option
                v-for="item in locationCity.provinceOptions"
                :key="item.id"
                :label="item.name"
                size="small"
                :value="item.id"
              ></el-option>
            </el-select>
            <el-select
              class="ml10 mr10"
              v-model="locationCity.city"
              :disabled="!locationCity.province"
              @change="changeCity"
              size="small"
              placeholder="请选择城市"
            >
              <el-option
                v-for="item in locationCity.cityOptions"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
            <el-select
              v-model="locationCity.county"
              :disabled="!locationCity.city"
              size="small"
              placeholder="请选择区县"
            >
              <el-option
                v-for="item in locationCity.countyOptions"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
            <el-button
              type="text"
              style="position: absolute"
              v-show="gb28181.idType === 1"
              @click="newGBID"
            >生成ID</el-button>
          </el-form-item>
          <!-- <el-form-item label="国际服务器端口" prop="GbServerPort">
            <el-input v-model.number="gb28181.ServerPort" placeholder="请输入" size="small"></el-input>
          </el-form-item>-->
          <el-form-item label="国标ID">
            <el-input v-model="gb28181.PublicId" placeholder="请输入" size="small"></el-input>
          </el-form-item>
          <el-form-item label="国标端口" prop="ServerPort">
            <el-input v-model.number="gb28181.GbServerPort" placeholder="请输入" size="small"></el-input>
          </el-form-item>
          <el-form-item label="开启鉴权">
            <el-switch v-model="gb28181.IsAuth"></el-switch>
          </el-form-item>
          <el-form-item label="鉴权密码" v-show="gb28181.IsAuth">
            <el-input v-model="gb28181.Password" placeholder="请输入" size="small"></el-input>
          </el-form-item>
          <el-col :span="12">
            <el-form-item>
              <el-button type="primary" @click="submitGB28281" size="small">保存</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-tab-pane>
    </el-tabs>
  </div>
@@ -534,17 +394,13 @@
import {
  getDevInfo,
  getAlarmConfig,
  getGB28181Config,
  saveDevInfo,
  saveAlarmConfig,
  saveGB28181Config,
  getClockInfo,
  saveClockInfo,
  testNTPserver,
  getResourceConfig,
  saveResourceConfig,
  getGb28181AreaList,
  newGb28181ID
} from "@/api/system";
import { isPort, isIPv4 } from "@/scripts/validate";
@@ -600,7 +456,6 @@
      timestamp: 0,
      sysinfo: {},
      alarmConf: {},
      gb28181: {},
      originNetConfig: {
        ip: "",
        gw: "",
@@ -714,7 +569,6 @@
      this.initSysinfo();
      // this.initAlarmConf();
      this.initResourceConfig();
      this.initGB28181Conf();
      this.initClockConf();
    });
  },
@@ -785,19 +639,6 @@
          this.ipServer.ip = rsp.data.serviceIp
          this.ipServer.localhost = rsp.data.domain
          this.ipServer.localFilePort = rsp.data.filePort
        }
      })
    },
    initGB28181Conf() {
      getGB28181Config().then(rsp => {
        if (rsp && rsp.success) {
          this.gb28181 = rsp.data;
          this.gb28181.idType = 0;
        }
      });
      getGb28181AreaList().then(rsp => {
        if (rsp && rsp.success) {
          this.locationCity.provinceOptions = rsp.data;
        }
      })
    },
@@ -981,23 +822,6 @@
        }
      })
    },
    submitGB28281() {
      this.$refs["gb28181"].validate(valid => {
        if (valid) {
          saveGB28181Config(this.gb28181).then(rsp => {
            if (rsp && rsp.success) {
              this.$notify({
                type: "success",
                message: "GB28181设置保存成功"
              });
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    onIpBlur(e, ip) {
      console.log(e, ip);
    },
@@ -1052,33 +876,6 @@
      let re = /^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*$/
      return re.test(str)
    },
    changeProvince() {
      let pid = this.locationCity.province;
      getGb28181AreaList({ parentId: pid }).then(rsp => {
        if (rsp && rsp.success) {
          this.locationCity.cityOptions = rsp.data;
          this.locationCity.city = this.locationCity.cityOptions[0].id;
          this.changeCity();
        }
      })
    },
    changeCity() {
      let pid = this.locationCity.city;
      getGb28181AreaList({ parentId: pid }).then(rsp => {
        if (rsp && rsp.success) {
          this.locationCity.countyOptions = rsp.data;
          this.locationCity.county = this.locationCity.countyOptions[0].id;
        }
      })
    },
    newGBID() {
      let cCode = this.locationCity.county + "";
      newGb28181ID({ code: cCode }).then(rsp => {
        if (rsp && rsp.success) {
          this.gb28181.PublicId = rsp.data;
        }
      })
    }
  }
};
</script>
@@ -1088,10 +885,13 @@
  height: 100%;
  .el-form {
    width: 1000px;
    margin-top: 30px;
    // margin-left: -80px;
    .el-form-item {
      text-align: left;
      &.is-required:not(.is-no-asterisk)>.el-form-item__label:before{
        margin-left:-8px;
      }
      .el-button {
        float: right;
      }
@@ -1148,49 +948,6 @@
    font-weight: 600;
    background-color: #e4e6ed;
  }
  #e-basic-setting {
    .el-tabs__header {
      border: 0px solid #dcdfe6;
      .el-tabs__item {
        padding: 5px 50px;
        height: 50px;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #222222;
        text-align: center;
        border: 0px solid transparent;
      }
      .el-tabs__item:nth-child(2) {
        padding-left: 50px;
      }
      .el-tabs__item:last-child {
        padding-right: 50px;
      }
      .el-tabs__item.is-active {
        color: #ff7733;
        font-weight: bold;
        // border-right-color: #fff;
        // border-left-color: #fff;
      }
      .el-tabs__item:not(.is-disabled):hover {
        color: #ff7733;
      }
    }
    .el-tabs__active-bar {
      background-color: #ff7733;
    }
    .xiangqin-label {
      text-align: left;
      width: 85px;
      font-size: 14px;
      line-height: 30px;
    }
    .xiangqing-info {
      text-align: left;
      font-size: 14px;
      line-height: 30px;
    }
  }
  #cut_min_duration {
    .el-slider__bar {
@@ -1219,7 +976,7 @@
    list-style: none;
    position: relative;
    margin: 0;
    padding-left: 0;
    padding-left: 10px;
    background-color: #ffffff;
    .el-submenu__title {
      height: 35px;
@@ -1272,6 +1029,16 @@
}
</style>
<style lang="scss" scoped>
.flex-box {
  display: flex;
  height: 50px;
  label {
    width: 120px;
  }
  .el-input {
    width: 300px;
  }
}
.menu-css,
.el-menu {
  border-right: none;