Quellcode durchsuchen

考试计划列表和详情

luohailiang vor 2 Jahren
Ursprung
Commit
251a1f58c1
4 geänderte Dateien mit 165 neuen und 37 gelöschten Zeilen
  1. BIN
      public/images/icon-close.png
  2. 13 1
      src/pages/process/api.js
  3. 40 11
      src/pages/process/detail/[id].vue
  4. 112 25
      src/pages/process/index.vue

BIN
public/images/icon-close.png


+ 13 - 1
src/pages/process/api.js

@@ -8,7 +8,19 @@ export const project_list = (data = {}) => {
 }
 export const subject = (data = {}) => {
   return request({
-    url: window.GLOBAL_CONFIG.uc + 'index.php?mod=school&action=main&do=base_subject',
+    url: window.GLOBAL_CONFIG.uc + 'index.php?mod=school&action=main&do=base_grade',
+    data,
+  })
+}
+export const add_subject = (data = {}) => {
+  return request({
+    url: '/yzy/ksjh/liankao_add_subject',
+    data,
+  })
+}
+export const del_subject = (data = {}) => {
+  return request({
+    url: '/yzy/ksjh/liankao_del_subject',
     data,
   })
 }

+ 40 - 11
src/pages/process/detail/[id].vue

@@ -10,35 +10,42 @@
        <div class="mt-70px pl-300px">
          <div class="flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试名称</h3>
-           <div class="flex-1 text-16px leading-20px">联考</div>
+           <div class="flex-1 text-16px leading-20px">{{ykj_detail.ykj_ksrwmc}}</div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试时间</h3>
-           <div class="flex-1 text-16px leading-20px">2022-11-23  至 2022-12-12</div>
+           <div class="flex-1 text-16px leading-20px">{{ykj_detail.ykj_ksrq}} 至 {{ykj_detail.ykj_jsrq}}</div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试类型</h3>
-           <div class="flex-1 text-16px leading-20px">联考</div>
+           <div class="flex-1 text-16px leading-20px">
+             <span v-if="ykj_detail.ykj_kslx === '1'">周考</span>
+             <span v-if="ykj_detail.ykj_kslx === '2'">月考</span>
+             <span v-if="ykj_detail.ykj_kslx === '3'">作业</span>
+             <span v-if="ykj_detail.ykj_kslx === '4'">测验</span>
+             <span v-if="ykj_detail.ykj_kslx === '5'">期中</span>
+             <span v-if="ykj_detail.ykj_kslx === '6'">期末</span>
+             <span v-if="ykj_detail.ykj_kslx === '7'">联考</span>
+           </div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">联考学校</h3>
-           <div class="flex-1 text-16px leading-20px">蒙阴市中小学 蒙阴市中小学 蒙阴市中小学 蒙阴市中小学</div>
+           <div class="flex-1 text-16px leading-20px">{{ykj_detail.ykj_lkxx_name}}</div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试年级</h3>
-           <div class="flex-1 text-16px leading-20px">一年级</div>
+           <div class="flex-1 text-16px leading-20px">{{ykj_detail.ykj_ksnj_name}}</div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试科目</h3>
-           <div class="flex-1 text-16px leading-20px">语文 数学 英语 物理 化学 生物 地理</div>
-         </div>
-         <div class="mt-40px flex">
-           <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">考试形式</h3>
-           <div class="flex-1 text-16px leading-20px">线上考试</div>
+           <div class="flex-1 text-16px leading-20px">{{ykj_detail.ykj_kskm_name}}</div>
          </div>
          <div class="mt-40px flex">
            <h3 class="w-80px text-right text-16px leading-20px text-hex-949494 font-bold mr-30px">阅卷流程</h3>
-           <div class="flex-1 text-16px leading-20px">先上传后划块</div>
+           <div class="flex-1 text-16px leading-20px">
+             <span v-if="ykj_detail.ykj_yjlc === '1'">先上传后划块</span>
+             <span v-if="ykj_detail.ykj_yjlc === '2'">先划块后上传</span>
+           </div>
          </div>
          <div class="mt-40px flex">
            <h3 class="text-16px leading-20px w-80px text-right text-hex-949494 font-bold mr-30px">状态</h3>
@@ -67,10 +74,32 @@
 </route>
 <script setup>
 import { useRouter } from "vue-router";
