index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <z-paging class="" ref="paging" bgColor="#fff" paging-class="paging-btm-shadow" safe-area-inset-bottom
  3. scroll-with-animation>
  4. <template #top>
  5. <ut-navbar :title="did ? '编辑种源入库信息' : '添加种源入库信息'" :fixed="false" border></ut-navbar>
  6. </template>
  7. <view class="pd-24">
  8. <up-form class="p-rtv" labelPosition="top" :model="form" :rules="rules" labelWidth="auto" ref="upFormRef">
  9. <!-- 基本信息 -->
  10. <ut-action-sheet :tabs="pt_seed_type" mode="custom" title="种源类型" v-model="form.seedType">
  11. <up-form-item borderBottom label="种源类型" required prop="seedType">
  12. <view v-if="form.seedType" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_seed_type,
  13. form.seedType) }}</view>
  14. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择基地类型</view>
  15. <template #right>
  16. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  17. </template>
  18. </up-form-item>
  19. </ut-action-sheet>
  20. <up-form-item borderBottom label="物种基原" required prop="varietyId">
  21. <view class="flex1">
  22. <up-button v-if="!form.varietyId" @click="selectVarietyId" type="primary" plain>
  23. <image class="w-36 h-36 mr-10" src="@/static/images/common/select_push_icon.png"
  24. mode="widthFix" />
  25. <span>请选择物种基原</span>
  26. </up-button>
  27. <view v-else class="bg-#FBFDFB card-info-block pd-24 p-rtv">
  28. <view class="mb-16">
  29. <span class="f-s-34 c-#333 f-w-5 mr-16">{{ form?.varietyInfo?.varietyName }}</span>
  30. <span class="f-s-24 c-#666">{{ form?.varietyInfo?.latinName }}</span>
  31. </view>
  32. <view class="mb-16">
  33. <span class="f-s-28 c-#333 f-w-5 mr-16">{{ form?.varietyInfo?.genusName }}</span>
  34. <span class="f-s-24 c-#666">{{ form?.varietyInfo?.genusLatinName }}</span>
  35. </view>
  36. <view class="f-s-24 c-#666">产出:{{ form?.varietyInfo?.medicineName }}</view>
  37. <view class="close-icon pd-16" @click="form.varietyId = ''; form.varietyInfo = null;">
  38. <up-icon color="#F81242" name="close" size="32rpx"></up-icon>
  39. </view>
  40. </view>
  41. </view>
  42. </up-form-item>
  43. <up-form-item borderBottom label="具体品种/品系名称" prop="seedName">
  44. <up-input v-model="form.seedName" placeholder="请输入具体品种/品系名称" border="none" clearable></up-input>
  45. </up-form-item>
  46. <ut-action-sheet :tabs="pt_seed_source" mode="custom" title="种源来源" v-model="form.seedSource">
  47. <up-form-item borderBottom label="种源来源" required prop="seedSource">
  48. <view v-if="form.seedSource" class="f-s-30 c-333 f-w-5 flex1">{{ selectDictLabel(pt_seed_source,
  49. form.seedSource) }}</view>
  50. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择种源来源</view>
  51. <template #right>
  52. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  53. </template>
  54. </up-form-item>
  55. </ut-action-sheet>
  56. <ut-action-sheet :tabs="pt_mother_father_flag" mode="custom" title="父母本情况"
  57. v-model="form.instoreBizInfo.motherFatherFlag">
  58. <up-form-item borderBottom label="父母本情况" prop="motherFatherFlag">
  59. <view v-if="form.instoreBizInfo.motherFatherFlag" class="f-s-30 c-333 f-w-5 flex1">{{
  60. selectDictLabel(pt_mother_father_flag, form.instoreBizInfo.motherFatherFlag) }}</view>
  61. <view v-else class="f-s-30 c-ccc f-w-4 flex1">请选择父母本情况</view>
  62. <template #right>
  63. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  64. </template>
  65. </up-form-item>
  66. </ut-action-sheet>
  67. <template>
  68. <!-- 父本品种 -->
  69. <up-form-item v-if="form?.instoreBizInfo?.motherFatherFlag == '2'" borderBottom label="父本品种" prop="fatherVarietyId">
  70. <view class="flex1">
  71. <up-button v-if="!form.instoreBizInfo.fatherVarietyId" @click="selectFatherVarietyId"
  72. type="primary" plain>
  73. <image class="w-36 h-36 mr-10" src="@/static/images/common/select_push_icon.png"
  74. mode="widthFix" />
  75. <span>请选择父本品种</span>
  76. </up-button>
  77. <view v-else class="bg-#FBFDFB card-info-block pd-24 p-rtv">
  78. <view class="mb-16">
  79. <span class="f-s-34 c-#333 f-w-5 mr-16">{{
  80. form?.instoreBizInfo?.fatherVarietyInfo?.varietyName }}</span>
  81. <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.fatherVarietyInfo?.latinName
  82. }}</span>
  83. </view>
  84. <view class="mb-16">
  85. <span class="f-s-28 c-#333 f-w-5 mr-16">{{
  86. form?.instoreBizInfo?.fatherVarietyInfo?.genusName
  87. }}</span>
  88. <span class="f-s-24 c-#666">{{
  89. form?.instoreBizInfo?.fatherVarietyInfo?.genusLatinName }}</span>
  90. </view>
  91. <view class="f-s-24 c-#666">产出:{{ form?.instoreBizInfo?.fatherVarietyInfo?.medicineName
  92. }}</view>
  93. <view class="close-icon pd-16"
  94. @click="form.instoreBizInfo.fatherVarietyId = ''; form.instoreBizInfo.fatherVarietyInfo = null;">
  95. <up-icon color="#F81242" name="close" size="32rpx"></up-icon>
  96. </view>
  97. </view>
  98. </view>
  99. </up-form-item>
  100. <!-- 母本品种 -->
  101. <up-form-item borderBottom label="母本品种" prop="instoreBizInfo.motherVarietyId">
  102. <view class="flex1">
  103. <up-button v-if="!form.instoreBizInfo.motherVarietyId" @click="selectMotherVarietyId"
  104. type="primary" plain>
  105. <image class="w-36 h-36 mr-10" src="@/static/images/common/select_push_icon.png"
  106. mode="widthFix" />
  107. <span>请选择母本品种</span>
  108. </up-button>
  109. <view v-else class="bg-#FBFDFB card-info-block pd-24 p-rtv mt-16">
  110. <view class="mb-16">
  111. <span class="f-s-34 c-#333 f-w-5 mr-16">{{
  112. form?.instoreBizInfo?.motherVarietyInfo?.varietyName }}</span>
  113. <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.motherVarietyInfo?.latinName }}</span>
  114. </view>
  115. <view class="mb-16">
  116. <span class="f-s-28 c-#333 f-w-5 mr-16">{{ form?.instoreBizInfo?.motherVarietyInfo?.genusName }}</span>
  117. <span class="f-s-24 c-#666">{{ form?.instoreBizInfo?.motherVarietyInfo?.genusLatinName }}</span>
  118. </view>
  119. <view class="f-s-24 c-#666">产出:{{ form?.instoreBizInfo?.motherVarietyInfo?.medicineName }}</view>
  120. <view class="close-icon pd-16" @click="form.instoreBizInfo.motherVarietyId = ''; form.instoreBizInfo.motherVarietyInfo = null;">
  121. <up-icon color="#F81242" name="close" size="32rpx"></up-icon>
  122. </view>
  123. </view>
  124. </view>
  125. </up-form-item>
  126. </template>
  127. <up-form-item label="繁衍世代" prop="instoreBizInfo.genCount">
  128. <up-input v-model="form.instoreBizInfo.genCount" placeholder="请输入繁衍世代" border="none" clearable />
  129. <template #right>
  130. <view @click.stop>
  131. <ut-action-sheet v-model="form.unit" :tabs="pt_materail_unit" mode="custom" title="选择单位">
  132. <!-- 可点击选择单位 -->
  133. <view class="d-flex pd-10" style="">
  134. <span>{{ form.unit || '代' }}</span>
  135. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  136. </view>
  137. </ut-action-sheet>
  138. </view>
  139. </template>
  140. </up-form-item>
  141. <up-form-item borderBottom label="受托单位" prop="entrustId">
  142. <up-input v-model="form.entrustId" placeholder="请输入受托单位" border="none" clearable></up-input>
  143. </up-form-item>
  144. <!-- 入库数量与单位 -->
  145. <up-form-item label="入库量" prop="capacity" required borderBottom>
  146. <up-input v-model="form.capacity" placeholder="请输入入库量" border="none" clearable />
  147. <template #right>
  148. <view @click.stop>
  149. <ut-action-sheet v-model="form.unit" :tabs="pt_seed_unit" mode="custom" title="选择单位">
  150. <!-- 可点击选择单位 -->
  151. <view class="d-flex pd-10" style="">
  152. <span>{{ form.unit || '株' }}</span>
  153. <up-icon size="22rpx" color="#2A6D52" name="arrow-down-fill"></up-icon>
  154. </view>
  155. </ut-action-sheet>
  156. </view>
  157. </template>
  158. </up-form-item>
  159. <!-- 检验报告与供应商信息 -->
  160. <up-form-item borderBottom label="检验报告" prop="examinReport">
  161. <up-input v-model="form.examinReport" placeholder="请输入检验报告编号或说明" border="none" clearable></up-input>
  162. </up-form-item>
  163. <up-form-item borderBottom label="供应商" prop="supplierId">
  164. <up-input v-model="form.supplierId" placeholder="请输入供应商" border="none" clearable></up-input>
  165. </up-form-item>
  166. <up-form-item borderBottom label="供应商名称" prop="supplier">
  167. <up-input v-model="form.supplier" placeholder="请输入供应商名称" border="none" clearable></up-input>
  168. </up-form-item>
  169. <up-form-item borderBottom label="生产商" prop="producer">
  170. <up-input v-model="form.producer" placeholder="请输入生产商名称" border="none" clearable></up-input>
  171. </up-form-item>
  172. <!-- 菌种编码信息 -->
  173. <up-form-item borderBottom label="菌种/菌株编号" prop="fungusCode">
  174. <up-input v-model="form.fungusCode" placeholder="请输入菌种/菌株编号" border="none" clearable></up-input>
  175. </up-form-item>
  176. <up-form-item borderBottom label="菌种编码类型" prop="fungusCodeType">
  177. <up-input v-model="form.fungusCodeType" placeholder="请输入菌种编码类型" border="none" clearable></up-input>
  178. </up-form-item>
  179. <!-- 个体标识:此处仅占位,后续可改为多选列表 -->
  180. <up-form-item borderBottom label="是否有个体标识" prop="instoreBizInfo.idFlag" required>
  181. <up-radio-group v-model="form.instoreBizInfo.idFlag">
  182. <up-radio :customStyle="{ marginRight: '60rpx' }" v-for="(item, index) in yes_no" :key="index"
  183. :label="item.label" :name="item.value"></up-radio>
  184. </up-radio-group>
  185. </up-form-item>
  186. <!-- 个体标识:此处仅占位,后续可改为多选列表 -->
  187. <template v-if="+form?.instoreBizInfo?.idFlag">
  188. <up-form-item borderBottom label="个体标识号" prop="instoreBizInfo.animals" required>
  189. <AnimalsInput v-model="form.instoreBizInfo.animals"></AnimalsInput>
  190. </up-form-item>
  191. </template>
  192. <!-- 媒体与附件 -->
  193. <up-form-item borderBottom label="种源图片" prop="imgs">
  194. <ut-upload v-model="form.imgs" :max-count="9"></ut-upload>
  195. </up-form-item>
  196. <up-form-item borderBottom label="种源视频" prop="vedios">
  197. <ut-upload v-model="form.vedios" :max-count="3" accept="video" valueType="array"></ut-upload>
  198. </up-form-item>
  199. <!-- 产地与繁殖信息 -->
  200. <up-form-item borderBottom label="种源产地" prop="adcode">
  201. <up-input v-model="form.adcode" placeholder="请输入种源产地行政编码" border="none" clearable></up-input>
  202. </up-form-item>
  203. <up-form-item borderBottom label="繁殖材料" prop="generationMaterial">
  204. <up-input v-model="form.generationMaterial" placeholder="请输入繁殖材料" border="none"
  205. clearable></up-input>
  206. </up-form-item>
  207. <up-form-item borderBottom label="繁殖地点/采集地点" prop="generationAdcode">
  208. <up-input v-model="form.generationAdcode" placeholder="请输入繁殖/采集地点编码或名称" border="none"
  209. clearable></up-input>
  210. </up-form-item>
  211. <!-- 资质证明附件(暂按上传控件处理,可后续细化) -->
  212. <up-form-item borderBottom label="物种鉴定证书" prop="spCert">
  213. <ut-upload v-model="form.spCert" :max-count="9" valueType="array" accept="file"></ut-upload>
  214. </up-form-item>
  215. <up-form-item borderBottom label="新品种证书" prop="newSpCert">
  216. <ut-upload v-model="form.newSpCert" :max-count="9" valueType="array" accept="file"></ut-upload>
  217. </up-form-item>
  218. <up-form-item borderBottom label="引种证明" prop="importCert">
  219. <ut-upload v-model="form.importCert" :max-count="9" valueType="array" accept="file"></ut-upload>
  220. </up-form-item>
  221. <!-- 检疫信息 -->
  222. <up-form-item borderBottom label="种源检疫证号" prop="seedCheckSn">
  223. <up-input v-model="form.seedCheckSn" placeholder="请输入种源检疫证号" border="none" clearable></up-input>
  224. </up-form-item>
  225. <up-form-item borderBottom label="种源检疫证书" prop="seedCheckCert">
  226. <ut-upload v-model="form.seedCheckCert" :max-count="9" valueType="array" accept="file"></ut-upload>
  227. </up-form-item>
  228. </up-form>
  229. </view>
  230. <template #bottom>
  231. <view class="pd-20 d-flex">
  232. <up-button @click="submitForm" type="primary">保存</up-button>
  233. </view>
  234. </template>
  235. </z-paging>
  236. </template>
  237. <script setup lang="ts">
  238. import { useClientRequest } from '@/utils/request';
  239. import { seedInfoListType } from '../models/type';
  240. import AnimalsInput from '../models/animals-input.vue';
  241. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  242. const { pt_seed_type, pt_seed_source, pt_materail_unit, pt_mother_father_flag, pt_seed_unit, pt_fungus_code_type, pt_breeding_materials, yes_no } = toRefs<any>(proxy?.useDict('pt_seed_type', 'pt_seed_source', 'pt_materail_unit', 'pt_mother_father_flag', 'pt_op_method', 'pt_seed_unit', 'pt_fungus_code_type', 'pt_breeding_materials', 'yes_no'));
  243. const paging = ref<any>(null);
  244. const upFormRef = ref<any>(null);
  245. const form = ref<seedInfoListType>({
  246. imgs: [],
  247. spCert: [],
  248. newSpCert: [],
  249. importCert: [],
  250. seedCheckCert: [],
  251. unit: '株',
  252. instoreBizInfo: {
  253. motherFatherFlag: '',
  254. idFlag: '1',
  255. },
  256. });
  257. const rules = reactive({});
  258. const submitForm = async () => {
  259. uni.$u.debounce(
  260. async () => {
  261. try {
  262. await upFormRef.value?.validate();
  263. } catch (error: any) {
  264. // 滚动到第一个错误字段
  265. const firstErrorField = error && error[0].prop + 'pppp';
  266. paging.value?.scrollIntoViewById(firstErrorField, 30, true);
  267. return;
  268. }
  269. // 提交表单
  270. uni.showLoading({
  271. title: '提交中...',
  272. });
  273. try {
  274. } catch (error) {
  275. uni.hideLoading();
  276. }
  277. },
  278. 500,
  279. true,
  280. );
  281. };
  282. // 去选择物种基原
  283. const selectVarietyId = () => {
  284. uni.$once('updateBiologicalname', function (data) {
  285. console.log(data);
  286. form.value.varietyId = data.msg.id;
  287. form.value.varietyInfo = data.msg;
  288. });
  289. uni.$u.route({
  290. type: 'navigateTo',
  291. url: '/tools/por-torganism/index',
  292. params: {
  293. title: '选择物种基原',
  294. },
  295. });
  296. };
  297. const selectFatherVarietyId = () => {
  298. uni.$once('updateBiologicalname', function (data) {
  299. form.value.instoreBizInfo.fatherVarietyId = data.msg.id;
  300. form.value.instoreBizInfo.fatherVarietyInfo = data.msg;
  301. });
  302. uni.$u.route({
  303. type: 'navigateTo',
  304. url: '/tools/por-torganism/index',
  305. params: {
  306. title: '选择父本品种',
  307. },
  308. });
  309. };
  310. const selectMotherVarietyId = () => {
  311. uni.$once('updateBiologicalname', function (data) {
  312. form.value.instoreBizInfo.motherVarietyId = data.msg.id;
  313. form.value.instoreBizInfo.motherVarietyInfo = data.msg;
  314. });
  315. uni.$u.route({
  316. type: 'navigateTo',
  317. url: '/tools/por-torganism/index',
  318. params: {
  319. title: '选择母本品种',
  320. },
  321. });
  322. };
  323. const did = ref('');
  324. onLoad((optins: any) => {
  325. if (optins.id) {
  326. // 编辑加载详情
  327. did.value = optins.id;
  328. } else {
  329. }
  330. });
  331. </script>
  332. <style lang="scss" scoped>
  333. .card-info-block {
  334. border: 1rpx solid #afddbb;
  335. border-radius: 10rpx;
  336. }
  337. .close-icon {
  338. position: absolute;
  339. top: 0rpx;
  340. right: 0rpx;
  341. }
  342. </style>