|
@@ -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;
|