<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="style">
        <el-form ref="form" :model="form">
          <el-col :span="24" class="topTitle">
            {{ datilist.name }}
          </el-col>
          <el-col :span="24" v-for="(item, index) in datilist.question" :key="index">
            <el-form-item>
              <span slot="label">{{ index + 1 }} . {{ item.topic }}</span>
            </el-form-item>
            <template v-if="item.type === '0'">
              <el-col :span="24" v-for="(items, index) in item.option" :key="index">
                <el-radio v-model="item.answers" :label="items.number">{{ items.number }}</el-radio>
              </el-col>
            </template>
            <template v-else-if="item.type === '1'">
              <el-checkbox-group v-model="item.answers">
                <el-col :span="24" v-for="(items, index) in item.option" :key="index">
                  <el-checkbox :label="items.number">{{ items.opname }}</el-checkbox>
                </el-col>
              </el-checkbox-group>
            </template>
            <span v-else>
              <el-input
                type="textarea"
                placeholder="请输入内容"
                v-model="item.answers"
                :autosize="{ minRows: 4, maxRows: 6 }"
                maxlength="300"
                show-word-limit
              ></el-input>
            </span>
          </el-col>
          <el-col :span="24" class="btn">
            <el-button type="primary" @click="onSubmit">提交</el-button>
          </el-col>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import _ from 'lodash';
export default {
  name: 'index',
  props: {
    form: null,
    datilist: null,
    answer: null,
  },
  components: {},
  data: () => ({}),
  created() {},
  computed: {},
  methods: {
    onSubmit() {
      this.$emit('submit');
    },
  },
};
</script>
<style lang="less" scoped>
.style {
  min-height: 300px;
  padding: 0 40px;
}
.topTitle {
  text-align: center;
  height: 50px;
  line-height: 50px;
  border-bottom: 1px dashed #333;
}
/deep/.el-form-item {
  margin: 0;
}
/deep/.el-form-item__label {
  color: #389ff0;
}
.btn {
  text-align: center;
  padding: 30px 0;
}
</style>
