|
@@ -83,7 +83,7 @@
|
|
|
<!-- <span class="del-tag">删除互动</span> -->
|
|
<!-- <span class="del-tag">删除互动</span> -->
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="isEdit" class="interact-form">
|
|
<div v-if="isEdit" class="interact-form">
|
|
|
- <div class="interact-form-item">
|
|
|
|
|
|
|
+ <div class="interact-form-item" data-interact-field="phenologyId">
|
|
|
<div class="form-label">
|
|
<div class="form-label">
|
|
|
互动时间
|
|
互动时间
|
|
|
</div>
|
|
</div>
|
|
@@ -98,7 +98,7 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="interact-form-item">
|
|
|
|
|
|
|
+ <div class="interact-form-item" data-interact-field="interactionTime">
|
|
|
<div class="form-label">
|
|
<div class="form-label">
|
|
|
强制触发
|
|
强制触发
|
|
|
</div>
|
|
</div>
|
|
@@ -113,7 +113,7 @@
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="interact-form-item">
|
|
|
|
|
|
|
+ <div class="interact-form-item" data-interact-field="interactionQuestion">
|
|
|
<div class="form-label">
|
|
<div class="form-label">
|
|
|
互动问题
|
|
互动问题
|
|
|
</div>
|
|
</div>
|
|
@@ -220,7 +220,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mt-8">
|
|
<div class="mt-8">
|
|
|
- <div class="box-item sub-item">
|
|
|
|
|
|
|
+ <div class="box-item sub-item" :data-ratio-index="index">
|
|
|
<div class="form-l has-sub">
|
|
<div class="form-l has-sub">
|
|
|
<div class="main-name">亩兑水量</div>
|
|
<div class="main-name">亩兑水量</div>
|
|
|
<div class="sub-name">(药剂:兑水量)</div>
|
|
<div class="sub-name">(药剂:兑水量)</div>
|
|
@@ -237,17 +237,12 @@
|
|
|
</el-input>
|
|
</el-input>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="box-item sub-item">
|
|
|
|
|
|
|
+ <div class="box-item sub-item" :data-dosage-index="index">
|
|
|
<div class="form-l has-sub">
|
|
<div class="form-l has-sub">
|
|
|
<div class="main-name">单亩用量</div>
|
|
<div class="main-name">单亩用量</div>
|
|
|
<div class="sub-name">(亩数:药剂)</div>
|
|
<div class="sub-name">(亩数:药剂)</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="form-r input-box text-center">
|
|
<div class="form-r input-box text-center">
|
|
|
- <!-- <el-input
|
|
|
|
|
- v-model="domain.muUsage"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- /> -->
|
|
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="domain.dosage"
|
|
v-model="domain.dosage"
|
|
|
type="number"
|
|
type="number"
|
|
@@ -302,6 +297,7 @@
|
|
|
>
|
|
>
|
|
|
<div
|
|
<div
|
|
|
class="medicine-box"
|
|
class="medicine-box"
|
|
|
|
|
+ :data-price-index="mIndex"
|
|
|
>
|
|
>
|
|
|
<div class="form-index">药肥{{ mIndex + 1 }}</div>
|
|
<div class="form-index">药肥{{ mIndex + 1 }}</div>
|
|
|
<div class="box-wrap">
|
|
<div class="box-wrap">
|
|
@@ -448,7 +444,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="info-content-wrap">
|
|
<div class="info-content-wrap">
|
|
|
- <price-table :prescriptionData="dynamicValidateForm.prescription.prescriptionList">
|
|
|
|
|
|
|
+ <price-table :prescriptionData="dynamicValidateForm.prescription">
|
|
|
<template #bottomContent>
|
|
<template #bottomContent>
|
|
|
<div class="price-bottom">
|
|
<div class="price-bottom">
|
|
|
<div class="info-title-wrap">
|
|
<div class="info-title-wrap">
|
|
@@ -472,10 +468,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="info-c">
|
|
<div class="info-c">
|
|
|
亩单价<span class="main-text">{{
|
|
亩单价<span class="main-text">{{
|
|
|
- quotationData.farmWorkServiceCost ||
|
|
|
|
|
- quotationData.manualServicePrice
|
|
|
|
|
- ? (quotationData.farmWorkServiceCost ||
|
|
|
|
|
- quotationData.manualServicePrice) + "元/亩"
|
|
|
|
|
|
|
+ quotationData.serviceMuPrice
|
|
|
|
|
+ ? (quotationData.serviceMuPrice) + "元/亩"
|
|
|
: "--"
|
|
: "--"
|
|
|
}}</span>
|
|
}}</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -622,6 +616,9 @@ const getPriceList = async (schemeId, pesticideFertilizerCodes) => {
|
|
|
item.price = priceInfo.price ?? item.price;
|
|
item.price = priceInfo.price ?? item.price;
|
|
|
item.brand = priceInfo.brand ?? item.brand;
|
|
item.brand = priceInfo.brand ?? item.brand;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ quotationData.value = {...detailData.value, ...dynamicValidateForm};
|
|
|
|
|
+ console.log('quotationData.value', quotationData.value)
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const toEditPrescription = () => {
|
|
const toEditPrescription = () => {
|
|
@@ -864,8 +861,10 @@ const servicePricePerMu = ref(null);
|
|
|
|
|
|
|
|
// 计算服务费用总计:亩单价 * 亩数
|
|
// 计算服务费用总计:亩单价 * 亩数
|
|
|
const getServiceTotal = () => {
|
|
const getServiceTotal = () => {
|
|
|
- if (!servicePricePerMu.value || !detailData.value.area) return "--";
|
|
|
|
|
- const total = (servicePricePerMu.value * detailData.value.area).toFixed(2);
|
|
|
|
|
|
|
+ const price = Number(servicePricePerMu.value || 0);
|
|
|
|
|
+ const area = Number(detailData.value?.farm?.mianji || detailData.value?.area || 0);
|
|
|
|
|
+ if (!price || !area) return "--";
|
|
|
|
|
+ const total = (price * area).toFixed(2);
|
|
|
return total;
|
|
return total;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -876,8 +875,14 @@ const submitForm = (formEl) => {
|
|
|
// 校验农情互动,不通过,直接返回失败
|
|
// 校验农情互动,不通过,直接返回失败
|
|
|
if (!validateInteractForm()) return false;
|
|
if (!validateInteractForm()) return false;
|
|
|
|
|
|
|
|
|
|
+ // 校验药肥的亩兑水量和单亩用量是否填写
|
|
|
|
|
+ if (!validatePesticideDosage()) return;
|
|
|
|
|
+
|
|
|
// 保存报价信息前先校验是否填写完整
|
|
// 保存报价信息前先校验是否填写完整
|
|
|
if (!validatePriceInfos()) return;
|
|
if (!validatePriceInfos()) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 检验服务报价是否填写
|
|
|
|
|
+ if (!validateServicePrice()) return;
|
|
|
submit();
|
|
submit();
|
|
|
} else {
|
|
} else {
|
|
|
console.log("error submit!");
|
|
console.log("error submit!");
|
|
@@ -885,20 +890,52 @@ const submitForm = (formEl) => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 检验服务报价是否填写
|
|
|
|
|
+const validateServicePrice = () => {
|
|
|
|
|
+ if (!servicePricePerMu.value) {
|
|
|
|
|
+ ElMessage.warning("请完善服务报价信息");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 校验药肥的亩兑水量和单亩用量是否填写
|
|
|
|
|
+const validatePesticideDosage = () => {
|
|
|
|
|
+ const list = dynamicValidateForm.prescription?.pesticideFertilizerList || [];
|
|
|
|
|
+ if (!list.length) return true; // 没有药肥就不校验
|
|
|
|
|
+
|
|
|
|
|
+ // 找到第一个未填写完整的药肥
|
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
|
+ const item = list[i];
|
|
|
|
|
+ // 如果选择了药肥(有 code),就必须填写亩兑水量和单亩用量
|
|
|
|
|
+ if (item.code) {
|
|
|
|
|
+ const hasRatio = item.ratio !== undefined && item.ratio !== null && item.ratio !== "";
|
|
|
|
|
+ const hasDosage = item.dosage !== undefined && item.dosage !== null && item.dosage !== "";
|
|
|
|
|
+
|
|
|
|
|
+ if (!hasRatio || !hasDosage) {
|
|
|
|
|
+ ElMessage.warning("请完善药物处方信息");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 校验报价信息是否填写完整
|
|
// 校验报价信息是否填写完整
|
|
|
const validatePriceInfos = () => {
|
|
const validatePriceInfos = () => {
|
|
|
const list = dynamicValidateForm.prescription?.pesticideFertilizerList || [];
|
|
const list = dynamicValidateForm.prescription?.pesticideFertilizerList || [];
|
|
|
if (!list.length) return true; // 没有药肥就不校验
|
|
if (!list.length) return true; // 没有药肥就不校验
|
|
|
|
|
|
|
|
- const invalid = list.some((item) => {
|
|
|
|
|
|
|
+ // 找到第一个未填写完整的药肥
|
|
|
|
|
+ const invalidIndex = list.findIndex((item) => {
|
|
|
// 只要选择了药肥(有 id),就必须填写单价和品牌
|
|
// 只要选择了药肥(有 id),就必须填写单价和品牌
|
|
|
- if (!item.id) return true;
|
|
|
|
|
|
|
+ if (!item.id) return false; // 没选择药肥不校验
|
|
|
const hasPrice = item.price !== undefined && item.price !== null && item.price !== "";
|
|
const hasPrice = item.price !== undefined && item.price !== null && item.price !== "";
|
|
|
const hasBrand = !!item.brand;
|
|
const hasBrand = !!item.brand;
|
|
|
return !hasPrice || !hasBrand;
|
|
return !hasPrice || !hasBrand;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- if (invalid) {
|
|
|
|
|
|
|
+ if (invalidIndex !== -1) {
|
|
|
ElMessage.warning("请先完善报价信息");
|
|
ElMessage.warning("请先完善报价信息");
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -909,6 +946,7 @@ const submit = () => {
|
|
|
const data = {
|
|
const data = {
|
|
|
id: route.query.farmWorkId,
|
|
id: route.query.farmWorkId,
|
|
|
...dynamicValidateForm,
|
|
...dynamicValidateForm,
|
|
|
|
|
+ serviceMuPrice: servicePricePerMu.value,
|
|
|
prescription: dynamicValidateForm.prescription
|
|
prescription: dynamicValidateForm.prescription
|
|
|
};
|
|
};
|
|
|
VE_API.monitor.saveFarmWorkLib(data);
|
|
VE_API.monitor.saveFarmWorkLib(data);
|
|
@@ -933,12 +971,9 @@ const submit = () => {
|
|
|
isEdit.value = false;
|
|
isEdit.value = false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- // VE_API.z_farm_work_record.issueFarmWorkRecord(data).then(async (res) => {
|
|
|
|
|
- // if (res.code === 0) {
|
|
|
|
|
- // await getDetail();
|
|
|
|
|
- // showPriceSheetPopup();
|
|
|
|
|
- // }
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 切换标记
|
|
|
|
|
+ VE_API.container_farm_work_arrange.toggleFollow({ id: route.query.farmWorkId, isFollow: tagName.value });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleSaveInteractSuccess = () => {
|
|
const handleSaveInteractSuccess = () => {
|
|
@@ -969,6 +1004,7 @@ const getFarmWorkArrangeDetail = async (id) => {
|
|
|
if (!id) return;
|
|
if (!id) return;
|
|
|
const { data, code } = await VE_API.farm.getFarmWorkArrangeDetail({ id });
|
|
const { data, code } = await VE_API.farm.getFarmWorkArrangeDetail({ id });
|
|
|
if(code === 0) {
|
|
if(code === 0) {
|
|
|
|
|
+ tagName.value = data.isFollow;
|
|
|
interactFormData.value = {
|
|
interactFormData.value = {
|
|
|
phenologyId: data.phenologyId || "",
|
|
phenologyId: data.phenologyId || "",
|
|
|
interactionTime: data.interactionTime || "",
|
|
interactionTime: data.interactionTime || "",
|