dedsudiyu 4 days ago
parent
commit
2c5135efa3

+ 57 - 0
src/api/safetyEducationExaminationNew/index.js

@@ -289,4 +289,61 @@ export function examElQuestionBankDetail(query) {
     params: query
   })
 }
+//试卷详情
+export function examElPaperDetail(query) {
+  return request({
+    url: '/exam/elPaper/detail',
+    method: 'get',
+    params: query
+  })
+}
+//试卷列表
+export function examElPaperPage(data) {
+  return request({
+    url: '/exam/elPaper/page',
+    method: 'post',
+    data: data
+  })
+}
+//试卷新增
+export function examElPaperAdd(data) {
+  return request({
+    url: '/exam/elPaper/add',
+    method: 'post',
+    data: data
+  })
+}
+//试卷编辑
+export function examElPaperEdit(data) {
+  return request({
+    url: '/exam/elPaper/edit',
+    method: 'post',
+    data: data
+  })
+}
+//试卷删除
+export function examElPaperDel(data) {
+  return request({
+    url: '/exam/elPaper/del',
+    method: 'post',
+    data: data
+  })
+}
+//试卷复制
+export function examElPaperCopy(data) {
+  return request({
+    url: '/exam/elPaper/copy',
+    method: 'post',
+    data: data
+  })
+}
+//查询知识点下题目数量
+export function examElQuestionBankKnowledgePointCount(query) {
+  return request({
+    url: '/exam/elQuestionBank/knowledge-point-count',
+    method: 'get',
+    params: query
+  })
+}
+
 

+ 358 - 159
src/views/safetyEducationExaminationNew/examManagement/testPaperManagement/addPage.vue

@@ -12,12 +12,12 @@
         <!-- 第一块:基本信息 -->
         <div class="section-box">
           <!-- 试卷名称 -->
-          <el-form-item label="试卷名称" prop="data1" class="full-width-item">
-            <el-input v-model="newData.data1" maxLength="30" placeholder="请输入名称"/>
+          <el-form-item label="试卷名称" prop="paperName" class="full-width-item">
+            <el-input v-model="newData.paperName" maxLength="30" placeholder="请输入名称"/>
           </el-form-item>
           <!-- 总分数 / 及格分数 / 答题时间 -->
           <div class="flex-row-box">
-            <el-form-item label="总分数" prop="data2">
+            <el-form-item label="总分数" prop="totalScore">
               <div class="input-unit-box">
                 <el-input-number
                   class="form-input-number"
@@ -25,14 +25,14 @@
                   :min="0"
                   :max="9999"
                   :step="1" :precision="0" step-strictly
-                  v-model="newData.data2"
+                  v-model="newData.totalScore"
                   :controls="false"
                 >
                 </el-input-number>
                 <span class="unit-text">分</span>
               </div>
             </el-form-item>
-            <el-form-item label="及格分数" prop="data3">
+            <el-form-item label="及格分数" prop="passScore">
               <div class="input-unit-box">
                 <el-input-number
                   class="form-input-number"
@@ -40,14 +40,14 @@
                   :min="0"
                   :max="9999"
                   :step="1" :precision="0" step-strictly
-                  v-model="newData.data3"
+                  v-model="newData.passScore"
                   :controls="false"
                 >
                 </el-input-number>
                 <span class="unit-text">分</span>
               </div>
             </el-form-item>
-            <el-form-item label="答题时间" prop="data4">
+            <el-form-item label="答题时间" prop="answerDuration">
               <div class="input-unit-box">
                 <el-input-number
                   class="form-input-number"
@@ -55,7 +55,7 @@
                   :min="0"
                   :max="9999"
                   :step="1" :precision="0" step-strictly
-                  v-model="newData.data4"
+                  v-model="newData.answerDuration"
                   :controls="false"
                 >
                 </el-input-number>
@@ -66,8 +66,8 @@
 
           <!-- 专业类别 / 是否共享 -->
           <div class="flex-row-box">
-            <el-form-item label="专业类别" prop="data5">
-              <el-select v-model="newData.data5" placeholder="专业类别" style="width:200px;">
+            <el-form-item label="专业类别" prop="disciplineTypeId">
+              <el-select v-model="newData.disciplineTypeId" placeholder="专业类别" style="width:200px;">
                 <el-option
                   v-for="item in optionListA"
                   :key="item.id"
@@ -76,15 +76,15 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item label="是否共享" prop="data6">
+            <el-form-item label="是否共享" prop="shareStatus">
               <el-switch
-                v-model="newData.data6"
-                :active-value="true"
-                :inactive-value="false"
+                v-model="newData.shareStatus"
+                :active-value="1"
+                :inactive-value="0"
                 active-color="#0183FB"
                 inactive-color="#AAAAAA"
               />
-              <span class="share-tip">{{newData.data6 ? '共享开启,全校所有学院单位都可见' : '不共享,仅本学院单位及上级都可见'}}</span>
+              <span class="share-tip">{{newData.shareStatus == 1 ? '共享开启,全校所有学院单位都可见' : '不共享,仅本学院单位及上级都可见'}}</span>
             </el-form-item>
           </div>
         </div>
@@ -95,27 +95,30 @@
         <!-- 第二块:组卷方式 & 知识点 -->
         <div class="section-box">
           <!-- 组卷方式 -->
-          <el-form-item label="组卷方式" prop="data7">
-            <el-radio-group v-model="newData.data7">
+          <el-form-item label="组卷方式" prop="assemblyMode">
+            <el-radio-group v-model="newData.assemblyMode">
               <el-radio :label="1">固定组卷</el-radio>
               <el-radio :label="2">随机组卷</el-radio>
             </el-radio-group>
           </el-form-item>
 
           <!-- 选择知识点 -->
-          <el-form-item label="选择知识点" prop="data8" class="knowledge-form-item">
+          <el-form-item label="选择知识点" prop="knowledgePointId" class="knowledge-form-item">
             <!-- 统计信息条 -->
             <div class="stat-bar">
               <span>总题目数:<b>{{totalQuestionCount}}</b></span>
               <span style="margin-left:20px;">总分:<b>{{totalScore}}</b></span>
-              <span style="margin-left:20px;" v-if="remainScore > 0">还需设置 <b>{{remainScore}}</b> 分的题目</span>
+              <span style="margin-left:20px;">
+                <span v-if="remainScore > 0">还需设置 <b>{{remainScore}}</b> 分的题目</span>
+                <span v-if="remainScore < 0">超过总分数 <b>{{Math.abs(remainScore)}}</b> 分</span>
+              </span>
             </div>
 
             <!-- 已选知识点标签 -->
             <div class="knowledge-tag-box">
               <el-cascader
                 ref="knowledgeCascader"
-                v-model="newData.data8"
+                v-model="newData.knowledgePointId"
                 :options="optionListKnowledge"
                 :props="{
                   multiple :true,
@@ -134,16 +137,16 @@
             </div>
 
             <!-- 知识点明细表格 -->
-            <div class="knowledge-table" v-if="selectedKnowledgePoints.length > 0">
+            <div class="knowledge-table" v-if="fixedKnowledgePointConfigs.length > 0">
               <div class="table-header">
                 <span class="col-name">知识点</span>
                 <span class="col-count">试题数量</span>
                 <span class="col-score">每题分数</span>
-                <span class="col-fixed">{{newData.data7==1?'固定选题':'随机选题'}}</span>
+                <span class="col-fixed">{{newData.assemblyMode==1?'固定选题':'随机选题'}}</span>
               </div>
               <div
                 class="table-row"
-                v-for="(item, index) in selectedKnowledgePoints"
+                v-for="(item, index) in fixedKnowledgePointConfigs"
                 :key="index"
                 draggable="true"
                 @dragstart="onBigDragStart($event, index)"
@@ -153,41 +156,43 @@
               >
                 <div class="table-big-row">
                   <span class="col-name color-name">
-                    <span class="roller-span" v-show="newData.data7==2"
+                    <span class="roller-span" v-show="newData.assemblyMode==2"
                           @click="rollerButton(index)"
                           :class="item.rollerType?'el-icon-arrow-up':'el-icon-arrow-down'"></span>
                     {{item.name}}
                   </span>
-                  <span class="col-count color-name">{{item.questionCount || 0}}</span>
+                  <span class="col-count color-name">{{item.questionTotalCount}}</span>
                   <span class="col-score">
                     <span class="number-stepper">
                       <el-input-number
-                        v-if="newData.data7==1"
+                        v-if="newData.assemblyMode==1"
+                        @change="calculationMaxData()"
                         class="form-input-number"
                         style="width:160px"
                         :min="0"
                         :max="9999"
                         :step="1" :precision="0" step-strictly
-                        v-model="item.scorePerQuestion"
+                        v-model="item.questionScore"
                       >
                       </el-input-number>
                     </span>
                   </span>
                   <span class="col-fixed">
-                    <span class="item-num-span" v-if="newData.data7==1">{{item.fixedCount}}</span>
-                    <span class="el-icon-circle-plus" v-if="newData.data7==1" @click="addFixed(index)"></span>
+                    <span class="item-num-span" v-if="newData.assemblyMode==1">{{item.questionIds.length}}</span>
+                    <span class="el-icon-circle-plus" v-if="newData.assemblyMode==1" @click="addFixed(index)"></span>
                     <span class="el-icon-rank"></span>
                   </span>
                 </div>
