瀏覽代碼

学生分班信息完成

shilipojs 2 年之前
父節點
當前提交
b3ca0bd8b6
共有 2 個文件被更改,包括 86 次插入44 次删除
  1. 14 16
      src/components/MxDialog/ElectiveSign.vue
  2. 72 28
      src/views/career/bigdataSelectCourse/personalDivideClass.vue

+ 14 - 16
src/components/MxDialog/ElectiveSign.vue

@@ -33,7 +33,7 @@
   </div>
 </template>
 <script>
-import { submitElectiveModels } from '@/api/webApi/elective/selected-subject'
+import { saveEsign } from '@/api/webApi/elective/selected-subject'
 
 export default {
   // props: ['generation'],
@@ -59,31 +59,29 @@ export default {
     handleReset() {
       this.$refs.esign.reset()
     },
-    // saveElective() {
-    //   submitElectiveModels({
-    //     models: this.generation.activeModel.selectedList,
-    //     esign:this.base64Img
-    //   }).then(res => {
-    //     if (res.code == 200) {
-    //       this.dialogVisible = false
-    //       this.$message.success('报名成功')
-    //       this.refreshData()
-    //     }
-    //   })
-    // },
+    saveElective() {
+      saveEsign({
+        id: this.flowId,
+        esignPath:this.base64Img
+      }).then(res => {
+        if (res.code == 200) {
+          this.show = false
+          this.success()
+        }
+      })
+    },
     // 生成签字图
     handleGenerate() {
       this.$refs.esign
         .generate() // 使用生成器调用把签字的图片转换成为base64图片格式
         .then((res) => {
           this.base64Img = res
-          // this.saveElective()
-          this.show = false
-          this.success()
+          this.saveElective()
           // 在这里向后端发请求把转换后的base64文件传给后端,后端接收以后再转换成图片做静态图片存储
           // 当然也可以把base64转成流文件blob格式的,类似上传给后端这样,具体哪种方式看后端要求
         })
         .catch((err) => {
+          console.log(err)
           // 画布没有签字时会执行这里提示一下
           this.$message({
             type: 'warning',

+ 72 - 28
src/views/career/bigdataSelectCourse/personalDivideClass.vue

@@ -1,6 +1,10 @@
 <template>
   <div class="app-container">
-    <el-card class="box-card" >
+    <el-card class="mb20">
+      <mx-condition ref="condition" :query-params="queryParams" :require-fields="requireFields" @query="handleQuery"
+                    @invalid="handleInvalidQuery"></mx-condition>
+    </el-card>
+    <el-card v-if="queryParams.roundId"  class="box-card" >
       <div slot="header" class="clearfix text-center f20 pb10 pt10" >
         {{ title }}
       </div>
@@ -12,7 +16,7 @@
         <div v-if="isSign && isShow">
           <el-alert
             class="mb5"
-            :title="`通知:${$store.getters.nickName}同学您的新班级信息于2022年6月18日0点生效`"
+            :title="tips"
             type="info"
             :closable="false"
             show-icon>
@@ -25,38 +29,40 @@
         </div>
       </div>
     </el-card>
+    <evaluation-empty v-else shadow title="暂无数据"></evaluation-empty>
   </div>
 </template>
 
 <script>
+import { classesResult, getRound } from '@/api/webApi/elective/dispatch'
+import MxCondition from '@/components/MxCondition/mx-condition'
+import { mapGetters } from 'vuex'
  export default {
+   components:{MxCondition},
    data(){
      return{
-       isSign:false,
        isShow:false,
-       rows: [
-         {
-           year: 2021,
-           group: '物化生',
-           name: this.$store.getters.nickName,
-           oldClass: '2101',
-           newClass: '2105',
-         }
-       ],
+       rows: [],
+       requireFields: ['year', 'roundId'],
+       queryParams: {
+         year: '',
+         roundId: ''
+       },
+       round: {},
        propsDefines: {
          year: {
            label:'学年'
          },
-         group: {
+         groupName: {
            label:'选择组合'
          },
          name: {
            label:'姓名'
          },
-         oldClass: {
+         originalClassName: {
            label:'原班级'
          },
-         newClass: {
+         className: {
            label:'新班级'
          },
          tips: {
@@ -67,33 +73,71 @@
      }
    },
    computed:{
-      title(){
+     ...mapGetters(['school','nickName']),
+     title(){
         const store  = this.$store.getters
         if(!store) return  ''
         console.log(store)
-        return `${store.school.schoolName}${store.firstClassName}级分班信息  ${store.nickName}同学`
+        return `${this.school.schoolName}${this.round.name}分班信息  ${store.nickName}同学`
+     },
+     isSign() {
+        if(!this.rows.length) return false
+        return this.rows[0].statusText == '分班完成'
+     },
+     tips() {
+       if(!this.isSign) return ''
+       return `通知:${this.nickName}同学您的新班级信息于${this.rows[0].activeDate}点生效`
      }
    },
    methods: {
+     handleQuery() {
+       this.getRound()
+       this.getInfo()
+     },
+     // 获取批次的组合
+     getRound() {
+       getRound({
+         year:this.queryParams.year,
+         round:this.queryParams.roundId,
+       }).then(res => {
+         this.round = res.data
+       })
+     },
+     getInfo() {
+       classesResult({
+         roundId: 29
+       }).then(res =>{
+         this.rows= res.rows.map(item => {
+           item.year = this.queryParams.year
+           return item
+         })
+         console.log(res)
+       })
+     },
      showDispatchInfo() {
-       if(!this.isSign){
-         this.$message.warning('请完成选科报名签字,个人的分班信息才能显示')
+       if(this.rows[0].statusText != '分班完成'){
+         this.$message.warning(this.rows[0].statusText )
          return
        }
-       this.isShow = true
+       if(!this.isShow) {
+         this.isShow = true
+       }else {
+         this.$message.warning('已显示')
+       }
 
      },
      toSign() {
-       // 签字
-       if(this.isSign) return
-       this.$Dialog('ElectiveSign',{},() => {
+       if(this.isSign) {
+         this.$message.warning('已完成签名,可查看分班信息')
+         return
+       }
+       this.$Dialog('ElectiveSign',{flowId:this.rows[0].flowId},() => {
           this.$message.success('已完成签名')
-          this.isSign = true
+          this.handleQuery()
        })
-       // if(!this.isSign) {
-       //   this.isSign = true
-       //   this.$message.success('已完成签名')
-       // }
+     },
+     handleInvalidQuery() {
+       this.rows = []
      }
    }
  }