generalParameters.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="">
  3. <view class="line">
  4. </view>
  5. <view class="body">
  6. <p class="p">自测试模式</p>
  7. <!-- <input class="input" type="text" v-model="M17" /> -->
  8. <!-- <button type="primary" class="button" @click="update('M-17',M17)">
  9. <p class="p2">更新</P>
  10. </button> -->
  11. <button type="primary" class="button" @click="update('M17','0')">
  12. <p class="p2">启动</P>
  13. </button>
  14. <button type="primary" class="button" @click="update('M17','1')">
  15. <p class="p2">关闭</P>
  16. </button>
  17. </view>
  18. <view class="line2"></view>
  19. <view class="body">
  20. <p class="p">A轴正转</p>
  21. <!-- <input class="input" type="text" v-model="M311" /> -->
  22. <button type="primary" class="button" @click="update('M311','0')">
  23. <p class="p2">启动</P>
  24. </button>
  25. <button type="primary" class="button" @click="update('M311','1')">
  26. <p class="p2">关闭</P>
  27. </button>
  28. </view>
  29. <view class="line2"></view>
  30. <view class="body">
  31. <p class="p">A轴反转</p>
  32. <!-- <input class="input" type="text" v-model="M312" />
  33. <button type="primary" class="button" @click="update('M-312',M312)">
  34. <p class="p2">更新</P>
  35. </button> -->
  36. <button type="primary" class="button" @click="update('M312','0')">
  37. <p class="p2">启动</P>
  38. </button>
  39. <button type="primary" class="button" @click="update('M312','1')">
  40. <p class="p2">关闭</P>
  41. </button>
  42. </view>
  43. <view class="line2"></view>
  44. <view class="body">
  45. <p class="p">喷水泵启动</p>
  46. <!-- <input class="input" type="text" v-model="M313" />
  47. <button type="primary" class="button" @click="update('M-313',M313)">
  48. <p class="p2">更新</P>
  49. </button> -->
  50. <button type="primary" class="button" @click="update('M313','0')">
  51. <p class="p2">启动</P>
  52. </button>
  53. <button type="primary" class="button" @click="update('M313','1')">
  54. <p class="p2">关闭</P>
  55. </button>
  56. </view>
  57. <view class="line2"></view>
  58. <view class="body">
  59. <p class="p">气泵启动</p>
  60. <!-- <input class="input" type="text" v-model="M315" />
  61. <button type="primary" class="button" @click="update('M-315',M315)">
  62. <p class="p2">更新</P>
  63. </button> -->
  64. <button type="primary" class="button" @click="update('M315','0')">
  65. <p class="p2">启动</P>
  66. </button>
  67. <button type="primary" class="button" @click="update('M315','1')">
  68. <p class="p2">关闭</P>
  69. </button>
  70. </view>
  71. <view class="line2"></view>
  72. <view class="body">
  73. <p class="p">清洁消毒喷水泵</p>
  74. <!-- <input class="input" type="text" v-model="M316" />
  75. <button type="primary" class="button" @click="update('M-316',M316)">
  76. <p class="p2">更新</P>
  77. </button> -->
  78. <button type="primary" class="button" @click="update('M316','0')">
  79. <p class="p2">启动</P>
  80. </button>
  81. <button type="primary" class="button" @click="update('M316','1')">
  82. <p class="p2">关闭</P>
  83. </button>
  84. </view>
  85. <view class="line2"></view>
  86. <view class="body">
  87. <p class="p">清洗洁厕灵+水</p>
  88. <!-- <input class="input" type="text" v-model="M317" />
  89. <button type="primary" class="button" @click="update('M-317',M317)">
  90. <p class="p2">更新</P>
  91. </button> -->
  92. <button type="primary" class="button" @click="update('M317','0')">
  93. <p class="p2">启动</P>
  94. </button>
  95. <button type="primary" class="button" @click="update('M317','1')">
  96. <p class="p2">关闭</P>
  97. </button>
  98. </view>
  99. <view class="line2"></view>
  100. <view class="body">
  101. <p class="p">消毒液+水</p>
  102. <!-- <input class="input" type="text" v-model="M318" /> -->
  103. <!-- <button type="primary" class="button" @click="update('M-318',M318)">
  104. <p class="p2">更新</P>
  105. </button> -->
  106. <button type="primary" class="button" @click="update('M318','0')">
  107. <p class="p2">启动</P>
  108. </button>
  109. <button type="primary" class="button" @click="update('M318','1')">
  110. <p class="p2">关闭</P>
  111. </button>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. mapState,
  118. mapActions,
  119. mapMutations
  120. } from 'vuex'
  121. export default {
  122. data() {
  123. return {
  124. M17: 0,
  125. M311: 0,
  126. M312: 0,
  127. M313: 0,
  128. M315: 0,
  129. M316: 0,
  130. M317: 0,
  131. M318: 0,
  132. }
  133. },
  134. onShow() {
  135. this.getParam();
  136. },
  137. methods: {
  138. ...mapActions('chart', ['getParameters', 'updateParameters']),
  139. getParam() {
  140. const param = {};
  141. param['id'] = uni.getStorageSync("nowEquipmentId");
  142. param['code'] = '0';
  143. this.getParameters(param).then(data => {
  144. var info = data;
  145. if (info!=null||info!='') {
  146. for (var i = 0; i < info.length; i++) {
  147. if(info[i].name=='M-17'){
  148. this.M17=info[i].val;
  149. }
  150. if(info[i].name=='M-311'){
  151. this.M311=info[i].val;
  152. }
  153. if(info[i].name=='M-312'){
  154. this.M312=info[i].val;
  155. }
  156. if(info[i].name=='M-313'){
  157. this.M313=info[i].val;
  158. }
  159. if(info[i].name=='M-315'){
  160. this.M315=info[i].val;
  161. }
  162. if(info[i].name=='M-316'){
  163. this.M316=info[i].val;
  164. }
  165. if(info[i].name=='M-317'){
  166. this.M317=info[i].val;
  167. }
  168. if(info[i].name=='M-318'){
  169. this.M318=info[i].val;
  170. }
  171. }
  172. }
  173. }, _ => void uni.stopPullDownRefresh());
  174. },
  175. update(name, val) {
  176. const param = {};
  177. param['id'] = uni.getStorageSync("nowEquipmentId");
  178. param['name'] = name;
  179. param['val'] = val;
  180. this.updateParameters(param).then(data => {
  181. if (data == 'SUCCESS') {
  182. uni.showToast({
  183. title: '修改成功',
  184. duration: 1000
  185. });
  186. }
  187. }, _ => void uni.stopPullDownRefresh());
  188. },
  189. },
  190. }
  191. </script>
  192. <style>
  193. .line {
  194. height: 50upx;
  195. }
  196. .line2 {
  197. height: 10upx;
  198. }
  199. .body {
  200. padding-top: 10upx;
  201. background-color: #FFFFFF;
  202. width: 550upx;
  203. padding: 10upx 10upx 10upx 10upx;
  204. display: flex;
  205. flex-direction: row;
  206. justify-content: flex-start;
  207. font-size: 32upx;
  208. }
  209. .p {
  210. width: 250upx;
  211. padding-top: 3upx;
  212. text-align: right;
  213. }
  214. .input {
  215. width: 200upx;
  216. box-shadow: 0upx 0upx 20upx #D3D3D3;
  217. border-radius: 5upx;
  218. }
  219. .button {
  220. width: 120upx;
  221. height: 60upx;
  222. text-align: left;
  223. border-radius: 10upx;
  224. }
  225. .p2 {
  226. font-size: 30upx;
  227. /* #ifndef H5 */
  228. padding-top: 3upx;
  229. /* #endif */
  230. position: absolute;
  231. /* 水平居中 */
  232. left: 50%;
  233. -webkit-transform: translateX(-50%);
  234. transform: translateX(-50%);
  235. }
  236. </style>