+import request from "@/utils/request";
 const router = useRouter();
+const route = useRoute();
 const linkTo = (name) => {
   router.push({ name });
 };
+let ykj_id = $ref('');
+let ykj_detail = $ref({});
+function getDetail() {
+  request({
+    url: "/yzy/ksjh/detail",
+    data: {
+      ykj_id: ykj_id,
+    },
+  }).then((res) => {
+    if (res.code === "1") {
+      console.log(res.data.one_info,887)
+      ykj_detail= res.data.one_info;
+    }
+  });
+}
+
+if (route.params.id) {
+  ykj_id = route.params.id;
+  getDetail();
+}
 </script>
 
 <style lang="scss" scoped>

+ 112 - 25
src/pages/process/index.vue

@@ -56,7 +56,7 @@
           <div class="w-300px">操作</div>
         </div>
         <div>
-          <div v-for="item in listData" class="line">
+          <div v-for="(item,index) in listData" class="line">
             <div class="up">
               <div class="w-340px pl-20px text-left">{{item.ykj_ksrwmc}}</div>
               <div class="w-250px">
@@ -80,7 +80,7 @@
               <div class="w-220px text-left">{{item.ykj_ksrq}}~{{item.ykj_jsrq}}</div>
               <div class="w-300px">
                 <button type="button" class="op-btn">编辑</button>
-                <button type="button" class="op-btn ml-10px" @click="linkTo({name:'process-detail-id',params:{id:'1'}})">详情</button>
+                <button type="button" class="op-btn ml-10px" @click="linkTo({name:'process-detail-id',params:{id:item.ykj_id}})">详情</button>
                 <div class="ml-10px relative op-btn cursor-pointer">
                   <span class="inline-block align-middle leading-28px">更多</span>
                   <div class="more-list">
@@ -91,12 +91,13 @@
                     </ul>
                   </div>
                 </div>
-                <button type="button" class="ml-10px inline-block align-middle arrow-btn up"></button>
+                <button type="button" class="ml-10px inline-block align-middle arrow-btn" :class="item.showSub?'up':'down'" @click="toggleDown(index)"></button>
               </div>
             </div>
-            <div class="down pt-15px pl-35px">
+            <div class="down pt-15px pl-35px" v-if="item.showSub">
               <ul class="subject-list">
                 <li v-for="items in item.lc">
+                  <span class="sub-del cursor-pointer" @click="del_sub(item.ykj_id,items.ykl_id)"></span>
                   <div>
                     <div class="subject-name m-auto">{{JSON.parse(items.ykl_lc).ze_xueke_name}}</div>
                     <div class="mt-5px">
@@ -113,7 +114,7 @@
                     </div>
                   </div>
                 </li>
-                <li class="cursor-pointer" @click="dialogVisible = true">
+                <li class="cursor-pointer" @click="addSubject(item,index)">
                   <div class="subject-add-btn"></div>
                 </li>
               </ul>
@@ -143,8 +144,8 @@
     <div>
       <el-form label-width="120px" size="large">
         <el-form-item label="请选择学科">
-          <el-select v-model="add_sub_id" placeholder="请选择学科">
-            <el-option v-for="item in subject_list" :label="item.label" :value="item.value" />
+          <el-select v-model="add_sub" placeholder="请选择学科">
+            <el-option v-for="item in sub_filter_list" :label="item.subject_name" :value="{value:item.subject_id,label:item.subject_name}" />
           </el-select>
         </el-form-item>
       </el-form>
@@ -152,7 +153,7 @@
     <template #footer>
       <span class="dialog-footer text-right">
         <el-button @click="dialogVisible = false" size="large">取消</el-button>
-        <el-button size="large" color="#003eee" type="primary" @click="dialogVisible = false">
+        <el-button size="large" color="#003eee" :disabled="add_sub.value === '' || isSubmit" type="primary" @click="addSubmit">
           确定
         </el-button>
       </span>
@@ -170,9 +171,10 @@
 }
 </route>
 <script setup>
-import {project_list,subject} from "~/pages/process/api";
+import {project_list,subject,add_subject} from "~/pages/process/api";
 import { useRouter } from "vue-router";
 import {user} from "~/store";
