| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534 |
- <template>
- <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
- <template #top>
- <ut-navbar title="创建种养殖任务" :fixed="false"></ut-navbar>
- </template>
- <view class="pt-24">
- <!-- 养殖 -->
- <template v-if="form.taskType == 2">
- <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
- <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
- <view class="bg-#fff pd-24 pb-0">
- <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
- </view>
- <view class="bg-#fff pd-24 mb-20 pt-0">
- <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
- <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
- <view class="w-100%" v-else>
- <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
- </view>
- </up-form-item>
- </view>
- <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
- <view class="bg-#fff pd-24 mb-20">
- <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
- <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
- </up-form-item>
- <ut-action-sheet v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
- <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
- <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-model="form.gapFlag" :tabs="pt_task_gap_flag" title="选择符合要求">
- <up-form-item borderBottom label="符合要求" required prop="gapFlag" id="gapFlagpppp">
- <view v-if="form.gapFlag" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_gap_flag, form.gapFlag) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择符合要求</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
- <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择养植的动物名称" style="flex: 1" />
- <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="养殖批号" required prop="plantationCode" id="plantationCodepppp">
- <view class="d-flex a-c j-sb w-100%">
- <view v-if="!form.plantationCode" class="flex1 c-#999">请生成养殖批号</view>
- <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
- <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
- </view>
- </up-form-item>
- <up-form-item label="请选择养殖技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
- <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
- </up-form-item>
- <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_feeding_method" title="选择养殖方式">
- <up-form-item borderBottom label="养殖方式" required prop="plantationMethod" id="plantationMethodpppp">
- <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_feeding_method, form.plantationMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择养殖方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <view class="h-1" id="queryType6pppp"></view>
- <up-form-item :borderBottom="false" label="养殖时间" required prop="queryType6">
- <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
- <view class="d-flex mr-20">
- <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择养殖开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
- <view class="d-flex">
- <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择养殖结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- </up-form-item>
- <up-form-item borderBottom label="养殖面积" required prop="plantingAmount" id="plantingAmountpppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入养殖面积" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="养殖区域" required prop="breedScale" id="breedScalepppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input v-model="form.breedScale" placeholder="请输入养殖区域" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">个</view>
- </view>
- </up-form-item>
- <view class="h-1" id="plantpppp"></view>
- <up-form-item label="养殖量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd">
- <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.plantingMgAmount" placeholder="请输入养殖量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_planting_mg_unit" title="选择单位">
- <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
- <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
- </up-form-item>
- </view>
- </up-form>
- </template>
- <!-- 种畜繁育 -->
- <template v-if="form.taskType == 21">
- <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules1" labelWidth="auto" ref="upFormRef">
- <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
- <view class="bg-#fff pd-24 pb-0">
- <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
- </view>
- <view class="bg-#fff pd-24 mb-20 pt-0">
- <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
- <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
- <view class="w-100%" v-else>
- <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
- </view>
- </up-form-item>
- </view>
- <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
- <view class="bg-#fff pd-24 mb-20">
- <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
- <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
- </up-form-item>
- <up-form-item borderBottom label="是否代繁育" required prop="delegateFlag" id="delegateFlagFlagpppp">
- <up-radio-group v-model="form.delegateFlag">
- <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
- </up-radio-group>
- </up-form-item>
- <up-form-item v-if="+(form?.delegateFlag ?? 0)" borderBottom label="委托企业" prop="delegateInfo">
- <view class="flex1">
- <ContactUnitInput v-model="form.delegateInfo.cpyid" v-model:info="form.delegate" :params="{ cpyType: '1' }" title="选择委托企业" placeholder="请选择委托企业信息"></ContactUnitInput>
- </view>
- </up-form-item>
- <ut-action-sheet v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
- <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
- <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
- <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择养植的动物名称" style="flex: 1" />
- <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="养殖批号" required prop="plantationCode" id="plantationCodepppp">
- <view class="d-flex a-c j-sb w-100%">
- <view v-if="!form.plantationCode" class="flex1 c-#999">请生成养殖批号</view>
- <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
- <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
- </view>
- </up-form-item>
- <up-form-item label="请选择养殖技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
- <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
- </up-form-item>
- <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_feeding_method" title="选择养殖方式">
- <up-form-item borderBottom label="养殖方式" prop="plantationMethod" id="plantationMethodpppp">
- <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_feeding_method, form.plantationMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择养殖方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <view class="h-1" id="queryType6pppp"></view>
- <up-form-item :borderBottom="false" label="养殖时间" required prop="queryType6">
- <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
- <view class="d-flex mr-20">
- <up-input v-model="form.queryType6.plannedStartDate" readonly placeholder="请选择养殖开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
- <view class="d-flex">
- <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择养殖结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- </up-form-item>
- <up-form-item borderBottom label="养殖面积" required prop="plantingAmount" id="plantingAmountpppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入养殖面积" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="养殖区域" required prop="breedScale" id="breedScalepppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input v-model="form.breedScale" placeholder="请输入养殖区域" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">个</view>
- </view>
- </up-form-item>
- <view class="h-1" id="plantpppp"></view>
- <up-form-item label="养殖量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd" id="plantingMgAmountpppp">
- <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.plantingMgAmount" placeholder="请输入养殖量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5" id="plantingMgUnitpppp"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_planting_mg_unit" title="选择单位">
- <up-form-item prop="plantingMgUnit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
- <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
- </up-form-item>
- </view>
- </up-form>
- </template>
- <!-- 种植 -->
- <template v-if="form.taskType == 1">
- <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules2" labelWidth="auto" ref="upFormRef">
- <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
- <view class="bg-#fff pd-24 pb-0">
- <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
- </view>
- <view class="bg-#fff pd-24 mb-20 pt-0">
- <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
- <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
- <view class="w-100%" v-else>
- <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
- </view>
- </up-form-item>
- </view>
- <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
- <view class="bg-#fff pd-24 mb-20">
- <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
- <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
- </up-form-item>
- <ut-action-sheet v-model="form.gapFlag" :tabs="pt_task_gap_flag" title="选择符合要求">
- <up-form-item borderBottom label="符合要求" required prop="gapFlag" id="gapFlagpppp">
- <view v-if="form.gapFlag" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_gap_flag, form.gapFlag) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择符合要求</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
- <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择种植的植物名称" style="flex: 1" />
- <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius w-100% p-rtv">
- <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="种植批号" required prop="plantationCode" id="plantationCodepppp">
- <view class="d-flex a-c j-sb w-100%">
- <view v-if="!form.plantationCode" class="flex1 c-#999">请生成种植批号</view>
- <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
- <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
- </view>
- </up-form-item>
- <up-form-item label="请选择种植技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
- <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
- </up-form-item>
- <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_plantation_method" title="选择种植方式">
- <up-form-item borderBottom label="种植方式" prop="plantationMethod" id="plantationMethodpppp">
- <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_method, form.plantationMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="种植面积" required prop="plantingAmount" id="plantingAmountpppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入种植面积" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">亩</view>
- </view>
- </up-form-item>
- <up-form-item label="种植量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd" id="plantingMgAmountpppp">
- <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.plantingMgAmount" placeholder="请输入种植量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5" id="plantingMgUnitpppp"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_area_unit" title="选择单位">
- <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_area_unit, form.plantingMgUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- </view>
- </up-form-item>
- <view class="h-1" id="queryType6pppp"></view>
- <up-form-item :borderBottom="false" label="种植时间" required prop="queryType6">
- <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
- <view class="d-flex mr-20">
- <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择种植开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
- <view class="d-flex">
- <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择种植结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- </up-form-item>
- <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
- <up-form-item borderBottom label="繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
- <view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择繁殖方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.plantationType" :tabs="pt_plantation_type" title="选择种植类型">
- <up-form-item borderBottom label="种植类型" prop="plantationType" id="plantationTypepppp">
- <view v-if="form.plantationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_type, form.plantationType) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植类型</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.sowingMethod" :tabs="pt_sowing_method" title="选择播种方法">
- <up-form-item borderBottom label="播种方法" prop="sowingMethod" id="sowingMethodpppp">
- <view v-if="form.sowingMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_sowing_method, form.sowingMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择播种方法</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.transplantMethod" :tabs="pt_transplant_method" title="选择移栽方法">
- <up-form-item borderBottom label="移栽方法" prop="transplantMethod" id="transplantMethodpppp">
- <view v-if="form.transplantMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_transplant_method, form.transplantMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择移栽方法</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
- <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
- <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
- <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
- </up-form-item>
- </view>
- </up-form>
- </template>
- <!-- 种苗繁育 -->
- <template v-if="form.taskType == 11">
- <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules3" labelWidth="auto" ref="upFormRef">
- <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
- <view class="bg-#fff pd-24 pb-0">
- <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
- </view>
- <view class="bg-#fff pd-24 mb-20 pt-0">
- <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
- <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
- <view class="w-100%" v-else>
- <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
- </view>
- </up-form-item>
- <up-form-item :borderBottom="false" label="具体位置" prop="baseId" id="baseIdpppp">
- <Go_button v-if="!laboratory" @click="openLaboratory" title="请选择具体位置" style="flex: 1" />
- <view class="w-100%" v-else>
- <laboratory :modeValue="laboratory" @close="handleLaboratoryClose" :baseType="form.taskType" />
- </view>
- </up-form-item>
- </view>
- <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
- <view class="bg-#fff pd-24 mb-20">
- <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
- <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
- </up-form-item>
- <up-form-item borderBottom label="是否代繁育" required prop="delegateFlag" id="delegateFlagFlagpppp">
- <up-radio-group v-model="form.delegateFlag">
- <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
- </up-radio-group>
- </up-form-item>
- <!-- <up-form-item borderBottom label="委托企业" required prop="delegateInfo" id="delegateInfopppp">
- <view v-if="!Enterprise" @click="$u.route({ type: 'navigateTo', url: '/plant/port/por-torganism/index' })" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
- <view class=""></view>
- <view class="f-s-34 c-primary">请选择委托企业</view>
- </view>
- <view v-if="Enterprise" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="Enterprise = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ form?.delegateInfo?.cusName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#666 f-s-24">{{ form?.delegateInfo?.crediteCode }}</text>
- </view>
- </view>
- </up-form-item> -->
- <up-form-item v-if="+(form?.delegateFlag ?? 0)" borderBottom label="委托企业" prop="delegateInfo">
- <view class="flex1">
- <ContactUnitInput v-model="form.delegateInfo.cpyid" v-model:info="form.delegate" :params="{ cpyType: '1' }" title="选择委托企业" placeholder="请选择委托企业信息"></ContactUnitInput>
- </view>
- </up-form-item>
- <ut-action-sheet v-if="+deawerData?.data[0]?.landType == 3" v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
- <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
- <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
- <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择种植的植物名称" style="flex: 1" />
- <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="繁育批号" required prop="plantationCode" id="plantationCodepppp">
- <view class="d-flex a-c j-sb w-100%">
- <view v-if="!form.plantationCode" class="flex1 c-#999">请生成繁育批号</view>
- <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
- <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
- </view>
- </up-form-item>
- <up-form-item label="请选择繁育技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
- <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
- </up-form-item>
- <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_plantation_method" title="选择繁育方式">
- <up-form-item borderBottom label="繁育方式" prop="plantationMethod" id="plantationMethodpppp">
- <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_method, form.plantationMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择繁育方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <view class="h-1" id="queryType6pppp"></view>
- <up-form-item :borderBottom="false" label="繁育日期" required prop="queryType6">
- <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
- <view class="d-flex mr-20">
- <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择种植开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
- <view class="d-flex">
- <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择种植结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
- </view>
- </ut-datetime-picker>
- </up-form-item>
- <up-form-item v-if="+deawerData?.data[0]?.landType == 1" borderBottom label="种植面积" required prop="plantingAmount" id="plantingAmountpppp">
- <view class="d-flex a-c j-sb w-100%">
- <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入种植面积" border="none"></up-input>
- <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
- </view>
- </up-form-item>
- <up-form-item v-if="+deawerData?.data[0]?.landType == 3" label="接种数量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd" id="plantingMgAmountpppp">
- <up-form-item prop="inoculationAmount" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.inoculationAmount" placeholder="请输入接种数量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5" id="plantingMgUnitpppp"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.inoculationUnit" :tabs="pt_inoculation_unit" title="选择单位">
- <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.inoculationUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_unit, form.inoculationUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- </view>
- </up-form-item>
- <up-form-item v-if="+deawerData?.data[0]?.landType == 3" label="接种剂量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd">
- <up-form-item prop="inoculationDosage" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.inoculationDosage" placeholder="请输入接种剂量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.inoculationDosageUnit" :tabs="pt_inoculation_dosage_unit" title="选择单位">
- <up-form-item prop="specUnit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.inoculationDosageUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_dosage_unit, form.inoculationDosageUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon class="mr-10" size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- <view class="pd2-0-10 c-#ccc d-flex d-c a-c">/</view>
- <view class="min-w-200">
- <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.inoculationUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_unit, form.inoculationUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#fff" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </view>
- </view>
- </up-form-item>
- <view class="h-1" id="plantpppp"></view>
- <up-form-item v-if="+deawerData?.data[0]?.landType == 3" borderBottom label="繁育量" prop="plant">
- <view class="d-flex a-c j-sb w-100%">
- <view class="f-s-30 c-333 f-w-5 w-100">{{ plantingMgAmount }}</view>
- <view v-if="plantingMgUnit" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_inoculation_dosage_unit, plantingMgUnit) }}</view>
- </view>
- </up-form-item>
- <!-- <up-form-item v-else borderBottom label="繁育量" required prop="plant">
- <up-input v-model="form.plant.plantingMgAmount" placeholder="请输入繁育量" border="none"></up-input>
- <ut-action-sheet v-model="form.plant.plantingMgUnit" :tabs="pt_feed_amount_unit" title="选择单位">
- <view class="d-flex a-c">
- <view v-if="form.plant?.plantingMgUnit" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_feed_amount_unit, form.plant?.plantingMgUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 w-100">单位</view>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </view>
- </ut-action-sheet>
- </up-form-item> -->
- <up-form-item v-else label="繁育量" required class="form-item-bottom-padding-0">
- <view class="flex1 d-flex">
- <view class="flex1 ov-hd" id="plantingMgAmountpppp">
- <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
- <up-input v-model="form.plantingMgAmount" placeholder="请输入繁育量" border="none" clearable></up-input>
- </up-form-item>
- </view>
- <view class="pd-5" id="plantingMgUnitpppp"></view>
- <view class="min-w-200">
- <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_feed_amount_unit" title="选择单位">
- <up-form-item prop="plantingMgUnit" border-bottom class="form-item-top-padding-0">
- <view class="flex1" style="line-height: 24px">
- <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_feed_amount_unit, form.plantingMgUnit) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
- </view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- </view>
- </view>
- </up-form-item>
- <!-- <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
- <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择培养基配方" style="flex: 1" />
- <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item> -->
- <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
- <up-form-item borderBottom label="选择繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
- <view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择选择繁殖方式</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.plantationType" :tabs="pt_plantation_type" title="选择种植类型">
- <up-form-item borderBottom label="种植类型" required prop="plantationType" id="plantationTypepppp">
- <view v-if="form.plantationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_type, form.plantationType) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植类型</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.sowingMethod" :tabs="pt_sowing_method" title="选择播种方法">
- <up-form-item borderBottom label="播种方法" required prop="sowingMethod" id="sowingMethodpppp">
- <view v-if="form.sowingMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_sowing_method, form.sowingMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择播种方法</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.transplantMethod" :tabs="pt_transplant_method" title="选择移栽方法">
- <up-form-item borderBottom label="移栽方法" required prop="transplantMethod" id="transplantMethodpppp">
- <view v-if="form.transplantMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_transplant_method, form.transplantMethod) }}</view>
- <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择移栽方法</view>
- <template #right>
- <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
- </template>
- </up-form-item>
- </ut-action-sheet>
- <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
- <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
- <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
- <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
- <view class="mb-20">
- <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
- </view>
- <view class="mb-20">
- <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
- </view>
- <view class="">
- <text class="c-#666 f-s-24">产出:</text>
- <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
- </view>
- </view>
- </up-form-item>
- <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
- <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
- </up-form-item>
- </view>
- </up-form>
- </template>
- <view v-if="+form.mgMethod == 2" class="">
- <view class="startline-title pl-24 ml-24 mb-16">个体标识信息</view>
- <view class="bg-#fff pd-24">
- <view class="d-flex pt-20 pb-20">
- <view class="">个体标识({{ animalIds.length }}个)</view>
- <view class="flex1"></view>
- <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c" @click="handleScanAdd">扫一扫添加</view>
- </view>
- <view class="d-flex gap-20 mb-20">
- <view
- @click="
- editIndex = -1;
- animalId = null;
- showAnimalIdDialog = true;
- "
- class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34"
- >手动输入添加</view
- >
- <view class="b-radius border-#A3E5EA c-#18BECA bg-#FAFFFF w-100% d-flex j-c a-c h-100 f-s-34">从种源库快速添加</view>
- </view>
- <up-swipe-action>
- <up-swipe-action-item class="mb-20" v-for="(item, index) in animalIds" :key="index" :index="item" :name="item" :options="options1" @click="clickSwipe">
- <view class="b-radius border-#37A954 c-#333 f-s-28 pd4-34-30-34-30">{{ item }}</view>
- </up-swipe-action-item>
- </up-swipe-action>
- </view>
- </view>
- </view>
- <template #bottom>
- <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
- <up-button type="warning" @click="saveDraft()">暂存</up-button>
- <up-button type="primary" @click="save()">提交</up-button>
- </view>
- </template>
- </z-paging>
- <ut-confirm-dialog v-model:show="showAnimalIdDialog" width="75vw" :title="editIndex === -1 ? '添加个体标识' : '修改个体标识'" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleAnimalIdConfirm" @cancel="handleAnimalIdCancel">
- <view class="">
- <view class="c-#333 f-s-28">个体标识号</view>
- <view class="">
- <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
- </view>
- </view>
- </ut-confirm-dialog>
- <!-- 添加drawer组件 -->
- <Drawer v-if="drawerVisible" :baseType="form.taskType" v-model="drawerVisible" @open="onDrawerOpen" @close="onDrawerClose" @confirm="onDrawerConfirm" />
- </template>
- <script setup lang="ts">
- import { ref } from 'vue';
- import Drawer from './models/drawer.vue';
- import Baseinfo from './models/baseinfo.vue';
- import { useClientRequest } from '@/utils/request';
- import type { TaskType, YesNoType, TimeRange, PlantInfo, DelegateInfo, InoculationInfo, LandInfo, BaseSelectData, PlantationTaskForm, FormRuleItem, FormRules } from './models/types';
- import Drawer_laboratory from './models/drawer_laboratory.vue';
- import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
- import Go_button from './models/go_button.vue';
- const { proxy } = getCurrentInstance() as ComponentInternalInstance;
- const { pt_feed_amount_unit, pt_planting_mg_unit, pt_inoculation_unit, pt_inoculation_dosage_unit, pt_transplant_method, pt_plantation_type, pt_sowing_method, pt_area_unit, pt_plantation_method, pt_reproduction_type, pt_scale_unit, pt_feeding_method, pt_mg_method, pt_task_gap_flag, pt_task_type, pt_org_type, yes_no } = toRefs<any>(
- proxy?.useDict('pt_feed_amount_unit', 'pt_planting_mg_unit', 'pt_inoculation_unit', 'pt_inoculation_dosage_unit', 'pt_transplant_method', 'pt_plantation_type', 'pt_sowing_method', 'pt_area_unit', 'pt_plantation_method', 'pt_reproduction_type', 'pt_scale_unit', 'pt_feeding_method', 'pt_mg_method', 'pt_task_gap_flag', 'pt_task_type', 'pt_org_type', 'yes_no'),
- );
- const form = ref<PlantationTaskForm>({
- deawerData: null,
- baseId: null,
- landIds: [],
- taskType: null,
- gapFlag: null,
- mgMethod: null,
- varietyId: null,
- plantationCode: null,
- plantationMethod: null,
- reproductionType: null,
- technicalFile: [],
- plantingUnit: null,
- breedScale: null,
- queryType6: {
- plannedStartDate: null,
- plannedEndDate: null,
- },
- plantingMgAmount: null,
- plantingMgUnit: null,
- plantingAmount: '',
- remark: null,
- delegateFlag: '0',
- delegateInfo: { cpyid: '', cusCode: '', cusName: '' },
- delegate: {},
- plantationType: null,
- sowingMethod: null,
- transplantMethod: null,
- preCropId: null,
- inoculationAmount: null,
- inoculationUnit: null,
- inoculationDosage: null,
- inoculationDosageUnit: null,
- cultureMediumFormula: null,
- landFlag: null,
- });
- const changeStartTime = () => {
- if (!form.value?.queryType6?.plannedEndDate) {
- form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
- }
- };
- // 单个溯源数组
- const animalIds = ref<any>([]);
- const animalId = ref();
- const editIndex = ref(-1); // 编辑索引,-1 表示添加模式
- const showAnimalIdDialog = ref(false); // 统一的弹框
- // 统一的确认方法
- const handleAnimalIdConfirm = () => {
- if (!animalId.value) {
- uni.showToast({
- title: '请输入个体标识号',
- icon: 'none',
- });
- return;
- }
- // 检查是否已存在(修改时排除自身)
- const index = animalIds.value.findIndex((item: any) => item == animalId.value);
- if (index !== -1 && index !== editIndex.value) {
- uni.showToast({
- title: '个体标识不可重复',
- icon: 'none',
- });
- return;
- }
- if (editIndex.value !== -1) {
- // 修改模式
- animalIds.value[editIndex.value] = animalId.value;
- } else {
- // 添加模式
- animalIds.value.push(animalId.value);
- }
- animalId.value = null;
- editIndex.value = -1;
- showAnimalIdDialog.value = false;
- };
- // 取消方法
- const handleAnimalIdCancel = () => {
- animalId.value = null;
- editIndex.value = -1;
- showAnimalIdDialog.value = false;
- };
- // 扫一扫添加个体标识
- const handleScanAdd = () => {
- uni.scanCode({
- success: (res) => {
- const scanResult = res.result;
- // 检查是否已存在
- if (animalIds.value.includes(scanResult)) {
- uni.showToast({
- title: '个体标识不可重复',
- icon: 'none',
- });
- return;
- }
- // 将扫描结果赋值给 animalId
- animalId.value = scanResult;
- editIndex.value = -1; // 添加模式
- // 调用统一的确认方法
- handleAnimalIdConfirm();
- },
- fail: (err) => {
- console.log('扫码失败', err);
- },
- });
- };
- // 使用 reactive 创建响应式对象
- const options1 = reactive([
- {
- text: '删除',
- style: {
- backgroundColor: '#F74C30',
- },
- },
- {
- text: '编辑',
- style: {
- backgroundColor: '#37A954',
- },
- },
- ]);
- // 自定义校验函数:养殖时间校验
- const validateBreedingTime = (rule: any, value: any, callback: any) => {
- if (!value) {
- callback(new Error('请选择养殖时间'));
- return;
- }
- const { plannedStartDate, plannedEndDate } = value;
- if (!plannedStartDate) {
- callback(new Error('请选择养殖开始时间'));
- return;
- }
- if (!plannedEndDate) {
- callback(new Error('请选择养殖结束时间'));
- return;
- }
- const startDate = new Date(plannedStartDate);
- const endDate = new Date(plannedEndDate);
- if (endDate < startDate) {
- callback(new Error('养殖结束时间必须晚于开始时间'));
- return;
- }
- callback();
- };
- // 自定义校验函数:养殖量校验
- const validateBreedingAmount = (rule: any, value: any, callback: any) => {
- if (+deawerData.value?.data[0]?.landType == 3) {
- callback();
- return;
- }
- if (!value) {
- callback(new Error('请输入养殖量'));
- return;
- }
- const { plantingMgAmount, plantingMgUnit } = value;
- if (!plantingMgAmount || plantingMgAmount.trim() === '') {
- callback(new Error('请输入养殖量'));
- return;
- }
- if (!plantingMgUnit) {
- callback(new Error('请选择养殖量单位'));
- return;
- }
- callback();
- };
- // 委托企业
- const Enterprise = ref('123');
- // 自定义delegateInfo 委托企业校验
- const validateDelegateInfo = (rule: any, value: any, callback: any) => {
- if (+(form.value?.delegateFlag ?? 0)) {
- if (!value) {
- callback(new Error('请选择委托企业'));
- return;
- }
- const { cpyid, crediteCode, cusName } = value;
- if (!cpyid) {
- callback(new Error('请选择委托企业'));
- return;
- }
- callback();
- } else {
- callback();
- }
- };
- //判断是否要填种植面积
- const validatePlantingAmount = (rule: any, value: any, callback: any) => {
- if (+deawerData.value?.data[0]?.landType == 1) {
- if (!value || value.trim() === '') {
- callback(new Error('请输入种植面积'));
- return;
- }
- callback();
- return;
- } else {
- callback();
- return;
- }
- };
- // 判断是否要填接种数量
- const validateinoculation = (rule: any, value: any, callback: any) => {
- if (+deawerData.value?.data[0]?.landType == 3) {
- console.log(form.value, 'form.value');
- if (!form.value?.inoculationUnit) {
- console.log(form.value?.inoculationUnit, 'form.value?.inoculationUnit');
- callback(new Error('请选择接种数量单位'));
- return;
- }
- if (!form.value?.inoculationAmount || form.value?.inoculationAmount.trim() === '') {
- console.log(form.value?.inoculationAmount, 'form.value?.inoculationAmount');
- callback(new Error('请输入接种数量'));
- return;
- }
- callback();
- } else {
- callback();
- }
- };
- const validateInoculationDosage = (rule: any, value: any, callback: any) => {
- if (+deawerData.value?.data[0]?.landType == 3) {
- // value 就是 form.inoculation.inoculationDosage 的值
- if (!form.value?.inoculationDosage || form.value?.inoculationDosage.trim() === '') {
- console.log(form.value?.inoculationDosage, 'form.value?.inoculationDosage');
- callback(new Error('请输入接种剂量'));
- return;
- }
- console.log(form.value);
- // 检查单位是否选择
- if (!form.value?.inoculationDosageUnit) {
- console.log(form.value?.inoculationDosageUnit, 'form.value?.inoculationDosageUnit');
- callback(new Error('请选择接种剂量单位'));
- return;
- }
- callback();
- } else {
- callback();
- }
- };
- // 判断溯源级别是否需要校验
- const validateMgMethod = (rule: any, value: any, callback: any) => {
- if (+deawerData.value?.data[0]?.landType == 3) {
- if (!value) {
- callback(new Error('请选择溯源级别'));
- return;
- }
- callback();
- } else {
- callback();
- }
- };
- const rules = reactive({
- baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
- taskType: [{ required: true, message: '请选择任务类型' }],
- mgMethod: [{ required: true, message: '请选择溯源级别' }],
- gapFlag: [{ required: true, message: '请选择符合要求' }],
- varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
- plantationCode: [{ required: true, message: '请输入养殖批号' }],
- technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
- plantationMethod: [{ required: true, message: '请选择养殖方式' }],
- queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
- plantingAmount: [{ required: true, message: '请输入养殖面积' }],
- breedScale: [{ required: true, message: '请输入养殖区域' }],
- plantingMgUnit: [{ required: true, message: '请选择养殖单位' }],
- plantingMgAmount: [{ required: true, message: '请输入养殖量' }],
- remark: [{ required: false, message: '请输入备注' }],
- });
- const rules1 = reactive({
- baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
- taskType: [{ required: true, message: '请选择任务类型' }],
- delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
- delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
- mgMethod: [{ required: true, message: '请选择溯源级别' }],
- varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
- plantationCode: [{ required: true, message: '请输入养殖批号' }],
- technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
- plantationMethod: [{ required: false, message: '请选择养殖方式' }],
- queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
- plantingAmount: [{ required: true, message: '请输入养殖面积' }],
- breedScale: [{ required: true, message: '请输入养殖区域' }],
- plantingMgUnit: [{ required: true, message: '请选择养殖单位' }],
- plantingMgAmount: [{ required: true, message: '请输入养殖量' }],
- remark: [{ required: false, message: '请输入备注' }],
- });
- const rules2 = reactive({
- baseId: [{ required: true, message: '请选择种植所在的基地' }],
- taskType: [{ required: true, message: '请选择任务类型' }],
- gapFlag: [{ required: true, message: '请选择符合要求' }],
- varietyId: [{ required: true, message: '请选择种植的植物名称' }],
- plantationCode: [{ required: true, message: '请输入种植批号' }],
- technicalFile: [{ required: false, message: '请选择种植技术规程文件' }],
- plantationMethod: [{ required: false, message: '请选择种植方式' }],
- queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
- plantingAmount: [{ required: true, message: '请输入种植面积' }],
- plantingMgUnit: [{ required: true, message: '请选择种植单位' }],
- plantingMgAmount: [{ required: true, message: '请输入种植量' }],
- remark: [{ required: false, message: '请输入备注' }],
- preCropId: [{ required: false, message: '请选择前茬植物' }],
- reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
- });
- const rules3 = reactive({
- baseId: [{ required: true, message: '请选择种植所在的基地' }],
- taskType: [{ required: true, message: '请选择任务类型' }],
- delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
- delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
- mgMethod: [{ validator: validateMgMethod, trigger: 'blur' }],
- varietyId: [{ required: true, message: '请选择种植的植物名称' }],
- plantationCode: [{ required: true, message: '请输入种植批号' }],
- technicalFile: [{ required: false, message: '请选择繁育技术规程文件' }],
- plantationMethod: [{ required: false, message: '请选择繁育方式' }],
- queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
- plantingAmount: [{ validator: validatePlantingAmount, trigger: 'blur' }],
- plantingMgUnit: [{ required: true, message: '请选择繁育单位' }],
- plantingMgAmount: [{ required: true, message: '请输入繁育数量' }],
- inoculationAmount: [{ validator: validateinoculation }],
- inoculationUnit: [{ validator: validateinoculation }],
- inoculationDosage: [{ validator: validateInoculationDosage }],
- inoculationDosageUnit: [{ validator: validateInoculationDosage }],
- remark: [{ required: false, message: '请输入备注' }],
- preCropId: [{ required: false, message: '请选择前茬植物' }],
- reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
- });
- const upFormRef = ref<any>();
- const paging = ref<any>();
- const list = ref<unknown>([]);
- // 控制抽屉显示状态
- const drawerVisible = ref(false);
- // 打开抽屉
- function openDrawer() {
- drawerVisible.value = true;
- }
- // 关闭抽屉
- function closeDrawer() {
- drawerVisible.value = false;
- }
- // 处理抽屉打开事件
- function onDrawerOpen() {
- console.log('抽屉打开了');
- }
- // 处理抽屉关闭事件
- function onDrawerClose() {
- console.log('抽屉关闭了');
- }
- const deawerData = ref<any>(null);
- // 处理抽屉确认事件
- function onDrawerConfirm(data: any) {
- console.log('收到基地选择数据:', data);
- deawerData.value = data;
- // 确认基地id
- form.value.baseId = data.data[0]?.baseId;
- //确认地块面积
- if (+data.data[0]?.landType !== 3) {
- form.value.plantingAmount = '';
- data.data.forEach((i: LandInfo) => {
- form.value.plantingAmount += i.area;
- });
- }
- //确认养殖区域的个数
- form.value.breedScale = data.data?.length;
- if (data?.aloneChecked) {
- form.value.landFlag = 1;
- form.value.landIds = data?.checkBox;
- } else {
- form.value.landIds = data?.checkBox;
- form.value.landFlag = 0;
- }
- }
- // 处理Baseinfo组件的关闭事件
- function handleBaseinfoClose() {
- deawerData.value = null;
- }
- // 所选动植物
- const Biological = ref<any>(null);
- // 所选前茬植物
- const PreBiological = ref<any>(null);
- //随机生成
- const randomCode = async () => {
- let plType = '';
- const taskType = form.value.taskType;
- if (taskType === 1) {
- plType = 'P';
- } else if (taskType === 2) {
- plType = 'F';
- } else {
- plType = 'C';
- }
- const code = await useClientRequest.post('/plt-api/app/plantationTask/getBatchCode', { plType: plType, linkType: plType });
- form.value.plantationCode = code.data;
- };
- //完成提交表单
- const save = () => {
- uni.$u.debounce(async () => {
- try {
- console.log('开始提交');
- await upFormRef.value?.validate();
- console.log('校验完成');
- if (+(form.value.delegateFlag ?? 0)) {
- form.value.delegateInfo.cusName = form.value?.delegate.cusName;
- form.value.delegateInfo.cusCode = form.value?.delegate.cusCode;
- } else {
- form.value.delegateInfo = null as any;
- form.value.delegate = null as any;
- }
- const params = {
- ...form.value,
- ...form.value.queryType6,
- ...form.value.inoculation,
- animalIds: animalIds.value,
- };
- console.log('提交参数:', params);
- let res = null;
- if (isEdit.value) {
- res = await useClientRequest.post('/plt-api/app/plantationTask/updateTask', params);
- } else {
- res = await useClientRequest.post('/plt-api/app/plantationTask/saveTask', params);
- }
- if (res.code == 200) {
- uni.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000,
- });
- uni.$emit('refreshportList');
- setTimeout(() => {
- uni.navigateBack();
- }, 1000);
- }
- } catch (error: any) {
- // 滚动到第一个错误字段
- console.log(error);
- const firstErrorField = error && error[0].field + 'pppp';
- paging.value?.scrollIntoViewById(firstErrorField, 30, true);
- return;
- }
- }, 500, true);
- };
- // 暂存
- const saveDraft = () => {
- uni.$u.debounce(async () => {
- try {
- const params = {
- ...form.value,
- ...form.value.queryType6,
- animalIds: animalIds.value,
- };
- if (form.value?.delegate?.cusCode) {
- form.value.delegateInfo.cusName = form.value?.delegate?.cusName;
- form.value.delegateInfo.cusCode = form.value?.delegate?.cusCode;
- }
- console.log('暂存参数:', params);
- const res = await useClientRequest.post('/plt-api/app/plantationTask/draftTask', params);
- if (res.code == 200) {
- uni.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000,
- });
- setTimeout(() => {
- uni.navigateBack();
- }, 1000);
- }
- } catch (error: any) {
- console.log(error, 'error');
- }
- }, 500, true);
- };
- const clickSwipe = async (name: any, index: number) => {
- if (name?.index == 0) {
- const res = await uni.showModal({
- title: '删除提示',
- content: '删除后不可撤回,请谨慎操作!',
- confirmColor: '#F74C30',
- });
- if (!res.confirm) return;
- await uni.showLoading({
- title: '删除中...',
- mask: true,
- });
- const findindex = animalIds.value.findIndex((i) => i == name?.name);
- animalIds.value.splice(findindex, 1);
- uni.hideLoading();
- uni.showToast({
- title: '删除成功',
- icon: 'success',
- });
- } else {
- // 编辑模式:设置编辑索引和 animalId
- editIndex.value = animalIds.value.findIndex((item: any) => item == name?.name);
- animalId.value = name?.name;
- showAnimalIdDialog.value = true;
- }
- };
- // 如果是组培实验室的话,繁育量是一个计算属性
- const plantingMgAmount = computed(() => {
- // 安全访问嵌套属性
- if (Number(deawerData.value?.data?.[0]?.landType) !== 3) {
- return '';
- }
- const inoculationAmount = Number(form.value?.inoculationAmount);
- const inoculationDosage = Number(form.value?.inoculationDosage);
- // 如果任一值为无效数字,返回空字符串
- if (!inoculationAmount || !inoculationDosage || isNaN(inoculationAmount) || isNaN(inoculationDosage)) {
- return '';
- }
- const result = inoculationAmount * inoculationDosage;
- form.value.plantingMgAmount = result;
- // 返回计算结果,保持数字类型或空字符串
- return isNaN(result) ? '' : result;
- });
- // 如果是组培实验室的话,繁育量单位是一个计算属性
- const plantingMgUnit = computed(() => {
- if (Number(deawerData.value?.data?.[0]?.landType) == 3) {
- form.value.plantingMgUnit = form.value?.inoculationDosageUnit || null;
- return form.value.plantingMgUnit;
- }
- return null;
- });
- const laboratory = ref<any>();
- // 控制抽屉显示状态
- // 处理实验室的关闭
- function handleLaboratoryClose() {
- laboratory.value = null;
- }
- // 处理实验室的打开
- function openLaboratory() {
- uni.$on('cultivationLocationSelected', function (data) {
- console.log(data);
- });
- uni.$u.route({
- type: 'navigateTo',
- url: '/tools/select-cultivation-location/index',
- })
- }
- // 处理抽屉确认事件
- function handleLaboratoryConfirm(data: any) {
- console.log('收到基地选择数据:', data);
- }
- const taskId = ref();
- //是否是修改的标志
- const isEdit = ref(false);
- //是否是复制
- const isCopy = ref(false);
- onLoad((options) => {
- if (!options?.taskType && options?.taskId) {
- taskId.value = options?.taskId;
- isEdit.value = true;
- if (options?.copy) {
- isCopy.value = true;
- }
- } else {
- form.value.taskType = options?.taskType;
- if (+options?.taskType == 1 || +options?.taskType == 11) {
- form.value.plantingUnit = '亩';
- if (+options?.taskType == 11) {
- form.value.gapFlag = 0;
- }
- } else {
- form.value.plantingUnit = '平方米';
- if (+options?.taskType == 21) {
- form.value.gapFlag = 0;
- }
- }
- }
- });
- const gotoTorganism = (type: number) => {
- if (type == 1) {
- uni.$once('updateBiologicalname', function (data) {
- Biological.value = data.msg;
- console.log(Biological.value);
- form.value.varietyId = data.msg.id;
- });
- } else {
- uni.$once('updateBiologicalname', function (data) {
- PreBiological.value = data.msg;
- form.value.preCropId = data.msg.id;
- });
- }
- uni.navigateTo({
- url: '/tools/por-torganism/index',
- });
- };
- // 查看是否有缓存的信息
- const getCache = async (taskType: TaskType | null) => {
- const res = await useClientRequest.get(`/plt-api/app/plantationTask/getDraft/${taskType}`);
- if (!res.data) return;
- form.value = res.data;
- form.value.queryType6 = {
- plannedStartDate: res.data.plannedStartDate,
- plannedEndDate: res.data.plannedEndDate,
- };
- form.value.delegate = {
- cusCode: form.value.delegateInfo?.cusCode,
- cusName: form.value.delegateInfo?.cusName,
- };
- if (res.data.animalIds) {
- animalIds.value = res.data.animalIds;
- }
- if (res.data.preCropCode) {
- PreBiological.value = {};
- const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
- PreBiological.value = Bio.data;
- }
- if (res.data.varietyCode) {
- Biological.value = {};
- const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
- Biological.value = Bio.data;
- }
- // 判断有没有基地,然后去获取基地数据
- if (res.data.baseId) {
- deawerData.value = {};
- deawerData.value.baseName = res.data.baseRef.baseName;
- deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
- deawerData.value.area = res.data.baseRef.baseInfo.area;
- deawerData.value.address = res.data.baseRef.baseInfo.address;
- // adcodeName
- deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
- if (+res.data.landFlag) {
- deawerData.value.aloneChecked = true;
- const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
- deawerData.value.data = landIds.rows;
- } else {
- deawerData.value.aloneChecked = false;
- deawerData.value.data = [];
- const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
- //找到res.data.landIds和landIds.rows中的id相同的项
- landIds.rows.forEach((i: any) => {
- if (res.data.landIds.find((t: any) => t == i.id)) {
- deawerData.value.data.push(i);
- }
- });
- }
- }
- };
- // 获取详细数据
- const getInfo = async (taskId: any) => {
- const res = await useClientRequest.get<any>(`/plt-api/app/plantationTask/getInfo/${taskId}`);
- if (!res.data) return;
- form.value = res.data;
- form.value.queryType6 = {
- plannedStartDate: res.data.plannedStartDate,
- plannedEndDate: res.data.plannedEndDate,
- };
- form.value.delegate = {
- cusCode: form.value.delegateInfo?.cusCode,
- cusName: form.value.delegateInfo?.cusName,
- };
- if (res.data.animalIds) {
- animalIds.value = res.data.animalIds;
- }
- if (res.data.preCropCode) {
- PreBiological.value = {};
- const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
- PreBiological.value = Bio.data;
- }
- if (res.data.varietyCode) {
- Biological.value = {};
- const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
- Biological.value = Bio.data;
- }
- // 判断有没有基地,然后去获取基地数据
- if (res.data.baseId) {
- deawerData.value = {};
- deawerData.value.baseName = res.data.baseRef.baseName;
- deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
- deawerData.value.area = res.data.baseRef.baseInfo.area;
- deawerData.value.address = res.data.baseRef.baseInfo.address;
- // adcodeName
- deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
- if (+res.data.landFlag) {
- deawerData.value.aloneChecked = true;
- const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
- deawerData.value.data = landIds.rows;
- } else {
- deawerData.value.aloneChecked = false;
- deawerData.value.data = [];
- const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
- //找到res.data.landIds和landIds.rows中的id相同的项
- landIds.rows.forEach((i: any) => {
- if (res.data.landIds.find((t: any) => t == i.id)) {
- deawerData.value.data.push(i);
- }
- });
- }
- }
- if (isCopy.value) {
- form.value.plantationCode = null;
- form.value.queryType6.plannedStartDate = null;
- form.value.queryType6.plannedEndDate = null;
- form.value.plantingMgAmount = null;
- animalIds.value = [];
- animalId.value = null;
- }
- };
- onMounted(() => {
- if (taskId.value) {
- getInfo(taskId.value);
- } else {
- getCache(form.value.taskType);
- }
- });
- </script>
- <style lang="scss" scoped>
- :deep(.form-item-top-padding-0) {
- > .u-form-item__body {
- padding-top: 0rpx;
- }
- }
- :deep(.form-item-bottom-padding-0) {
- > .u-form-item__body {
- padding-bottom: 0rpx;
- }
- }
- </style>
|