|
|
@@ -36,7 +36,7 @@
|
|
|
</div> -->
|
|
|
<div class="task-content" v-loading="loading">
|
|
|
<div class="task-item" v-for="(item, index) in taskList" :key="item.id || item.workRecordId">
|
|
|
- <task-item :key="activeIndex + '-' + index" :status="activeIndex === 3 ? 1 : 0" :item-data="item" @handleUploadSuccess="handleUploadSuccess" ref="taskItemRef">
|
|
|
+ <task-item :key="activeIndex + '-' + index" :status="activeIndex === 3 ? 1 : 0" :item-data="item" @handleUploadSuccess="handleUploadSuccess" :ref="el => setTaskItemRef(el, index)">
|
|
|
<template #footer>
|
|
|
<div class="item-footer" v-if="activeIndex === 0 || activeIndex === 2">
|
|
|
<div class="footer-l" @click="toDetail(item)">
|
|
|
@@ -71,7 +71,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" />
|
|
|
+ <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" @uploadSuccess="handleUploadSuccess" />
|
|
|
|
|
|
<popup v-model:show="showTaskPopup" round class="task-tips-popup">
|
|
|
<template v-if="taskPopupType === 'warning'">
|
|
|
@@ -175,10 +175,23 @@ function getTaskCount(flowStatus, index) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-const taskItemRef = ref(null);
|
|
|
+const taskItemRefs = ref([]);
|
|
|
+const setTaskItemRef = (el, index) => {
|
|
|
+ if (el) {
|
|
|
+ taskItemRefs.value[index] = el;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const handleUploadSuccess = () =>{
|
|
|
+ console.log('handleUploadSuccess', taskItemRefs.value)
|
|
|
getSimpleList();
|
|
|
- taskItemRef.value.updateTriggerImg();
|
|
|
+ // 更新所有task-item的triggerImg
|
|
|
+ taskItemRefs.value.forEach(ref => {
|
|
|
+ if (ref && ref.updateTriggerImg) {
|
|
|
+ ref.updateTriggerImg();
|
|
|
+ console.log('updateTriggerImg', ref)
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 初始化时获取所有状态的任务数量
|
|
|
@@ -212,6 +225,8 @@ watch(activeIndex, () => {
|
|
|
function getSimpleList() {
|
|
|
loading.value = true;
|
|
|
noData.value = false;
|
|
|
+ // 清空refs数组,避免索引错乱
|
|
|
+ taskItemRefs.value = [];
|
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
|
const startFlowStatus = getStartFlowStatus(activeIndex.value);
|
|
|
VE_API.z_farm_work_record.getSimpleList({ role: 2, location, flowStatus: startFlowStatus }).then(({data}) => {
|