wanggang
1 year ago
1 changed files with 8 additions and 15 deletions
@ -1,31 +1,24 @@ |
|||||
import AppList from "../../components/list/index.js"; |
import AppList from "../../components/list/index.js"; |
||||
import html from "html"; |
import html from "html"; |
||||
import useConfig from "../../models/job-item.js"; |
import useConfig from "../../models/job-item.js"; |
||||
import { ref, nextTick, onMounted, onUnmounted } from "vue"; |
import { ref, onMounted, onUnmounted } from "vue"; |
||||
import useConfig2 from "../../models/job-log.js"; |
import useConfig2 from "../../models/job-log.js"; |
||||
|
|
||||
export default { |
export default { |
||||
components: { AppList }, |
components: { AppList }, |
||||
template: html`<app-list v-if="refresh" :config="config" @command="onCommand" />`, |
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />`, |
||||
setup() { |
setup() { |
||||
const config = useConfig(); |
const config = useConfig(); |
||||
const onCommand = async (item, rows, load, showList) => { |
const onCommand = async (item, rows, load, showList) => { |
||||
console.log(item.path, item, rows); |
|
||||
console.log(showList); |
|
||||
const config = useConfig2(); |
const config = useConfig2(); |
||||
config.query.schema.properties.filters.default[0].value = rows[0].id; |
config.query.schema.properties.filters.default[0].value = rows[0].id; |
||||
showList({ test: "test" }, "/base-data/job-log", config); |
showList({ test: "test" }, "/base-data/job-log", config); |
||||
}; |
}; |
||||
const refresh = ref(true); |
//
|
||||
onMounted(async () => { |
const appListRef = ref(null); |
||||
PubSub.subscribe("JobItem", () => { |
const event = "JobItem"; |
||||
refresh.value = false; |
onMounted(() => PubSub.subscribe(event, async () => await appListRef.value.load())); |
||||
nextTick(() => (refresh.value = true)); |
onUnmounted(() => PubSub.unsubscribe(event)); |
||||
}); |
return { config, onCommand, appListRef }; |
||||
}); |
|
||||
onUnmounted(() => { |
|
||||
PubSub.unsubscribe(onMonitor); |
|
||||
}); |
|
||||
return { config, onCommand, refresh }; |
|
||||
}, |
}, |
||||
}; |
}; |
||||
|
Loading…
Reference in new issue