Explorar el Código

1213 18:20

新增学员 修改学员
mo hace 5 años
padre
commit
3c978324eb

+ 4 - 0
src/App.vue

@@ -290,4 +290,8 @@ input[type="number"] {
   -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
   background-color: #d5d5d5;
 }
+.el-input.is-disabled .el-input__inner {
+  color: #333;
+  opacity: 1;
+}
 </style>

+ 18 - 0
src/api/studentManager.js

@@ -193,4 +193,22 @@ export function getStudentInfoByPhone (data) {
     method: 'get',
     params: data
   })
+}
+
+// 添加学生 studentManage/register
+export function registerStudent (data) {
+  return request({
+    url: api + `/studentManage/register`,
+    method: 'post',
+    data: qs.stringify(data)
+  })
+}
+
+// 更新学生信息
+export function updateStudent (data) {
+  return request({
+    url: api + `/studentManage/studentUpdate`,
+    method: 'post',
+    data: qs.stringify(data)
+  })
 }

+ 179 - 4
src/views/studentManager/studentList.vue

@@ -4,7 +4,8 @@
       <div class="squrt"></div>学员列表
     </h2>
     <div class="m-core">
-      <!-- <div class="newBand">声部调整</div> -->
+      <div class="newBand"
+           @click="addStudent">新增学员</div>
       <!-- 搜索标题 -->
       <el-form :inline="true"
                class="searchForm"
@@ -46,7 +47,7 @@
                            label="学员编号">
           </el-table-column>
           <el-table-column align='center'
-                           prop="realName"
+                           prop="username"
                            label="学员姓名">
           </el-table-column>
           <el-table-column align='center'
@@ -56,7 +57,7 @@
             </template>
           </el-table-column>
           <el-table-column align='center'
-                           prop="parentsName"
+                           prop="realName"
                            label="家长姓名">
           </el-table-column>
           <el-table-column align='center'
@@ -74,6 +75,8 @@
                            v-permission="'/studentDetail'"
                            :to="{path:`/business/studentDetail?userId=${scope.row.userId}`,query:{search:JSON.stringify(searchForm),rules:JSON.stringify(pageInfo)}}">查看</router-link>
 
+              <el-button type="text"
+                         @click="resetStudent(scope.row)">修改</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -84,11 +87,77 @@
                     @pagination="getList" />
       </div>
     </div>
+    <el-dialog title="新增学员"
+               width="700px"
+               label-width='100px'
+               label-position="right"
+               :visible.sync="studentVisible">
+      <el-divider>基本信息</el-divider>
+      <el-form :model="studentForm"
+               :inline='true'
+               ref='studentForm'
+               :rules="studentRules">
+        <el-form-item label="联系电话"
+                      :rules="[{ required: true, message: '请输入手机号' }, { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }]">
+          <el-input v-model="studentForm.phone"
+                    @blur="checkPhone(studentForm.phone)"></el-input>
+        </el-form-item>
+        <el-form-item label="所属分部"
+                      v-if="isNew"
+                      prop="organId">
+          <el-select class='multiple'
+                     v-model="studentForm.organId"
+                     clearable
+                     placeholder="请选择分部">
+            <el-option v-for="(item,index) in organList"
+                       :key="index"
+                       :label="item.name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="学生姓名"
+                      prop="name">
+          <el-input v-model="studentForm.name"></el-input>
+        </el-form-item>
+        <el-form-item label="学生性别"
+                      prop="sex">
+          <el-select class='multiple'
+                     v-model="studentForm.sex"
+                     clearable
+                     placeholder="请选择分部">
+            <el-option :value="0"
+                       label="女"></el-option>
+            <el-option :value="1"
+                       label="男"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="家长姓名">
+          <el-input v-model="studentForm.parseName"></el-input>
+        </el-form-item>
+        <el-form-item label="出生日期">
+          <el-date-picker v-model="studentForm.date"
+                          value-format="yyyy-MM-dd"
+                          type="date"
+                          placeholder="选择日期">
+          </el-date-picker>
+        </el-form-item>
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="studentVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   v-if="isNew"
+                   @click="submitAddStudent">确 定</el-button>
+        <el-button type="primary"
+                   v-if="!isNew"
+                   @click="resetStudentSubmie">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
 import pagination from '@/components/Pagination/index'
