Procházet zdrojové kódy

Merge branch '02/23reviewBUG' into test

mo před 3 roky
rodič
revize
dc1b5b4a33

+ 13 - 1
src/store/modules/permission.js

@@ -677,7 +677,19 @@ function setDetailRoute(accessedRoutes) {
             id: 'xx19'
           }
         },
-
+        {
+          name: '答题详情',
+          path: 'userAskList',
+          component: () => import('@/views/setQuestions/userAskList'),
+          hidden: true,
+          meta: {
+            noCache: '1',
+            title: '答题详情',
+            belongTopMenu: "/operateManager",
+            activeMenu: '/operateManager/setQuestions',
+            id: 'xx19'
+          }
+        },
       ])
     }
     if (route.path == '/financialManager') {

+ 143 - 110
src/views/reaplceMusicPlayer/answerList.vue

@@ -1,5 +1,5 @@
 <template>
-<div class='m-container'>
+  <div class="m-container">
     <h2>
       <el-page-header @back="onCancel" :content="titleName"></el-page-header>
     </h2>
@@ -22,135 +22,165 @@
         <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-button
+            type="primary"
+            @click="onExport"
+            v-if="$helpers.permission('questionnaireUserResult/export')"
+            >导出</el-button
+          >
         </el-form-item>
       </save-form>
       <el-card class="box-card" v-for="item in tableList" :key="item.id">
-          <el-row>
-            <el-col :xs="24" :sm="24" :md="6" :lg="5" :xl="5">
-              <el-form label-position="left" inline label-width="90px" class="demo-table-expand">
-                <el-form-item label="学生编号">
-                  <span><copy-text>{{ item.userId}}</copy-text></span>
-                </el-form-item>
-                <el-form-item label="学生姓名">
-                  <span><copy-text>{{ item.username}}</copy-text></span>
-                </el-form-item>
-                <el-form-item label="学生手机号">
-                  <span><copy-text>{{ item.phone}}</copy-text></span>
-                </el-form-item>
-              </el-form>
-              <!-- <el-row :gutter="10" style="font-size: 14px">
+        <el-row>
+          <el-form
+            label-position="left"
+            :inline="true"
+            label-width="90px"
+            class="demo-table-expand"
+          >
+            <el-form-item label="学生编号">
+              <span
+                ><copy-text>{{ item.userId }}</copy-text></span
+              >
+            </el-form-item>
+            <el-form-item label="学生姓名">
+              <span
+                ><copy-text>{{ item.username }}</copy-text></span
+              >
+            </el-form-item>
+            <el-form-item label="学生手机号">
+              <span
+                ><copy-text>{{ item.phone }}</copy-text></span
+              >
+            </el-form-item>
+          </el-form>
+          <!-- <el-row :gutter="10" style="font-size: 14px">
                 <el-col :span="24" style="padding-bottom: 8px"><>学生编号:<copy-text>{{ item.userId}}</copy-text></el-col>
                 <el-col :span="24" style="padding-bottom: 8px">学生姓名:<copy-text>{{ item.username}}</copy-text></el-col>
                 <el-col :span="24" style="padding-bottom: 8px">学生手机号:<copy-text>{{ item.phone}}</copy-text></el-col>
               </el-row> -->
-            </el-col>
-            <el-col :xs="24" :sm="24" :md="18" :lg="19" :xl="19">
-              <el-collapse>
-                <el-collapse-item title="查看答案" name="1">
-                  <div v-for="(o, index) in item.questionnaireResultDtoList" :key="index" class="text item">
-                    <el-alert :title="o.content" type="info" :closable="false"></el-alert>
-                    <div style="padding: 8px 20px; font-size: 14px;" v-if="o.answerValue || o.additionalValue">{{ o.answerValue ? o.answerValue : o.additionalValue }}</div>
-                    <!-- <div style="padding: 8px 20px; font-size: 14px;" v-else>未答题</div> -->
-                    <el-tag style="margin: 8px 20px; font-size: 14px;" type="danger" v-else>未答题</el-tag>
-                  </div>
-                </el-collapse-item>
-              </el-collapse>
-              <!-- <div v-for="(o, index) in item.questionnaireResultDtoList" :key="index" class="text item">
-                <el-alert :title="o.content" type="info" :closable="false"></el-alert>
-                <div style="padding: 8px 20px; font-size: 14px;">{{ o.answerValue }}</div>
-              </div> -->
-            </el-col>
-          </el-row>
+        </el-row>
+        <el-row>
+          <el-collapse>
+            <el-collapse-item title="查看答案" name="1">
+              <div
+                v-for="(o, index) in item.questionnaireResultDtoList"
+                :key="index"
+                class="text item"
+              >
+                <el-alert
+                  :title="o.content"
+                  type="info"
+                  :closable="false"
+                ></el-alert>
+                <div
+                  style="padding: 8px 20px; font-size: 14px"
+                  v-if="o.answerValue || o.additionalValue"
+                >
+                  {{ o.answerValue ? o.answerValue : o.additionalValue }}
+                </div>
+                <!-- <div style="padding: 8px 20px; font-size: 14px;" v-else>未答题</div> -->
+                <el-tag
+                  style="margin: 8px 20px; font-size: 14px"
+                  type="danger"
+                  v-else
+                  >未答题</el-tag
+                >
+              </div>
+            </el-collapse-item>
+          </el-collapse>
+        </el-row>
       </el-card>
       <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"
-        />
+        sync
+        :total.sync="pageInfo.total"
+        :page.sync="pageInfo.page"
+        :limit.sync="pageInfo.limit"
+        :page-sizes="pageInfo.page_size"
+        @pagination="getList"
+      />
     </div>
-</div>
+  </div>
 </template>
 <script>
-import { questionnaireUserResultQueryPage } from './api'
-import { Export } from '@/utils/downLoadFile'
+import { questionnaireUserResultQueryPage } 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: titleName,
-            id: query.id,
-            topicId: query.topicId,
-            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();
+  name: "operationQuestion",
+  components: { pagination },
+  data() {
+    let query = this.$route.query;
+    let titleName = "问答详情";
+    return {
+      titleName: titleName,
+      id: query.id,
+      topicId: query.topicId,
+      searchForm: {
+        search: null,
       },
-      async getList() {
-        try {
-          let params = {
-            activeId: this.id,
-            activeType: 'REPLACEMENT',
-            page: this.pageInfo.page,
-            rows: this.pageInfo.limit,
-            ...this.searchForm
-          }
-          let result = await questionnaireUserResultQueryPage(params)
-          this.tableList = result.data.rows
-          this.pageInfo.total = result.data.total
-        } catch {
-
-        }
-      },
-      onCancel() {
-        this.$store.dispatch('delVisitedViews', this.$route)
-        this.$router.push({ path: '/otherManager/reaplceMusicPlayer' })
+      tableList: [],
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
       },
-      onExport() {
-        Export(this, {
-          url: '/api-web/questionnaireUserResult/export',
-          fileName: '问答详情.xls',
-          method: 'get',
-          params: { cooperationId: this.id, activeType: 'REPLACEMENT' }
-        }, '您确定导出问答详情?')
-      }
-    }
-}
+    };
+  },
+  async mounted() {
+    this.getList();
+  },
+  methods: {
+    search() {
+      this.pageInfo.page = 1;
+      this.getList();
+    },
+    onReSet() {
+      this.$refs.searchForm.resetFields();
+      this.search();
+    },
+    async getList() {
+      try {
+        let params = {
+          activeId: this.id,
+          activeType: "REPLACEMENT",
+          page: this.pageInfo.page,
+          rows: this.pageInfo.limit,
+          ...this.searchForm,
+        };
+        let result = await questionnaireUserResultQueryPage(params);
+        this.tableList = result.data.rows;
+        this.pageInfo.total = result.data.total;
+      } catch {}
+    },
+    onCancel() {
+      this.$store.dispatch("delVisitedViews", this.$route);
+      this.$router.push({ path: "/otherManager/reaplceMusicPlayer" });
+    },
+    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;
+  background: #edeef0;
   color: #444;
   padding: 0 10px;
 }
