|
|
@@ -56,6 +56,10 @@ import DialogJustForm from "@/components/DialogJustForm.vue"; |
|
|
|
const DIALOG_WITH_MENU = "DialogWithMenu"; |
|
|
|
const DIALOG_JUST_FORM = "DialogJustForm"; |
|
|
|
|
|
|
|
function constructToTree(list) { |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "ListViewWithHead", |
|
|
|
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm }, |
|
|
@@ -146,10 +150,12 @@ export default { |
|
|
|
// page 场景: |
|
|
|
if ("list" in res.data) { |
|
|
|
// real env: |
|
|
|
this.dataList = res.data.list.map((item) => ({ |
|
|
|
...item, |
|
|
|
id: item._id ?? item.id, |
|
|
|
})); |
|
|
|
this.dataList = constructToTree( |
|
|
|
res.data.list.map((item) => ({ |
|
|
|
...item, |
|
|
|
id: item._id ?? item.id, |
|
|
|
})) |
|
|
|
); |
|
|
|
// this.dataList = res.data.records; |
|
|
|
this.totalPage = res.data.total; |
|
|
|
} else if ("records" in res.data) { |
|
|
@@ -214,6 +220,21 @@ export default { |
|
|
|
this.openDialog(data, true); |
|
|
|
break; |
|
|
|
} |
|
|
|
case "status": { |
|
|
|
console.log('status', data) |
|
|
|
// TODO: 类似于这种字符串,可以统一集中到一个文件里 |
|
|
|
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, queryCondition).then(({ data: res }) => { |
|
|
|
if (res.code === 0) { |
|
|
|
// do nothing |
|
|
|
} |
|
|
|
}); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|