+import request from "@/utils/request";
 const router = useRouter();
 console.log(router,87)
 const linkTo = (obj) => {
@@ -204,26 +206,30 @@ let type_list = [{
   label: '联考'
 }]
 let subject_list = $ref([])
-let noData = $ref(null);
-let limit = $ref(10);
-let total = $ref(0);
-let cur_page = $ref(1);
-let listData = $ref([]);
+let noData = $ref(null)
+let limit = $ref(10)
+let total = $ref(0)
+let cur_page = $ref(1)
+let listData = $ref([])
 let dialogVisible = $ref(false)
-let add_sub_id = $ref('')
+let sub_filter_list = $ref([])
+let allSub = $ref([])
+let add_sub = $ref({
+  value:'',
+  label:''
+})
+let isSubmit = $ref(false)
+let add_ykj_id = $ref('')
 function getSubject() {
-   let data = {}
+   let data = {
+     for_mistake:'1'
+   }
+   if(user.user_role_id < 72) {
+     data.sm_id = user.sm_info.sm_id
+   }
    subject(data).then(res =>{
      if(res.code === '1') {
-       for(let i in res.data) {
-         console.log(res.data[i],7)
-         let subject_obj = {
-           id:i,
-           name: res.data[i]
-         }
-         subject_list.push(subject_obj);
-       }
-       console.log(subject_list,88)
+       allSub = res.data;
      }
    })
 }
@@ -241,6 +247,14 @@ function getListData() {
   project_list(data).then(res=>{
     if(res.code === '1') {
       listData = res.data.page_data;
+      for(let i in listData) {
+        if(i == 0) {
+          listData[i].showSub = true;
+        } else {
+          listData[i].showSub = false;
+        }
+
+      }
       // console.log(listData,87)
       total = Number(res.data.total_rows);
       cur_page = Number(res.data.page_now);
@@ -265,6 +279,68 @@ const handleDateChange = (val) => {
   cur_page = 1;
   getListData();
 }
+function addSubject(item) {
+  let filter_list = item.ykj_kskm.split(',');
+  add_ykj_id = item.ykj_id;
+  dialogVisible = true;
+  add_sub = {
+    label:'',
+    value:''
+  }
+  for(let i in allSub) {
+    if(allSub[i].grade == item.ykj_ksnj) {
+      subject_list = allSub[i].subjects;
+      sub_filter_list = subject_list.filter(item=>!filter_list.some(ele=>ele === item.subject_id))
+    }
+  }
+}
+function addSubmit() {
+   isSubmit = true;
+   let data = {
+     ykj_id:add_ykj_id,
+     ykj_kskm:add_sub.value,
+     ykj_kskm_name:add_sub.label
+   }
+   add_subject(data).then(res =>{
+     isSubmit = false;
+     if(res.code === '1') {
+       ElMessage.success("科目添加成功!");
+       dialogVisible = false;
+       getListData();
+     }
+   })
+}
+function del_sub(ykj_id,ykl_id) {
+  ElMessageBox.confirm("确认删除该学科的考试?", "", {
+    confirmButtonText: "确认",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+
+    request({
+      url: "/yzy/ksjh/liankao_del_subject",
+      data: {
+        ykj_id: ykj_id,
+        ykl_id: ykl_id
+      },
+    }).then((res) => {
+      if (res.code === "1") {
+        ElMessage({
+          type: "success",
+          message: "删除成功",
+        });
+        getListData();
+      }
+    });
+  })
+}
+function toggleDown(index) {
+  if(listData[index].showSub) {
+    listData[index].showSub = false;
+  } else {
+    listData[index].showSub = true;
+  }
+}
 </script>
 <style lang="scss" scoped>
 $color: #0048e5;
@@ -523,6 +599,7 @@ $color: #0048e5;
   display: flex;
   flex-wrap: wrap;
   li{
+    position: relative;
     width: 205px;
     height: 280px;
     margin: 0 28px 23px 0;
@@ -532,6 +609,16 @@ $color: #0048e5;
     justify-content: center;
     align-items: center;
   }
+  .sub-del{
+    position: absolute;
+    right: 3px;
+    top: 3px;
+    z-index: 50;
+    width: 20px;
+    height: 20px;
+    background: url("/images/icon-close.png") center no-repeat;
+    background-size: 20px 20px;
+  }
 }
 .subject-add-btn{
   width: 57px;