@@ -162,7 +192,7 @@ export default {
 }
 
 .demo-table-expand {
-    font-size: 0;
+  font-size: 0;
 }
 .demo-table-expand label {
   width: 90px;
@@ -171,6 +201,9 @@ export default {
 .demo-table-expand .el-form-item {
   margin-right: 0;
   margin-bottom: 0;
-  width: 100%;
+  width: 300px;
+  span {
+    width: 200px;
+  }
 }
-</style>
+</style>

+ 9 - 1
src/views/setQuestions/api.js

@@ -29,4 +29,12 @@ export const questionnaireTopicUpdateStatus = data => request2({
     data,
     method: 'post',
     requestType: 'form'
-})
+})
+
+// 问卷答案 questionnaireUserResult/queryResultPage
+export const questionnaireUserResult = data => request2({
+  url: '/api-web/questionnaireUserResult/queryResultPage',
+  data,
+  params: data,
+  method: 'get',
+})

+ 439 - 176
src/views/setQuestions/components/answerList.vue

@@ -1,209 +1,472 @@
 <template>
-	<div>
-        <div class="questions" v-if="questionList.length > 0"  v-show="!resultStatus">
-            <div class="top-tips">{{ form.title }}</div>
-            <el-card class="box-card">
-                <div slot="header" class="clearfix">
-                    <span class="questionName">{{ questionList[currentIndex - 1]['content'] }}</span>
-                </div>
-                <el-radio-group v-model="check" v-if="questionList[currentIndex - 1]['type'] == 'radio'">
-                    <div class="" v-for="(item) in questionList[currentIndex - 1]['questionnaireQuestionItemList']" :key="item.id">
-                        <el-radio :label="item.id">{{item.answerValue}}</el-radio>
-                    </div>
-                </el-radio-group>
-                <el-checkbox-group v-model="checkBox" v-if="questionList[currentIndex - 1]['type'] == 'checkbox'">
-                    <el-checkbox  v-for="(item) in questionList[currentIndex - 1]['questionnaireQuestionItemList']" :key="item.id" :label="item.id">{{ item.answerValue }}</el-checkbox>
-                </el-checkbox-group>
-                <el-input
-                    v-if="questionList[currentIndex - 1]['type'] == 'textarea'"
-                    type="textarea"
-                    style="border: 0;"
-                    :autosize="{ minRows: 3, maxRows: 6}"
-                    placeholder="请输入其它意见"
-                    v-model="textarea">
-                </el-input>
-            </el-card>
-            <el-button size="large" type="primary" v-if="questionList[currentIndex - 1]['type'] == 'radio'" block round class="btn-submit" color="#01C1B5" :disabled="!check && !!isRequire" @click="onSubmit">提交</el-button>
-            <el-button size="large" type="primary" v-if="questionList[currentIndex - 1]['type'] == 'checkbox'" block round class="btn-submit" color="#01C1B5" :disabled="checkBox.length <= 0 && !!isRequire" @click="onSubmit">提交</el-button>
-            <el-button size="large" type="primary" v-if="questionList[currentIndex - 1]['type'] == 'textarea'" block round class="btn-submit" color="#01C1B5" :disabled="!textarea && !!isRequire" @click="onSubmit">提交</el-button>
-        </div>
+  <div>
+    <div
+      class="questions"
+      v-if="questionList.length > 0"
+      v-show="!resultStatus"
+    >
+      <div class="top-tips">{{ form.title }}</div>
 
-        <div class="resultModel" v-show="resultStatus">
-            <img src="@/assets/images/pay_success.png" class="img" alt="">
-            <p class="content">感谢您的参与!</p>
-            <el-button size="large" type="primary" round class="btn-submit" @click="onSubmitClose">确认</el-button>
+      <el-card class="box-card">
+        <div slot="header" class="clearfix">
+          <span class="questionName">{{
+            questionList[currentIndex - 1]["content"]
+          }}</span>
         </div>
