소스 검색

feat: 重构编辑处方

lxf 10 시간 전
부모
커밋
428678d8ba
3개의 변경된 파일210개의 추가작업 그리고 293개의 파일을 삭제
  1. 9 0
      src/api/modules/farm.js
  2. 200 292
      src/views/old_mini/modify_work/modify.vue
  3. 1 1
      src/views/old_mini/monitor/subPages/plan.vue

+ 9 - 0
src/api/modules/farm.js

@@ -62,4 +62,13 @@ module.exports = {
         url: config.base_dev_url + "z_agricultural_store/page/{page}/{limit}",
         type: "get",
     },
+    // 报价
+    getPriceList: {
+        url: config.base_dev_url + "agricultural_store_pesticide_fertilizer/findBySchemeAndPesticides",
+        type: "post",
+    },
+    updateBatchByScheme: {
+        url: config.base_dev_url + "agricultural_store_pesticide_fertilizer/updateBatchByScheme",
+        type: "post",
+    },
 }

+ 200 - 292
src/views/old_mini/modify_work/modify.vue

@@ -50,12 +50,12 @@
                         </el-form-item>
                         <el-form-item label-width="70px" class="form-item text-item" label="服务亩数">
                             <div class="info-text">
-                                {{ detailData?.area ? formatArea(detailData?.area) + "亩" : "--" }}
+                                {{ detailData?.farm?.mianji ? formatArea(detailData?.farm?.mianji) + "亩" : "--" }}
                             </div>
                         </el-form-item>
                         <el-form-item label-width="70px" class="form-item text-item" label="服务区域">
                             <div class="info-text">
-                                {{ detailData?.serviceRegion || "--" }}
+                                {{ detailData?.farm?.address || "--" }}
                             </div>
                         </el-form-item>
                         <el-form-item
@@ -98,7 +98,12 @@
 
                 <template v-if="isEdit">
                     <div class="farm-card prescription-content common-inputs">
-                        <div class="card-title pb-12">药物处方</div>
+                        <div class="card-title pb-12 between">
+                            药物处方
+                            <div class="add-tag" @click="addDomain()">
+                                <el-icon color="#2199F8"><Plus /></el-icon>新增药物
+                            </div>
+                        </div>
                         <el-form-item label-width="82px" class="form-item" prop="usageMode" label="施用方式">
                             <el-select
                                 v-model="dynamicValidateForm.usageMode"
@@ -113,20 +118,35 @@
                                 />
                             </el-select>
                         </el-form-item>
+                        <el-form-item v-if="dynamicValidateForm.usageMode === '叶面施'" label-width="82px" class="form-item" prop="executeStyle" label="执行方式">
+                            
+                            <el-select
+                                    class="select-item"
+                                    v-model="dynamicValidateForm.executeStyle"
+                                    placeholder="执行方式"
+                                    @change="handleExecutionMethodChange"
+                                >
+                                    <el-option
+                                        v-for="(item, index) in modeList"
+                                        :key="index"
+                                        :label="item.name"
+                                        :value="item.value"
+                                    />
+                                </el-select>
+                        </el-form-item>
+
+                        <el-form-item v-if="dynamicValidateForm.usageMode === '根部施'" label-width="82px" class="form-item" prop="executeStyle" label="执行方式">
+                            <div class="info-text">人工</div>
+                        </el-form-item>
+                        
                         <div v-if="dynamicValidateForm.usageMode !== '人工农事'">
                             <el-form-item
-                                v-for="(domain, index) in dynamicValidateForm.prescriptionList"
+                                v-for="(domain, index) in dynamicValidateForm.prescription.pesticideFertilizerList"
                                 :key="index"
-                                :prop="'prescriptionList.' + index + '.value'"
+                                :prop="'prescription.pesticideFertilizerList.' + index + '.value'"
                                 class="prescription-item"
                             >
                                 <div class="recipe-item">
