prescriptionPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div class="prescription-page">
  3. <div class="prescription-title">
  4. <img @click="goBack" src="@/assets/img/home/back.png" alt="" />
  5. <div class="title-name">农场基本信息</div>
  6. <div class="title-desc">请认真核对一下内容</div>
  7. </div>
  8. <div class="prescription-box">
  9. <div class="box-title">
  10. <img src="@/assets/img/home/label-icon.png" />
  11. 农场情况
  12. </div>
  13. <div class="box-content">
  14. <div class="box-item" v-for="(group, i) in productList" :key="i">
  15. <div class="item-name">
  16. <span class="required-icon">*</span>
  17. <span>{{ group.name }}</span>
  18. </div>
  19. <div class="tips">{{ group.subName }}</div>
  20. <div class="item-checkbox">
  21. <el-radio-group v-model="group.checked">
  22. <el-radio-button
  23. v-for="(item, index) in group.items"
  24. :key="index"
  25. :label="item.name"
  26. :value="item.name"
  27. />
  28. </el-radio-group>
  29. </div>
  30. </div>
  31. <!-- 农场规模 -->
  32. <div class="farm-scale-header">
  33. <div class="farm-scale-title">请填写您的农场规模</div>
  34. <div class="farm-scale-desc">农闲时可以提供农事服务,获取额外收益</div>
  35. </div>
  36. <div class="farm-scale-form">
  37. <div class="farm-scale-item">
  38. <label class="farm-scale-label">一般长工人数</label>
  39. <el-input
  40. v-model="farmScale.longTermWorker"
  41. placeholder="请输入人数"
  42. class="farm-scale-input"
  43. >
  44. <template #append>人</template>
  45. </el-input>
  46. </div>
  47. <div class="farm-scale-item">
  48. <label class="farm-scale-label">植保技能人数</label>
  49. <el-input
  50. v-model="farmScale.plantProtection"
  51. placeholder="请输入人数"
  52. class="farm-scale-input"
  53. >
  54. <template #append>人</template>
  55. </el-input>
  56. </div>
  57. <div class="farm-scale-item">
  58. <label class="farm-scale-label">剪枝技能人数</label>
  59. <el-input
  60. v-model="farmScale.pruning"
  61. placeholder="请输入人数"
  62. class="farm-scale-input"
  63. >
  64. <template #append>人</template>
  65. </el-input>
  66. </div>
  67. </div>
  68. <div class="box-item" v-for="(group, i) in farmScaleList" :key="i">
  69. <div class="item-name">
  70. <span class="required-icon">*</span>
  71. <span>{{ group.name }}</span>
  72. </div>
  73. <div class="tips">{{ group.subName }}</div>
  74. <div class="item-checkbox">
  75. <el-radio-group v-model="group.checked">
  76. <el-radio-button
  77. v-for="(item, index) in group.items"
  78. :key="index"
  79. :label="item.name"
  80. :value="item.name"
  81. />
  82. </el-radio-group>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <!-- <div class="prescription-box">
  88. <div class="box-title">
  89. <img src="@/assets/img/home/label-icon.png" />
  90. 过往出现过的灾害 (多选)
  91. </div>
  92. <div class="box-content">
  93. <div class="box-item" style="padding-top: 0">
  94. <div class="item-checkbox">
  95. <el-checkbox-group v-model="outputVal">
  96. <el-checkbox-button v-for="(item, index) in outputList" :key="index" :value="item.name">
  97. {{ item.name }}
  98. </el-checkbox-button>
  99. </el-checkbox-group>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="disaster-desc-box">
  104. <span>其它异常</span>
  105. <el-input
  106. v-model="disasterDesc"
  107. :autosize="{ minRows: 2, maxRows: 4 }"
  108. type="textarea"
  109. placeholder="请简单描述一下异常情况"
  110. />
  111. </div>
  112. </div> -->
  113. <!-- 按钮 -->
  114. <div class="custom-bottom-fixed-btns">
  115. <div class="bottom-btn secondary-btn" @click="handlePage">跳过</div>
  116. <div class="bottom-btn primary-btn" @click="handlePage">确认信息</div>
  117. </div>
  118. </div>
  119. </template>
  120. <script setup>
  121. import { ref, onActivated } from "vue";
  122. import { useRouter, useRoute } from "vue-router";
  123. const router = useRouter();
  124. const route = useRoute();
  125. const productList = ref([
  126. { name: "请选择您的果园土壤类型", subName:'土壤类型确认最佳施肥策略',items: [{ name: "砂质土" }, { name: "黏质土" }, { name: "壤土" }] },
  127. { name: "请选择您的灌溉方式",subName:'处方执行方式,根据您的灌溉设施确定', items: [{ name: "人工浇灌" }, { name: "人工喷灌" }, { name: "微喷灌" },{name:'滴灌'}] },
  128. { name: "请选择您的农机设备",subName:'农机可以加入农机租赁库,在农闲时获取额外收益', items: [{ name: "植保无人机" }, { name: "骑乘式割草机" },{name:'乘坐式喷药机'},{name:'果园运输车'},{name:'果园碎枝机'},{name:'农用吊运无人机'}] },
  129. ]);
  130. const farmScaleList = ref([
  131. { name: "您最想改善的方向",items: [{ name: "病虫防治" }, { name: "树势不良" }, { name: "土壤板结" },{name:'保花保果'},{name:'品种改良'},{name:'树体剪枝'},{name:'果园规划'}] },
  132. ]);
  133. const outputList = ref([
  134. { name: "低温冻害" },
  135. { name: "干旱" },
  136. { name: "暴雨渍水" },
  137. { name: "病虫害" },
  138. { name: "阴天寡照" },
  139. ]);
  140. // 默认选中前两项
  141. const outputVal = ref([]);
  142. const disasterDesc = ref("");
  143. // 农场规模
  144. const farmScale = ref({
  145. longTermWorker: "",
  146. plantProtection: "",
  147. pruning: "",
  148. });
  149. // 初始化默认选中第一项
  150. onActivated(() => {
  151. // outputVal.value = outputList.value.length >= 2
  152. // ? [outputList.value[0].name, outputList.value[1].name]
  153. // : outputList.value.length === 1
  154. // ? [outputList.value[0].name]
  155. // : []
  156. if (route.query.speciesName === '籼稻') {
  157. productList.value[0].items = [{ name: "黏质土" }, { name: "壤土" }, { name: "冲积土" }];
  158. productList.value[1].items = [{ name: "漫灌" }, { name: "间歇灌溉" }, { name: "喷灌" }];
  159. }
  160. // 为 productList 的每个 group 设置默认选中第一项
  161. productList.value.forEach((group) => {
  162. if (group.items && group.items.length > 0 && !group.checked) {
  163. group.checked = group.items[0].name;
  164. }
  165. });
  166. });
  167. const goBack = () => {
  168. // router.go(-1);
  169. router.replace(`/create_farm?from=${route.query.from}&type=${route.query.type}`)
  170. };
  171. const handlePage = () => {
  172. if(route.query.type === 'farmer'){
  173. router.push('/agri_record')
  174. return
  175. }
  176. // 获取所有需要传递的参数,包括 from 参数
  177. const queryParams = {
  178. containerId: route.query.containerId,
  179. };
  180. // 如果存在 from 参数,继续传递
  181. if (route.query.from) {
  182. queryParams.from = route.query.from;
  183. }
  184. // 传递所有农场相关的参数,以便在 agricultural_plan 页面创建农场
  185. const farmParams = ['wkt', 'speciesId', 'containerId', 'agriculturalCreate', 'geom', 'address', 'mu', 'name', 'fzr', 'tel', 'defaultFarm', 'typeId', 'speciesName','userType'];
  186. farmParams.forEach(key => {
  187. if (route.query[key] !== undefined) {
  188. queryParams[key] = route.query[key];
  189. }
  190. });
  191. router.push({
  192. path: '/agricultural_plan',
  193. query: queryParams
  194. });
  195. };
  196. </script>
  197. <style lang="scss" scoped>
  198. .prescription-page {
  199. position: relative;
  200. width: 100%;
  201. height: calc(100vh - 62px);
  202. overflow: auto;
  203. box-sizing: border-box;
  204. background: linear-gradient(to left, #e6f2ff, #8fc5fe);
  205. .prescription-title {
  206. padding: 16px 14px;
  207. background: url("@/assets/img/home/page-bg.png") no-repeat bottom right / 149px 116px;
  208. background-position-y: 30px;
  209. img {
  210. width: 24px;
  211. }
  212. .title-name {
  213. font-size: 22px;
  214. color: #2e2e2e;
  215. text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
  216. font-weight: 800;
  217. padding: 21px 0 4px 6px;
  218. }
  219. .title-desc {
  220. font-size: 14px;
  221. color: rgba(49, 49, 49, 0.56);
  222. padding-left: 6px;
  223. }
  224. }
  225. .prescription-box {
  226. background: #ffffff;
  227. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1);
  228. border-radius: 10px;
  229. margin: 0 10px 10px;
  230. box-sizing: border-box;
  231. padding-bottom: 10px;
  232. .box-title {
  233. margin: 0 10px;
  234. box-sizing: border-box;
  235. border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  236. font-weight: 800;
  237. font-size: 18px;
  238. color: #222222;
  239. padding: 15px 0 10px;
  240. img {
  241. width: 14px;
  242. height: 9px;
  243. }
  244. }
  245. .box-content {
  246. padding: 0 10px;
  247. .box-item {
  248. padding-top: 10px;
  249. .item-name {
  250. display: flex;
  251. align-items: center;
  252. font-size: 15px;
  253. color: rgba(0, 0, 0, 0.9);
  254. font-weight: 500;
  255. .required-icon {
  256. color: #ff0000;
  257. font-size: 16px;
  258. margin-right: 4px;
  259. }
  260. }
  261. .tips{
  262. margin-left: 10px;
  263. font-size: 12px;
  264. color: rgba(0, 0, 0, 0.4);
  265. }
  266. .item-checkbox {
  267. ::v-deep {
  268. .el-radio-button,
  269. .el-checkbox-button {
  270. margin: 10px 0 0 7px;
  271. .el-radio-button__inner,
  272. .el-checkbox-button__inner {
  273. border: none;
  274. border-radius: 6px;
  275. // padding: 13px 21px;
  276. height: 43px;
  277. width: 107px;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. border: 1px solid #EBEBEB;
  282. color: #000000;
  283. background: rgba(241, 241, 241, 0.12);
  284. font-weight: 400;
  285. }
  286. &.is-active,
  287. &.is-checked {
  288. &::after {
  289. content: "";
  290. position: absolute;
  291. z-index: 9;
  292. bottom: 0;
  293. right: 0;
  294. width: 18px;
  295. height: 16px;
  296. background: url("@/assets/img/home/checked-bg.png") no-repeat bottom right / 18px
  297. 16px;
  298. }
  299. .el-radio-button__inner,
  300. .el-checkbox-button__inner {
  301. background: rgba(33, 153, 248, 0.1) !important;
  302. color: #2199f8 !important;
  303. border: 1px solid #2199f8 !important;
  304. box-shadow: none;
  305. }
  306. }
  307. &.is-active {
  308. .el-radio-button__original-radio:not(:disabled) + .el-radio-button__inner {
  309. background: rgba(33, 153, 248, 0.1) !important;
  310. color: #2199f8 !important;
  311. border: 1px solid #2199f8 !important;
  312. box-shadow: none;
  313. font-weight: 500;
  314. }
  315. }
  316. &.is-checked {
  317. .el-checkbox-button__original-checkbox:not(:disabled) + .el-checkbox-button__inner {
  318. background: rgba(33, 153, 248, 0.1) !important;
  319. color: #2199f8 !important;
  320. border: 1px solid #2199f8 !important;
  321. box-shadow: none;
  322. font-weight: 500;
  323. }
  324. }
  325. }
  326. .el-radio-button:nth-child(3n-2){
  327. margin-left: 0;
  328. }
  329. }
  330. }
  331. }
  332. }
  333. /* 农场规模(与农场情况同一卡片内) */
  334. .farm-scale-header {
  335. margin-top: 16px;
  336. .farm-scale-title {
  337. font-size: 15px;
  338. font-weight: 500;
  339. color: rgba(0, 0, 0, 0.9);
  340. }
  341. .farm-scale-desc {
  342. font-size: 13px;
  343. color: rgba(0, 0, 0, 0.4);
  344. }
  345. }
  346. .farm-scale-form {
  347. margin-top: 10px;
  348. .farm-scale-item {
  349. display: flex;
  350. align-items: center;
  351. margin-bottom: 14px;
  352. &:last-child {
  353. margin-bottom: 0;
  354. }
  355. .farm-scale-label {
  356. flex-shrink: 0;
  357. width: 110px;
  358. font-size: 14px;
  359. color: rgba(0, 0, 0, 0.9);
  360. margin-right: 12px;
  361. }
  362. .farm-scale-input {
  363. flex: 1;
  364. ::v-deep .el-input-group__append {
  365. padding: 0 12px;
  366. background: #f5f7fa;
  367. color: rgba(0, 0, 0, 0.65);
  368. border-color: #dcdfe6;
  369. border-radius: 0 4px 4px 0;
  370. }
  371. ::v-deep .el-input__inner {
  372. border-radius: 4px 0 0 4px;
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .disaster-desc-box {
  379. padding: 10px;
  380. display: flex;
  381. align-items: center;
  382. span {
  383. font-size: 14px;
  384. color: rgba(0, 0, 0, 0.9);
  385. width: 80px;
  386. }
  387. }
  388. }
  389. </style>