+        <el-radio-group
+          v-model="check"
+          v-if="questionList[currentIndex - 1]['type'] == 'radio'"
+        >
+          <div
+            class=""
+            v-for="item in questionList[currentIndex - 1][
+              'questionnaireQuestionItemList'
+            ]"
+            :key="item.id"
+          >
+            <el-radio :label="item.id">{{ item.answerValue }}</el-radio>
+          </div>
+        </el-radio-group>
+        <el-checkbox-group
+          v-model="checkBox"
+          v-if="questionList[currentIndex - 1]['type'] == 'checkbox'"
+        >
+          <el-checkbox
+            v-for="item in questionList[currentIndex - 1][
+              'questionnaireQuestionItemList'
+            ]"
+            :key="item.id"
+            :label="item.id"
+            >{{ item.answerValue }}</el-checkbox
+          >
+        </el-checkbox-group>
+        <el-input
+          v-if="questionList[currentIndex - 1]['type'] == 'textarea'"
+          type="textarea"
+          style="border: 0"
+          :autosize="{ minRows: 3, maxRows: 6 }"
+          placeholder="请输入其它意见"
+          v-model="textarea"
+        >
+        </el-input>
+        <!-- 图片或者文件 -->
+        <el-upload
+          v-if="
+            questionList[currentIndex - 1]['type'] == 'image' ||
+            questionList[currentIndex - 1]['type'] == 'file'
+          "
+          class="ivu-upload"
+          :file-list="fileList"
+          :show-file-list="true"
+          :headers="headers"
+          :on-remove="handleRemove"
+          :accept="
+            questionList[currentIndex - 1]['type'] == 'image'
+              ? '.jpg, .jpeg, .png'
+              : '.XLSX,.XLS,.DOCX,.PDF,.TXT'
+          "
+          :before-upload="
+            (flie) => {
+              return beforeUpload(flie, questionList[currentIndex - 1]['type']);
+            }
+          "
+          :on-success="
+            (response, file, list) => {
+              handleUploadSuccess(
+                response,
+                file,
+                list,
+                questionList[currentIndex - 1]
+              );
+            }
+          "
+          :on-error="handleUploadError"
+          :max-size="2048"
+          multiple
+          action="/api-web/uploadFile"
+        >
+          <div slot="trigger" class="el-upload el-upload--picture-card">
+            <i class="el-icon-plus"></i>
+          </div>
+          <div
+            slot="tip"
+            v-if="questionList[currentIndex - 1]['type'] == 'image'"
+            class="el-upload__tip"
+          >
+            只能上传JPG、PNG、JPEG、GIF文件,且不超过5MB
+          </div>
+          <div slot="tip" v-else class="el-upload__tip">
+            只能上传XLSX、XLS、DOCX、PDF、TXT文件,且不超过5MB
+          </div>
+        </el-upload>
+      </el-card>
+      <el-button
+        size="large"
+        type="primary"
+        v-if="questionList[currentIndex - 1]['type'] == 'radio'"
+        block
+        round
+        class="btn-submit"
+        color="#01C1B5"
+        :disabled="!check && !!isRequire"
+        @click="onSubmit"
+        >提交</el-button
+      >
+      <el-button
+        size="large"
+        type="primary"
+        v-if="questionList[currentIndex - 1]['type'] == 'checkbox'"
+        block
+        round
+        class="btn-submit"
+        color="#01C1B5"
+        :disabled="checkBox.length <= 0 && !!isRequire"
+        @click="onSubmit"
+        >提交</el-button
+      >
+      <el-button
+        size="large"
+        type="primary"
+        v-if="questionList[currentIndex - 1]['type'] == 'textarea'"
+        block
+        round
+        class="btn-submit"
+        color="#01C1B5"
+        :disabled="!textarea && !!isRequire"
+        @click="onSubmit"
+        >提交</el-button
+      >
+            <el-button
+        size="large"
+        type="primary"
+        v-if="questionList[currentIndex - 1]['type'] == 'image'"
+        block
+        round
+        class="btn-submit"
+        color="#01C1B5"
+        :disabled="fileList.length <= 0 && !!isRequire"
+        @click="onSubmit"
+        >提交</el-button
+      >
+            <el-button
+        size="large"
+        type="primary"
+        v-if="questionList[currentIndex - 1]['type'] == 'file'"
+        block
+        round
+        class="btn-submit"
+        color="#01C1B5"
+        :disabled="fileList.length <= 0 && !!isRequire"
+        @click="onSubmit"
+        >提交</el-button
+      >
+    </div>
 
-	</div>
+    <div class="resultModel" v-show="resultStatus">
+      <img src="@/assets/images/pay_success.png" class="img" alt="" />
+      <p class="content">感谢您的参与!</p>
+      <el-button
+        size="large"
+        type="primary"
+        round
+        class="btn-submit"
+        @click="onSubmitClose"
+        >确认</el-button
+      >
+    </div>
+  </div>
 </template>
 
 <script>
