feat: 完善taskindex取值逻辑

feat/20240417similarite
zhouxiaoan 1 year ago
parent 99cf47a7dd
commit f961c27255

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useInfiniteScroll } from "@vueuse/core"; import { useInfiniteScroll } from "@vueuse/core";
import { defineProps, onMounted, onUnmounted, reactive, ref, watch } from "vue"; import { defineProps, nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue";
import ListItem from "./ListItem.vue"; import ListItem from "./ListItem.vue";
import emitter from "@/utils/mitt"; import emitter from "@/utils/mitt";
import { useTaskStore } from "@/store/modules/task"; import { useTaskStore } from "@/store/modules/task";
@ -77,8 +77,12 @@ async function fetchList() {
watch( watch(
() => taskStore.activeId, () => taskStore.activeId,
(newVal) => { (newVal) => {
activeId.value = newVal; activeId.value = newVal
taskIndex.value = taskStore.getApprovalList.find(i => i.id === newVal)?.taskIndex nextTick(() => {
const taskPackage = taskStore.getApprovalList[taskStore.getCurrentIndex]||{}
taskIndex.value = taskPackage.taskIndex
})
}, },
); );

@ -517,8 +517,7 @@ watch(
packageId.value = taskStore.getPackageid packageId.value = taskStore.getPackageid
taskId.value = taskStore.getActiveId taskId.value = taskStore.getActiveId
// //
const task = taskStore.getApprovalList.find(i => i.id === taskStore.activeId) taskIndex.value = taskStore.getApprovalList[taskStore.currentIndex].taskIndex
taskIndex.value = task.taskIndex
getDetail() getDetail()
} }
}, },

@ -346,7 +346,8 @@ async function refreshHandler() {
reset() reset()
if (!taskId.value) if (!taskId.value)
return return
taskDetailInfo.value = await getTaskDetailInfo(taskId.value, '') const taskPackage = taskStore.getApprovalList[taskStore.getCurrentIndex] || {}
taskDetailInfo.value = await getTaskDetailInfo(taskId.value, taskPackage.packageid,taskPackage?.taskIndex || '')
nextTick(() => { nextTick(() => {
setTimeout(() => { setTimeout(() => {

Loading…
Cancel
Save