answerList.vue 6.0 KB

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