-	export default {
-		name: 'question',
-        props: ['form', 'close'],
-		data() {
-			return {
-                currentIndex: 1,
-                questionList: [],
-                check: null,
-                isRequire: 1,
-                checkBox: [],
-                textarea: null,
-                checkList: [],
-                resultStatus: false
-			}
-		},
-		async mounted() {
-            try {
-                this.questionList = this.form.questionnaireQuestionList || []
-                console.log(this.questionList)
-                this.isRequire = this.questionList[this.currentIndex - 1].isRequire
-            } catch {
-                //
-            }
-		},
-		methods: {
-            toggle(index) {
-                let selectList = this.questionList[this.currentIndex - 1]
-                if(selectList.type == 'radio') {
-                    this.check = index
-                } else if(selectList.type == 'checkbox') {
-                    this.$refs.checkboxes[index].toggle()
-                }
-            },
-            onSubmit() {
-                let selectList = this.questionList[this.currentIndex - 1]
-                if(selectList.type == 'radio' && selectList.isRequire && !this.check) {
-                    this.$message.error('请回答当前问题')
-                    return
-                } else if(selectList.type == 'checkbox' && selectList.isRequire && this.checkBox.length <= 0) {
-                    this.$message.error('请回答当前问题')
-                    return
-                } else if(selectList.type == 'textarea' && selectList.isRequire && !this.textarea) {
-                    this.$message.error('请回答当前问题')
-                    return
-                }
+import { getToken } from "@/utils/auth";
+export default {
+  name: "question",
+  props: ["form", "close"],
+  data() {
+    return {
+      currentIndex: 1,
+      questionList: [],
+      check: null,
+      isRequire: 1,
+      checkBox: [],
+      textarea: null,
+      checkList: [],
+      fileList: [],
 
-                let answerList = selectList.questionnaireQuestionItemList || [] //当前题的选项
-                let currentIsOver = 0 // 是否终止答题
-                answerList.forEach(item => {
-                    if(selectList.type == 'radio' && this.check == item.id) {
-                        currentIsOver = item.isOver
-                    } else if(selectList.type == 'checkbox' && this.checkBox.includes(item.id) && !currentIsOver) {
-                        currentIsOver = item.isOver
-                    }
-                })
+      resultStatus: false,
+      headers: {
+        Authorization: getToken(),
+      },
+    };
+  },
+  async mounted() {
+    try {
+      this.questionList = this.form.questionnaireQuestionList || [];
+      console.log(this.questionList);
+      this.isRequire = this.questionList[this.currentIndex - 1].isRequire;
+    } catch {
+      //
+    }
+  },
+  methods: {
+    toggle(index) {
+      let selectList = this.questionList[this.currentIndex - 1];
+      if (selectList.type == "radio") {
+        this.check = index;
+      } else if (selectList.type == "checkbox") {
+        this.$refs.checkboxes[index].toggle();
+      }
+    },
+    onSubmit() {
+      let selectList = this.questionList[this.currentIndex - 1];
+      if (selectList.type == "radio" && selectList.isRequire && !this.check) {
+        this.$message.error("请回答当前问题");
+        return;
+      } else if (
+        selectList.type == "checkbox" &&
+        selectList.isRequire &&
+        this.checkBox.length <= 0
+      ) {
+        this.$message.error("请回答当前问题");
+        return;
+      } else if (
+        selectList.type == "textarea" &&
+        selectList.isRequire &&
+        !this.textarea
+      ) {
+        this.$message.error("请回答当前问题");
+        return;
+      } else if (
+        selectList.type == "image" &&
+        selectList.isRequire &&
+        this.fileList.length <= 0
+      ) {
+        this.$message.error("请回答当前问题");
+        return;
+      } else if (
+        selectList.type == "file" &&
+        selectList.isRequire &&
+        this.fileList.length <= 0
+      ) {
+        this.$message.error("请回答当前问题");
+        return;
+      }
 
-                // 判断是否在题目列表里面
-                if(this.currentIndex <= this.questionList.length) {
-                    if(selectList.type == 'radio') {
-                        this.checkList[this.currentIndex - 1] = {
-                            questionnaireQuestionId: selectList.id,
-                            questionnaireQuestionItemIdList: this.check
-                        }
-                        this.check = null
-                    } else if(selectList.type == 'checkbox') {
-                        this.checkList[this.currentIndex - 1] = {
-                            questionnaireQuestionId: selectList.id,
-                            questionnaireQuestionItemIdList: this.checkBox.join(',')
-                        }
-                        this.checkBox = []
-                    } else if(selectList.type == 'textarea') {
-                        this.checkList[this.currentIndex - 1] = {
-                            questionnaireQuestionId: selectList.id,
-                            additionalValue: this.textarea
-                        }
-                        this.textarea = null
-                    }
+      let answerList = selectList.questionnaireQuestionItemList || []; //当前题的选项
+      let currentIsOver = 0; // 是否终止答题
+      answerList.forEach((item) => {
+        if (selectList.type == "radio" && this.check == item.id) {
+          currentIsOver = item.isOver;
+        } else if (
+          selectList.type == "checkbox" &&
+          this.checkBox.includes(item.id) &&
+          !currentIsOver
+        ) {
+          currentIsOver = item.isOver;
+        }
+      });
 
-                    // 1 为终止答题
-                    if(currentIsOver) {
-                        this.onConfirm()
-                        return
-                    }
+      // 判断是否在题目列表里面
+      if (this.currentIndex <= this.questionList.length) {
+        if (selectList.type == "radio") {
+          this.checkList[this.currentIndex - 1] = {
+            questionnaireQuestionId: selectList.id,
+            questionnaireQuestionItemIdList: this.check,
+          };
+          this.check = null;
+        } else if (selectList.type == "checkbox") {
+          this.checkList[this.currentIndex - 1] = {
+            questionnaireQuestionId: selectList.id,
+            questionnaireQuestionItemIdList: this.checkBox.join(","),
+          };
+          this.checkBox = [];
+        } else if (selectList.type == "textarea") {
+          this.checkList[this.currentIndex - 1] = {
+            questionnaireQuestionId: selectList.id,
+            additionalValue: this.textarea,
+          };
+          this.textarea = null;
+        } else if (selectList.type == "image") {
+          this.checkList[this.currentIndex - 1] = {
+            questionnaireQuestionId: selectList.id,
+            additionalValue: JSON.stringify(
+              this.fileList.map((item) => {
+                return {
+                  name: item.name,
+                  url: item.response.data.url,
+                };
+              })
+            ),
+          };
+         this.fileList = [];
+        } else if (selectList.type == "file") {
+          this.checkList[this.currentIndex - 1] = {
+            questionnaireQuestionId: selectList.id,
+            additionalValue: JSON.stringify(
+              this.fileList.map((item) => {
+                return {
+                  name: item.name,
+                  url: item.response.data.url,
+                };
+              })
+            ),
+          };
+         this.fileList = [];
+        }
 
-                    this.check = null
-                    if(this.currentIndex == this.questionList.length) {
-                        this.saveKey()
-                        return
-                    }
+        // 1 为终止答题
+        if (currentIsOver) {
+          this.onConfirm();
+          return;
+        }
 
-                    this.currentIndex++
-                }
-            },
-            saveKey() {
-                // this.$message.info('谢谢参与')
-                this.resultStatus = true
-            },
-            async onConfirm() {
-                // this.$message.info('谢谢参与')
-                this.resultStatus = true
-            },
-            onSubmitClose() {
-                this.close()
-            }
-		}
-	}
+        this.check = null;
+        if (this.currentIndex == this.questionList.length) {
+          this.saveKey();
+          return;
+        }
+        this.currentIndex++;
+      }
+    },
+    saveKey() {
+      // this.$message.info('谢谢参与')
+      this.resultStatus = true;
+    },
+    async onConfirm() {
+      // this.$message.info('谢谢参与')
+      this.resultStatus = true;
+    },
+    onSubmitClose() {
+      this.close();
+    },
+    beforeUpload(file, type) {
+      // const isJPG = file.type === 'image/jpeg';
+      const isLt2M = file.size / 1024 / 1024 < 5;
+      const imgType = ["JPG", "PNG", "JPEG", "GIF"];
+      const testType = ["XLSX", "XLS", "DOCX", "PDF", "TXT"];
+      const fileExtension = file.name.split(".").pop().toUpperCase();
+      console.log(
+        type,
+        fileExtension,
+        testType,
+        testType.indexOf(fileExtension) != -1
+      );
+      let fileType = false;
+      if (type == "file") {
+        if (testType.indexOf(fileExtension) != -1) {
+          fileType = true;
+        } else {
+          this.$message.error("请上传正确的附件!");
+          return false;
+        }
+      } else if ((type = "image")) {
+        if (imgType.indexOf(fileExtension) != -1) {
+          fileType = true;
+        } else {
+          this.$message.error("请上传正确的附件!");
+          return false;
+        }
+      }
+      //   if (!isJPG) {
+      //     this.$message.error('上传头像图片只能是 JPG 格式!');
+      //   }
+      if (!isLt2M) {
+        this.$message.error("上传附件大小不能超过 5MB!");
+      }
+      this.uploadLoading = true;
+      return isLt2M && fileType;
+    },
+    handleUploadError(file) {
+      this.uploadLoading = false;
+      this.$message.error("上传附件失败");
+    },
+    handleUploadSuccess(response, file, list, question) {
+      this.uploadLoading = false;
+      this.$message.success("上传附件成功");
+      this.fileList = [...list];
+      console.log(this.fileList);
+      // this.fileList.push(file)
+    },
+    handleRemove(file, list) {
+      this.fileList = [...list];
+      console.log(this.fileList);
+    },
+  },
+};
 </script>
 
 <style lang="less" scoped>
 .top-tips {
-    color: #808080;
-    font-size: 14px;
-    padding: 0 0 10px;
+  color: #808080;
+  font-size: 14px;
+  padding: 0 0 10px;
 }
 
 .btn-submit {
-    width: 90%;
-    margin: 20px 5%;
+  width: 90%;
+  margin: 20px 5%;
 }
 
 .form-info {
-    margin: 10px;
-    width: auto;
-    border-radius: 5px;
+  margin: 10px;
+  width: auto;
+  border-radius: 5px;
 }
 .questionName {
-    padding-top: 5px;
-    font-size: 16px;
-    color: #444;
-    font-weight: 500;
-    line-height: 1.5;
+  padding-top: 5px;
+  font-size: 16px;
+  color: #444;
+  font-weight: 500;
+  line-height: 1.5;
 }