-                                    <div class="sub-title">
-                                        <div>{{ domain.name }}处方</div>
-                                        <div class="add-tag" @click="addDomain(index)">
-                                            <el-icon color="#2199F8"><Plus /></el-icon>新增药物
-                                        </div>
-                                    </div>
                                     <div class="recipe-form">
                                         <!-- <el-form-item
                                             v-for="(domain, index) in prescriptionItem.pesticideFertilizerList"
@@ -147,7 +167,7 @@
                                                         <el-select
                                                             filterable
                                                             @change="
-                                                                handlePesticideFertilizerChange(prescriptionI, index)
+                                                                handlePesticideFertilizerChange(index)
                                                             "
                                                             v-model="domain.code"
                                                             placeholder="请选择"
@@ -162,75 +182,8 @@
                                                         </el-select>
                                                     </div>
                                                 </div>
-                                                <div class="box-item">
-                                                    <div class="form-l">执行方式</div>
-                                                    <div
-                                                        class="form-r item-val"
-                                                        v-if="dynamicValidateForm.usageMode === '叶面施'"
-                                                    >
-                                                        <el-select
-                                                            class="select-item"
-                                                            v-model="domain.executionMethod"
-                                                            placeholder="执行方式"
-                                                            style="width: 150px"
-                                                            @change="
-                                                                (val) =>
-                                                                    handleExecutionMethodChange(
-                                                                        prescriptionI,
-                                                                        index,
-                                                                        val
-                                                                    )
-                                                            "
-                                                        >
-                                                            <el-option
-                                                                v-for="(item, index) in modeList"
-                                                                :key="index"
-                                                                :label="item.name"
-                                                                :value="item.value"
-                                                            />
-                                                        </el-select>
-                                                    </div>
-                                                    <div class="form-r r-text" v-else>人工</div>
-                                                </div>
 
-                                                <div class="mt-8" v-if="domain.executionMethod === 1">
-                                                    <div class="box-item sub-item">
-                                                        <div class="form-l has-sub">
-                                                            <div class="main-name">亩兑水量</div>
-                                                            <div class="sub-name">(药剂:兑水量)</div>
-                                                        </div>
-                                                        <div class="form-r input-box text-center">
-                                                            <el-input
-                                                                v-model="domain.ratio2"
-                                                                type="number"
-                                                                step="0.01"
-                                                                style="width: 150px"
-                                                                placeholder="请输入"
-                                                            >
-                                                                <template #append>{{ domain.unit }}</template>
-                                                            </el-input>
-                                                        </div>
-                                                    </div>
-                                                    <div class="box-item sub-item">
-                                                        <div class="form-l has-sub">
-                                                            <div class="main-name">单亩用量</div>
-                                                            <div class="sub-name">(亩数:药剂)</div>
-                                                        </div>
-                                                        <div class="form-r input-box text-center">
-                                                            <el-input
-                                                                v-model="domain.muUsage2"
-                                                                type="number"
-                                                                step="0.01"
-                                                                style="width: 150px"
-                                                                placeholder="请输入"
-                                                            >
-                                                                <template #append>{{ domain.unit }}</template>
-                                                            </el-input>
-                                                        </div>
-                                                    </div>
-                                                </div>
-
-                                                <div class="mt-8" v-else>
+                                                <div class="mt-8">
                                                     <div class="box-item sub-item">
                                                         <div class="form-l has-sub">
                                                             <div class="main-name">亩兑水量</div>
@@ -308,19 +261,17 @@
                         <div class="card-title">处方报价</div>
                         <div class="medicine-wrap">
                             <template
-                                v-for="(prescription, pIndex) in dynamicValidateForm.prescriptionList"
-                                :key="pIndex"
+                                v-for="(pesticide, mIndex) in dynamicValidateForm.prescription.pesticideFertilizerList"
+                                :key="mIndex"
                             >
                                 <div
                                     class="medicine-box"
-                                    v-for="(pesticide, mIndex) in prescription.pesticideFertilizerList"
-                                    :key="mIndex"
                                 >
                                     <div class="form-index">药肥{{ mIndex + 1 }}</div>
                                     <div class="box-wrap">
                                         <div class="medicine-item">
                                             <div class="item-name">药肥名称</div>
