update switchBtn
This commit is contained in:
@@ -222,20 +222,18 @@ export default {
|
||||
break;
|
||||
}
|
||||
case "status": {
|
||||
console.log('status', data)
|
||||
// TODO: 类似于这种字符串,可以统一集中到一个文件里
|
||||
const { id, code, enabled } = data;
|
||||
const { id, code } = data;
|
||||
const queryCondition = { id, code };
|
||||
if ("enabled" in data) queryCondition.enabled = data['enabled'];
|
||||
if ("status" in data) queryCondition.status = data['status'];
|
||||
// 更改状态,更改状态需要 id 和 code 然后是 状态 enabled
|
||||
this.$http
|
||||
.put(this.urls.base, {
|
||||
id,
|
||||
code,
|
||||
enabled,
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
this.$http.put(this.urls.base, queryCondition).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user