-/deep/.el-radio-group, /deep/.el-checkbox-group {
-    width: 100%;
+/deep/.el-radio-group,
+/deep/.el-checkbox-group {
+  width: 100%;
 }
-/deep/.el-radio__input.is-checked+.el-radio__label {
-    color: #606266;
+/deep/.el-radio__input.is-checked + .el-radio__label {
+  color: #606266;
 }
-/deep/.el-radio, /deep/.el-checkbox {
-    width: 100%;
-    display: flex;
-    justify-content: space-between;
-    flex-direction: row-reverse;
-    padding: 10px 0;
-    .el-radio__label, .el-checkbox__label {
-        padding-left: 0;
-    }
+/deep/.el-radio,
+/deep/.el-checkbox {
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+  flex-direction: row-reverse;
+  padding: 10px 0;
+  .el-radio__label,
+  .el-checkbox__label {
+    padding-left: 0;
+  }
 }
 /deep/.el-button--primary {
-    background: #01c1b5 !important;
-    border-color: #01c1b5 !important;
+  background: #01c1b5 !important;
+  border-color: #01c1b5 !important;
+}
+/deep/.el-upload {
+  display: block;
+}
+/deep/.el-upload--picture-card {
+  width: 100%;
+  height: 100px;
+  align-items: center;
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
 }
 
 .resultModel {
-    .img {
-        width: 145px;
-        margin: 0 auto;
-        display: block;
-        // padding-top: 50px;
-    }
-    .content {
-        font-size: 20px;
-        color: #1A1A1A;
-        text-align: center;
-        font-weight: 500;
-        padding-bottom: 30px;
-    }
+  .img {
+    width: 145px;
+    margin: 0 auto;
+    display: block;
+    // padding-top: 50px;
+  }
+  .content {
+    font-size: 20px;
+    color: #1a1a1a;
+    text-align: center;
+    font-weight: 500;
+    padding-bottom: 30px;
+  }
 }
-</style>
+</style>

+ 187 - 86
src/views/setQuestions/components/questionList.vue

@@ -1,103 +1,204 @@
 <template>
-<el-form :model="form" ref="form" label-width="100px" class="question">
+  <el-form :model="form" ref="form" label-width="100px" class="question">
     <el-row>
-        <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
-            <el-form-item label="题目类型" prop="type" :rules="[{ required: true, message: '请选择题目类型', trigger: 'change' }]">
-                <el-select v-model="form.type" placeholder="请选择题目类型" :disabled="disabled">
-                    <el-option label="单选" value="radio"></el-option>
-                    <el-option label="多选" value="checkbox"></el-option>
-                    <el-option label="问答" value="textarea"></el-option>
-                </el-select>
-            </el-form-item>
-        </el-col>
-        <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
-            <el-form-item label="是否必填" prop="isRequire" :rules="[{ required: true, message: '请选择是否必填', trigger: 'change' }]">
-                <el-select v-model="form.isRequire" placeholder="请选择是否必填" :disabled="disabled">
-                    <el-option label="是" :value="1"></el-option>
-                    <el-option label="否" :value="0"></el-option>
-                </el-select>
-            </el-form-item>
-        </el-col>
+      <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
+        <el-form-item
+          label="题目类型"
+          prop="type"
+          :rules="[
+            { required: true, message: '请选择题目类型', trigger: 'change' },
+          ]"
+        >
+          <el-select
+            v-model="form.type"
+            placeholder="请选择题目类型"
+            :disabled="disabled"
+          >
+            <el-option label="单选" value="radio"></el-option>
+            <el-option label="多选" value="checkbox"></el-option>
+            <el-option label="问答" value="textarea"></el-option>
+            <el-option label="附件" value="file"></el-option>
+            <el-option label="图片" value="image"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
+        <el-form-item
+          label="是否必填"
+          prop="isRequire"
+          :rules="[
+            { required: true, message: '请选择是否必填', trigger: 'change' },
+          ]"
+        >
+          <el-select
+            v-model="form.isRequire"
+            placeholder="请选择是否必填"
+            :disabled="disabled"
+          >
+            <el-option label="是" :value="1"></el-option>
+            <el-option label="否" :value="0"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
     </el-row>
-    <el-form-item label="题目" prop="content" :rules="[{ required: true, message: '请输入题目', trigger: 'blur' }]">
-        <el-input type="textarea" placeholder="请输入题目" :disabled="disabled" v-model="form.content" show-word-limit maxlength="200" :autosize="{ minRows: 2, maxRows: 4}"></el-input>
+    <el-form-item
+      label="题目"
+      prop="content"
+      :rules="[{ required: true, message: '请输入题目', trigger: 'blur' }]"
+    >
+      <el-input
+        type="textarea"
+        placeholder="请输入题目"
+        :disabled="disabled"
+        v-model="form.content"
+        show-word-limit
+        maxlength="200"
+        :autosize="{ minRows: 2, maxRows: 4 }"
+      ></el-input>
     </el-form-item>
 
-    <template v-if="form.type != 'textarea'">
-        <div v-for="(questionnaireQuestionItemList, index) in form.questionnaireQuestionItemList" :key="index">
-            <el-form-item :label="'选项' + (index + 1)"
-                style="display: inline-block;"
-                :prop="'questionnaireQuestionItemList.' + index + '.answerValue'"
-                :rules="[{ required: true, message: '请输入选项内容', trigger: 'change' }]">
-                <el-input type="text" placeholder="请输入选项内容" :disabled="disabled" maxlength="100" v-model="questionnaireQuestionItemList.answerValue"></el-input>
-            </el-form-item>
-            <el-form-item label="是否终止答题"
-                style="display: inline-block;"
-                label-width="120px"
-                :prop="'questionnaireQuestionItemList.' + index + '.isOver'"
-                :rules="[{ required: true, message: '请选择是否终止答题', trigger: 'change' }]">
-                <el-radio-group v-model="questionnaireQuestionItemList.isOver" :disabled="disabled" style="margin-right: 20px">
-                    <el-radio :label="1">是</el-radio>
-                    <el-radio :label="0">否</el-radio>
-                </el-radio-group>
-            </el-form-item>
-            <div style="display: inline-block;">
-                <el-tooltip class="item" effect="dark" content="向下移动" placement="top">
-                    <el-button icon="el-icon-top" circle size="small" @click="moveDown(form.questionnaireQuestionItemList, index)" :disabled="index == 0 || disabled"></el-button>
-                </el-tooltip>
-                <el-tooltip class="item" effect="dark" content="向下移动" placement="top">
-                    <el-button icon="el-icon-bottom" circle size="small" @click="moveUp(form.questionnaireQuestionItemList, index)" :disabled="form.questionnaireQuestionItemList.length <= 1 || form.questionnaireQuestionItemList.length == (index + 1) || disabled"></el-button>
-                </el-tooltip>
-                <el-tooltip class="item" effect="dark" content="删除" placement="top">
-                    <el-button icon="el-icon-delete" circle size="small" @click="onDelete(form.questionnaireQuestionItemList, index)" :disabled="form.questionnaireQuestionItemList.length <= 1 || disabled"></el-button>
-                </el-tooltip>
-            </div>
-        </div>
-        <el-form-item>
-            <el-button style="width: 200px" type="default" icon="el-icon-plus" :disabled="form.questionnaireQuestionItemList.length >= 10 || disabled" @click="addQuestionItem(form.questionnaireQuestionItemList)">新增选项</el-button>
+    <template v-if="form.type == 'radio' || form.type == 'checkbox'">
+      <div
+        v-for="(
+          questionnaireQuestionItemList, index
+        ) in form.questionnaireQuestionItemList"
+        :key="index"
+      >
+        <el-form-item
+          :label="'选项' + (index + 1)"
+          style="display: inline-block"
+          :prop="'questionnaireQuestionItemList.' + index + '.answerValue'"
+          :rules="[
+            { required: true, message: '请输入选项内容', trigger: 'change' },
+          ]"
+        >
+          <el-input
+            type="text"
+            placeholder="请输入选项内容"
+            :disabled="disabled"
+            maxlength="100"
+            v-model="questionnaireQuestionItemList.answerValue"
+          ></el-input>
         </el-form-item>
