<template>
  <div id="person">
    <el-col :span="24" class="info">
      <van-form @submit="onSubmit">
        <van-field
          v-model="form.title"
          name="对接会标题"
          label="对接会标题"
          placeholder="请输入对接会标题"
          :rules="[{ required: true, message: '请输入对接会标题' }]"
          disabled
        />

        <van-field
          v-model="form.start_time"
          name="开始时间"
          label="开始时间"
          placeholder="请输入开始时间"
          :rules="[{ required: true, message: '请输入开始时间' }]"
          disabled
        />

        <van-field
          v-model="form.join_end"
          name="截止时间"
          label="截止时间"
          placeholder="请输入截止时间"
          :rules="[{ required: true, message: '请输入截止时间' }]"
          disabled
        />
      </van-form>

      <el-form ref="form" :model="form" label-width="58px">
        <el-form-item label="省份">
          <el-select v-model="form.province" placeholder="请选择省份" @change="changeshenge">
            <el-option v-for="item in option" :key="item.code" :label="item.name" :value="item.code" disabled> </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="市">
          <el-select v-model="form.place" placeholder="请选择市">
            <el-option v-for="item in options" :key="item.code" :label="item.name" :value="item.code" disabled> </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="简介">
          <el-input type="textarea" v-model="form.desc" disabled></el-input>
        </el-form-item>

        <el-form-item label="对接会视频">
          <upload :limit="1" :data="form.file_path" type="file_path" listType="" :url="'/files/imgpath/upload'" @upload="uploadSuccess" disabled></upload>
        </el-form-item>

        <el-form-item label="状态" :disabled="true">
          <el-radio v-model="form.status" label="1">开始</el-radio>
          <el-radio v-model="form.status" label="2">结束</el-radio>
        </el-form-item>
      </el-form>

      <div style="margin: 16px;">
        <van-button round block type="info" native-type="submit" @click="onSubmit">
          保存
        </van-button>
      </div>
    </el-col>
  </div>
</template>

<script>
import upload from '@/components/upload.vue';
export default {
  name: 'person',
  props: {
    form: null,
    option: null,
    options: null,
  },
  components: {
    upload,
  },
  data: () => ({
    // 出生日期
  }),
  created() {},
  computed: {
    id() {
      return this.$route.query.id;
    },
  },
  methods: {
    changeshenge(value) {
      this.$emit('placesubmit', { value });
    },
    onSubmit() {
      console.log(this.form);

      this.$emit('onSubmit', { data: this.form });
    },
    // 图片上传
    uploadSuccess({ type, data }) {
      console.log(type, data);
      this.$set(this.form, `${type}`, data.uri);
    },
  },
};
</script>

<style lang="less" scoped>
.info {
  margin: 0 0 50px 0;
}
</style>
