Commit 69105779 authored by liwei's avatar liwei

修改bug

parent c505617d
......@@ -43,6 +43,18 @@ export function updateUser(data) {
headers: {}
})
}
// 1.新增用户
export function addLectureByUser(data) {
data = Qs.stringify(data)
return request({
url: '/pc/sysuser/addLectureByUser',
method: 'post',
data,
headers: {}
})
}
// 3.删除用户
export function delUser(userId) {
return request({
......@@ -202,3 +214,11 @@ export function listByIdentity(query) {
})
}
// 11.用户状态修改
export function updateLectureByUser(businessId, flag) {
return request({
url: '/cmslecturer/updateLecturerByUser/' + praseStrEmpty(businessId),
method: 'put'
})
}
......@@ -425,7 +425,7 @@ import {
changeUserStatus,
importExcel,
uploadFalseFile,
importTemplate, updatePassword
importTemplate, updatePassword, addLectureByUser, updateLectureByUser
} from '@/api/system/user'
import { getToken } from '@/utils/auth'
import { treeSelect } from '@/api/system/dept'
......@@ -918,6 +918,36 @@ export default {
this.open = false
this.getList()
})
console.log('this.form.roleList:', this.form.roleList)
if (this.form.roleList.length === 2 || (this.form.roleList.length === 1 && this.form.roleList[0] === 9)) {
const params1 = {
businessId: this.form.businessId,
identity: this.form.identity,
username: this.form.username,
flag: 1,
name: this.form.name,
phone: this.form.phone,
remarks: this.form.remarks
}
addLectureByUser(params1).then(response => {
this.$message({
message: '修改成功',
type: 'success'
})
this.open = false
this.getList()
})
}
if (this.form.roleList.length === 1 && this.form.roleList[0] === 3) {
updateLectureByUser(this.form.businessId).then(response => {
this.$message({
message: '修改成功',
type: 'success'
})
this.open = false
this.getList()
})
}
} else {
const paramsAdd = {
identity: this.form.identity,
......@@ -944,20 +974,41 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
// 使用箭头函数来保持正确的 `this` 上下文
const userId = row.businessId || this.ids
// 使用箭头函数来确保 `this` 的正确绑定
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(() => {
// 更新讲座信息
updateLectureByUser(userId).then(() => {
// 讲座更新成功后显示提示
this.$message({
message: '修改成功',
type: 'success'
})
})
// 删除用户
}).then(() => {
return delUser(userId)
}).then(() => {
this.getList()
// 成功删除后重新获取列表并显示提示
this.getList();
this.$message({
message: '除成功',
message: '除成功',
type: 'success'
});
}).catch((error) => {
// 错误处理
console.error(error)
this.$message({
message: '操作失败,请稍后重试',
type: 'error'
})
}).catch(function() {})
})
},
/** 导出按钮操作 */
handleExport() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment