|
@@ -3,19 +3,19 @@
|
|
|
<div class="task-top">
|
|
<div class="task-top">
|
|
|
<div class="map-container" ref="mapContainer"></div>
|
|
<div class="map-container" ref="mapContainer"></div>
|
|
|
<div class="calendar-wrap">
|
|
<div class="calendar-wrap">
|
|
|
- <calendar ref="calendarRef" @dateSelect="handleDateSelect"></calendar>
|
|
|
|
|
|
|
+ <customCalendar ref="calendarRef" @dateSelect="handleDateSelect"></customCalendar>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="task-list">
|
|
<div class="task-list">
|
|
|
<div class="list-filter">
|
|
<div class="list-filter">
|
|
|
- <div class="filter-item" :class="{ active: activeIndex === 2 }" @click="handleActiveFilter(2)">
|
|
|
|
|
- 待完成({{ taskCounts[2] || 0 }})
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="filter-item" :class="{ active: activeIndex === 3 }" @click="handleActiveFilter(3)">
|
|
|
|
|
- 已完成({{ taskCounts[3] || 0 }})
|
|
|
|
|
|
|
+ <div class="filter-item" :class="{ active: activeIndex === 0 }" @click="handleActiveFilter(0)">
|
|
|
|
|
+ 待完成({{ taskCounts[0] || 0 }})
|
|
|
</div>
|
|
</div>
|
|
|
<div class="filter-item" :class="{ active: activeIndex === 1 }" @click="handleActiveFilter(1)">
|
|
<div class="filter-item" :class="{ active: activeIndex === 1 }" @click="handleActiveFilter(1)">
|
|
|
- 已复核({{ taskCounts[1] || 0 }})
|
|
|
|
|
|
|
+ 已完成({{ taskCounts[1] || 0 }})
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="filter-item" :class="{ active: activeIndex === 2 }" @click="handleActiveFilter(2)">
|
|
|
|
|
+ 已复核({{ taskCounts[2] || 0 }})
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="select-group">
|
|
<div class="select-group">
|
|
@@ -43,27 +43,43 @@
|
|
|
<task-item
|
|
<task-item
|
|
|
:key="activeIndex + '-' + index"
|
|
:key="activeIndex + '-' + index"
|
|
|
:itemIndex="activeIndex"
|
|
:itemIndex="activeIndex"
|
|
|
- :status="activeIndex === 3 ? 1 : 0"
|
|
|
|
|
|
|
+ :status="activeIndex === 0 ? 0 : 1"
|
|
|
:item-data="item"
|
|
:item-data="item"
|
|
|
@handleUploadSuccess="handleUploadSuccess"
|
|
@handleUploadSuccess="handleUploadSuccess"
|
|
|
:ref="(el) => setTaskItemRef(el, index)"
|
|
:ref="(el) => setTaskItemRef(el, index)"
|
|
|
>
|
|
>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<div class="item-footer" v-if="activeIndex === 2">
|
|
<div class="item-footer" v-if="activeIndex === 2">
|
|
|
- <div class="footer-l" @click="toDetail(item)">查看详情</div>
|
|
|
|
|
- <div class="footer-r">
|
|
|
|
|
- <div class="btn primary" @click="showUploadExecutePopup(item)">
|
|
|
|
|
- 请求确认
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="footer-l farm-name-text van-ellipsis"
|
|
|
|
|
+ >
|
|
|
|
|
+ 来自<span class="name-text">{{ item.farmName || "--" }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="footer-r">
|
|
|
|
|
+ <div class="btn primary" @click="handleAction(item)">上传复核照片</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else-if="activeIndex === 1" class="item-footer">
|
|
<div v-else-if="activeIndex === 1" class="item-footer">
|
|
|
- <div class="footer-l" @click="toDetail(item)">查看详情</div>
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="footer-l farm-name-text van-ellipsis"
|
|
|
|
|
+ >
|
|
|
|
|
+ 来自<span class="name-text">{{ item.farmName || "--" }}</span>
|
|
|
|
|
+ </div>
|
|
|
<div class="footer-r">
|
|
<div class="footer-r">
|
|
|
- <!-- <div class="btn second" @click="handleForward(item)">
|
|
|
|
|
- 转发给客户
|
|
|
|
|
- </div> -->
|
|
|
|
|
- <div class="btn primary" @click="showPriceSheetPopup(item)">确认并报价</div>
|
|
|
|
|
|
|
+ <div class="btn warning" @click="generateReport(item)">生成成果报告</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else-if="activeIndex === 0" class="item-footer">
|
|
|
|
|
+ <div class="footer-l" @click="toDetail(item)">查看详情</div>
|
|
|
|
|
+ <div class="footer-r" v-if="item.expectedExecuteDate">
|
|
|
|
|
+ <div class="btn primary" @click="showUploadExecutePopup(item)">
|
|
|
|
|
+ 上传照片
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="footer-r" v-else>
|
|
|
|
|
+ <div class="btn warning" @click="selectExecuteTime(item)">
|
|
|
|
|
+ 确认执行时间
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -77,16 +93,19 @@
|
|
|
|
|
|
|
|
<!-- 服务报价单 -->
|
|
<!-- 服务报价单 -->
|
|
|
<price-sheet-popup :key="activeIndex" ref="priceSheetPopupRef"></price-sheet-popup>
|
|
<price-sheet-popup :key="activeIndex" ref="priceSheetPopupRef"></price-sheet-popup>
|
|
|
- <offer-popup ref="offerPopupRef"></offer-popup>
|
|
|
|
|
|
|
+ <offer-popup ref="offerPopupRef" @uploadSuccess="handleUploadSuccess"></offer-popup>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 确认执行时间 -->
|
|
|
|
|
+ <calendar teleport="#app" v-model:show="showCalendar" @confirm="onConfirmExecuteTime" :min-date="minDate" :max-date="maxDate" />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
|
import { useStore } from "vuex";
|
|
import { useStore } from "vuex";
|
|
|
-import { Popup } from "vant";
|
|
|
|
|
|
|
+import { Popup, Calendar } from "vant";
|
|
|
import IndexMap from "../../farm_manage/map/index";
|
|
import IndexMap from "../../farm_manage/map/index";
|
|
|
import taskItem from "@/components/taskItem.vue";
|
|
import taskItem from "@/components/taskItem.vue";
|
|
|
-import calendar from "./calendar.vue";
|
|
|
|
|
|
|
+import customCalendar from "./calendar.vue";
|
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
|
import uploadExecute from "./uploadExecute.vue";
|
|
import uploadExecute from "./uploadExecute.vue";
|
|
|
import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
|
|
import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
|
|
@@ -115,7 +134,7 @@ const fullTaskList = ref([]);
|
|
|
// 各状态任务数量
|
|
// 各状态任务数量
|
|
|
const taskCounts = ref([0, 0, 0]);
|
|
const taskCounts = ref([0, 0, 0]);
|
|
|
// 当前选中的筛选索引
|
|
// 当前选中的筛选索引
|
|
|
-const activeIndex = ref(2);
|
|
|
|
|
|
|
+const activeIndex = ref(0);
|
|
|
// 筛选日期(用于按日期筛选)
|
|
// 筛选日期(用于按日期筛选)
|
|
|
const filterDate = ref(null);
|
|
const filterDate = ref(null);
|
|
|
const noData = ref(false);
|
|
const noData = ref(false);
|
|
@@ -124,24 +143,26 @@ const loading = ref(false);
|
|
|
// 根据 activeIndex 计算 startFlowStatus
|
|
// 根据 activeIndex 计算 startFlowStatus
|
|
|
const getStartFlowStatus = (index) => {
|
|
const getStartFlowStatus = (index) => {
|
|
|
const statusMap = {
|
|
const statusMap = {
|
|
|
- 1: 4, // 待完成
|
|
|
|
|
- 2: 5, // 已完成
|
|
|
|
|
- 3: 5, // 待复核
|
|
|
|
|
|
|
+ 0: 4, // 待完成
|
|
|
|
|
+ 1: 5, // 已完成
|
|
|
|
|
+ 2: 5, // 待复核
|
|
|
};
|
|
};
|
|
|
return statusMap[index] ?? 4;
|
|
return statusMap[index] ?? 4;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 获取单个状态的任务数量
|
|
// 获取单个状态的任务数量
|
|
|
-function getTaskCount(flowStatus, index, needReview) {
|
|
|
|
|
|
|
+function getTaskCount(flowStatus, index) {
|
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
|
|
|
+ const needReview = activeIndex.value === 2 ? 1 : null;
|
|
|
|
|
+ const includePrescription = activeIndex.value === 0 ? false : true;
|
|
|
return VE_API.z_farm_work_record
|
|
return VE_API.z_farm_work_record
|
|
|
- .getSimpleList({ role: 2, location, flowStatus, needReview })
|
|
|
|
|
|
|
+ .getSimpleList({ role: 2, location, flowStatus, needReview, includePrescription })
|
|
|
.then(({ data }) => {
|
|
.then(({ data }) => {
|
|
|
if (Array.isArray(data)) {
|
|
if (Array.isArray(data)) {
|
|
|
taskCounts.value[index] = data.length;
|
|
taskCounts.value[index] = data.length;
|
|
|
calendarRef.value && calendarRef.value.setCounts(index, taskCounts.value[index]);
|
|
calendarRef.value && calendarRef.value.setCounts(index, taskCounts.value[index]);
|
|
|
|
|
|
|
|
- if (index === 2) {
|
|
|
|
|
|
|
+ if (index === 0) {
|
|
|
calendarRef.value && calendarRef.value.setSolarTerm(data);
|
|
calendarRef.value && calendarRef.value.setSolarTerm(data);
|
|
|
indexMap.initData(data);
|
|
indexMap.initData(data);
|
|
|
}
|
|
}
|
|
@@ -165,21 +186,8 @@ const setTaskItemRef = (el, index) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleUploadSuccess = async () => {
|
|
const handleUploadSuccess = async () => {
|
|
|
- // 先保存当前需要更新的 item id
|
|
|
|
|
- const currentItemIds = taskList.value.map((item) => item.id || item.workRecordId);
|
|
|
|
|
-
|
|
|
|
|
// 刷新列表
|
|
// 刷新列表
|
|
|
await getSimpleList();
|
|
await getSimpleList();
|
|
|
-
|
|
|
|
|
- // 等待 DOM 更新完成,refs 被重新收集
|
|
|
|
|
- await nextTick();
|
|
|
|
|
-
|
|
|
|
|
- // 更新所有task-item的triggerImg
|
|
|
|
|
- taskItemRefs.value.forEach((ref) => {
|
|
|
|
|
- if (ref && ref.updateTriggerImg) {
|
|
|
|
|
- ref.updateTriggerImg();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const cityCode = ref("");
|
|
const cityCode = ref("");
|
|
@@ -210,9 +218,9 @@ function initTaskCounts() {
|
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
const location = store.state.home.miniUserLocationPoint;
|
|
|
// 并行请求状态的数量
|
|
// 并行请求状态的数量
|
|
|
Promise.all([
|
|
Promise.all([
|
|
|
- getTaskCount(4, 1), // 已确认
|
|
|
|
|
- getTaskCount(5, 2), // 待完成
|
|
|
|
|
- getTaskCount(5, 3, true), // 已完成
|
|
|
|
|
|
|
+ getTaskCount(4, 0), // 待完成
|
|
|
|
|
+ getTaskCount(5, 1), // 已完成
|
|
|
|
|
+ getTaskCount(5, 2), // 待复核
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
const mapPoint = ref(null);
|
|
const mapPoint = ref(null);
|
|
@@ -257,7 +265,7 @@ function getSimpleList() {
|
|
|
// 清空refs数组,避免索引错乱
|
|
// 清空refs数组,避免索引错乱
|
|
|
taskItemRefs.value = [];
|
|
taskItemRefs.value = [];
|
|
|
const startFlowStatus = getStartFlowStatus(activeIndex.value);
|
|
const startFlowStatus = getStartFlowStatus(activeIndex.value);
|
|
|
- const needReview = activeIndex.value === 2 ? true : false;
|
|
|
|
|
|
|
+ const needReview = activeIndex.value === 2 ? 1 : null;
|
|
|
const params = {
|
|
const params = {
|
|
|
...selectParma.value,
|
|
...selectParma.value,
|
|
|
role: 2,
|
|
role: 2,
|
|
@@ -265,6 +273,7 @@ function getSimpleList() {
|
|
|
flowStatus: startFlowStatus,
|
|
flowStatus: startFlowStatus,
|
|
|
farmWorkTypeId: selectParma.value.farmWorkTypeId || null,
|
|
farmWorkTypeId: selectParma.value.farmWorkTypeId || null,
|
|
|
needReview: needReview,
|
|
needReview: needReview,
|
|
|
|
|
+ includePrescription: activeIndex.value === 0 ? false : true,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return VE_API.z_farm_work_record
|
|
return VE_API.z_farm_work_record
|
|
@@ -293,7 +302,7 @@ function getSimpleList() {
|
|
|
taskList.value = filteredData;
|
|
taskList.value = filteredData;
|
|
|
// 更新当前状态的数量
|
|
// 更新当前状态的数量
|
|
|
taskCounts.value[activeIndex.value] = filteredData.length;
|
|
taskCounts.value[activeIndex.value] = filteredData.length;
|
|
|
- if (activeIndex.value === 2) {
|
|
|
|
|
|
|
+ if (activeIndex.value === 0) {
|
|
|
// 传递给日历的数据应该是完整的未筛选数据
|
|
// 传递给日历的数据应该是完整的未筛选数据
|
|
|
const calendarData = filterDate.value ? fullTaskList.value : taskList.value;
|
|
const calendarData = filterDate.value ? fullTaskList.value : taskList.value;
|
|
|
calendarRef.value && calendarRef.value.setSolarTerm(calendarData);
|
|
calendarRef.value && calendarRef.value.setSolarTerm(calendarData);
|
|
@@ -311,7 +320,7 @@ function getSimpleList() {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
taskList.value = [];
|
|
taskList.value = [];
|
|
|
taskCounts.value[activeIndex.value] = 0;
|
|
taskCounts.value[activeIndex.value] = 0;
|
|
|
- if (activeIndex.value === 2) {
|
|
|
|
|
|
|
+ if (activeIndex.value === 0) {
|
|
|
// 即使筛选后没有数据,日历也应该显示完整数据
|
|
// 即使筛选后没有数据,日历也应该显示完整数据
|
|
|
const calendarData = filterDate.value ? fullTaskList.value : [];
|
|
const calendarData = filterDate.value ? fullTaskList.value : [];
|
|
|
indexMap.initData(taskList.value);
|
|
indexMap.initData(taskList.value);
|
|
@@ -382,17 +391,16 @@ function toPage(item) {
|
|
|
const offerPopupRef = ref(null);
|
|
const offerPopupRef = ref(null);
|
|
|
const showUploadExecutePopup = (item) => {
|
|
const showUploadExecutePopup = (item) => {
|
|
|
offerPopupRef.value.openPopup(item);
|
|
offerPopupRef.value.openPopup(item);
|
|
|
- // if (item?.executeEvidence.length) {
|
|
|
|
|
- // onlyShare.value = true;
|
|
|
|
|
- // } else {
|
|
|
|
|
- // onlyShare.value = false;
|
|
|
|
|
- // }
|
|
|
|
|
- // setTimeout(() => {
|
|
|
|
|
- // uploadExecuteRef.value.showPopup(item);
|
|
|
|
|
- // }, 10);
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+const generateReport = (item) => {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/achievement_report",
|
|
|
|
|
+ query: { miniJson: JSON.stringify({ id: item.id }) },
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
function toDetail(item) {
|
|
function toDetail(item) {
|
|
|
// router.push({
|
|
// router.push({
|
|
|
// path: "/modify",
|
|
// path: "/modify",
|
|
@@ -404,6 +412,27 @@ function toDetail(item) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const showCalendar = ref(false);
|
|
|
|
|
+const maxDate = ref();
|
|
|
|
|
+const minDate = new Date(2010, 0, 1);
|
|
|
|
|
+const executeItem = ref(null);
|
|
|
|
|
+const selectExecuteTime = (item) => {
|
|
|
|
|
+ executeItem.value = item;
|
|
|
|
|
+ maxDate.value = new Date(item.executeDeadlineDate);
|
|
|
|
|
+ showCalendar.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const onConfirmExecuteTime = (date) => {
|
|
|
|
|
+ showCalendar.value = false;
|
|
|
|
|
+ VE_API.z_farm_work_record.updateExpectedExecuteDate({ recordId: executeItem.value.id, expectedExecuteDate: formatDate(date) }).then((res) => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ ElMessage.success("操作成功");
|
|
|
|
|
+ getSimpleList();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const priceSheetPopupRef = ref(null);
|
|
const priceSheetPopupRef = ref(null);
|
|
|
const showPriceSheetPopup = (item) => {
|
|
const showPriceSheetPopup = (item) => {
|
|
|
VE_API.z_farm_work_record.getDetail({ id: item.id }).then(({ data }) => {
|
|
VE_API.z_farm_work_record.getDetail({ id: item.id }).then(({ data }) => {
|
|
@@ -414,7 +443,6 @@ const showPriceSheetPopup = (item) => {
|
|
|
|
|
|
|
|
const onlyShare = ref(false);
|
|
const onlyShare = ref(false);
|
|
|
function handleAction(item) {
|
|
function handleAction(item) {
|
|
|
- onlyShare.value = true;
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
uploadExecuteRef.value.showPopup(item, "share-sheet");
|
|
uploadExecuteRef.value.showPopup(item, "share-sheet");
|
|
|
}, 10);
|
|
}, 10);
|
|
@@ -611,3 +639,10 @@ function handleForward(item) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+
|
|
|
|
|
+.van-calendar__popup {
|
|
|
|
|
+ z-index: 9999 !important;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|