-                                            <div class="item-val">{{ pesticide.pesticideFertilizerName }}</div>
+                                            <div class="item-val">{{ pesticide.name }}</div>
                                         </div>
                                         <div class="medicine-item">
                                             <div class="item-name">药肥品牌</div>
@@ -348,11 +299,11 @@
                                         </div>
                                         <div class="medicine-item">
                                             <div class="item-name">单亩用量</div>
-                                            <div class="item-val">{{ getMuUsage(pesticide) }}{{ pesticide.unit }}</div>
+                                            <div class="item-val">{{ pesticide.dosage }}{{ pesticide.unit }}</div>
                                         </div>
                                         <div class="medicine-item">
                                             <div class="item-name">服务亩数</div>
-                                            <div class="item-val">{{ formatArea(detailData?.area) }}亩</div>
+                                            <div class="item-val">{{ detailData?.farm?.mianji ? formatArea(detailData?.farm?.mianji) + "亩": "" }}</div>
                                         </div>
                                         <div class="medicine-item">
                                             <div class="item-total">总计:</div>
@@ -382,7 +333,7 @@
                                     </div>
                                     <div class="medicine-item">
                                         <div class="item-name">服务亩数</div>
-                                        <div class="item-val">{{ formatArea(detailData?.area) }}亩</div>
+                                        <div class="item-val">{{ detailData?.farm?.mianji ? formatArea(detailData?.farm?.mianji) + "亩" : "" }}</div>
                                     </div>
                                     <div class="medicine-item">
                                         <div class="item-total">总计:</div>
@@ -420,7 +371,7 @@
                             </div>
                             <div
                                 class="new-table-wrap"
-                                v-for="(subP, prescriptionI) in detailData?.prescriptionList"
+                                v-for="(subP, prescriptionI) in detailData?.prescription?.pesticideFertilizerList || []"
                                 :key="prescriptionI"
                             >
                                 <!-- <div
@@ -461,7 +412,7 @@
                             </div>
                         </div>
                         <div class="info-content-wrap">
-                            <price-table :prescriptionData="quotationData.prescriptionList">
+                            <price-table :prescriptionData="dynamicValidateForm.prescription.prescriptionList">
                                 <template #bottomContent>
                                     <div class="price-bottom">
                                         <div class="info-title-wrap">
@@ -471,7 +422,7 @@
                                                     quotationData?.farmWorkServiceCost
                                                         ? getServiceCost(
                                                               quotationData.farmWorkServiceCost,
-                                                              quotationData.area
+                                                              quotationData.farm?.mianji
                                                           )
                                                         : "--"
                                                 }}<span class="unit-text">元</span>
@@ -480,7 +431,7 @@
                                         <div class="price-info">
                                             <div class="info-l">
                                                 执行方式<span class="main-text">{{
-                                                    quotationData.executionMethodName || "人工"
+                                                    dynamicValidateForm.executionMethodName || "人工"
                                                 }}</span>
                                             </div>
                                             <div class="info-c">
@@ -494,7 +445,7 @@
                                             </div>
                                             <div class="info-r">
                                                 亩数<span class="main-text">{{
-                                                    quotationData.area ? formatArea(quotationData.area) + "亩" : "--"
+                                                    quotationData.farm?.mianji ? formatArea(quotationData.farm?.mianji) + "亩" : "--"
                                                 }}</span>
                                             </div>
                                         </div>
@@ -545,35 +496,33 @@ const store = useStore();
 const router = useRouter();
 const route = useRoute();
 
-const actionType = ref([]);
 
