| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423 |
- <template>
- <div class="new-farming-page">
- <custom-header :name="isAdd ? '新增农事' : '农事详情'"></custom-header>
- <div class="new-farming-content">
- <div v-if="!isAdd">
- <div class="step-wrap">
- <farm-steps :currentStep="0" />
- </div>
- <div class="box-wrap farm-info">
- <div class="info-title">
- <div class="card-title">农场现状</div>
- <div class="info-more">
- 点击查看更多
- <el-icon><ArrowRight /></el-icon>
- </div>
- </div>
- <div class="info-content">
- 当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标:当前农场指标
- </div>
- </div>
- <div class="box-wrap farm-photo">
- <div class="photo-list">
- <div class="img-item" v-for="(item, index) in 6" :key="index">
- <img class="photo-item" src="https://birdseye-img-ali-cdn.sysuimars.com/16926861-1e20-4cbd-8bf2-90208db5a2d0/806080da-1a30-4b5b-b64b-b22e722c6cb6/DJI_202509010800_001_806080da-1a30-4b5b-b64b-b22e722c6cb6/DJI_20250901080536_0045_V_code-ws0fsmge97gh.jpeg" alt="">
- </div>
- </div>
- <div class="list-text">点击查看更多</div>
- </div>
- </div>
- <el-form
- ref="formRef"
- style="max-width: 600px"
- label-position="left"
- :rules="rules"
- :model="dynamicValidateForm"
- class="demo-dynamic"
- >
- <div class="farm-card" v-if="!isAdd">
- <div class="card-title">{{ detailData?.farmWorkName }}<span class="type-tag">标准农事</span></div>
- <div class="info-content">
- <el-form-item label-width="70px" class="form-item text-item" label="农事编号">
- <div class="info-text">
- {{ detailData?.code }}
- </div>
- </el-form-item>
- <el-form-item label-width="70px" class="form-item text-item" label="服务亩数">
- <div class="info-text">
- {{ detailData?.area ? detailData?.area + '亩' : '--' }}
- </div>
- </el-form-item>
- <el-form-item label-width="70px" class="form-item text-item" label="服务区域">
- <div class="info-text">
- {{ detailData?.serviceRegion }}
- </div>
- </el-form-item>
- <el-form-item label-width="70px" class="form-item" prop="conditionRate" label="触发条件">
- <div class="condition-wrap">
- {{ detailData?.condition }}
- <!-- <el-select v-model="dynamicValidateForm.condition" placeholder="请选择触发条件" style="width: 58%">
- <el-option v-for="(item, index) in farmWorkIndexNameList" :key="index" :value="item" :label="item" />
- </el-select>
- <span class="symbol"></span>
- <el-select v-model="dynamicValidateForm.conditionRate" placeholder="" style="width: 38%">
- <el-option :value="0" label="0%" />
- <el-option :value="5" label="5%" />
- <el-option :value="10" label="10%" />
- <el-option :value="20" label="20%" />
- <el-option :value="40" label="40%" />
- <el-option :value="60" label="60%" />
- <el-option :value="80" label="80%" />
- </el-select> -->
- </div>
- </el-form-item>
- <el-form-item label-width="70px" class="form-item" prop="executeDate" label="执行时间">
- <el-date-picker
- class="item-input"
- style="width: 100%"
- value-format="YYYY-MM-DD"
- v-model="dynamicValidateForm.executeDate"
- type="date"
- :clearable="false"
- placeholder="选择日期"
- />
- </el-form-item>
- </div>
- </div>
- <template v-else>
- <div class="farm-card progress">
- <span class="progress-title">农事进度</span>
- <el-radio-group v-model="farmProgress">
- <el-radio :value="0">已做</el-radio>
- <el-radio :value="1">未做</el-radio>
- </el-radio-group>
- </div>
- <div class="farm-card" v-if="farmProgress === 0">
- <div class="card-title">基本信息</div>
- <div class="info-content">
- <el-form-item label-width="82px" class="form-item" prop="farmWorkName" label="农事名称">
- <el-select v-model="dynamicValidateForm.farmWorkName" placeholder="请选择农事名称" style="width: 100%">
- <el-option v-for="(item, index) in farmWorkNameList" :key="index" :value="item" :label="item" />
- </el-select>
- </el-form-item>
- <el-form-item label-width="82px" class="form-item" prop="name" label="农事目的">
- <el-input
- v-model="dynamicValidateForm.purpose"
- style="width: 100%"
- :rows="2"
- type="textarea"
- placeholder="请输入农事目的"
- />
- </el-form-item>
- <el-form-item label-width="82px" class="form-item" prop="conditionRate" label="执行时间">
- <el-date-picker
- v-model="dynamicValidateForm.checkDay"
- value-format="YYYY-MM-DD"
- type="date"
- placeholder="请选择执行时间"
- style="width: 100%"
- />
- </el-form-item>
- <!-- <el-form-item label-width="82px" class="form-item" prop="conditionRate" label="触发条件">
- <div class="condition-wrap">
- <el-select v-model="dynamicValidateForm.condition" placeholder="请选择触发条件" style="width: 58%">
- <el-option v-for="(item, index) in farmWorkIndexNameList" :key="index" :value="item" :label="item" />
- </el-select>
- <span class="symbol"></span>
- <el-select v-model="dynamicValidateForm.conditionRate" placeholder="请选择" style="width: 38%">
- <el-option :value="0" label="0%" />
- <el-option :value="5" label="5%" />
- <el-option :value="10" label="10%" />
- <el-option :value="20" label="20%" />
- <el-option :value="40" label="40%" />
- <el-option :value="60" label="60%" />
- <el-option :value="80" label="80%" />
- </el-select>
- </div>
- </el-form-item> -->
- </div>
- </div>
- </template>
- <div class="farm-card prescription-content" v-if="farmProgress === 0">
- <div class="card-title pb-12">药物处方</div>
- <el-form-item label-width="82px" class="form-item" prop="usageMode" label="施用方式">
- <el-select v-model="dynamicValidateForm.usageMode" placeholder="请选择施用方式" style="width: 100%">
- <el-option
- v-for="(usage, uId) in allUsageModeList"
- :key="uId"
- :label="usage"
- :value="usage"
- />
- </el-select>
- </el-form-item>
- <div v-if="dynamicValidateForm.usageMode !== '人工农事'">
- <el-form-item
- v-for="(prescriptionItem, prescriptionI) in dynamicValidateForm.prescriptionList"
- :key="prescriptionI"
- :prop="'prescriptions.' + prescriptionI + '.value'"
- class="prescription-item"
- >
- <div class="recipe-item">
- <div class="sub-title">
- <div>{{ prescriptionItem.name }}处方</div>
- <div class="add-tag" @click="addDomain(prescriptionI)">
- <el-icon color="#2199F8"><Plus /></el-icon>新增药物
- </div>
- </div>
- <div class="recipe-form">
- <el-form-item
- v-for="(domain, index) in prescriptionItem.pesticideFertilizerList"
- :key="domain.key"
- :prop="'pesticideFertilizerList.' + index + '.value'"
- >
- <div class="form-box">
- <div class="form-index">{{ formatIndex(index) }}</div>
- <div class="box-item" v-if="domain.typeName">
- <div class="form-l">使用功效</div>
- <div class="form-r r-text">
- {{ domain.typeName }}
- <!-- <el-select
- v-model="domain.typeName"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option :label="domain.typeName" :value="domain.typeName" />
- </el-select> -->
- </div>
- </div>
- <div class="box-item">
- <div class="form-l">肥药名称</div>
- <div class="form-r">
- <el-select
- filterable
- @change="handlePesticideFertilizerChange(prescriptionI, index)"
- v-model="domain.pesticideFertilizerId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in pesticideFertilizersOptions"
- :key="item.id"
- :label="item.defaultName"
- :value="item.id"
- />
- </el-select>
- </div>
- </div>
- <div class="form-title">人工方式</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.ratio"
- style="width: 100%"
- placeholder="请输入"
- />
- </div>
- </div>
- <!-- <div class="box-item sub-item">
- <div class="form-l">施用方式</div>
- <div class="form-r">
- <el-select
- v-model="domain.usageMode"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="(usage, uId) in domain.usageModeList"
- :key="uId"
- :label="usage"
- :value="usage"
- />
- </el-select>
- </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.muUsage"
- style="width: 100%"
- placeholder="请输入"
- />
- </div>
- </div>
- <div v-if="dynamicValidateForm.usageMode === '叶面施'">
- <div class="form-title">无人机</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.ratio2"
- style="width: 100%"
- placeholder="请输入"
- />
- </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"
- style="width: 100%"
- placeholder="请输入"
- />
- </div>
- </div>
- </div>
- <div class="input-box mark-box">
- <el-input
- v-model="domain.remark"
- style="width: 100%"
- placeholder="备注:用药注意事项"
- />
- </div>
- <div class="action-btn">
- <el-button
- class="btn delete-btn"
- @click.prevent="removeDomain(prescriptionI, domain)"
- >
- 删除
- </el-button>
- <el-button
- type="default"
- class="btn"
- @click.prevent="resetItemForm(prescriptionI, index)"
- >
- 重置
- </el-button>
- </div>
- </div>
- </el-form-item>
- </div>
- </div>
- </el-form-item>
- </div>
- </div>
- <div class="farm-card progress" v-else>
- <div class="situation-description">
- <div class="description-title">状况描述</div>
- <div class="description-content">
- <el-input
- v-model="situationDescription"
- type="textarea"
- :rows="3"
- placeholder="请输入目前农场状况"
- class="description-textarea"
- />
- <div class="upload-section">
- <el-button class="upload-btn" @click="handleUploadImage">
- <el-icon><Upload /></el-icon>
- 上传图片
- </el-button>
- <div class="upload-tip">上传图片,专家诊断更清晰</div>
- </div>
- </div>
- </div>
- </div>
- <div class="farm-card map-content" v-if="false">
- <!-- <div class="farm-card map-content" v-if="!(curRole==1 && isAdd)"> -->
- <div class="card-title">执行农事区域</div>
- <div class="info-content">
- <div class="area-select">
- 执行分区:
- <span class="block"></span>
- <el-select
- popper-class="v-select-popper-ns"
- v-model="regionId"
- placeholder="请选择分区"
- style="width: 160px"
- @change="changeRegion"
- >
- <el-option
- v-for="(area, index) in areaList"
- :key="index"
- :label="area.name"
- :value="area.id"
- >
- </el-option>
- </el-select>
- </div>
- <div class="area-select">
- 服务亩数:
- <span class="block"></span>{{ serveArea }}
- </div>
- <div class="bottom-map" ref="areaRef"></div>
- <div>
- <div class="check-btn">
- <el-checkbox v-model="checkedArea" @change="handleArea" label="全选" size="large" />
- </div>
- </div>
- </div>
- </div>
- <div class="submit-btn" v-if="!isAdd">
- <div class="btn second" @click="handleIgnore">忽略</div>
- <div class="btn" @click.prevent="submitForm(formRef)">下发农事</div>
- </div>
- <div class="submit-btn" v-if="isAdd && farmProgress === 0">
- <div class="btn second">取消</div>
- <div class="btn" @click.prevent="submitForm(formRef)">确定新增</div>
- </div>
- <div v-if="isAdd && farmProgress === 1">
- <div class="expert-diagnosis-btn" @click="handleExpertDiagnosis">邀请专家诊断</div>
- </div>
- </el-form>
- </div>
- </div>
- <popup v-model:show="showTaskPopup" round class="task-tips-popup">
- <template v-if="taskPopupType === 'warning'">
- <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
- <div class="create-farm-text">
- <div>您确认忽略 <span class="main-text">{{ detailData?.farmName }}</span> 的 <span class="main-text">{{ detailData?.farmWorkName }}</span> 农事吗</div>
- </div>
- </template>
- <template v-else>
- <img class="farm-check-icon" src="@/assets/img/home/right.png" alt="">
- <div class="create-farm-text success-text">农事已下发成功</div>
- </template>
- <div class="create-farm-btn" @click="handlePopupBtn">{{ taskPopupType === 'warning' ? '确认忽略' : '我知道了' }}</div>
- </popup>
- </template>
- <script setup>
- import { onActivated, ref, reactive, onDeactivated, computed, onMounted } from "vue";
- import { useRouter, useRoute } from "vue-router";
- import { ElMessage } from "element-plus";
- import customHeader from "@/components/customHeader.vue";
- import NewFarmMap from "./newFarmMap";
- import { useStore } from "vuex";
- import { Popup } from "vant";
- import farmSteps from "@/components/farmSteps.vue";
- import dayjs from "dayjs";
- const store = useStore();
- const router = useRouter();
- const route = useRoute();
- // 角色
- // const curRole = store.state.app.curRole
- const curRole = 0
- const gardenId = ref(null);
- const actionType = ref([]);
- const isAdd = ref(false)
- const showTaskPopup = ref(false);
- const taskPopupType = ref('warning');
- isAdd.value = route.query.isAdd ? true : false
- onMounted(() => {
- const id = route.query.id;
- if (id) {
- getDetail(id);
- }
- window.scrollTo(0, 0);
- getFarmWorkNameList();
- getFarmWorkIndexNameList();
- if (route.query.data) {
- actionType.value = JSON.parse(route.query.data);
- } else {
- actionType.value = ["生长异常"];
- }
- dynamicValidateForm.prescriptionList = actionType.value.map((name) => ({
- name,
- pesticideFertilizerList: [
- {
- key: 1,
- typeName: "",
- muUsage: "",
- muUsage2: "",
- ratio: "",
- ratio2: "",
- remark: "",
- },
- ],
- }));
- if (!(curRole==1 && isAdd.value)) {
- const point = store.state.home.miniUserLocationPoint;
- // newFarmMap.initMap(point, areaRef.value);
- // eventBus.on("editNsMap:areaVal", getArea);
- gardenId.value = route.query.gardenId;
- // getAreaList(() => {
- // newFarmMap.initArea(areaList.value);
- // });
- }
- getWarningMsg();
- });
- onDeactivated(() => {
- // areaRef.value && newFarmMap.destroyMap();
- resetForm(formRef.value);
- });
- const detailData = ref({});
- const getDetail = (id) => {
- VE_API.z_farm_work_record.getDetail({ id }).then(({ data }) => {
- const res = data[0];
- detailData.value = res;
- dynamicValidateForm.executeDate = res.executeDate;
- dynamicValidateForm.usageMode = res.usageMode;
- res.prescriptionList.forEach(item => {
- item.pesticideFertilizerList.forEach(pesticide => {
- pesticide.typeName = item.name;
- });
- });
- dynamicValidateForm.prescriptionList = res.prescriptionList;
- });
- };
- function handleIgnore() {
- taskPopupType.value = 'warning';
- showTaskPopup.value = true;
- }
- function handlePopupBtn() {
- showTaskPopup.value = false;
- if (taskPopupType.value === 'warning') {
- // 确认忽略
- }
- }
- const resetForm = (formEl) => {
- if (!formEl) return;
- formEl.resetFields();
- serveArea.value = null;
- regionId.value = null;
- };
- // 表单
- const formRef = ref();
- const dynamicValidateForm = reactive({
- farmWorkName: "",
- conditionRate: "",
- purpose: "",
- executeDate: dayjs().format("YYYY-MM-DD"),
- checkDay: "",
- usageMode: "",
- prescriptionList: [
- {
- name: "",
- pesticideFertilizerList: [
- {
- key: 1,
- typeName: "",
- muUsage: "",
- muUsage2: "",
- ratio: "",
- ratio2: "",
- remark: "",
- },
- ],
- },
- ],
- });
- const rules = {
- farmWorkName: [
- {
- required: true,
- message: "请输入农事名称",
- trigger: "blur",
- },
- ],
- conditionRate: [
- {
- required: false,
- message: "请输入触发条件",
- trigger: "blur",
- },
- ],
- executeDate: [
- {
- required: false,
- message: "请选择执行时间",
- trigger: "blur",
- },
- ],
- checkDay: [
- {
- required: true,
- message: "请选择复核时间",
- trigger: "blur",
- },
- ],
- };
- const formatIndex = (index) => {
- return String(index + 1).padStart(2, "0");
- };
- const addDomain = (parentIndex) => {
- dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.unshift({
- key: Date.now(),
- muUsage: "",
- muUsage2: "",
- ratio: "",
- ratio2: "",
- remark: "",
- });
- };
- let pesticideFertilizersOptions = ref([
- // {
- // id: 'null',
- // name: "芸苔素内酯 15000倍",
- // typeName: "30",
- // defaultRatio: null,
- // defaultDroneRatio: null,
- // unit: 0,
- // defaultName: "调节",
- // },
- {
- brand: "天润美满",
- capacity: 1000,
- count: null,
- defaultDroneRatio: null,
- defaultName: "生物活性酶",
- defaultRatio: null,
- ftl: "",
- id: "185",
- name: "生物活性酶",
- pesticideFertilizerCode: "1185",
- price: 220.0,
- processUnit: "",
- typeId: 1,
- typeName: "调节",
- unit: "ml",
- unitUsage: null,
- unitWaterAmount: null,
- usageModeList: ["叶面施"],
- },
- {
- brand: "",
- capacity: null,
- count: null,
- defaultDroneRatio: null,
- defaultName: "矮壮素",
- defaultRatio: null,
- ftl: "",
- id: "145",
- name: "矮壮素",
- pesticideFertilizerCode: "1145",
- price: null,
- processUnit: "",
- typeId: 1,
- typeName: "调节",
- unit: "ml",
- unitUsage: null,
- unitWaterAmount: null,
- usageModeList: ["叶面施"],
- },
- ]);
- VE_API.z_farm_work_order.pesticideFertilizersList().then(({ data }) => {
- pesticideFertilizersOptions.value = data;
- });
- const allUsageMode = ref(null);
- const allUsageModeList = ["叶面施", "根部施", "人工农事"];
- // 农事名称列表
- const farmWorkIndexNameList = ref([
- "片区拔节率",
- "园区花蕾率",
- "单树花蕾率",
- "片区雄穗抽出率",
- "园区花量大率",
- "单树花量大率",
- "片区分蘖率",
- ]);
- function getFarmWorkIndexNameList() {
- farmWorkIndexNameList.value = [
- "片区拔节率",
- "园区花蕾率",
- "单树花蕾率",
- "片区雄穗抽出率",
- "园区花量大率",
- "单树花量大率",
- "片区分蘖率",
- ];
- // VE_API.farm.fetchFarmWorkIndexNameList().then(({data}) => {
- // farmWorkIndexNameList.value = data
- // })
- }
- // 触发指标列表
- const farmWorkNameList = ref([]);
- function getFarmWorkNameList() {
- // VE_API.farm.fetchFarmWorkNameList().then(({data}) => {
- // farmWorkNameList.value = data
- // })
- }
- // 预警文字信息
- const warningMsg = ref("");
- const getWarningMsg = () => {
- // VE_API.farm.getFarmWorkWarningMsg({farmId: gardenId.value}).then(({data}) => {
- // warningMsg.value = data
- // })
- };
- /**
- * 选择药肥的时候修改订单中药肥pesticideFertilizerId 以外其他数据
- * @param index
- */
- const handlePesticideFertilizerChange = (parentIndex, index) => {
- let obj = pesticideFertilizersOptions.value.filter(
- (item) =>
- dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index].pesticideFertilizerId ===
- item.id
- )[0];
- dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index] = {
- ...dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index],
- typeName: obj.typeName,
- unit: obj.unit,
- defaultRatio: obj.defaultRatio,
- usageModeList: obj.usageModeList,
- ratio: obj.defaultRatio,
- defaultName: obj.defaultName,
- pesticideFertilizerName: obj.name,
- pesticideFertilizerCode: obj.pesticideFertilizerCode,
- };
- };
- const removeDomain = (parentIndex, item) => {
- const index = dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.indexOf(item);
- if (index !== -1) {
- dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.splice(index, 1);
- }
- };
- const resetItemForm = (parentIndex, index) => {
- dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList[index] = {
- typeName: "",
- muUsage: "",
- muUsage2: "",
- ratio: "",
- ratio2: "",
- remark: "",
- };
- };
- const submitForm = (formEl) => {
- if (!formEl) return;
- formEl.validate((valid) => {
- if (valid) {
- taskPopupType.value = 'success';
- showTaskPopup.value = true;
- // router.push({
- // path: "/completed_work",
- // query: {
- // id: 1,
- // status: 1,
- // },
- // });
- // submit();
- } else {
- console.log("error submit!");
- }
- });
- };
- const submit = () => {
- let executeBlueZones = null
- if (!(curRole==1 && isAdd.value)) {
- executeBlueZones = newFarmMap.getSelectedBlueRegion();
- }
- // if (!executeBlueZones || !executeBlueZones.length) {
- // ElMessage({
- // message: "请选择执行区域",
- // type: "warning",
- // });
- // return false
- // }
- console.log("dynamicValidateForm.prescriptionList", dynamicValidateForm.prescriptionList);
- // 检查药物所有项是否都包含特定的字段
- // const hasRequiredFields = dynamicValidateForm.prescriptionList.every(item => {
- // return item.pesticideFertilizerList.every(domain => {
- // const hasPesticideFertilizerCode = 'pesticideFertilizerCode' in domain
- // const hasMuUsage = 'muUsage' in domain;
- // const hasRatio = 'ratio' in domain;
- // const isMuUsageValid = domain.muUsage !== '';
- // const isRatioValid = domain.ratio ? true : false;
- // return hasPesticideFertilizerCode && hasMuUsage && hasRatio && isMuUsageValid && isRatioValid
- // });
- // })
- // if (!hasRequiredFields) {
- // ElMessage({
- // message: "请完善药物信息",
- // type: "warning",
- // });
- // return false
- // }
- // const flattenedDomains = flattenDomains(dynamicValidateForm.prescription)
- const data = {
- ...dynamicValidateForm,
- // prescription: flattenedDomains,
- farmWorkType: farmWorkTypeVal.value,
- farmId: gardenId.value,
- regionId: regionId.value,
- executeBlueZones,
- // weatherWarningMsg: warningMsg.value,
- // allUsageMode: allUsageMode.value,
- };
- console.log("ddddaaaaa", data);
- // 新增农事
- VE_API.farm.saveFarmWork(data).then(({ code }) => {
- if (code === 0) {
- ElMessage({
- message: "保存成功",
- type: "success",
- });
- setTimeout(() => {
- // router.go(-1);
- router.replace("/expert_album?reload=true");
- }, 500);
- }
- });
- // const data = {
- // orderId: props.prescriptioData.orderId,
- // orderStatus: 1,
- // pesticideFertilizers: dynamicValidateForm.domains,
- // };
- // VE_API.order.confirm(data).then(({ code }) => {
- // if (code == 0) {
- // console.log('专家下发处方成功');
- // eventBus.emit('discover:submitForm')
- // window.location.reload()
- // }
- // });
- };
- const farmWorkTypeVal = computed(() => {
- const valueMap = {
- 生长异常: 1,
- 病虫异常: 3,
- 营养农事: 2,
- };
- if (actionType.value.length === 1) {
- return valueMap[actionType.value[0]] || null; // 如果只有一个元素,返回对应的值,否则返回 null
- } else {
- return 1;
- }
- });
- function flattenDomains(data) {
- return data.reduce((acc, item) => {
- return acc.concat(item.pesticideFertilizerList);
- }, []);
- }
- // 地图
- const areaRef = ref(null);
- let newFarmMap = new NewFarmMap();
- const serveArea = ref(null);
- // 农场分区列表
- const areaList = ref([]);
- const regionId = ref(null);
- const farmProgress = ref(0)
- // 状况描述相关数据
- const situationDescription = ref('')
- // 切换分区
- const changeRegion = (e) => {
- checkedArea.value = false;
- newFarmMap.getBlueRegion({ gardenId: gardenId.value, regionId: e }, () => {
- // newFarmMap.setBlueRegion([{id: "ws0y1me7h94u"}, {id: "ws0y1me545tg"}])
- // serveArea.value = "3.72亩"
- });
- };
- // 所选蓝色分区的面积
- const getArea = (val) => {
- serveArea.value = val.toFixed(2) + "亩";
- };
- const checkedArea = ref(false);
- const handleArea = (e) => {
- newFarmMap.toggleAllArea(e);
- };
- // 处理上传图片
- const handleUploadImage = () => {
- // 这里可以添加上传图片的逻辑
- console.log('上传图片');
- };
- // 处理邀请专家诊断
- const handleExpertDiagnosis = () => {
- // 这里可以添加邀请专家诊断的逻辑
- console.log('邀请专家诊断');
- };
- </script>
- <style lang="scss" scoped>
- .new-farming-page {
- height: 100vh;
- position: relative;
- overflow: auto;
- font-size: 14px;
- background: #f2f3f5;
- ::v-deep {
- .custom-header {
- position: fixed;
- top: 0;
- padding-bottom: 1px;
- }
- }
- .step-wrap {
- padding: 12px 0;
- }
- .box-wrap {
- background: #fff;
- padding: 10px;
- border-radius: 8px;
- }
- .new-farming-content {
- margin: 41px 0 62px 0;
- padding: 4px 12px 8px 12px;
- width: 100%;
- box-sizing: border-box;
-
- // ::v-deep {
- // .el-select__input {
- // color: #2199F8;
- // }
- // .el-select__wrapper {
- // color: #2199F8;
- // min-height: 30px;
- // line-height: 28px;
- // box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
- // }
- // .el-select__caret {
- // color: #2199F8;
- // }
- // .el-select__placeholder {
- // color: #2199F8;
- // }
- // .el-radio {
- // margin-right: 16px;
- // }
- // .el-input__wrapper {
- // box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
- // }
- // .el-input__prefix {
- // color: #2199F8;
- // }
- // .el-input__inner {
- // color: #2199F8;
- // --el-input-placeholder-color: rgba(33, 153, 248, 0.43);
- // }
- // .el-tag.el-tag--info {
- // --el-tag-text-color: #2199F8;
- // --el-tag-bg-color: rgba(33, 153, 248, 0.1);
- // }
- // }
- .farm-info {
- color: rgba(0, 0, 0, 0.6);
- font-size: 14px;
- margin-top: 14px;
- .info-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: rgba(41, 41, 41, 0.3);
- .info-more {
- display: flex;
- align-items: center;
- }
- }
- }
- .farm-photo {
- margin-top: 10px;
- .photo-list {
- display: flex;
- align-items: center;
- width: 100%;
- overflow: auto;
- padding-bottom: 10px;
- .photo-item {
- width: 92px;
- height: 92px;
- border-radius: 8px;
- object-fit: cover;
- }
- .img-item + .img-item {
- margin-left: 12px;
- }
- }
- .list-text {
- text-align: center;
- color: rgba(0, 0, 0, 0.5);
- padding-top: 2px;
- }
- }
- .submit-btn {
- z-index: 10;
- position: fixed;
- bottom: 0px;
- left: 0;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 12px;
- background: #fff;
- box-sizing: border-box;
- box-shadow: 0 4px 4px rgba(0, 0, 0, 0.4);
- border-top: 1px solid rgba(0, 0, 0, 0.1);
- .btn {
- height: 40px;
- border-radius: 25px;
- line-height: 40px;
- width: 110px;
- text-align: center;
- background: linear-gradient(180deg, #70BFFE, #2199F8);
- color: #FFFFFF;
- font-size: 14px;
- &.second {
- background: #FFFFFF;
- border: 1px solid rgba(153, 153, 153, 0.5);
- color: #666666;
- }
- }
- .btn + .btn {
- margin-left: 12px;
- }
- }
- }
- .card-title {
- font-size: 16px;
- font-weight: bold;
- color: #000;
- display: flex;
- align-items: center;
- // justify-content: space-between;
- .add-tag {
- font-size: 12px;
- color: #2199f8;
- padding: 4px 8px;
- background: rgba(33, 153, 248, 0.16);
- border-radius: 20px;
- font-weight: normal;
- height: 25px;
- line-height: 25px;
- }
- .type-tag {
- margin-left: 5px;
- font-size: 12px;
- color: #000000;
- padding: 0 10px;
- background: rgba(119, 119, 119, 0.1);
- border-radius: 20px;
- font-weight: normal;
- height: 26px;
- line-height: 26px;
- }
- }
- .pb-12 {
- padding-bottom: 12px;
- }
- .farm-card {
- background: #ffffff;
- border-radius: 8px;
- padding: 12px 12px 0 12px;
- width: 100%;
- box-sizing: border-box;
- margin-top: 10px;
- color: rgba(0, 0, 0, 0.4);
- &.progress{
- display: flex;
- align-items: center;
- padding: 12px;
- .progress-title{
- margin-right: 12px;
- }
- ::v-deep{
- .el-radio{
- margin-right: 10px;
- }
- }
- }
- &.map-content {
- margin-top: 12px;
- }
- &.prescription-content {
- padding: 12px;
- }
- }
- .usage-mode-wrap {
- padding: 0 12px;
- margin-top: 12px;
- .info-content {
- padding-top: 14px;
- padding-bottom: 1px;
- }
- .el-form-item--default {
- margin-bottom: 0;
- }
- }
- ::v-deep {
- .el-form-item__label {
- height: 30px;
- line-height: 30px;
- color: rgba(0, 0, 0, 0.4);
- }
- .el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before {
- display: none;
- }
- }
- .info-content {
- padding: 10px 0;
- position: relative;
- .condition-wrap {
- display: flex;
- align-items: center;
- width: 100%;
- .symbol {
- width: 10px;
- // text-align: center;
- // padding: 0 4px;
- }
- }
- .item-input {
- // width: 60%;
- min-width: 140px;
- max-width: 240px;
- }
- .recheck-text {
- padding-left: 6px;
- }
- .info-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- }
- .info-item + .info-item {
- margin-top: 12px;
- }
- .bottom-map {
- width: 100%;
- height: 250px;
- clip-path: inset(0px round 8px);
- }
- .check-btn {
- position: absolute;
- bottom: 16px;
- right: 6px;
- background: rgba(0, 0, 0, 0.6);
- padding: 0 8px;
- border-radius: 8px;
- ::v-deep {
- .el-checkbox {
- color: #fff;
- }
- }
- }
- .area-select {
- padding-bottom: 12px;
- .block {
- width: 12px;
- display: inline-block;
- }
- }
- }
- ::v-deep {
- .el-form-item--default {
- margin-bottom: 8px;
- &.text-item {
- margin-bottom: 2px;
- .el-form-item__content {
- line-height: 24px;
- }
- .el-form-item__label {
- height: 24px;
- line-height: 24px;
- }
- }
- }
- }
- .sub-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: rgba(0, 0, 0, 0.6);
- font-size: 14px;
- .add-tag {
- font-size: 12px;
- color: #2199f8;
- padding: 0 8px;
- border: 1px solid #2199F8;
- border-radius: 5px;
- font-weight: normal;
- height: 28px;
- line-height: 28px;
- }
- }
- .recipe-item {
- width: 100%;
- .recipe-form {
- padding-top: 8px;
- ::v-deep {
- .el-form-item {
- &:last-child {
- margin-bottom: 0;
- }
- }
- }
- }
- .box-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: rgba(0, 0, 0, 0.4);
- .r-text {
- width: 140px;
- text-align: center;
- }
- .form-r {
- width: 60%;
- min-width: 140px;
- max-width: 240px;
- }
- }
- .form-box {
- border: 1px solid rgba(33, 153, 248, 0.8);
- border-radius: 8px;
- padding: 20px 10px;
- width: 100%;
- position: relative;
- // background: rgb(209, 235, 255, 0.3);
- // margin-bottom: 12px;
- .form-index {
- position: absolute;
- left: 0;
- top: 0;
- padding: 0 6px;
- background: #2199F8;
- border-radius: 4px 0 4px 0;
- height: 18px;
- line-height: 18px;
- font-size: 12px;
- color: #fff;
- }
- .input-box {
- &.mark-box {
- padding: 8px 0 12px 0;
- }
- }
- .text-center {
- ::v-deep {
- .el-input__inner {
- text-align: center;
- }
- }
- }
- .action-btn {
- display: flex;
- justify-content: flex-end;
- .btn {
- color: #8F8F8F;
- border-radius: 25px;
- padding: 5px 30px;
- }
- .delete-btn {
- color: rgba(255, 89, 89, 0.9);
- background: #fff;
- border: 1px solid rgba(255, 89, 89, 0.9);
- }
- }
- .btn-group {
- padding-top: 12px;
- }
- .sub-item {
- padding-left: 10px;
- .has-sub {
- display: flex;
- flex-direction: column;
- align-items: center;
- .main-name {
- line-height: 20px;
- }
- .sub-name {
- font-size: 10px;
- color: rgba(129, 129, 129, 0.5);
- line-height: 14px;
- }
- }
- .colunm-sub {
- display: flex;
- align-items: center;
- .sub-name {
- font-size: 10px;
- color: rgba(129, 129, 129, 0.5);
- }
- }
- .r-text {
- width: 132px;
- text-align: center;
- font-size: 14px;
- color: #474747;
- }
- .price {
- ::v-deep {
- .el-input__wrapper {
- box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
- }
- .el-input__inner {
- color: #2199f8;
- }
- }
- }
- }
- .form-title {
- font-size: 14px;
- padding-top: 6px;
- color: #000;
- font-weight: 600;
- }
- .box-item + .box-item {
- margin-top: 8px;
- }
- }
- .form-box + .form-box {
- margin-top: 8px;
- }
- .usageMode-wrap {
- padding-top: 8px;
- }
- }
-
- // 状况描述样式
- .situation-description {
- width: 100%;
- .description-title {
- font-size: 16px;
- font-weight: bold;
- color: #000;
- margin-bottom: 12px;
- }
-
- .description-content {
- .description-textarea {
- margin-bottom: 10px;
- width: 100%;
- }
-
- .upload-section {
- .upload-btn {
- width: 112px;
- height: 32px;
- border-radius: 3px;
- border: 1px solid #e0e0e0;
- background: #fff;
- color: #000;
- font-size: 14px;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 8px;
-
- .el-icon {
- margin-right: 6px;
- }
- }
-
- .upload-tip {
- font-size: 12px;
- color: #999;
- line-height: 1.4;
- }
- }
- }
- }
-
- // 专家诊断按钮样式
- .expert-diagnosis-btn {
- width: 180px;
- height: 40px;
- border-radius: 24px;
- background: linear-gradient(180deg, #70BFFE 0%, #2199F8 100%);
- color: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 30px auto 0;
- }
- }
- .task-tips-popup {
- width: 75%;
- padding: 28px 28px 20px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- .create-farm-icon{
- width: 40px;
- height: 40px;
- margin-bottom: 12px;
- }
- .farm-check-icon{
- width: 68px;
- height: 68px;
- margin-bottom: 12px;
- }
- .create-farm-text{
- font-size: 20px;
- font-weight: 500;
- line-height: 40px;
- margin-bottom: 32px;
- text-align: center;
- &.success-text{
- font-size: 23px;
- font-weight: 400;
- }
- }
- .main-text {
- color: #2199F8;
- }
- .create-farm-btn{
- width: 100%;
- box-sizing: border-box;
- padding: 8px;
- border-radius: 25px;
- font-size: 16px;
- background: #2199F8;
- color: #fff;
- text-align: center;
- }
- }
- </style>
|