humidityParameters.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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" size="mini" 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. uni.setNavigationBarTitle({
  103. title: this.$t('parameters.cabinet_hd')
  104. });
  105. if (token.length > 1) {
  106. this.getEquipmentListData();
  107. // this.getParam();
  108. } else {
  109. uni.reLaunch({
  110. url: '../Login/Login',
  111. });
  112. }
  113. },
  114. methods: {
  115. ...mapActions('chart', ['getParameters', 'humidityParameters', 'getEquipmentListByUser']),
  116. getEquipmentListData() {
  117. this.getEquipmentListByUser(this.globalUser)
  118. .then(data => {
  119. // this.merchantList = data;
  120. var listName = data[0].equipmentList;
  121. var equipmentNameList = [];
  122. for (var i = 0; i < listName.length; i++) {
  123. equipmentNameList.push("名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
  124. listName[i].clientId.length - 6, listName[i].clientId.length));
  125. }
  126. this.equipmentNameList = equipmentNameList;
  127. var listId = data[0].id;
  128. if (listId != null && listId != '1') {
  129. uni.setStorageSync("listName", listName);
  130. }
  131. uni.stopPullDownRefresh();
  132. }, _ => void uni.stopPullDownRefresh());
  133. },
  134. search(){
  135. var clientId = this.searchClientId;
  136. var list = uni.getStorageSync("listName");
  137. var n = 0;
  138. for (var i = 0; i < list.length; i++) {
  139. var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
  140. if(code==clientId){
  141. n++;
  142. this.index = i;
  143. var id = list[i].id;
  144. this.equipmentId = id;
  145. this.cabinetHd = list[i].cabinetHd;
  146. this.equimentType = list[i].equimentType;
  147. this.clientId = list[i].clientId;
  148. this.show = true;
  149. if (this.equimentType == 'MG280') {
  150. this.show = false;
  151. }
  152. // this.getParam();
  153. break;
  154. }
  155. }
  156. if(n==0){
  157. uni.showModal({
  158. title: "提示",
  159. content: "找不到该机器",
  160. success: (res) => {
  161. }
  162. })
  163. }
  164. },
  165. //改变机器
  166. changeEquipment: function(e) {
  167. this.searchClientId = null;
  168. this.index = e.target.value;
  169. var list = uni.getStorageSync("listName");
  170. // this.getProName(list[e.target.value].id);
  171. this.equipmentId = list[e.target.value].id;
  172. this.cabinetHd = list[e.target.value].cabinetHd;
  173. this.equimentType = list[e.target.value].equimentType;
  174. this.clientId = list[e.target.value].clientId;
  175. this.show = true;
  176. if (this.equimentType == 'MG280') {
  177. this.show = false;
  178. }
  179. // console.log("eid==" + this.equipmentId);
  180. // console.log("equimentType==" + this.equimentType);
  181. // this.getParam();
  182. },
  183. update(name, val) {
  184. const param = {};
  185. param['id'] = this.equipmentId;
  186. param['name'] = name;
  187. param['val'] = val;
  188. this.humidityParameters(param).then(res => {
  189. if (res.data == 'SUCCESS') {
  190. uni.showToast({
  191. title: '发送成功success',
  192. duration: 1000
  193. });
  194. }
  195. }, _ => void uni.stopPullDownRefresh());
  196. },
  197. },
  198. }
  199. </script>
  200. <style>
  201. .search{
  202. width: 100%;
  203. padding-top: 10upx;
  204. display: flex;
  205. flex-direction: row;
  206. justify-content: flex-start;
  207. }
  208. .search-title{
  209. width: 28%;
  210. text-align: center;
  211. font-size: 26upx;
  212. font-family: "PingFang-SC-Bold";
  213. }
  214. .search-input{
  215. width: 48%;
  216. height: 25px;
  217. text-align: center;
  218. font-size: 26upx;
  219. /* font-family: "PingFang-SC-Bold"; */
  220. box-shadow: 0upx 0upx 20upx #D3D3D3;
  221. border-radius: 5upx;
  222. }
  223. .search-button{
  224. width: 20%;
  225. padding-left: 10px;
  226. padding-bottom: 5px;
  227. text-align: center;
  228. height: 60upx;
  229. text-align: left;
  230. }
  231. .line {
  232. height: 50upx;
  233. }
  234. .line2 {
  235. height: 10upx;
  236. }
  237. .body {
  238. background-color: #FFFFFF;
  239. width: 700upx;
  240. padding: 10upx 10upx 10upx 10upx;
  241. display: flex;
  242. flex-direction: row;
  243. justify-content: flex-start;
  244. font-size: 32upx;
  245. }
  246. .p {
  247. width: 350upx;
  248. text-align: right;
  249. }
  250. .input {
  251. width: 200upx;
  252. box-shadow: 0upx 0upx 20upx #D3D3D3;
  253. border-radius: 5upx;
  254. text-align: center;
  255. }
  256. .button {
  257. width: 120upx;
  258. height: 60upx;
  259. text-align: left;
  260. border-radius: 10upx;
  261. }
  262. .p2 {
  263. font-size: 30upx;
  264. /* #ifndef H5 */
  265. padding-top: 3upx;
  266. /* #endif */
  267. position: absolute;
  268. /* 水平居中 */
  269. left: 50%;
  270. -webkit-transform: translateX(-50%);
  271. transform: translateX(-50%);
  272. }
  273. </style>