humidityParameters.vue 7.2 KB

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