删除类别。

This commit is contained in:
tengge1 2019-08-19 22:22:49 +08:00
parent 09ea17cfb6
commit eaffe01f48
2 changed files with 28 additions and 1 deletions

View File

@ -643,5 +643,6 @@
"Cannot deserialize scene data.": "无法解析场景数据!",
"Total {{totalPage}} Pages": "共{{totalPage}}页",
"Create": "添加",
"Please select a record.": "请选择数据"
"Please select a record.": "请选择数据",
"Delete this category?": "是否删除该类别?"
}

View File

@ -108,7 +108,33 @@ class CategoryWindow extends React.Component {
}
handleDelete() {
const { selected } = this.state;
if (!selected) {
app.toast(_t('Please select a record.'));
return;
}
app.confirm({
title: _t('Query'),
content: _t('Delete this category?'),
onOK: () => {
fetch(`${app.options.server}/api/Category/Delete?ID=${selected.ID}`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
}).then(response => {
response.json().then(json => {
if (json.Code === 200) {
this.updateUI();
} else {
app.toast(json.Msg);
}
});
});
}
});
}
handleSelect(obj) {