mahao
1 year ago
5 changed files with 39 additions and 25 deletions
@ -1,15 +1,35 @@ |
|||
import AppList from "../../../components/list/index.js"; |
|||
import html from "html"; |
|||
import { ref, nextTick } from "vue"; |
|||
import useConfig from "../../../models/vmi/backup.js"; |
|||
import { useAppStore } from "../../store/index.js"; |
|||
import request from "../../request/index.js"; |
|||
|
|||
export default { |
|||
components: { AppList }, |
|||
template: html`<app-list :config="config" @command="onCommand" />`, |
|||
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />`, |
|||
setup() { |
|||
const appListRef = ref(null); |
|||
const config = useConfig(); |
|||
const appStore = useAppStore(); |
|||
const onCommand = async (item, rows) => { |
|||
console.log(item.path, item, rows); |
|||
if (item.path === "invoke") { |
|||
const url = "settleaccount/vmi/vmi-backup/invoke"; |
|||
await appListRef.value.onClick( |
|||
async () => { |
|||
const result = await request(url, null, { method: "POST" }, true); |
|||
if (!result.errors) { |
|||
appStore.isRefreshing = true; |
|||
nextTick(() => { |
|||
appStore.isRefreshing = false; |
|||
}); |
|||
} |
|||
}, |
|||
`是否手动进行备份?`, |
|||
false |
|||
); |
|||
} |
|||
}; |
|||
return { config, onCommand }; |
|||
return { appListRef, config, onCommand }; |
|||
}, |
|||
}; |
|||
|
Loading…
Reference in new issue