grainRemovalInputFlux.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="crop-cd-calculator">
  3. <div class="header">
  4. <h1>籽粒移除含量计算器</h1>
  5. <p>评估作物镉含量及籽粒移除的影响,助力农业安全生产</p>
  6. </div>
  7. <div class="card-container">
  8. <div class="card">
  9. <div class="card-header">
  10. <i class="fas fa-leaf"></i>
  11. <h2>作物镉模型计算</h2>
  12. </div>
  13. <div class="card-body">
  14. <div v-if="!inputsEnabled" class="enable-section">
  15. <p>首次使用请点击下方按钮启用计算功能</p>
  16. <button class="enable-btn" @click="enableInputs">
  17. <i class="fas fa-calculator"></i> 启用作物镉模型计算
  18. </button>
  19. </div>
  20. <div v-if="inputsEnabled" class="input-section">
  21. <div class="input-group">
  22. <label for="yieldPerMu">
  23. <i class="fas fa-weight-hanging"></i> 作物亩产量 (斤)
  24. </label>
  25. <input
  26. type="number"
  27. id="yieldPerMu"
  28. v-model.number="yieldPerMu"
  29. placeholder="800"
  30. min="0"
  31. >
  32. </div>
  33. <div class="button-group">
  34. <button class="calculate-btn" @click="showStrawRemovalMessage">
  35. <i class="fas fa-calculator"></i> 计算籽粒移除含量
  36. </button>
  37. <button class="reset-btn" @click="resetInputs">
  38. <i class="fas fa-redo"></i> 重置作物镉模型计算
  39. </button>
  40. </div>
  41. </div>
  42. <div v-if="cropCd > 0" class="result-section">
  43. <div class="result-card">
  44. <h3>作物镉模型计算结果</h3>
  45. <div class="result-content">
  46. <div class="result-item">
  47. <span>作物镉含量:</span>
  48. <span class="highlight">{{ cropCd.toFixed(4) }} mg/kg</span>
  49. </div>
  50. <div class="result-item">
  51. <span>国家标准限值:</span>
  52. <span>0.2 mg/kg</span>
  53. </div>
  54. <div class="result-status" :class="{'safe': cropCd <= 0.2, 'warning': cropCd > 0.2}">
  55. <i :class="cropCd <= 0.2 ? 'fas fa-check-circle' : 'fas fa-exclamation-triangle'"></i>
  56. {{ cropCd <= 0.2 ? '符合安全标准' : '超出安全标准' }}
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="card-footer">
  63. <p>安全标准依据: GB 2762-2022 食品安全国家标准</p>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="info-section">
  68. <h3><i class="fas fa-info-circle"></i> 使用说明</h3>
  69. <ol>
  70. <li>首次使用请点击"启用作物镉模型计算"按钮</li>
  71. <li>输入土壤镉含量、作物镉富集系数和作物亩产量</li>
  72. <li>点击"计算作物镉含量"按钮获取结果</li>
  73. <li>"重置作物镉模型计算"按钮用于重置所有输入数据</li>
  74. </ol>
  75. <h3><i class="fas fa-lightbulb"></i> 计算原理</h3>
  76. <p>作物镉含量 = 土壤镉含量 × 作物镉富集系数</p>
  77. <p>计算结果与国家食品安全标准(0.2 mg/kg)对比评估安全性</p>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. export default {
  83. name: 'CropCdCalculator',
  84. data() {
  85. return {
  86. inputsEnabled: false,
  87. yieldPerMu: 800,
  88. cropCd: 0
  89. };
  90. },
  91. methods: {
  92. enableInputs() {
  93. this.inputsEnabled = true;
  94. },
  95. calculateCropCd() {
  96. // 假设土壤镉含量和作物镉富集系数默认值分别为 0.5 和 0.05
  97. const soilCd = 0.5;
  98. const enrichmentFactor = 0.05;
  99. // 作物镉含量计算模型
  100. this.cropCd = soilCd * enrichmentFactor;
  101. },
  102. resetInputs() {
  103. this.yieldPerMu = 800;
  104. this.cropCd = 0;
  105. },
  106. showStrawRemovalMessage() {
  107. alert("计算秸秆移除含量功能未启用");
  108. }
  109. }
  110. };
  111. </script>
  112. <style scoped>
  113. .crop-cd-calculator {
  114. max-width: 900px;
  115. margin: 0 auto;
  116. padding: 20px;
  117. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  118. color: #333;
  119. background: linear-gradient(135deg, rgba(230, 247, 255, 0.7) 0%, rgba(240, 248, 255, 0.7) 100%);
  120. border-radius: 15px;
  121. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  122. }
  123. .header {
  124. text-align: center;
  125. margin-bottom: 30px;
  126. padding: 25px;
  127. background: linear-gradient(135deg, rgba(38, 176, 70, 0.7) 0%, rgba(26, 122, 50, 0.7) 100%);
  128. border-radius: 10px;
  129. color: white;
  130. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  131. }
  132. .header h1 {
  133. font-size: 2.2rem;
  134. margin-bottom: 10px;
  135. text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
  136. }
  137. .header p {
  138. font-size: 1.1rem;
  139. opacity: 0.9;
  140. }
  141. .card-container {
  142. margin-bottom: 30px;
  143. }
  144. .card {
  145. background: rgba(255, 255, 255, 0.9);
  146. border-radius: 12px;
  147. box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  148. overflow: hidden;
  149. }
  150. .card-header {
  151. background: linear-gradient(135deg, rgba(52, 152, 219, 0.7) 0%, rgba(31, 111, 181, 0.7) 100%);
  152. color: white;
  153. padding: 18px 25px;
  154. display: flex;
  155. align-items: center;
  156. gap: 15px;
  157. }
  158. .card-header h2 {
  159. font-size: 1.6rem;
  160. font-weight: 600;
  161. }
  162. .card-header i {
  163. font-size: 1.8rem;
  164. }
  165. .card-body {
  166. padding: 25px;
  167. }
  168. .enable-section {
  169. text-align: center;
  170. padding: 30px 20px;
  171. }
  172. .enable-section p {
  173. margin-bottom: 25px;
  174. font-size: 1.1rem;
  175. color: #555;
  176. }
  177. .input-section {
  178. display: grid;
  179. gap: 20px;
  180. }
  181. .input-group {
  182. display: flex;
  183. flex-direction: column;
  184. gap: 8px;
  185. }
  186. .input-group label {
  187. font-weight: 600;
  188. color: #2c3e50;
  189. display: flex;
  190. align-items: center;
  191. gap: 10px;
  192. }
  193. .input-group input {
  194. padding: 14px 15px;
  195. border: 1px solid #ddd;
  196. border-radius: 8px;
  197. font-size: 16px;
  198. transition: all 0.3s;
  199. background: #f9fbfd;
  200. }
  201. .input-group input:focus {
  202. outline: none;
  203. border-color: #3498db;
  204. box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  205. }
  206. .button-group {
  207. display: flex;
  208. gap: 15px;
  209. margin-top: 15px;
  210. flex-wrap: wrap;
  211. }
  212. button {
  213. padding: 14px 25px;
  214. border: none;
  215. border-radius: 8px;
  216. font-size: 16px;
  217. font-weight: 600;
  218. cursor: pointer;
  219. transition: all 0.3s ease;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. gap: 10px;
  224. flex: 1;
  225. min-width: 200px;
  226. }
  227. .enable-btn {
  228. background: linear-gradient(to right, rgba(38, 176, 70, 0.7), rgba(26, 122, 50, 0.7));
  229. color: white;
  230. max-width: 350px;
  231. margin: 0 auto;
  232. box-shadow: 0 4px 10px rgba(38, 176, 70, 0.3);
  233. }
  234. .enable-btn:hover {
  235. transform: translateY(-2px);
  236. box-shadow: 0 6px 15px rgba(38, 176, 70, 0.4);
  237. }
  238. .calculate-btn {
  239. background: linear-gradient(to right, rgba(52, 152, 219, 0.7), rgba(31, 111, 181, 0.7));
  240. color: white;
  241. box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
  242. }
  243. .calculate-btn:hover {
  244. transform: translateY(-2px);
  245. box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
  246. }
  247. .reset-btn {
  248. background: linear-gradient(to right, rgba(241, 196, 15, 0.7), rgba(243, 156, 18, 0.7));
  249. color: white;
  250. box-shadow: 0 4px 10px rgba(241, 196, 15, 0.3);
  251. }
  252. .reset-btn:hover {
  253. transform: translateY(-2px);
  254. box-shadow: 0 6px 15px rgba(241, 196, 15, 0.4);
  255. }
  256. .result-section {
  257. margin-top: 30px;
  258. border-top: 1px solid #eee;
  259. padding-top: 25px;
  260. }
  261. .result-card {
  262. background: rgba(249, 251, 253, 0.7);
  263. border-radius: 10px;
  264. padding: 20px;
  265. border-left: 4px solid #3498db;
  266. }
  267. .result-card h3 {
  268. margin-bottom: 15px;
  269. color: #2c3e50;
  270. }
  271. .result-content {
  272. display: grid;
  273. gap: 15px;
  274. }
  275. .result-item {
  276. display: flex;
  277. justify-content: space-between;
  278. padding: 10px 0;
  279. border-bottom: 1px dashed #eee;
  280. }
  281. .highlight {
  282. font-weight: 700;
  283. color: #e74c3c;
  284. font-size: 1.1rem;
  285. }
  286. .result-status {
  287. padding: 12px;
  288. border-radius: 8px;
  289. text-align: center;
  290. font-weight: 600;
  291. margin-top: 10px;
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. gap: 10px;
  296. }
  297. .result-status.safe {
  298. background: rgba(46, 204, 113, 0.15);
  299. color: #27ae60;
  300. }
  301. .result-status.warning {
  302. background: rgba(231, 76, 60, 0.15);
  303. color: #c0392b;
  304. }
  305. .card-footer {
  306. background: rgba(245, 247, 250, 0.7);
  307. padding: 15px 25px;
  308. text-align: center;
  309. color: #7f8c8d;
  310. font-size: 0.9rem;
  311. border-top: 1px solid #eee;
  312. }
  313. .info-section {
  314. background: rgba(255, 255, 255, 0.7);
  315. border-radius: 12px;
  316. padding: 25px;
  317. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  318. }
  319. .info-section h3 {
  320. color: #2c3e50;
  321. margin-bottom: 15px;
  322. display: flex;
  323. align-items: center;
  324. gap: 10px;
  325. }
  326. .info-section ol {
  327. padding-left: 25px;
  328. margin-bottom: 25px;
  329. }
  330. .info-section ol li {
  331. margin-bottom: 10px;
  332. line-height: 1.6;
  333. }
  334. .info-section p {
  335. line-height: 1.6;
  336. margin-bottom: 15px;
  337. }
  338. /* 响应式设计 */
  339. @media (max-width: 768px) {
  340. .header {
  341. padding: 15px;
  342. }
  343. .header h1 {
  344. font-size: 1.8rem;
  345. }
  346. .card-body {
  347. padding: 20px;
  348. }
  349. .button-group {
  350. flex-direction: column;
  351. }
  352. button {
  353. width: 100%;
  354. }
  355. }
  356. </style>