index.vue 90 KB

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