index.vue 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431
  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">/</view>
  598. <view v-if="form.inoculation?.inoculationUnit" class="f-s-30 c-333 f-w-5 w-100" style="text-align: right">{{ selectDictLabel(pt_inoculation_unit, form.inoculation?.inoculationUnit) }}</view>
  599. </view>
  600. </up-form-item>
  601. <view class="h-1" id="plantpppp"></view>
  602. <up-form-item v-if="+deawerData?.data[0]?.landType == 3" borderBottom label="繁育量" prop="plant">
  603. <view class="d-flex a-c j-sb w-100%">
  604. <view class="f-s-30 c-333 f-w-5 w-100">{{ plantingMgAmount }}</view>
  605. <view v-if="plantingMgUnit" class="f-s-30 c-333 f-w-5 w-100">{{ selectDictLabel(pt_inoculation_dosage_unit, plantingMgUnit) }}</view>
  606. </view>
  607. </up-form-item>
  608. <up-form-item v-else borderBottom label="繁育量" required prop="plant">
  609. <up-input v-model="form.plant.plantingMgAmount" placeholder="请输入繁育量" border="none"></up-input>
  610. <ut-action-sheet v-model="form.plant.plantingMgUnit" :tabs="pt_feed_amount_unit" title="选择单位">
  611. <view class="d-flex a-c">
  612. <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>
  613. <view v-else class="f-s-30 c-ccc f-w-4 w-100">单位</view>
  614. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  615. </view>
  616. </ut-action-sheet>
  617. </up-form-item>
  618. <up-form-item borderBottom label="培养基配方" prop="cultureMediumFormula" id="cultureMediumFormulapppp">
  619. <view v-if="!Biological" @click="gotoTorganism(1)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
  620. <view class=""></view>
  621. <view class="f-s-34 c-primary">请选择培养基配方</view>
  622. </view>
  623. <view v-if="Biological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  624. <up-icon @click="Biological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  625. <view class="mb-20">
  626. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ Biological?.varietyName }}</text>
  627. <text class="c-#666 f-s-24">{{ Biological?.latinName }}</text>
  628. </view>
  629. <view class="mb-20">
  630. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ Biological?.genusName }}</text>
  631. <text class="c-#666 f-s-24">{{ Biological?.genusLatinName }}</text>
  632. </view>
  633. <view class="">
  634. <text class="c-#666 f-s-24">产出:</text>
  635. <text class="c-#666 f-s-24">{{ Biological?.medicineName }}</text>
  636. </view>
  637. </view>
  638. </up-form-item>
  639. <ut-action-sheet v-model="form.reproductionType" :tabs="pt_reproduction_type" title="选择繁殖方式">
  640. <up-form-item borderBottom label="选择繁殖方式" required prop="reproductionType" id="reproductionTypepppp">
  641. <view v-if="form.reproductionType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_reproduction_type, form.reproductionType) }}</view>
  642. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择选择繁殖方式</view>
  643. <template #right>
  644. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  645. </template>
  646. </up-form-item>
  647. </ut-action-sheet>
  648. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.plantationType" :tabs="pt_plantation_type" title="选择种植类型">
  649. <up-form-item borderBottom label="种植类型" required prop="plantationType" id="plantationTypepppp">
  650. <view v-if="form.plantationType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_plantation_type, form.plantationType) }}</view>
  651. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种植类型</view>
  652. <template #right>
  653. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  654. </template>
  655. </up-form-item>
  656. </ut-action-sheet>
  657. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.sowingMethod" :tabs="pt_sowing_method" title="选择播种方法">
  658. <up-form-item borderBottom label="播种方法" required prop="sowingMethod" id="sowingMethodpppp">
  659. <view v-if="form.sowingMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_sowing_method, form.sowingMethod) }}</view>
  660. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择播种方法</view>
  661. <template #right>
  662. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  663. </template>
  664. </up-form-item>
  665. </ut-action-sheet>
  666. <ut-action-sheet v-if="+form.reproductionType == 2" v-model="form.transplantMethod" :tabs="pt_transplant_method" title="选择移栽方法">
  667. <up-form-item borderBottom label="移栽方法" required prop="transplantMethod" id="transplantMethodpppp">
  668. <view v-if="form.transplantMethod" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_transplant_method, form.transplantMethod) }}</view>
  669. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择移栽方法</view>
  670. <template #right>
  671. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  672. </template>
  673. </up-form-item>
  674. </ut-action-sheet>
  675. <up-form-item borderBottom label="前茬植物" prop="preCropId" id="preCropIddpppp">
  676. <view v-if="!PreBiological" @click="gotoTorganism(2)" class="w-100% d-flex a-c j-c pd-24 b-radius bg-#FBFDFB border-#AFDDBB">
  677. <view class=""></view>
  678. <view class="f-s-34 c-primary">请选择前茬植物名称</view>
  679. </view>
  680. <view v-if="PreBiological" class="pd-24 d-flex flex-cln bg-#FBFDFB border-#37A954 b-radius mb-20 w-100% p-rtv">
  681. <up-icon @click="PreBiological = null" size="26rpx" color="red" name="close" style="position: absolute; right: 10rpx; top: 10rpx"></up-icon>
  682. <view class="mb-20">
  683. <text class="c-#333 f-s-34 f-w-5 mr-5">{{ PreBiological?.varietyName }}</text>
  684. <text class="c-#666 f-s-24">{{ PreBiological?.latinName }}</text>
  685. </view>
  686. <view class="mb-20">
  687. <text class="c-#333 f-s-28 f-w-5 mr-5">{{ PreBiological?.genusName }}</text>
  688. <text class="c-#666 f-s-24">{{ PreBiological?.genusLatinName }}</text>
  689. </view>
  690. <view class="">
  691. <text class="c-#666 f-s-24">产出:</text>
  692. <text class="c-#666 f-s-24">{{ PreBiological?.medicineName }}</text>
  693. </view>
  694. </view>
  695. </up-form-item>
  696. <up-form-item borderBottom label="备注" prop="remark" id="remarkpppp">
  697. <up-input v-model="form.remark" placeholder="请输入备注" border="none"></up-input>
  698. </up-form-item>
  699. </view>
  700. </up-form>
  701. </template>
  702. <view v-if="+form.mgMethod == 2" class="">
  703. <view class="startline-title pl-24 ml-24 mb-16">个体标识信息</view>
  704. <view class="bg-#fff pd-24">
  705. <view class="d-flex pt-20 pb-20">
  706. <view class="">个体标识({{ animalIds.length }}个)</view>
  707. <view class="flex1"></view>
  708. <view class="border-#79C58C radius-100 c-primary f-s-24 pd4-10-20-10-20 d-flex a-c j-c" @click="">扫一扫添加</view>
  709. </view>
  710. <view class="d-flex gap-20 mb-20">
  711. <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>
  712. <view class="b-radius border-#A3E5EA c-#18BECA bg-#FAFFFF w-100% d-flex j-c a-c h-100 f-s-34">从种源库快速添加</view>
  713. </view>
  714. <up-swipe-action>
  715. <up-swipe-action-item class="mb-20" v-for="(item, index) in animalIds" :key="index" :index="item" :name="item" :options="options1" @click="clickSwipe">
  716. <view class="b-radius border-#37A954 c-#333 f-s-28 pd4-34-30-34-30">{{ item }}</view>
  717. </up-swipe-action-item>
  718. </up-swipe-action>
  719. </view>
  720. </view>
  721. </view>
  722. <template #bottom>
  723. <view class="pd-24 d-flex j-c gap-20 base-bottom-wrap">
  724. <up-button type="warning" @click="saveDraft()">暂存</up-button>
  725. <up-button type="primary" @click="save()">提交</up-button>
  726. </view>
  727. </template>
  728. </z-paging>
  729. <ut-confirm-dialog v-model:show="showDeleteDialog" width="75vw" title="添加个体标识" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleDeleteConfirm" @cancel="handleDeleteCancel">
  730. <view class="">
  731. <view class="c-#333 f-s-28">个体标识号</view>
  732. <view class="">
  733. <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
  734. </view>
  735. </view>
  736. </ut-confirm-dialog>
  737. <ut-confirm-dialog v-model:show="showChangeDialog" width="75vw" title="修改个体标识" :confirmText="'确认'" :cancelText="'取消'" @confirm="handleChangeConfirm" @cancel="handleChangeCancel">
  738. <view class="">
  739. <view class="c-#333 f-s-28">个体标识号</view>
  740. <view class="">
  741. <up-input placeholder="请输入个体标识号" v-model="animalId" border="bottom"></up-input>
  742. </view>
  743. </view>
  744. </ut-confirm-dialog>
  745. <!-- 添加drawer组件 -->
  746. <Drawer v-if="drawerVisible" :baseType="form.taskType" v-model="drawerVisible" @open="onDrawerOpen" @close="onDrawerClose" @confirm="onDrawerConfirm" />
  747. <Drawer_laboratory v-if="laboratoryVisible" :baseId="form?.baseId" :landIds="form?.landIds" v-model="laboratoryVisible" @open="openLaboratory" @close="handleLaboratoryClose" @confirm="handleLaboratoryConfirm" />
  748. </template>
  749. <script setup lang="ts">
  750. import { ref } from 'vue';
  751. import Drawer from './models/drawer.vue';
  752. import Baseinfo from './models/baseinfo.vue';
  753. import { useClientRequest } from '@/utils/request';
  754. import type { TaskType, YesNoType, TimeRange, PlantInfo, DelegateInfo, InoculationInfo, LandInfo, BaseSelectData, PlantationTaskForm, FormRuleItem, FormRules } from './models/types';
  755. import Drawer_laboratory from './models/drawer_laboratory.vue';
  756. import ContactUnitInput from '@/models/contact-unit-input/contact-unit-input.vue';
  757. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  758. 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>(
  759. 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'),
  760. );
  761. const form = ref<PlantationTaskForm>({
  762. deawerData: null,
  763. baseId: null,
  764. landIds: [],
  765. taskType: null,
  766. gapFlag: null,
  767. mgMethod: null,
  768. varietyId: null,
  769. plantationCode: null,
  770. plantationMethod: null,
  771. reproductionType: null,
  772. technicalFile: [],
  773. plantingUnit: null,
  774. breedScale: null,
  775. queryType6: {
  776. plannedStartDate: null,
  777. plannedEndDate: null,
  778. },
  779. plant: {
  780. plantingMgAmount: null,
  781. plantingMgUnit: null,
  782. },
  783. plantingAmount: '',
  784. remark: null,
  785. delegateFlag: '0',
  786. delegateInfo: { cpyid: '', cusCode: '', cusName: '' },
  787. delegate: {},
  788. plantationType: null,
  789. sowingMethod: null,
  790. transplantMethod: null,
  791. preCropId: null,
  792. inoculation: {
  793. inoculationAmount: null,
  794. inoculationUnit: null,
  795. inoculationDosage: null,
  796. inoculationDosageUnit: null,
  797. },
  798. cultureMediumFormula: null,
  799. });
  800. const changeStartTime = () => {
  801. if (!form.value?.queryType6?.plannedEndDate) {
  802. form.value.queryType6.plannedEndDate = form.value.queryType6.plannedStartDate;
  803. }
  804. };
  805. //单个溯源都数组
  806. const animalIds = ref<any>([]);
  807. const animalId = ref();
  808. const showDeleteDialog = ref(false);
  809. // 修改耽搁溯源弹窗
  810. const showChangeDialog = ref(false);
  811. let DialogFlag = ref();
  812. const handleChangeConfirm = () => {
  813. // 直接在animalIds中找到DialogFlag相同的项然后修改这个项
  814. const index = animalIds.value.findIndex((item: any) => item == DialogFlag.value);
  815. console.log(index, 'itemToUpdate');
  816. if (index !== -1) {
  817. animalIds.value[index] = animalId.value;
  818. }
  819. animalId.value = null;
  820. DialogFlag.value = null;
  821. };
  822. const handleChangeCancel = () => {
  823. animalId.value = null;
  824. DialogFlag.value = null;
  825. };
  826. // 使用 reactive 创建响应式对象
  827. const options1 = reactive([
  828. {
  829. text: '删除',
  830. style: {
  831. backgroundColor: '#F74C30',
  832. },
  833. },
  834. {
  835. text: '编辑',
  836. style: {
  837. backgroundColor: '#37A954',
  838. },
  839. },
  840. ]);
  841. // 自定义校验函数:养殖时间校验
  842. const validateBreedingTime = (rule: any, value: any, callback: any) => {
  843. if (!value) {
  844. callback(new Error('请选择养殖时间'));
  845. return;
  846. }
  847. const { plannedStartDate, plannedEndDate } = value;
  848. if (!plannedStartDate) {
  849. callback(new Error('请选择养殖开始时间'));
  850. return;
  851. }
  852. if (!plannedEndDate) {
  853. callback(new Error('请选择养殖结束时间'));
  854. return;
  855. }
  856. const startDate = new Date(plannedStartDate);
  857. const endDate = new Date(plannedEndDate);
  858. if (endDate < startDate) {
  859. callback(new Error('养殖结束时间必须晚于开始时间'));
  860. return;
  861. }
  862. callback();
  863. };
  864. // 自定义校验函数:养殖量校验
  865. const validateBreedingAmount = (rule: any, value: any, callback: any) => {
  866. if (+deawerData.value?.data[0]?.landType == 3) {
  867. callback();
  868. return;
  869. }
  870. if (!value) {
  871. callback(new Error('请输入养殖量'));
  872. return;
  873. }
  874. const { plantingMgAmount, plantingMgUnit } = value;
  875. if (!plantingMgAmount || plantingMgAmount.trim() === '') {
  876. callback(new Error('请输入养殖量'));
  877. return;
  878. }
  879. if (!plantingMgUnit) {
  880. callback(new Error('请选择养殖量单位'));
  881. return;
  882. }
  883. callback();
  884. };
  885. // 委托企业
  886. const Enterprise = ref('123');
  887. // 自定义delegateInfo 委托企业校验
  888. const validateDelegateInfo = (rule: any, value: any, callback: any) => {
  889. if (!value) {
  890. callback(new Error('请选择委托企业'));
  891. return;
  892. }
  893. const { cpyid, crediteCode, cusName } = value;
  894. if (!cpyid) {
  895. callback(new Error('请选择委托企业'));
  896. return;
  897. }
  898. callback();
  899. };
  900. //判断是否要填种植面积
  901. const validatePlantingAmount = (rule: any, value: any, callback: any) => {
  902. if (+deawerData.value?.data[0]?.landType == 1) {
  903. if (!value || value.trim() === '') {
  904. callback(new Error('请输入种植面积'));
  905. return;
  906. }
  907. callback();
  908. return;
  909. } else {
  910. callback();
  911. return;
  912. }
  913. };
  914. // 判断是否要填接种数量
  915. const validateinoculation = (rule: any, value: any, callback: any) => {
  916. if (+deawerData.value?.data[0]?.landType == 3) {
  917. if (!value || value.trim() === '') {
  918. callback(new Error('请输入接种数量'));
  919. return;
  920. }
  921. // 检查单位是否选择
  922. if (!form.value.inoculation?.inoculationUnit) {
  923. callback(new Error('请选择接种数量单位'));
  924. return;
  925. }
  926. callback();
  927. } else {
  928. callback();
  929. }
  930. };
  931. const validateInoculationDosage = (rule: any, value: any, callback: any) => {
  932. if (+deawerData.value?.data[0]?.landType == 3) {
  933. // value 就是 form.inoculation.inoculationDosage 的值
  934. if (!value || value.trim() === '') {
  935. callback(new Error('请输入接种剂量'));
  936. return;
  937. }
  938. // 检查单位是否选择
  939. if (!form.value.inoculation?.inoculationDosageUnit) {
  940. callback(new Error('请选择接种剂量单位'));
  941. return;
  942. }
  943. callback();
  944. } else {
  945. callback();
  946. }
  947. };
  948. // 判断溯源级别是否需要校验
  949. const validateMgMethod = (rule: any, value: any, callback: any) => {
  950. if (+deawerData.value?.data[0]?.landType == 3) {
  951. if (!value) {
  952. callback(new Error('请选择溯源级别'));
  953. return;
  954. }
  955. callback();
  956. } else {
  957. callback();
  958. }
  959. };
  960. const rules = reactive({
  961. baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
  962. taskType: [{ required: true, message: '请选择任务类型' }],
  963. mgMethod: [{ required: true, message: '请选择溯源级别' }],
  964. gapFlag: [{ required: true, message: '请选择符合要求' }],
  965. varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
  966. plantationCode: [{ required: true, message: '请输入养殖批号' }],
  967. technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
  968. plantationMethod: [{ required: true, message: '请选择养殖方式' }],
  969. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  970. plantingAmount: [{ required: true, message: '请输入养殖面积' }],
  971. breedScale: [{ required: true, message: '请输入养殖区域' }],
  972. plant: [{ validator: validateBreedingAmount, trigger: 'blur' }],
  973. remark: [{ required: false, message: '请输入备注' }],
  974. });
  975. const rules1 = reactive({
  976. baseId: [{ required: true, message: '请选择种养殖所在的基地' }],
  977. taskType: [{ required: true, message: '请选择任务类型' }],
  978. delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
  979. delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
  980. mgMethod: [{ required: true, message: '请选择溯源级别' }],
  981. varietyId: [{ required: true, message: '请选择养殖的动物名称' }],
  982. plantationCode: [{ required: true, message: '请输入养殖批号' }],
  983. technicalFile: [{ required: false, message: '请选择养殖技术规程文件' }],
  984. plantationMethod: [{ required: false, message: '请选择养殖方式' }],
  985. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  986. plantingAmount: [{ required: true, message: '请输入养殖面积' }],
  987. breedScale: [{ required: true, message: '请输入养殖区域' }],
  988. plant: [{ validator: validateBreedingAmount, trigger: 'blur' }],
  989. remark: [{ required: false, message: '请输入备注' }],
  990. });
  991. const rules2 = reactive({
  992. baseId: [{ required: true, message: '请选择种植所在的基地' }],
  993. taskType: [{ required: true, message: '请选择任务类型' }],
  994. gapFlag: [{ required: true, message: '请选择符合要求' }],
  995. varietyId: [{ required: true, message: '请选择种植的植物名称' }],
  996. plantationCode: [{ required: true, message: '请输入种植批号' }],
  997. technicalFile: [{ required: false, message: '请选择种植技术规程文件' }],
  998. plantationMethod: [{ required: false, message: '请选择种植方式' }],
  999. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1000. plantingAmount: [{ required: true, message: '请输入种植面积' }],
  1001. plant: [{ validator: validateBreedingAmount, trigger: 'blur' }],
  1002. remark: [{ required: false, message: '请输入备注' }],
  1003. preCropId: [{ required: false, message: '请选择前茬植物' }],
  1004. reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
  1005. });
  1006. const rules3 = reactive({
  1007. baseId: [{ required: true, message: '请选择种植所在的基地' }],
  1008. taskType: [{ required: true, message: '请选择任务类型' }],
  1009. delegateFlag: [{ required: true, message: '请选择是否代繁育' }],
  1010. delegateInfo: [{ validator: validateDelegateInfo, trigger: 'blur' }],
  1011. mgMethod: [{ validator: validateMgMethod, trigger: 'blur' }],
  1012. varietyId: [{ required: true, message: '请选择种植的植物名称' }],
  1013. plantationCode: [{ required: true, message: '请输入种植批号' }],
  1014. technicalFile: [{ required: false, message: '请选择繁育技术规程文件' }],
  1015. plantationMethod: [{ required: false, message: '请选择繁育方式' }],
  1016. queryType6: [{ validator: validateBreedingTime, trigger: 'blur' }],
  1017. plantingAmount: [{ validator: validatePlantingAmount, trigger: 'blur' }],
  1018. plant: [{ validator: validateBreedingAmount, trigger: 'blur' }],
  1019. 'inoculation.inoculationAmount': [{ validator: validateinoculation, trigger: 'blur' }],
  1020. 'inoculation.inoculationDosage': [{ validator: validateInoculationDosage, trigger: 'blur' }],
  1021. remark: [{ required: false, message: '请输入备注' }],
  1022. preCropId: [{ required: false, message: '请选择前茬植物' }],
  1023. reproductionType: [{ required: true, message: '请选择选择繁殖方式' }],
  1024. });
  1025. const upFormRef = ref<any>();
  1026. const paging = ref<any>();
  1027. const list = ref<unknown>([]);
  1028. // 控制抽屉显示状态
  1029. const drawerVisible = ref(false);
  1030. // 打开抽屉
  1031. function openDrawer() {
  1032. drawerVisible.value = true;
  1033. }
  1034. // 关闭抽屉
  1035. function closeDrawer() {
  1036. drawerVisible.value = false;
  1037. }
  1038. // 处理抽屉打开事件
  1039. function onDrawerOpen() {
  1040. console.log('抽屉打开了');
  1041. }
  1042. // 处理抽屉关闭事件
  1043. function onDrawerClose() {
  1044. console.log('抽屉关闭了');
  1045. }
  1046. const deawerData = ref<any>(null);
  1047. // 处理抽屉确认事件
  1048. function onDrawerConfirm(data: any) {
  1049. console.log('收到基地选择数据:', data);
  1050. deawerData.value = data;
  1051. // 确认基地id
  1052. form.value.baseId = data.data[0]?.baseId;
  1053. //确认地块面积
  1054. if (+data.data[0]?.landType !== 3) {
  1055. form.value.plantingAmount = '';
  1056. data.data.forEach((i: LandInfo) => {
  1057. form.value.plantingAmount += i.area;
  1058. });
  1059. }
  1060. //确认养殖区域的个数
  1061. form.value.breedScale = data.data?.length;
  1062. if (data?.aloneChecked) {
  1063. form.value.landIds = [];
  1064. } else {
  1065. form.value.landIds = data?.checkBox;
  1066. }
  1067. }
  1068. // 处理Baseinfo组件的关闭事件
  1069. function handleBaseinfoClose() {
  1070. deawerData.value = null;
  1071. }
  1072. // 所选动植物
  1073. const Biological = ref<any>(null);
  1074. // 所选前茬植物
  1075. const PreBiological = ref<any>(null);
  1076. //随机生成
  1077. const randomCode = async () => {
  1078. let plType = '';
  1079. const taskType = form.value.taskType;
  1080. if (taskType === 1) {
  1081. plType = 'P';
  1082. } else if (taskType === 2) {
  1083. plType = 'F';
  1084. } else {
  1085. plType = 'C';
  1086. }
  1087. const code = await useClientRequest.post('/plt-api/app/plantationTask/getBatchCode', { plType: plType, linkType: plType });
  1088. form.value.plantationCode = code.data;
  1089. };
  1090. //完成提交表单
  1091. const save = () => {
  1092. uni.$u.debounce(async () => {
  1093. try {
  1094. console.log('开始提交');
  1095. await upFormRef.value?.validate();
  1096. console.log('校验完成');
  1097. form.value.delegateInfo.cusName = form.value?.delegate.cusName;
  1098. form.value.delegateInfo.cusCode = form.value?.delegate.cusCode;
  1099. const params = {
  1100. ...form.value,
  1101. ...form.value.queryType6,
  1102. ...form.value.plant,
  1103. ...form.value.inoculation,
  1104. animalIds: animalIds.value,
  1105. };
  1106. const res = await useClientRequest.post('/plt-api/app/plantationTask/saveTask', params);
  1107. if (res.code == 200) {
  1108. uni.showToast({
  1109. title: '提交成功',
  1110. icon: 'success',
  1111. duration: 2000,
  1112. });
  1113. setTimeout(() => {
  1114. uni.navigateBack();
  1115. }, 1000);
  1116. }
  1117. } catch (error: any) {
  1118. // 滚动到第一个错误字段
  1119. console.log(error);
  1120. const firstErrorField = error && error[0].field + 'pppp';
  1121. paging.value?.scrollIntoViewById(firstErrorField, 30, true);
  1122. return;
  1123. }
  1124. });
  1125. };
  1126. // 暂存
  1127. const saveDraft = () => {
  1128. uni.$u.debounce(async () => {
  1129. try {
  1130. const params = {
  1131. ...form.value,
  1132. ...form.value.queryType6,
  1133. ...form.value.plant,
  1134. ...form.value.inoculation,
  1135. animalIds: animalIds.value,
  1136. };
  1137. if (form.value?.delegate?.cusCode) {
  1138. form.value.delegateInfo.cusName = form.value?.delegate?.cusName;
  1139. form.value.delegateInfo.cusCode = form.value?.delegate?.cusCode;
  1140. }
  1141. console.log('暂存参数:', params);
  1142. const res = await useClientRequest.post('/plt-api/app/plantationTask/draftTask', params);
  1143. if (res.code == 200) {
  1144. uni.showToast({
  1145. title: '提交成功',
  1146. icon: 'success',
  1147. duration: 2000,
  1148. });
  1149. setTimeout(() => {
  1150. uni.navigateBack();
  1151. }, 1000);
  1152. }
  1153. } catch (error: any) {
  1154. console.log(error, 'error');
  1155. }
  1156. });
  1157. };
  1158. //确认添加个体
  1159. const handleDeleteConfirm = () => {
  1160. if (animalId.value) {
  1161. if (animalIds.value.includes(animalId.value)) {
  1162. uni.showToast({
  1163. title: '个体标识不可重复',
  1164. icon: 'none',
  1165. });
  1166. animalId.value = null;
  1167. return;
  1168. }
  1169. animalIds.value.push(animalId.value);
  1170. animalId.value = null;
  1171. } else {
  1172. uni.showToast({
  1173. title: '请输入个体标识号',
  1174. icon: 'none',
  1175. });
  1176. }
  1177. };
  1178. const handleDeleteCancel = () => {
  1179. animalId.value = null;
  1180. };
  1181. const clickSwipe = async (name: any, index: number) => {
  1182. if (name?.index == 0) {
  1183. const res = await uni.showModal({
  1184. title: '删除提示',
  1185. content: '删除后不可撤回,请谨慎操作!',
  1186. confirmColor: '#F74C30',
  1187. });
  1188. if (!res.confirm) return;
  1189. await uni.showLoading({
  1190. title: '删除中...',
  1191. mask: true,
  1192. });
  1193. const findindex = animalIds.value.findIndex((i) => i == name?.name);
  1194. animalIds.value.splice(findindex, 1);
  1195. uni.hideLoading();
  1196. uni.showToast({
  1197. title: '删除成功',
  1198. icon: 'success',
  1199. });
  1200. } else {
  1201. showChangeDialog.value = true;
  1202. DialogFlag.value = name?.name;
  1203. }
  1204. };
  1205. // 如果是组培实验室的话,繁育量是一个计算属性
  1206. const plantingMgAmount = computed(() => {
  1207. // 安全访问嵌套属性
  1208. if (Number(deawerData.value?.data?.[0]?.landType) !== 3) {
  1209. return '';
  1210. }
  1211. const inoculationAmount = Number(form.value?.inoculation?.inoculationAmount);
  1212. const inoculationDosage = Number(form.value?.inoculation?.inoculationDosage);
  1213. // 如果任一值为无效数字,返回空字符串
  1214. if (!inoculationAmount || !inoculationDosage || isNaN(inoculationAmount) || isNaN(inoculationDosage)) {
  1215. return '';
  1216. }
  1217. const result = inoculationAmount * inoculationDosage;
  1218. // 返回计算结果,保持数字类型或空字符串
  1219. return isNaN(result) ? '' : result;
  1220. });
  1221. // 如果是组培实验室的话,繁育量单位是一个计算属性
  1222. const plantingMgUnit = computed(() => {
  1223. if (Number(deawerData.value?.data?.[0]?.landType) == 3) {
  1224. form.value.plant.plantingMgUnit = form.value.inoculation?.inoculationDosageUnit || null;
  1225. return form.value.plant.plantingMgUnit;
  1226. }
  1227. return null;
  1228. });
  1229. const laboratory = ref<any>();
  1230. // 控制抽屉显示状态
  1231. const laboratoryVisible = ref(false);
  1232. // 处理实验室的关闭
  1233. function handleLaboratoryClose() {
  1234. laboratory.value = null;
  1235. }
  1236. // 处理实验室的打开
  1237. function openLaboratory() {
  1238. laboratoryVisible.value = true;
  1239. }
  1240. // 处理抽屉确认事件
  1241. function handleLaboratoryConfirm(data: any) {
  1242. console.log('收到基地选择数据:', data);
  1243. }
  1244. const taskId = ref();
  1245. onLoad((options) => {
  1246. if (!options?.taskType && options?.taskId) {
  1247. taskId.value = options?.taskId;
  1248. } else {
  1249. form.value.taskType = options?.taskType;
  1250. if (+options?.taskType == 1 || +options?.taskType == 11) {
  1251. form.value.plantingUnit = '亩';
  1252. if (+options?.taskType == 11) {
  1253. form.value.gapFlag = 0;
  1254. }
  1255. } else {
  1256. form.value.plantingUnit = '平方米';
  1257. if (+options?.taskType == 21) {
  1258. form.value.gapFlag = 0;
  1259. }
  1260. }
  1261. }
  1262. });
  1263. const gotoTorganism = (type: number) => {
  1264. if (type == 1) {
  1265. uni.$once('updateBiologicalname', function (data) {
  1266. Biological.value = data.msg;
  1267. console.log(Biological.value);
  1268. form.value.varietyId = data.msg.id;
  1269. });
  1270. } else {
  1271. uni.$once('updateBiologicalname', function (data) {
  1272. PreBiological.value = data.msg;
  1273. form.value.preCropId = data.msg.id;
  1274. });
  1275. }
  1276. uni.navigateTo({
  1277. url: '/tools/por-torganism/index',
  1278. });
  1279. };
  1280. // 查看是否有缓存的信息
  1281. const getCache = async (taskType: TaskType | null) => {
  1282. const res = await useClientRequest.get(`/plt-api/app/plantationTask/getDraft/${taskType}`);
  1283. if (!res.data) return;
  1284. form.value = res.data;
  1285. form.value.queryType6 = {
  1286. plannedStartDate: res.data.plannedStartDate,
  1287. plannedEndDate: res.data.plannedEndDate,
  1288. };
  1289. form.value.inoculation = {
  1290. inoculationAmount: res.data.inoculationAmount,
  1291. inoculationDosage: res.data.inoculationDosage,
  1292. inoculationUnit: res.data.inoculationUnit,
  1293. inoculationDosageUnit: res.data.inoculationDosageUnit,
  1294. };
  1295. form.value.plant = {
  1296. plantingMgAmount: res.data.plantingMgAmount,
  1297. plantingMgUnit: res.data.plantingMgUnit,
  1298. };
  1299. form.value.delegate = {
  1300. cusCode: form.value.delegateInfo?.cusCode,
  1301. cusName: form.value.delegateInfo?.cusName,
  1302. };
  1303. console.log(form.value.delegate);
  1304. if (res.data.animalIds) {
  1305. animalIds.value = res.data.animalIds;
  1306. }
  1307. if (res.data.preCropCode) {
  1308. PreBiological.value = {};
  1309. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
  1310. PreBiological.value = Bio.data;
  1311. }
  1312. if (res.data.varietyCode) {
  1313. Biological.value = {};
  1314. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
  1315. Biological.value = Bio.data;
  1316. }
  1317. // 判断有没有基地,然后去获取基地数据
  1318. if (res.data.baseId) {
  1319. deawerData.value = {};
  1320. deawerData.value.baseName = res.data.baseRef.baseName;
  1321. deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
  1322. deawerData.value.area = res.data.baseRef.baseInfo.area;
  1323. deawerData.value.address = res.data.baseRef.baseInfo.address;
  1324. // adcodeName
  1325. deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
  1326. if (res.data.landIds.length == 0) {
  1327. deawerData.value.aloneChecked = true;
  1328. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1329. deawerData.value.data = landIds.rows;
  1330. } else {
  1331. deawerData.value.aloneChecked = false;
  1332. deawerData.value.data = [];
  1333. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1334. //找到res.data.landIds和landIds.rows中的id相同的项
  1335. landIds.rows.forEach((i: any) => {
  1336. if (res.data.landIds.find((t: any) => t == i.id)) {
  1337. deawerData.value.data.push(i);
  1338. }
  1339. });
  1340. }
  1341. }
  1342. };
  1343. // 获取详细数据
  1344. const getInfo = async (taskId: any) => {
  1345. const res = await useClientRequest.get<any>(`/plt-api/app/plantationTask/getInfo/${taskId}`);
  1346. if (!res.data) return;
  1347. form.value = res.data;
  1348. form.value.queryType6 = {
  1349. plannedStartDate: res.data.plannedStartDate,
  1350. plannedEndDate: res.data.plannedEndDate,
  1351. };
  1352. form.value.inoculation = {
  1353. inoculationAmount: res.data.inoculationAmount,
  1354. inoculationDosage: res.data.inoculationDosage,
  1355. inoculationUnit: res.data.inoculationUnit,
  1356. inoculationDosageUnit: res.data.inoculationDosageUnit,
  1357. };
  1358. form.value.plant = {
  1359. plantingMgAmount: res.data.plantingMgAmount,
  1360. plantingMgUnit: res.data.plantingMgUnit,
  1361. };
  1362. form.value.delegate = {
  1363. cusCode: form.value.delegateInfo?.cusCode,
  1364. cusName: form.value.delegateInfo?.cusName,
  1365. };
  1366. if (res.data.animalIds) {
  1367. animalIds.value = res.data.animalIds;
  1368. }
  1369. if (res.data.preCropCode) {
  1370. PreBiological.value = {};
  1371. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.preCropCode}`);
  1372. PreBiological.value = Bio.data;
  1373. }
  1374. if (res.data.varietyCode) {
  1375. Biological.value = {};
  1376. const Bio = await useClientRequest.get(`/plt-api/app/medicine/getMedicineByCode/${res.data.varietyCode}`);
  1377. Biological.value = Bio.data;
  1378. }
  1379. // 判断有没有基地,然后去获取基地数据
  1380. if (res.data.baseId) {
  1381. deawerData.value = {};
  1382. deawerData.value.baseName = res.data.baseRef.baseName;
  1383. deawerData.value.areaUnit = res.data.baseRef.baseInfo.areaUnit;
  1384. deawerData.value.area = res.data.baseRef.baseInfo.area;
  1385. deawerData.value.address = res.data.baseRef.baseInfo.address;
  1386. // adcodeName
  1387. deawerData.value.adcodeName = res.data.baseRef.baseInfo.adcodeName;
  1388. if (res.data.landIds.length == 0) {
  1389. deawerData.value.aloneChecked = true;
  1390. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1391. deawerData.value.data = landIds.rows;
  1392. } else {
  1393. deawerData.value.aloneChecked = false;
  1394. deawerData.value.data = [];
  1395. const landIds = await useClientRequest.get('/plt-api/app/baseLandInfo/pageList', { baseId: res.data.baseId });
  1396. //找到res.data.landIds和landIds.rows中的id相同的项
  1397. landIds.rows.forEach((i: any) => {
  1398. if (res.data.landIds.find((t: any) => t == i.id)) {
  1399. deawerData.value.data.push(i);
  1400. }
  1401. });
  1402. }
  1403. }
  1404. };
  1405. onMounted(() => {
  1406. if (taskId.value) {
  1407. getInfo(taskId.value);
  1408. } else {
  1409. getCache(form.value.taskType);
  1410. }
  1411. });
  1412. </script>