Explorar o código

fix: 农资编辑

刘秀芳 hai 1 mes
pai
achega
5984ea2e95

BIN=BIN
src/assets/img/gallery/step-0.png


BIN=BIN
src/assets/img/gallery/step-1.png


BIN=BIN
src/assets/img/gallery/step-2.png


BIN=BIN
src/assets/img/gallery/step-3.png


+ 10 - 10
src/components/common/stepBox.vue

@@ -37,40 +37,40 @@ const formatDate = (dateStr) => {
     justify-content: center;
     &.step-0 {
         .t-r {
-            color: #FFD489;
+            color: #2199f8;
         }
     }
     &.step-1 {
         .t-r {
-            color: #FFD489;
+            color: #2199f8;
         }
         .b-r {
-            color: #FFD489;
+            color: #2199f8;
         }
     }
     &.step-2 {
         .t-r {
-            color: #FFD489;
+            color: #2199f8;
         }
         .b-r {
-            color: #FFD489;
+            color: #2199f8;
         }
         .b-l {
-            color: #FFD489;
+            color: #2199f8;
         }
     }
     &.step-3 {
         .t-r {
-            color: #FFD489;
+            color: #2199f8;
         }
         .b-r {
-            color: #FFD489;
+            color: #2199f8;
         }
         .b-l {
-            color: #FFD489;
+            color: #2199f8;
         }
         .t-l {
-            color: #FFD489;
+            color: #2199f8;
         }
     }
     &.step-4 {

+ 4 - 3
src/views/addFarm/index.vue

@@ -150,6 +150,7 @@
                         </template>
                     </div>
                     <div class="footer">
+                        <!-- <el-button class="btn" type="danger" plain @click="remove()">删除</el-button> -->
                         <div class="button" @click="handleOk">{{ active === 0 ? "确定" : (isAdd ? "新增农事" : "下发农事") }}</div>
                     </div>
                 </chart-box>
@@ -281,9 +282,9 @@ function getList() {
 
         farmMap.initData(workItemData.value.farmId, workItemData.value.regionId)
         farmMap.getBlueRegion({gardenId:  workItemData.value.farmId, regionId: workItemData.value.regionId}, (e) => {
-                checkedArea.value = workItemData.value.executeBlueZones.length === e
-                farmMap.setBlueRegion(workItemData.value.executeBlueZones)
-            });
+            checkedArea.value = workItemData.value.executeBlueZones.length === e
+            farmMap.setBlueRegion(workItemData.value.executeBlueZones)
+        });
     })
 }
 

+ 1 - 0
src/views/home/album/index.vue

