|
|
@@ -317,7 +317,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
-import { ref, computed, onMounted } from "vue";
|
|
|
+import { ref, computed, onActivated } from "vue";
|
|
|
// import NewFarmMap from "./newFarmMap";
|
|
|
import { useStore } from "vuex";
|
|
|
import { Popup } from "vant";
|
|
|
@@ -332,7 +332,7 @@ import { ElMessage } from "element-plus";
|
|
|
|
|
|
const router = useRouter();
|
|
|
const store = useStore();
|
|
|
-const query = useRoute().query?.json ? JSON.parse(useRoute().query?.json) : {};
|
|
|
+const query = ref({});
|
|
|
// 角色
|
|
|
// const curRole = store.state.app.curRole
|
|
|
const currentStep = ref(0);
|
|
|
@@ -361,7 +361,7 @@ const successText = ref('');
|
|
|
const taskPopupActionType = ref(0);
|
|
|
const handleDemand = () => {
|
|
|
// router.push("/share_page");
|
|
|
- VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 2 }).then((res) => {
|
|
|
+ VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 2 }).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
taskPopupType.value = 'success';
|
|
|
successText.value = '需求已发送成功';
|
|
|
@@ -377,21 +377,21 @@ const handlePopupBtn = () => {
|
|
|
showTaskPopup.value = false;
|
|
|
if (taskPopupType.value === 'warning') {
|
|
|
// 确认忽略
|
|
|
- VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 1 }).then((res) => {
|
|
|
+ VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 1 }).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
- getDetail(query.id);
|
|
|
+ getDetail(query.value.id);
|
|
|
currentStep.value = 1
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
if (taskPopupActionType.value === 0) {
|
|
|
- getDetail(query.id);
|
|
|
+ getDetail(query.value.id);
|
|
|
currentStep.value = 2
|
|
|
} else {
|
|
|
router.replace({
|
|
|
path: "/review_work",
|
|
|
query: {
|
|
|
- json: JSON.stringify({ id: query.id })
|
|
|
+ json: JSON.stringify({ id: query.value.id })
|
|
|
},
|
|
|
});
|
|
|
}
|
|
|
@@ -409,7 +409,7 @@ const showPriceSheetPopup = () => {
|
|
|
};
|
|
|
|
|
|
const handleConfirmExecute = () => {
|
|
|
- VE_API.z_farm_work_record_cost.selectQuote({ farmWorkRecordId: query.id, agriculturalId: quotationData.value.agriculturalId }).then((res) => {
|
|
|
+ VE_API.z_farm_work_record_cost.selectQuote({ farmWorkRecordId: query.value.id, agriculturalId: quotationData.value.agriculturalId }).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
taskPopupType.value = 'success';
|
|
|
successText.value = '农事已锁单成功';
|
|
|
@@ -420,7 +420,7 @@ const handleConfirmExecute = () => {
|
|
|
};
|
|
|
|
|
|
const handleConfirmComplete = () => {
|
|
|
- VE_API.z_farm_work_record.updateFlowStatus({ id: query.id, targetFlowStatus: 5 }).then((res) => {
|
|
|
+ VE_API.z_farm_work_record.updateFlowStatus({ id: query.value.id, targetFlowStatus: 5 }).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
taskPopupType.value = 'success';
|
|
|
successText.value = '农事已经执行结束,请按照时间复核';
|
|
|
@@ -477,8 +477,9 @@ const toList = (val) => {
|
|
|
};
|
|
|
const speciesList = computed(() => toList(quotationData.value.serviceSpecies));
|
|
|
const equipmentList = computed(() => toList(quotationData.value.serviceEquipment));
|
|
|
-onMounted(async () => {
|
|
|
- const id = query.id;
|
|
|
+onActivated(async () => {
|
|
|
+ query.value = useRoute().query?.json ? JSON.parse(useRoute().query?.json) : {};
|
|
|
+ const id = query.value?.id;
|
|
|
if (id) {
|
|
|
await getDetail(id);
|
|
|
}
|
|
|
@@ -490,8 +491,8 @@ onMounted(async () => {
|
|
|
farmWorkName:detailData.value.farmWorkName,
|
|
|
id:detailData.value.id,
|
|
|
}
|
|
|
- if (query.farmWorkOrderId || detailData.value?.flowStatus === 4) {
|
|
|
- const farmWorkOrderId = query.farmWorkOrderId || detailData.value.orderId;
|
|
|
+ if (query.value?.farmWorkOrderId || detailData.value?.flowStatus === 4) {
|
|
|
+ const farmWorkOrderId = query.value?.farmWorkOrderId || detailData.value.orderId;
|
|
|
const { data } = await VE_API.z_farm_work_record_cost.listByOrderId({ farmWorkOrderId });
|
|
|
if (data && data.length > 0) {
|
|
|
const priceDataObj = data[0];
|
|
|
@@ -502,7 +503,6 @@ onMounted(async () => {
|
|
|
...priceDataObj,
|
|
|
agriculturalId: priceDataObj.agriculturalId,
|
|
|
};
|
|
|
- console.log("quotationData.value", quotationData.value);
|
|
|
|
|
|
// 根据 itemsList 的 pesticideFertilizerId 匹配并赋值品牌和价格
|
|
|
if (priceDataObj.itemsList && Array.isArray(priceDataObj.itemsList) && detailData.value.prescriptionList) {
|