feat: 完善taskindex取值逻辑

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

@ -1,6 +1,6 @@
<script lang="ts" setup>
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 emitter from "@/utils/mitt";
import { useTaskStore } from "@/store/modules/task";
@ -77,8 +77,12 @@ async function fetchList() {
watch(
() => taskStore.activeId,
(newVal) => {
activeId.value = newVal;
taskIndex.value = taskStore.getApprovalList.find(i => i.id === newVal)?.taskIndex
activeId.value = newVal
nextTick(() => {
const taskPackage = taskStore.getApprovalList[taskStore.getCurrentIndex]||{}
taskIndex.value = taskPackage.taskIndex
})
},
);

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

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

Loading…
Cancel
Save