prescriptionPage copy.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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="item-checkbox">
  20. <el-radio-group v-model="group.checked">
  21. <el-radio-button
  22. v-for="(item, index) in group.items"
  23. :key="index"
  24. :label="item.name"
  25. :value="item.name"
  26. />
  27. </el-radio-group>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="prescription-box">
  33. <div class="box-title">
  34. <img src="@/assets/img/home/label-icon.png" />
  35. 过往出现过的灾害 (多选)
  36. </div>
  37. <div class="box-content">
  38. <div class="box-item" style="padding-top: 0">
  39. <div class="item-checkbox">
  40. <el-checkbox-group v-model="outputVal">
  41. <el-checkbox-button v-for="(item, index) in outputList" :key="index" :value="item.name">
  42. {{ item.name }}
  43. </el-checkbox-button>
  44. </el-checkbox-group>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="disaster-desc-box">
  49. <span>其它异常</span>
  50. <el-input
  51. v-model="disasterDesc"
  52. :autosize="{ minRows: 2, maxRows: 4 }"
  53. type="textarea"
  54. placeholder="请简单描述一下异常情况"
  55. />
  56. </div>
  57. </div>
  58. <!-- 按钮 -->
  59. <div class="custom-bottom-fixed-btns">
  60. <div class="bottom-btn secondary-btn" @click="handlePage">跳过</div>
  61. <div class="bottom-btn primary-btn" @click="handlePage">生成处方</div>
  62. </div>
  63. </div>
  64. </template>
  65. <script setup>
  66. import { ref, onActivated } from "vue";
  67. import { useRouter, useRoute } from "vue-router";
  68. const router = useRouter();
  69. const route = useRoute();
  70. const productList = ref([
  71. { name: "请选择您的果园土壤类型", items: [{ name: "红壤" }, { name: "壤土" }, { name: "冲积土" }] },
  72. { name: "请选择您的灌溉方式", items: [{ name: "滴灌" }, { name: "穴灌" }, { name: "微喷灌" }] },
  73. { name: "是否需要改良土壤", items: [{ name: "需要" }, { name: "不需要" }] },
  74. ]);
  75. const outputList = ref([
  76. { name: "低温冻害" },
  77. { name: "干旱" },
  78. { name: "暴雨渍水" },
  79. { name: "病虫害" },
  80. { name: "阴天寡照" },
  81. ]);
  82. // 默认选中前两项
  83. const outputVal = ref([]);
  84. const disasterDesc = ref("");
  85. // 初始化默认选中第一项
  86. onActivated(() => {
  87. // outputVal.value = outputList.value.length >= 2
  88. // ? [outputList.value[0].name, outputList.value[1].name]
  89. // : outputList.value.length === 1
  90. // ? [outputList.value[0].name]
  91. // : []
  92. if (route.query.speciesName === '籼稻') {
  93. productList.value[0].items = [{ name: "黏质土" }, { name: "壤土" }, { name: "冲积土" }];
  94. productList.value[1].items = [{ name: "漫灌" }, { name: "间歇灌溉" }, { name: "喷灌" }];
  95. }
  96. // 为 productList 的每个 group 设置默认选中第一项
  97. productList.value.forEach((group) => {
  98. if (group.items && group.items.length > 0 && !group.checked) {
  99. group.checked = group.items[0].name;
  100. }
  101. });
  102. });
  103. const goBack = () => {
  104. // router.go(-1);
  105. router.replace(`/create_farm?from=${route.query.from}&type=${route.query.type}`)
  106. };
  107. const handlePage = () => {
  108. // 获取所有需要传递的参数,包括 from 参数
  109. const queryParams = {
  110. containerId: route.query.containerId,
  111. };
  112. // 如果存在 from 参数,继续传递
  113. if (route.query.from) {
  114. queryParams.from = route.query.from;
  115. }
  116. // 传递所有农场相关的参数,以便在 agricultural_plan 页面创建农场
  117. const farmParams = ['wkt', 'speciesId', 'containerId', 'agriculturalCreate', 'geom', 'address', 'mu', 'name', 'fzr', 'tel', 'defaultFarm', 'typeId', 'speciesName','userType'];
  118. farmParams.forEach(key => {
  119. if (route.query[key] !== undefined) {
  120. queryParams[key] = route.query[key];
  121. }
  122. });
  123. router.push({
  124. path: '/agricultural_plan',
  125. query: queryParams
  126. });
  127. };
  128. </script>
  129. <style lang="scss" scoped>
  130. .prescription-page {
  131. position: relative;
  132. width: 100%;
  133. height: calc(100vh - 62px);
  134. overflow: auto;
  135. box-sizing: border-box;
  136. background: linear-gradient(to left, #e6f2ff, #8fc5fe);
  137. .prescription-title {
  138. padding: 16px 14px;
  139. background: url("@/assets/img/home/page-bg.png") no-repeat bottom right / 149px 116px;
  140. background-position-y: 30px;
  141. img {
  142. width: 24px;
  143. }
  144. .title-name {
  145. font-size: 22px;
  146. color: #2e2e2e;
  147. text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
  148. font-weight: 800;
  149. padding: 21px 0 4px 6px;
  150. }
  151. .title-desc {
  152. font-size: 14px;
  153. color: rgba(49, 49, 49, 0.56);
  154. padding-left: 6px;
  155. }
  156. }
  157. .prescription-box {
  158. background: #ffffff;
  159. box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1);
  160. border-radius: 10px;
  161. margin: 0 10px 10px;
  162. box-sizing: border-box;
  163. padding-bottom: 10px;
  164. .box-title {
  165. margin: 0 10px;
  166. box-sizing: border-box;
  167. border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  168. font-weight: 800;
  169. font-size: 18px;
  170. color: #222222;
  171. padding: 15px 0 10px;
  172. img {
  173. width: 14px;
  174. height: 9px;
  175. }
  176. }
  177. .box-content {
  178. padding: 0 10px;
  179. .box-item {
  180. padding-top: 10px;
  181. .item-name {
  182. display: flex;
  183. align-items: center;
  184. font-size: 15px;
  185. color: rgba(0, 0, 0, 0.9);
  186. .required-icon {
  187. color: #ff0000;
  188. font-size: 16px;
  189. margin-right: 4px;
  190. }
  191. }
  192. .item-checkbox {
  193. ::v-deep {
  194. .el-radio-button,
  195. .el-checkbox-button {
  196. margin: 10px 7px 0 0;
  197. .el-radio-button__inner,
  198. .el-checkbox-button__inner {
  199. border: none;
  200. background: #f1f1f1;
  201. border-radius: 8px;
  202. padding: 13px 24px;
  203. border: 1px solid rgba(255, 255, 255, 0);
  204. color: #000000;
  205. font-size: 15px;
  206. font-weight: 400;
  207. }
  208. &.is-active,
  209. &.is-checked {
  210. &::after {
  211. content: "";
  212. position: absolute;
  213. z-index: 9;
  214. bottom: 0;
  215. right: 0;
  216. width: 18px;
  217. height: 16px;
  218. background: url("@/assets/img/home/checked-bg.png") no-repeat bottom right / 18px
  219. 16px;
  220. }
  221. .el-radio-button__inner,
  222. .el-checkbox-button__inner {
  223. background: rgba(33, 153, 248, 0.1) !important;
  224. color: #2199f8 !important;
  225. border: 1px solid #2199f8 !important;
  226. box-shadow: none;
  227. font-weight: 500;
  228. }
  229. }
  230. &.is-active {
  231. .el-radio-button__original-radio:not(:disabled) + .el-radio-button__inner {
  232. background: rgba(33, 153, 248, 0.1) !important;
  233. color: #2199f8 !important;
  234. border: 1px solid #2199f8 !important;
  235. box-shadow: none;
  236. font-weight: 500;
  237. }
  238. }
  239. &.is-checked {
  240. .el-checkbox-button__original-checkbox:not(:disabled) + .el-checkbox-button__inner {
  241. background: rgba(33, 153, 248, 0.1) !important;
  242. color: #2199f8 !important;
  243. border: 1px solid #2199f8 !important;
  244. box-shadow: none;
  245. font-weight: 500;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. }
  253. }
  254. .disaster-desc-box {
  255. padding: 10px;
  256. display: flex;
  257. align-items: center;
  258. span {
  259. font-size: 14px;
  260. color: rgba(0, 0, 0, 0.9);
  261. width: 80px;
  262. }
  263. }
  264. }
  265. </style>