index.vue 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" safe-area-inset-bottom>
  3. <template #top>
  4. <ut-navbar title="创建种养殖任务" :fixed="false"></ut-navbar>
  5. </template>
  6. <view class="pt-24">
  7. <!-- 养殖 -->
  8. <template v-if="form.taskType == 2">
  9. <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
  10. <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
  11. <view class="bg-#fff pd-24 pb-0">
  12. <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
  13. </view>
  14. <view class="bg-#fff pd-24 mb-20 pt-0">
  15. <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
  16. <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
  17. <view class="w-100%" v-else>
  18. <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
  19. </view>
  20. </up-form-item>
  21. </view>
  22. <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
  23. <view class="bg-#fff pd-24 mb-20">
  24. <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
  25. <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
  26. </up-form-item>
  27. <ut-action-sheet v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
  28. <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
  29. <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
  30. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
  31. <template #right>
  32. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  33. </template>
  34. </up-form-item>
  35. </ut-action-sheet>
  36. <ut-action-sheet v-model="form.gapFlag" :tabs="pt_task_gap_flag" title="选择符合要求">
  37. <up-form-item borderBottom label="符合要求" required prop="gapFlag" id="gapFlagpppp">
  38. <view v-if="form.gapFlag" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_gap_flag, form.gapFlag) }}</view>
  39. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择符合要求</view>
  40. <template #right>
  41. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  42. </template>
  43. </up-form-item>
  44. </ut-action-sheet>
  45. <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
  46. <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择养植的动物名称" style="flex: 1" />
  47. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  48. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  49. <view class="mb-20">
  50. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  51. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  52. </view>
  53. <view class="mb-20">
  54. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  55. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  56. </view>
  57. <view class="">
  58. <text class="c-#666 f-s-24">产出:</text>
  59. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  60. </view>
  61. </view>
  62. </up-form-item>
  63. <up-form-item borderBottom label="养殖批号" required prop="plantationCode" id="plantationCodepppp">
  64. <view class="d-flex a-c j-sb w-100%">
  65. <view v-if="!form.plantationCode" class="flex1 c-#999">请生成养殖批号</view>
  66. <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
  67. <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
  68. </view>
  69. </up-form-item>
  70. <up-form-item label="请选择养殖技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
  71. <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
  72. </up-form-item>
  73. <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_feeding_method" title="选择养殖方式">
  74. <up-form-item borderBottom label="养殖方式" required prop="plantationMethod" id="plantationMethodpppp">
  75. <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_feeding_method, form.plantationMethod) }}</view>
  76. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择养殖方式</view>
  77. <template #right>
  78. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  79. </template>
  80. </up-form-item>
  81. </ut-action-sheet>
  82. <view class="h-1" id="queryType6pppp"></view>
  83. <up-form-item :borderBottom="false" label="养殖时间" required prop="queryType6">
  84. <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
  85. <view class="d-flex mr-20">
  86. <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择养殖开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
  87. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  88. </view>
  89. </ut-datetime-picker>
  90. <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
  91. <view class="d-flex">
  92. <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择养殖结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
  93. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  94. </view>
  95. </ut-datetime-picker>
  96. </up-form-item>
  97. <up-form-item borderBottom label="养殖面积" required prop="plantingAmount" id="plantingAmountpppp">
  98. <view class="d-flex a-c j-sb w-100%">
  99. <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入养殖面积" border="none"></up-input>
  100. <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
  101. </view>
  102. </up-form-item>
  103. <up-form-item borderBottom label="养殖区域" required prop="breedScale" id="breedScalepppp">
  104. <view class="d-flex a-c j-sb w-100%">
  105. <up-input v-model="form.breedScale" placeholder="请输入养殖区域" border="none"></up-input>
  106. <view class="c-#333 f-s-32 f-w-5">个</view>
  107. </view>
  108. </up-form-item>
  109. <view class="h-1" id="plantpppp"></view>
  110. <up-form-item label="养殖量" required class="form-item-bottom-padding-0">
  111. <view class="flex1 d-flex">
  112. <view class="flex1 ov-hd">
  113. <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
  114. <up-input v-model="form.plantingMgAmount" placeholder="请输入养殖量" border="none" clearable></up-input>
  115. </up-form-item>
  116. </view>
  117. <view class="pd-5"></view>
  118. <view class="min-w-200">
  119. <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_planting_mg_unit" title="选择单位">
  120. <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
  121. <view class="flex1" style="line-height: 24px">
  122. <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) }}</view>
  123. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  124. </view>
  125. <template #right>
  126. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  127. </template>
  128. </up-form-item>
  129. </ut-action-sheet>
  130. </view>
  131. </view>
  132. </up-form-item>
  133. <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
  134. <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
  135. </up-form-item>
  136. </view>
  137. </up-form>
  138. </template>
  139. <!-- 种畜繁育 -->
  140. <template v-if="form.taskType == 21">
  141. <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules1" labelWidth="auto" ref="upFormRef">
  142. <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
  143. <view class="bg-#fff pd-24 pb-0">
  144. <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
  145. </view>
  146. <view class="bg-#fff pd-24 mb-20 pt-0">
  147. <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
  148. <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
  149. <view class="w-100%" v-else>
  150. <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
  151. </view>
  152. </up-form-item>
  153. </view>
  154. <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
  155. <view class="bg-#fff pd-24 mb-20">
  156. <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
  157. <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
  158. </up-form-item>
  159. <up-form-item borderBottom label="是否代繁育" required prop="delegateFlag" id="delegateFlagFlagpppp">
  160. <up-radio-group v-model="form.delegateFlag">
  161. <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
  162. </up-radio-group>
  163. </up-form-item>
  164. <up-form-item v-if="+(form?.delegateFlag ?? 0)" borderBottom label="委托企业" prop="delegateInfo">
  165. <view class="flex1">
  166. <ContactUnitInput v-model="form.delegateInfo.cpyid" v-model:info="form.delegate" :params="{ cpyType: '1' }" title="选择委托企业" placeholder="请选择委托企业信息"></ContactUnitInput>
  167. </view>
  168. </up-form-item>
  169. <ut-action-sheet v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
  170. <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
  171. <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
  172. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
  173. <template #right>
  174. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  175. </template>
  176. </up-form-item>
  177. </ut-action-sheet>
  178. <up-form-item borderBottom label="动物名称" required prop="varietyId" id="varietyIdpppp">
  179. <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择养植的动物名称" style="flex: 1" />
  180. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  181. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  182. <view class="mb-20">
  183. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  184. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  185. </view>
  186. <view class="mb-20">
  187. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  188. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  189. </view>
  190. <view class="">
  191. <text class="c-#666 f-s-24">产出:</text>
  192. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  193. </view>
  194. </view>
  195. </up-form-item>
  196. <up-form-item borderBottom label="养殖批号" required prop="plantationCode" id="plantationCodepppp">
  197. <view class="d-flex a-c j-sb w-100%">
  198. <view v-if="!form.plantationCode" class="flex1 c-#999">请生成养殖批号</view>
  199. <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
  200. <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
  201. </view>
  202. </up-form-item>
  203. <up-form-item label="请选择养殖技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
  204. <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
  205. </up-form-item>
  206. <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_feeding_method" title="选择养殖方式">
  207. <up-form-item borderBottom label="养殖方式" prop="plantationMethod" id="plantationMethodpppp">
  208. <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_feeding_method, form.plantationMethod) }}</view>
  209. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择养殖方式</view>
  210. <template #right>
  211. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  212. </template>
  213. </up-form-item>
  214. </ut-action-sheet>
  215. <view class="h-1" id="queryType6pppp"></view>
  216. <up-form-item :borderBottom="false" label="养殖时间" required prop="queryType6">
  217. <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
  218. <view class="d-flex mr-20">
  219. <up-input v-model="form.queryType6.plannedStartDate" readonly placeholder="请选择养殖开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
  220. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  221. </view>
  222. </ut-datetime-picker>
  223. <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
  224. <view class="d-flex">
  225. <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择养殖结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
  226. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  227. </view>
  228. </ut-datetime-picker>
  229. </up-form-item>
  230. <up-form-item borderBottom label="养殖面积" required prop="plantingAmount" id="plantingAmountpppp">
  231. <view class="d-flex a-c j-sb w-100%">
  232. <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入养殖面积" border="none"></up-input>
  233. <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
  234. </view>
  235. </up-form-item>
  236. <up-form-item borderBottom label="养殖区域" required prop="breedScale" id="breedScalepppp">
  237. <view class="d-flex a-c j-sb w-100%">
  238. <up-input v-model="form.breedScale" placeholder="请输入养殖区域" border="none"></up-input>
  239. <view class="c-#333 f-s-32 f-w-5">个</view>
  240. </view>
  241. </up-form-item>
  242. <view class="h-1" id="plantpppp"></view>
  243. <up-form-item label="养殖量" required class="form-item-bottom-padding-0">
  244. <view class="flex1 d-flex">
  245. <view class="flex1 ov-hd" id="plantingMgAmountpppp">
  246. <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
  247. <up-input v-model="form.plantingMgAmount" placeholder="请输入养殖量" border="none" clearable></up-input>
  248. </up-form-item>
  249. </view>
  250. <view class="pd-5" id="plantingMgUnitpppp"></view>
  251. <view class="min-w-200">
  252. <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_planting_mg_unit" title="选择单位">
  253. <up-form-item prop="plantingMgUnit" border-bottom class="form-item-top-padding-0">
  254. <view class="flex1" style="line-height: 24px">
  255. <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_planting_mg_unit, form.plantingMgUnit) }}</view>
  256. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  257. </view>
  258. <template #right>
  259. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  260. </template>
  261. </up-form-item>
  262. </ut-action-sheet>
  263. </view>
  264. </view>
  265. </up-form-item>
  266. <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
  267. <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
  268. </up-form-item>
  269. </view>
  270. </up-form>
  271. </template>
  272. <!-- 种植 -->
  273. <template v-if="form.taskType == 1">
  274. <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules2" labelWidth="auto" ref="upFormRef">
  275. <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
  276. <view class="bg-#fff pd-24 pb-0">
  277. <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
  278. </view>
  279. <view class="bg-#fff pd-24 mb-20 pt-0">
  280. <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
  281. <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
  282. <view class="w-100%" v-else>
  283. <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
  284. </view>
  285. </up-form-item>
  286. </view>
  287. <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
  288. <view class="bg-#fff pd-24 mb-20">
  289. <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
  290. <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
  291. </up-form-item>
  292. <ut-action-sheet v-model="form.gapFlag" :tabs="pt_task_gap_flag" title="选择符合要求">
  293. <up-form-item borderBottom label="符合要求" required prop="gapFlag" id="gapFlagpppp">
  294. <view v-if="form.gapFlag" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_gap_flag, form.gapFlag) }}</view>
  295. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择符合要求</view>
  296. <template #right>
  297. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  298. </template>
  299. </up-form-item>
  300. </ut-action-sheet>
  301. <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
  302. <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择种植的植物名称" style="flex: 1" />
  303. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius w-100% p-rtv">
  304. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  305. <view class="mb-20">
  306. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  307. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  308. </view>
  309. <view class="mb-20">
  310. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  311. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  312. </view>
  313. <view class="">
  314. <text class="c-#666 f-s-24">产出:</text>
  315. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  316. </view>
  317. </view>
  318. </up-form-item>
  319. <up-form-item borderBottom label="种植批号" required prop="plantationCode" id="plantationCodepppp">
  320. <view class="d-flex a-c j-sb w-100%">
  321. <view v-if="!form.plantationCode" class="flex1 c-#999">请生成种植批号</view>
  322. <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
  323. <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
  324. </view>
  325. </up-form-item>
  326. <up-form-item label="请选择种植技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
  327. <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
  328. </up-form-item>
  329. <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_plantation_method" title="选择种植方式">
  330. <up-form-item borderBottom label="种植方式" prop="plantationMethod" id="plantationMethodpppp">
  331. <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_method, form.plantationMethod) }}</view>
  332. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植方式</view>
  333. <template #right>
  334. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  335. </template>
  336. </up-form-item>
  337. </ut-action-sheet>
  338. <up-form-item borderBottom label="种植面积" required prop="plantingAmount" id="plantingAmountpppp">
  339. <view class="d-flex a-c j-sb w-100%">
  340. <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入种植面积" border="none"></up-input>
  341. <view class="c-#333 f-s-32 f-w-5">亩</view>
  342. </view>
  343. </up-form-item>
  344. <up-form-item label="种植量" required class="form-item-bottom-padding-0">
  345. <view class="flex1 d-flex">
  346. <view class="flex1 ov-hd" id="plantingMgAmountpppp">
  347. <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
  348. <up-input v-model="form.plantingMgAmount" placeholder="请输入种植量" border="none" clearable></up-input>
  349. </up-form-item>
  350. </view>
  351. <view class="pd-5" id="plantingMgUnitpppp"></view>
  352. <view class="min-w-200">
  353. <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_area_unit" title="选择单位">
  354. <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
  355. <view class="flex1" style="line-height: 24px">
  356. <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_area_unit, form.plantingMgUnit) }}</view>
  357. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  358. </view>
  359. <template #right>
  360. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  361. </template>
  362. </up-form-item>
  363. </ut-action-sheet>
  364. </view>
  365. </view>
  366. </up-form-item>
  367. <view class="h-1" id="queryType6pppp"></view>
  368. <up-form-item :borderBottom="false" label="种植时间" required prop="queryType6">
  369. <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
  370. <view class="d-flex mr-20">
  371. <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择种植开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
  372. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  373. </view>
  374. </ut-datetime-picker>
  375. <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
  376. <view class="d-flex">
  377. <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择种植结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
  378. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  379. </view>
  380. </ut-datetime-picker>
  381. </up-form-item>
  382. <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
  383. <up-form-item borderBottom label="繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
  384. <view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
  385. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择繁殖方式</view>
  386. <template #right>
  387. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  388. </template>
  389. </up-form-item>
  390. </ut-action-sheet>
  391. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.plantationType" :tabs="pt_plantation_type" title="选择种植类型">
  392. <up-form-item borderBottom label="种植类型" prop="plantationType" id="plantationTypepppp">
  393. <view v-if="form.plantationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_type, form.plantationType) }}</view>
  394. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植类型</view>
  395. <template #right>
  396. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  397. </template>
  398. </up-form-item>
  399. </ut-action-sheet>
  400. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.sowingMethod" :tabs="pt_sowing_method" title="选择播种方法">
  401. <up-form-item borderBottom label="播种方法" prop="sowingMethod" id="sowingMethodpppp">
  402. <view v-if="form.sowingMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_sowing_method, form.sowingMethod) }}</view>
  403. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择播种方法</view>
  404. <template #right>
  405. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  406. </template>
  407. </up-form-item>
  408. </ut-action-sheet>
  409. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.transplantMethod" :tabs="pt_transplant_method" title="选择移栽方法">
  410. <up-form-item borderBottom label="移栽方法" prop="transplantMethod" id="transplantMethodpppp">
  411. <view v-if="form.transplantMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_transplant_method, form.transplantMethod) }}</view>
  412. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择移栽方法</view>
  413. <template #right>
  414. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  415. </template>
  416. </up-form-item>
  417. </ut-action-sheet>
  418. <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
  419. <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
  420. <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  421. <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  422. <view class="mb-20">
  423. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
  424. <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
  425. </view>
  426. <view class="mb-20">
  427. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
  428. <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
  429. </view>
  430. <view class="">
  431. <text class="c-#666 f-s-24">产出:</text>
  432. <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
  433. </view>
  434. </view>
  435. </up-form-item>
  436. <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
  437. <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
  438. </up-form-item>
  439. </view>
  440. </up-form>
  441. </template>
  442. <!-- 种苗繁育 -->
  443. <template v-if="form.taskType == 11">
  444. <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules3" labelWidth="auto" ref="upFormRef">
  445. <view class="startline-title pl-24 ml-24 mb-16">基地信息</view>
  446. <view class="bg-#fff pd-24 pb-0">
  447. <view class="b-radius bg-#EBF6EE c-primary f-s-24 pd-24 pb-16"> 注意:关联时请确保已添加到地块;关联时必须选到地块/圈舍/培养架。</view>
  448. </view>
  449. <view class="bg-#fff pd-24 mb-20 pt-0">
  450. <up-form-item :borderBottom="false" label="种养殖所在基地" required prop="baseId" id="baseIdpppp">
  451. <Go_button v-if="!deawerData" @click="openDrawer" title="请选择种养殖所在的基地" style="flex: 1" />
  452. <view class="w-100%" v-else>
  453. <Baseinfo :modeValue="deawerData" @close="handleBaseinfoClose" :baseType="form.taskType" />
  454. </view>
  455. </up-form-item>
  456. <up-form-item :borderBottom="false" label="具体位置" prop="baseId" id="baseIdpppp">
  457. <Go_button v-if="!laboratory" @click="openLaboratory" title="请选择具体位置" style="flex: 1" />
  458. <view class="w-100%" v-else>
  459. <laboratory :modeValue="laboratory" @close="handleLaboratoryClose" :baseType="form.taskType" />
  460. </view>
  461. </up-form-item>
  462. </view>
  463. <view class="startline-title pl-24 ml-24 mb-16">种养殖信息</view>
  464. <view class="bg-#fff pd-24 mb-20">
  465. <up-form-item borderBottom label="任务类型" required prop="taskType" id="taskTypepppp">
  466. <view class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_task_type, form.taskType) }}</view>
  467. </up-form-item>
  468. <up-form-item borderBottom label="是否代繁育" required prop="delegateFlag" id="delegateFlagFlagpppp">
  469. <up-radio-group v-model="form.delegateFlag">
  470. <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index" :label="item.label" :name="item.value"></up-radio>
  471. </up-radio-group>
  472. </up-form-item>
  473. <!-- <up-form-item borderBottom label="委托企业" required prop="delegateInfo" id="delegateInfopppp">
  474. <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">
  475. <view class=""></view>
  476. <view class="f-s-34 c-primary">请选择委托企业</view>
  477. </view>
  478. <view v-if="Enterprise" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  479. <up-icon @click="Enterprise = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  480. <view class="">
  481. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ form?.delegateInfo?.cusName }}</text>
  482. </view>
  483. <view class="mb-20">
  484. <text class="c-#666 f-s-24">{{ form?.delegateInfo?.crediteCode }}</text>
  485. </view>
  486. </view>
  487. </up-form-item> -->
  488. <up-form-item v-if="+(form?.delegateFlag ?? 0)" borderBottom label="委托企业" prop="delegateInfo">
  489. <view class="flex1">
  490. <ContactUnitInput v-model="form.delegateInfo.cpyid" v-model:info="form.delegate" :params="{ cpyType: '1' }" title="选择委托企业" placeholder="请选择委托企业信息"></ContactUnitInput>
  491. </view>
  492. </up-form-item>
  493. <ut-action-sheet v-if="+deawerData?.data[0]?.landType == 3" v-model="form.mgMethod" :tabs="pt_mg_method" title="选择溯源级别">
  494. <up-form-item borderBottom label="溯源级别" required prop="mgMethod" id="mgMethodpppp">
  495. <view v-if="form.mgMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_mg_method, form.mgMethod) }}</view>
  496. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择溯源级别</view>
  497. <template #right>
  498. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  499. </template>
  500. </up-form-item>
  501. </ut-action-sheet>
  502. <up-form-item borderBottom label="植物名称" required prop="varietyId" id="varietyIdpppp">
  503. <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择种植的植物名称" style="flex: 1" />
  504. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  505. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  506. <view class="mb-20">
  507. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  508. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  509. </view>
  510. <view class="mb-20">
  511. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  512. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  513. </view>
  514. <view class="">
  515. <text class="c-#666 f-s-24">产出:</text>
  516. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  517. </view>
  518. </view>
  519. </up-form-item>
  520. <up-form-item borderBottom label="繁育批号" required prop="plantationCode" id="plantationCodepppp">
  521. <view class="d-flex a-c j-sb w-100%">
  522. <view v-if="!form.plantationCode" class="flex1 c-#999">请生成繁育批号</view>
  523. <view v-else class="flex1 c-#333">{{ form.plantationCode }}</view>
  524. <up-button @click="randomCode" class="c-#fff" type="primary" style="height: 50rpx; width: 130rpx">随机生成</up-button>
  525. </view>
  526. </up-form-item>
  527. <up-form-item label="请选择繁育技术规程文件" prop="technicalFile" borderBottom id="technicalFilepppp">
  528. <ut-upload v-model="form.technicalFile" :max-count="9" valueType="array" accept="file"></ut-upload>
  529. </up-form-item>
  530. <ut-action-sheet v-model="form.plantationMethod" :tabs="pt_plantation_method" title="选择繁育方式">
  531. <up-form-item borderBottom label="繁育方式" prop="plantationMethod" id="plantationMethodpppp">
  532. <view v-if="form.plantationMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_method, form.plantationMethod) }}</view>
  533. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择繁育方式</view>
  534. <template #right>
  535. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  536. </template>
  537. </up-form-item>
  538. </ut-action-sheet>
  539. <view class="h-1" id="queryType6pppp"></view>
  540. <up-form-item :borderBottom="false" label="繁育日期" required prop="queryType6">
  541. <ut-datetime-picker v-model="form.queryType6.plannedStartDate" mode="date" dateFields="day" @change="changeStartTime">
  542. <view class="d-flex mr-20">
  543. <up-input v-model="form.queryType6.plannedStartDate" placeholder="请选择种植开始时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }" readonly></up-input>
  544. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  545. </view>
  546. </ut-datetime-picker>
  547. <ut-datetime-picker v-model="form.queryType6.plannedEndDate" mode="date" dateFields="day">
  548. <view class="d-flex">
  549. <up-input v-model="form.queryType6.plannedEndDate" readonly placeholder="请选择种植结束时间" border="bottom" :customStyle="{ paddingLeft: '0rpx' }"></up-input>
  550. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill" style="margin-left: -20rpx"></up-icon>
  551. </view>
  552. </ut-datetime-picker>
  553. </up-form-item>
  554. <up-form-item v-if="+deawerData?.data[0]?.landType == 1" borderBottom label="种植面积" required prop="plantingAmount" id="plantingAmountpppp">
  555. <view class="d-flex a-c j-sb w-100%">
  556. <up-input style="padding-left: 0" v-model="form.plantingAmount" placeholder="请输入种植面积" border="none"></up-input>
  557. <view class="c-#333 f-s-32 f-w-5">{{ form.plantingUnit }}</view>
  558. </view>
  559. </up-form-item>
  560. <up-form-item v-if="+deawerData?.data[0]?.landType == 3" label="接种数量" required class="form-item-bottom-padding-0">
  561. <view class="flex1 d-flex">
  562. <view class="flex1 ov-hd" id="plantingMgAmountpppp">
  563. <up-form-item prop="inoculationAmount" border-bottom class="form-item-top-padding-0">
  564. <up-input v-model="form.inoculationAmount" placeholder="请输入接种数量" border="none" clearable></up-input>
  565. </up-form-item>
  566. </view>
  567. <view class="pd-5" id="plantingMgUnitpppp"></view>
  568. <view class="min-w-200">
  569. <ut-action-sheet v-model="form.inoculationUnit" :tabs="pt_inoculation_unit" title="选择单位">
  570. <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
  571. <view class="flex1" style="line-height: 24px">
  572. <view v-if="form.inoculationUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_unit, form.inoculationUnit) }}</view>
  573. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  574. </view>
  575. <template #right>
  576. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  577. </template>
  578. </up-form-item>
  579. </ut-action-sheet>
  580. </view>
  581. </view>
  582. </up-form-item>
  583. <up-form-item v-if="+deawerData?.data[0]?.landType == 3" label="接种剂量" required class="form-item-bottom-padding-0">
  584. <view class="flex1 d-flex">
  585. <view class="flex1 ov-hd">
  586. <up-form-item prop="inoculationDosage" border-bottom class="form-item-top-padding-0">
  587. <up-input v-model="form.inoculationDosage" placeholder="请输入接种剂量" border="none" clearable></up-input>
  588. </up-form-item>
  589. </view>
  590. <view class="pd-5"></view>
  591. <view class="min-w-200">
  592. <ut-action-sheet v-model="form.inoculationDosageUnit" :tabs="pt_inoculation_dosage_unit" title="选择单位">
  593. <up-form-item prop="specUnit" border-bottom class="form-item-top-padding-0">
  594. <view class="flex1" style="line-height: 24px">
  595. <view v-if="form.inoculationDosageUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_dosage_unit, form.inoculationDosageUnit) }}</view>
  596. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  597. </view>
  598. <template #right>
  599. <up-icon class="mr-10" size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  600. </template>
  601. </up-form-item>
  602. </ut-action-sheet>
  603. </view>
  604. <view class="pd2-0-10 c-#ccc d-flex d-c a-c">/</view>
  605. <view class="min-w-200">
  606. <up-form-item prop="unit" border-bottom class="form-item-top-padding-0">
  607. <view class="flex1" style="line-height: 24px">
  608. <view v-if="form.inoculationUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_inoculation_unit, form.inoculationUnit) }}</view>
  609. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  610. </view>
  611. <template #right>
  612. <up-icon size="22rpx" color="#fff" name="arrow-down-fill"></up-icon>
  613. </template>
  614. </up-form-item>
  615. </view>
  616. </view>
  617. </up-form-item>
  618. <view class="h-1" id="plantpppp"></view>
  619. <up-form-item v-if="+deawerData?.data[0]?.landType == 3" borderBottom label="繁育量" prop="plant">
  620. <view class="d-flex a-c j-sb w-100%">
  621. <view class="f-s-30 c-333 f-w-5 w-100">{{ plantingMgAmount }}</view>
  622. <view v-if="plantingMgUnit" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_inoculation_dosage_unit, plantingMgUnit) }}</view>
  623. </view>
  624. </up-form-item>
  625. <!-- <up-form-item v-else borderBottom label="繁育量" required prop="plant">
  626. <up-input v-model="form.plant.plantingMgAmount" placeholder="请输入繁育量" border="none"></up-input>
  627. <ut-action-sheet v-model="form.plant.plantingMgUnit" :tabs="pt_feed_amount_unit" title="选择单位">
  628. <view class="d-flex a-c">
  629. <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>
  630. <view v-else class="f-s-30 c-ccc f-w-4 w-100">单位</view>
  631. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  632. </view>
  633. </ut-action-sheet>
  634. </up-form-item> -->
  635. <up-form-item v-else label="繁育量" required class="form-item-bottom-padding-0">
  636. <view class="flex1 d-flex">
  637. <view class="flex1 ov-hd" id="plantingMgAmountpppp">
  638. <up-form-item prop="plantingMgAmount" border-bottom class="form-item-top-padding-0">
  639. <up-input v-model="form.plantingMgAmount" placeholder="请输入繁育量" border="none" clearable></up-input>
  640. </up-form-item>
  641. </view>
  642. <view class="pd-5" id="plantingMgUnitpppp"></view>
  643. <view class="min-w-200">
  644. <ut-action-sheet v-model="form.plantingMgUnit" :tabs="pt_feed_amount_unit" title="选择单位">
  645. <up-form-item prop="plantingMgUnit" border-bottom class="form-item-top-padding-0">
  646. <view class="flex1" style="line-height: 24px">
  647. <view v-if="form.plantingMgUnit" class="f-s-30 c-333 f-w-5 text-center">{{ selectDictLabel(pt_feed_amount_unit, form.plantingMgUnit) }}</view>
  648. <view v-else class="f-s-30 c-ccc f-w-4 text-center">单位</view>
  649. </view>
  650. <template #right>
  651. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  652. </template>
  653. </up-form-item>
  654. </ut-action-sheet>
  655. </view>
  656. </view>
  657. </up-form-item>
  658. <!-- <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
  659. <Go_button v-if="!Biological" @click="gotoTorganism(1)" title="请选择培养基配方" style="flex: 1" />
  660. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  661. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  662. <view class="mb-20">
  663. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  664. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  665. </view>
  666. <view class="mb-20">
  667. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  668. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  669. </view>
  670. <view class="">
  671. <text class="c-#666 f-s-24">产出:</text>
  672. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  673. </view>
  674. </view>
  675. </up-form-item> -->
  676. <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
  677. <up-form-item borderBottom label="选择繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
  678. <view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
  679. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择选择繁殖方式</view>
  680. <template #right>
  681. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  682. </template>
  683. </up-form-item>
  684. </ut-action-sheet>
  685. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.plantationType" :tabs="pt_plantation_type" title="选择种植类型">
  686. <up-form-item borderBottom label="种植类型" required prop="plantationType" id="plantationTypepppp">
  687. <view v-if="form.plantationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_type, form.plantationType) }}</view>
  688. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植类型</view>
  689. <template #right>
  690. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  691. </template>
  692. </up-form-item>
  693. </ut-action-sheet>
  694. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.sowingMethod" :tabs="pt_sowing_method" title="选择播种方法">
  695. <up-form-item borderBottom label="播种方法" required prop="sowingMethod" id="sowingMethodpppp">
  696. <view v-if="form.sowingMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_sowing_method, form.sowingMethod) }}</view>
  697. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择播种方法</view>
  698. <template #right>
  699. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  700. </template>
  701. </up-form-item>
  702. </ut-action-sheet>
  703. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.transplantMethod" :tabs="pt_transplant_method" title="选择移栽方法">
  704. <up-form-item borderBottom label="移栽方法" required prop="transplantMethod" id="transplantMethodpppp">
  705. <view v-if="form.transplantMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_transplant_method, form.transplantMethod) }}</view>
  706. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择移栽方法</view>
  707. <template #right>
  708. <up-icon size="22rpx" color="#37A954" name="arrow-down-fill"></up-icon>
  709. </template>
  710. </up-form-item>
  711. </ut-action-sheet>
  712. <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
  713. <Go_button v-if="!PreBiological" @click="gotoTorganism(2)" title="请选择前茬植物名称" style="flex: 1" />
  714. <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  715. <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  716. <view class="mb-20">
  717. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
  718. <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
  719. </view>
  720. <view class="mb-20">
  721. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
  722. <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
  723. </view>
  724. <view class="">
  725. <text class="c-#666 f-s-24">产出:</text>
  726. <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
  727. </view>
  728. </view>
  729. </up-form-item>
  730. <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
  731. <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
  732. </up-form-item>
  733. </view>
  734. </up-form>
  735. </template>
  736. <view v-if="+form.mgMethod == 2" class="">
  737. <view class="startline-title pl-24 ml-24 mb-16">个体标识信息</view>
  738. <view class="bg-#fff pd-24">
  739. <view class="d-flex pt-20 pb-20">
  740. <view class="">个体标识({{ animalIds.length }}个)</view>
  741. <view class="flex1"></view>
  742. <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>
  743. </view>
  744. <view class="d-flex gap-20 mb-20">
  745. <view
  746. @click="
  747. editIndex = -1;
  748. animalId = null;
  749. showAnimalIdDialog = true;
  750. "
  751. class="b-radius border-#AFDDBB bg-#FBFDFB c-primary w-100% d-flex j-c a-c h-100 f-s-34"
  752. >手动输入添加</view
  753. >
  754. <view class="b-radius border-#A3E5EA c-#18BECA bg-#FAFFFF w-100% d-flex j-c a-c h-100 f-s-34">从种源库快速添加</view>
  755. </view>
  756. <up-swipe-action>
  757. <up-swipe-action-item class="mb-20" v-for="(item, index) in animalIds" :key="index" :index="item" :name="item" :options="options1" @click="clickSwipe">
  758. <view class="b-radius border-#37A954 c-#333 f-s-28 pd4-34-30-34-30">{{ item }}</view>
  759. </up-swipe-action-item>
  760. </up-swipe-action>
  761. </view>
  762. </view>
  763. </view>
  764. <template #bottom>
  765. <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
  766. <up-button type="warning" @click="saveDraft()">暂存</up-button>
  767. <up-button type="primary" @click="save()">提交</up-button>
  768. </view>
  769. </template>
  770. </z-paging>
  771. <ut-confirm-dialog v-model:show="showAnimalIdDialog" width="75vw" :title="editIndex === -1 ? '添加个体标识' : '修改个体标识'" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleAnimalIdConfirm" @cancel="handleAnimalIdCancel">
  772. <view class="">
  773. <view class="c-#333 f-s-28">个体标识号</view>
  774. <view class="">
  775. <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
  776. </view>
  777. </view>
  778. </ut-confirm-dialog>
  779. <!-- 添加drawer组件 -->
  780. <Drawer v-if="drawerVisible" :baseType="form.taskType" v-model="drawerVisible" @open="onDrawerOpen" @close="onDrawerClose" @confirm="onDrawerConfirm" />
  781. </template>
  782. <script setup lang="ts">
  783. import { ref } from 'vue';
  784. import Drawer from './models/drawer.vue';
  785. import Baseinfo from './models/baseinfo.vue';
  786. import { useClientRequest } from '@/utils/request';
  787. import type { TaskType, YesNoType, TimeRange, PlantInfo, DelegateInfo, InoculationInfo, LandInfo, BaseSelectData, PlantationTaskForm, FormRuleItem, FormRules } from './models/types';
  788. import Drawer_laboratory from './models/drawer_laboratory.vue';
  789. import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
  790. import Go_button from './models/go_button.vue';
  791. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  792. 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>(
  793. 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'),
  794. );
  795. const form = ref<PlantationTaskForm>({
  796. deawerData: null,
  797. baseId: null,
  798. landIds: [],
  799. taskType: null,
  800. gapFlag: null,
  801. mgMethod: null,
  802. varietyId: null,
  803. plantationCode: null,
  804. plantationMethod: null,
  805. reproductionType: null,
  806. technicalFile: [],
  807. plantingUnit: null,
  808. breedScale: null,
  809. queryType6: {
  810. plannedStartDate: null,
  811. plannedEndDate: null,
  812. },
  813. plantingMgAmount: null,
  814. plantingMgUnit: null,
  815. plantingAmount: '',
  816. remark: null,
  817. delegateFlag: '0',
  818. delegateInfo: { cpyid: '', cusCode: '', cusName: '' },
  819. delegate: {},
  820. plantationType: null,
  821. sowingMethod: null,
  822. transplantMethod: null,
  823. preCropId: null,
  824. inoculationAmount: null,
  825. inoculationUnit: null,
  826. inoculationDosage: null,
  827. inoculationDosageUnit: null,
  828. cultureMediumFormula: null,
  829. landFlag: null,
  830. });
  831. const changeStartTime = () => {
  832. if (!form.value?.queryType6?.plannedEndDate) {
  833. form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
  834. }
  835. };
  836. // 单个溯源数组
  837. const animalIds = ref<any>([]);
  838. const animalId = ref();
  839. const editIndex = ref(-1); // 编辑索引,-1 表示添加模式
  840. const showAnimalIdDialog = ref(false); // 统一的弹框
  841. // 统一的确认方法
  842. const handleAnimalIdConfirm = () => {
  843. if (!animalId.value) {
  844. uni.showToast({
  845. title: '请输入个体标识号',
  846. icon: 'none',
  847. });
  848. return;
  849. }
  850. // 检查是否已存在(修改时排除自身)
  851. const index = animalIds.value.findIndex((item: any) => item == animalId.value);
  852. if (index !== -1 && index !== editIndex.value) {
  853. uni.showToast({
  854. title: '个体标识不可重复',
  855. icon: 'none',
  856. });
  857. return;
  858. }
  859. if (editIndex.value !== -1) {
  860. // 修改模式
  861. animalIds.value[editIndex.value] = animalId.value;
  862. } else {
  863. // 添加模式
  864. animalIds.value.push(animalId.value);
  865. }
  866. animalId.value = null;
  867. editIndex.value = -1;
  868. showAnimalIdDialog.value = false;
  869. };
  870. // 取消方法
  871. const handleAnimalIdCancel = () => {
  872. animalId.value = null;
  873. editIndex.value = -1;
  874. showAnimalIdDialog.value = false;
  875. };
  876. // 扫一扫添加个体标识
  877. const handleScanAdd = () => {
  878. uni.scanCode({
  879. success: (res) => {
  880. const scanResult = res.result;
  881. // 检查是否已存在
  882. if (animalIds.value.includes(scanResult)) {
  883. uni.showToast({
  884. title: '个体标识不可重复',
  885. icon: 'none',
  886. });
  887. return;
  888. }
  889. // 将扫描结果赋值给 animalId
  890. animalId.value = scanResult;
  891. editIndex.value = -1; // 添加模式
  892. // 调用统一的确认方法
  893. handleAnimalIdConfirm();
  894. },
  895. fail: (err) => {
  896. console.log('扫码失败', err);
  897. },
  898. });
  899. };
  900. // 使用 reactive 创建响应式对象
  901. const options1 = reactive([
  902. {
  903. text: '删除',
  904. style: {
  905. backgroundColor: '#F74C30',
  906. },
  907. },
  908. {
  909. text: '编辑',
  910. style: {
  911. backgroundColor: '#37A954',
  912. },
  913. },
  914. ]);
  915. // 自定义校验函数:养殖时间校验
  916. const validateBreedingTime = (rule: any, value: any, callback: any) => {
  917. if (!value) {
  918. callback(new Error('请选择养殖时间'));
  919. return;
  920. }
  921. const { plannedStartDate, plannedEndDate } = value;
  922. if (!plannedStartDate) {
  923. callback(new Error('请选择养殖开始时间'));
  924. return;
  925. }
  926. if (!plannedEndDate) {
  927. callback(new Error('请选择养殖结束时间'));
  928. return;
  929. }
  930. const startDate = new Date(plannedStartDate);
  931. const endDate = new Date(plannedEndDate);
  932. if (endDate < startDate) {
  933. callback(new Error('养殖结束时间必须晚于开始时间'));
  934. return;
  935. }
  936. callback();
  937. };
  938. // 自定义校验函数:养殖量校验
  939. const validateBreedingAmount = (rule: any, value: any, callback: any) => {
  940. if (+deawerData.value?.data[0]?.landType == 3) {
  941. callback();
  942. return;
  943. }
  944. if (!value) {
  945. callback(new Error('请输入养殖量'));
  946. return;
  947. }
  948. const { plantingMgAmount, plantingMgUnit } = value;
  949. if (!plantingMgAmount || plantingMgAmount.trim() === '') {
  950. callback(new Error('请输入养殖量'));
  951. return;
  952. }
  953. if (!plantingMgUnit) {
  954. callback(new Error('请选择养殖量单位'));
  955. return;
  956. }
  957. callback();
  958. };
  959. // 委托企业
  960. const Enterprise = ref('123');
  961. // 自定义delegateInfo 委托企业校验
  962. const validateDelegateInfo = (rule: any, value: any, callback: any) => {
  963. if (+(form.value?.delegateFlag ?? 0)) {
  964. if (!value) {
  965. callback(new Error('请选择委托企业'));
  966. return;
  967. }
  968. const { cpyid, crediteCode, cusName } = value;
  969. if (!cpyid) {
  970. callback(new Error('请选择委托企业'));
  971. return;
  972. }
  973. callback();
  974. } else {
  975. callback();
  976. }
  977. };
  978. //判断是否要填种植面积
  979. const validatePlantingAmount = (rule: any, value: any, callback: any) => {
  980. if (+deawerData.value?.data[0]?.landType == 1) {
  981. if (!value || value.trim() === '') {
  982. callback(new Error('请输入种植面积'));
  983. return;
  984. }
  985. callback();
  986. return;
  987. } else {
  988. callback();
  989. return;
  990. }
  991. };
  992. // 判断是否要填接种数量
  993. const validateinoculation = (rule: any, value: any, callback: any) => {
  994. if (+deawerData.value?.data[0]?.landType == 3) {
  995. console.log(form.value, 'form.value');
  996. if (!form.value?.inoculationUnit) {
  997. console.log(form.value?.inoculationUnit, 'form.value?.inoculationUnit');
  998. callback(new Error('请选择接种数量单位'));
  999. return;
  1000. }
  1001. if (!form.value?.inoculationAmount || form.value?.inoculationAmount.trim() === '') {
  1002. console.log(form.value?.inoculationAmount, 'form.value?.inoculationAmount');
  1003. callback(new Error('请输入接种数量'));
  1004. return;
  1005. }
  1006. callback();
  1007. } else {
  1008. callback();
  1009. }
  1010. };
  1011. const validateInoculationDosage = (rule: any, value: any, callback: any) => {
  1012. if (+deawerData.value?.data[0]?.landType == 3) {
  1013. // value 就是 form.inoculation.inoculationDosage 的值
  1014. if (!form.value?.inoculationDosage || form.value?.inoculationDosage.trim() === '') {
  1015. console.log(form.value?.inoculationDosage, 'form.value?.inoculationDosage');
  1016. callback(new Error('请输入接种剂量'));
  1017. return;
  1018. }
  1019. console.log(form.value);
  1020. // 检查单位是否选择
  1021. if (!form.value?.inoculationDosageUnit) {
  1022. console.log(form.value?.inoculationDosageUnit, 'form.value?.inoculationDosageUnit');
  1023. callback(new Error('请选择接种剂量单位'));
  1024. return;
  1025. }
  1026. callback();
  1027. } else {
  1028. callback();
  1029. }
  1030. };
  1031. // 判断溯源级别是否需要校验
  1032. const validateMgMethod = (rule: any, value: any, callback: any) => {
  1033. if (+deawerData.value?.data[0]?.landType == 3) {
  1034. if (!value) {
  1035. callback(new Error('请选择溯源级别'));
  1036. return;
  1037. }
  1038. callback();
  1039. } else {
  1040. callback();
  1041. }
  1042. };
  1043. const rules = reactive({
  1044. baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
  1045. taskType: [{ required: true, message: '请选择任务类型' }],
  1046. mgMethod: [{ required: true, message: '请选择溯源级别' }],
  1047. gapFlag: [{ required: true, message: '请选择符合要求' }],
  1048. varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
  1049. plantationCode: [{ required: true, message: '请输入养殖批号' }],
  1050. technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
  1051. plantationMethod: [{ required: true, message: '请选择养殖方式' }],
  1052. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1053. plantingAmount: [{ required: true, message: '请输入养殖面积' }],
  1054. breedScale: [{ required: true, message: '请输入养殖区域' }],
  1055. plantingMgUnit: [{ required: true, message: '请选择养殖单位' }],
  1056. plantingMgAmount: [{ required: true, message: '请输入养殖量' }],
  1057. remark: [{ required: false, message: '请输入备注' }],
  1058. });
  1059. const rules1 = reactive({
  1060. baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
  1061. taskType: [{ required: true, message: '请选择任务类型' }],
  1062. delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
  1063. delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
  1064. mgMethod: [{ required: true, message: '请选择溯源级别' }],
  1065. varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
  1066. plantationCode: [{ required: true, message: '请输入养殖批号' }],
  1067. technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
  1068. plantationMethod: [{ required: false, message: '请选择养殖方式' }],
  1069. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1070. plantingAmount: [{ required: true, message: '请输入养殖面积' }],
  1071. breedScale: [{ required: true, message: '请输入养殖区域' }],
  1072. plantingMgUnit: [{ required: true, message: '请选择养殖单位' }],
  1073. plantingMgAmount: [{ required: true, message: '请输入养殖量' }],
  1074. remark: [{ required: false, message: '请输入备注' }],
  1075. });
  1076. const rules2 = reactive({
  1077. baseId: [{ required: true, message: '请选择种植所在的基地' }],
  1078. taskType: [{ required: true, message: '请选择任务类型' }],
  1079. gapFlag: [{ required: true, message: '请选择符合要求' }],
  1080. varietyId: [{ required: true, message: '请选择种植的植物名称' }],
  1081. plantationCode: [{ required: true, message: '请输入种植批号' }],
  1082. technicalFile: [{ required: false, message: '请选择种植技术规程文件' }],
  1083. plantationMethod: [{ required: false, message: '请选择种植方式' }],
  1084. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1085. plantingAmount: [{ required: true, message: '请输入种植面积' }],
  1086. plantingMgUnit: [{ required: true, message: '请选择种植单位' }],
  1087. plantingMgAmount: [{ required: true, message: '请输入种植量' }],
  1088. remark: [{ required: false, message: '请输入备注' }],
  1089. preCropId: [{ required: false, message: '请选择前茬植物' }],
  1090. reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
  1091. });
  1092. const rules3 = reactive({
  1093. baseId: [{ required: true, message: '请选择种植所在的基地' }],
  1094. taskType: [{ required: true, message: '请选择任务类型' }],
  1095. delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
  1096. delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
  1097. mgMethod: [{ validator: validateMgMethod, trigger: 'blur' }],
  1098. varietyId: [{ required: true, message: '请选择种植的植物名称' }],
  1099. plantationCode: [{ required: true, message: '请输入种植批号' }],
  1100. technicalFile: [{ required: false, message: '请选择繁育技术规程文件' }],
  1101. plantationMethod: [{ required: false, message: '请选择繁育方式' }],
  1102. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1103. plantingAmount: [{ validator: validatePlantingAmount, trigger: 'blur' }],
  1104. plantingMgUnit: [{ required: true, message: '请选择繁育单位' }],
  1105. plantingMgAmount: [{ required: true, message: '请输入繁育数量' }],
  1106. inoculationAmount: [{ validator: validateinoculation }],
  1107. inoculationUnit: [{ validator: validateinoculation }],
  1108. inoculationDosage: [{ validator: validateInoculationDosage }],
  1109. inoculationDosageUnit: [{ validator: validateInoculationDosage }],
  1110. remark: [{ required: false, message: '请输入备注' }],
  1111. preCropId: [{ required: false, message: '请选择前茬植物' }],
  1112. reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
  1113. });
  1114. const upFormRef = ref<any>();
  1115. const paging = ref<any>();
  1116. const list = ref<unknown>([]);
  1117. // 控制抽屉显示状态
  1118. const drawerVisible = ref(false);
  1119. // 打开抽屉
  1120. function openDrawer() {
  1121. drawerVisible.value = true;
  1122. }
  1123. // 关闭抽屉
  1124. function closeDrawer() {
  1125. drawerVisible.value = false;
  1126. }
  1127. // 处理抽屉打开事件
  1128. function onDrawerOpen() {
  1129. console.log('抽屉打开了');
  1130. }
  1131. // 处理抽屉关闭事件
  1132. function onDrawerClose() {
  1133. console.log('抽屉关闭了');
  1134. }
  1135. const deawerData = ref<any>(null);
  1136. // 处理抽屉确认事件
  1137. function onDrawerConfirm(data: any) {
  1138. console.log('收到基地选择数据:', data);
  1139. deawerData.value = data;
  1140. // 确认基地id
  1141. form.value.baseId = data.data[0]?.baseId;
  1142. //确认地块面积
  1143. if (+data.data[0]?.landType !== 3) {
  1144. form.value.plantingAmount = '';
  1145. data.data.forEach((i: LandInfo) => {
  1146. form.value.plantingAmount += i.area;
  1147. });
  1148. }
  1149. //确认养殖区域的个数
  1150. form.value.breedScale = data.data?.length;
  1151. if (data?.aloneChecked) {
  1152. form.value.landFlag = 1;
  1153. form.value.landIds = data?.checkBox;
  1154. } else {
  1155. form.value.landIds = data?.checkBox;
  1156. form.value.landFlag = 0;
  1157. }
  1158. }
  1159. // 处理Baseinfo组件的关闭事件
  1160. function handleBaseinfoClose() {
  1161. deawerData.value = null;
  1162. }
  1163. // 所选动植物
  1164. const Biological = ref<any>(null);
  1165. // 所选前茬植物
  1166. const PreBiological = ref<any>(null);
  1167. //随机生成
  1168. const randomCode = async () => {
  1169. let plType = '';
  1170. const taskType = form.value.taskType;
  1171. if (taskType === 1) {
  1172. plType = 'P';
  1173. } else if (taskType === 2) {
  1174. plType = 'F';
  1175. } else {
  1176. plType = 'C';
  1177. }
  1178. const code = await useClientRequest.post('/plt-api/app/plantationTask/getBatchCode', { plType: plType, linkType: plType });
  1179. form.value.plantationCode = code.data;
  1180. };
  1181. //完成提交表单
  1182. const save = () => {
  1183. uni.$u.debounce(async () => {
  1184. try {
  1185. console.log('开始提交');
  1186. await upFormRef.value?.validate();
  1187. console.log('校验完成');
  1188. if (+(form.value.delegateFlag ?? 0)) {
  1189. form.value.delegateInfo.cusName = form.value?.delegate.cusName;
  1190. form.value.delegateInfo.cusCode = form.value?.delegate.cusCode;
  1191. } else {
  1192. form.value.delegateInfo = null as any;
  1193. form.value.delegate = null as any;
  1194. }
  1195. const params = {
  1196. ...form.value,
  1197. ...form.value.queryType6,
  1198. ...form.value.inoculation,
  1199. animalIds: animalIds.value,
  1200. };
  1201. console.log('提交参数:', params);
  1202. let res = null;
  1203. if (isEdit.value) {
  1204. res = await useClientRequest.post('/plt-api/app/plantationTask/updateTask', params);
  1205. } else {
  1206. res = await useClientRequest.post('/plt-api/app/plantationTask/saveTask', params);
  1207. }
  1208. if (res.code == 200) {
  1209. uni.showToast({
  1210. title: '提交成功',
  1211. icon: 'success',
  1212. duration: 2000,
  1213. });
  1214. uni.$emit('refreshportList');
  1215. setTimeout(() => {
  1216. uni.navigateBack();
  1217. }, 1000);
  1218. }
  1219. } catch (error: any) {
  1220. // 滚动到第一个错误字段
  1221. console.log(error);
  1222. const firstErrorField = error && error[0].field + 'pppp';
  1223. paging.value?.scrollIntoViewById(firstErrorField, 30, true);
  1224. return;
  1225. }
  1226. }, 500, true);
  1227. };
  1228. // 暂存
  1229. const saveDraft = () => {
  1230. uni.$u.debounce(async () => {
  1231. try {
  1232. const params = {
  1233. ...form.value,
  1234. ...form.value.queryType6,
  1235. animalIds: animalIds.value,
  1236. };
  1237. if (form.value?.delegate?.cusCode) {
  1238. form.value.delegateInfo.cusName = form.value?.delegate?.cusName;
  1239. form.value.delegateInfo.cusCode = form.value?.delegate?.cusCode;
  1240. }
  1241. console.log('暂存参数:', params);
  1242. const res = await useClientRequest.post('/plt-api/app/plantationTask/draftTask', params);
  1243. if (res.code == 200) {
  1244. uni.showToast({
  1245. title: '提交成功',
  1246. icon: 'success',
  1247. duration: 2000,
  1248. });
  1249. setTimeout(() => {
  1250. uni.navigateBack();
  1251. }, 1000);
  1252. }
  1253. } catch (error: any) {
  1254. console.log(error, 'error');
  1255. }
  1256. }, 500, true);
  1257. };
  1258. const clickSwipe = async (name: any, index: number) => {
  1259. if (name?.index == 0) {
  1260. const res = await uni.showModal({
  1261. title: '删除提示',
  1262. content: '删除后不可撤回,请谨慎操作!',
  1263. confirmColor: '#F74C30',
  1264. });
  1265. if (!res.confirm) return;
  1266. await uni.showLoading({
  1267. title: '删除中...',
  1268. mask: true,
  1269. });
  1270. const findindex = animalIds.value.findIndex((i) => i == name?.name);
  1271. animalIds.value.splice(findindex, 1);
  1272. uni.hideLoading();
  1273. uni.showToast({
  1274. title: '删除成功',
  1275. icon: 'success',
  1276. });
  1277. } else {
  1278. // 编辑模式:设置编辑索引和 animalId
  1279. editIndex.value = animalIds.value.findIndex((item: any) => item == name?.name);
  1280. animalId.value = name?.name;
  1281. showAnimalIdDialog.value = true;
  1282. }
  1283. };
  1284. // 如果是组培实验室的话,繁育量是一个计算属性
  1285. const plantingMgAmount = computed(() => {
  1286. // 安全访问嵌套属性
  1287. if (Number(deawerData.value?.data?.[0]?.landType) !== 3) {
  1288. return '';
  1289. }
  1290. const inoculationAmount = Number(form.value?.inoculationAmount);
  1291. const inoculationDosage = Number(form.value?.inoculationDosage);
  1292. // 如果任一值为无效数字,返回空字符串
  1293. if (!inoculationAmount || !inoculationDosage || isNaN(inoculationAmount) || isNaN(inoculationDosage)) {
  1294. return '';
  1295. }
  1296. const result = inoculationAmount * inoculationDosage;
  1297. form.value.plantingMgAmount = result;
  1298. // 返回计算结果,保持数字类型或空字符串
  1299. return isNaN(result) ? '' : result;
  1300. });
  1301. // 如果是组培实验室的话,繁育量单位是一个计算属性
  1302. const plantingMgUnit = computed(() => {
  1303. if (Number(deawerData.value?.data?.[0]?.landType) == 3) {
  1304. form.value.plantingMgUnit = form.value?.inoculationDosageUnit || null;
  1305. return form.value.plantingMgUnit;
  1306. }
  1307. return null;
  1308. });
  1309. const laboratory = ref<any>();
  1310. // 控制抽屉显示状态
  1311. // 处理实验室的关闭
  1312. function handleLaboratoryClose() {
  1313. laboratory.value = null;
  1314. }
  1315. // 处理实验室的打开
  1316. function openLaboratory() {
  1317. uni.$on('cultivationLocationSelected', function (data) {
  1318. console.log(data);
  1319. });
  1320. uni.$u.route({
  1321. type: 'navigateTo',
  1322. url: '/tools/select-cultivation-location/index',
  1323. })
  1324. }
  1325. // 处理抽屉确认事件
  1326. function handleLaboratoryConfirm(data: any) {
  1327. console.log('收到基地选择数据:', data);
  1328. }
  1329. const taskId = ref();
  1330. //是否是修改的标志
  1331. const isEdit = ref(false);
  1332. //是否是复制
  1333. const isCopy = ref(false);
  1334. onLoad((options) => {
  1335. if (!options?.taskType && options?.taskId) {
  1336. taskId.value = options?.taskId;
  1337. isEdit.value = true;
  1338. if (options?.copy) {
  1339. isCopy.value = true;
  1340. }
  1341. } else {
  1342. form.value.taskType = options?.taskType;
  1343. if (+options?.taskType == 1 || +options?.taskType == 11) {
  1344. form.value.plantingUnit = '亩';
  1345. if (+options?.taskType == 11) {
  1346. form.value.gapFlag = 0;
  1347. }
  1348. } else {
  1349. form.value.plantingUnit = '平方米';
  1350. if (+options?.taskType == 21) {
  1351. form.value.gapFlag = 0;
  1352. }
  1353. }
  1354. }
  1355. });
  1356. const gotoTorganism = (type: number) => {
  1357. if (type == 1) {
  1358. uni.$once('updateBiologicalname', function (data) {
  1359. Biological.value = data.msg;
  1360. console.log(Biological.value);
  1361. form.value.varietyId = data.msg.id;
  1362. });
  1363. } else {
  1364. uni.$once('updateBiologicalname', function (data) {
  1365. PreBiological.value = data.msg;
  1366. form.value.preCropId = data.msg.id;
  1367. });
  1368. }
  1369. uni.navigateTo({
  1370. url: '/tools/por-torganism/index',
  1371. });
  1372. };
  1373. // 查看是否有缓存的信息
  1374. const getCache = async (taskType: TaskType | null) => {
  1375. const res = await useClientRequest.get(`/plt-api/app/plantationTask/getDraft/${taskType}`);
  1376. if (!res.data) return;
  1377. form.value = res.data;
  1378. form.value.queryType6 = {
  1379. plannedStartDate: res.data.plannedStartDate,
  1380. plannedEndDate: res.data.plannedEndDate,
  1381. };
  1382. form.value.delegate = {
  1383. cusCode: form.value.delegateInfo?.cusCode,
  1384. cusName: form.value.delegateInfo?.cusName,
  1385. };
  1386. if (res.data.animalIds) {
  1387. animalIds.value = res.data.animalIds;
  1388. }
  1389. if (res.data.preCropCode) {
  1390. PreBiological.value = {};
  1391. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
  1392. PreBiological.value = Bio.data;
  1393. }
  1394. if (res.data.varietyCode) {
  1395. Biological.value = {};
  1396. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
  1397. Biological.value = Bio.data;
  1398. }
  1399. // 判断有没有基地,然后去获取基地数据
  1400. if (res.data.baseId) {
  1401. deawerData.value = {};
  1402. deawerData.value.baseName = res.data.baseRef.baseName;
  1403. deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
  1404. deawerData.value.area = res.data.baseRef.baseInfo.area;
  1405. deawerData.value.address = res.data.baseRef.baseInfo.address;
  1406. // adcodeName
  1407. deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
  1408. if (+res.data.landFlag) {
  1409. deawerData.value.aloneChecked = true;
  1410. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1411. deawerData.value.data = landIds.rows;
  1412. } else {
  1413. deawerData.value.aloneChecked = false;
  1414. deawerData.value.data = [];
  1415. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1416. //找到res.data.landIds和landIds.rows中的id相同的项
  1417. landIds.rows.forEach((i: any) => {
  1418. if (res.data.landIds.find((t: any) => t == i.id)) {
  1419. deawerData.value.data.push(i);
  1420. }
  1421. });
  1422. }
  1423. }
  1424. };
  1425. // 获取详细数据
  1426. const getInfo = async (taskId: any) => {
  1427. const res = await useClientRequest.get<any>(`/plt-api/app/plantationTask/getInfo/${taskId}`);
  1428. if (!res.data) return;
  1429. form.value = res.data;
  1430. form.value.queryType6 = {
  1431. plannedStartDate: res.data.plannedStartDate,
  1432. plannedEndDate: res.data.plannedEndDate,
  1433. };
  1434. form.value.delegate = {
  1435. cusCode: form.value.delegateInfo?.cusCode,
  1436. cusName: form.value.delegateInfo?.cusName,
  1437. };
  1438. if (res.data.animalIds) {
  1439. animalIds.value = res.data.animalIds;
  1440. }
  1441. if (res.data.preCropCode) {
  1442. PreBiological.value = {};
  1443. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
  1444. PreBiological.value = Bio.data;
  1445. }
  1446. if (res.data.varietyCode) {
  1447. Biological.value = {};
  1448. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
  1449. Biological.value = Bio.data;
  1450. }
  1451. // 判断有没有基地,然后去获取基地数据
  1452. if (res.data.baseId) {
  1453. deawerData.value = {};
  1454. deawerData.value.baseName = res.data.baseRef.baseName;
  1455. deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
  1456. deawerData.value.area = res.data.baseRef.baseInfo.area;
  1457. deawerData.value.address = res.data.baseRef.baseInfo.address;
  1458. // adcodeName
  1459. deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
  1460. if (+res.data.landFlag) {
  1461. deawerData.value.aloneChecked = true;
  1462. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1463. deawerData.value.data = landIds.rows;
  1464. } else {
  1465. deawerData.value.aloneChecked = false;
  1466. deawerData.value.data = [];
  1467. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1468. //找到res.data.landIds和landIds.rows中的id相同的项
  1469. landIds.rows.forEach((i: any) => {
  1470. if (res.data.landIds.find((t: any) => t == i.id)) {
  1471. deawerData.value.data.push(i);
  1472. }
  1473. });
  1474. }
  1475. }
  1476. if (isCopy.value) {
  1477. form.value.plantationCode = null;
  1478. form.value.queryType6.plannedStartDate = null;
  1479. form.value.queryType6.plannedEndDate = null;
  1480. form.value.plantingMgAmount = null;
  1481. animalIds.value = [];
  1482. animalId.value = null;
  1483. }
  1484. };
  1485. onMounted(() => {
  1486. if (taskId.value) {
  1487. getInfo(taskId.value);
  1488. } else {
  1489. getCache(form.value.taskType);
  1490. }
  1491. });
  1492. </script>
  1493. <style lang="scss" scoped>
  1494. :deep(.form-item-top-padding-0) {
  1495. > .u-form-item__body {
  1496. padding-top: 0rpx;
  1497. }
  1498. }
  1499. :deep(.form-item-bottom-padding-0) {
  1500. > .u-form-item__body {
  1501. padding-bottom: 0rpx;
  1502. }
  1503. }
  1504. </style>