Lijy před 4 dny
rodič
revize
069bcfd9b9

+ 35 - 10
fhKeeper/formulahousekeeper/course-pc/src/views/offlineRegistration/registration.vue

@@ -143,7 +143,7 @@
       <div style="width: 100%;">
         <el-select v-model="examRow.openExamVal" multiple placeholder="请选择" style="width: 100%;">
           <el-option v-for="item in (examRow.offlineSignList || [])" :key="item.id" :label="item.courseOfflineName"
-            :value="item.id">
+            :value="item.courseOfflineId">
           </el-option>
         </el-select>
       </div>
@@ -245,8 +245,8 @@ export default {
             return {
               ...item,
               course: item.offlineSignList.map(ua => ua.courseOfflineName).join(','),
-              courseIds: item.offlineSignList.map(ua => ua.id).join(','),
-              courseIdList: item.offlineSignList.map(ua => ua.id)
+              courseIds: item.offlineSignList.map(ua => ua.courseOfflineId).join(','),
+              courseIdList: item.offlineSignList.map(ua => ua.courseOfflineId)
             }
           })
           this.total = total
@@ -269,6 +269,7 @@ export default {
       this.getList()
     },
     editCourseRegistration(row) {
+      console.log(row, '<=== 编辑')
       this.dialogVisible = true
       this.registrationForm = {
         id: row.id,
@@ -305,12 +306,29 @@ export default {
     },
     submitRegistration() {
       // 这里添加提交逻辑
-      console.log(this.registrationForm, '<==== registrationForm')
-      this.$message({
-        type: 'success',
-        message: '报名成功!'
-      });
-      this.dialogVisible = false;
+      const { id, name, phone, course = [] } = this.registrationForm
+      if(!name || !phone || !course.length) {
+        this.$message({
+          type: 'error',
+          message: '请填写完整信息'
+        })
+        return
+      }
+      const urls = !id ? 'course-offline-sign/save' : 'course-offline-sign/update'
+      let obj = { name, phone, courseOffLineIdStr: course.join(',') }
+      if (id) {
+        obj.userSignId = id
+      }
+      post(urls, { ...obj }).then(() => {
+        this.$message({
+          type: 'success',
+          message: id ? '操作成功!' : '报名成功!'
+        });
+      
+        this.getList()
+        this.dialogVisible = false;
+      })
+      
     },
     // 课程管理
     batchManage(flag = true) {
@@ -523,9 +541,16 @@ export default {
     openExamCli() {
       const { id, openExamVal = [] } = this.examRow; 
       console.log(openExamVal, '<==== openExamVal')
+      if(!openExamVal.length) {
+        this.$message({
+          type: 'warning',
+          message: '请选择要开通的考试'
+        })
+        return
+      }
       post(`/course-offline-sign/openCourseExam`, {
         userSignId: id,
-        courseOfflineId: openExamVal.join(',')
+        courseOffLineIdStr: openExamVal.join(',')
       }).then(() => {
         this.$message({
           type: 'success',