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

我的考试待考已考逻辑调整

lidie 1 год назад
Родитель
Сommit
8804a1b094
1 измененных файлов с 39 добавлено и 32 удалено
  1. 39 32
      src/views/platform/bpmn/my-test/index.vue

+ 39 - 32
src/views/platform/bpmn/my-test/index.vue

@@ -20,7 +20,7 @@
         <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
             <van-list v-model="loading" :finished="finished" @load="loadData">
                 <van-checkbox-group v-model="checkedIds">
-                    <van-cell v-for="(item,index) in listData" :key="item.id+index" :title="item.examName" @click="onDialogShow(item)">
+                    <van-cell v-for="(item,index) in listData" :key="item.id+index" :title="item.examName">
                         <!-- :label="getTaskDesc(item.subject)" @click="onClick(item,index)"> -->
                         <!-- 插入图标 -->
                         <template slot="icon">
@@ -30,37 +30,39 @@
                             <van-icon name="notes-o" size="1.5rem" color="#1E90FF" />
                         </template>
                         <template #label>
-                            <van-row>
-                                <van-col span="12">考试类别</van-col>
-                                <van-col span="12">{{ item.examType==''?'/':item.examType==null?'/':item.examType==undefined?'/':item.examType }}</van-col>
-                            </van-row>
-                            <van-row>
-                                <van-col span="12">考试状态</van-col>
-                                <van-col span="12">{{ item.examState===''?'/':item.examState===null?'/':item.examState===undefined?'/':item.examState }}</van-col>
-                            </van-row>
-                            <van-row>
-                                <van-col span="12">限考时间</van-col>
-                                <van-col span="12">{{ item.limitDate===''?'/':item.limitDate===null?'/':item.limitDate===undefined?'/':item.limitDate }}</van-col>
-                            </van-row>
-                            <van-row>
-                                <van-col span="12">限考次数</van-col>
-                                <van-col span="12">{{ item.limitCount===''?'/':item.limitCount===undefined?'/':item.limitCount===null?'/':item.limitCount }}</van-col>
-                            </van-row>
-                            <van-row>
-                                <van-col span="12">考试时长</van-col>
-                                <van-col
-                                    span="12"
-                                >{{ item.duration===''?'/':item.duration===undefined?'/':item.duration===null?'/':item.duration==='不限'?item.duration:transformTime(item.duration) }}</van-col>
-                            </van-row>
-                            <van-row>
-                                <van-col span="12">考试题库</van-col>
-                                <van-col span="12">{{ item.bankName===''?'/':item.bankName===null?'/':item.bankName===undefined?'/':item.bankName }}</van-col>
-                            </van-row>
+                            <div @click="onDialogShow(item)">
+                                <van-row>
+                                    <van-col span="12">考试类别</van-col>
+                                    <van-col span="12">{{ item.examType==''?'/':item.examType==null?'/':item.examType==undefined?'/':item.examType }}</van-col>
+                                </van-row>
+                                <van-row>
+                                    <van-col span="12">考试状态</van-col>
+                                    <van-col span="12">{{ item.examState===''?'/':item.examState===null?'/':item.examState===undefined?'/':item.examState }}</van-col>
+                                </van-row>
+                                <van-row>
+                                    <van-col span="12">限考时间</van-col>
+                                    <van-col span="12">{{ item.limitDate===''?'/':item.limitDate===null?'/':item.limitDate===undefined?'/':item.limitDate }}</van-col>
+                                </van-row>
+                                <van-row>
+                                    <van-col span="12">限考次数</van-col>
+                                    <van-col span="12">{{ item.limitCount===''?'/':item.limitCount===undefined?'/':item.limitCount===null?'/':item.limitCount }}</van-col>
+                                </van-row>
+                                <van-row>
+                                    <van-col span="12">考试时长</van-col>
+                                    <van-col
+                                        span="12"
+                                    >{{ item.duration===''?'/':item.duration===undefined?'/':item.duration===null?'/':item.duration==='不限'?item.duration:transformTime(item.duration) }}</van-col>
+                                </van-row>
+                                <van-row>
+                                    <van-col span="12">考试题库</van-col>
+                                    <van-col span="12">{{ item.bankName===''?'/':item.bankName===null?'/':item.bankName===undefined?'/':item.bankName }}</van-col>
+                                </van-row>
+                            </div>
                         </template>
                         <!-- 插入内容 -->
                         <span>{{ item.createTime|formatRelativeTime }}</span>
-                        <div v-if="tabActive==0" style="margin-top: 90%;height: 100%;">
-                            <van-tag type="primary" size="medium" @click="onClick(item,index)">开始考试</van-tag>
+                        <div style="margin-top: 90%;height: 100%;">
+                            <van-tag type="primary" size="large" @click="onClick(item,index)"><span>{{ tabActive==0?'开始考试':'再次考试' }}</span></van-tag>
                         </div>
                         <!-- <div> -->
                         <!-- <van-tag plain :type=" item.status | optionsFilter(bpmnStatusOptions,'type')">{{ item.status | optionsFilter(bpmnStatusOptions) }}</van-tag> -->
@@ -151,7 +153,7 @@
                             <van-col
                                 span="17"
                                 class="popupContent"
-                            >{{ examPopup.limitCount===''?'/':examPopup.limitCount===null?'/':countTotal?`${examPopup.limitCount}次 (您已参加${countTotal.count - 1}次 ,本次不消耗次数)`:'' }}</van-col>
+                            >{{ examPopup.limitCount===''?'/':examPopup.limitCount===null?'/':countTotal?`${examPopup.limitCount}次 (您已参加${examPopup.paperState==='未开始'?countTotal.count - 1:countTotal.count}次 ,本次不消耗次数)`:'' }}</van-col>
                         </van-row>
                         <van-row class="examRow">
                             <van-col span="7" class="popupTitle">考试时长:</van-col>
@@ -597,6 +599,7 @@ export default {
         },
         updataSet(v) {
             this.showPop = v
+            this.onRefresh()
         },
         generateTitle(name, title) { // generateTitle by vue-i18n
             return i18n.generateTitle(name, title)
@@ -721,8 +724,12 @@ export default {
             const canshu = (key1 !== '' || key2 !== '') ? `${canshu1} ${canshu2}`.trim() : key !== '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             // let canshu = key != '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             // const sql = `select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu} ORDER BY startDate DESC LIMIT ${page},10`
-            const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_`
-            const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ ORDER BY startDate DESC LIMIT ${page},10`
+            // 已考待考(以考试次数是否使用完为区分点)
+            // const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_`
+            // const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ ORDER BY startDate DESC LIMIT ${page},10`
+            // 已考待考(已0为区分点)
+            const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_ where num = 1 AND paperState='未开始' AND examState='已发布' `
+            const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ where num>=1 AND paperState='已完成' ORDER BY startDate DESC LIMIT ${page},10`
             const sql = this.tabActive === 0 ? sql1 : sql2
             // let sql2 = `select * from (select * from t-exams ) a LEFT JOIN () B ON a.examId=b.exam_id_`
             // const { variables: { data }} = await this.$common.request('sql', sql)