+        <el-form-item
+          label="是否终止答题"
+          style="display: inline-block"
+          label-width="120px"
+          :prop="'questionnaireQuestionItemList.' + index + '.isOver'"
+          :rules="[
+            {
+              required: true,
+              message: '请选择是否终止答题',
+              trigger: 'change',
+            },
+          ]"
+        >
+          <el-radio-group
+            v-model="questionnaireQuestionItemList.isOver"
+            :disabled="disabled"
+            style="margin-right: 20px"
+          >
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="0">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <div style="display: inline-block">
+          <el-tooltip
+            class="item"
+            effect="dark"
+            content="向下移动"
+            placement="top"
+          >
+            <el-button
+              icon="el-icon-top"
+              circle
+              size="small"
+              @click="moveDown(form.questionnaireQuestionItemList, index)"
+              :disabled="index == 0 || disabled"
+            ></el-button>
+          </el-tooltip>
+          <el-tooltip
+            class="item"
+            effect="dark"
+            content="向下移动"
+            placement="top"
+          >
+            <el-button
+              icon="el-icon-bottom"
+              circle
+              size="small"
+              @click="moveUp(form.questionnaireQuestionItemList, index)"
+              :disabled="
+                form.questionnaireQuestionItemList.length <= 1 ||
+                form.questionnaireQuestionItemList.length == index + 1 ||
+                disabled
+              "
+            ></el-button>
+          </el-tooltip>
+          <el-tooltip class="item" effect="dark" content="删除" placement="top">
+            <el-button
+              icon="el-icon-delete"
+              circle
+              size="small"
+              @click="onDelete(form.questionnaireQuestionItemList, index)"
+              :disabled="
+                form.questionnaireQuestionItemList.length <= 1 || disabled
+              "
+            ></el-button>
+          </el-tooltip>
+        </div>
+      </div>
+      <el-form-item>
+        <el-button
+          style="width: 200px"
+          type="default"
+          icon="el-icon-plus"
+          :disabled="
+            form.questionnaireQuestionItemList.length >= 10 || disabled
+          "
+          @click="addQuestionItem(form.questionnaireQuestionItemList)"
+          >新增选项</el-button
+        >
+      </el-form-item>
     </template>
