123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template>
- <div class="m-container">
- <h2>
- <el-page-header @back="onCancel" :content="titleName"></el-page-header>
- </h2>
- <div class="m-core">
- <save-form
- :inline="true"
- ref="searchForm"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- >
- <el-form-item prop="search">
- <el-input
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="search"
- placeholder="请输入搜索内容"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- <!-- <el-button
- type="primary"
- @click="onExport"
- v-if="$helpers.permission('questionnaireUserResult/export')"
- >导出</el-button
- > -->
- </el-form-item>
- </save-form>
- <div class="tableWrap" v-if="tableList.length > 0">
- <el-table
- :data="tableList"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- >
- <el-table-column
- align="center"
- :label="item.content"
- v-for="(item, index) in tableList[0].questionnaireResultDtoList"
- :key="item.userId"
- >
- <template slot-scope="scope">
- <div v-if=" scope.row.questionnaireResultDtoList[index]&&scope.row.questionnaireResultDtoList[index].type">
- <p v-if=" scope.row.questionnaireResultDtoList[index].type == 'radio'">
- {{
- scope.row.questionnaireResultDtoList[index].questionnaireQuestionItemIdList=='true' ? "是" : "否"
- }}
- </p>
- <p v-if="scope.row.questionnaireResultDtoList[index].type == 'checkbox'">
- {{ scope.row.questionnaireResultDtoList[index].answerValue }}
- </p>
- <p v-if="scope.row.questionnaireResultDtoList[index].type == 'textarea'">
- <overflow-text :text="scope.row.questionnaireResultDtoList[index].additionalValue" />
- </p>
- <div v-if="scope.row.questionnaireResultDtoList[index].type == 'file'">
- <p
- v-for="(url, index) in JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue)"
- :key="index"
- >
- <a :href="url.url">{{ url.name }}</a>
- </p>
- </div>
- <div v-if="scope.row.questionnaireResultDtoList[index].type == 'image'" >
- <div v-if="JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).length > 0" class="imgWrap">
- <el-image
- class="refImg"
- ref='refImg'
- style="width: 50px; height: 50px;margin-right:5px"
- :src="JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue)[0].url"
- :preview-src-list="[
- ...JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).map(item=>{return item.url})
- ]"
- >
- </el-image>
- <div class="moreImg">
- +{{JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue).length-1}}
- </div>
- </div>
- <span v-else>--</span>
- </div>
- </div>
- <p v-else>--</p>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <empty v-if="tableList.length <= 0" />
- <pagination
- sync
- :total.sync="pageInfo.total"
- :page.sync="pageInfo.page"
- :limit.sync="pageInfo.limit"
- :page-sizes="pageInfo.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- </template>
- <script>
- import { questionnaireUserResult } from "./api";
- import { Export } from "@/utils/downLoadFile";
- import pagination from "@/components/Pagination/index";
- export default {
- name: "operationQuestion",
- components: { pagination },
- data() {
- let query = this.$route.query;
- let titleName = "问答详情";
- return {
- titleName: query.name,
- id: query.id,
- searchForm: {
- search: null,
- },
- tableList: [],
- pageInfo: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- };
- },
- async mounted() {
- this.getList();
- },
- methods: {
- search() {
- this.pageInfo.page = 1;
- this.getList();
- },
- onReSet() {
- this.$refs.searchForm.resetFields();
- this.search();
- },
- async getList() {
- try {
- let params = {
- topicId: this.id,
- page: this.pageInfo.page,
- rows: this.pageInfo.limit,
- ...this.searchForm,
- };
- console.log(params);
- let result = await questionnaireUserResult(params);
- this.tableList = result.data.rows;
- this.pageInfo.total = result.data.total;
- } catch {}
- },
- onCancel() {
- this.$store.dispatch("delVisitedViews", this.$route);
- this.$router.push({ path: "/operateManager/setQuestions" });
- },
- // onExport() {
- // Export(
- // this,
- // {
- // url: "/api-web/questionnaireUserResult/export",
- // fileName: "问答详情.xls",
- // method: "get",
- // params: { cooperationId: this.id, activeType: "REPLACEMENT" },
- // },
- // "您确定导出问答详情?"
- // );
- // },
- },
- };
- </script>
- <style lang="scss" scoped>
- .box-card {
- margin-bottom: 10px;
- }
- /deep/.el-collapse-item__header {
- background: #edeef0;
- color: #444;
- padding: 0 10px;
- }
- /deep/.el-collapse-item__wrap {
- border: 0;
- }
- /deep/.el-collapse-item__content {
- padding-bottom: 0;
- }
- .demo-table-expand {
- font-size: 0;
- }
- .demo-table-expand label {
- width: 90px;
- color: #99a9bf;
- }
- .demo-table-expand .el-form-item {
- margin-right: 0;
- margin-bottom: 0;
- width: 300px;
- span {
- width: 200px;
- }
- }
- .imgWrap {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .moreImg {
- width: 50px;
- height: 50px;
- background-color: #999;
- line-height: 50px;
- text-align: center;
- color: #fff;
- }
- </style>
- <style lang="css">
- .el-image-viewer__close {
- top: 40px;
- right: 40px;
- width: 40px;
- height: 40px;
- font-size: 24px;
- color: #fff;
- background-color: #606266;
- }
- </style>
|