|
@@ -0,0 +1,817 @@
|
|
|
+<template>
|
|
|
+ <!-- 专家处方 -->
|
|
|
+ <div class="work-item" :class="{ dark: progress === 0 && ROLETYPE != '3' }">
|
|
|
+ <div class="work-line">
|
|
|
+ <div class="line-box">
|
|
|
+ <div class="line-dotted">
|
|
|
+ <div class="dotted-inset"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="work-info">
|
|
|
+ <img v-if="progress === 0 && ROLETYPE == '3'" class="todo-img" src="@/assets/img/gallery/todo.png" />
|
|
|
+ <img v-if="progress !== 0" class="done-img" src="@/assets/img/gallery/done.png" />
|
|
|
+ <div class="card-item-title"><span class="dotted"></span>专家处方</div>
|
|
|
+ <div class="prescription-box">
|
|
|
+ <div class="step-box">
|
|
|
+ <step-box :orderStatus="infoItem.orderStatus" v-if="infoItem.orderStatus || infoItem.orderStatus === 0"></step-box>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="blur-bg">
|
|
|
+ <div class="lock-btn">解锁智能处方</div>
|
|
|
+ </div> -->
|
|
|
+ <div class="work-info-conetnt">
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">农事编号</div>
|
|
|
+ <div class="info-value">{{ infoItem.orderId }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">服务亩数</div>
|
|
|
+ <div class="info-value">{{ infoItem.area }}亩</div>
|
|
|
+ </div>
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">服务区域</div>
|
|
|
+ <div class="info-value">{{ infoItem.serviceRegion }}</div>
|
|
|
+ </div>
|
|
|
+ <div v-if="progress === 0 && ROLETYPE == '3'">
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">触发条件</div>
|
|
|
+ <div class="info-value">
|
|
|
+ {{ infoItem.condition }}
|
|
|
+ <div class="select-value">
|
|
|
+ <el-select v-model="infoItem.condition" placeholder="请选择" style="width: 80px">
|
|
|
+ <el-option v-for="num in 9" :key="num" :value="20 + (num - 1) * 5 + '%'">
|
|
|
+ {{ 20 + (num - 1) * 5 }}%
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="info-item time-picker">
|
|
|
+ <div class="info-name">执行时间</div>
|
|
|
+ <div class="info-value">
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 150px"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ v-model="infoItem.executeDate"
|
|
|
+ type="date"
|
|
|
+ :clearable="false"
|
|
|
+ class="date-info"
|
|
|
+ placeholder="选择日期"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">触发条件</div>
|
|
|
+ <div class="info-value">{{ infoItem.farmWorkLibName }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="info-item">
|
|
|
+ <div class="info-name">执行时间</div>
|
|
|
+ <div class="info-value">{{ infoItem.executeDate }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="info-item">
|
|
|
+ <li class="info-name">执行时间</li>
|
|
|
+ <div class="info-value primary-color">2025.01.12</div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ <div class="desc">
|
|
|
+ {{ prescriptioData.expertPrescription || prescriptioData.weatherWarningMsg }}
|
|
|
+ </div>
|
|
|
+ <div class="prescription-item" v-if="progress === 0 && ROLETYPE == '3' && dynamicValidateForm.prescriptionList && dynamicValidateForm.prescriptionList.length && dynamicValidateForm.prescriptionList[0].pesticideFertilizerList.length">
|
|
|
+ <div class="usageMode-wrap">
|
|
|
+ <div class="box-item">
|
|
|
+ <div class="form-l">施用方式</div>
|
|
|
+ <div class="form-r">
|
|
|
+ <el-select
|
|
|
+ v-model="dynamicValidateForm.usageMode"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 152px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(usage, uId) in allUsageModeList"
|
|
|
+ :key="uId"
|
|
|
+ :label="usage"
|
|
|
+ :value="usage"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-form ref="formRef" style="max-width: 600px" :model="dynamicValidateForm" class="demo-dynamic">
|
|
|
+ <div
|
|
|
+ v-for="(prescriptionItem, prescriptionI) in dynamicValidateForm.prescriptionList"
|
|
|
+ :key="prescriptionI"
|
|
|
+ >
|
|
|
+ <div class="recipe-box">
|
|
|
+ <div class="recipe-title">
|
|
|
+ <div class="recipe-name">{{ prescriptionItem.name }}处方</div>
|
|
|
+ <div class="recipe-btn" @click="addDomain(prescriptionI)">
|
|
|
+ <el-icon><Plus /></el-icon>新增药物
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="recipe-item">
|
|
|
+ <div class="recipe-form">
|
|
|
+ <el-form-item
|
|
|
+ v-for="(domain, index) in prescriptionItem.pesticideFertilizerList"
|
|
|
+ :key="domain.key"
|
|
|
+ :prop="'domains.' + 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: 140px"
|
|
|
+ >
|
|
|
+ <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
|
|
|
+ @change="
|
|
|
+ handlePesticideFertilizerChange(prescriptionI, index)
|
|
|
+ "
|
|
|
+ v-model="domain.pesticideFertilizerId"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 140px"
|
|
|
+ >
|
|
|
+ <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: 140px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ <!-- <el-select
|
|
|
+ v-model="domain.value3"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 140px"
|
|
|
+ >
|
|
|
+ <el-option label="1ml:5000ml" value="1" />
|
|
|
+ <el-option label="1ml:10000ml" value="3" />
|
|
|
+ </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: 140px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ <!-- <el-select
|
|
|
+ v-model="domain.value5"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 140px"
|
|
|
+ >
|
|
|
+ <el-option label="1:5000ml" value="1" />
|
|
|
+ <el-option label="1:10000ml" value="3" />
|
|
|
+ </el-select> -->
|
|
|
+ </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.muUsage2"
|
|
|
+ style="width: 140px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ <!-- <el-select
|
|
|
+ v-model="domain.value6"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 140px"
|
|
|
+ >
|
|
|
+ <el-option label="1ml:5000ml" value="1" />
|
|
|
+ <el-option label="1ml:10000ml" value="3" />
|
|
|
+ </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.ratio2"
|
|
|
+ style="width: 140px"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="input-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="primary"
|
|
|
+ class="btn"
|
|
|
+ @click.prevent="resetItemForm(prescriptionI, index)"
|
|
|
+ >
|
|
|
+ 重置
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-item" v-else v-show="prescriptioData.prescriptionList && prescriptioData.prescriptionList.length && prescriptioData.prescriptionList[0].pesticideFertilizerList.length">
|
|
|
+ <div class="sub-title">
|
|
|
+ <div class="sub-name">药物处方</div>
|
|
|
+ </div>
|
|
|
+ <div class="use-mode">施用方式:<span>{{ prescriptioData.usageMode }}</span></div>
|
|
|
+ <div v-if="workType">
|
|
|
+ <div class="new-wrap">
|
|
|
+ <div class="new-title">
|
|
|
+ <div class="title-1"><div class="table-name">使用功效</div></div>
|
|
|
+ <div class="title-2"><div class="table-name">肥药名称</div></div>
|
|
|
+ <div class="title-3"><div class="table-name">执行方式</div></div>
|
|
|
+ <div class="title-4"><div class="table-name">药肥配比</div></div>
|
|
|
+ <div class="title-5"><div class="table-name">单亩用量</div></div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="new-table-wrap"
|
|
|
+ v-for="(prescriptionItem, prescriptionI) in prescriptioData.prescriptionList"
|
|
|
+ :key="prescriptionI"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="new-prescription"
|
|
|
+ v-for="(subP, subI) in prescriptionItem.pesticideFertilizerList"
|
|
|
+ :key="subI"
|
|
|
+ >
|
|
|
+ <div class="new-table">
|
|
|
+ <div class="line-l">
|
|
|
+ <div class="line-1 title-1">{{ subP.typeName }}</div>
|
|
|
+ <div class="line-2">{{ subP.defaultName }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="line-r" :class="{'has-border': prescriptioData.usageMode === '叶面施'}">
|
|
|
+ <div class="line-3">
|
|
|
+ <div class="sub-line title-3" :class="{'execute-line': prescriptioData.usageMode === '叶面施'}">人工</div>
|
|
|
+ <div class="sub-line title-4">{{ subP.ratio }}</div>
|
|
|
+ <div class="sub-line title-5">{{ subP.muUsage }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="line-4" v-if="prescriptioData.usageMode === '叶面施'">
|
|
|
+ <div class="sub-line title-3 execute-line">无人机</div>
|
|
|
+ <div class="sub-line title-4">{{ subP.ratio2 ? subP.ratio2 : "---" }}</div>
|
|
|
+ <div class="sub-line title-5">{{ subP.muUsage2 ? subP.muUsage2 : "---" }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="note-text" v-if="subP.remark">{{ subP.remark }}</div>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="prescription-result" :class="{ 'has-wrap': workType }">
|
|
|
+ <div class="result-index">0{{ index + 1 }}</div>
|
|
|
+ <div class="result-title">
|
|
|
+ <div class="title-item">
|
|
|
+ <div class="name">功效:</div>
|
|
|
+ <div class="value">{{ item.typeName }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="title-item">
|
|
|
+ <div class="name">名称:</div>
|
|
|
+ <div class="value">{{ item.defaultName }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-table
|
|
|
+ :data="handleTableData(item)"
|
|
|
+ style="width: 100%"
|
|
|
+ :header-cell-style="{ background: '#F5F5F5' }"
|
|
|
+ >
|
|
|
+ <el-table-column label="" width="50">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="table-l-title">
|
|
|
+ {{ scope.row.executeStyle == 1 ? "人工" : "无人机" }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="配比" width="56">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.ratio ? scope.row.ratio + scope.row.unit : "---" }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="muUsage" label="单亩用量">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.muUsage ? scope.row.muUsage + scope.row.unit : "---" }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="remark-text">备注:{{ item.remark }}</div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="item-table has-sub-title no-wrap-table">
|
|
|
+ <div class="prescription-result">
|
|
|
+ <el-table
|
|
|
+ :data="prescriptioData.pesticideFertilizers"
|
|
|
+ style="width: 100%"
|
|
|
+ :header-cell-style="{ background: '#F5F5F5' }"
|
|
|
+ >
|
|
|
+ <el-table-column prop="typeName" label="功效" width="42" />
|
|
|
+ <el-table-column prop="defaultName" label="名称" />
|
|
|
+ <el-table-column label="配比" width="52">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.ratio ? scope.row.ratio + scope.row.unit : "---" }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="muUsage" label="单亩用量" width="42">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.muUsage ? scope.row.muUsage + scope.row.unit : "---" }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="执行方式" width="40">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="table-l-title">
|
|
|
+ {{ scope.row.executeStyle == 1 ? "人工" : "人工" }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-item">
|
|
|
+ <div class="sub-title">
|
|
|
+ <div class="sub-line"></div>
|
|
|
+ <div class="sub-name">执行农事区域</div>
|
|
|
+ <div class="sub-line"></div>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-chart prescription-map" v-if="infoItem?.executeBlueZones">
|
|
|
+ <execute-blue-region
|
|
|
+ :executeBlueZones="infoItem?.executeBlueZones"
|
|
|
+ :farmId="infoItem.farmId"
|
|
|
+ :regionId="infoItem.regionId"
|
|
|
+ ></execute-blue-region>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-item" v-if="progress === 0">
|
|
|
+ <div class="sub-title">
|
|
|
+ <div class="sub-line"></div>
|
|
|
+ <div class="sub-name">指标动态</div>
|
|
|
+ <div class="sub-line"></div>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-chart">
|
|
|
+ <chart
|
|
|
+ :key="1"
|
|
|
+ type="feature"
|
|
|
+ :indexName="infoItem.indexName"
|
|
|
+ :chartJson="prescriptioData.indexJson"
|
|
|
+ ></chart>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="prescription-item action-btn" v-if="progress === 0 && ROLETYPE == '3'">
|
|
|
+ <el-button class="btn" type="danger" plain @click="remove()">删除</el-button>
|
|
|
+ <el-button class="btn" type="primary" @click="submitForm(formRef)">确认下发</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import eventBus from "@/api/eventBus";
|
|
|
+import chart from "./chart.vue";
|
|
|
+import { onActivated, onMounted, reactive, ref } from "vue";
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import { useStore } from "vuex";
|
|
|
+import ExecuteBlueRegion from "./executeBlueRegion";
|
|
|
+import stepBox from "@/components/common/stepBox.vue";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
+const router = useRouter();
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ progress: {
|
|
|
+ type: Number,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ prescriptioData: {
|
|
|
+ type: Object,
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const infoItem = ref({});
|
|
|
+
|
|
|
+const store = useStore();
|
|
|
+const ROLETYPE = store.state.app.curRole;
|
|
|
+
|
|
|
+// 农事类型--区分表格显示字段等
|
|
|
+const workType = ref(true);
|
|
|
+
|
|
|
+let pesticideFertilizersOptions = ref([
|
|
|
+ {
|
|
|
+ id: "null",
|
|
|
+ name: "芸苔素内酯 15000倍",
|
|
|
+ typeName: "30",
|
|
|
+ defaultRatio: null,
|
|
|
+ defaultDroneRatio: null,
|
|
|
+ unit: 0,
|
|
|
+ defaultName: "调节",
|
|
|
+ },
|
|
|
+]);
|
|
|
+VE_API.order.pesticideFertilizers().then(({ data }) => {
|
|
|
+ pesticideFertilizersOptions.value = data;
|
|
|
+});
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ dynamicValidateForm.usageMode = props.prescriptioData.usageMode;
|
|
|
+ dynamicValidateForm.prescriptionList = props.prescriptioData.prescriptionList.map((item) => ({ ...item }));
|
|
|
+ // submit()
|
|
|
+ infoItem.value = props.prescriptioData;
|
|
|
+});
|
|
|
+
|
|
|
+// 表单
|
|
|
+const formRef = ref();
|
|
|
+const dynamicValidateForm = reactive({
|
|
|
+ name: "",
|
|
|
+ conditionRate: "",
|
|
|
+ executeDate: "",
|
|
|
+ usageMode: "",
|
|
|
+ prescriptionList: [
|
|
|
+ {
|
|
|
+ name: "",
|
|
|
+ pesticideFertilizerList: [
|
|
|
+ {
|
|
|
+ key: 1,
|
|
|
+ typeName: "",
|
|
|
+ muUsage: "",
|
|
|
+ muUsage2: "",
|
|
|
+ ratio: "",
|
|
|
+ ratio2: "",
|
|
|
+ remark: "",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+const addDomain = (parentIndex) => {
|
|
|
+ dynamicValidateForm.prescriptionList[parentIndex].pesticideFertilizerList.unshift({
|
|
|
+ key: Date.now(),
|
|
|
+ muUsage: "",
|
|
|
+ muUsage2: "",
|
|
|
+ ratio: "",
|
|
|
+ ratio2: "",
|
|
|
+ remark: "",
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+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 allUsageMode = ref(null);
|
|
|
+const allUsageModeList = ["叶面施", "根部施"];
|
|
|
+
|
|
|
+/**
|
|
|
+ * 选择药肥的时候修改订单中药肥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 submitForm = (formEl) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ submit();
|
|
|
+ } else {
|
|
|
+ console.log("error submit!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const submit = () => {
|
|
|
+ // const executeBlueZones = newFarmMap.getSelectedBlueRegion();
|
|
|
+ // if (!executeBlueZones || !executeBlueZones.length) {
|
|
|
+ // ElMessage({
|
|
|
+ // message: "请选择执行区域",
|
|
|
+ // type: "warning",
|
|
|
+ // });
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ // 检查药物所有项是否都包含特定的字段
|
|
|
+ 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 data = {
|
|
|
+ ...infoItem.value,
|
|
|
+ ...dynamicValidateForm,
|
|
|
+ // prescription: flattenedDomains,
|
|
|
+ orderStatus: 1,
|
|
|
+ // weatherWarningMsg: warningMsg.value,
|
|
|
+ // allUsageMode: allUsageMode.value,
|
|
|
+ };
|
|
|
+ VE_API.order.confirm(data).then(({ code }) => {
|
|
|
+ if (code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: "下发处方成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ eventBus.emit("discover:submitForm");
|
|
|
+ // window.location.reload();
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const formatIndex = (index) => {
|
|
|
+ return String(index + 1).padStart(2, "0");
|
|
|
+};
|
|
|
+
|
|
|
+const handleTableData = (item) => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ typeName: item.typeName,
|
|
|
+ defaultName: item.defaultName,
|
|
|
+ executeStyle: 1,
|
|
|
+ ratio: item.ratio || item.defaultRatio,
|
|
|
+ usageMode: item.usageMode,
|
|
|
+ muUsage: item.muUsage,
|
|
|
+ unit: item.unit,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ typeName: item.typeName,
|
|
|
+ defaultName: item.defaultName,
|
|
|
+ executeStyle: 2,
|
|
|
+ ratio: item.ratio2,
|
|
|
+ usageMode: "---",
|
|
|
+ muUsage: item.muUsage2,
|
|
|
+ unit: item.unit,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+};
|
|
|
+
|
|
|
+const remove = () => {
|
|
|
+ ElMessageBox.confirm("是否要删除这个农事?", "警告", {
|
|
|
+ confirmButtonText: "删除",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ VE_API.farm.deleteFarmWork({ libId: infoItem.value.farmWorkLibId }).then(({ code }) => {
|
|
|
+ if (code === 0) {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!",
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ // router.go(-1);
|
|
|
+ router.replace("/expert_album?reload=true");
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import "./boxClass.scss";
|
|
|
+.recipe-box {
|
|
|
+ .recipe-title {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ .recipe-name {
|
|
|
+ color: #000000;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .recipe-btn {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #2199f8;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.prescription-result {
|
|
|
+ position: relative;
|
|
|
+ // border: 0.5px solid rgba(33, 153, 248, 0.5);
|
|
|
+ // border-radius: 4px;
|
|
|
+ // padding: 8px 10px 10px 10px;
|
|
|
+ &.has-wrap {
|
|
|
+ border: 0.5px solid rgba(33, 153, 248, 0.5);
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 8px 10px 10px 10px;
|
|
|
+ }
|
|
|
+ .result-index {
|
|
|
+ position: absolute;
|
|
|
+ left: -1px;
|
|
|
+ top: -1px;
|
|
|
+ padding: 0 8px;
|
|
|
+ background: #2199f8;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 12px;
|
|
|
+ border-radius: 4px 0 4px 0;
|
|
|
+ }
|
|
|
+ .result-title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ padding-bottom: 8px;
|
|
|
+ .title-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .name {
|
|
|
+ color: rgba(33, 153, 248, 0.85);
|
|
|
+ }
|
|
|
+ .value {
|
|
|
+ color: rgba(0, 0, 0, 0.4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .title-item + .title-item {
|
|
|
+ padding-left: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.use-mode {
|
|
|
+ color: rgba(0, 0, 0, 0.4);
|
|
|
+ padding: 2px 0 8px 0;
|
|
|
+ span {
|
|
|
+ color: #2199f8;
|
|
|
+ }
|
|
|
+}
|
|
|
+.new-wrap {
|
|
|
+ border-radius: 5px;
|
|
|
+ text-align: center;
|
|
|
+ border: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ .new-title {
|
|
|
+ background: #e0f2ff;
|
|
|
+ border-radius: 5px 5px 0 0;
|
|
|
+ border-bottom: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ display: flex;
|
|
|
+ color: rgba(33, 153, 248, 0.85);
|
|
|
+ // justify-content: space-around;
|
|
|
+ padding: 5px 6px;
|
|
|
+ font-size: 12px;
|
|
|
+ .table-name {
|
|
|
+ width: 24px;
|
|
|
+ font-size: 12px;
|
|
|
+ margin: 0 auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .title-1 {
|
|
|
+ width: 46px;
|
|
|
+ }
|
|
|
+ .title-2 {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ .title-3 {
|
|
|
+ width: 52px;
|
|
|
+ }
|
|
|
+ .title-4 {
|
|
|
+ width: 56px;
|
|
|
+ }
|
|
|
+ .title-5 {
|
|
|
+ width: 52px;
|
|
|
+ }
|
|
|
+ .new-table-wrap {
|
|
|
+ padding: 5px;
|
|
|
+ .new-prescription {
|
|
|
+ .new-table {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ border: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 5px;
|
|
|
+ color: rgba(0, 0, 0, 0.4);
|
|
|
+ font-size: 11px;
|
|
|
+ .line-l {
|
|
|
+ display: flex;
|
|
|
+ flex: 1;
|
|
|
+ .line-2 {
|
|
|
+ flex: 1;
|
|
|
+ padding: 0 2px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .line-r {
|
|
|
+ &.has-border {
|
|
|
+ border-left: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ }
|
|
|
+ .line-3 {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .sub-line {
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+ .line-4 {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ border-top: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ }
|
|
|
+ .execute-line {
|
|
|
+ border-right: 1px solid rgba(33, 153, 248, 0.5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ .note-text {
|
|
|
+ margin: 8px 0 4px 0;
|
|
|
+ color: rgba(0, 0, 0, 0.4);
|
|
|
+ background: #fff;
|
|
|
+ padding: 6px 8px;
|
|
|
+ border-radius: 5px;
|
|
|
+ text-align: left;
|
|
|
+ font-size: 11px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .new-prescription + .new-prescription {
|
|
|
+ padding-top: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|