-</el-form>
+  </el-form>
 </template>
 <script>
 export default {
-    props: ['form', 'type', 'disabled'],
-    data () {
-        return {
-        }
+  props: ["form", "type", "disabled"],
+  data() {
+    return {};
+  },
+  mounted() {},
+  methods: {
+    // 添加题目选项
+    addQuestionItem(questionnaireQuestionItemLists) {
+      questionnaireQuestionItemLists.push({});
     },
-    mounted () {
+    // 向上移动
+    moveUp(arr, index) {
+      arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]));
     },
-    methods: {
-        // 添加题目选项
-        addQuestionItem(questionnaireQuestionItemLists) {
-            questionnaireQuestionItemLists.push({})
-        },
-        // 向上移动
-        moveUp(arr, index) {
-            arr.splice(index, 1, ...arr.splice(index + 1, 1, arr[index]));
-        },
-        // 向下移动
-        moveDown(arr, index) {
-            arr.splice(index - 1, 1, ...arr.splice(index, 1, arr[index - 1]));
-
-        },
-        // 删除选项
-        onDelete(arr, index) {
-            if(this.type == 'update') {
-                if(this.form.delQuestionnaireQuestionItemIdList) {
-                    this.form.delQuestionnaireQuestionItemIdList.push(arr[index].id)
-                } else {
-                    this.form.delQuestionnaireQuestionItemIdList = [arr[index].id]
-                }
-            }
-            arr.splice(index, 1)
+    // 向下移动
+    moveDown(arr, index) {
+      arr.splice(index - 1, 1, ...arr.splice(index, 1, arr[index - 1]));
+    },
+    // 删除选项
+    onDelete(arr, index) {
+      if (this.type == "update") {
+        if (this.form.delQuestionnaireQuestionItemIdList) {
+          this.form.delQuestionnaireQuestionItemIdList.push(arr[index].id);
+        } else {
+          this.form.delQuestionnaireQuestionItemIdList = [arr[index].id];
         }
-    }
-}
+      }
+      arr.splice(index, 1);
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
 .question .el-select {
-    width: 100% !important;
+  width: 100% !important;
 }
-</style>
+</style>

+ 160 - 109
src/views/setQuestions/index.vue

@@ -1,30 +1,39 @@
 <template>
-  <div class='m-container'>
+  <div class="m-container">
     <h2>
-      <div class="squrt"></div>问卷管理
+      <div class="squrt"></div>
+      问卷管理
     </h2>
     <div class="m-core">
-        <el-button type="primary" @click="onQuestionOperation('create')"
-           v-if="$helpers.permission('/operateManager/questionOperation/create')"
-           class='newBand'>添加问卷</el-button>
-        <save-form :inline="true"
-               @submit="search"
-               @reset="onReSet"
-               ref="searchForm"
-               :model="searchForm">
+      <el-button
+        type="primary"
+        @click="onQuestionOperation('create')"
+        v-if="$helpers.permission('/operateManager/questionOperation/create')"
+        class="newBand"
+        >添加问卷</el-button
+      >
+      <save-form
+        :inline="true"
+        @submit="search"
+        @reset="onReSet"
+        ref="searchForm"
+        :model="searchForm"
+      >
         <el-form-item prop="search">
-            <el-input
-                type="text"
-                clearable
-                v-model="searchForm.search"
-                placeholder="问卷编号或名称"
-            ></el-input>
+          <el-input
+            type="text"
+            clearable
+            v-model="searchForm.search"
+            placeholder="问卷编号或名称"
+          ></el-input>
         </el-form-item>
         <el-form-item prop="status">
-          <el-select v-model="searchForm.status"
-                     filterable
-                     placeholder="请选择问卷状态"
-                     clearable>
+          <el-select
+            v-model="searchForm.status"
+            filterable
+            placeholder="请选择问卷状态"
+            clearable
+          >
             <el-option label="启用" :value="1"></el-option>
             <el-option label="停用" :value="0"></el-option>
           </el-select>
@@ -37,145 +46,187 @@
       </save-form>
       <!-- 列表 -->
       <div class="tableWrap">
-        <el-table :data='tableList'
-                  :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-          <el-table-column align='center'
-                           prop="id"
-                           label="问卷编号">
+        <el-table
+          :data="tableList"
+          :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+        >
+          <el-table-column align="center" prop="id" label="问卷编号">
             <template slot-scope="scope">
               <copy-text>{{ scope.row.id }}</copy-text>
             </template>
           </el-table-column>
-          <el-table-column align='center'
-                           prop="title"
-                           label="问卷名称">
+          <el-table-column align="center" prop="title" label="问卷名称">
             <template slot-scope="scope">
               <!-- <copy-text>{{ scope.row.title }}</copy-text> -->
-              <overflow-text :text="scope.row.title" ></overflow-text>
+              <overflow-text :text="scope.row.title"></overflow-text>
             </template>
           </el-table-column>
-          <el-table-column align='center'
-                           prop="status"
-                           label="状态">
+          <el-table-column align="center" prop="status" label="状态">
             <template slot-scope="scope">
-              {{ scope.row.status ? '开启' : '关闭' }}
+              {{ scope.row.status ? "开启" : "关闭" }}
             </template>
           </el-table-column>
-          <el-table-column align='center'
-                           label="操作">
+          <el-table-column align="center" label="操作">
             <template slot-scope="scope">
-              <el-button @click="onQuestionOperation('look', scope.row)"
-                         v-if="$helpers.permission('/operateManager/questionOperation/detail')"
-                         type="text">详情</el-button>
-              <el-button @click="onOperation(scope.row)"
-                         v-if="$helpers.permission(scope.row.status ? 'questionnaireTopic/updateStatus/stop' : 'questionnaireTopic/updateStatus/start')"
-                         type="text">{{ scope.row.status ? '停用' : '启用' }}</el-button>
+              <el-button
+                @click="onQuestionOperation('look', scope.row)"
+                v-if="
+                  $helpers.permission(
+                    '/operateManager/questionOperation/detail'
+                  )
+                "
+                type="text"
+                >详情</el-button
+              >
+              <el-button
+                @click="onOperation(scope.row)"
+                v-if="
+                  $helpers.permission(
+                    scope.row.status
+                      ? 'questionnaireTopic/updateStatus/stop'
+                      : 'questionnaireTopic/updateStatus/start'
+                  )
+                "
+                type="text"
+                >{{ scope.row.status ? "停用" : "启用" }}</el-button
+              >
               <!-- 启用的问卷不能修改 -->
-              <el-button @click="onQuestionOperation('update', scope.row)"
-                         v-if="$helpers.permission('/operateManager/questionOperation/update') && !scope.row.status"
-                         type="text">修改</el-button>
+              <el-button
+                @click="onQuestionOperation('update', scope.row)"
+                v-if="
+                  $helpers.permission(
+                    '/operateManager/questionOperation/update'
+                  ) && !scope.row.status
+                "
+                type="text"
+                >修改</el-button
+              >
+              <el-button
+                @click="lookAsk(scope.row)"
+                v-if="
+                  $helpers.permission(
+                    '/userAskList'
+                  )
+                "
+                type="text"
+                >答题详情</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
-        <pagination sync :total.sync="pageInfo.total"
-                    :page.sync="pageInfo.page"
-                    :limit.sync="pageInfo.limit"
-                    :page-sizes="pageInfo.page_size"
-                    @pagination="getList" />
+        <pagination
+          sync
+          :total.sync="pageInfo.total"
+          :page.sync="pageInfo.page"
+          :limit.sync="pageInfo.limit"
+          :page-sizes="pageInfo.page_size"
+          @pagination="getList"
+        />
       </div>
     </div>
-
   </div>
 </template>
 <script>
-import pagination from '@/components/Pagination/index'
-import { questionnaireTopicQueryPage, questionnaireTopicUpdateStatus } from './api'
+import pagination from "@/components/Pagination/index";
+import {
+  questionnaireTopicQueryPage,
+  questionnaireTopicUpdateStatus,
+} from "./api";
 export default {
-  name: 'branchSetting',
+  name: "branchSetting",
   components: { pagination },
-  data () {
+  data() {
     return {
-        searchForm: {
-            search: null,
-            status: null
-        },
-        tableList: [],
-        pageInfo: {
-            // 分页规则
-            limit: 10, // 限制显示条数
-            page: 1, // 当前页
-            total: 0, // 总条数
-            page_size: [10, 20, 40, 50] // 选择限制显示条数
-        },
-        organId: null,
-    }
+      searchForm: {
+        search: null,
+        status: null,
+      },
+      tableList: [],
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      organId: null,
+    };
   },
-  mounted () {
-    this.getList()
+  mounted() {
+    this.getList();
   },
   methods: {
-    getList () {
+    getList() {
       questionnaireTopicQueryPage({
         rows: this.pageInfo.limit,
         page: this.pageInfo.page,
-        ...this.searchForm
-      }).then(res => {
+        ...this.searchForm,
+      }).then((res) => {
         if (res.code == 200 && res.data) {
-          this.tableList = res.data.rows
-          this.pageInfo.total = res.data.total
+          this.tableList = res.data.rows;
+          this.pageInfo.total = res.data.total;
         }
-      })
+      });
     },
     onQuestionOperation(type, row) {
-        let str = '问卷'
-        if(type == 'create') {
-          str = '添加' + str
-        } else if(type == 'update') {
-          str = '修改' + str
-        } else if(type == 'look') {
-          str = '查看' + str
-        }
-        let params = {
-          type
-        }
-        if(type == 'update' || type == 'look') {
-          params.id = row.id
+      let str = "问卷";
+      if (type == "create") {
+        str = "添加" + str;
+      } else if (type == "update") {
+        str = "修改" + str;
+      } else if (type == "look") {
+        str = "查看" + str;
+      }
+      let params = {
+        type,
+      };
+      if (type == "update" || type == "look") {
+        params.id = row.id;
+      }
+      this.$router.push(
+        {
+          path: "/operateManager/questionOperations",
+          query: params,
+        },
+        (router) => {
+          router.meta.title = str;
         }
-        this.$router.push({
-            path: '/operateManager/questionOperations',
-            query: params
-        }, (router) => {
-            router.meta.title = str;
-        })
+      );
     },
     async onOperation(row, type) {
-      let str = row.status ? '停用' : '启用'
-      this.$confirm(`是否${str}该问卷?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
+      let str = row.status ? "停用" : "启用";
+      this.$confirm(`是否${str}该问卷?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
       }).then(async () => {
         try {
-            let status = row.status ? 0 : 1
-            await questionnaireTopicUpdateStatus({ topicId: row.id, status: status })
-            this.$message.success(str + '成功')
-            this.getList()
+          let status = row.status ? 0 : 1;
+          await questionnaireTopicUpdateStatus({
+            topicId: row.id,
+            status: status,
+          });
+          this.$message.success(str + "成功");
+          this.getList();
         } catch {
           //
         }
-      })
+      });
     },
     search() {
       this.pageInfo.page = 1;
       this.getList();
     },
     onReSet() {
-      this.$refs['searchForm'].resetFields();
+      this.$refs["searchForm"].resetFields();
       this.search();
     },
-
-  }
-}
+    lookAsk(row){
+      this.$router.push({path:'/operateManager/userAskList',query:{id:row.id,name:row.title}})
+      console.log(row)
+    }
+  },
+};
 </script>
 <style lang="scss" scoped>
 /deep/.el-button--primary {

+ 1 - 1
src/views/setQuestions/operation.vue

@@ -268,4 +268,4 @@ export default {
 /deep/.el-collapse-item__wrap, /deep/.el-collapse-item__header {
     background-color: #eef4f9;
 }
-</style>
+</style>

+ 203 - 0
src/views/setQuestions/userAskList.vue

@@ -0,0 +1,203 @@
+<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">
+                    <el-image
+
+                      v-for="(item,index) in JSON.parse(scope.row.questionnaireResultDtoList[index].additionalValue)"
+                      :key="index"
+                      style="width: 50px; height: 50px;margin-right:5px"
+                      :src="item.url"
+                      :preview-src-list="[
+                        item.url,
+                      ]"
+                    >
+                    </el-image>
+                  </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;
+  }
+}
+</style>