datiList.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-form ref="form" :model="form">
  6. <el-col :span="24" class="topTitle">
  7. {{ datilist.name }}
  8. </el-col>
  9. <el-col :span="24" v-for="(item, index) in datilist.question" :key="index">
  10. <el-form-item>
  11. <span slot="label">{{ index + 1 }} . {{ item.topic }}</span>
  12. </el-form-item>
  13. <template v-if="item.type === '0'">
  14. <el-col :span="24" v-for="(items, index) in item.option" :key="index">
  15. <el-radio v-model="item.answers" :label="items.number">{{ items.number }}</el-radio>
  16. </el-col>
  17. </template>
  18. <template v-else-if="item.type === '1'">
  19. <el-checkbox-group v-model="item.answers">
  20. <el-col :span="24" v-for="(items, index) in item.option" :key="index">
  21. <el-checkbox :label="items.number">{{ items.opname }}</el-checkbox>
  22. </el-col>
  23. </el-checkbox-group>
  24. </template>
  25. <span v-else>
  26. <el-input
  27. type="textarea"
  28. placeholder="请输入内容"
  29. v-model="item.answers"
  30. :autosize="{ minRows: 4, maxRows: 6 }"
  31. maxlength="300"
  32. show-word-limit
  33. ></el-input>
  34. </span>
  35. </el-col>
  36. <el-col :span="24" class="btn">
  37. <el-button type="primary" @click="onSubmit">提交</el-button>
  38. </el-col>
  39. </el-form>
  40. </el-col>
  41. </el-row>
  42. </div>
  43. </template>
  44. <script>
  45. import _ from 'lodash';
  46. export default {
  47. name: 'index',
  48. props: {
  49. form: null,
  50. datilist: null,
  51. answer: null,
  52. },
  53. components: {},
  54. data: () => ({}),
  55. created() {},
  56. computed: {},
  57. methods: {
  58. onSubmit() {
  59. this.$emit('submit');
  60. },
  61. },
  62. };
  63. </script>
  64. <style lang="less" scoped>
  65. .style {
  66. min-height: 300px;
  67. padding: 0 40px;
  68. }
  69. .topTitle {
  70. text-align: center;
  71. height: 50px;
  72. line-height: 50px;
  73. border-bottom: 1px dashed #333;
  74. }
  75. /deep/.el-form-item {
  76. margin: 0;
  77. }
  78. /deep/.el-form-item__label {
  79. color: #389ff0;
  80. }
  81. .btn {
  82. text-align: center;
  83. padding: 30px 0;
  84. }
  85. </style>