index.vue 80 KB

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