<template>
  <div class="addFormBox">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px" class="addForm" label-position="top">
      <el-form-item
        label="页面说明："
        class="addTipMsg"
      >可新建版权方信息。创建展板内容，“*”为必填项，音频资料支持汉语、蒙语、藏语、维吾尔语、英语五种言音频上传，参考资料支持多文件上传。</el-form-item>
      <div class="addTitle">展板基本信息</div>
      <el-form-item label="展板名称" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="展板版权方">
        <el-select v-model="ruleForm.desc" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
       <el-form-item label="展板分类">
        <el-select v-model="ruleForm.desc" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="展板图片">
        
      </el-form-item>
      <el-form-item label="展板二维码">
        
      </el-form-item>

      <el-form-item label="展板介绍">
        <el-input type="textarea" v-model="ruleForm.desc"></el-input>
      </el-form-item>
      <div class="addTitle">展板影音信息</div> 
      <el-form-item label="视频版权方">
        <el-select v-model="ruleForm.desc" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="视频类别">
        <el-select v-model="ruleForm.desc" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="视频">
        <el-select v-model="ruleForm.desc" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="导览音频">
        
      </el-form-item>
      <el-form-item label="参考资料">
        
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
        <el-button @click="resetForm('ruleForm')">取消</el-button>
      </el-form-item>
      
    </el-form>
    <!--新增弹框-->
    <el-dialog
      custom-class="party-dialog"
      title="新建视频分类"
      width="468px"
      :visible.sync="dialogVisible"
      :before-close="close"
    >
      <div class="dialog-content">
        <el-form
          :model="classForm"
          ref="classForm"
          label-width="80px"
          label-position="top"
          :rules="rules"
          id="ruleo"
          class="party-form"
        >
          <el-form-item label="视频分类名称" prop="name">
            <el-input v-model="classForm.name"></el-input>
          </el-form-item>
          <el-form-item label="备注">
            <el-input type="textarea" v-model="classForm.desc"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer btn-group">
        <el-button size="mini" type="primary" @click="save">确定</el-button>
        <el-button size="mini" @click="close">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      options: [
        {
          value: "选项1",
          label: "黄金糕"
        },
        {
          value: "选项2",
          label: "双皮奶"
        },
        {
          value: "选项3",
          label: "蚵仔煎"
        },
        {
          value: "选项4",
          label: "龙须面"
        },
        {
          value: "选项5",
          label: "北京烤鸭"
        }
      ],
      dialogVisible: false,
      formLabelWidth: "100px",
      form: {
        name: ""
      },
      classForm: {
        menuName: "",
        menuUrl: "",
        parentId: "",
        sort: ""
      },
      value1: "",
      ruleForm: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      departments: [
        {
          value: "Beijing",
          label: "北京"
        },
        {
          value: "Shanghai",
          label: "上海"
        },
        {
          value: "Nanjing",
          label: "南京"
        },
        {
          value: "Chengdu",
          label: "成都"
        },
        {
          value: "Shenzhen",
          label: "深圳"
        },
        {
          value: "Guangzhou",
          label: "广州"
        }
      ],

      checkedThing: false,
      department: [],

      selfstyle: {
        textAlign: "right",
        width: "100%",
        paddingRight: "10px"
      },
      rules: {
        name: [
          { required: true, message: "请输入版权方名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ],
        region: [
          { required: true, message: "请选择活动区域", trigger: "change" }
        ],
        date1: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "change"
          }
        ],
        date2: [
          {
            type: "date",
            required: true,
            message: "请选择时间",
            trigger: "change"
          }
        ],
        type: [
          {
            type: "array",
            required: true,
            message: "请至少选择一个活动性质",
            trigger: "change"
          }
        ],
        resource: [
          { required: true, message: "请选择活动资源", trigger: "change" }
        ],
        desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }]
      }
    };
  },
  methods: {
    // 新建视频分类
    addVideoClass() {
      this.dialogVisible = true;
    },
    save() {
      this.dialogVisible = false;
    },
    // 新增关闭
    close() {
      this.dialogVisible = false;
      for (let key in this.classForm) {
        this.classForm[key] = null;
      }
      this.$refs["classForm"].resetFields();
    },
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      history.go(-1);
    },
    getSelectDep(department) {
      //   debugger

      if (department.length === this.departments.length) {
        this.checkedThing = true;
      } else {
        this.checkedThing = false;
      }
    },

    selectAllThing() {
      // debugger
      this.department = [];
      if (this.checkedThing) {
        this.departments.map(item => {
          this.department.push(item.label);
        });
      } else {
        this.department = [];
      }
    }
  }
};
</script>
<style lang="less">
@import "../../style/add";
@import "../../../../style/dialog";
</style>