<template>
  <div>
    <el-form ref="form" label-width="80px">
      <el-form-item label="工作地点" style="text-align: left">
        <el-select v-model="media.address" placeholder="工作地点">
          <el-option label="珠海" value="珠海"></el-option>
          <el-option label="芜湖" value="芜湖"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="岗位类别" style="text-align: left">
        <el-select v-model="media.type" placeholder="岗位类别">
          <el-option label="开发类" value="开发类"></el-option>
          <el-option label="设计类" value="设计类"></el-option>
          <el-option label="硬件类" value="硬件类"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="语言" style="text-align: left">
        <el-select v-model="media.language" placeholder="语言">
          <el-option label="中文" :value="1"></el-option>
          <el-option label="英文" :value="2"></el-option>
          <el-option label="德文" :value="3"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="人数">
        <el-input v-model="media.count"></el-input>
      </el-form-item>
      <el-form-item label="岗位">
        <el-input v-model="media.title"></el-input>
      </el-form-item>
      <el-form-item label="职位描述">
        <div style="padding-right: 10%; position: relative">
          <el-button type="primary" @click="media.describe.push('')" circle class="addText" icon="el-icon-plus"></el-button>
          <el-input type="text" v-model="media.describe[k]" v-for="(t, k) in media.describe" :key="k" style="margin-bottom: 10px"></el-input>
        </div>
      </el-form-item>
      <el-form-item label="任职要求">
        <div style="padding-right: 10%; position: relative">
          <el-button type="primary" @click="media.requirement.push('')" circle class="addText" icon="el-icon-plus"></el-button>
          <el-input type="text" v-model="media.requirement[k]" v-for="(t, k) in media.requirement" :key="k" style="margin-bottom: 10px"></el-input>
        </div>
      </el-form-item>
      <el-form-item label="加分项">
        <div style="padding-right: 10%; position: relative">
          <el-button type="primary" @click="media.bonus.push('')" circle class="addText" icon="el-icon-plus"></el-button>
          <el-input type="text" v-model="media.bonus[k]" v-for="(t, k) in media.bonus" :key="k" style="margin-bottom: 10px"></el-input>
        </div>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="$emit('submit', media)">{{media.id ? '修改' : '创建'}}</el-button>
        <el-button @click="$emit('quit')">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: ['datap'],
  data () {
    return {
      media: {
        ...this.datap
      }
    }
  }
}
</script>

<style scoped>
  .addText {
    position: absolute;
    right: 0;
    top: 0;
  }
</style>
