userAskList.vue 6.8 KB

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