| | |
| | | ref="joinForm"
|
| | | class="join-form"
|
| | | >
|
| | | <!-- 授权管理方式 -->
|
| | | <el-form-item>
|
| | | <div class="row">
|
| | | <div class="item-title">设备授权管理方式</div>
|
| | | <div class="inputContain">
|
| | | <el-select
|
| | | v-model="settingForm.authorizationType"
|
| | | v-model="settingForm.need_auth_pwd"
|
| | | placeholder="请选择"
|
| | | size="small"
|
| | | :popper-append-to-body="false"
|
| | |
| | | </div>
|
| | | </el-form-item>
|
| | |
|
| | | <el-form-item prop="password" v-if="settingForm.authorizationType == 1">
|
| | | <!-- 授权密码 -->
|
| | | <el-form-item prop="auth_pwd" v-if="settingForm.need_auth_pwd == 1">
|
| | | <div class="row">
|
| | | <div class="item-title">授权密钥</div>
|
| | | <div class="inputContain">
|
| | | <el-input
|
| | | v-model="settingForm.password"
|
| | | v-model="settingForm.auth_pwd"
|
| | | placeholder="请输入6位授权密钥"
|
| | | maxlength="6"
|
| | | show-password
|
| | | show-auth_pwd
|
| | | ></el-input>
|
| | | </div>
|
| | | </div>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <div class="save">保存</div>
|
| | | <div class="save" @click="submit">保存</div>
|
| | | </div>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { getAuthInfo, setAuthInfo } from "@/api/system";
|
| | |
|
| | | export default {
|
| | | created() {
|
| | | this.getAuth();
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | settingForm: {
|
| | | authorizationType: 0,
|
| | | password: "",
|
| | | need_auth_pwd: 0, //授权管理方式
|
| | | auth_pwd: "", //授权密钥
|
| | | id: "", //设备id
|
| | | },
|
| | | typeOptions: [
|
| | | {
|
| | |
| | | label: "密码校验",
|
| | | value: 1,
|
| | | },
|
| | | ],
|
| | | ], //授权管理方式选项
|
| | | rules: {
|
| | | password: [
|
| | | auth_pwd: [
|
| | | { min: 6, max: 6, message: "长度为6个字符", trigger: "blur" },
|
| | | ],
|
| | | },
|
| | | }, //正则校验
|
| | | };
|
| | | },
|
| | | methods: {
|
| | | //获取授权信息
|
| | | async getAuth() {
|
| | | const res = await getAuthInfo();
|
| | | if (res.code === 200 && res.success) {
|
| | | //授权数据回填
|
| | | this.settingForm = res.data;
|
| | | } else {
|
| | | this.$notify.error({
|
| | | title: "错误",
|
| | | message: "获取授权信息失败",
|
| | | });
|
| | | }
|
| | | },
|
| | | //提交授权配置
|
| | | async submit() {
|
| | | const res = await setAuthInfo(this.settingForm);
|
| | | if (res.code === 200 && res.success) {
|
| | | this.$notify.success({
|
| | | title: "成功",
|
| | | message: "修改成功",
|
| | | });
|
| | | } else {
|
| | | this.$notify.error({
|
| | | title: "错误",
|
| | | message: "修改失败",
|
| | | });
|
| | | }
|
| | | },
|
| | | },
|
| | | };
|
| | | </script>
|
| | |
|