humidityParameters.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="">
  3. <!-- <view class="line">
  4. </view> -->
  5. <view class="search">
  6. <view class="search-title">
  7. {{$t('dosugar.equipmentClientID')}}
  8. </view>
  9. <view class="search-input">
  10. <input type="text" :placeholder="$t('dosugar.placeholder')" v-model="searchClientId" />
  11. </view>
  12. <view class="search-button">
  13. <button type="primary" class="" @click="search()">
  14. <p class="">{{$t('dosugar.search')}}</P>
  15. </button>
  16. </view>
  17. </view>
  18. <view class="td-right">
  19. <view class="uni-list">
  20. <view class="uni-list-cell">
  21. <view class="uni-list-cell-left">
  22. {{$t('dosugar.chooseEquipment')}}
  23. </view>
  24. <view class="uni-list-cell-db" style="overflow: hidden;text-overflow: ellipsis;">
  25. <picker @change="changeEquipment" :value="index" :range="equipmentNameList">
  26. <view class="uni-input">{{equipmentNameList[index]}}</view>
  27. </picker>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view >
  33. <view class="line2"></view>
  34. <view class="body">
  35. <p class="p">{{$t('parameters.cabinetHd')}}:</p>
  36. <input class="input" type="text" v-model="cabinetHd" />
  37. </view>
  38. <!-- 320和330特有 -->
  39. <view class="" v-show="equimentType=='MG330'||equimentType=='MG320'">
  40. <view class="line2"></view>
  41. <view class="body">
  42. <p class="p">{{$t('parameters.allUpdate')}}:</p>
  43. <input class="input" type="text" v-model="allUpdate" />
  44. <button type="primary" class="button" @click="update('allUpdate',allUpdate)">
  45. <p class="p2">{{$t('parameters.update')}}</P>
  46. </button>
  47. </view>
  48. <view class="line2"></view>
  49. </view>
  50. <!-- //320特有 -->
  51. <view class="" v-show="equimentType=='MG320'">
  52. <view class="line2"></view>
  53. <view class="body">
  54. <p class="p">{{$t('parameters.winter')}}:</p>
  55. <button type="primary" class="button" @click="update('winter','winter')">
  56. <p class="p2">{{$t('parameters.update')}}</P>
  57. </button>
  58. </view>
  59. <view class="line2"></view>
  60. <view class="body">
  61. <p class="p">{{$t('parameters.summer')}}:</p>
  62. <button type="primary" class="button" @click="update('summer','summer')">
  63. <p class="p2">{{$t('parameters.update')}}</P>
  64. </button>
  65. </view>
  66. <view class="line2"></view>
  67. </view>
  68. <!-- 301和280特有 -->
  69. <view class="" v-show="equimentType=='MG301'||equimentType=='MG280'">
  70. </view>
  71. <!-- 280特有 -->
  72. <view class="" v-show="equimentType=='MG280'">
  73. </view>
  74. </view>
  75. <view class="line2"></view>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. mapState,
  81. mapActions,
  82. mapMutations
  83. } from 'vuex'
  84. export default {
  85. data() {
  86. return {
  87. index: null,
  88. allUpdate:null,
  89. equipmentName: null,
  90. equimentType: null,
  91. equipmentId:null,
  92. cabinetHd:'',
  93. equipmentNameList: [],
  94. globalUser: null,
  95. show: true,
  96. searchClientId:null
  97. }
  98. },
  99. onShow() {
  100. var token = uni.getStorageSync("token");
  101. this.globalUser = uni.getStorageSync("globalUser");
  102. if (token.length > 1) {
  103. this.getEquipmentListData();
  104. // this.getParam();
  105. } else {
  106. uni.reLaunch({
  107. url: '../Login/Login',
  108. });
  109. }
  110. },
  111. methods: {
  112. ...mapActions('chart', ['getParameters', 'humidityParameters', 'getEquipmentListByUser']),
  113. getEquipmentListData() {
  114. this.getEquipmentListByUser(this.globalUser)
  115. .then(data => {
  116. // this.merchantList = data;
  117. var listName = data[0].equipmentList;
  118. var equipmentNameList = [];
  119. for (var i = 0; i < listName.length; i++) {
  120. equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
  121. listName[i].clientId.length - 6, listName[i].clientId.length));
  122. }
  123. this.equipmentNameList = equipmentNameList;
  124. var listId = data[0].id;
  125. if (listId != null && listId != '1') {
  126. uni.setStorageSync("listName", listName);
  127. }
  128. uni.stopPullDownRefresh();
  129. }, _ => void uni.stopPullDownRefresh());
  130. },
  131. search(){
  132. var clientId = this.searchClientId;
  133. var list = uni.getStorageSync("listName");
  134. var n = 0;
  135. for (var i = 0; i < list.length; i++) {
  136. var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
  137. if(code==clientId){
  138. n++;
  139. this.index = i;
  140. var id = list[i].id;
  141. this.equipmentId = id;
  142. this.cabinetHd = list[i].cabinetHd;
  143. this.equimentType = list[i].equimentType;
  144. this.clientId = list[i].clientId;
  145. this.show = true;
  146. if (this.equimentType == 'MG280') {
  147. this.show = false;
  148. }
  149. // this.getParam();
  150. break;
  151. }
  152. }
  153. if(n==0){
  154. uni.showModal({
  155. title: "提示",
  156. content: "找不到该机器",
  157. success: (res) => {
  158. }
  159. })
  160. }
  161. },
  162. //改变机器
  163. changeEquipment: function(e) {
  164. this.searchClientId = null;
  165. this.index = e.target.value;
  166. var list = uni.getStorageSync("listName");
  167. // this.getProName(list[e.target.value].id);
  168. this.equipmentId = list[e.target.value].id;
  169. this.cabinetHd = list[e.target.value].cabinetHd;
  170. this.equimentType = list[e.target.value].equimentType;
  171. this.clientId = list[e.target.value].clientId;
  172. this.show = true;
  173. if (this.equimentType == 'MG280') {
  174. this.show = false;
  175. }
  176. // console.log("eid==" + this.equipmentId);
  177. // console.log("equimentType==" + this.equimentType);
  178. // this.getParam();
  179. },
  180. update(name, val) {
  181. const param = {};
  182. param['id'] = this.equipmentId;
  183. param['name'] = name;
  184. param['val'] = val;
  185. this.humidityParameters(param).then(res => {
  186. if (res.data == 'SUCCESS') {
  187. uni.showToast({
  188. title: '发送成功success',
  189. duration: 1000
  190. });
  191. }
  192. }, _ => void uni.stopPullDownRefresh());
  193. },
  194. },
  195. }
  196. </script>
  197. <style>
  198. .search{
  199. width: 100%;
  200. padding-top: 10upx;
  201. display: flex;
  202. flex-direction: row;
  203. justify-content: flex-start;
  204. }
  205. .search-title{
  206. width: 28%;
  207. text-align: center;
  208. font-size: 26upx;
  209. font-family: "PingFang-SC-Bold";
  210. }
  211. .search-input{
  212. width: 45%;
  213. text-align: center;
  214. font-size: 26upx;
  215. font-family: "PingFang-SC-Bold";
  216. box-shadow: 0upx 0upx 20upx #D3D3D3;
  217. border-radius: 5upx;
  218. }
  219. .search-button{
  220. width: 20%;
  221. padding-left: 7upx;
  222. text-align: center;
  223. }
  224. .line {
  225. height: 50upx;
  226. }
  227. .line2 {
  228. height: 10upx;
  229. }
  230. .body {
  231. background-color: #FFFFFF;
  232. width: 700upx;
  233. padding: 10upx 10upx 10upx 10upx;
  234. display: flex;
  235. flex-direction: row;
  236. justify-content: flex-start;
  237. font-size: 32upx;
  238. }
  239. .p {
  240. width: 350upx;
  241. text-align: right;
  242. }
  243. .input {
  244. width: 200upx;
  245. box-shadow: 0upx 0upx 20upx #D3D3D3;
  246. border-radius: 5upx;
  247. text-align: center;
  248. }
  249. .button {
  250. width: 120upx;
  251. height: 60upx;
  252. text-align: left;
  253. border-radius: 10upx;
  254. }
  255. .p2 {
  256. font-size: 30upx;
  257. /* #ifndef H5 */
  258. padding-top: 3upx;
  259. /* #endif */
  260. position: absolute;
  261. /* 水平居中 */
  262. left: 50%;
  263. -webkit-transform: translateX(-50%);
  264. transform: translateX(-50%);
  265. }
  266. </style>