answerList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class='m-container'>
  3. <h2>
  4. <el-page-header @back="onCancel" :content="titleName"></el-page-header>
  5. </h2>
  6. <div class="m-core">
  7. <save-form
  8. :inline="true"
  9. ref="searchForm"
  10. :model="searchForm"
  11. @submit="search"
  12. @reset="onReSet"
  13. >
  14. <el-form-item prop="search">
  15. <el-input
  16. v-model.trim="searchForm.search"
  17. clearable
  18. @keyup.enter.native="search"
  19. placeholder="编号/姓名/手机号"
  20. ></el-input>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button native-type="submit" type="primary">搜索</el-button>
  24. <el-button native-type="reset" type="danger">重置</el-button>
  25. <el-button type="primary" @click="onExport" v-if="$helpers.permission('questionnaireUserResult/export')">导出</el-button>
  26. </el-form-item>
  27. </save-form>
  28. <el-card class="box-card" v-for="item in tableList" :key="item.id">
  29. <el-row>
  30. <el-col :xs="24" :sm="24" :md="6" :lg="5" :xl="5">
  31. <el-form label-position="left" inline label-width="90px" class="demo-table-expand">
  32. <el-form-item label="学生编号">
  33. <span><copy-text>{{ item.userId}}</copy-text></span>
  34. </el-form-item>
  35. <el-form-item label="学生姓名">
  36. <span><copy-text>{{ item.username}}</copy-text></span>
  37. </el-form-item>
  38. <el-form-item label="学生手机号">
  39. <span><copy-text>{{ item.phone}}</copy-text></span>
  40. </el-form-item>
  41. </el-form>
  42. <!-- <el-row :gutter="10" style="font-size: 14px">
  43. <el-col :span="24" style="padding-bottom: 8px"><>学生编号:<copy-text>{{ item.userId}}</copy-text></el-col>
  44. <el-col :span="24" style="padding-bottom: 8px">学生姓名:<copy-text>{{ item.username}}</copy-text></el-col>
  45. <el-col :span="24" style="padding-bottom: 8px">学生手机号:<copy-text>{{ item.phone}}</copy-text></el-col>
  46. </el-row> -->
  47. </el-col>
  48. <el-col :xs="24" :sm="24" :md="18" :lg="19" :xl="19">
  49. <el-collapse>
  50. <el-collapse-item title="查看答案" name="1">
  51. <div v-for="(o, index) in item.questionnaireResultDtoList" :key="index" class="text item">
  52. <el-alert :title="o.content" type="info" :closable="false"></el-alert>
  53. <div style="padding: 8px 20px; font-size: 14px;" v-if="o.answerValue || o.additionalValue">{{ o.answerValue ? o.answerValue : o.additionalValue }}</div>
  54. <!-- <div style="padding: 8px 20px; font-size: 14px;" v-else>未答题</div> -->
  55. <el-tag style="margin: 8px 20px; font-size: 14px;" type="danger" v-else>未答题</el-tag>
  56. </div>
  57. </el-collapse-item>
  58. </el-collapse>
  59. <!-- <div v-for="(o, index) in item.questionnaireResultDtoList" :key="index" class="text item">
  60. <el-alert :title="o.content" type="info" :closable="false"></el-alert>
  61. <div style="padding: 8px 20px; font-size: 14px;">{{ o.answerValue }}</div>
  62. </div> -->
  63. </el-col>
  64. </el-row>
  65. </el-card>
  66. <empty v-if="tableList.length <= 0" />
  67. <pagination
  68. sync
  69. :total.sync="pageInfo.total"
  70. :page.sync="pageInfo.page"
  71. :limit.sync="pageInfo.limit"
  72. :page-sizes="pageInfo.page_size"
  73. @pagination="getList"
  74. />
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { questionnaireUserResultQueryPage } from './api'
  80. import { Export } from '@/utils/downLoadFile'
  81. import pagination from "@/components/Pagination/index";
  82. export default {
  83. name: 'operationQuestion',
  84. components: { pagination },
  85. data () {
  86. let query = this.$route.query
  87. let titleName = '问答详情'
  88. return {
  89. titleName: titleName,
  90. id: query.id,
  91. topicId: query.topicId,
  92. searchForm: {
  93. search: null,
  94. },
  95. tableList: [],
  96. pageInfo: {
  97. // 分页规则
  98. limit: 10, // 限制显示条数
  99. page: 1, // 当前页
  100. total: 0, // 总条数
  101. page_size: [10, 20, 40, 50], // 选择限制显示条数
  102. },
  103. }
  104. },
  105. async mounted () {
  106. this.getList()
  107. },
  108. methods: {
  109. search() {
  110. this.pageInfo.page = 1;
  111. this.getList();
  112. },
  113. onReSet() {
  114. this.$refs.searchForm.resetFields();
  115. this.search();
  116. },
  117. async getList() {
  118. try {
  119. let params = {
  120. activeId: this.id,
  121. activeType: 'REPLACEMENT',
  122. page: this.pageInfo.page,
  123. rows: this.pageInfo.limit,
  124. ...this.searchForm
  125. }
  126. let result = await questionnaireUserResultQueryPage(params)
  127. this.tableList = result.data.rows
  128. this.pageInfo.total = result.data.total
  129. } catch {
  130. }
  131. },
  132. onCancel() {
  133. this.$store.dispatch('delVisitedViews', this.$route)
  134. this.$router.push({ path: '/otherManager/reaplceMusicPlayer' })
  135. },
  136. onExport() {
  137. Export(this, {
  138. url: '/api-web/questionnaireUserResult/export',
  139. fileName: '问答详情.xls',
  140. method: 'get',
  141. params: { cooperationId: this.id }
  142. }, '您确定导出问答详情?')
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .box-card {
  149. margin-bottom: 10px;
  150. }
  151. /deep/.el-collapse-item__header {
  152. background: #EDEEF0;
  153. color: #444;
  154. padding: 0 10px;
  155. }
  156. /deep/.el-collapse-item__wrap {
  157. border: 0;
  158. }
  159. /deep/.el-collapse-item__content {
  160. padding-bottom: 0;
  161. }
  162. .demo-table-expand {
  163. font-size: 0;
  164. }
  165. .demo-table-expand label {
  166. width: 90px;
  167. color: #99a9bf;
  168. }
  169. .demo-table-expand .el-form-item {
  170. margin-right: 0;
  171. margin-bottom: 0;
  172. width: 100%;
  173. }
  174. </style>