userAskList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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
  26. type="primary"
  27. @click="onExport"
  28. v-if="$helpers.permission('questionnaireUserResult/export')"
  29. >导出</el-button
  30. > -->
  31. </el-form-item>
  32. </save-form>
  33. <div class="tableWrap" v-if="tableList.length > 0">
  34. <el-table
  35. :data="tableList"
  36. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  37. >
  38. <el-table-column
  39. align="center"
  40. :label="item.content"
  41. v-for="(item, index) in tableList[0].questionnaireResultDtoList"
  42. :key="item.userId"
  43. >
  44. <template slot-scope="scope">
  45. <div v-if=" scope.row.questionnaireResultDtoList[index]&&scope.row.questionnaireResultDtoList[index].type">
  46. <p v-if=" scope.row.questionnaireResultDtoList[index].type == 'radio'">
  47. {{
  48. scope.row.questionnaireResultDtoList[index].questionnaireQuestionItemIdList=='true' ? "是" : "否"
  49. }}
  50. </p>
  51. <p v-if="scope.row.questionnaireResultDtoList[index].type == 'checkbox'">
  52. {{ scope.row.questionnaireResultDtoList[index].answerValue }}
  53. </p>
  54. <p v-if="scope.row.questionnaireResultDtoList[index].type == 'textarea'">
  55. <overflow-text :text="scope.row.questionnaireResultDtoList[index].additionalValue" />
  56. </p>
  57. <div v-if="scope.row.questionnaireResultDtoList[index].type == 'file'">
  58. <p
  59. v-for="(url, index) in JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue)"
  60. :key="index"
  61. >
  62. <a :href="url.url">{{ url.name }}</a>
  63. </p>
  64. </div>
  65. <div v-if="scope.row.questionnaireResultDtoList[index].type == 'image'" >
  66. <div v-if="JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).length > 0" class="imgWrap">
  67. <el-image
  68. class="refImg"
  69. ref='refImg'
  70. style="width: 50px; height: 50px;margin-right:5px"
  71. :src="JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue)[0].url"
  72. :preview-src-list="[
  73. ...JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).map(item=>{return item.url})
  74. ]"
  75. >
  76. </el-image>
  77. <div class="moreImg">
  78. +{{JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).length-1}}
  79. </div>
  80. </div>
  81. <span v-else>--</span>
  82. </div>
  83. </div>
  84. <p v-else>--</p>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. </div>
  89. <empty v-if="tableList.length <= 0" />
  90. <pagination
  91. sync
  92. :total.sync="pageInfo.total"
  93. :page.sync="pageInfo.page"
  94. :limit.sync="pageInfo.limit"
  95. :page-sizes="pageInfo.page_size"
  96. @pagination="getList"
  97. />
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import { questionnaireUserResult } from "./api";
  103. import { Export } from "@/utils/downLoadFile";
  104. import pagination from "@/components/Pagination/index";
  105. export default {
  106. name: "operationQuestion",
  107. components: { pagination },
  108. data() {
  109. let query = this.$route.query;
  110. let titleName = "问答详情";
  111. return {
  112. titleName: query.name,
  113. id: query.id,
  114. searchForm: {
  115. search: null,
  116. },
  117. tableList: [],
  118. pageInfo: {
  119. // 分页规则
  120. limit: 10, // 限制显示条数
  121. page: 1, // 当前页
  122. total: 0, // 总条数
  123. page_size: [10, 20, 40, 50], // 选择限制显示条数
  124. },
  125. };
  126. },
  127. async mounted() {
  128. this.getList();
  129. },
  130. methods: {
  131. search() {
  132. this.pageInfo.page = 1;
  133. this.getList();
  134. },
  135. onReSet() {
  136. this.$refs.searchForm.resetFields();
  137. this.search();
  138. },
  139. async getList() {
  140. try {
  141. let params = {
  142. topicId: this.id,
  143. page: this.pageInfo.page,
  144. rows: this.pageInfo.limit,
  145. ...this.searchForm,
  146. };
  147. console.log(params);
  148. let result = await questionnaireUserResult(params);
  149. this.tableList = result.data.rows;
  150. this.pageInfo.total = result.data.total;
  151. } catch {}
  152. },
  153. onCancel() {
  154. this.$store.dispatch("delVisitedViews", this.$route);
  155. this.$router.push({ path: "/operateManager/setQuestions" });
  156. },
  157. // onExport() {
  158. // Export(
  159. // this,
  160. // {
  161. // url: "/api-web/questionnaireUserResult/export",
  162. // fileName: "问答详情.xls",
  163. // method: "get",
  164. // params: { cooperationId: this.id, activeType: "REPLACEMENT" },
  165. // },
  166. // "您确定导出问答详情?"
  167. // );
  168. // },
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. .box-card {
  174. margin-bottom: 10px;
  175. }
  176. /deep/.el-collapse-item__header {
  177. background: #edeef0;
  178. color: #444;
  179. padding: 0 10px;
  180. }
  181. /deep/.el-collapse-item__wrap {
  182. border: 0;
  183. }
  184. /deep/.el-collapse-item__content {
  185. padding-bottom: 0;
  186. }
  187. .demo-table-expand {
  188. font-size: 0;
  189. }
  190. .demo-table-expand label {
  191. width: 90px;
  192. color: #99a9bf;
  193. }
  194. .demo-table-expand .el-form-item {
  195. margin-right: 0;
  196. margin-bottom: 0;
  197. width: 300px;
  198. span {
  199. width: 200px;
  200. }
  201. }
  202. .imgWrap {
  203. display: flex;
  204. flex-direction: row;
  205. justify-content: center;
  206. align-items: center;
  207. }
  208. .moreImg {
  209. width: 50px;
  210. height: 50px;
  211. background-color: #999;
  212. line-height: 50px;
  213. text-align: center;
  214. color: #fff;
  215. }
  216. </style>
  217. <style lang="css">
  218. .el-image-viewer__close {
  219. top: 40px;
  220. right: 40px;
  221. width: 40px;
  222. height: 40px;
  223. font-size: 24px;
  224. color: #fff;
  225. background-color: #606266;
  226. }
  227. </style>