-                <div  v-if="newData.data7==2 && item.rollerType" class="table-min-row">
+                <div  v-if="newData.assemblyMode==2 && item.rollerType" class="table-min-row">
                   <span class="col-name">
                     <span class="roller-span">单选题</span>
                   </span>
-                  <span class="col-count color-name">{{item.maxNumA || 0}}</span>
+                  <span class="col-count color-name">{{item.singleQuestionCount}}</span>
                   <span class="col-score">
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:160px"
                         :min="0"
                         :max="9999"
@@ -201,9 +206,10 @@
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:80px"
                         :min="0"
-                        :max="9999"
+                        :max="item.singleQuestionCount"
                         :step="1" :precision="0" step-strictly
                         v-model="item.checkNumA"
                         :controls="false"
@@ -212,15 +218,16 @@
                     </span>
                   </span>
                 </div>
-                <div  v-if="newData.data7==2 && item.rollerType" class="table-min-row">
+                <div  v-if="newData.assemblyMode==2 && item.rollerType" class="table-min-row">
                   <span class="col-name">
-                    <span class="roller-span">选题</span>
+                    <span class="roller-span">选题</span>
                   </span>
-                  <span class="col-count color-name">{{item.maxNumB || 0}}</span>
+                  <span class="col-count color-name">{{item.multipleQuestionCount}}</span>
                   <span class="col-score">
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:160px"
                         :min="0"
                         :max="9999"
@@ -234,9 +241,10 @@
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:80px"
                         :min="0"
-                        :max="9999"
+                        :max="item.multipleQuestionCount"
                         :step="1" :precision="0" step-strictly
                         v-model="item.checkNumB"
                         :controls="false"
@@ -245,15 +253,16 @@
                     </span>
                   </span>
                 </div>
-                <div v-if="newData.data7==2 && item.rollerType" class="table-min-row">
+                <div v-if="newData.assemblyMode==2 && item.rollerType" class="table-min-row">
                   <span class="col-name">
                     <span class="roller-span">判断题</span>
                   </span>
-                  <span class="col-count color-name">{{item.maxNumC || 0}}</span>
+                  <span class="col-count color-name">{{item.judgeQuestionCount}}</span>
                   <span class="col-score">
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:160px"
                         :min="0"
                         :max="9999"
@@ -267,9 +276,10 @@
                     <span class="number-stepper">
                       <el-input-number
                         class="form-input-number"
+                        @change="calculationMaxData()"
                         style="width:80px"
                         :min="0"
-                        :max="9999"
+                        :max="item.judgeQuestionCount"
                         :step="1" :precision="0" step-strictly
                         v-model="item.checkNumC"
                         :controls="false"
@@ -289,29 +299,24 @@
       size="100%"
       custom-class="testPaper-select-drawer"
       :append-to-body="true"
-      :title="drawerKnowledgeName ? '固定选题 - ' + drawerKnowledgeName : '固定选题'"
+      :show-close="false"
+      title="固定选题"
       ref="drawer"
       :visible.sync="drawer"
       direction="rtl"
-      :withHeader="false"
     >
-      <drawer-item
-        v-if="drawer"
-        :knowledge-name="drawerKnowledgeName"
-        :knowledge-id="drawerKnowledgeId"
-        :score-per-question="drawerScorePerQuestion"
-        :total-score="Number(newData.data2) || 0"
-        :init-selected="drawerInitSelected"
-        @confirm="onDrawerConfirm"
-        @cancel="drawer = false"
-      />
+      <drawer-item v-if="drawer" :drawerPropsData="drawerPropsData"/>
     </el-drawer>
   </div>
 </template>
 
 <script>
-  import { examElKnowledgePointTreeList, examElDisciplineTypeList } from '@/api/safetyEducationExaminationNew/index'
+  import {
+    examElPaperAdd,examElPaperEdit,examElKnowledgePointTreeList,examElPaperDetail,
+    examElDisciplineTypeList,examElQuestionBankKnowledgePointCount
+  } from '@/api/safetyEducationExaminationNew/index'
   import drawerItem from './drawerItem.vue'
