<!--
  门店权限设置组件

 -->
<template>
  <div class="permiss-wrap">
    <el-form label-width="110px" :model="ruleForm">
      <el-form-item label="店员可见权限">
        <el-radio v-model="ruleForm.radio" label="0">可见所有品牌门店架构和行政架构</el-radio>
      </el-form-item>
      <div class="permiss-child-cell">
        <p>允许指定部门/人员可见:</p>

      </div>
      <el-form-item label=" ">
        <el-radio v-model="ruleForm.radio" label="1">可见所在品牌门店架构和行政架构</el-radio>
      </el-form-item>
      <el-form-item label=" ">
        <el-radio v-model="ruleForm.radio" label="2">门店仅可见所有品牌门店架构</el-radio>
      </el-form-item>
      <el-form-item label=" ">
        <el-radio v-model="ruleForm.radio" label="3"> 门店仅可见自己品牌门店架构</el-radio>
      </el-form-item>
      <el-form-item label=" ">
        <el-radio v-model="ruleForm.radio" label="4">门店仅可见自己门店</el-radio>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import strLength from '@/common/js/strlen';
import showMsg from '@/common/js/showmsg';
import errMsg  from '@/common/js/error';
import { _debounce } from "@/common/js/public";
import { getRequest, postRequest, postJson, postForm } from '@/api/api';
export default {
  name: "",
  props: {
    imgSrc: {// 传入 input value
      type: String,
      default: ''
    },
    field: {
      type: String,
      default: ''
    },
    uploadLimit: {
      type: Number,
      default: 2
    }

  },
  data() {
    return {
      projectName:  '', // 当前项目名
      imgShowFlag: false, // 是否弹框显示,true: 显示；false: 不显示
      imgUrl: '', // 传递的图片 src

      ruleForm: {
        radio: '0',
        visibleAll: [
          {
            id: '1',
            type: 'people',
            name: '张三',
            img: 'http://thirdwx.qlogo.cn/mmopen/j7nX4OeBsXRNyvh6micCywssVEYCaWiaicUZq5Vn2zWktWLAyRvEAH7icQmUhLze8rrQYpM5ptwZ2RL7cX0icyBbiavhYFNTIZhibKu/0'
          },
          {
            id: '1',
            type: 'store',
            name: '张三',
          }
        ],
        storeVisibleAll: [],
        storeOwnBrand: [],
        storeOwnStore: []
      }
    }
  },
  beforeMount() {
    var that = this
    var host = window.location.origin;
    console.log("当前host:",host)
    if (host.indexOf('localhost') != '-1') {
      that.baseUrl = 'http://gicdev.demogic.com';
    }else {
      that.baseUrl = host
    }

  },
  methods: {
    /**
     * 保存
     */
    submitForm: _debounce(function(formName) {
      const that = this;
      that.$refs[formName].validate((valid) => {
        console.log(valid)
        if (valid) {

        } else {
          return false;
        }
      });
    },500),


    /**
     *
     */

  },
  mounted() {

  },
}
</script>
<style lang="less" scoped>

.w-500 {
  width: 500px;
}

/* flex */
.flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.flex-1 {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.flex-column {
  -webkit-flex-direction: column;
  -moz-flex-direction: column;
  -ms-flex-direction: column;
  -o-flex-direction: column;
  flex-direction: column;
}

.flex-row {
  -webkit-flex-direction: row;
  -moz-flex-direction: row;
  -ms-flex-direction: row;
  -o-flex-direction: row;
  flex-direction: row;
}

.flex-align-center {
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}

.flex-pack-center {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 180px;
  height: 180px;
  line-height: 180px;
  text-align: center;
}
.avatar {
  max-width: 180px;
  max-height: 180px;
  display: block;
}

.upload-tip {
  color: #606266;
  font-size: 12px;
  line-height: 20px;
}

.color-1890ff {
  color: #1890ff;
}

.permiss-wrap {

}
</style>
