mo před 4 roky
rodič
revize
6ad4c7da0f

+ 10 - 0
src/api/systemManage.js

@@ -332,4 +332,14 @@ export function hasCourseGroupRelation (data) {
     method: 'post',
     data: qs.stringify(data)
   })
+}
+
+// 教务老师转移课程
+
+export function updateEducationTeacherId (data) {
+  return request({
+    url: api + '/employee/updateEducationTeacherId',
+    method: 'post',
+    data: qs.stringify(data)
+  })
 }

+ 70 - 27
src/views/categroyManager/insideSetting/staffManager.vue

@@ -289,7 +289,7 @@
 </template>
 <script>
 import pagination from '@/components/Pagination/index'
-import { queryEmployByOrganId, employeeOperate, getUserRole, employeeAdd, employeeUpdate, hasCourseGroupRelation } from '@/api/systemManage'
+import { queryEmployByOrganId, employeeOperate, getUserRole, employeeAdd, employeeUpdate, hasCourseGroupRelation, updateEducationTeacherId } from '@/api/systemManage'
 import { branchQueryPage } from '@/api/specialSetting'
 import { findEducationUsers } from '@/api/buildTeam'
 import store from '@/store'
@@ -369,9 +369,7 @@ export default {
     this.getEducationUsers()
   },
   methods: {
-    submitEducation () {
-      console.log('来了')
-    },
+
     getEducationUsers () {
       findEducationUsers().then(res => {
         if (res.code === 200) {
@@ -505,35 +503,80 @@ export default {
         return reuslt[row.lockFlag]
       }
     },
-    async onStaffOperation (type, data) {
-      if (type === 'DEMISSION' && !data.demissionDate) {
-        this.activeRow = data;
-        // 1.点击的是离职按钮
-        // 2.判断该考级是否存在教务老师
-        await hasCourseGroupRelation({ employeeId: data.id }).then(res => {
-          if (res.code === 200) {
-            if (res.deta === 0) {
-              return
+    async checkStatus (data) {
+      let status;
+      await hasCourseGroupRelation({ employeeId: data.id }).then(res => {
+        if (res.code === 200) {
+          if (res.data.hasCourseSchedule) {
+            this.$message.error('请先交接指导老师课程')
+            status = false
+          } else {
+            if (res.data.hasCourseGroupRelation) {
+              this.educationViseble = true
+              status = false
             } else {
-              this.educationViseble = true;
+              // 1 要弹出
+              status = true
             }
           }
+
+        }
+      })
+
+      return status
+    },
+    onStaffOperation (type, data) {
+      this.$confirm("您确定修改员工状态", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(async () => {
+        if (type === 'DEMISSION' && !data.demissionDate) {
+          this.activeRow = data;
+          // 1.点击的是离职按钮
+          // 2.判断该考级是否存在教务老师
+          const status = await this.checkStatus(data)
+          if (!status) {
+            return
+          }
+        }
+        employeeOperate({
+          employeeId: data.id,
+          operate: type
+        }).then(res => {
+          if (res.code == 200) {
+            this.$message.success('更改成功')
+            this.roleStatus = false
+            this.getList()
+          } else {
+            this.$message.error(res.msg)
+          }
         })
-        return
-      }
-      employeeOperate({
-        employeeId: data.id,
-        operate: type
-      }).then(res => {
-        if (res.code == 200) {
-          this.$message.success('更改成功')
-          this.roleStatus = false
-          this.getList()
-        } else {
-          this.$message.error(res.msg)
+      }).catch(err => { })
+
+    },
+    submitEducation () {
+      // 发请求 提交信息
+      updateEducationTeacherId({ currentUserId: this.activeRow.id, targetUserId: this.educationForm.targetUserId }).then(res => {
+        if (res.code === 200) {
+          const type = 'DEMISSION'
+          const data = this.activeRow;
+          employeeOperate({
+            employeeId: data.id,
+            operate: type
+          }).then(res => {
+            if (res.code == 200) {
+              this.$message.success('更改成功')
+              this.roleStatus = false
+              this.educationViseble = false
+              this.getList()
+            } else {
+              this.$message.error(res.msg)
+            }
+          })
         }
       })
-    }
+    },
   },
   watch: {
     educationViseble (val) {

+ 2 - 2
vue.config.js

@@ -19,9 +19,9 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // let target = 'https://online.dayaedu.com' //线上
 // let target = 'http://dyme.utools.club' //test环境
 // let target = 'http://192.168.3.139:8000' // 箭河
-let target = 'http://192.168.3.28:8000' //邹璇
+// let target = 'http://192.168.3.28:8000' //邹璇
 // let target = 'http://192.168.3.8:8000' //勇哥
-// let target = 'http://dev.dayaedu.com' // 测试服
+let target = 'http://dev.dayaedu.com' // 测试服
 // let target = 'http://192.168.3.196:8080' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {