|
|
@@ -173,13 +173,15 @@ const getStartFlowStatus = (index) => {
|
|
|
// 获取单个状态的任务数量
|
|
|
function getTaskCount(flowStatus, index) {
|
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
|
- const needReview = activeIndex.value === 2 ? 1 : null;
|
|
|
- const includePrescription = activeIndex.value === 0 ? false : true;
|
|
|
+ // 根据传入的 index 参数来设置 needReview 和 includePrescription,而不是根据 activeIndex.value
|
|
|
+ const needReview = index === 2 ? 1 : null; // 待复核需要 needReview=1
|
|
|
+ const includePrescription = index === 0 ? false : true; // 待完成不需要处方,其他需要
|
|
|
return VE_API.z_farm_work_record
|
|
|
.getSimpleList({ role: 2, location, flowStatus, needReview, includePrescription })
|
|
|
.then(({ data }) => {
|
|
|
if (Array.isArray(data)) {
|
|
|
taskCounts.value[index] = data.length;
|
|
|
+ console.log('taskCounts.value', taskCounts.value);
|
|
|
calendarRef.value && calendarRef.value.setCounts(index, taskCounts.value[index]);
|
|
|
|
|
|
if (index === 0) {
|
|
|
@@ -265,6 +267,8 @@ onMounted(() => {
|
|
|
});
|
|
|
|
|
|
onActivated(() => {
|
|
|
+ // 初始化时获取所有状态的数量
|
|
|
+ initTaskCounts();
|
|
|
getSimpleList();
|
|
|
});
|
|
|
|
|
|
@@ -321,8 +325,8 @@ function getSimpleList() {
|
|
|
// 如果有日期筛选,在前端再次过滤(确保数据准确)
|
|
|
if (filterDate.value && Array.isArray(filteredData)) {
|
|
|
filteredData = filteredData.filter((item) => {
|
|
|
- if (!item.executeDate) return false;
|
|
|
- const itemDate = formatDate(new Date(item.executeDate));
|
|
|
+ if (!item.expectedExecuteDate && !item.executeDeadlineDate) return false;
|
|
|
+ const itemDate = formatDate(new Date(item.expectedExecuteDate || item.executeDeadlineDate));
|
|
|
return itemDate === filterDate.value;
|
|
|
});
|
|
|
}
|
|
|
@@ -334,7 +338,6 @@ function getSimpleList() {
|
|
|
if (activeIndex.value === 0) {
|
|
|
// 传递给日历的数据应该是完整的未筛选数据
|
|
|
const calendarData = filterDate.value ? fullTaskList.value : taskList.value;
|
|
|
- console.log("calendarData", calendarData);
|
|
|
calendarRef.value && calendarRef.value.setSolarTerm(calendarData);
|
|
|
// 地图使用筛选后的数据
|
|
|
indexMap.initData(taskList.value);
|
|
|
@@ -366,9 +369,9 @@ const handleDateSelect = (date) => {
|
|
|
// 有日期选择,切换到"待完成"筛选并设置筛选日期
|
|
|
filterDate.value = date;
|
|
|
// 如果当前不是"待完成"状态,切换到"待完成"
|
|
|
- if (activeIndex.value !== 2) {
|
|
|
+ if (activeIndex.value !== 0) {
|
|
|
isDateSelecting.value = true; // 标记正在通过日期选择切换
|
|
|
- activeIndex.value = 2;
|
|
|
+ activeIndex.value = 0;
|
|
|
// watch 会处理 getSimpleList
|
|
|
} else {
|
|
|
// 如果已经是"待完成"状态,直接重新加载列表
|
|
|
@@ -389,24 +392,6 @@ function handleActiveFilter(i) {
|
|
|
selectParma.value.farmWorkTypeId = null;
|
|
|
}
|
|
|
|
|
|
-function toPage(item) {
|
|
|
- // router.push("/servicZes_agri")
|
|
|
- // if (activeIndex.value === 2) {
|
|
|
- // } else {
|
|
|
- // // 下发农事请求
|
|
|
- // const data = {
|
|
|
- // id: item.id,
|
|
|
- // };
|
|
|
- // VE_API.z_farm_work_record.issueFarmWorkRecord(data).then((res) => {
|
|
|
- // if (res.code === 0) {
|
|
|
- // taskPopupType.value = "success";
|
|
|
- // showTaskPopup.value = true;
|
|
|
- // getSimpleList();
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
-}
|
|
|
-
|
|
|
const offerPopupRef = ref(null);
|
|
|
const showUploadExecutePopup = (item) => {
|
|
|
if(getButtonText(item)) {
|