3 changed files with 40 additions and 4 deletions
@ -1,2 +1,34 @@ |
|||||
import useList from "../_list.js"; |
import AppList from "../../components/list/index.js"; |
||||
export default useList("vmi/balance"); |
import html from "html"; |
||||
|
import { ref, onMounted, onUnmounted } from "vue"; |
||||
|
import { useRoute } from "vue-router"; |
||||
|
import { ElNotification } from "element-plus"; |
||||
|
|
||||
|
export default { |
||||
|
components: { AppList }, |
||||
|
template: html`<app-list v-if="config" :config="config" @command="onCommand" />`, |
||||
|
setup() { |
||||
|
const config = ref(null); |
||||
|
const route = useRoute(); |
||||
|
const messageCount = ref(-1); |
||||
|
const onCommand = async (item, rows) => { |
||||
|
console.log(item.path, item, rows); |
||||
|
}; |
||||
|
const event = "VmiBalance"; |
||||
|
onMounted(async () => { |
||||
|
const model = "vmi/balance"; |
||||
|
const useConfig = (await import(`../../models/${model}.js`)).default; |
||||
|
config.value = useConfig(route.meta?.businessType, route.meta); |
||||
|
PubSub.subscribe(event, async (_, data) => { |
||||
|
messageCount.value = parseInt(data); |
||||
|
}); |
||||
|
ElNotification({ |
||||
|
title: "Prompt", |
||||
|
message: messageCount.value, |
||||
|
duration: 0, |
||||
|
}); |
||||
|
}); |
||||
|
onUnmounted(() => PubSub.unsubscribe(event)); |
||||
|
return { config, onCommand, messageCount }; |
||||
|
}, |
||||
|
}; |
||||
|
Loading…
Reference in new issue