index.vue 87 KB

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