-import { queryStudentList } from '@/api/studentManager'
+import { queryStudentList, getStudentInfoByPhone, registerStudent, updateStudent } from '@/api/studentManager'
 import { getEmployeeOrgan } from '@/api/buildTeam'
 import store from '@/store'
 export default {
@@ -96,6 +165,7 @@ export default {
   components: { pagination },
   data () {
     return {
+      studentVisible: false,
       searchForm: {
         organId: null,
         search: null,
@@ -112,6 +182,22 @@ export default {
         total: 0, // 总条数
         page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
+      studentForm: {
+        phone: '',
+        organId: '',
+        name: '',
+        sex: '',
+        parseName: '',
+        date: '',
+      },
+      studentRules: {
+        name: [{ required: true, message: '请输入学生姓名' },],
+        sex: [{ required: true, message: '请选择学生姓名' },],
+        date: [{ required: true, message: '请选择出生日期' },],
+        organId: [{ required: true, message: '请选择分部' }]
+      },
+      isNew: false,
+      active: null
     }
   },
   mounted () {
@@ -151,6 +237,95 @@ export default {
         search: null,
         studentName: null
       }
+    },
+    checkPhone (val) {
+      var regu = /^1[3456789]\d{9}$/;
+      var re = new RegExp(regu);
+      if (re.test(val)) {
+        getStudentInfoByPhone({ mobile: this.studentForm.phone }).then(res => {
+          if (res.code == 200) {
+            if (res.data) {
+              this.studentForm = {
+                name: res.data.name,
+                sex: res.data.gender,
+                parseName: res.data.parentsName,
+                // sound: parseInt(res.data.subjectId),
+                phone: val,
+                date: res.data.birthdate
+              }
+            }
+          }
+        })
+      }
+    },
+    submitAddStudent () {
+      // 效验  然后组数据提交
+      this.$refs['studentForm'].validate(item => {
+        if (item) {
+          let obj = {
+            phone: this.studentForm.phone,
+            username: this.studentForm.name,
+            gender: this.studentForm.sex,
+            realName: this.studentForm.parseName,
+            birthdate: this.studentForm.date,
+            organId: this.studentForm.organId
+          }
+          registerStudent(obj).then(res => {
+            if (res.code == 200) {
+              this.$message.success('添加成功');
+              this.studentVisible = false;
+              this.getList()
+            }
+          })
+        }
+      })
+    },
+    // 修改学生信息
+    resetStudentSubmie () {
+      this.$refs['studentForm'].validate(item => {
+        if (item) {
+          let obj = {
+            phone: this.studentForm.phone,
+            username: this.studentForm.name,
+            gender: this.studentForm.sex,
+            realName: this.studentForm.parseName,
+            birthdate: this.studentForm.date,
+            organId: this.studentForm.organId,
+            id: this.active.userId
+          }
+          updateStudent(obj).then(res => {
+            if (res.code == 200) {
+              this.$message.success('修改成功');
+              this.studentVisible = false;
+              this.getList()
+            }
+          })
+        }
+      })
+    },
+    addStudent () {
+      this.isNew = true;
+      this.studentVisible = true;
+    },
+    resetStudent (row) {
+      this.isNew = false;
+      this.active = row;
+      this.studentVisible = true;
+      this.studentForm = {
+        phone: row.parentsPhone,
+        name: row.username,
+        sex: row.gender,
+        parseName: row.realName,
+        date: row.birthdate,
+      }
+    }
+  },
+  watch: {
+    studentVisible (val) {
+      if (!val) {
+        this.$refs['studentForm'].resetFields()
+        // this.studentForm.
+      }
     }
   }
 }

+ 1 - 1
src/views/vipClass/vipReset.vue

@@ -342,7 +342,7 @@
 </template>
 <script>
 import { resetCourse } from '@/api/buildTeam'
-import { getSchool } from '@/api/systemManage'
+// import { getSchool } from '@/api/systemManage'
 import pagination from '@/components/Pagination/index'
 import { findVipGroupCourseSchedules, bathDelete, appendVipGroupCourseSchedules, vipCourseAdjust, updateVipBaseInfo, batchAppendVipGroupCourses } from '@/api/vipSeting'
 import { getTeachSchool } from '@/api/teacherManager'

+ 2 - 2
vue.config.js

@@ -18,10 +18,10 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // // 
 // let target = 'http://testadm.dayaedu.com/' //勇哥迁库
 // let target = 'http://192.168.3.27:8000' // 箭河
-// let target = 'http://192.168.3.28:8000' //邹璇
+let target = 'http://192.168.3.28:8000' //邹璇
 // let target = 'http://192.168.3.8:18000' //勇哥
 // let target = 'http://47.99.212.176:8000' // 测试服
-let target = 'http://192.168.3.48:8080' // 乔
+// let target = 'http://192.168.3.48:8080' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
   /**