-const isEdit = ref(false);
+const isEdit = ref(true);
 
 onActivated(() => {
-    isEdit.value = route.query.isEdit ? true : false;
+    // isEdit.value = route.query.isEdit ? true : false;
     if (route.query.farmWorkId) {
         getDetail();
     }
     window.scrollTo(0, 0);
-    if (route.query.data) {
-        actionType.value = JSON.parse(route.query.data);
-    } else {
-        actionType.value = ["生长异常"];
+    // 初始化 prescription 对象
+    if (!route.query.farmWorkId) {
+        dynamicValidateForm.prescription = {
+            usageMode: "",
+            pesticideFertilizerList: [
+                {
+                    code: "",
+                    name: "",
+                    dosage: "",
+                    ratio: "",
+                    typeName: "",
+                    muPrice: 0,
+                    executeStyle: 1,
+                    unit: "",
+                },
+            ],
+        };
     }
-    dynamicValidateForm.prescriptionList = actionType.value.map((name) => ({
-        name,
-        pesticideFertilizerList: [
-            {
-                key: 1,
-                typeName: "",
-                muUsage: "",
-                muUsage2: "",
-                ratio: "",
-                ratio2: "",
-                remark: "",
-            },
-        ],
-    }));
 });
 
 const priceSheetPopupRef = ref(null);
@@ -583,112 +532,48 @@ const showPriceSheetPopup = () => {
 
 const detailData = ref({});
 const getDetail = async () => {
-    const { data, code } = await VE_API.farm.getFarmWorkLib({ id: route.query.farmWorkId });
+    const { data, code } = await VE_API.farm.getFarmWorkLib({ id: route.query.farmWorkId, farmId: route.query.farmId });
     if(code === 0) {
         detailData.value = data;
         dynamicValidateForm.executeDate = data.executeDate;
-        dynamicValidateForm.usageMode = data.usageMode;
-        data.prescriptionList = data.prescription?.pesticideFertilizerList || [];
-    
-        dynamicValidateForm.prescriptionList = data.prescriptionList;
+        dynamicValidateForm.usageMode = data.prescription.usageMode;
+        // 从 prescription 获取数据
+        dynamicValidateForm.prescription = data.prescription || {
+            usageMode: "",
+            pesticideFertilizerList: [],
+        };
         servicePricePerMu.value = detailData.value.farmWorkServiceCost || null;
-    
-        // getQuotationData();
+        const pesticideFertilizerCodes = data.prescription.pesticideFertilizerList.map(item => item.code);
+        getPriceList(data.schemeId, pesticideFertilizerCodes);
     }
 };
 
+const getPriceList = async (schemeId, pesticideFertilizerCodes) => {
+    const { data } = await VE_API.farm.getPriceList({ schemeId, pesticideFertilizerCodes });
+    if (!data || !Array.isArray(data)) return;
+
+    dynamicValidateForm.prescription.pesticideFertilizerList.forEach((item) => {
+        const priceInfo = data.find((p) => p.pesticideFertilizerCode === item.code);
+        if (!priceInfo) return;
+        item.price = priceInfo.price ?? item.price;
+        item.brand = priceInfo.brand ?? item.brand;
+    });
+};
+
 const toEditPrescription = () => {
     isEdit.value = true;
 };
 
 const quotationData = ref({});
 
-const getQuotationData = async () => {
-    let priceDataObj = {};
-    const { data } = await VE_API.z_farm_work_record_cost.getByRecordId({ farmWorkRecordId: detailData.value.id });
-    priceDataObj = data;
-    if (priceDataObj && Object.keys(priceDataObj).length > 0) {
-        // 合并外层字段
-        quotationData.value = {
-            ...detailData.value,
-            ...priceDataObj,
-            agriculturalId: priceDataObj.agriculturalId,
-        };
-
-        // 根据 itemsList 的 pesticideFertilizerId 匹配并赋值品牌和价格
-        if (priceDataObj.itemsList && Array.isArray(priceDataObj.itemsList) && detailData.value.prescriptionList) {
-            // 创建价格映射表
-            const priceMap = new Map();
-            priceDataObj.itemsList.forEach((item) => {
-                priceMap.set(String(item.pesticideFertilizerId), {
-                    brand: item.brand || "",
-                    price: item.price || 0,
-                    totalPrice: item.totalPrice || null,
-                });
-            });
-
-            // 遍历处方列表,赋值品牌和价格,并计算格式化字段供 price-table 使用
-            quotationData.value.prescriptionList = detailData.value.prescriptionList.map((prescription) => {
-                return {
-                    ...prescription,
-                    pesticideFertilizerList: prescription.pesticideFertilizerList.map((pesticide) => {
-                        const pesticideId = String(pesticide.pesticideFertilizerId || "");
-                        const priceInfo = priceMap.get(pesticideId);
-
-                        if (priceInfo) {
-                            const price = priceInfo.price || 0;
-                            const muUsage = pesticide.muUsage || 0;
-                            const unit = pesticide.unit || "";
-                            const area = detailData.value.area || 0;
-
-                            // 计算总价:优先使用 totalPrice,否则计算 price * muUsage * area
-                            const total = priceInfo.totalPrice ? priceInfo.totalPrice : price * muUsage * area;
-
-                            return {
-                                ...pesticide,
-                                brand: priceInfo.brand || "--",
-                                totalPrice: priceInfo.totalPrice,
-                                // 格式化字段供 price-table 组件使用
-                                price: price > 0 ? `${price}元/${unit}` : "--", // 格式化单价显示
-                                dosage: muUsage > 0 ? `${muUsage}${unit}` : "--", // 格式化用量显示
-                                total: total > 0 ? total.toFixed(2) : "--", // 格式化总价显示
-                            };
-                        }
-                        return pesticide;
-                    }),
-                };
-            });
-        }
-    }
-};
-
-// 根据执行方式获取单亩用量:1=无人机用muUsage2,2=人工用muUsage
-const getMuUsage = (pesticide) => {
-    if (!pesticide) return 0;
-    // 如果是叶面施且有执行方式选择,根据执行方式判断
-    if (
-        detailData.value?.usageMode === "叶面施" &&
-        dynamicValidateForm.executionMethod !== null &&
-        dynamicValidateForm.executionMethod !== undefined
-    ) {
-        // 1 = 无人机,使用 muUsage2
-        if (dynamicValidateForm.executionMethod == 1) {
-            return pesticide.muUsage2 || pesticide.muUsage || 0;
-        }
-        // 2 = 人工,使用 muUsage
-        if (dynamicValidateForm.executionMethod == 2) {
-            return pesticide.muUsage || 0;
-        }
-    }
-    // 默认使用 muUsage(非叶面施的情况)
-    return pesticide.muUsage || 0;
-};
 
 // 计算单个药肥的总计:单价 * 单亩用量 * 亩数
 const getPesticideTotal = (pesticide) => {
-    const muUsage = getMuUsage(pesticide);
-    if (!pesticide.price || !muUsage || !detailData.value.area) return "--";
-    const total = (pesticide.price * muUsage * detailData.value.area).toFixed(2);
+    const price = Number(pesticide.price || 0);
+    const dosage = Number(pesticide.dosage || 0); // 单亩用量
+    const area = Number(detailData.value.farm?.mianji || 0); // 农场面积
+    if (!price || !dosage || !area) return "--";
+    const total = (price * dosage * area).toFixed(2);
     return total;
 };
 
@@ -717,25 +602,27 @@ const clearData = () => {
     dynamicValidateForm.executeDate = dayjs().format("YYYY-MM-DD");
     dynamicValidateForm.checkDay = "";
     dynamicValidateForm.usageMode = "";
-    dynamicValidateForm.prescriptionList = [
-        {
-            name: "",
-            pesticideFertilizerList: [
-                {
-                    key: 1,
-                    typeName: "",
-                    muUsage: "",
-                    muUsage2: "",
-                    ratio: "",
-                    ratio2: "",
-                    remark: "",
-                },
-            ],
-        },
-    ];
-
-    // 清空其他数据
-    actionType.value = [];
+    dynamicValidateForm.prescription = {
+        id: "",
+        usageMode: "",
+        farmWorkLibCode: "",
+        expertId: "",
+        phenology: "",
+        soil: "",
+        speed: null,
+        pesticideFertilizerList: [
+            {
+                code: "",
+                name: "",
+                dosage: "",
+                ratio: "",
+                typeName: "",
+                muPrice: 0,
+                executeStyle: 1,
+                unit: "",
+            },
+        ],
+    };
 };
 
 onDeactivated(() => {
@@ -765,11 +652,8 @@ const modeList = ref([
     { name: "人工", value: 2 },
 ]);
 
-const handleExecutionMethodChange = (parentIndex, index, val) => {
-    const domain = dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index];
+const handleExecutionMethodChange = (index, val) => {
     if (val == 1) {
-        domain.muUsage = domain.muUsage2;
-        domain.ratio = domain.ratio2;
         servicePricePerMu.value = detailData.value.uavServicePrice;
     } else {
         servicePricePerMu.value = detailData.value.manualServicePrice;
@@ -785,23 +669,30 @@ const dynamicValidateForm = reactive({
     executeDate: dayjs().format("YYYY-MM-DD"),
     checkDay: "",
     usageMode: "",
+    executeStyle: 2,
     executionMethod: 2,
-    prescriptionList: [
-        {
-            name: "",
-            pesticideFertilizerList: [
-                {
-                    key: 1,
-                    typeName: "",
-                    muUsage: "",
-                    muUsage2: "",
-                    ratio: "",
-                    ratio2: "",
-                    remark: "",
-                },
-            ],
-        },
-    ],
+    prescription: {
+        id: "",
+        usageMode: "",
+        farmWorkLibCode: "",
+        expertId: "",
+        phenology: "",
+        soil: "",
+        speed: null,
+        pesticideFertilizerList: [
+            {
+                code: "",
+                id: "",
+                name: "",
+                dosage: "",
+                ratio: "",
+                typeName: "",
+                muPrice: 0,
+                executeStyle: 1,
+                unit: "",
+            },
+        ],
+    },
 });
 
 const rules = {
@@ -835,15 +726,20 @@ const rules = {
     ],
 };
 
-const addDomain = (parentIndex) => {
-    dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.unshift({
-        key: Date.now(),
-        muUsage: "",
-        muUsage2: "",
+const addDomain = () => {
+    if (!dynamicValidateForm.prescription.pesticideFertilizerList) {
+        dynamicValidateForm.prescription.pesticideFertilizerList = [];
+    }
+    dynamicValidateForm.prescription.pesticideFertilizerList.unshift({
+        code: "",
+        name: "",
+        dosage: "",
         ratio: "",
-        ratio2: "",
-        remark: "",
-        executionMethod: 2, // 默认人工
+        typeName: "",
+        muPrice: 0,
+        id: "",
+        executeStyle: 1,
+        unit: "",
     });
 };
 
@@ -858,43 +754,45 @@ const allUsageModeList = ["叶面施", "根部施", "人工农事"];
  * 选择药肥的时候修改订单中药肥pesticideFertilizerId 以外其他数据
  * @param index
  */
-const handlePesticideFertilizerChange = (parentIndex, index) => {
+const handlePesticideFertilizerChange = (index) => {
+    const currentItem = dynamicValidateForm.prescription.pesticideFertilizerList[index];
     let obj = pesticideFertilizersOptions.value.filter(
-        (item) =>
-            dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index].pesticideFertilizerId ===
-            item.id
+        (item) => currentItem.code === item.pesticideFertilizerCode
     )[0];
-    dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index] = {
-        ...dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index],
-        typeName: obj.typeName,
-        unit: obj.unit,
-        defaultRatio: obj.defaultRatio,
-        usageModeList: obj.usageModeList,
-        executionMethod: obj.executionMethod || 2, // 默认人工
-        ratio: obj.defaultRatio,
-        defaultName: obj.defaultName,
-        pesticideFertilizerName: obj.name,
-        pesticideFertilizerCode: obj.pesticideFertilizerCode,
-    };
+    if (obj) {
+        dynamicValidateForm.prescription.pesticideFertilizerList[index] = {
+            ...currentItem,
+            code: obj.pesticideFertilizerCode,
+            id: obj.id,
+            name: obj.name || obj.defaultName,
+            typeName: obj.typeName,
+            unit: obj.unit,
+            ratio: obj.defaultRatio || currentItem.ratio,
+            executeStyle: obj.executionMethod || 1,
+        };
+    }
 };
 
-const removeDomain = (parentIndex, item) => {
-    const index = dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.indexOf(item);
-    if (index !== -1) {
-        dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.splice(index, 1);
+const removeDomain = (index) => {
+    if (index !== -1 && dynamicValidateForm.prescription.pesticideFertilizerList) {
+        dynamicValidateForm.prescription.pesticideFertilizerList.splice(index, 1);
     }
 };
 
-const resetItemForm = (parentIndex, index) => {
-    dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index] = {
-        typeName: "",
-        muUsage: "",
-        muUsage2: "",
-        ratio: "",
-        ratio2: "",
-        remark: "",
-        executionMethod: 2, // 默认人工
-    };
+const resetItemForm = (index) => {
+    if (dynamicValidateForm.prescription.pesticideFertilizerList) {
+        dynamicValidateForm.prescription.pesticideFertilizerList[index] = {
+            code: "",
+            id: "",
+            name: "",
+            dosage: "",
+            ratio: "",
+            typeName: "",
+            muPrice: 0,
+            executeStyle: 1,
+            unit: "",
+        };
+    }
 };
 
 const servicePricePerMu = ref(null);
@@ -921,17 +819,26 @@ const submit = () => {
     const data = {
         id: route.query.farmWorkId,
         ...dynamicValidateForm,
-        prescription:{
-            ...detailData.value.prescription,
-            pesticideFertilizerList:dynamicValidateForm.prescriptionList
-        }
+        prescription: dynamicValidateForm.prescription
     };
-    VE_API.monitor.saveFarmWorkLib(data).then(async (res) => {
+    VE_API.monitor.saveFarmWorkLib(data);
+
+    // 保存报价信息
+    const priceList = {
+        schemeId: detailData.value.schemeId,
+        pesticideFertilizerInfos: dynamicValidateForm.prescription.pesticideFertilizerList.map(item => {
+            return {
+                pesticideFertilizerId: item.id,
+                price: item.price,
+                brand: item.brand,
+            }
+        }),
+    }
+    VE_API.farm.updateBatchByScheme(priceList).then(async (res) => {
         if (res.code === 0) {
             await getDetail();
             ElMessage.success("保存成功");
             isEdit.value = false;
-            // showPriceSheetPopup();
         }
     });
     // VE_API.z_farm_work_record.issueFarmWorkRecord(data).then(async (res) => {
@@ -1128,12 +1035,12 @@ const handleEditInteract = (item) => {
         .add-tag {
             font-size: 12px;
             color: #2199f8;
-            padding: 4px 8px;
-            background: rgba(33, 153, 248, 0.16);
-            border-radius: 20px;
+            padding: 0px 11px;
+            border: 1px solid #2199F8;
+            border-radius: 5px;
             font-weight: normal;
-            height: 25px;
-            line-height: 25px;
+            height: 28px;
+            line-height: 28px;
         }
         .type-tag {
             margin-left: 5px;
@@ -1640,6 +1547,7 @@ const handleEditInteract = (item) => {
             border-radius: 6px;
             padding: 20px 10px;
             width: 100%;
+            box-sizing: border-box;
             position: relative;
             // background: rgb(209, 235, 255, 0.3);
             // margin-bottom: 12px;

+ 1 - 1
src/views/old_mini/monitor/subPages/plan.vue

@@ -377,7 +377,7 @@ const handleRowClick = (item) => {
     curFarmObj.value = item;
     router.push({
         path: "/modify",
-        query: { id: item.id, farmWorkId: item.farmWorkId, containerSpaceTimeId: item.containerSpaceTimeId },
+        query: { id: item.id, farmId: route.query.farmId, farmWorkId: item.farmWorkId, containerSpaceTimeId: item.containerSpaceTimeId },
     });
 };