mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-09 04:57:11 +08:00
优化:优化后端公共 CRUD 组件-修改接口,将 id 从请求体提取到路径变量,更符合 RESTful 风格
This commit is contained in:
@@ -431,7 +431,7 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateDept(form.value).then((res) => {
|
||||
updateDept(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@@ -559,14 +559,16 @@
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: DeptRecord) => {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateDept(record)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateDept(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -482,7 +482,7 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateMenu(form.value).then((res) => {
|
||||
updateMenu(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@@ -596,14 +596,16 @@
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: MenuRecord) => {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateMenu(record)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateMenu(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -625,7 +625,7 @@
|
||||
if (form.value.id !== undefined) {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
form.value.deptIds = getDeptAllCheckedKeys();
|
||||
updateRole(form.value).then((res) => {
|
||||
updateRole(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@@ -731,14 +731,16 @@
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: RoleRecord) => {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateRole(record)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateRole(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -695,7 +695,7 @@
|
||||
proxy.$refs.formRef.validate((valid: any) => {
|
||||
if (!valid) {
|
||||
if (form.value.id !== undefined) {
|
||||
updateUser(form.value).then((res) => {
|
||||
updateUser(form.value, form.value.id).then((res) => {
|
||||
handleCancel();
|
||||
getList();
|
||||
proxy.$message.success(res.msg);
|
||||
@@ -825,14 +825,16 @@
|
||||
* @param record 记录信息
|
||||
*/
|
||||
const handleChangeStatus = (record: UserRecord) => {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateUser(record)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
if (record.id) {
|
||||
const tip = record.status === 1 ? '启用' : '禁用';
|
||||
updateUser(record, record.id)
|
||||
.then(() => {
|
||||
proxy.$message.success(`${tip}成功`);
|
||||
})
|
||||
.catch(() => {
|
||||
record.status = record.status === 1 ? 2 : 1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user