<style>
  .editGuestTeamPower .add-tit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 20px;
  }

  .editGuestTeamPower .add-tit p {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: rgba(17, 17, 17, 1);
    font-size: 14px;
  }

  .editGuestTeamPower .add-tit p span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #409efe;
    border-radius: 50%;
    margin-right: 10px;
  }

  .editGuestTeamPower .el-dialog__header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 1);
  }

  .editGuestTeamPower .dialog-footer {
    text-align: center;
    background-color: rgba(248, 250, 251, 1);
    padding-bottom: 20px;
  }

  .editGuestTeamPower .el-dialog__footer {
    padding: 0;
  }
</style>
<template>
  <el-dialog @closed="closedDialog" :modal="false" width="400px" :visible.sync="dialogTableVisible"
    :close-on-click-modal="false" class="editGuestTeamPower">
    <div class="add-tit" slot="title">
      <p><span></span>编辑权限</p>
      <span icon="el-icon-close"></span>
    </div>
    <div class="form-box">
      <el-form :model="form" ref="form" class="MyEditForm">
        <div class="MyEditForm-item">
          <el-form-item label="权限" class="label-pad-left form-check">
            <div class="pad-left-10">
              <el-radio v-model="form.IsRead" :label="0">只读</el-radio>
              <el-radio v-model="form.IsRead" :label="1">读写</el-radio>
            </div>
          </el-form-item>
        </div>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" class="add-box-btn" @click="submitForm('form')">确 定</el-button>
      <el-button class="add-box-btn add-box-cancel" @click="dialogTableVisible = false, resetForm('form')">取 消
      </el-button>
    </div>
  </el-dialog>
</template>
<script>
  export default {
    props: {
      Ids: {
        type: String,
        default: 0,
      },
    },
    data() {
      return {
        dialogTableVisible: true,
        zwList: [],
        form: {
          Ids: "",
          IsRead: 1,
        },
      };
    },
    watch: {},
    mounted() {
      let $this = this;
      setTimeout(() => {
        $this.dialogTableVisible = true;
      }, 50);
    },
    methods: {
      closedDialog() {
        this.MsgBus.$emit("success");
      },
      addData() {
        this.form.Ids = this.Ids;
        this.apipost(
          "/api/SellEvent/SetTravelGuestTeamPower",
          this.form,
          (res) => {
            if (res.data.resultCode == 1) {
              this.$message.success("操作成功");
              this.resetForm("form");
              this.dialogTableVisible = false;
              this.$emit("success");
            }
          }
        );
      },
      submitForm(addMsg) {
        //提交创建、修改表单
        this.$refs[addMsg].validate((valid) => {
          if (valid) {
            this.addData();
          } else {
            return false;
          }
        });
      },
      resetForm(formName) {
        // 重置表单
        this.form = {
          Ids: "",
          IsRead: 0,
        };
        this.$refs[formName].resetFields();
      },
    },
  };
</script>