<style>
.editTeamPower .add-tit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 20px;
}
.editTeamPower .add-tit p {
  display: flex;
  align-items: center;
  font-weight: bold;
  color: rgba(17, 17, 17, 1);
  font-size: 14px;
}
.editTeamPower .add-tit p span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #409efe;
  border-radius: 50%;
  margin-right: 10px;
}
.editTeamPower .el-dialog__header {
  padding: 15px 20px;
  background: rgba(255, 255, 255, 1);
}
.editTeamPower .dialog-footer {
  text-align: center;
  background-color: rgba(248, 250, 251, 1);
  padding-bottom: 20px;
}
.editTeamPower .el-dialog__footer {
  padding: 0;
}
</style>
<template>
    <el-dialog @closed="closedDialog" :modal="false" width="400px"  :visible.sync="dialogTableVisible" :close-on-click-modal="false" class="editTeamPower">
        <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="1">只读</el-radio>
                            <el-radio v-model="form.IsRead" :label="0">读写</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: {
    ID: {
      type: "",
      default: 0,
    },
    BusinessId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      dialogTableVisible: true,
      zwList: [],
      form: {
        BusinessId: 0,
        ID: "",
        IsRead: 1,
      },
    };
  },
  watch: {},
  mounted() {
    let $this = this;
    setTimeout(() => {
      $this.dialogTableVisible = true;
    }, 50);
  },
  methods: {
    closedDialog() {
      this.MsgBus.$emit("closeeditTeamPower");
    },
    addData() {
      this.form.BusinessId = this.BusinessId;
      this.form.IDs = this.ID;
      this.apipost(
        "/api/Customer/EditBusinessListJurisdiction",
        this.form,
        (res) => {
          if (res.data.resultCode == 1) {
            this.$message.success("操作成功");
            this.resetForm("form");
            this.dialogTableVisible = false;
            this.$emit("addTeammanOk");
          }
        }
      );
    },
    submitForm(addMsg) {
      //提交创建、修改表单
      this.$refs[addMsg].validate((valid) => {
        if (valid) {
          this.addData();
        } else {
          return false;
        }
      });
    },
    resetForm(formName) {
      // 重置表单
      this.form = {
        BusinessId: 0,
        ID: "",
        IsRead: 0,
      };
      this.$refs[formName].resetFields();
    },
  },
};
</script>
