unitConversion.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. <template>
  2. <div style="display: flex; flex-wrap: wrap; width: 1200px; margin: auto">
  3. <div :class="$i18n.locale === 'zh' ? 'user-title1' : 'user-title2'">
  4. <div class="information">
  5. {{ $i18n.locale === 'zh' ? '快速选择:' : 'Quick selection' }}
  6. </div>
  7. <div
  8. @click="getInfo('0')"
  9. :class="informationsClass == 0 ? 'information2' : 'information1'"
  10. >
  11. {{ $i18n.locale === 'zh' ? '全部' : 'Whole' }}
  12. </div>
  13. <div
  14. @click="getInfo('1')"
  15. :class="informationsClass == 1 ? 'information2' : 'information1'"
  16. >
  17. {{ $i18n.locale === 'zh' ? '煤炭' : 'Coal' }}
  18. </div>
  19. <div
  20. @click="getInfo('2')"
  21. :class="informationsClass == 2 ? 'information2' : 'information1'"
  22. >
  23. {{ $i18n.locale === 'zh' ? '石油' : 'Oil' }}
  24. </div>
  25. <div
  26. @click="getInfo('3')"
  27. :class="informationsClass == 3 ? 'information2' : 'information1'"
  28. >
  29. {{ $i18n.locale === 'zh' ? '天然气' : 'Natural gas' }}
  30. </div>
  31. <div
  32. @click="getInfo('4')"
  33. :class="informationsClass == 4 ? 'information2' : 'information1'"
  34. >
  35. {{ $i18n.locale === 'zh' ? '氢' : 'Hydrogen' }}
  36. </div>
  37. </div>
  38. <div
  39. style="
  40. display: flex;
  41. flex-wrap: wrap;
  42. width: 98%;
  43. margin-left: 1%;
  44. justify-content: space-between;
  45. "
  46. >
  47. <div v-if="userCoal" style="width: 48%; display: inline-block">
  48. <div style="display: flex">
  49. <div style="width: 40px; height: 40px">
  50. <img
  51. src="@/assets/userUntil-8.png"
  52. style="width: 100%; height: 100%"
  53. />
  54. </div>
  55. <div
  56. style="
  57. font-size: 22px;
  58. font-weight: 700;
  59. height: 40px;
  60. line-height: 40px;
  61. margin-left: 10px;
  62. "
  63. >
  64. {{ $i18n.locale === 'zh' ? '煤炭' : 'Coal' }}
  65. </div>
  66. </div>
  67. <div style="border-top: 1px solid #d7d7d7; width: 100%"></div>
  68. <div style="display: flex">
  69. <ul class="text-title" style="width: 30%">
  70. <li>{{ $i18n.locale === 'zh' ? '吨(t)' : 't' }}</li>
  71. <li>{{ $i18n.locale === 'zh' ? '千克(kg)' : 'kg' }}</li>
  72. <li>{{ $i18n.locale === 'zh' ? '磅(lb)' : 'lb' }}</li>
  73. <li>{{ $i18n.locale === 'zh' ? '长吨(lt)' : 'lt' }}</li>
  74. <li>{{ $i18n.locale === 'zh' ? '短吨(st)' : 'st' }}</li>
  75. </ul>
  76. <ul style="width: 70%">
  77. <li>
  78. <el-input
  79. type="number"
  80. v-model="a"
  81. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  82. :title="a"
  83. @focus="getFocus('1')"
  84. @blur="lostBlur"
  85. @input="getNum('a')"
  86. :class="focusClass == 1 ? 'focusClass2' : 'focusClass1'"
  87. style="
  88. overflow: hidden;
  89. white-space: nowrap;
  90. text-overflow: ellipsis;
  91. "
  92. /><el-button class="user-btn" @click="getNum('a')">{{
  93. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  94. }}</el-button>
  95. </li>
  96. <li>
  97. <el-input
  98. type="number"
  99. v-model="b"
  100. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  101. :title="b"
  102. @focus="getFocus('2')"
  103. @blur="lostBlur"
  104. @input="getNum('b')"
  105. :class="focusClass == 2 ? 'focusClass2' : 'focusClass1'"
  106. style="
  107. overflow: hidden;
  108. white-space: nowrap;
  109. text-overflow: ellipsis;
  110. "
  111. /><el-button class="user-btn" @click="getNum('b')">{{
  112. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  113. }}</el-button>
  114. </li>
  115. <li>
  116. <el-input
  117. type="number"
  118. v-model="c"
  119. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  120. :title="c"
  121. @focus="getFocus('3')"
  122. @blur="lostBlur"
  123. @input="getNum('c')"
  124. :class="focusClass == 3 ? 'focusClass2' : 'focusClass1'"
  125. style="
  126. overflow: hidden;
  127. white-space: nowrap;
  128. text-overflow: ellipsis;
  129. "
  130. /><el-button class="user-btn" @click="getNum('c')">{{
  131. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  132. }}</el-button>
  133. </li>
  134. <li>
  135. <el-input
  136. type="number"
  137. v-model="d"
  138. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  139. :title="d"
  140. @focus="getFocus('4')"
  141. @blur="lostBlur"
  142. @input="getNum('d')"
  143. :class="focusClass == 4 ? 'focusClass2' : 'focusClass1'"
  144. style="
  145. overflow: hidden;
  146. white-space: nowrap;
  147. text-overflow: ellipsis;
  148. "
  149. /><el-button class="user-btn" @click="getNum('d')">{{
  150. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  151. }}</el-button>
  152. </li>
  153. <li>
  154. <el-input
  155. type="number"
  156. v-model="e"
  157. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  158. :title="e"
  159. @focus="getFocus('5')"
  160. @blur="lostBlur"
  161. @input="getNum('e')"
  162. :class="focusClass == 5 ? 'focusClass2' : 'focusClass1'"
  163. style="
  164. overflow: hidden;
  165. white-space: nowrap;
  166. text-overflow: ellipsis;
  167. "
  168. /><el-button class="user-btn" @click="getNum('e')">{{
  169. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  170. }}</el-button>
  171. </li>
  172. </ul>
  173. </div>
  174. <div>
  175. <el-button class="user-btn-clear" @click="getNum('0')">{{
  176. $i18n.locale === 'zh' ? '数 据 重 置' : 'Data reset'
  177. }}</el-button>
  178. </div>
  179. </div>
  180. <div v-if="userOil" style="width: 48%; display: inline-block">
  181. <div style="display: flex">
  182. <div style="width: 40px; height: 40px">
  183. <img
  184. src="@/assets/userUntil-2.png"
  185. style="width: 100%; height: 100%"
  186. />
  187. </div>
  188. <div
  189. style="
  190. font-size: 22px;
  191. font-weight: 700;
  192. height: 40px;
  193. line-height: 40px;
  194. margin-left: 10px;
  195. "
  196. >
  197. {{ $i18n.locale === 'zh' ? '石油' : 'Oil' }}
  198. </div>
  199. </div>
  200. <div style="border-top: 1px solid #d7d7d7; width: 100%"></div>
  201. <div style="display: flex">
  202. <ul class="text-title" style="width: 30%">
  203. <li>{{ $i18n.locale === 'zh' ? '吨(t)' : 't' }}</li>
  204. <li>{{ $i18n.locale === 'zh' ? '千克(kg)' : 'kg' }}</li>
  205. <li>{{ $i18n.locale === 'zh' ? '磅(lb)' : 'lb' }}</li>
  206. <li>{{ $i18n.locale === 'zh' ? '长吨(lt)' : 'lt' }}</li>
  207. <li>{{ $i18n.locale === 'zh' ? '短吨(st)' : 'st' }}</li>
  208. <li>{{ $i18n.locale === 'zh' ? '升(l)' : 'l' }}</li>
  209. <li>
  210. {{ $i18n.locale === 'zh' ? '美制加仑(gal.US)' : 'gal.US' }}
  211. </li>
  212. <li>
  213. {{ $i18n.locale === 'zh' ? '英制加仑(gal.UK)' : 'gal.UK' }}
  214. </li>
  215. <li>{{ $i18n.locale === 'zh' ? '桶(bbl)' : 'bbl' }}</li>
  216. </ul>
  217. <ul style="width: 70%">
  218. <li>
  219. <el-input
  220. type="number"
  221. v-model="a1"
  222. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  223. :title="a1"
  224. @focus="getFocus('6')"
  225. @blur="lostBlur"
  226. @input="getOil('a1')"
  227. :class="focusClass == 6 ? 'focusClass2' : 'focusClass1'"
  228. style="
  229. overflow: hidden;
  230. white-space: nowrap;
  231. text-overflow: ellipsis;
  232. "
  233. /><el-button class="user-btn" @click="getOil('a1')">{{
  234. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  235. }}</el-button>
  236. </li>
  237. <li>
  238. <el-input
  239. type="number"
  240. v-model="b1"
  241. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  242. :title="b1"
  243. @focus="getFocus('7')"
  244. @blur="lostBlur"
  245. @input="getOil('b1')"
  246. :class="focusClass == 7 ? 'focusClass2' : 'focusClass1'"
  247. style="
  248. overflow: hidden;
  249. white-space: nowrap;
  250. text-overflow: ellipsis;
  251. "
  252. /><el-button class="user-btn" @click="getOil('b1')">{{
  253. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  254. }}</el-button>
  255. </li>
  256. <li>
  257. <el-input
  258. type="number"
  259. v-model="c1"
  260. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  261. :title="c1"
  262. @focus="getFocus('8')"
  263. @blur="lostBlur"
  264. @input="getOil('c1')"
  265. :class="focusClass == 8 ? 'focusClass2' : 'focusClass1'"
  266. style="
  267. overflow: hidden;
  268. white-space: nowrap;
  269. text-overflow: ellipsis;
  270. "
  271. /><el-button class="user-btn" @click="getOil('c1')">{{
  272. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  273. }}</el-button>
  274. </li>
  275. <li>
  276. <el-input
  277. type="number"
  278. v-model="d1"
  279. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  280. :title="d1"
  281. @focus="getFocus('9')"
  282. @blur="lostBlur"
  283. @input="getOil('d1')"
  284. :class="focusClass == 9 ? 'focusClass2' : 'focusClass1'"
  285. style="
  286. overflow: hidden;
  287. white-space: nowrap;
  288. text-overflow: ellipsis;
  289. "
  290. /><el-button class="user-btn" @click="getOil('d1')">{{
  291. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  292. }}</el-button>
  293. </li>
  294. <li>
  295. <el-input
  296. type="number"
  297. v-model="e1"
  298. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  299. :title="e1"
  300. @focus="getFocus('10')"
  301. @blur="lostBlur"
  302. @input="getOil('e1')"
  303. :class="focusClass == 10 ? 'focusClass2' : 'focusClass1'"
  304. style="
  305. overflow: hidden;
  306. white-space: nowrap;
  307. text-overflow: ellipsis;
  308. "
  309. /><el-button class="user-btn" @click="getOil('e1')">{{
  310. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  311. }}</el-button>
  312. </li>
  313. <li>
  314. <el-input
  315. type="number"
  316. v-model="f"
  317. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  318. :title="f"
  319. @focus="getFocus('11')"
  320. @blur="lostBlur"
  321. @input="getOil('f')"
  322. :class="focusClass == 11 ? 'focusClass2' : 'focusClass1'"
  323. style="
  324. overflow: hidden;
  325. white-space: nowrap;
  326. text-overflow: ellipsis;
  327. "
  328. /><el-button class="user-btn" @click="getOil('f')">{{
  329. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  330. }}</el-button>
  331. </li>
  332. <li>
  333. <el-input
  334. type="number"
  335. v-model="g"
  336. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  337. :title="g"
  338. @focus="getFocus('12')"
  339. @blur="lostBlur"
  340. @input="getOil('g')"
  341. :class="focusClass == 12 ? 'focusClass2' : 'focusClass1'"
  342. style="
  343. overflow: hidden;
  344. white-space: nowrap;
  345. text-overflow: ellipsis;
  346. "
  347. /><el-button class="user-btn" @click="getOil('g')">{{
  348. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  349. }}</el-button>
  350. </li>
  351. <li>
  352. <el-input
  353. type="number"
  354. v-model="h"
  355. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  356. :title="h"
  357. @focus="getFocus('13')"
  358. @blur="lostBlur"
  359. @input="getOil('h')"
  360. :class="focusClass == 13 ? 'focusClass2' : 'focusClass1'"
  361. style="
  362. overflow: hidden;
  363. white-space: nowrap;
  364. text-overflow: ellipsis;
  365. "
  366. /><el-button class="user-btn" @click="getOil('h')">{{
  367. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  368. }}</el-button>
  369. </li>
  370. <li>
  371. <el-input
  372. type="number"
  373. v-model="i"
  374. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  375. :title="i"
  376. @focus="getFocus('14')"
  377. @blur="lostBlur"
  378. @input="getOil('i')"
  379. :class="focusClass == 14 ? 'focusClass2' : 'focusClass1'"
  380. style="
  381. overflow: hidden;
  382. white-space: nowrap;
  383. text-overflow: ellipsis;
  384. "
  385. /><el-button class="user-btn" @click="getOil('i')">{{
  386. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  387. }}</el-button>
  388. </li>
  389. </ul>
  390. </div>
  391. <div>
  392. <el-button class="user-btn-clear" @click="getOil('0')">{{
  393. $i18n.locale === 'zh' ? '数 据 重 置' : 'Data reset'
  394. }}</el-button>
  395. </div>
  396. </div>
  397. <div v-if="userNatural" style="width: 48%; display: inline-block">
  398. <div style="display: flex">
  399. <div style="width: 40px; height: 40px">
  400. <img
  401. src="@/assets/userUntil-7.png"
  402. style="width: 100%; height: 100%"
  403. />
  404. </div>
  405. <div
  406. style="
  407. font-size: 22px;
  408. font-weight: 700;
  409. height: 40px;
  410. line-height: 40px;
  411. margin-left: 10px;
  412. "
  413. >
  414. {{ $i18n.locale === 'zh' ? '天然气' : 'Natural gas' }}
  415. </div>
  416. </div>
  417. <div style="border-top: 1px solid #d7d7d7; width: 100%"></div>
  418. <div style="display: flex">
  419. <ul class="text-title" style="width: 30%">
  420. <li>{{ $i18n.locale === 'zh' ? '立方米(m3)' : 'm3' }}</li>
  421. <li>{{ $i18n.locale === 'zh' ? '立方英尺(ft3)' : 'ft3' }}</li>
  422. </ul>
  423. <ul style="width: 70%">
  424. <li>
  425. <el-input
  426. type="number"
  427. v-model="j"
  428. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  429. :title="j"
  430. @focus="getFocus('15')"
  431. @blur="lostBlur"
  432. @input="getGas('j')"
  433. :class="focusClass == 15 ? 'focusClass2' : 'focusClass1'"
  434. style="
  435. overflow: hidden;
  436. white-space: nowrap;
  437. text-overflow: ellipsis;
  438. "
  439. /><el-button class="user-btn" @click="getGas('j')">{{
  440. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  441. }}</el-button>
  442. </li>
  443. <li>
  444. <el-input
  445. type="number"
  446. v-model="k"
  447. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  448. :title="k"
  449. @focus="getFocus('16')"
  450. @blur="lostBlur"
  451. @input="getGas('k')"
  452. :class="focusClass == 16 ? 'focusClass2' : 'focusClass1'"
  453. style="
  454. overflow: hidden;
  455. white-space: nowrap;
  456. text-overflow: ellipsis;
  457. "
  458. /><el-button class="user-btn" @click="getGas('k')">{{
  459. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  460. }}</el-button>
  461. </li>
  462. </ul>
  463. </div>
  464. <div>
  465. <el-button class="user-btn-clear" @click="getGas('0')">{{
  466. $i18n.locale === 'zh' ? '数 据 重 置' : 'Data reset'
  467. }}</el-button>
  468. </div>
  469. </div>
  470. <div v-if="userHydrogen" style="width: 48%; display: inline-block">
  471. <div style="display: flex">
  472. <div style="width: 40px; height: 40px">
  473. <img
  474. src="@/assets/userUntil-3.png"
  475. style="width: 100%; height: 100%"
  476. />
  477. </div>
  478. <div
  479. style="
  480. font-size: 22px;
  481. font-weight: 700;
  482. height: 40px;
  483. line-height: 40px;
  484. margin-left: 10px;
  485. "
  486. >
  487. {{ $i18n.locale === 'zh' ? '氢' : 'Hydrogen' }}
  488. </div>
  489. </div>
  490. <div style="border-top: 1px solid #d7d7d7; width: 100%"></div>
  491. <div style="display: flex">
  492. <ul class="text-title" style="width: 30%">
  493. <li>{{ $i18n.locale === 'zh' ? '吨(t)' : 't' }}</li>
  494. <li>{{ $i18n.locale === 'zh' ? '千克(kg)' : 'kg' }}</li>
  495. <li>{{ $i18n.locale === 'zh' ? '磅(lb)' : 'lb' }}</li>
  496. <li>{{ $i18n.locale === 'zh' ? '长吨(lt)' : 'lt' }}</li>
  497. <li>{{ $i18n.locale === 'zh' ? '短吨(st)' : 'st' }}</li>
  498. <li>{{ $i18n.locale === 'zh' ? '立方米(m3)' : 'm3' }}</li>
  499. <li>{{ $i18n.locale === 'zh' ? '立方英尺(ft3)' : 'ft3' }}</li>
  500. </ul>
  501. <ul style="width: 70%">
  502. <li>
  503. <el-input
  504. type="number"
  505. v-model="a2"
  506. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  507. :title="a2"
  508. @focus="getFocus('17')"
  509. @blur="lostBlur"
  510. @input="getHydrogen('a2')"
  511. :class="focusClass == 17 ? 'focusClass2' : 'focusClass1'"
  512. style="
  513. overflow: hidden;
  514. white-space: nowrap;
  515. text-overflow: ellipsis;
  516. "
  517. /><el-button class="user-btn" @click="getHydrogen('a2')">{{
  518. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  519. }}</el-button>
  520. </li>
  521. <li>
  522. <el-input
  523. type="number"
  524. v-model="b2"
  525. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  526. :title="b2"
  527. @focus="getFocus('18')"
  528. @blur="lostBlur"
  529. @input="getHydrogen('b2')"
  530. :class="focusClass == 18 ? 'focusClass2' : 'focusClass1'"
  531. style="
  532. overflow: hidden;
  533. white-space: nowrap;
  534. text-overflow: ellipsis;
  535. "
  536. /><el-button class="user-btn" @click="getHydrogen('b2')">{{
  537. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  538. }}</el-button>
  539. </li>
  540. <li>
  541. <el-input
  542. type="number"
  543. v-model="c2"
  544. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  545. :title="c2"
  546. @focus="getFocus('19')"
  547. @blur="lostBlur"
  548. @input="getHydrogen('c2')"
  549. :class="focusClass == 19 ? 'focusClass2' : 'focusClass1'"
  550. style="
  551. overflow: hidden;
  552. white-space: nowrap;
  553. text-overflow: ellipsis;
  554. "
  555. /><el-button class="user-btn" @click="getHydrogen('c2')">{{
  556. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  557. }}</el-button>
  558. </li>
  559. <li>
  560. <el-input
  561. type="number"
  562. v-model="d2"
  563. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  564. :title="d2"
  565. @focus="getFocus('20')"
  566. @blur="lostBlur"
  567. @input="getHydrogen('d2')"
  568. :class="focusClass == 20 ? 'focusClass2' : 'focusClass1'"
  569. style="
  570. overflow: hidden;
  571. white-space: nowrap;
  572. text-overflow: ellipsis;
  573. "
  574. /><el-button class="user-btn" @click="getHydrogen('d2')">{{
  575. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  576. }}</el-button>
  577. </li>
  578. <li>
  579. <el-input
  580. type="number"
  581. v-model="e2"
  582. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  583. :title="e2"
  584. @focus="getFocus('21')"
  585. @blur="lostBlur"
  586. @input="getHydrogen('e2')"
  587. :class="focusClass == 21 ? 'focusClass2' : 'focusClass1'"
  588. style="
  589. overflow: hidden;
  590. white-space: nowrap;
  591. text-overflow: ellipsis;
  592. "
  593. /><el-button class="user-btn" @click="getHydrogen('e2')">{{
  594. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  595. }}</el-button>
  596. </li>
  597. <li>
  598. <el-input
  599. type="number"
  600. v-model="l"
  601. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  602. :title="l"
  603. @focus="getFocus('22')"
  604. @blur="lostBlur"
  605. @input="getHydrogen('l')"
  606. :class="focusClass == 22 ? 'focusClass2' : 'focusClass1'"
  607. style="
  608. overflow: hidden;
  609. white-space: nowrap;
  610. text-overflow: ellipsis;
  611. "
  612. /><el-button class="user-btn" @click="getHydrogen('l')">{{
  613. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  614. }}</el-button>
  615. </li>
  616. <li>
  617. <el-input
  618. type="number"
  619. v-model="m"
  620. :placeholder="this.$i18n.locale === 'zh' ? textInfo : textInfo1"
  621. :title="m"
  622. @focus="getFocus('23')"
  623. @blur="lostBlur"
  624. @input="getHydrogen('m')"
  625. :class="focusClass == 23 ? 'focusClass2' : 'focusClass1'"
  626. style="
  627. overflow: hidden;
  628. white-space: nowrap;
  629. text-overflow: ellipsis;
  630. "
  631. /><el-button class="user-btn" @click="getHydrogen('m')">{{
  632. $i18n.locale === 'zh' ? '换 算' : 'Conversion'
  633. }}</el-button>
  634. </li>
  635. </ul>
  636. </div>
  637. <div>
  638. <el-button class="user-btn-clear" @click="getHydrogen('0')">{{
  639. $i18n.locale === 'zh' ? '数 据 重 置' : 'Data reset'
  640. }}</el-button>
  641. </div>
  642. </div>
  643. </div>
  644. </div>
  645. </template>
  646. <script>
  647. export default {
  648. name: 'unitConversion',
  649. data() {
  650. return {
  651. focusClass: '',
  652. userCoal: true,
  653. userOil: true,
  654. userNatural: true,
  655. userHydrogen: true,
  656. informationsClass: '0',
  657. textInfo: '请输入数值',
  658. textInfo1: 'Please enter a value',
  659. //煤炭
  660. a: '',
  661. b: '',
  662. c: '',
  663. d: '',
  664. e: '',
  665. //石油
  666. a1: '',
  667. b1: '',
  668. c1: '',
  669. d1: '',
  670. e1: '',
  671. f: '',
  672. g: '',
  673. h: '',
  674. i: '',
  675. //天然气
  676. j: '',
  677. k: '',
  678. //氢
  679. a2: '',
  680. b2: '',
  681. c2: '',
  682. d2: '',
  683. e2: '',
  684. l: '',
  685. m: '',
  686. }
  687. },
  688. mounted() {
  689. this.getInfo('0')
  690. },
  691. methods: {
  692. lostBlur() {
  693. this.focusClass = ''
  694. },
  695. getFocus(num) {
  696. this.focusClass = num
  697. },
  698. getInfo(num) {
  699. this.informationsClass = num
  700. if (num == '0') {
  701. this.userCoal = true
  702. this.userOil = true
  703. this.userNatural = true
  704. this.userHydrogen = true
  705. }
  706. if (num == '1') {
  707. this.userCoal = true
  708. this.userOil = false
  709. this.userNatural = false
  710. this.userHydrogen = false
  711. }
  712. if (num == '2') {
  713. this.userCoal = false
  714. this.userOil = true
  715. this.userNatural = false
  716. this.userHydrogen = false
  717. }
  718. if (num == '3') {
  719. this.userCoal = false
  720. this.userOil = false
  721. this.userNatural = true
  722. this.userHydrogen = false
  723. }
  724. if (num == '4') {
  725. this.userCoal = false
  726. this.userOil = false
  727. this.userNatural = false
  728. this.userHydrogen = true
  729. }
  730. },
  731. getNum(num) {
  732. if (num == 'a') {
  733. if (this.a == '') {
  734. this.getNum('0')
  735. } else {
  736. let a1 = Number(this.a)
  737. this.b = (a1 * Number(1000)).toFixed(3)
  738. this.c = (a1 * Number(2205)).toFixed(3)
  739. this.d = (a1 * Number(0.9843)).toFixed(3)
  740. this.e = (a1 * Number(1.102)).toFixed(3)
  741. }
  742. } else if (num == 'b') {
  743. if (this.b == '') {
  744. this.getNum('0')
  745. } else {
  746. let b1 = Number(this.b)
  747. this.a = (b1 / Number(1000)).toFixed(3)
  748. let a2 = Number(this.a)
  749. this.c = (a2 * Number(2205)).toFixed(3)
  750. this.d = (a2 * Number(0.9843)).toFixed(3)
  751. this.e = (a2 * Number(1.102)).toFixed(3)
  752. }
  753. } else if (num == 'c') {
  754. if (this.c == '') {
  755. this.getNum('0')
  756. } else {
  757. let c1 = Number(this.c)
  758. this.a = (c1 / Number(2205)).toFixed(3)
  759. let a3 = Number(this.a)
  760. this.b = (a3 * Number(1000)).toFixed(3)
  761. this.d = (a3 * Number(0.9843)).toFixed(3)
  762. this.e = (a3 * Number(1.102)).toFixed(3)
  763. }
  764. } else if (num == 'd') {
  765. if (this.d == '') {
  766. this.getNum('0')
  767. } else {
  768. let d1 = Number(this.d)
  769. this.a = (d1 / Number(0.9843)).toFixed(3)
  770. let a4 = Number(this.a)
  771. this.b = (a4 * Number(1000)).toFixed(3)
  772. this.c = (a4 * Number(2205)).toFixed(3)
  773. this.e = (a4 * Number(1.102)).toFixed(3)
  774. }
  775. } else if (num == 'e') {
  776. if (this.e == '') {
  777. this.getNum('0')
  778. } else {
  779. let e1 = Number(this.e)
  780. this.a = (e1 / Number(1.102)).toFixed(3)
  781. let a5 = Number(this.a)
  782. this.b = (a5 * Number(1000)).toFixed(3)
  783. this.c = (a5 * Number(2205)).toFixed(3)
  784. this.d = (a5 * Number(0.9843)).toFixed(3)
  785. }
  786. } else if (num == '0') {
  787. this.a = ''
  788. this.b = ''
  789. this.c = ''
  790. this.d = ''
  791. this.e = ''
  792. }
  793. },
  794. getOil(num) {
  795. if (num == 'a1') {
  796. if (this.a1 == '') {
  797. this.getOil('0')
  798. } else {
  799. let a2 = Number(this.a1)
  800. this.b1 = (a2 * Number(1000)).toFixed(3)
  801. this.c1 = (a2 * Number(2205)).toFixed(3)
  802. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  803. this.e1 = (a2 * Number(1.102)).toFixed(3)
  804. this.f = (a2 * Number(1173)).toFixed(3)
  805. this.g = (a2 * Number(309.8)).toFixed(3)
  806. this.h = (a2 * Number(258)).toFixed(3)
  807. this.i = (a2 * Number(7.38)).toFixed(3)
  808. }
  809. }
  810. if (num == 'b1') {
  811. if (this.b1 == '') {
  812. this.getOil('0')
  813. } else {
  814. let b1 = Number(this.b1)
  815. this.a1 = (b1 / Number(1000)).toFixed(3)
  816. let a2 = Number(this.a1)
  817. this.c1 = (a2 * Number(2205)).toFixed(3)
  818. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  819. this.e1 = (a2 * Number(1.102)).toFixed(3)
  820. this.f = (a2 * Number(1173)).toFixed(3)
  821. this.g = (a2 * Number(309.8)).toFixed(3)
  822. this.h = (a2 * Number(258)).toFixed(3)
  823. this.i = (a2 * Number(7.38)).toFixed(3)
  824. }
  825. }
  826. if (num == 'c1') {
  827. if (this.c1 == '') {
  828. this.getOil('0')
  829. } else {
  830. let c1 = Number(this.c1)
  831. this.a1 = (c1 / Number(2205)).toFixed(3)
  832. let a2 = Number(this.a1)
  833. this.b1 = (a2 * Number(1000)).toFixed(3)
  834. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  835. this.e1 = (a2 * Number(1.102)).toFixed(3)
  836. this.f = (a2 * Number(1173)).toFixed(3)
  837. this.g = (a2 * Number(309.8)).toFixed(3)
  838. this.h = (a2 * Number(258)).toFixed(3)
  839. this.i = (a2 * Number(7.38)).toFixed(3)
  840. }
  841. }
  842. if (num == 'd1') {
  843. if (this.d1 == '') {
  844. this.getOil('0')
  845. } else {
  846. let d1 = Number(this.d1)
  847. this.a1 = (d1 / Number(0.9843)).toFixed(3)
  848. let a2 = Number(this.a1)
  849. this.b1 = (a2 * Number(1000)).toFixed(3)
  850. this.c1 = (a2 * Number(2205)).toFixed(3)
  851. this.e1 = (a2 * Number(1.102)).toFixed(3)
  852. this.f = (a2 * Number(1173)).toFixed(3)
  853. this.g = (a2 * Number(309.8)).toFixed(3)
  854. this.h = (a2 * Number(258)).toFixed(3)
  855. this.i = (a2 * Number(7.38)).toFixed(3)
  856. }
  857. }
  858. if (num == 'e1') {
  859. if (this.e1 == '') {
  860. this.getOil('0')
  861. } else {
  862. let e2 = Number(this.e1)
  863. this.a1 = (e2 / Number(1.102)).toFixed(3)
  864. let a2 = Number(this.a1)
  865. this.b1 = (a2 * Number(1000)).toFixed(3)
  866. this.c1 = (a2 * Number(2205)).toFixed(3)
  867. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  868. this.f = (a2 * Number(1173)).toFixed(3)
  869. this.g = (a2 * Number(309.8)).toFixed(3)
  870. this.h = (a2 * Number(258)).toFixed(3)
  871. this.i = (a2 * Number(7.38)).toFixed(3)
  872. }
  873. }
  874. if (num == 'f') {
  875. if (this.f == '') {
  876. this.getOil('0')
  877. } else {
  878. let f2 = Number(this.f)
  879. this.a1 = (f2 / Number(1173)).toFixed(3)
  880. let a2 = Number(this.a1)
  881. this.b1 = (a2 * Number(1000)).toFixed(3)
  882. this.c1 = (a2 * Number(2205)).toFixed(3)
  883. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  884. this.e1 = (a2 * Number(1.102)).toFixed(3)
  885. this.g = (a2 * Number(309.8)).toFixed(3)
  886. this.h = (a2 * Number(258)).toFixed(3)
  887. this.i = (a2 * Number(7.38)).toFixed(3)
  888. }
  889. }
  890. if (num == 'g') {
  891. if (this.g == '') {
  892. this.getOil('0')
  893. } else {
  894. let g2 = Number(this.g)
  895. this.a1 = (g2 / Number(309.8)).toFixed(3)
  896. let a2 = Number(this.a1)
  897. this.b1 = (a2 * Number(1000)).toFixed(3)
  898. this.c1 = (a2 * Number(2205)).toFixed(3)
  899. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  900. this.e1 = (a2 * Number(1.102)).toFixed(3)
  901. this.f = (a2 * Number(1173)).toFixed(3)
  902. this.h = (a2 * Number(258)).toFixed(3)
  903. this.i = (a2 * Number(7.38)).toFixed(3)
  904. }
  905. }
  906. if (num == 'h') {
  907. if (this.h == '') {
  908. this.getOil('0')
  909. } else {
  910. let g2 = Number(this.h)
  911. this.a1 = (g2 / Number(258)).toFixed(3)
  912. let a2 = Number(this.a1)
  913. this.b1 = (a2 * Number(1000)).toFixed(3)
  914. this.c1 = (a2 * Number(2205)).toFixed(3)
  915. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  916. this.e1 = (a2 * Number(1.102)).toFixed(3)
  917. this.f = (a2 * Number(1173)).toFixed(3)
  918. this.g = (a2 * Number(309.8)).toFixed(3)
  919. this.i = (a2 * Number(7.38)).toFixed(3)
  920. }
  921. }
  922. if (num == 'i') {
  923. if (this.i == '') {
  924. this.getOil('0')
  925. } else {
  926. let g2 = Number(this.i)
  927. this.a1 = (g2 / Number(7.38)).toFixed(3)
  928. let a2 = Number(this.a1)
  929. this.b1 = (a2 * Number(1000)).toFixed(3)
  930. this.c1 = (a2 * Number(2205)).toFixed(3)
  931. this.d1 = (a2 * Number(0.9843)).toFixed(3)
  932. this.e1 = (a2 * Number(1.102)).toFixed(3)
  933. this.f = (a2 * Number(1173)).toFixed(3)
  934. this.g = (a2 * Number(309.8)).toFixed(3)
  935. this.h = (a2 * Number(258)).toFixed(3)
  936. }
  937. }
  938. if (num == '0') {
  939. this.a1 = ''
  940. this.b1 = ''
  941. this.c1 = ''
  942. this.d1 = ''
  943. this.e1 = ''
  944. this.f = ''
  945. this.g = ''
  946. this.h = ''
  947. this.i = ''
  948. }
  949. },
  950. getGas(num) {
  951. if (num == 'j') {
  952. if (this.j == '') {
  953. this.getGas('0')
  954. } else {
  955. let j1 = Number(this.j)
  956. this.k = (j1 * Number(35.31)).toFixed(3)
  957. }
  958. }
  959. if (num == 'k') {
  960. if (this.k == '') {
  961. this.getGas('0')
  962. } else {
  963. let k1 = Number(this.k)
  964. this.j = (k1 / Number(35.31)).toFixed(3)
  965. }
  966. }
  967. if (num == '0') {
  968. this.j = ''
  969. this.k = ''
  970. }
  971. },
  972. getHydrogen(num) {
  973. if (num == 'a2') {
  974. if (this.a2 == '') {
  975. this.getHydrogen('0')
  976. } else {
  977. let a3 = Number(this.a2)
  978. this.b2 = (a3 * Number(1000)).toFixed(3)
  979. this.c2 = (a3 * Number(2205)).toFixed(3)
  980. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  981. this.e2 = (a3 * Number(1.102)).toFixed(3)
  982. this.l = (a3 * Number(11124)).toFixed(3)
  983. this.m = (a3 * Number(392771)).toFixed(3)
  984. }
  985. }
  986. if (num == 'b2') {
  987. if (this.b2 == '') {
  988. this.getHydrogen('0')
  989. } else {
  990. this.a2 = Number(this.b2) / Number(1000)
  991. let a3 = Number(this.a2)
  992. this.c2 = (a3 * Number(2205)).toFixed(3)
  993. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  994. this.e2 = (a3 * Number(1.102)).toFixed(3)
  995. this.l = (a3 * Number(11124)).toFixed(3)
  996. this.m = (a3 * Number(392771)).toFixed(3)
  997. }
  998. }
  999. if (num == 'c2') {
  1000. if (this.c2 == '') {
  1001. this.getHydrogen('0')
  1002. } else {
  1003. this.a2 = Number(this.c2) / Number(2205)
  1004. let a3 = Number(this.a2)
  1005. this.b2 = (a3 * Number(1000)).toFixed(3)
  1006. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  1007. this.e2 = (a3 * Number(1.102)).toFixed(3)
  1008. this.l = (a3 * Number(11124)).toFixed(3)
  1009. this.m = (a3 * Number(392771)).toFixed(3)
  1010. }
  1011. }
  1012. if (num == 'd2') {
  1013. if (this.d2 == '') {
  1014. this.getHydrogen('0')
  1015. } else {
  1016. this.a2 = Number(this.d2) / Number(0.9843)
  1017. let a3 = Number(this.a2)
  1018. this.b2 = (a3 * Number(1000)).toFixed(3)
  1019. this.c2 = (a3 * Number(2205)).toFixed(3)
  1020. this.e2 = (a3 * Number(1.102)).toFixed(3)
  1021. this.l = (a3 * Number(11124)).toFixed(3)
  1022. this.m = (a3 * Number(392771)).toFixed(3)
  1023. }
  1024. }
  1025. if (num == 'e2') {
  1026. if (this.e2 == '') {
  1027. this.getHydrogen('0')
  1028. } else {
  1029. this.a2 = Number(this.e2) / Number(1.102)
  1030. let a3 = Number(this.a2)
  1031. this.b2 = (a3 * Number(1000)).toFixed(3)
  1032. this.c2 = (a3 * Number(2205)).toFixed(3)
  1033. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  1034. this.l = (a3 * Number(11124)).toFixed(3)
  1035. this.m = (a3 * Number(392771)).toFixed(3)
  1036. }
  1037. }
  1038. if (num == 'l') {
  1039. if (this.l == '') {
  1040. this.getHydrogen('0')
  1041. } else {
  1042. this.a2 = Number(this.l) / Number(11124)
  1043. let a3 = Number(this.a2)
  1044. this.b2 = (a3 * Number(1000)).toFixed(3)
  1045. this.c2 = (a3 * Number(2205)).toFixed(3)
  1046. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  1047. this.e2 = (a3 * Number(1.102)).toFixed(3)
  1048. this.m = (a3 * Number(392771)).toFixed(3)
  1049. }
  1050. }
  1051. if (num == 'm') {
  1052. if (this.m == '') {
  1053. this.getHydrogen('0')
  1054. } else {
  1055. this.a2 = Number(this.m) / Number(392771)
  1056. let a3 = Number(this.a2)
  1057. this.b2 = (a3 * Number(1000)).toFixed(3)
  1058. this.c2 = (a3 * Number(2205)).toFixed(3)
  1059. this.d2 = (a3 * Number(0.9843)).toFixed(3)
  1060. this.e2 = (a3 * Number(1.102)).toFixed(3)
  1061. this.l = (a3 * Number(11124)).toFixed(3)
  1062. }
  1063. }
  1064. if (num == '0') {
  1065. this.a2 = ''
  1066. this.b2 = ''
  1067. this.c2 = ''
  1068. this.d2 = ''
  1069. this.e2 = ''
  1070. this.l = ''
  1071. this.m = ''
  1072. }
  1073. },
  1074. },
  1075. }
  1076. </script>
  1077. <style lang="less" scoped>
  1078. ul > li {
  1079. height: 41px;
  1080. margin: 20px 0;
  1081. line-height: 41px;
  1082. border-top: 1px solid #dbdbdb;
  1083. border-right: 1px solid #dbdbdb;
  1084. border-bottom: 1px solid #dbdbdb;
  1085. display: flex;
  1086. }
  1087. .none-title > li {
  1088. border: none !important;
  1089. height: 41px;
  1090. line-height: 41px;
  1091. }
  1092. .text-title > li {
  1093. padding-left: 10px;
  1094. border-left: 1px solid #dbdbdb;
  1095. }
  1096. ul > li /deep/.el-input__inner {
  1097. width: 100% !important;
  1098. height: 100% !important;
  1099. border: none;
  1100. border-radius: 0;
  1101. background-color: rgba(255, 255, 255, 0);
  1102. color: #000;
  1103. }
  1104. .information {
  1105. display: inline-block;
  1106. height: 100%;
  1107. text-align: center;
  1108. color: #343434;
  1109. box-sizing: border-box;
  1110. vertical-align: middle;
  1111. font-weight: 600;
  1112. padding: 0 20px;
  1113. }
  1114. .information1 {
  1115. display: inline-block;
  1116. height: 100%;
  1117. text-align: center;
  1118. color: #b7b7b7;
  1119. box-sizing: border-box;
  1120. vertical-align: middle;
  1121. font-weight: 600;
  1122. padding: 0 20px;
  1123. border-radius: 10px;
  1124. cursor: pointer;
  1125. }
  1126. .information1:hover {
  1127. color: #2c5589;
  1128. cursor: pointer;
  1129. }
  1130. .information2 {
  1131. display: inline-block;
  1132. height: 100%;
  1133. text-align: center;
  1134. color: #fff;
  1135. background-color: #105dbc;
  1136. box-sizing: border-box;
  1137. vertical-align: middle;
  1138. font-weight: 600;
  1139. padding: 0 20px;
  1140. border-radius: 10px;
  1141. cursor: pointer;
  1142. }
  1143. .focusClass1 {
  1144. border: none;
  1145. }
  1146. .focusClass2 {
  1147. border: 2px solid #c7d1dd;
  1148. background-color: #f1f1f1;
  1149. }
  1150. .user-btn {
  1151. background-color: #105dbc;
  1152. color: #fff;
  1153. }
  1154. // .user-btn:hover {
  1155. // background-color: #18caf7;
  1156. // color: #000;
  1157. // }
  1158. .user-btn-clear {
  1159. width: 60%;
  1160. margin-left: 20%;
  1161. margin-top: 2%;
  1162. font-size: 16px;
  1163. font-weight: 700;
  1164. box-shadow: 5px 5px 5px rgb(63, 62, 62);
  1165. border-bottom: 1px;
  1166. border-right: 1px;
  1167. vertical-align: middle;
  1168. background: linear-gradient(90deg, #3f9eff, #1674d5);
  1169. color: #fff;
  1170. border-radius: 50px;
  1171. }
  1172. // .user-btn-clear:hover {
  1173. // width: 60%;
  1174. // margin-left: 20%;
  1175. // margin-top: 2%;
  1176. // font-size: 16px;
  1177. // font-weight: 700;
  1178. // vertical-align: middle;
  1179. // background: linear-gradient(90deg, #4d98e4, #18caf7);
  1180. // color: #000;
  1181. // border-radius: 50px;
  1182. // }
  1183. /deep/ input::-webkit-outer-spin-button,
  1184. /deep/ input::-webkit-inner-spin-button {
  1185. -webkit-appearance: none !important;
  1186. }
  1187. /deep/ input[type='number'] {
  1188. -moz-appearance: textfield !important;
  1189. }
  1190. .user-title1 {
  1191. width: 100%;
  1192. display: flex;
  1193. height: 40px;
  1194. line-height: 40px;
  1195. margin-top: 12px;
  1196. margin-bottom: 12px;
  1197. }
  1198. .user-title2 {
  1199. width: 100%;
  1200. display: flex;
  1201. flex-wrap: wrap;
  1202. height: 40px;
  1203. line-height: 40px;
  1204. margin-top: 14px;
  1205. margin-bottom: 52px;
  1206. }
  1207. </style>