|
@@ -136,12 +136,12 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
|
-import { ref, onMounted } from "vue";
|
|
|
|
|
|
|
+import { ref, onMounted, onActivated, onBeforeUnmount, onDeactivated } from "vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const executeDate = ref(null);
|
|
const executeDate = ref(null);
|
|
|
-const query = useRoute().query;
|
|
|
|
|
|
|
+let query = useRoute().query;
|
|
|
const detailData = ref(JSON.parse(query.data));
|
|
const detailData = ref(JSON.parse(query.data));
|
|
|
const priceData = ref({});
|
|
const priceData = ref({});
|
|
|
|
|
|
|
@@ -153,7 +153,9 @@ const modeList = ref([
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
// 初始化数据
|
|
// 初始化数据
|
|
|
-onMounted(() => {
|
|
|
|
|
|
|
+onActivated(() => {
|
|
|
|
|
+ query = useRoute().query;
|
|
|
|
|
+ detailData.value = JSON.parse(query.data);
|
|
|
executeDate.value = detailData.value.executeDate;
|
|
executeDate.value = detailData.value.executeDate;
|
|
|
priceData.value = JSON.parse(query?.priceData || '{}');
|
|
priceData.value = JSON.parse(query?.priceData || '{}');
|
|
|
|
|
|
|
@@ -184,6 +186,24 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 清空数据
|
|
|
|
|
+const clearData = () => {
|
|
|
|
|
+ executeDate.value = null;
|
|
|
|
|
+ detailData.value = {};
|
|
|
|
|
+ priceData.value = {};
|
|
|
|
|
+ servicePricePerMu.value = 0;
|
|
|
|
|
+ executionMethod.value = null;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 离开页面时清空数据
|
|
|
|
|
+onBeforeUnmount(() => {
|
|
|
|
|
+ clearData();
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+onDeactivated(() => {
|
|
|
|
|
+ clearData();
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
// 计算单个药肥的总计:单价 * 单亩用量 * 亩数
|
|
// 计算单个药肥的总计:单价 * 单亩用量 * 亩数
|
|
|
const getPesticideTotal = (pesticide) => {
|
|
const getPesticideTotal = (pesticide) => {
|
|
|
if (!pesticide.price || !pesticide.muUsage || !detailData.value.area) return '0.00';
|
|
if (!pesticide.price || !pesticide.muUsage || !detailData.value.area) return '0.00';
|
|
@@ -246,9 +266,10 @@ const confirmPrice = () => {
|
|
|
VE_API.z_farm_work_record.acceptFarmWorkRecord(payload).then(({ data, code, msg }) => {
|
|
VE_API.z_farm_work_record.acceptFarmWorkRecord(payload).then(({ data, code, msg }) => {
|
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
|
ElMessage.success("确认报价成功");
|
|
ElMessage.success("确认报价成功");
|
|
|
- router.push({
|
|
|
|
|
- path: "/task_condition",
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // router.push({
|
|
|
|
|
+ // path: "/task_condition",
|
|
|
|
|
+ // });
|
|
|
|
|
+ router.back();
|
|
|
} else {
|
|
} else {
|
|
|
ElMessage.error(msg);
|
|
ElMessage.error(msg);
|
|
|
}
|
|
}
|