+  import { accAdd,accMul } from '@/utils/calculation'
 
   export default {
     name: 'addPage',
@@ -323,54 +328,70 @@
       const validateData = (rule, value, callback) => {
         if (value == 0) {
           callback(new Error('总分数不能为0'))
-        } else if (this.newData.data3 > value) {
+        } else if (this.newData.passScore > value) {
           callback(new Error('总分数不能小于及格分数'))
         } else {
           callback()
         }
       }
+      const validateData1 = (rule, value, callback) => {
+        if (value == 0) {
+          callback(new Error('及格分数不能为0'))
+        } else if (this.newData.passScore > value) {
+          callback(new Error('及格分数不能大于总分数'))
+        } else {
+          callback()
+        }
+      }
+      const validateData2 = (rule, value, callback) => {
+        if (value == 0) {
+          callback(new Error('答题时间不能为0'))
+        } else {
+          callback()
+        }
+      }
       return {
+        totalQuestionCount:0,
+        totalScore:0,
         newData: {
-          data1: '',
-          data2: 0,
-          data3: 0,
-          data4: 0,
-          data5: null,
-          data6: true,
-          data7: 1,
-          data8: []
+          paperName: '',
+          totalScore: 0,
+          passScore: 0,
+          answerDuration: 0,
+          disciplineTypeId: null,
+          shareStatus: true,
+          assemblyMode: 1,
+          knowledgePointId: []
         },
         rules: {
-          data1: [
+          paperName: [
             { required: true, message: '请输入试卷名称', trigger: 'blur' }
           ],
-          data2: [
+          totalScore: [
             { required: true, message: '请输入总分数', trigger: 'blur' },
             { validator: validateData, trigger: 'blur' }
           ],
-          data3: [
-            { required: true, message: '请输入及格分数', trigger: 'blur' }
+          passScore: [
+            { required: true, message: '请输入及格分数', trigger: 'blur' },
+            { validator: validateData1, trigger: 'blur' }
           ],
-          data4: [
-            { required: true, message: '请输入答题时间', trigger: 'blur' }
+          answerDuration: [
+            { required: true, message: '请输入答题时间', trigger: 'blur' },
+            { validator: validateData2, trigger: 'blur' }
           ],
-          data7: [
+          assemblyMode: [
             { required: true, message: '请选择组卷方式', trigger: 'change' }
           ],
-          data8: [
+          knowledgePointId: [
             { required: true, message: '请选择知识点', trigger: 'change' }
           ]
         },
         optionListA: [],
         optionListKnowledge: [],
-        selectedKnowledgePoints: [],
+        fixedKnowledgePointConfigs: [],
         //弹窗相关
         drawer: false,
-        drawerKnowledgeName: '',
-        drawerKnowledgeId: null,
-        drawerScorePerQuestion: 1,
-        drawerInitSelected: [],
-        drawerCurrentIndex: -1,
+        drawerPropsData:{},
         //拖拽相关
         dragInfo: {
           type: null, // 'big' 或 'small'
@@ -380,16 +401,9 @@
       }
     },
     computed: {
-      totalQuestionCount() {
-        return this.selectedKnowledgePoints.reduce((sum, item) => sum + (Number(item.fixedCount) || 0), 0)
-      },
-      totalScore() {
-        return this.selectedKnowledgePoints.reduce((sum, item) => {
-          return sum + (Number(item.fixedCount) || 0) * (Number(item.scorePerQuestion) || 0)
-        }, 0)
-      },
       remainScore() {
-        return Math.max(0, Number(this.newData.data2 || 0) - this.totalScore)
+        // return Math.max(0, Number(this.newData.totalScore || 0) - this.totalScore)
+        return Number(this.newData.totalScore || 0) - this.totalScore
       }
     },
     mounted() {
@@ -398,9 +412,100 @@
       this.examElDisciplineTypeList()
     },
     methods: {
+      //弹窗返回
+      drawerReturnButton(){
+        this.$refs.drawer.closeDrawer();
+      },
+      //弹窗确定
+      drawerConfirmButton(obj){
+        this.fixedKnowledgePointConfigs[obj.index].questionIds = [...obj.questionIds]
+        this.calculationMaxData();
+        this.$refs.drawer.closeDrawer();
+      },
       initialize() {
-        if (this.propsData && this.propsData.id) {
-          this.newData = { ...this.propsData }
+        let self = this;
+        if (this.propsData.id) {
+          examElPaperDetail({id:this.propsData.id}).then(response => {
+            let obj = {
+              id:this.propsData.id,
+              paperName:response.data.paperName,
+              totalScore:response.data.totalScore,
+              passScore:response.data.passScore,
+              answerDuration:response.data.answerDuration,
+              disciplineTypeId:response.data.disciplineTypeId,
+              shareStatus:response.data.shareStatus,
+              assemblyMode:response.data.assemblyMode,
+              knowledgePointId:[],
+            };
+            let list = [];
+            if(response.data.assemblyMode == 1){
+              for(let i=0;i<response.data.fixedKnowledgePointDetails.length;i++){
+                obj.knowledgePointId.push(response.data.fixedKnowledgePointDetails[i].knowledgePointId)
+                list.push({
+                  id: response.data.fixedKnowledgePointDetails[i].knowledgePointId,
+                  name:response.data.fixedKnowledgePointDetails[i].knowledgePointName,
+                  rollerType: true,
+                  questionIds: response.data.fixedKnowledgePointDetails[i].questionIds,
+                  questionScore: response.data.fixedKnowledgePointDetails[i].questionScore,//每题分数
+                  fixedCount: response.data.fixedKnowledgePointDetails[i].questionIds.length,//选题数量
+                  questionTotalCount:response.data.fixedKnowledgePointDetails[i].questionTotalCount,
+                  singleQuestionCount:0,
+                  multipleQuestionCount:0,
+                  judgeQuestionCount:0,
+                  scoreA:0,
+                  checkNumA:0,
+                  scoreB:0,
+                  checkNumB:0,
+                  scoreC:0,
+                  checkNumC:0,
+                })
+              }
+            }else if(response.data.assemblyMode == 2){
+              for(let i=0;i<response.data.randomKnowledgePointDetails.length;i++){
+                obj.knowledgePointId.push(response.data.randomKnowledgePointDetails[i].knowledgePointId)
+                let minObj = {
+                  id: response.data.randomKnowledgePointDetails[i].knowledgePointId,
+                  name:response.data.randomKnowledgePointDetails[i].knowledgePointName,
+                  rollerType: true,
+                  questionIds: [],
+                  questionScore: 0,//每题分数
+                  fixedCount: 0,//选题数量
+                  questionTotalCount:response.data.randomKnowledgePointDetails[i].questionTotalCount,
+                  singleQuestionCount:0,
+                  multipleQuestionCount:0,
+                  judgeQuestionCount:0,
+                  scoreA:0,
+                  checkNumA:0,
+                  scoreB:0,
+                  checkNumB:0,
+                  scoreC:0,
+                  checkNumC:0,
+                }
+                for(let o=0;o<response.data.randomKnowledgePointDetails[i].rules.length;o++){
+                  if(response.data.randomKnowledgePointDetails[i].rules[o].questionType == 1){
+                    minObj.singleQuestionCount = response.data.randomKnowledgePointDetails[i].rules[o].questionTotalCount
+                    minObj.scoreA = response.data.randomKnowledgePointDetails[i].rules[o].questionScore
+                    minObj.checkNumA = response.data.randomKnowledgePointDetails[i].rules[o].questionCount
+                  }
+                  if(response.data.randomKnowledgePointDetails[i].rules[o].questionType == 2){
+                    minObj.multipleQuestionCount = response.data.randomKnowledgePointDetails[i].rules[o].questionTotalCount
+                    minObj.scoreB = response.data.randomKnowledgePointDetails[i].rules[o].questionScore
+                    minObj.checkNumB = response.data.randomKnowledgePointDetails[i].rules[o].questionCount
+                  }
+                  if(response.data.randomKnowledgePointDetails[i].rules[o].questionType == 3){
+                    minObj.judgeQuestionCount = response.data.randomKnowledgePointDetails[i].rules[o].questionTotalCount
+                    minObj.scoreC = response.data.randomKnowledgePointDetails[i].rules[o].questionScore
+                    minObj.checkNumC = response.data.randomKnowledgePointDetails[i].rules[o].questionCount
+                  }
+                }
+                list.push(minObj);
+              }
+            }
+            this.$set(this,'newData',obj);
+            this.$set(this,'fixedKnowledgePointConfigs',list);
+            this.calculationMaxData();
+            this.$forceUpdate();
+          })
         }
       },
       backPage() {
@@ -410,26 +515,102 @@
         this.$set(this, 'drawer', true)
       },
       submitButton() {
-        this.$refs.form.validate(valid => {
-          if (!valid) return
-          // TODO: 调用保存接口
+        let self = this;
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if(this.remainScore != 0){
+              this.msgError('总分数与试题分数不一致')
+              return
+            }
+            this.$confirm('是否确认保存?', "警告", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            }).then(function() {
+            }).then(() => {
+              self.dataIntegration();
+            }).catch(() => {});
+          }
+        })
+
+      },
+      dataIntegration(){
+        let self = this;
+        let obj = {
+          paperName:this.newData.paperName,
+          totalScore:this.newData.totalScore,
+          passScore:this.newData.passScore,
+          answerDuration:this.newData.answerDuration,
+          disciplineTypeId:this.newData.disciplineTypeId,
+          shareStatus:this.newData.shareStatus,
+          assemblyMode:this.newData.assemblyMode,
+          fixedKnowledgePointConfigs:[],
+          randomKnowledgePointConfigs:[],
+        };
+        for(let i=0;i<self.fixedKnowledgePointConfigs.length;i++){
+          if(this.newData.assemblyMode == 1){
+            obj.fixedKnowledgePointConfigs.push({
+              knowledgePointId:self.fixedKnowledgePointConfigs[i].id,
+              questionScore:self.fixedKnowledgePointConfigs[i].questionScore,
+              questionIds:self.fixedKnowledgePointConfigs[i].questionIds,
+            })
+          }else if(this.newData.assemblyMode == 2){
+            obj.randomKnowledgePointConfigs.push({
+              knowledgePointId:self.fixedKnowledgePointConfigs[i].id,
+              rules:[
+                {
+                  questionType:1,
+                  questionCount:self.fixedKnowledgePointConfigs[i].scoreA,
+                  questionScore:self.fixedKnowledgePointConfigs[i].checkNumA,
+                },
+                {
+                  questionType:2,
+                  questionCount:self.fixedKnowledgePointConfigs[i].scoreB,
+                  questionScore:self.fixedKnowledgePointConfigs[i].checkNumB,
+                },
+                {
+                  questionType:3,
+                  questionCount:self.fixedKnowledgePointConfigs[i].scoreC,
+                  questionScore:self.fixedKnowledgePointConfigs[i].checkNumC,
+                },
+              ],
+            })
+          }
+        }
+        if (this.newData.id){
+          obj.id = this.newData.id;
+          this.examElPaperEdit(obj);
+        }else{
+          this.examElPaperAdd(obj);
+        }
+      },
+      examElPaperAdd(obj){
+        examElPaperAdd(obj).then(response => {
+          this.msgSuccess(response.message);
+          this.$parent.tableButton(6);
+        })
+      },
+      examElPaperEdit(obj){
+        examElPaperEdit(obj).then(response => {
+          this.msgSuccess(response.message);
+          this.$parent.tableButton(6);
         })
       },
       //收起展开
       rollerButton(idnex){
-        this.$set(this.selectedKnowledgePoints[idnex],'rollerType',!this.selectedKnowledgePoints[idnex].rollerType);
+        this.$set(this.fixedKnowledgePointConfigs[idnex],'rollerType',!this.fixedKnowledgePointConfigs[idnex].rollerType);
       },
       //change触发过滤知识点列表
       onKnowledgeSelect(val) {
         if (!Array.isArray(val)) return
-        for (let i = this.selectedKnowledgePoints.length - 1; i >= 0; i--) {
-          const currentItem = this.selectedKnowledgePoints[i]
+        for (let i = this.fixedKnowledgePointConfigs.length - 1; i >= 0; i--) {
+          const currentItem = this.fixedKnowledgePointConfigs[i]
           if (!val.includes(currentItem.id)) {
-            this.selectedKnowledgePoints.splice(i, 1)
+            this.fixedKnowledgePointConfigs.splice(i, 1)
           }
         }
         val.forEach(id => {
-          const exists = this.selectedKnowledgePoints.some(item => item.id === id)
+          const exists = this.fixedKnowledgePointConfigs.some(item => item.id === id)
           if (!exists) {
             const node = this.$refs.knowledgeCascader.getCheckedNodes()
             let name = ''
@@ -438,76 +619,43 @@
                 name = node[i].label
               }
             }
-            this.selectedKnowledgePoints.push({
-              id: id,
-              name,
-              rollerType: true,
-              dataList: [],
-              questionCount: 0,
-              scorePerQuestion: 0,
-              fixedCount: 0,
-              maxNumA:0,
-              scoreA:0,
-              checkNumA:0,
-              maxNumB:0,
-              scoreB:0,
-              checkNumB:0,
-              maxNumC:0,
-              scoreC:0,
-              checkNumC:0,
-            })
+            this.examElQuestionBankKnowledgePointCount(name,id);
           }
         })
       },
-      changeScore(index, delta) {
-        const val = (Number(this.selectedKnowledgePoints[index].scorePerQuestion) || 0) + delta
-        this.selectedKnowledgePoints[index].scorePerQuestion = Math.max(0, val)
-      },
-      minChangeScore(index, delta,type) {
-        let val = 0;
-        if(type == 1){
-          val = (Number(this.selectedKnowledgePoints[index].scoreA) || 0) + delta
-          this.selectedKnowledgePoints[index].scoreA = Math.max(0, val)
-        }else if(type == 2){
-          val = (Number(this.selectedKnowledgePoints[index].scoreB) || 0) + delta
-          this.selectedKnowledgePoints[index].scoreB = Math.max(0, val)
-        }else if(type == 3){
-          val = (Number(this.selectedKnowledgePoints[index].scoreC) || 0) + delta
-          this.selectedKnowledgePoints[index].scoreC = Math.max(0, val)
-        }
+      //查询知识点题目数量
+      examElQuestionBankKnowledgePointCount(name,id) {
+        examElQuestionBankKnowledgePointCount({knowledgePointId:id}).then(response => {
+          this.fixedKnowledgePointConfigs.push({
+            id: id,
+            name,
+            rollerType: true,
+            questionIds: [],
+            questionScore: 0,//每题分数
+            fixedCount: 0,//选题数量
+            questionTotalCount:response.data.questionTotalCount,//试题总量
+            singleQuestionCount:response.data.singleQuestionCount,//单选
+            multipleQuestionCount:response.data.multipleQuestionCount,//多选
+            judgeQuestionCount:response.data.judgeQuestionCount,//判断
+            scoreA:0,
+            checkNumA:0,
+            scoreB:0,
+            checkNumB:0,
+            scoreC:0,
+            checkNumC:0,
+          })
+        })
       },
       addFixed(index) {
-        const item = this.selectedKnowledgePoints[index]
-        this.drawerCurrentIndex = index
-        this.drawerKnowledgeName = item.name
-        this.drawerKnowledgeId = item.id
-        this.drawerScorePerQuestion = Number(item.scorePerQuestion) || 1
-        this.drawerInitSelected = item.fixedList ? [...item.fixedList] : []
+        this.$set(this,'drawerPropsData',{
+          titleName:this.fixedKnowledgePointConfigs[index].name,
+          knowledgePointId:this.fixedKnowledgePointConfigs[index].id,
+          maxScore:this.remainScore,
+          questionIds:this.fixedKnowledgePointConfigs[index].questionIds,
+          index:index
+        });
         this.drawer = true
       },
-      onDrawerConfirm(list) {
-        if (this.drawerCurrentIndex >= 0) {
-          const item = this.selectedKnowledgePoints[this.drawerCurrentIndex]
-          item.fixedList = list
-          item.fixedCount = list.length
-          this.$set(this.selectedKnowledgePoints, this.drawerCurrentIndex, { ...item })
-        }
-        this.drawer = false
-      },
-      //数字过滤
-      handleInput(type, val) {
-        if (type == 1) {
-          this.newData.data2 = val.replace(/[^\d]/g, '')
-        } else if (type == 2) {
-          this.newData.data3 = val.replace(/[^\d]/g, '')
-        } else if (type == 3) {
-          this.newData.data4 = val.replace(/[^\d]/g, '')
-        }
-      },
-      //及格分判断
-      validateData2() {
-        this.$refs.form && this.$refs.form.validateField('data2')
-      },
       // ========== 大项拖拽逻辑 ==========
       onBigDragStart(e, index) {
         this.dragInfo = { type: 'big', bigIndex: index, smallIndex: null }
@@ -526,8 +674,8 @@
         if (sourceIndex === targetIndex) return
 
         // 核心:交换数组元素
-        const movedItem = this.selectedKnowledgePoints.splice(sourceIndex, 1)[0]
-        this.selectedKnowledgePoints.splice(targetIndex, 0, movedItem)
+        const movedItem = this.fixedKnowledgePointConfigs.splice(sourceIndex, 1)[0]
+        this.fixedKnowledgePointConfigs.splice(targetIndex, 0, movedItem)
       },
       // 拖拽结束,清理样式
       onDragEnd(e) {
@@ -554,6 +702,47 @@
           this.$set(this, 'optionListKnowledge', list)
         })
       },
+      //计算总分总题
+      calculationMaxData(){
+        let self = this;
+        let totalQuestionCount = 0;
+        let totalScore = 0;
+        for(let i=0;i<self.fixedKnowledgePointConfigs.length;i++){
+          if(self.newData.assemblyMode == 1){
+            //固定组卷
+            totalQuestionCount = self.accAdd(totalQuestionCount,self.fixedKnowledgePointConfigs[i].questionIds.length)
+            let minTotalScore = self.accMul(self.fixedKnowledgePointConfigs[i].questionScore,self.fixedKnowledgePointConfigs[i].questionIds.length);
+            totalScore =  self.accAdd(totalScore,minTotalScore)
+          }else if(self.newData.assemblyMode == 2){
+            let numA = self.accMul(self.fixedKnowledgePointConfigs[i].scoreA,self.fixedKnowledgePointConfigs[i].checkNumA);
+            let numB = self.accMul(self.fixedKnowledgePointConfigs[i].scoreB,self.fixedKnowledgePointConfigs[i].checkNumB);
+            let numC = self.accMul(self.fixedKnowledgePointConfigs[i].scoreC,self.fixedKnowledgePointConfigs[i].checkNumC);
+            totalScore = self.accAdd(totalScore,numA)
+            totalScore = self.accAdd(totalScore,numB)
+            totalScore = self.accAdd(totalScore,numC)
+            totalQuestionCount = self.accAdd(totalQuestionCount,self.fixedKnowledgePointConfigs[i].checkNumA)
+            totalQuestionCount = self.accAdd(totalQuestionCount,self.fixedKnowledgePointConfigs[i].checkNumB)
+            totalQuestionCount = self.accAdd(totalQuestionCount,self.fixedKnowledgePointConfigs[i].checkNumC)
+          }
+        }
+        this.$set(this,'totalQuestionCount',totalQuestionCount);
+        this.$set(this,'totalScore',totalScore);
+      },
+      //乘法
+      accMul(arg1,arg2){
+        var m=0,s1=arg1.toString(),s2=arg2.toString();
+        try{m+=s1.split(".")[1].length}catch(e){}
+        try{m+=s2.split(".")[1].length}catch(e){}
+        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
+      },
+      //加法
+      accAdd(arg1,arg2){
+        var r1,r2,m;
+        try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
+        try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
+        m=Math.pow(10,Math.max(r1,r2))
+        return ((arg1*m+arg2*m)/m).toFixed(0);
+      },
     }
   }
 </script>
@@ -898,3 +1087,13 @@
     }
   }
 </style>
+<style lang="scss">
+  .testPaper-select-drawer{
+    .el-drawer__body{
+      padding:0;
+    }
+    .el-drawer__header{
+      margin:0;
+    }
+  }
+</style>

+ 426 - 296
src/views/safetyEducationExaminationNew/examManagement/testPaperManagement/drawerItem.vue

@@ -1,20 +1,16 @@
 <!-- 固定选题 Drawer 内容 -->
 <template>
   <div class="drawerItem-container">
-    <!-- 顶部知识点标题 -->
-    <div class="drawer-header">
-      <span class="knowledge-title">{{ knowledgeName || '知识点名称' }}</span>
-    </div>
-
-    <div class="drawer-body">
-      <!-- 左侧:题库列表 -->
-      <div class="panel left-panel">
-        <div class="panel-inner">
-          <div class="filter-bar">
+    <div class="left-max-big-box">
+      <div class="left-title-p">{{titleName}}</div>
+      <div class="page-form-title-box">
+        <el-form :model="leftQueryParams" class="form-box" ref="queryForm"
+                 :inline="true" style="width:100%;">
+          <el-form-item label="" prop="deptId">
             <el-cascader
               style="width: 180px"
-              v-model="leftQuery.source"
-              :options="optionSource"
+              v-model="leftQueryParams.deptId"
+              :options="optionListA"
               :props="{
                     emitPath:false,
                     checkStrictly: true,
@@ -26,69 +22,88 @@
               filterable
               placeholder="来源"
             ></el-cascader>
-            <el-select v-model="leftQuery.type" placeholder="题型" size="small" style="width:90px;" clearable>
-              <el-option v-for="item in optionType" :key="item.value" :label="item.label" :value="item.value" />
+          </el-form-item>
+          <el-form-item label="" prop="questionType">
+            <el-select v-model="leftQueryParams.questionType" placeholder="题型" style="width: 140px">
+              <el-option
+                v-for="dict in optionListB"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
             </el-select>
-            <el-select v-model="leftQuery.difficulty" placeholder="难度" size="small" style="width:90px;" clearable>
-              <el-option v-for="item in optionDifficulty" :key="item.value" :label="item.label" :value="item.value" />
+          </el-form-item>
+          <el-form-item label="" prop="difficulty">
+            <el-select v-model="leftQueryParams.difficulty" placeholder="难度" style="width: 140px">
+              <el-option
+                v-for="dict in optionListC"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
             </el-select>
-            <el-input v-model="leftQuery.keyword" placeholder="搜索试题" size="small" style="width:140px;" clearable />
-            <el-button type="primary" size="small" @click="searchLeft">查询</el-button>
-            <el-button size="small" @click="resetLeft">重置</el-button>
-          </div>
-          <el-table
-            ref="leftTable"
-            :data="leftTableData"
-            size="small"
-            @selection-change="onLeftSelectionChange"
-            style="width:100%;"
-            height="calc(100vh - 220px)"
-          >
-            <el-table-column type="selection" width="40" />
-            <el-table-column label="题干" prop="stem" show-overflow-tooltip>
-              <template slot-scope="{ row }">
-                <span class="stem-text" v-html="row.stem || ''"></span>
-              </template>
-            </el-table-column>
-            <el-table-column label="题型" prop="typeName" width="80" align="center">
-              <template slot-scope="{ row }">
-                <el-tag size="mini" :type="typeTagMap[row.type]" effect="plain">{{ row.typeName }}</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column label="难度" prop="difficultyName" width="70" align="center">
-              <template slot-scope="{ row }">
-                <span :class="['difficulty-text', 'diff-' + row.difficulty]">{{ row.difficultyName }}</span>
-              </template>
-            </el-table-column>
-          </el-table>
-        </div>
+          </el-form-item>
+          <el-form-item label="" prop="questionContent">
+            <el-input
+              maxLength="30"
+              v-model="leftQueryParams.questionContent"
+              placeholder="搜索试题"
+              style="width: 140px"
+            />
+          </el-form-item>
+          <p class="page-inquire-common-style-button" @click="leftHandleQuery">查询</p>
+          <p class="page-reset-common-style-button" @click="leftResetQuery">重置</p>
+        </el-form>
       </div>
-
-      <!-- 中间:穿梭按钮 -->
-      <div class="middle-actions">
-        <el-button circle class="transfer-btn" @click="moveToRight">
-          <i class="el-icon-arrow-right"></i>
-        </el-button>
-        <el-button circle class="transfer-btn" style="margin-left:0;" @click="moveToLeft">
-          <i class="el-icon-arrow-left"></i>
-        </el-button>
+      <div class="page-content-box">
+        <el-table class="table-box" v-loading="leftLoading" border :data="leftDataList"
+                  ref="leftMultipleTable" :row-key="leftGetRowKey" @selection-change="leftHandleSelectionChange">
+          <el-table-column type="selection" width="55" :reserve-selection="true"></el-table-column>
+          <el-table-column label="题干" prop="questionContent"  show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span style="color:#0183fa;cursor: pointer;" @click="tableButton(2,scope.row)">{{ cleanRichText(scope.row.questionContent) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="题型" prop="questionType" width="140" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ scope.row.questionType == 1?'单选题':(scope.row.questionType == 2?'多选题':(scope.row.questionType == 3?'判断题':'')) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="难度" prop="content" width="140" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ scope.row.difficulty == 1?'简单':(scope.row.difficulty == 2?'一般':(scope.row.difficulty == 3?'较难':(scope.row.difficulty == 4?'极难':''))) }}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+        <pagination :page-sizes="[20, 30, 40, 50]"
+                    v-show="leftTotal>0"
+                    :total="leftTotal"
+                    :page.sync="leftQueryParams.page"
+                    :limit.sync="leftQueryParams.pageSize"
+                    @pagination="leftGetList"
+        />
       </div>
-
-      <!-- 右侧:已选题目 -->
-      <div class="panel right-panel">
-        <div class="panel-inner">
-          <div class="stat-bar">
-            <span>总题目数:<b>{{ rightTableData.length }}</b></span>
-            <span style="margin-left:20px;">总分:<b>{{ rightTotalScore }}</b></span>
-            <span v-if="remainScore > 0" style="margin-left:20px;color:#e6a23c;">
-              还需设置 <b>{{ remainScore }}</b> 分的题目
-            </span>
-          </div>
-          <div class="filter-bar">
+    </div>
+    <div class="center-max-big-box">
+      <p></p>
+      <p class="el-icon-arrow-right" @click="addButton()"></p>
+      <p class="el-icon-arrow-left" @click="delButton()"></p>
+      <p></p>
+    </div>
+    <div class="right-max-big-box">
+      <div class="right-title-box">
+        <p>总题目数:{{maxNum}}</p>
+        <p>总分:{{maxScore}}</p>
+        <!--<p>还需设置 {{gapScore}} 分的题目</p>-->
+      </div>
+      <div class="page-form-title-box">
+        <el-form :model="rightQueryParams" class="form-box" ref="queryForm"
+                 :inline="true" style="width:100%;">
+          <el-form-item label="" prop="deptId">
             <el-cascader
               style="width: 180px"
-              v-model="rightQuery.source"
-              :options="optionSource"
+              v-model="rightQueryParams.deptId"
+              :options="optionListA"
               :props="{
                     emitPath:false,
                     checkStrictly: true,
@@ -100,295 +115,410 @@
               filterable
               placeholder="来源"
             ></el-cascader>
-            <el-select v-model="rightQuery.type" placeholder="题型" size="small" style="width:90px;" clearable>
-              <el-option v-for="item in optionType" :key="item.value" :label="item.label" :value="item.value" />
+          </el-form-item>
+          <el-form-item label="" prop="questionType">
+            <el-select v-model="rightQueryParams.questionType" placeholder="题型" style="width: 140px">
+              <el-option
+                v-for="dict in optionListB"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
             </el-select>
-            <el-select v-model="rightQuery.difficulty" placeholder="难度" size="small" style="width:90px;" clearable>
-              <el-option v-for="item in optionDifficulty" :key="item.value" :label="item.label" :value="item.value" />
+          </el-form-item>
+          <el-form-item label="" prop="difficulty">
+            <el-select v-model="rightQueryParams.difficulty" placeholder="难度" style="width: 140px">
+              <el-option
+                v-for="dict in optionListC"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
             </el-select>
-            <el-input v-model="rightQuery.keyword" placeholder="搜索试题" size="small" style="width:140px;" clearable />
-            <el-button type="primary" size="small" @click="searchRight">查询</el-button>
-            <el-button size="small" @click="resetRight">重置</el-button>
-          </div>
-          <el-table
-            ref="rightTable"
-            :data="rightTableDataFiltered"
-            size="small"
-            @selection-change="onRightSelectionChange"
-            style="width:100%;"
-            height="calc(100vh - 260px)"
-          >
-            <el-table-column type="selection" width="40" />
-            <el-table-column label="题干" prop="stem" show-overflow-tooltip>
-              <template slot-scope="{ row }">
-                <span class="stem-text" v-html="row.stem || ''"></span>
-              </template>
-            </el-table-column>
-            <el-table-column label="题型" prop="typeName" width="80" align="center">
-              <template slot-scope="{ row }">
-                <el-tag size="mini" :type="typeTagMap[row.type]" effect="plain">{{ row.typeName }}</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column label="难度" prop="difficultyName" width="70" align="center">
-              <template slot-scope="{ row }">
-                <span :class="['difficulty-text', 'diff-' + row.difficulty]">{{ row.difficultyName }}</span>
-              </template>
-            </el-table-column>
-          </el-table>
-        </div>
+          </el-form-item>
+          <el-form-item label="" prop="questionContent">
+            <el-input
+              maxLength="30"
+              v-model="rightQueryParams.questionContent"
+              placeholder="搜索试题"
+              style="width: 140px"
+            />
+          </el-form-item>
+          <p class="page-inquire-common-style-button" @click="rightHandleQuery">查询</p>
+          <p class="page-reset-common-style-button" @click="rightResetQuery">重置</p>
+        </el-form>
+      </div>
+      <div class="page-content-box">
+        <el-table class="table-box" v-loading="rightLoading" border :data="rightDataList"
+                  ref="rightMultipleTable" :row-key="rightGetRowKey" @selection-change="rightHandleSelectionChange">
+          <el-table-column type="selection" width="55" :reserve-selection="true"></el-table-column>
+          <el-table-column label="题干" prop="questionContent"  show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span style="color:#0183fa;cursor: pointer;" @click="tableButton(2,scope.row)">{{ cleanRichText(scope.row.questionContent) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="题型" prop="questionType" width="140" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ scope.row.questionType == 1?'单选题':(scope.row.questionType == 2?'多选题':(scope.row.questionType == 3?'判断题':'')) }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="难度" prop="content" width="140" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ scope.row.difficulty == 1?'简单':(scope.row.difficulty == 2?'一般':(scope.row.difficulty == 3?'较难':(scope.row.difficulty == 4?'极难':''))) }}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+        <pagination :page-sizes="[20, 30, 40, 50]"
+                    v-show="rightTotal>0"
+                    :total="rightTotal"
+                    :page.sync="rightQueryParams.page"
+                    :limit.sync="rightQueryParams.pageSize"
+                    @pagination="rightGetList"
+        />
       </div>
     </div>
