autoSetting.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <view class="auto-fertilization-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar">
  5. <view class="nav-left">
  6. <text class="back-icon">←</text>
  7. </view>
  8. <view class="nav-center">
  9. <text class="nav-title">自动施肥</text>
  10. </view>
  11. <view class="nav-right">
  12. <text class="nav-icon">⋯</text>
  13. <text class="nav-icon">⚙️</text>
  14. </view>
  15. </view>
  16. <!-- 内容区域 -->
  17. <view class="content">
  18. <!-- 灌溉模式 -->
  19. <view class="setting-item">
  20. <text class="setting-label">灌溉模式</text>
  21. <view class="radio-group">
  22. <label class="radio-item" :class="{ active: irrigationMode === '定时' }" @click="irrigationMode = '定时'">
  23. <radio value="定时" :checked="irrigationMode === '定时'" color="#14a478" />
  24. <text>定时</text>
  25. </label>
  26. <label class="radio-item" :class="{ active: irrigationMode === '定量' }" @click="irrigationMode = '定量'">
  27. <radio value="定量" :checked="irrigationMode === '定量'" color="#14a478" />
  28. <text>定量</text>
  29. </label>
  30. <label class="radio-item" :class="{ active: irrigationMode === '禁用' }" @click="irrigationMode = '禁用'">
  31. <radio value="禁用" :checked="irrigationMode === '禁用'" color="#14a478" />
  32. <text>禁用</text>
  33. </label>
  34. </view>
  35. </view>
  36. <!-- 配方方式 -->
  37. <view class="setting-item">
  38. <text class="setting-label">配方方式</text>
  39. <view class="radio-group">
  40. <label class="radio-item" :class="{ active: formulaMode === 'PID' }" @click="formulaMode = 'PID'">
  41. <radio value="PID" :checked="formulaMode === 'PID'" color="#14a478" />
  42. <text>PID</text>
  43. </label>
  44. <label class="radio-item" :class="{ active: formulaMode === '水肥比例' }" @click="formulaMode = '水肥比例'">
  45. <radio value="水肥比例" :checked="formulaMode === '水肥比例'" color="#14a478" />
  46. <text>水肥比例</text>
  47. </label>
  48. <label class="radio-item" :class="{ active: formulaMode === '禁用' }" @click="formulaMode = '禁用'">
  49. <radio value="禁用" :checked="formulaMode === '禁用'" color="#14a478" />
  50. <text>禁用</text>
  51. </label>
  52. </view>
  53. </view>
  54. <!-- 轮灌次数 -->
  55. <view class="setting-item">
  56. <text class="setting-label">轮灌次数</text>
  57. <view class="number-input">
  58. <text class="number-btn" @click="decreaseRoundCount">−</text>
  59. <text class="number-value">{{ roundCount }}</text>
  60. <text class="number-btn" @click="increaseRoundCount">+</text>
  61. </view>
  62. </view>
  63. <!-- 轮灌间隔 -->
  64. <view class="setting-item">
  65. <text class="setting-label">轮灌间隔</text>
  66. <view class="time-input">
  67. <input type="number" v-model="roundInterval" class="time-input-field" />
  68. <text class="time-unit">分钟</text>
  69. </view>
  70. </view>
  71. <!-- 肥前水 -->
  72. <view class="setting-item">
  73. <text class="setting-label">肥前水</text>
  74. <view class="time-input">
  75. <input type="number" v-model="waterBefore" class="time-input-field" />
  76. <text class="time-unit">分钟</text>
  77. </view>
  78. </view>
  79. <!-- 肥后水 -->
  80. <view class="setting-item">
  81. <text class="setting-label">肥后水</text>
  82. <view class="time-input">
  83. <input type="number" v-model="waterAfter" class="time-input-field" />
  84. <text class="time-unit">分钟</text>
  85. </view>
  86. </view>
  87. <!-- 定时轮灌组 -->
  88. <view class="round-groups-section">
  89. <text class="section-title">定时轮灌组</text>
  90. <view class="round-groups-container">
  91. <!-- 左侧轮灌组列表 -->
  92. <view class="round-groups-list">
  93. <view
  94. v-for="i in 7"
  95. :key="i"
  96. class="round-group-item"
  97. :class="{ active: selectedGroup === i }"
  98. @click="selectedGroup = i"
  99. >
  100. <text>{{ i }}组</text>
  101. </view>
  102. </view>
  103. <!-- 右侧轮灌组详情 -->
  104. <view class="round-group-detail">
  105. <!-- 1组 -->
  106. <view class="group-detail-item" :class="{ active: selectedGroup === 1 }">
  107. <view class="group-header">
  108. <text class="group-title">1组</text>
  109. <text class="group-check" v-if="selectedGroup === 1">✓</text>
  110. </view>
  111. <view class="group-settings">
  112. <view class="setting-row">
  113. <text class="setting-row-label">施肥配方</text>
  114. <input type="text" placeholder="请输入" class="setting-row-input" />
  115. </view>
  116. <view class="setting-row">
  117. <text class="setting-row-label">灌溉时长</text>
  118. <input type="number" v-model="irrigationTime1" class="setting-row-input" />
  119. <text class="setting-row-unit">分钟</text>
  120. </view>
  121. <view class="setting-row">
  122. <text class="setting-row-label">施肥时长</text>
  123. <input type="number" v-model="fertilizationTime1" class="setting-row-input" />
  124. <text class="setting-row-unit">分钟</text>
  125. </view>
  126. </view>
  127. </view>
  128. <!-- 2组 -->
  129. <view class="group-detail-item" :class="{ active: selectedGroup === 2 }">
  130. <view class="group-header">
  131. <text class="group-title">2组</text>
  132. <text class="group-check" v-if="selectedGroup === 2">✓</text>
  133. </view>
  134. <view class="group-settings">
  135. <view class="setting-row">
  136. <text class="setting-row-label">施肥配方</text>
  137. <input type="text" placeholder="请输入" class="setting-row-input" />
  138. </view>
  139. <view class="setting-row">
  140. <text class="setting-row-label">灌溉时长</text>
  141. <input type="number" v-model="irrigationTime2" class="setting-row-input" />
  142. <text class="setting-row-unit">分钟</text>
  143. </view>
  144. <view class="setting-row">
  145. <text class="setting-row-label">施肥时长</text>
  146. <input type="number" v-model="fertilizationTime2" class="setting-row-input" />
  147. <text class="setting-row-unit">分钟</text>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <!-- 底部确定按钮 -->
  156. <view class="confirm-btn-container">
  157. <view class="confirm-btn" @click="confirm">
  158. <text class="confirm-btn-text">确定</text>
  159. </view>
  160. </view>
  161. </view>
  162. </template>
  163. <script>
  164. export default {
  165. data() {
  166. return {
  167. // 灌溉模式
  168. irrigationMode: '定时',
  169. // 配方方式
  170. formulaMode: 'PID',
  171. // 轮灌次数
  172. roundCount: 1,
  173. // 轮灌间隔(分钟)
  174. roundInterval: 0,
  175. // 肥前水(分钟)
  176. waterBefore: 0,
  177. // 肥后水(分钟)
  178. waterAfter: 0,
  179. // 选中的轮灌组
  180. selectedGroup: 1,
  181. // 1组设置
  182. irrigationTime1: 0,
  183. fertilizationTime1: 0,
  184. // 2组设置
  185. irrigationTime2: 0,
  186. fertilizationTime2: 0
  187. };
  188. },
  189. methods: {
  190. // 减少轮灌次数
  191. decreaseRoundCount() {
  192. if (this.roundCount > 1) {
  193. this.roundCount--;
  194. }
  195. },
  196. // 增加轮灌次数
  197. increaseRoundCount() {
  198. this.roundCount++;
  199. },
  200. // 确认按钮点击事件
  201. confirm() {
  202. // 这里可以添加确认逻辑
  203. console.log('确认设置');
  204. }
  205. }
  206. };
  207. </script>
  208. <style scoped lang="scss">
  209. .auto-fertilization-container {
  210. width: 100%;
  211. min-height: 100vh;
  212. background: linear-gradient(180deg, #e6f7f2 0%, #f5f5f5 100%);
  213. font-family: 'Source Han Sans CN';
  214. }
  215. /* 顶部导航栏 */
  216. .nav-bar {
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. padding: 20rpx 32rpx;
  221. background: linear-gradient(180deg, #14a478 0%, #0f8a64 100%);
  222. color: #fff;
  223. .nav-left {
  224. .back-icon {
  225. font-size: 32rpx;
  226. }
  227. }
  228. .nav-center {
  229. .nav-title {
  230. font-size: 32rpx;
  231. font-weight: 500;
  232. }
  233. }
  234. .nav-right {
  235. display: flex;
  236. gap: 24rpx;
  237. .nav-icon {
  238. font-size: 28rpx;
  239. }
  240. }
  241. }
  242. /* 内容区域 */
  243. .content {
  244. padding: 32rpx;
  245. }
  246. /* 设置项 */
  247. .setting-item {
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-between;
  251. padding: 24rpx 0;
  252. border-bottom: 1rpx solid #e8e8e8;
  253. .setting-label {
  254. font-size: 28rpx;
  255. color: #042118;
  256. }
  257. /* 单选组 */
  258. .radio-group {
  259. display: flex;
  260. gap: 32rpx;
  261. .radio-item {
  262. display: flex;
  263. align-items: center;
  264. gap: 8rpx;
  265. font-size: 26rpx;
  266. color: #666;
  267. &.active {
  268. color: #14a478;
  269. }
  270. radio {
  271. transform: scale(0.8);
  272. }
  273. }
  274. }
  275. /* 数字输入 */
  276. .number-input {
  277. display: flex;
  278. align-items: center;
  279. gap: 16rpx;
  280. .number-btn {
  281. width: 40rpx;
  282. height: 40rpx;
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. background: #f5f5f5;
  287. border-radius: 4rpx;
  288. font-size: 28rpx;
  289. color: #666;
  290. }
  291. .number-value {
  292. min-width: 60rpx;
  293. text-align: center;
  294. font-size: 26rpx;
  295. color: #042118;
  296. }
  297. }
  298. /* 时间输入 */
  299. .time-input {
  300. display: flex;
  301. align-items: center;
  302. gap: 8rpx;
  303. .time-input-field {
  304. width: 100rpx;
  305. height: 52rpx;
  306. padding: 0 16rpx;
  307. font-size: 26rpx;
  308. text-align: center;
  309. border: 1rpx solid #d9d9d9;
  310. border-radius: 8rpx;
  311. color: #042118;
  312. }
  313. .time-unit {
  314. font-size: 24rpx;
  315. color: #666;
  316. }
  317. }
  318. }
  319. /* 轮灌组区域 */
  320. .round-groups-section {
  321. margin-top: 40rpx;
  322. .section-title {
  323. font-size: 28rpx;
  324. font-weight: 500;
  325. color: #042118;
  326. margin-bottom: 24rpx;
  327. }
  328. .round-groups-container {
  329. display: flex;
  330. background: #fff;
  331. border-radius: 12rpx;
  332. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  333. /* 左侧轮灌组列表 */
  334. .round-groups-list {
  335. width: 120rpx;
  336. border-right: 1rpx solid #e8e8e8;
  337. .round-group-item {
  338. height: 80rpx;
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. font-size: 26rpx;
  343. color: #666;
  344. border-bottom: 1rpx solid #f0f0f0;
  345. &.active {
  346. background: #e6f7f2;
  347. color: #14a478;
  348. font-weight: 500;
  349. }
  350. &:last-child {
  351. border-bottom: none;
  352. }
  353. }
  354. }
  355. /* 右侧轮灌组详情 */
  356. .round-group-detail {
  357. flex: 1;
  358. padding: 24rpx;
  359. .group-detail-item {
  360. display: none;
  361. &.active {
  362. display: block;
  363. }
  364. .group-header {
  365. display: flex;
  366. align-items: center;
  367. justify-content: space-between;
  368. margin-bottom: 24rpx;
  369. .group-title {
  370. font-size: 28rpx;
  371. font-weight: 500;
  372. color: #042118;
  373. }
  374. .group-check {
  375. width: 32rpx;
  376. height: 32rpx;
  377. display: flex;
  378. align-items: center;
  379. justify-content: center;
  380. background: #14a478;
  381. color: #fff;
  382. border-radius: 50%;
  383. font-size: 20rpx;
  384. }
  385. }
  386. .group-settings {
  387. .setting-row {
  388. display: flex;
  389. align-items: center;
  390. margin-bottom: 24rpx;
  391. .setting-row-label {
  392. width: 120rpx;
  393. font-size: 26rpx;
  394. color: #666;
  395. }
  396. .setting-row-input {
  397. flex: 1;
  398. height: 56rpx;
  399. padding: 0 16rpx;
  400. font-size: 26rpx;
  401. border: 1rpx solid #d9d9d9;
  402. border-radius: 8rpx;
  403. color: #042118;
  404. margin-right: 12rpx;
  405. }
  406. .setting-row-unit {
  407. font-size: 24rpx;
  408. color: #666;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. }
  416. /* 底部确定按钮 */
  417. .confirm-btn-container {
  418. padding: 32rpx;
  419. .confirm-btn {
  420. height: 88rpx;
  421. display: flex;
  422. align-items: center;
  423. justify-content: center;
  424. background: #14a478;
  425. border-radius: 12rpx;
  426. box-shadow: 0 4rpx 12rpx rgba(20, 164, 120, 0.3);
  427. .confirm-btn-text {
  428. font-size: 32rpx;
  429. font-weight: 500;
  430. color: #fff;
  431. }
  432. }
  433. }
  434. </style>