<template>
  <div :class="{'active':searchData.isCked}">
    <div class="diy-component-options" v-if="searchData.isCked">
      <el-button type="primary" icon="el-icon-delete" style="left: -25px; top: 0px;" @click="delPlugin()"></el-button>
      <el-button type="primary" icon="el-icon-document-copy" style="left: -25px; top: 30px;"></el-button>
      <el-button type="primary" icon="el-icon-arrow-up" v-if="index>0" @click="resetSord(0)"
        style="right: -25px; top: 0;"></el-button>
      <el-button type="primary" icon="el-icon-arrow-down" v-if="index!=dataLeng-1" @click="resetSord(1)"
        style="right: -25px; top: 30px;"></el-button>
    </div>
    <div class="diy-component-preview">
      <div class="diy-search">
        <el-form label-width="90px">
          <el-form-item :label="searchData.CompData.Name" :required="searchData.CompData.IsRequire"
            style="margin-bottom:0">
            <el-select v-model="defaultValue" disabled style="width:328px;"></el-select>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="diy-component-edit" v-if="searchData.isCked">
      <el-form label-width="100px">
        <el-form-item label="名称" required>
          <el-input v-model="searchData.CompData.Name" size="small"></el-input>
        </el-form-item>
        <el-form-item label="是否多选">
          <el-switch v-model="searchData.CompData.IsMultiple">
          </el-switch>
        </el-form-item>
        <el-form-item label="是否必填">
          <el-switch v-model="searchData.CompData.IsRequire">
          </el-switch>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
  export default {
    props: ["searchData", "index", "dataLeng"],
    data() {
      return {
        defaultValue:''
      };
    },
    created() {},
    methods: {
      //向父组件传值 并调用排序
      resetSord(IsUp) {
        this.$emit('getSord', this.index, IsUp);
      },
      //点击触发父组件删除
      delPlugin() {
        this.$emit('comDelPlugin', this.index);
      }
    },
    mounted() {}
  };

</script>