-
-    <!-- 底部操作栏 -->
-    <div class="drawer-footer">
-      <el-button style="line-height:40px;" @click="$emit('cancel')">取消</el-button>
-      <el-button type="primary"  style="line-height:40px;width:100px;" @click="confirmSelect">确认选题</el-button>
+    <div class="button-position-box">
+      <p class="button-1" @click="outButton()">返回</p>
+      <p class="button-2" @click="resetButton()">重置</p>
+      <p class="button-3" @click="saveButton()">保存</p>
     </div>
   </div>
 </template>
 
 <script>
   import {
-    systemDeptCurrentDept,
+    systemDeptCurrentDept,examElQuestionBankList,
   } from "@/api/safetyEducationExaminationNew/index";
   export default {
     name: 'drawerItem',
     props: {
-      knowledgeName: { type: String, default: '' },
-      knowledgeId: { type: [String, Number], default: null },
-      scorePerQuestion: { type: Number, default: 1 },
-      totalScore: { type: Number, default: 0 },
-      initSelected: { type: Array, default: () => [] },
+      drawerPropsData:{},
     },
     data() {
       return {
-        leftQuery: { source: null, type: null, difficulty: null, keyword: '' },
-        rightQuery: { source: null, type: null, difficulty: null, keyword: '' },
-        leftTableData: [],
-        rightTableData: [],
-        leftSelected: [],
-        rightSelected: [],
-        optionSource: [],
-        optionType: [
-          { label: '单选题', value: 1 },
-          { label: '多选题', value: 2 },
-          { label: '判断题', value: 3 },
-        ],
-        optionDifficulty: [
-          { label: '简单', value: 1 },
-          { label: '一般', value: 2 },
-          { label: '较难', value: 3 },
-          { label: '极难', value: 4 },
-        ],
-        typeTagMap: { 1: '', 2: 'warning', 3: 'success' },
-      }
-    },
-    computed: {
-      rightTotalScore() {
-        return this.rightTableData.length * (this.scorePerQuestion || 1)
-      },
-      remainScore() {
-        return Math.max(0, (this.totalScore || 0) - this.rightTotalScore)
-      },
-      rightTableDataFiltered() {
-        return this.rightTableData.filter(row => {
-          const q = this.rightQuery
-          if (q.source && row.source !== q.source) return false
-          if (q.type && row.type !== q.type) return false
-          if (q.difficulty && row.difficulty !== q.difficulty) return false
-          if (q.keyword && !(row.stem || '').includes(q.keyword)) return false
-          return true
-        })
-      },
-    },
-    watch: {
-      initSelected: {
-        immediate: true,
-        handler(val) {
-          if (val && val.length) {
-            this.rightTableData = [...val]
-          }
+        titleName:'',
+        knowledgePointId:'',
+        maxNum:0,
+        maxScore:0,
+        checkIndex:null,
+        // gapScore:0,
+        optionListA:[],
+        optionListB:[{value:1,label:'单选'},{value:2,label:'多选'},{value:3,label:'判断'}],
+        optionListC:[{value:1,label:'简单'},{value:2,label:'一般'},{value:3,label:'较难'},{value:4,label:'极难'}],
+        leftQueryParams:{
+          page:1,
+          pageSize:20,
+          questionContent:'',
+          difficulty:null,
+          questionType:null,
+          deptId:null,
         },
-      },
+        leftDataList:[],
+        leftTotal:0,
+        leftLoading:false,
+        rightQueryParams:{
+          page:1,
+          pageSize:20,
+          questionContent:'',
+          difficulty:null,
+          questionType:null,
+          deptId:null,
+        },
+        rightDataList:[],
+        rightTotal:0,
+        rightLoading:false,
+        //过滤/显示的题目ids
+        questionIds:[],
+        leftMultipleSelection:[],
+        rightMultipleSelection:[],
+      }
     },
     mounted() {
-      this.fetchLeftData()
+      this.$set(this,'titleName',this.drawerPropsData.name);
+      this.$set(this,'knowledgePointId',this.drawerPropsData.knowledgePointId);
+      this.$set(this,'maxScore',this.drawerPropsData.maxScore);
+      this.$set(this,'checkIndex',this.drawerPropsData.index);
+      this.$set(this,'questionIds',this.drawerPropsData.questionIds?this.drawerPropsData.questionIds:[]);
+      this.leftGetList()
+      this.rightGetList()
       this.systemDeptCurrentDept()
     },
     methods: {
-      fetchLeftData() {
-        // TODO: 调用接口获取题库列表
+      addButton(){
+        let self = this;
+        if(!self.leftMultipleSelection[0]){
+          this.msgError('请勾选左侧题目')
+          return
+        }
+        if(self.leftMultipleSelection.length + this.questionIds.length > 1000){
+          this.msgError('最多添加1000道题目')
+          return
+        }
+        let list = [];
+        for(let i=0;i<self.leftMultipleSelection.length;i++){
+          list.push(self.leftMultipleSelection[i].id)
+        }
+        this.$set(this,'questionIds',JSON.parse(JSON.stringify([...this.questionIds,...list])));
+        this.$set(this,'leftMultipleSelection',[]);
+        this.$set(this,'rightMultipleSelection',[]);
+        this.$refs.leftMultipleTable.clearSelection();
+        this.$refs.rightMultipleTable.clearSelection();
+        this.leftHandleQuery();
+        this.rightHandleQuery();
+      },
+      delButton(){
+        let self = this;
+        if(!self.rightMultipleSelection[0]){
+          this.msgError('请勾选右侧题目')
+          return
+        }
+        let list = [];
+        for(let i=0;i<self.rightMultipleSelection.length;i++){
+          list.push(self.rightMultipleSelection[i].id)
+        }
+        this.$set(this,'questionIds',JSON.parse(JSON.stringify(this.questionIds.filter(item => !list.includes(item)))));
+        this.$set(this,'leftMultipleSelection',[]);
+        this.$set(this,'rightMultipleSelection',[]);
+        this.$refs.leftMultipleTable.clearSelection();
+        this.$refs.rightMultipleTable.clearSelection();
+        this.leftHandleQuery();
+        this.rightHandleQuery();
+      },
+      //查询按钮
+      leftHandleQuery(){
+        this.$set(this.leftQueryParams,'page',1);
+        this.leftGetList();
       },
-      searchLeft() {
-        this.fetchLeftData()
+      //重置按钮
+      leftResetQuery(){
+        this.$set(this,'leftQueryParams',{
+          page:1,
+          pageSize:20,
+          questionContent:'',
+          difficulty:null,
+          questionType:null,
+          deptId:null,
+        });
+        this.leftGetList();
       },
-      resetLeft() {
-        this.leftQuery = { source: null, type: null, difficulty: null, keyword: '' }
-        this.fetchLeftData()
+      leftGetList(){
+        this.$set(this,'leftLoading',true);
+        let obj = JSON.parse(JSON.stringify(this.leftQueryParams))
+        obj.knowledgePointId = this.knowledgePointId;
+        obj.excludeQuestionIds = this.questionIds;
+        examElQuestionBankList(obj).then(response => {
+          this.$set(this,'leftLoading',false);
+          this.$set(this,'leftDataList',response.data.records);
+          this.$set(this,'leftTotal',response.data.total);
+        });
       },
-      searchRight() {
-        this.$forceUpdate()
+      leftGetRowKey(row) {
+        return row.id;
       },
-      resetRight() {
-        this.rightQuery = { source: null, type: null, difficulty: null, keyword: '' }
+      leftHandleSelectionChange(val) {
+        this.leftMultipleSelection = val;
       },
-      onLeftSelectionChange(selection) {
-        this.leftSelected = selection
+      //查询按钮
+      rightHandleQuery(){
+        this.$set(this.rightQueryParams,'page',1);
+        this.rightGetList();
       },
-      onRightSelectionChange(selection) {
-        this.rightSelected = selection
+      //重置按钮
+      rightResetQuery(){
+        this.$set(this,'rightQueryParams',{
+          page:1,
+          pageSize:20,
+          questionContent:'',
+          difficulty:null,
+          questionType:null,
+          deptId:null,
+        });
+        this.rightGetList();
       },
-      moveToRight() {
-        const rightIds = new Set(this.rightTableData.map(r => r.id))
-        const toAdd = this.leftSelected.filter(r => !rightIds.has(r.id))
-        this.rightTableData = [...this.rightTableData, ...toAdd]
-        this.$refs.leftTable.clearSelection()
+      rightGetList(){
+        if(!this.questionIds[0]){
+          this.$set(this,'rightDataList',[]);
+          this.$set(this,'rightTotal',0);
+          return
+        }
+        this.$set(this,'rightLoading',true);
+        let obj = JSON.parse(JSON.stringify(this.rightQueryParams))
+        obj.knowledgePointId = this.knowledgePointId;
+        obj.includeQuestionIds = this.questionIds;
+        examElQuestionBankList(obj).then(response => {
+          this.$set(this,'rightLoading',false);
+          this.$set(this,'rightDataList',response.data.records);
+          this.$set(this,'rightTotal',response.data.total);
+          this.$set(this,'maxNum',response.data.total);
+        });
       },
-      moveToLeft() {
-        const removeIds = new Set(this.rightSelected.map(r => r.id))
-        this.rightTableData = this.rightTableData.filter(r => !removeIds.has(r.id))
-        this.$refs.rightTable.clearSelection()
+      rightGetRowKey(row) {
+        return row.id;
       },
-      confirmSelect() {
-        this.$emit('confirm', [...this.rightTableData])
+      rightHandleSelectionChange(val) {
+        this.rightMultipleSelection = val;
       },
       //学院列表
       systemDeptCurrentDept(){
         systemDeptCurrentDept({}).then(response => {
           const list = response.data || [];
           this.formatTreeData(list);
-          this.$set(this,'optionSource',list);
+          this.$set(this,'optionListA',list);
         });
       },
+      //清洗富文本
+      cleanRichText(htmlStr, maxLength = 50) {
+        if (!htmlStr) return '';
+        const tempDiv = document.createElement('div');
+        tempDiv.innerHTML = htmlStr;
+        let text = tempDiv.textContent || tempDiv.innerText || '';
+        text = text.replace(/\s+/g, ' ').trim();
+        if (maxLength && text.length > maxLength) {
+          return text.substring(0, maxLength) + '...';
+        }
+        return text;
+      },
+      //返回
+      outButton(){
+        this.$parent.$parent.drawerReturnButton();
+      },
+      //重置
+      resetButton(){
+
+      },
+      //保存
+      saveButton(){
+        if(!this.questionIds[0]){
+          this.msgError('请选择题目')
+          return
+        }
+        let obj = {
+          index:this.checkIndex,
+          questionIds:this.questionIds
+        }
+        this.$parent.$parent.drawerConfirmButton(JSON.parse(JSON.stringify(obj)))
+      },
     },
   }
 </script>
 
 <style scoped lang="scss">
   .drawerItem-container {
+    flex:1;
     display: flex;
-    flex-direction: column;
-    height: 100%;
-    background: #f4f6fa;
-
-    .drawer-header {
-      padding: 16px 24px;
-      background: #fff;
-      border-bottom: 1px solid #e8e8e8;
-      flex-shrink: 0;
-      .knowledge-title {
-        font-size: 15px;
-        font-weight: 600;
-        color: #333;
-        &::before {
-          content: '';
-          display: inline-block;
-          width: 4px;
-          height: 16px;
-          background: #0183fa;
-          border-radius: 2px;
-          margin-right: 8px;
-          vertical-align: middle;
-        }
-      }
-    }
-
-    .drawer-body {
-      flex: 1;
+    overflow: hidden;
+    .left-max-big-box{
+      flex:1;
       display: flex;
+      flex-direction: column;
       overflow: hidden;
-      padding: 16px;
-      gap: 0;
+      border-right:1px solid #dedede;
+      .left-title-p{
+        height:50px;
+        border-bottom:1px solid #dedede;
+        line-height:50px;
+        padding: 0 20px;
+        color:#0183fa;
+        font-size:16px;
+      }
     }
-
-    .panel {
-      flex: 1;
-      background: #fff;
-      border-radius: 8px;
-      box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
+    .center-max-big-box{
+      width:60px;
       display: flex;
       flex-direction: column;
       overflow: hidden;
-      .panel-inner {
-        display: flex;
-        flex-direction: column;
-        height: 100%;
-        padding: 16px;
-        overflow: hidden;
+      p:nth-child(1){
+        flex: 1;
       }
-    }
-
-    .filter-bar {
-      display: flex;
-      flex-wrap: wrap;
-      gap: 8px;
-      align-items: center;
-      margin-bottom: 12px;
-      flex-shrink: 0;
-    }
-
-    .stat-bar {
-      background: #f0f7ff;
-      border: 1px solid #d6eaff;
-      border-radius: 6px;
-      padding: 10px 16px;
-      margin-bottom: 12px;
-      font-size: 13px;
-      color: #555;
-      flex-shrink: 0;
-      b {
-        color: #0183fa;
-        font-weight: 600;
+      p:nth-child(2){
+        width:40px;
+        height:40px;
+        line-height:40px;
+        text-align: center;
+        background-color: #0183fa;
+        color:#fff;
+        border-radius:50%;
+        margin:0 0 0 10px;
+        cursor: pointer;
+      }
+      p:nth-child(3){
+        width:40px;
+        height:40px;
+        line-height:40px;
+        text-align: center;
+        background-color: #0183fa;
+        color:#fff;
+        border-radius:50%;
+        margin:40px 0 0 10px;
+        cursor: pointer;
+      }
+      p:nth-child(4){
+        flex: 1;
       }
     }
-
-    .middle-actions {
-      width: 60px;
+    .right-max-big-box{
+      flex:1;
       display: flex;
       flex-direction: column;
-      justify-content: center;
-      align-items: center;
-      gap: 16px;
-      flex-shrink: 0;
-      padding: 0 8px;
-      .transfer-btn {
-        width: 44px;
-        height: 44px;
-        border: 2px solid #0183fa;
-        color: #0183fa;
-        background: #fff;
-        font-size: 16px;
-        padding: 0;
-        transition: all 0.2s;
-        &:hover {
-          background: #0183fa;
-          color: #fff;
+      overflow: hidden;
+      border-left:1px solid #dedede;
+      .right-title-box{
+        display: flex;
+        height:50px;
+        border-bottom:1px solid #dedede;
+        line-height:50px;
+        padding: 0 20px;
+        p{
+          margin-right:40px;
+          color:#0183fa;
+          font-size:14px;
+          font-weight:700;
         }
       }
     }
-
-    .difficulty-text {
-      font-size: 12px;
-      font-weight: 500;
-      &.diff-1 { color: #67c23a; }
-      &.diff-2 { color: #e6a23c; }
-      &.diff-3 { color: #f56c6c; }
-      &.diff-4 { color: #c0392b; font-weight: 700; }
-    }
-
-    .stem-text {
-      color: #333;
-      font-size: 13px;
-    }
-
-    .drawer-footer {
-      padding: 14px 24px;
-      background: #fff;
-      border-top: 1px solid #e8e8e8;
+    .button-position-box{
+      position: absolute;
+      top:0;
+      right:10px;
       display: flex;
-      justify-content: flex-end;
-      gap: 12px;
-      flex-shrink: 0;
+      .button-1{
+        border:1px solid #999;
+        color:#999;
+        font-size:14px;
+        text-align: center;
+        line-height:40px;
+        height:40px;
+        width:80px;
+        border-radius:4px;
+        margin:10px 10px 0 0;
+        cursor: pointer;
+      }
+      .button-2{
+        border:1px solid #999;
+        background-color: #999;
+        color:#fff;
+        font-size:14px;
+        text-align: center;
+        line-height:40px;
+        height:40px;
+        width:80px;
+        border-radius:4px;
+        margin:10px 10px 0 0;
+        cursor: pointer;
+      }
+      .button-3{
+        border:1px solid #0183fa;
+        background-color: #0183fa;
+        color:#fff;
+        font-size:14px;
+        text-align: center;
+        line-height:40px;
+        height:40px;
+        width:80px;
+        border-radius:4px;
+        margin:10px 0 0 0;
+        cursor: pointer;
+      }
     }
   }
 </style>

+ 80 - 98
src/views/safetyEducationExaminationNew/examManagement/testPaperManagement/index.vue

@@ -5,36 +5,33 @@
       <div class="page-form-title-box">
         <el-form :model="queryParams" class="form-box" ref="queryForm"
                  :inline="true" style="width:100%;">
-          <el-form-item label="" prop="queryParamsData1">
-            <el-select v-model="queryParams.queryParamsData1" placeholder="学院单位" style="width: 140px">
-              <el-option
-                v-for="dict in optionListA"
-                :key="dict.deptId"
-                :label="dict.deptName"
-                :value="dict.deptId"
-              />
-            </el-select>
-          </el-form-item>
-          <el-form-item label="" prop="queryParamsData2">
-            <el-select v-model="queryParams.queryParamsData2" placeholder="是否共享" style="width: 120px">
+          <el-form-item label="" prop="shareStatus">
+            <el-select v-model="queryParams.shareStatus" placeholder="是否共享" style="width: 120px">
               <el-option label="共享" value="1"/>
-              <el-option label="不共享" value="2"/>
+              <el-option label="不共享" value="0"/>
             </el-select>
           </el-form-item>
-          <el-form-item label="" prop="queryParamsData3">
-            <el-select v-model="queryParams.queryParamsData3" placeholder="来源" style="width: 120px">
-              <el-option
-                v-for="dict in optionListB"
-                :key="dict.value"
-                :label="dict.label"
-                :value="dict.value"
-              />
-            </el-select>
+          <el-form-item label="" prop="deptId">
+            <el-cascader
+              style="width: 180px"
+              v-model="queryParams.deptId"
+              :options="optionListB"
+              :props="{
+                    emitPath:false,
+                    checkStrictly: true,
+                    value: 'deptId',
+                    label: 'deptName',
+                    children: 'child',
+                  }"
+              :show-all-levels="false"
+              filterable
+              placeholder="来源"
+            ></el-cascader>
           </el-form-item>
-          <el-form-item label="" prop="queryParamsData4">
+          <el-form-item label="" prop="knowledgePointId">
             <el-cascader
               style="width: 180px"
-              v-model="queryParams.queryParamsData4"
+              v-model="queryParams.knowledgePointId"
               :options="optionListC"
               :props="{
                 emitPath:false,
@@ -45,11 +42,11 @@
               }"
               :show-all-levels="false"
               filterable
-              placeholder="请选择知识点"
+              placeholder="知识点"
             ></el-cascader>
           </el-form-item>
-          <el-form-item label="" prop="queryParamsData5">
-            <el-select v-model="queryParams.queryParamsData5" placeholder="专业类别" style="width: 140px">
+          <el-form-item label="" prop="disciplineTypeId">
+            <el-select v-model="queryParams.disciplineTypeId" placeholder="专业类别" style="width: 140px">
               <el-option
                 v-for="dict in optionListD"
                 :key="dict.id"
@@ -58,33 +55,20 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="" prop="queryParamsData6">
-            <el-select v-model="queryParams.queryParamsData6" placeholder="组卷方式" style="width: 140px">
+          <el-form-item label="" prop="assemblyMode">
+            <el-select v-model="queryParams.assemblyMode" placeholder="组卷方式" style="width: 140px">
               <el-option label="固定组卷" value="1"/>
               <el-option label="随机组卷" value="2"/>
             </el-select>
           </el-form-item>
-          <el-form-item label="" prop="queryParamsData7">
+          <el-form-item label="" prop="searchValue">
             <el-input
               maxLength="30"
-              v-model="queryParams.queryParamsData7"
+              v-model="queryParams.searchValue"
               placeholder="搜索名称"
               style="width: 140px"
             />
           </el-form-item>
-          <el-form-item label="" prop="state">
-            <el-date-picker
-              :clearable="false"
-              v-model="dateRange"
-              size="small"
-              style="width: 220px"
-              value-format="yyyy-MM-dd"
-              type="daterange"
-              range-separator="-"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-            ></el-date-picker>
-          </el-form-item>
           <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
           <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
           <p class="page-submit-common-style-button"
@@ -95,27 +79,31 @@
       </div>
       <div class="page-content-box">
         <el-table class="table-box" v-loading="loading" border :data="dataList">
-          <el-table-column label="名称" prop="name"  show-overflow-tooltip/>
-          <el-table-column label="内容" prop="content" width="200" show-overflow-tooltip/>
-          <el-table-column label="状态" prop="state" width="100" show-overflow-tooltip>
+          <el-table-column label="试卷名称" prop="paperName"  show-overflow-tooltip>
             <template slot-scope="scope">
-              <el-switch
-                @click.native="tableButton(5,scope.row)"
-                class="switch captcha-img"
-                :active-value="true"
-                :inactive-value="false"
-                active-color="#0183FA"
-                inactive-color="#999"
-                v-model="scope.row.state"
-                active-text="启用"
-                inactive-text="停用"
-                disabled
-              ></el-switch>
+              <span style="color:#0183fa;cursor: pointer" @click="tableButton(2,scope.row)">{{scope.row.paperName}}</span>
             </template>
           </el-table-column>
-          <el-table-column label="创建时间" prop="createTime" width="200" show-overflow-tooltip>
+          <el-table-column label="组卷方式" prop="assemblyMode" width="120" show-overflow-tooltip>
             <template slot-scope="scope">
-              <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
+              <span>{{scope.row.assemblyMode==1?'固定组卷':'随机组卷'}}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="知识点" prop="knowledgePointNames" width="160" show-overflow-tooltip/>
+          <el-table-column label="专业类别" prop="disciplineTypeName" width="120" show-overflow-tooltip/>
+          <el-table-column label="是否共享" prop="shareStatus" width="120" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span style="padding:2px 10px;border:1px solid rgb(1, 131, 251);border-radius:4px;color: rgb(1, 131, 251);background-color:rgba(1, 131, 251,0.2)" v-if="scope.row.shareStatus==1">共享</span>
+              <span style="padding:2px 10px;border:1px solid rgb(245, 154, 35);border-radius:4px;color: rgb(245, 154, 35);background-color:rgba(245, 154, 35,0.2)" v-if="scope.row.shareStatus==0">不共享</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="来源" prop="deptName" width="160" show-overflow-tooltip/>
+          <el-table-column label="总分" prop="totalScore" width="100" show-overflow-tooltip/>
+          <el-table-column label="及格分" prop="passScore" width="100" show-overflow-tooltip/>
+          <el-table-column label="时长" prop="answerDuration" width="100" show-overflow-tooltip/>
+          <el-table-column label="更新时间" prop="createTime" width="180" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <span>{{ scope.row.updateTime?parseTime(scope.row.updateTime,"{y}-{m}-{d} {h}:{i}"):parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
             </template>
           </el-table-column>
           <el-table-column label="操作" width="200" show-overflow-tooltip>
@@ -123,13 +111,13 @@
               <div class="table-button-box">
                 <p class="table-button-null"></p>
                 <p class="table-button-p"
-                   @click="tableButton(2,scope.row)"
+                   @click="tableButton(3,scope.row)"
                 >编辑</p>
                 <p class="table-button-p"
-                   @click="tableButton(3,scope.row)"
+                   @click="tableButton(4,scope.row)"
                 >复制</p>
                 <p class="table-button-p"
-                   @click="tableButton(4,scope.row)"
+                   @click="tableButton(5,scope.row)"
                 >删除</p>
                 <p class="table-button-null"></p>
               </div>
@@ -153,7 +141,10 @@
   //import { systemUserSelect } from "@/api/commonality/permission";
   //import { getInfo } from "@/api/basicsModules/index";
   import addPage from "./addPage.vue";
-  import { examElDisciplineTypeList,systemDeptCurrentDept,examElKnowledgePointTreeList, } from "@/api/safetyEducationExaminationNew/index";
+  import {
+    examElPaperPage,examElPaperDel,examElPaperCopy,
+    examElDisciplineTypeList,systemDeptCurrentDept,examElKnowledgePointTreeList,
+  } from "@/api/safetyEducationExaminationNew/index";
   export default {
     name: 'index',
     components: {
@@ -167,7 +158,6 @@
         //页面遮罩
         loading:false,
         //下拉列表数据
-        optionListA:[],
         optionListB:[],
         optionListC:[],
         optionListD:[],
@@ -175,14 +165,13 @@
         queryParams:{
           page:1,
           pageSize:20,
-          queryParamsData1:null,
-          queryParamsData2 :null,
-          queryParamsData3 :null,
-          queryParamsData4 :null,
-          queryParamsData5 :'',
+          searchValue:'',
+          shareStatus :null,
+          deptId :null,
+          knowledgePointId :null,
+          assemblyMode :null,
+          disciplineTypeId :null,
         },
-        //时间数据
-        dateRange:[],
         //列表数据
         dataList:[],
         //数据数量
@@ -198,7 +187,7 @@
       this.systemDeptCurrentDept();
       this.examElKnowledgePointTreeList();
       this.examElDisciplineTypeList();
-      //this.getList();
+      this.getList();
     },
     methods: {
       //查询按钮
@@ -208,15 +197,15 @@
       },
       //重置按钮
       resetQuery(){
-        this.$set(this,'dateRange',[])
         this.$set(this,'queryParams',{
           page:1,
           pageSize:20,
-          queryParamsData1:null,
-          queryParamsData2 :null,
-          queryParamsData3 :null,
-          queryParamsData4 :null,
-          queryParamsData5 :'',
+          searchValue:'',
+          shareStatus :null,
+          deptId :null,
+          knowledgePointId :null,
+          assemblyMode :null,
+          disciplineTypeId :null,
         });
         this.getList();
       },
@@ -224,14 +213,7 @@
       getList(){
         this.$set(this,'loading',true);
         let obj = JSON.parse(JSON.stringify(this.queryParams))
-        if(this.dateRange[0]){
-          obj.startTime = this.dateRange[0]+'T00:00:00'
-          obj.endTime = this.dateRange[1]+'T23:59:59'
-        }else{
-          obj.startTime = "";
-          obj.endTime = "";
-        }
-        getListFunction(obj).then(response => {
+        examElPaperPage(obj).then(response => {
           this.$set(this,'loading',false);
           this.$set(this,'dataList',response.data.records);
           this.$set(this,'total',response.data.total);
@@ -245,7 +227,7 @@
           this.$set(this,'pageType',2);
           this.$set(this,'propsData',{});
         }else if(type == 2){
-          //详情
+          //预览
           this.$set(this,'pageType',2);
           let obj = JSON.parse(JSON.stringify(row))
           obj.showType = true;
@@ -254,31 +236,29 @@
           //编辑
           this.$set(this,'pageType',2);
           let obj = JSON.parse(JSON.stringify(row))
-          obj.showType = false;
           this.$set(this,'propsData',obj);
         }else if(type == 4){
-          //删除
-          this.$confirm('是否确认删除?', "警告", {
+          //复制
+          this.$confirm('是否确认复制?', "警告", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
             type: "warning"
           }).then(function() {
           }).then(() => {
-            deleteFunction({id:row.id}).then(response => {
+            examElPaperCopy({id:row.id}).then(response => {
               self.msgSuccess(response.message)
               self.getList();
             });
           }).catch(() => {});
         }else if(type == 5){
-          //启用&停用
-          let text = row.state  ? "停用" : "启用";
-          this.$confirm('是否确认' + text + '?', "警告", {
+          //删除
+          this.$confirm('是否确认删除?', "警告", {
             confirmButtonText: "确定",
             cancelButtonText: "取消",
             type: "warning"
           }).then(function() {
           }).then(() => {
-            stateFunction({id:row.id,state:!row.state,}).then(response => {
+            examElPaperDel({id:row.id}).then(response => {
               self.msgSuccess(response.message)
               self.getList();
             });
@@ -300,7 +280,9 @@
       //学院列表
       systemDeptCurrentDept(){
         systemDeptCurrentDept({}).then(response => {
-          this.$set(this,'optionListA',response.data);
+          const list = response.data || [];
+          this.formatTreeData(list);
+          this.$set(this,'optionListB',response.data);
         });
       },
       //查询全部专业类别