Commit 69105779 authored by liwei's avatar liwei

修改bug

parent c505617d
...@@ -43,6 +43,18 @@ export function updateUser(data) { ...@@ -43,6 +43,18 @@ export function updateUser(data) {
headers: {} headers: {}
}) })
} }
// 1.新增用户
export function addLectureByUser(data) {
data = Qs.stringify(data)
return request({
url: '/pc/sysuser/addLectureByUser',
method: 'post',
data,
headers: {}
})
}
// 3.删除用户 // 3.删除用户
export function delUser(userId) { export function delUser(userId) {
return request({ return request({
...@@ -202,3 +214,11 @@ export function listByIdentity(query) { ...@@ -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 { ...@@ -425,7 +425,7 @@ import {
changeUserStatus, changeUserStatus,
importExcel, importExcel,
uploadFalseFile, uploadFalseFile,
importTemplate, updatePassword importTemplate, updatePassword, addLectureByUser, updateLectureByUser
} from '@/api/system/user' } from '@/api/system/user'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { treeSelect } from '@/api/system/dept' import { treeSelect } from '@/api/system/dept'
...@@ -918,6 +918,36 @@ export default { ...@@ -918,6 +918,36 @@ export default {
this.open = false this.open = false
this.getList() 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 { } else {
const paramsAdd = { const paramsAdd = {
identity: this.form.identity, identity: this.form.identity,
...@@ -944,20 +974,41 @@ export default { ...@@ -944,20 +974,41 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
// 使用箭头函数来保持正确的 `this` 上下文
const userId = row.businessId || this.ids const userId = row.businessId || this.ids
// 使用箭头函数来确保 `this` 的正确绑定
this.$confirm('是否确认操作?', '提示', { this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(() => {
// 更新讲座信息
updateLectureByUser(userId).then(() => {
// 讲座更新成功后显示提示
this.$message({
message: '修改成功',
type: 'success'
})
})
// 删除用户
}).then(() => {
return delUser(userId) return delUser(userId)
}).then(() => { }).then(() => {
this.getList() // 成功删除后重新获取列表并显示提示
this.getList();
this.$message({ this.$message({
message: '除成功', message: '除成功',
type: 'success' type: 'success'
});
}).catch((error) => {
// 错误处理
console.error(error)
this.$message({
message: '操作失败,请稍后重试',
type: 'error'
}) })
}).catch(function() {}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { 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