From feb57a65e895bfbf3f1ba78d960b97d5ed83c513 Mon Sep 17 00:00:00 2001 From: elseif Date: Mon, 18 Mar 2024 10:33:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=B7=A6=E4=BE=A7=E5=88=97=E8=A1=A8=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/workOrder.ts | 7 ++-- src/views/task/aside/TaskList.vue | 2 -- src/views/worksheet/aside/Aside.vue | 10 +++--- src/views/worksheet/aside/WorkSheetList.vue | 38 +++++++++++++++------ src/views/worksheet/content/Content.vue | 6 ++++ 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/store/modules/workOrder.ts b/src/store/modules/workOrder.ts index d41c1a1..07b58ef 100644 --- a/src/store/modules/workOrder.ts +++ b/src/store/modules/workOrder.ts @@ -45,10 +45,11 @@ export const useWorkOrderStore = defineStore({ }, async fetchOrderList(pagination, keyword) { const res = await getPackageList(pagination, keyword) - + if (res.data.length > 0) { - this.setOrderList(res.data) - this.setActive(0) + this.packageList.push(...res.data) + if (!this.activeId) + this.setActive(0) } return res diff --git a/src/views/task/aside/TaskList.vue b/src/views/task/aside/TaskList.vue index ca972d6..1a30aec 100644 --- a/src/views/task/aside/TaskList.vue +++ b/src/views/task/aside/TaskList.vue @@ -5,8 +5,6 @@ import ListItem from './ListItem.vue' import { useTaskStore } from '@/store/modules/task' import emitter from '@/utils/mitt' -defineOptions({ name: 'WorkSheetList' }) - const taskStore = useTaskStore() const data = ref([]) const activeId = ref('') diff --git a/src/views/worksheet/aside/Aside.vue b/src/views/worksheet/aside/Aside.vue index a0f4d9a..e088c6e 100644 --- a/src/views/worksheet/aside/Aside.vue +++ b/src/views/worksheet/aside/Aside.vue @@ -1,11 +1,11 @@ diff --git a/src/views/worksheet/content/Content.vue b/src/views/worksheet/content/Content.vue index 0cd3d46..54d6a47 100644 --- a/src/views/worksheet/content/Content.vue +++ b/src/views/worksheet/content/Content.vue @@ -8,6 +8,7 @@ import { useWorkOrder } from '@/store/modules/workOrder' import { clearTF, getPackageTaskList, getTaskDetailInfo, getTaskDetailPictureList, setTF } from '@/api/work/work' import { fieldMap } from '@/config/workorder' import { hideDownload } from '@/utils/image' +import { isEmpty } from '@/utils' const batch = ref(false) const selectItems = ref([]) @@ -184,6 +185,11 @@ function backHandler() { } watch(() => workStore.activeId, async (newValue, oldValue) => { + const taskId = workStore.getActiveId + + if (isEmpty(taskId)) + return + const res = await getPackageTaskList(newValue, packagepagination) const { data } = res taskList.value = data