|  |  | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script setup lang="ts"> | 
 |  |  |     import { ref, onMounted } from 'vue' | 
 |  |  |     import { ref, onMounted, getCurrentInstance, onBeforeUnmount } from 'vue' | 
 |  |  |     import { useRoute, useRouter } from "vue-router" | 
 |  |  |     import { queryById, getJdList, createDJ } from '@/apis/WorkOrderAPI' | 
 |  |  |     import { Toast } from 'vant' | 
 |  |  | 
 |  |  |     const route = useRoute() | 
 |  |  |  | 
 |  |  |     const router = useRouter() | 
 |  |  |     const { $Bus }  = getCurrentInstance().appContext.config.globalProperties  | 
 |  |  |  | 
 |  |  |     // 控制日期显示隐藏 | 
 |  |  |     let timer = ref<boolean>(false) | 
 |  |  | 
 |  |  |                 id: route.query.id | 
 |  |  |             }).then(res => { | 
 |  |  |                 if (res.code === 200) { | 
 |  |  |                     Toast.success({ | 
 |  |  |                         message: '创建成功', | 
 |  |  |                         duration: 2000, | 
 |  |  |                         forbidClick: true | 
 |  |  |                     }) | 
 |  |  |                     setTimeout(() => { | 
 |  |  |                         router.go(-1) | 
 |  |  |                     }, 2000) | 
 |  |  |                     Toast.success({ message: '创建成功', duration: 2000, forbidClick: true }) | 
 |  |  |                     // $Bus.emit('callback1', '1') | 
 |  |  |                     setTimeout(() => { router.go(-1) }, 2000) | 
 |  |  |                 } | 
 |  |  |             }) | 
 |  |  |         } else { | 
 |  |  | 
 |  |  |         queryByIds() | 
 |  |  |         getJdLists() | 
 |  |  |     }) | 
 |  |  |  | 
 |  |  |     onBeforeUnmount(() => { | 
 |  |  |         $Bus.all.delete("callback1") | 
 |  |  |     }) | 
 |  |  | </script> | 
 |  |  |  | 
 |  |  | <style lang="scss" scoped> |