@@ -797,6 +797,7 @@ function addNsRecord(){
                     background: #232323;
                     height: 100%;
                     overflow: auto;
+                    box-sizing: border-box;
                     .common-btn {
                         background: #F0AC37;
                         border-radius: 4px;

+ 37 - 17
src/views/workDetail/components/boxClass.scss

@@ -197,13 +197,13 @@
                     .date-info {
                         height: 24px;
                         .el-input__wrapper {
-                            box-shadow: 0 0 0 1px #2199F8 inset;
+                            box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
                             background: none;
                             .el-input__prefix {
-                                color: #2199F8;
+                                color: #fff;
                             }
                             .el-input__inner {
-                                color: #2199F8;
+                                color: #fff;
                             }
                         }
                     }
@@ -219,6 +219,7 @@
         .prescription-box {
             position: relative;
             padding-right: 10px;
+            font-size: 16px;
             .desc {
                 margin-top: 12px;
                 border-radius: 4px;
@@ -235,10 +236,10 @@
                     margin-top: 8px;
                     display: flex;
                     align-items: center;
-                    border: 1px solid #DDDDDD;
+                    border: 1px solid #474747;
                     padding: 0 12px;
                     height: 48px;
-                    color: #000000;
+                    color: #fff;
                     font-size: 14px;
                     border-radius: 8px;
                     .service-img {
@@ -249,7 +250,7 @@
                     .service-c {
                         flex: 1;
                         text-align: center;
-                        color: #666666;
+                        color: rgba(255, 255, 255, 0.6);
                     }
                 }
                 .service-bottom {
@@ -258,7 +259,11 @@
                         padding-top: 12px;
                         width: 100%;
                         .btn {
+                            background: #FFD489;
+                            color: #050505;
                             width: 100%;
+                            height: 44px;
+                            font-size: 16px;
                         }
                     }
                 }
@@ -304,7 +309,7 @@
                         padding-top: 8px;
                     }
                     .form-box {
-                        border: 1px solid #2199F8;
+                        border: 1px solid #444444;
                         border-radius: 4px;
                         padding: 20px 10px;
                         width: 100%;
@@ -314,19 +319,20 @@
                             left: 0;
                             top: 0;
                             padding: 0 6px;
-                            background: #2199F8;
+                            background: #FFD489;
                             border-radius: 4px 0 4px 0;
                             height: 18px;
                             line-height: 18px;
                             font-size: 12px;
-                            color: #fff;
+                            color: #000;
                         }
                         .box-item {
                             display: flex;
                             align-items: center;
                             justify-content: space-between;
-                            color: rgba(0, 0, 0, 0.4);
+                            color: #727272;
                             .r-text {
+                                color: #fff;
                                 width: 140px;
                                 text-align: center;
                             }
@@ -336,10 +342,11 @@
 
                             ::v-deep {
                                 .el-input__wrapper {
-                                    box-shadow: 0 0 0 1px #2199F8 inset;
+                                    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
+                                    background: none;
                                 }
                                 .el-input__inner {
-                                    color: #2199F8;
+                                    color: #fff;
                                 }
                             }
                         }
@@ -363,6 +370,13 @@
                         }
                         .btn-group {
                             padding-top: 12px;
+                            ::v-deep {
+                                .el-button--primary {
+                                    color: #FFD489;
+                                    background: rgba(255, 212, 137, 0.05);
+                                    border: 1px solid #FFD489;
+                                }
+                            }
                         }
                         .sub-item {
                             padding-left: 10px;
@@ -391,15 +405,20 @@
                                 width: 132px;
                                 text-align: center;
                                 font-size: 14px;
-                                color: #474747;
+                                color: #fff;
                             }
                             .price {
                                 ::v-deep {
                                     .el-input__wrapper {
-                                        box-shadow: 0 0 0 1px #2199F8 inset;
+                                        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
+                                        background: none;
                                     }
                                     .el-input__inner {
-                                        color: #2199F8;
+                                        color: #fff;
+                                    }
+                                    .el-input-group__append {
+                                        background: none;
+                                        color: rgba(255, 255, 255, 0.6);
                                     }
                                 }
                             }
@@ -414,9 +433,10 @@
                         }
                         ::v-deep {
                             .el-select__wrapper {
-                                box-shadow: 0 0 0 1px #2199F8 inset;
+                                box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
+                                background: none;
                                 .el-select__placeholder {
-                                    color: #2199F8;
+                                    color: #fff;
                                     text-align: center;
                                 }
                             }

+ 4 - 11
src/views/workDetail/components/prescriptionBox.vue

@@ -68,11 +68,12 @@
                         </div>
                     </div>
                 </div>
-                <div class="desc">
+                <!-- <div class="desc">
                     {{ prescriptioData.expertPrescription || prescriptioData.weatherWarningMsg }}
-                </div>
+                </div> -->
+                <!-- 显示简略信息 -->
                 <!-- v-if="prescriptioData?.orderStatus === 0 && ROLETYPE == '3'" -->
-                <div class="prescription-item">
+                <!-- <div class="prescription-item">
                     <div class="recipe-box">
                         <div class="recipe-title">
                             <div class="recipe-name">药物处方</div>
@@ -80,7 +81,6 @@
                         <div class="usage-mode">
                             施用方式:<span>{{ prescriptioData.usageMode }}</span>
                         </div>
-                        <!-- <custom-table type="0" @handleDelete="removeDomain" :tableHeader="tableHeader" :tableData="dynamicValidateForm.domains"></custom-table> -->
                         <div class="new-wrap">
                             <div class="new-title">
                                 <div class="title-1"><div class="table-name">使用功效</div></div>
@@ -122,13 +122,6 @@
                             </div>
                         </div>
                     </div>
-                </div>
-                <!-- <div class="prescription-item" v-else>
-                    <div class="sub-title">
-                        <div class="sub-name">药物处方</div>
-                        <div class="sub-name"><span>施用方式:</span>根部施</div>
-                    </div>
-                    <custom-table type="0" :tableHeader="tableHeader" :tableData="tableData"></custom-table>
                 </div> -->
                 <div class="prescription-item" v-if="prescriptioData?.orderStatus === 0">
                     <div class="sub-title">

+ 60 - 96
src/views/workDetail/components/serviceBox.vue

@@ -27,18 +27,18 @@
                             />
                         </div>
                     </div>
-                    <div class="sub-title">
-                        报价处方
-                    </div>
+                    <div class="usage-mode">
+                            施用方式:<span>{{ serviceData.usageMode }}</span>
+                        </div>
                     <div class="recipe-item">
                         <div class="recipe-form">
                             <el-form ref="formRef" style="max-width: 600px" class="demo-dynamic">
                                 <el-form-item
-                                    v-for="(domain, index) in dynamicValidateForm"
-                                    :key="domain.id"
+                                    v-for="(prescriptionItem, index) in prescriptionList"
+                                    :key="index"
                                     :prop="'domains.' + index + '.value'"
                                 >
-                                    <div class="form-box">
+                                    <div class="form-box" v-for="(domain, index) in prescriptionItem.pesticideFertilizerList" :key="'sub' + index">
                                         <div class="form-index">{{ formatIndex(index) }}</div>
                                         <div class="box-item">
                                             <div class="form-l">肥药名称</div>
@@ -57,7 +57,7 @@
                                                     style="width: 140px"
                                                 >
                                                     <el-option label="人工" :value="1" />
-                                                    <el-option label="无人机" :value="2" />
+                                                    <el-option v-if="serviceData.usageMode === '叶面施'" label="无人机" :value="2" />
                                                 </el-select>
                                             </div>
                                         </div>
@@ -95,14 +95,14 @@
                                                 </el-input>
                                             </div>
                                         </div>
-                                        <div class="action-btn btn-group">
+                                        <!-- <div class="action-btn btn-group">
                                             <el-button class="btn delete-btn" @click.prevent="removeDomain(domain)">
                                                 删除
                                             </el-button>
                                             <el-button type="primary" class="btn" @click.prevent="resetItemForm(index)">
                                                 重置
                                             </el-button>
-                                        </div>
+                                        </div> -->
                                     </div>
                                 </el-form-item>
                             </el-form>
@@ -113,7 +113,7 @@
                         <div class="sub-title">
                             <div class="sub-name">选择农户</div>
                         </div>
-                        <div class="bottom-map" ref="areaRef" :id="'areaMap' + boxId"></div>
+                        <!-- <div class="bottom-map" ref="areaRef" :id="'areaMap' + boxId"></div> -->
                         <template v-for="(item, index) in displayedItems" :key="index">
                             <div class="service-item">
                                 <div class="service-l">
@@ -180,7 +180,7 @@
                       </div>
                     <div class="item-table">
                         <el-table
-                            :data="pesticideFertilizers"
+                            :data="tableData"
                             style="width: 100%"
                             :header-cell-style="{ background: '#F5F5F5' }"
                         >
@@ -252,6 +252,10 @@ const props = defineProps({
         type: Number,
         required: false,
     },
+    prescriptionList: {
+        type: Array,
+        required: true,
+    },
     pesticideFertilizers: {
         type: Array,
         required: true,
@@ -268,103 +272,48 @@ const props = defineProps({
         type: String,
         required: false,
     },
+    serviceData: {
+        type: Object,
+        required: false,
+    },
 });
-const removeDomain = (item) => {
-    const index = dynamicValidateForm.value.indexOf(item);
-    if (index !== -1) {
-        dynamicValidateForm.value.splice(index, 1);
-    }
-};
 
-const resetItemForm = (index) => {
-    dynamicValidateForm.value[index] = props.pesticideFertilizers[index];
-};
 
 let pickerTime = ref(props.executeDate);
 
-let pesticideFertilizersOptions = ref([
-    {
-        id: 'null',
-        name: "芸苔素内酯 15000倍",
-        typeName: "30",
-        defaultRatio: null,
-        unit: 0,
-        defaultName: "调节",
-    },
-]);
-// VE_API.order.pesticideFertilizers().then(({ data }) => {
-//     pesticideFertilizersOptions.value = data;
-// });
-
 // 表单
 const formRef = ref();
-const dataModel = () => {
-    return {
-        id: null,
-        orderId: null, //订单id
-        pesticideFertilizerId: null, //农药id
-        pesticideFertilizerName: null, //农药名称
-        typeName: null, //功效类型名称
-        brand: null, //品牌
-        price: null, //单价
-        unit: null, //单位
-        executeStyle: null, //执行方式
-        muUsage: null, //亩用量
-        muPrice: null, //单亩价格
-        defaultRatio: null, //默认配比
-        ratio: null, //配比
-        defaultName: null, //默认名称
-    };
-};
+
 const dynamicValidateForm = ref([]);
 
 const formatIndex = (index) => {
     return String(index + 1).padStart(2, "0");
 };
-const settingData = () => {
-    for (let i = 0; i < props.pesticideFertilizers.length; i++) {
-        dynamicValidateForm.value.push(deepClone(props.pesticideFertilizers[i]));
-    }
-};
-
-/**
- * 选择药肥的时候修改订单中药肥pesticideFertilizerId 以外其他数据
- * @param index
- */
-const handlePesticideFertilizerChange = (index) => {
-    let obj = pesticideFertilizersOptions.value.filter(
-        (item) => dynamicValidateForm.value[index].pesticideFertilizerId === item.id
-    )[0];
-    dynamicValidateForm.value[index] = {
-        ...dynamicValidateForm.value[index],
-        typeName: obj.typeName,
-        unit: obj.unit,
-        defaultRatio: obj.defaultRatio,
-        ratio: obj.defaultRatio,
-        defaultName: obj.defaultName,
-        pesticideFertilizerName: obj.name,
-    };
-    console.log(dynamicValidateForm.value);
-};
-
 const handleUsersCheckChange = (index) => {
     console.log(props.users);
 };
 
+function flattenDomains(data) {
+  return data.reduce((acc, item) => {
+    return acc.concat(item.pesticideFertilizerList);
+  }, []);
+}
+
 const submit = () => {
     const data = {
         orderId: dynamicValidateForm.value[0].orderId,
         orderStatus: 2,
-        pesticideFertilizers: dynamicValidateForm.value,
+        prescriptionList: props.prescriptionList,
         users: props.users,
         executeDate: pickerTime.value,
     };
-    VE_API.order.confirm(data).then(({ code }) => {
-        if (code == 0) {
-            console.log('订单确认成功');
-            eventBus.emit('discover:submitForm')
-        }
-    });
+    console.log('data', data);
+    // VE_API.order.confirm(data).then(({ code }) => {
+    //     if (code == 0) {
+    //         console.log('订单确认成功');
+    //         eventBus.emit('discover:submitForm')
+    //     }
+    // });
 };
 
 const areaRef = ref();
@@ -372,16 +321,20 @@ let farmArr = ref([])
 let serviceArr = ref([])
 onMounted(() => {
     if (props.progress === 1 && ROLETYPE == '2') {
-        const dom = document.getElementById(`areaMap${props.boxId}`)
-        let areMap = new AreMap();
-        areMap.initMap("POINT(113.1093017627431 22.574540836684672)", dom);
-        areMap.setPoints(props.users.filter((item) => item.userType === 1).map((item) => item.point));
-        settingData();
+        // const dom = document.getElementById(`areaMap${props.boxId}`)
+        // let areMap = new AreMap();
+        // areMap.initMap("POINT(113.1093017627431 22.574540836684672)", dom);
+        // areMap.setPoints(props.users.filter((item) => item.userType === 1).map((item) => item.point));
+        // settingData();
     }
     farmArr.value = props.users.filter(item => item.userType === 1)
     serviceArr.value = props.users.filter(item => item.userType === 2)
-
+    if (ROLETYPE != '2') {
+        console.log('rrrr');
+        tableData.value = flattenDomains(props.prescriptionList)
+    }
 });
+const tableData = ref([])
 
 // 控制是否展开更多列表项的布尔值
 const isMoreVisible = ref(false);
@@ -422,23 +375,34 @@ const toggleMore2 = () => {
 .service-time {
     display: flex;
     align-items: center;
-    color: rgba(0, 0, 0, 0.2);
+    color: #727272;
     .time-picker {
         padding-left: 10px;
         ::v-deep {
             .el-input__wrapper {
-                background: #f0f8fd;
-                box-shadow: 0 0 0 1px #2199f8 inset;
+                background: none;
+                box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
                 .el-input__prefix {
-                    color: #2199f8;
+                    color: rgba(255, 255, 255, 0.6);
                 }
                 .el-input__inner {
-                    color: #2199f8;
+                    color: #fff;
                 }
             }
         }
     }
 }
+
+.usage-mode {
+    display: flex;
+    align-items: center;
+    font-size: 16px;
+    color: #727272;
+    padding: 12px 0 12px 0;
+    span {
+        color: #fff;
+    }
+}
 .service-name {
     padding-top: 12px;
     color: #2199F8;

+ 26 - 97
src/views/workDetail/index.vue

@@ -26,7 +26,7 @@
                             <service-box
                                 :boxId="workList[0].farmWorkLibId"
                                         :progress="workList[0].orderStatus"
-                                        :pesticideFertilizers="workList[0].pesticideFertilizers"
+                                        :prescriptionList="workList[0].prescriptionList"
                                         :users="workList[0].users"
                                         :serviceData="workList[0]"
                                         :executeDate="workList[0].executeDate">
@@ -41,29 +41,25 @@
                         <img src="@/assets/images/common/area-icon.png" alt="" />
                         执行农事区域
                     </div>
-                    <el-checkbox-group v-model="checkValue" @change="handleCheck">
-                        <el-checkbox
-                            v-for="item in checkList"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value"
-                        />
-                    </el-checkbox-group>
                 </div>
                 <div ref="mapRef" class="map">
-                    <div class="map-bg map-btn">查看巡园照片</div>
+                    <!-- <div class="map-bg map-btn">查看巡园照片</div> -->
                     <div class="map-bg map-legend">
                         <div class="item">
-                            <img src="@/assets/images/map/status/bhyc.png" alt="" />
-                            病害异
+                            <img src="@/assets/images/map/status/status-zc.png" alt="" />
+                            正常
                         </div>
                         <div class="item">
-                            <img src="@/assets/images/map/status/chyc.png" alt="" />
-                            虫害异常
+                            <img src="@/assets/images/map/status/status-szyc.png" alt="" />
+                            生长异常
                         </div>
                         <div class="item">
-                            <img src="@/assets/images/map/status/szyc.png" alt="" />
-                            生长异常
+                            <img src="@/assets/images/map/status/status-bh.png" alt="" />
+                            病害异常
+                        </div>
+                        <div class="item">
+                            <img src="@/assets/images/map/status/status-ch.png" alt="" />
+                            虫害异常
                         </div>
                     </div>
                 </div>
@@ -79,7 +75,7 @@ import fnHeader from "@/components/fnHeader.vue";
 import customTable from "./components/table.vue";
 import prescriptionBox from './components/prescriptionBox'
 import serviceBox from './components/serviceBox'
-import AreaMap from "./areaMap";
+import FarmMap from "@/views/addFarm/farmMap";
 import chartBox from "@/components/chartBox.vue";
 import { useRouter, useRoute } from "vue-router";
 import { useStore } from "vuex";
@@ -89,57 +85,8 @@ const components = {
 };
 const currentComponent = ref("prescriptionBox");
 
-const tableHeader = [
-    {
-        name:"功效",
-        props:"typeName"
-    },
-    {
-        name:"品牌",
-        props:"defaultName"
-    },
-    {
-        name:"执行方式",
-        props:"usageMode1"
-    },
-    {
-        name:"肥药配比(ml)",
-        props:"usageMode"
-    },
-    {
-        name:"单亩用量",
-        props:"muUsage"
-    },
-     {
-        name:"亩单价",
-        props:"muUsage"
-    }
-]
-
-const tableData = [
-    {
-        typeName:"营养",
-        defaultName:"国光",
-        usageMode1:"人工",
-        usageMode:"1:5000",
-        muUsage:"500元"
-    }
-]
-
 let store = useStore();
-let areaMap = new AreaMap();
-
-const active = ref(0);
-
-const checkList = ref([
-    { value: "0", label: "生长异常" },
-    { value: "1", label: "病害异常" },
-    { value: "2", label: "虫害异常" },
-]);
-const checkValue = ref(["0"]);
-const handleCheck = (e) => {
-    console.log("e", e);
-};
+let farmMap = new FarmMap();
 
 const router = useRouter();
 const route = useRoute();
@@ -150,42 +97,24 @@ const getList = () => {
     VE_API.farm.fetchFarmWorkList({ farmId, libId }).then(({data}) => {
     // data[0].orderStatus = data[0].orderStatus + 1
         workList.value = data
+
+        let itemData = data && data.length && data[0]
+        farmMap.initData(itemData.farmId, itemData.regionId)
+        farmMap.getBlueRegion({gardenId:  itemData.farmId, regionId: itemData.regionId}, (e) => {
+            farmMap.setBlueRegion(itemData.executeBlueZones)
+        });
     })
 }
 
-const getBlueList = () =>{
-    const executeBlueZones = [
-        {
-            id: "ws0y1mexxhxg",
-            level: null,
-        },
-        {
-            id: "ws0y1mey8wtx",
-            level: null,
-        },
-    ];
-    VE_API.farm.blueRegionList({ farmId }).then(({ data, code }) => {
-        for (let item of data) {
-            executeBlueZones.map((zone) => {
-                if (zone.id === item.blueZoneCode) {
-                    item.wkt = item.geom;
-                    item.id = item.blueZoneCode;
-                    areaMap.setData(item)
-                }
-            });
-        }
-        areaMap.fit()
-    });
-}
 
 let farmId = route.query.farmId
 let libId = route.query.libId
 onMounted(() => {
+    farmMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
     getList();
-    getBlueList()
-    areaMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
 });
 
+
 const goBack = () => {
     router.go(-1);
 };
@@ -326,17 +255,17 @@ const goBack = () => {
                 }
                 .map-legend {
                     bottom: 21px;
-                    display: flex;
-                    align-items: center;
                     .item {
                         display: flex;
                         align-items: center;
+                        font-size: 14px;
                         img {
-                            margin-right: 5px;
+                            width: 16px;
+                            margin-right: 6px;
                         }
                     }
                     .item + .item {
-                        margin-left: 20px;
+                        padding-top: 10px;
                     }
                 }
             }