Просмотр исходного кода

修改测试计划和问答测试

plg 2 месяцев назад
Родитель
Сommit
1e5e2c1884
3 измененных файлов с 30 добавлено и 5 удалено
  1. 1 0
      src/components/CpmdQuestionnaire.vue
  2. 23 3
      src/views/Plan.vue
  3. 6 2
      src/views/Scale.vue

+ 1 - 0
src/components/CpmdQuestionnaire.vue

@@ -101,6 +101,7 @@ const saveQuesQuestion = async () => {
     let res: any = await sqveQuesQuestionApi(questionList.value)
     if (res.code == 200) {
         //跳转到测试计划
+        dialogVisible.value = false
         router.push({ name: 'plan' })
     }
 }

+ 23 - 3
src/views/Plan.vue

@@ -1,14 +1,18 @@
 <script setup lang="ts">
 import CpmdHeader from '@/components/CpmdHeader.vue';
+import CpmdQuestionnaire from '@/components/CpmdQuestionnaire.vue'
 import { onMounted, onUnmounted, ref } from 'vue'
 import { useRouter } from 'vue-router'
 import { format } from 'date-fns/format';
 const router = useRouter()
 
+//调用子组件的ref
+const question = ref<any>()
+
 //持久化设置 菜单状态
 import { menuStatusStore, userInfoStore } from '@/stores'
 import { isHaveManage } from '@/utils/test';
-import { userPlanApi, userPlanDetailApi } from '@/api/home';
+import { queryIsQuestionApi, userPlanApi, userPlanDetailApi } from '@/api/home';
 import { ElMessage } from 'element-plus';
 const userInfo = userInfoStore();
 const menuStatus = menuStatusStore();
@@ -29,7 +33,18 @@ const planList = ref<any>([
 //     return hour + ':时'
 // }
 //点击了开始测试--跳转到测试页面
-const startPlan = (val: any) => {
+const startPlan = async (val: any) => {
+    //先判断
+    //是否做了问卷
+    //如果未做问卷需要弹出问卷的弹出框
+    //做完以后开始测试
+    let res: any = await queryIsQuestionApi()
+    if (res.data != null) {
+        //此时是问卷未做
+        //调用问卷组件打开
+        question.value.open(res.data)
+        return
+    }
     let nextFlag = '';
     let type = '';
     if (val.scaleList.length > 0) {
@@ -199,7 +214,7 @@ const planNumGet = async () => {
             let temp: any = await userPlanDetailApi(params)
             planList.value[i].list = temp.data
         }
-
+        debugger;
         //-------------处理SCL90的完成状态----------------
         for (let i = 0; i < planList.value.length; i++) {
             //
@@ -317,6 +332,10 @@ onUnmounted(() => {
                                                 <div class="task_content">
                                                     <div class="title">{{ subItem.name }}</div>
                                                     <div class="des">预计用时{{ subItem.expectTime }}</div>
+                                                    <div
+                                                        :style="{ color: subItem.isCompleted == '1' ? 'green' : 'red' }">
+                                                        {{
+                                                            subItem.isCompleted == '1' ? '已完成' : '未完成' }}</div>
                                                 </div>
                                             </div>
                                         </div>
@@ -456,6 +475,7 @@ onUnmounted(() => {
                 </div>
             </div>
         </div>
+        <CpmdQuestionnaire ref="question" />
     </div>
 </template>
 <style lang="scss" scoped>

+ 6 - 2
src/views/Scale.vue

@@ -2,6 +2,7 @@
 import { format } from 'date-fns/format';
 
 import CpmdHeader from '@/components/CpmdHeader.vue';
+
 import { onMounted, onUnmounted, ref } from 'vue'
 import { Check } from '@element-plus/icons-vue'
 import { number } from 'echarts';
@@ -9,6 +10,7 @@ import { ElMessage } from 'element-plus';
 import { useRouter, useRoute } from 'vue-router';
 import { getScaleApi, queryScaleDetailApi, saveScaleApi } from '@/api/plan';
 import { userInfoStore } from '@/stores'
+//调用子组件的ref
 
 // 加一个锁表示不能重复点击
 const isLock = ref<boolean>(false)
@@ -496,8 +498,10 @@ onUnmounted(() => {
                         <span style="color:#000000">{{ topicIndex + planIsComplateNum }}/{{ planAllNum }}</span>
                     </el-progress>
                     <div v-if="scaleList.length > 0">
-                        <div class="scale_title">{{ topicIndex }}:{{ scaleList[topicIndex - 1].content }}</div>
-
+                        <div class="scale_title" v-if="!(flag == '20210617140713' && isComplate == '2')">{{ topicIndex
+                            }}:{{ scaleList[topicIndex - 1].content }}</div>
+                        <div class="scale_title" v-if="flag == '20210617140713' && isComplate == '2'">{{ topicIndex +
+                            planIsComplateNum }}:{{ scaleList[topicIndex - 1].content }}</div>
                         <el-radio-group v-model="scaleList[topicIndex - 1].isCheck" class="scale_radio_group">
                             <el-radio-button
                                 v-for="item in scaleList[topicIndex - 1].checkItems.split(';').sort(() => { return Math.random() - 0.5 })  "