2023-12-28 角色修改前端1.页面3.接口
image.png
//////////////////////////
<el-table-column label="操作" align="center" width="280" #default="scope">
<el-button type="primary" size="small" @click="editShow(scope.row)">
//////////////////////////
// 修改按钮点击事件处理函数
const editShow = (row) => {
//sysRole.value = row
sysRole.value = {... row}
dialogVisible.value = true
}
image.png
////////
// 保存修改
export const UpdateSysRole = (data) => {
return request({
url: '/admin/system/sysRole/updateSysRole',
method: 'put',
data
})
}
////////引入
import { GetSysRoleListByPage , SaveSysRole , UpdateSysRole} from '@/api/sysRole';
////////
const submit = async () => {
if(!sysRole.value.id) {
const { code } = await SaveSysRole(sysRole.value) ;
if(code === 200) {
dialogVisible.value = false
ElMessage.success('操作成功')
fetchData()
}
}else {
const { code } = await UpdateSysRole(sysRole.value) ;
if(code === 200) {
dialogVisible.value = false
ElMessage.success('操作成功')
fetchData()
}
}
}