Your Name il y a 3 mois
Parent
commit
ff42df96c2
5 fichiers modifiés avec 166 ajouts et 65 suppressions
  1. 3 0
      src/api.js
  2. 8 6
      src/components/Subject.vue
  3. 33 5
      src/views/classes/Add.vue
  4. 26 11
      src/views/classes/Index.vue
  5. 96 43
      src/views/paper/Index.vue

+ 3 - 0
src/api.js

@@ -170,6 +170,9 @@ export default {
 	uploadPaper: params => {
 		return axios.post(`${baseURL}/api/admin/paper/upload`, params);
 	},
+	updatePaper: params => {
+		return axios.put(`${baseURL}/api/admin/paper`, params);
+	},
 	getPerList: params => {
 		return axios.get(`${baseURL}/api/admin/permission/list`, {
 			params: params

+ 8 - 6
src/components/Subject.vue

@@ -72,12 +72,14 @@ export default {
                     item3=item2[0].children.filter(item=>item.name==value[2])
                     id=item3[0].id;
             }
-            setTimeout(function(){
-                let values=document.querySelector('.el-input__inner').value;
-                let items=values.split(' / ');
-                console.log(values)
-                that.$emit('subChange',items,id,value)
-            },100)
+            that.$emit('subChange',value,id,value)
+            console.log(value,2222222222)
+            // setTimeout(function(){
+            //     let values=document.querySelector('.el-input__inner').value;
+            //     let items=values.split(' / ');
+            //     console.log(values)
+            //     that.$emit('subChange',items,id,value)
+            // },100)
             
             
         }

+ 33 - 5
src/views/classes/Add.vue

@@ -12,7 +12,7 @@
     <section class="addclass">
         <p>培训计划  >  班级管理  >  新增班级</p>
         <div class="content">
-            <el-form label-width="80px">
+            <el-form label-width="100px">
                 <!-- <el-form-item label="培训项目" v-if="id!=''">
                     <Subject v-if='form.signup_limit' :subvalue='form.subject_item' @subChange='subChange'/>
                 </el-form-item>
@@ -24,8 +24,15 @@
                     <el-cascader-multi :data="data" @change="change" :value="value2" v-model="value2"> </el-cascader-multi>
                 </el-form-item>
                 <el-form-item label="培训计划编号">
-                        <el-input placeholder="培训计划编号" v-model="form.class_no"></el-input>
+                    <el-input placeholder="培训计划编号" v-model="form.class_no"></el-input>
                 </el-form-item>
+                <el-form-item label="培训类型">
+              <el-select v-model="form.train_type" clearable>
+                <el-option label="新训" value="新训"></el-option>
+                <el-option label="复审" value="复审"></el-option>
+                <el-option label="换证" value="换证"></el-option>
+              </el-select>
+            </el-form-item>
                 <el-form-item label="班级名称">
                         <el-input placeholder="班级名称" v-model="form.name"></el-input>
                 </el-form-item>
@@ -39,14 +46,35 @@
                             <el-option label="已结束" :value="3"></el-option>
                         </el-select>
                 </el-form-item>
+                <el-form-item label="理论培训时间">
+                    <el-date-picker
+                        v-model="form.lilun_time"
+                        type="daterange"
+                        range-separator="至"
+                        start-placeholder="开始日期"
+                        end-placeholder="结束日期">
+                    </el-date-picker>
+                </el-form-item>
+                <el-form-item label="实操培训时间">
+                    <el-date-picker
+                        v-model="form.shicao_time"
+                        type="daterange"
+                        range-separator="至"
+                        start-placeholder="开始日期"
+                        end-placeholder="结束日期">
+                    </el-date-picker>
+                </el-form-item>
+                <el-form-item label="班主任">
+                    <el-input placeholder="班主任" v-model="form.teacher"></el-input>
+                </el-form-item>
                 <el-form-item label="备注">
-                        <el-input placeholder="备注" v-model="form.remark"></el-input>
+                    <el-input placeholder="备注" v-model="form.remark"></el-input>
                 </el-form-item>
                 <el-form-item label="提醒">
-                        <el-input placeholder="提醒" v-model="form.remind"></el-input>
+                    <el-input placeholder="提醒" v-model="form.remind"></el-input>
                 </el-form-item>
                 <el-form-item label=" ">
-                        <el-button @click="save" type="primary">保存</el-button>
+                    <el-button @click="save" type="primary">保存</el-button>
                 </el-form-item>
             </el-form>
         </div>

+ 26 - 11
src/views/classes/Index.vue

@@ -39,11 +39,15 @@
 <template>
   <section class="apply">
     <p>培训计划 > 班级管理</p>
-    <div style="display:flex;flex-direction:row;">
-      <div style="width:40%;margin-top:10px;margin-right:10px;background:#fff;">
+    <div style="display:flex;flex-direction:row;position:relative;">
+      <i v-if="showTree" @click="showTree=!showTree" class="el-icon-s-fold" 
+        style="position:absolute;left:375px;font-size:22px;top:50%;z-index:10000;"></i>
+      <i v-else @click="showTree=!showTree" class="el-icon-s-unfold" 
+        style="position:absolute;left:10px;font-size:22px;top:50%;z-index:10000;"></i>
+      <div v-if="showTree" style="width:400px;background:#fff;padding:10px;margin-top:10px;">
         <SubjectTree @subChange = "subChange" />
       </div>
-      <div style="width:60%;">
+      <div style="width:100%;margin-left:10px;">
         <div class="filter">
           <el-form label-width="80px" :inline="true" size="small">
             <el-form-item label="班级名称">
@@ -52,6 +56,13 @@
             <el-form-item label="班级编号">
               <el-input clearable placeholder="班级编号" v-model="form.class_no"></el-input>
             </el-form-item>
+            <el-form-item label="培训类型">
+              <el-select v-model="form.train_type" clearable>
+                <el-option label="新训" value="新训"></el-option>
+                <el-option label="复审" value="复审"></el-option>
+                <el-option label="换证" value="换证"></el-option>
+              </el-select>
+            </el-form-item>
             <!-- <el-form-item label="类别">
               <Subject @subChange="subChange" />
             </el-form-item> -->
@@ -69,11 +80,11 @@
                 <el-table-column prop="class_no" width="100" label="培训计划编号"></el-table-column>
           <el-table-column prop="name" width="200" label="班级名称">
           </el-table-column>
-          <!-- <el-table-column
-                prop="subject_item" width="300"
-                label="培训项目">
-                </el-table-column> -->
-          <el-table-column prop="name" width="200" label="班级状态">
+          <el-table-column
+                prop="train_type" width="80"
+                label="培训类型">
+                </el-table-column>
+          <el-table-column prop="name" width="80" label="班级状态">
               <template slot-scope="scope">
                   <span v-if="scope.row.class_status==1">未开班</span>
                   <span v-if="scope.row.class_status==2">培训中</span>
@@ -82,7 +93,7 @@
           </el-table-column>
           <el-table-column prop="signup_limit" width="80" label="计划人数">
           </el-table-column>
-          <el-table-column prop="signuped_count" width="100" label="已报名人数">
+          <el-table-column prop="signuped_count" width="70" label="已报名人数">
             <template slot-scope="scope">
               <el-link type="primary" @click="showSignupUser(scope.row)">{{
             scope.row.signuped_count
@@ -93,9 +104,10 @@
           <el-table-column prop="remind" label="提醒"> </el-table-column>
           <el-table-column prop="ctime" width="200" label="创建时间">
           </el-table-column>
-          <el-table-column fixed="right" prop="zip" width="200" label="操作">
+          <el-table-column fixed="right" prop="zip" width="280" label="操作">
             <template slot-scope="scope">
-              <el-button @click="download(scope.row.id)" size="mini" type="success">导出档案</el-button>
+              <el-button @click="download(scope.row.id)" size="mini" type="success">导出资料</el-button>
+              <el-button @click="download(scope.row.id)" size="mini" type="primary">导出档案</el-button>
               <el-button @click="
               $router.push({
                 path: '/classes/add',
@@ -138,6 +150,7 @@
         loading: false,
         dialogVisible: false,
         signupList: [],
+        showTree:true
       };
     },
     methods: {
@@ -206,6 +219,7 @@
         });
       },
       download(id) {
+        this.loading = true;
         this.$api.downloadClassUser({
           id: id
         }).then((res) => {
@@ -221,6 +235,7 @@
           document.body.appendChild(elink);
           elink.click();
           document.body.removeChild(elink);
+          this.loading = false;
         });
       },
       showSignupUser(row) {

+ 96 - 43
src/views/paper/Index.vue

@@ -1,26 +1,5 @@
-<style lang="scss">
-    .apply{
-       .filter{
-            background: #fff;
-            padding: 20px 20px 10px; 
-            border:1px solid #EDEDED;
-            border-radius:2px;
-            margin-bottom: 10px;
-            margin-top: 10px;
-            .el-form-item{
-                margin-bottom: 10px;
-            }
-            .el-input,.el-select{
-                width: 150px;
-            }
-    
-       }
-       thead{
-           th{
-               background: #eee;
-           }
-       }
-    }
+<style lang="scss" scoped>
+
 </style>
 <template>
     <section class="apply">
@@ -36,13 +15,10 @@
              
                 <el-form-item>
                        <el-button @click="getData" type="primary" icon="el-icon-search">搜索</el-button>
-                       <el-button type="primary">新增</el-button>
                        <el-button @click="dialogVisible=true" type="primary">导入</el-button>
                 </el-form-item>
             </el-form>
         </div>
-
-
         <el-table
                 class="table"
                 :data="list" height="450px"
@@ -65,36 +41,86 @@
                 label="满分">
                 </el-table-column>
                 <el-table-column
+                prop="paper_type"
+                label="试卷类型">
+                    <template slot-scope="scope">
+                        <el-tag type="success" v-if="scope.row.paper_type=='train'">练习</el-tag>
+                        <el-tag type="warning" v-if="scope.row.paper_type=='exam'">考试</el-tag>
+                    </template>
+                </el-table-column>
+                <el-table-column
+                prop="status"
+                label="状态">
+                    <template slot-scope="scope">
+                        <el-tag type="success" v-if="scope.row.status==2">已发布</el-tag>
+                        <el-tag type="warning" v-if="scope.row.status==1">编辑中</el-tag>
+                    </template>
+                </el-table-column>
+                <el-table-column
                 prop="ctime"
                 label="创建时间">
                 </el-table-column>
                 <el-table-column
                 prop="zip" width="250"
                 label="操作">
-                <template slot-scope="scope">
-                    <el-button @click="$router.push({path:'/papers/detail',query:{id:scope.row.id}})"  size="mini" type="success">查看</el-button>
-                    <el-button size="mini" type="warning">编辑</el-button>
-                    <el-button @click="del(scope.row.id)" size="mini"  type="danger">删除</el-button>
-                </template>
+                    <template slot-scope="scope">
+                        <el-button @click="$router.push({path:'/papers/detail',query:{id:scope.row.id}})"  size="mini" type="success">查看</el-button>
+                        <el-button @click="openAddEdit(scope.row)" size="mini" type="warning">编辑</el-button>
+                        <el-button @click="del(scope.row.id)" size="mini"  type="danger">删除</el-button>
+                    </template>
                 </el-table-column>
         </el-table>
         <Page  ref="pageButton"  :total='total' @pageChange='gopage'/>
-
+        <!--试卷导入-->
         <el-dialog
         title="导入试卷" center
         :visible.sync="dialogVisible"
         width="40%">
-        <p style="text-align:center;">请先下载模板,按模板格式填写好试题数据然后上传。
-            <a style="color:#409eff;" href="https://www.scxjc.club/paper.xlsx">点击下载模板</a> 
-            <br> <br>
-            <input style="width:160px" id='file' type="file">
-        </p>
-       
-        <span slot="footer" class="dialog-footer">
-            <el-button size="small" @click="dialogVisible = false">取 消</el-button>
-            <el-button size="small" type="primary" @click="upload('file')">确 定</el-button>
-        </span>
+            <p style="text-align:center;">请先下载模板,按模板格式填写好试题数据然后上传。
+                <a style="color:#409eff;" href="https://www.scxjc.club/paper.xlsx">点击下载模板</a> 
+                <br> <br>
+                <input style="width:160px" id='file' type="file">
+            </p>
+        
+            <span slot="footer" class="dialog-footer">
+                <el-button size="small" @click="dialogVisible = false">取 消</el-button>
+                <el-button size="small" type="primary" @click="upload('file')">确 定</el-button>
+            </span>
         </el-dialog>
+        <!--新增/编辑试卷-->
+        <el-dialog
+        title="新增/编辑试卷" center
+        :visible.sync="addEditDialogVisible"
+        width="40%">
+            <el-form v-model="addEditForm" label-width="80px" size="small">
+                <el-form-item label="试卷名称">
+                    <el-input placeholder="试卷名称" v-model="addEditForm.title"></el-input>
+                </el-form-item>
+                <el-form-item label="考试时间">
+                    <el-input placeholder="考试时间" v-model="addEditForm.total_time"></el-input>
+                </el-form-item>
+                <el-form-item label="满分">
+                    <el-input placeholder="满分" v-model="addEditForm.total_score"></el-input>
+                </el-form-item>
+                <el-form-item label="试卷类型">
+                    <el-select v-model="addEditForm.paper_type">
+                        <el-option label="练习" value="train"></el-option>
+                        <el-option label="考试" value="exam"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="状态">
+                    <el-select v-model="addEditForm.status">
+                        <el-option label="编辑中" :value="1"></el-option>
+                        <el-option label="已发布" :value="2"></el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item>
+                    <el-button @click="addEditDialogVisible=false">取消</el-button>
+                    <el-button @click="saveAddEdit" type="primary">保存</el-button>
+                </el-form-item>
+            </el-form>
+        </el-dialog>
+
     </section>
 </template>
 <script>
@@ -111,7 +137,12 @@ export default {
       total:1,
       list:[],
       loading:false,
-      dialogVisible:false
+      dialogVisible:false,
+      addEditDialogVisible:false,
+      addEditForm:{
+          paper_type:"train",
+          status:1
+      }
     }
   },
   methods:{
@@ -124,6 +155,7 @@ export default {
       },
       subChange(data){
           this.form.subject_item=data.join('|')
+          this.getData();
       },
       getData(){
          var parm=this.form;
@@ -161,6 +193,27 @@ export default {
                 })
             })
       },
+      openAddEdit(row){
+          this.addEditDialogVisible = true;
+          this.$api.getPaper({id:row.id,type:1}).then(res=>{
+              this.addEditForm = res.data.data;
+          })
+      },
+      saveAddEdit(){
+          if(this.addEditForm.id){
+              this.$api.updatePaper(this.addEditForm).then(res=>{
+                  if(!res.data.code){
+                      this.$message({
+                        message: '修改成功!',
+                        type: 'success'
+                    })
+                    this.addEditDialogVisible = false;
+                  }
+              })
+          }else{
+
+          }
+      }
   },
   created(){
       this.getData()