HZH-PC\HZH 2 년 전
부모
커밋
fd9bb8a091
2개의 변경된 파일83개의 추가작업 그리고 18개의 파일을 삭제
  1. 2 5
      src/api/ctrlPaper.js
  2. 81 13
      src/components/controlMainPage/IssuePaperList.vue

+ 2 - 5
src/api/ctrlPaper.js

@@ -21,12 +21,9 @@ export function getCommitPaperListSimple(uid,pid) {
 }
 
 //获取组合卷列表
-export function getIssuePaperList(name,subjectId) {
+export function getIssuePaperList(param) {
     return axios.get('/issuePaper/list',{
-        params: {
-            name:name,
-            subjectId:subjectId
-        }
+        params: param
     })
     .then(res => res.data);
 }

+ 81 - 13
src/components/controlMainPage/IssuePaperList.vue

@@ -25,14 +25,41 @@ table{
   .add-user{
     float: right;
   }
+  /deep/ .el-input{
+    width: 300px;
+    margin-right: 20px;
+  }
 }
 .dialog-style{
+  /deep/ .el-dialog__body{
+    height: 500px;
+    overflow: auto;
+  }
   div{
     text-align: center;
     margin: 5px;
     /deep/ .el-input{
       display: inline-block;
-      width: 200px;
+      width: 650px;
+    }
+    &.short{
+      /deep/ .el-input{
+        width: 250px;
+      }
+      label:nth-child(3){
+        margin-left: 98px;
+      }
+    }
+    &.left{
+      padding: 0 15px;
+      text-align: left;
+      &>div{
+        text-align: left;
+        margin: 10px 0;
+        .el-checkbox{
+          margin: 5px;
+        }
+      }
     }
   }
 }
@@ -45,6 +72,7 @@ table{
   <div class="search-part">
     <label>名称:</label>
     <el-input v-model="search.name" placeholder="请输入名称"></el-input>
+    <label>学科:</label>
     <el-select v-model="search.subjectId" placeholder="请选择" @change="searchList">
       <el-option
         v-for="item in subjectOptions"
@@ -87,21 +115,45 @@ table{
         class="dialog-style"
         title="编辑"
         :visible.sync="visibleAdd"
-        width="500px">
+        width="800px">
         <div>
-          <!-- <label>年级:</label>
-          <el-select v-model="user.grade" placeholder="请选择">
+          <label>名称:</label>
+          <el-input v-model="addPaperSet.name" placeholder="请输入名称"></el-input>
+        </div>
+        <div class="short">
+          <label>学科:</label>
+           <el-select v-model="addPaperSet.subjectId">
+            <el-option :label="'数学'" :value="2"></el-option>
+          </el-select>
+          <label>教材:</label>
+           <el-select v-model="addPaperSet.publisher">
+            <el-option :label="'人教版'" :value="'人教版'"></el-option>
+          </el-select>
+        </div>
+        <div class="left">
+          <label>模块一选择</label>
+          <div v-for="(item,index) in gradeOptions" :key="index">
+            <p v-if="chapterData[item.value]">{{item.label}}: </p>
+            <el-checkbox  v-for="chapter in chapterData[item.value]" :key="chapter.id" v-model="chapter.choose" :label="chapter.name" border size="medium"></el-checkbox>
+          </div>
+        </div>
+        <div class="left">
+          <label>模块二、三选择</label>
+        </div>
+        <div>
+          <label>年级:</label>
+          <el-select v-model="addPaperSet.grade" placeholder="请选择">
             <el-option
               v-for="item in gradeOptions"
               :key="item.value"
               :label="item.label"
               :value="item.value">
             </el-option>
-          </el-select> -->
+          </el-select>
         </div>
         <span slot="footer" class="dialog-footer">
-            <el-button type="primary" @click="addPaper">确 定</el-button>
             <el-button type="primary" @click="visibleAdd = false">取消</el-button>
+            <el-button type="primary" @click="addPaper">确 定</el-button>
         </span>
     </el-dialog>
 
@@ -121,7 +173,7 @@ table{
 <script>
 import { getIssuePaperList } from '@/api/ctrlPaper';
 import { subjectList, issueChapterList} from '@/api/common';
-import { GRADE_OPTION, GRADE_MAP } from '@/services/constant';
+import { GRADE_OPTION } from '@/services/constant';
 
 export default {
   name: 'IssueList',
@@ -148,11 +200,11 @@ export default {
         },
 
         addPaperSet:{
-          "chapterIds": "",
-          "grade": "",
           "name": "",
+          "subjectId": 2,
           "publisher": "人教版",
-          "subjectId": 2
+          "chapterIds": "",
+          "grade": "",
         },
         deleteId: -1,
 
@@ -162,7 +214,7 @@ export default {
   },
   created() {
     this.searchSubject();
-    this.searchList();
+    this.issueChapterList();
   },
   methods: {
     searchSubject(){
@@ -172,15 +224,31 @@ export default {
     },
     issueChapterList(){
       issueChapterList(this.chapterSearch).then((result) => {
+        Object.keys(result).forEach(key => {
+          result[key] = result[key].map(item => {
+            item.choose = false;
+            return item;
+          })
+        })
         this.chapterData = result;
       })
     },
     searchList(){
-      getIssuePaperList(this.search.name,this.search.subjectId).then((result) => {
-        this.paperList = result;
+      getIssuePaperList(this.search).then((result) => {
+        this.paperList = result.t;
       })
     },
     addPaper(){
+      let tempList = [];
+      Object.keys(this.chapterData).forEach(key => {
+        this.chapterData[key].forEach(item => {
+          if(item.choose){
+            tempList.push(item.id);
+          }
+        })
+      })
+      this.addPaperSet.chapterIds = tempList.join(',');
+      console.log(this.addPaperSet);
       // addUser(this.user).then((result) => {
       //   alert(result.message);
       //   this.visibleAdd = false