advancedParameters.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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 v-show="show">
  33. <view class="body">
  34. <p class="p">{{$t('advancedParameters.Xzerocompensation')}}:</p>
  35. <input class="input" type="text" v-model="D436" />
  36. <button type="primary" class="button" @click="update('D436',D436)">
  37. <p class="p2">{{$t('parameters.update')}}</P>
  38. </button>
  39. </view>
  40. <view class="line2"></view>
  41. <view class="body">
  42. <p class="p">{{$t('advancedParameters.Yzerocompensation')}}:</p>
  43. <input class="input" type="text" v-model="D438" />
  44. <button type="primary" class="button" @click="update('D438',D438)">
  45. <p class="p2">{{$t('parameters.update')}}</P>
  46. </button>
  47. </view>
  48. <view class="line2"></view>
  49. <view class="body">
  50. <p class="p">{{$t('advancedParameters.Zzerocompensation')}}:</p>
  51. <input class="input" type="text" v-model="D440" />
  52. <button type="primary" class="button" @click="update('D440',D440)">
  53. <p class="p2">{{$t('parameters.update')}}</P>
  54. </button>
  55. </view>
  56. <view class="line2"></view>
  57. <view class="body">
  58. <p class="p">{{$t('advancedParameters.sugarPositionX')}}:</p>
  59. <input class="input" type="text" v-model="D218" />
  60. <button type="primary" class="button" @click="update('D218',D218)">
  61. <p class="p2">{{$t('parameters.update')}}</P>
  62. </button>
  63. </view>
  64. <view class="line2"></view>
  65. <view class="body">
  66. <p class="p">{{$t('advancedParameters.sugarPositionY')}}:</p>
  67. <input class="input" type="text" v-model="D268" />
  68. <button type="primary" class="button" @click="update('D268',D268)">
  69. <p class="p2">{{$t('parameters.update')}}</P>
  70. </button>
  71. </view>
  72. <view class="line2"></view>
  73. <view class="body">
  74. <p class="p">{{$t('advancedParameters.sugarPositionZ')}}:</p>
  75. <input class="input" type="text" v-model="D318" />
  76. <button type="primary" class="button" @click="update('D318',D318)">
  77. <p class="p2">{{$t('parameters.update')}}</P>
  78. </button>
  79. </view>
  80. <!-- //301特有 -->
  81. <view class="" v-show="equimentType=='MG301'">
  82. <view class="line2"></view>
  83. <view class="body">
  84. <p class="p">{{$t('advancedParameters.stickPositionX')}}:</p>
  85. <input class="input" type="text" v-model="D226" />
  86. <button type="primary" class="button" @click="update('D226',D226)">
  87. <p class="p2">{{$t('parameters.update')}}</P>
  88. </button>
  89. </view>
  90. <view class="line2"></view>
  91. <view class="body">
  92. <p class="p">{{$t('advancedParameters.stickPositionY')}}:</p>
  93. <input class="input" type="text" v-model="D276" />
  94. <button type="primary" class="button" @click="update('D276',D276)">
  95. <p class="p2">{{$t('parameters.update')}}</P>
  96. </button>
  97. </view>
  98. <view class="line2"></view>
  99. <view class="body">
  100. <p class="p">{{$t('advancedParameters.stickPositionZ')}}:</p>
  101. <input class="input" type="text" v-model="D326" />
  102. <button type="primary" class="button" @click="update('D326',D326)">
  103. <p class="p2">{{$t('parameters.update')}}</P>
  104. </button>
  105. </view>
  106. </view>
  107. <!-- //320特有 -->
  108. <view class="" v-show="equimentType=='MG320'">
  109. <view class="line2"></view>
  110. <view class="body">
  111. <p class="p">{{$t('advancedParameters.stickPositionX')}}:</p>
  112. <input class="input" type="text" v-model="D228" />
  113. <button type="primary" class="button" @click="update('D228',D228)">
  114. <p class="p2">{{$t('parameters.update')}}</P>
  115. </button>
  116. </view>
  117. <view class="line2"></view>
  118. <view class="body">
  119. <p class="p">{{$t('advancedParameters.stickPositionY')}}:</p>
  120. <input class="input" type="text" v-model="D278" />
  121. <button type="primary" class="button" @click="update('D278',D278)">
  122. <p class="p2">{{$t('parameters.update')}}</P>
  123. </button>
  124. </view>
  125. <view class="line2"></view>
  126. <view class="body">
  127. <p class="p">{{$t('advancedParameters.stickPositionZ')}}:</p>
  128. <input class="input" type="text" v-model="D328" />
  129. <button type="primary" class="button" @click="update('D328',D328)">
  130. <p class="p2">{{$t('parameters.update')}}</P>
  131. </button>
  132. </view>
  133. <view class="line2"></view>
  134. <view class="body">
  135. <p class="p">{{$t('advancedParameters.materialShortageMonitor')}}</p>
  136. <button type="primary" class="button" @click="update('M502','0')">
  137. <p class="p2">{{$t('advancedParameters.on')}}</P>
  138. </button>
  139. <button type="primary" class="button" @click="update('M502','1')">
  140. <p class="p2">{{$t('advancedParameters.off')}}</P>
  141. </button>
  142. </view>
  143. <view class="line2"></view>
  144. <view class="body">
  145. <p class="p">{{$t('advancedParameters.outerLoopButton')}}</p>
  146. <button type="primary" class="button" @click="update('M506','0')">
  147. <p class="p2">{{$t('advancedParameters.on')}}</P>
  148. </button>
  149. <button type="primary" class="button" @click="update('M506','1')">
  150. <p class="p2">{{$t('advancedParameters.off')}}</P>
  151. </button>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="line2"></view>
  156. </view>
  157. </template>
  158. <script>
  159. import {
  160. mapState,
  161. mapActions,
  162. mapMutations
  163. } from 'vuex';
  164. import {
  165. dateUtils
  166. } from '@/common/util.js';
  167. export default {
  168. data() {
  169. return {
  170. D436: 0,
  171. D438: 0,
  172. D440: 0,
  173. D218: 0,
  174. D268: 0,
  175. D318: 0,
  176. D226: 0,
  177. D276: 0,
  178. D326: 0,
  179. D228: 0,
  180. D278: 0,
  181. D328: 0,
  182. M502: 0,
  183. M506: 0,
  184. index: null,
  185. equipmentName: null,
  186. equimentType: null,
  187. equipmentId:null,
  188. equipmentNameList: [],
  189. globalUser: null,
  190. show: true,
  191. searchClientId:null
  192. }
  193. },
  194. onShow() {
  195. var token = uni.getStorageSync("token");
  196. this.globalUser = uni.getStorageSync("globalUser");
  197. this.globalUser.todayDate = dateUtils.getCurrentDate();
  198. uni.setNavigationBarTitle({
  199. title: this.$t('parameters.advanced')
  200. });
  201. if (token.length > 1) {
  202. this.getEquipmentListData();
  203. // this.getParam();
  204. } else {
  205. uni.reLaunch({
  206. url: '../Login/Login',
  207. });
  208. }
  209. },
  210. methods: {
  211. ...mapActions('chart', ['getParameters', 'updateParameters', 'getEquipmentListByUser']),
  212. getEquipmentListData() {
  213. this.getEquipmentListByUser(this.globalUser)
  214. .then(data => {
  215. // this.merchantList = data;
  216. var listName = data[0].equipmentList;
  217. var equipmentNameList = [];
  218. for (var i = 0; i < listName.length; i++) {
  219. equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
  220. listName[i].clientId.length - 6, listName[i].clientId.length));
  221. }
  222. this.equipmentNameList = equipmentNameList;
  223. var listId = data[0].id;
  224. if (listId != null && listId != '1') {
  225. uni.setStorageSync("listName", listName);
  226. }
  227. uni.stopPullDownRefresh();
  228. }, _ => void uni.stopPullDownRefresh());
  229. },
  230. search(){
  231. var clientId = this.searchClientId;
  232. var list = uni.getStorageSync("listName");
  233. console.log(clientId);
  234. var n = 0;
  235. for (var i = 0; i < list.length; i++) {
  236. var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
  237. if(code==clientId){
  238. n++;
  239. this.D436 = null;
  240. this.D438 = null;
  241. this.D440 = null;
  242. this.D218 = null;
  243. this.D268 = null;
  244. this.D318 = null;
  245. this.D226 = null;
  246. this.D276 = null;
  247. this.D326 = null;
  248. this.D228 = null;
  249. this.D278 = null;
  250. this.D328 = null;
  251. this.M502 = null;
  252. this.M506 = null;
  253. this.index = i;
  254. var id = list[i].id;
  255. this.equipmentId = id;
  256. this.equimentType = list[i].equimentType;
  257. this.clientId = list[i].clientId;
  258. this.show = true;
  259. if (this.equimentType == 'MG280') {
  260. this.show = false;
  261. }
  262. this.getParam();
  263. break;
  264. }
  265. }
  266. if(n==0){
  267. uni.showModal({
  268. title: this.$t('common.tip'),
  269. content: this.$t('common.noDevice'),
  270. success: (res) => {
  271. }
  272. })
  273. }
  274. },
  275. //改变机器
  276. changeEquipment: function(e) {
  277. this.D436 = null;
  278. this.D438 = null;
  279. this.D440 = null;
  280. this.D218 = null;
  281. this.D268 = null;
  282. this.D318 = null;
  283. this.D226 = null;
  284. this.D276 = null;
  285. this.D326 = null;
  286. this.D228 = null;
  287. this.D278 = null;
  288. this.D328 = null;
  289. this.M502 = null;
  290. this.M506 = null;
  291. this.searchClientId = null;
  292. this.index = e.target.value;
  293. var list = uni.getStorageSync("listName");
  294. this.equipmentId = list[e.target.value].id;
  295. this.equimentType = list[e.target.value].equimentType;
  296. this.clientId = list[e.target.value].clientId;
  297. this.show = true;
  298. if (this.equimentType == 'MG280') {
  299. this.show = false;
  300. }
  301. this.getParam();
  302. },
  303. getParam() {
  304. const param = {};
  305. param['id'] = this.equipmentId;
  306. // 0:通用参数; 1:进阶参数
  307. param['status'] = '1';
  308. param['clientId'] = this.clientId;
  309. this.getParameters(param).then(res => {
  310. var code = res.code;
  311. if(code==false){
  312. uni.showToast({
  313. title: this.$t('common.noData'),
  314. duration: 2000
  315. });
  316. return;
  317. }
  318. var info = res.data;
  319. if (info != null || info != '') {
  320. for (var i = 0; i < info.length; i++) {
  321. if (info[i].name == 'D436') {
  322. this.D436 = info[i].val;
  323. }
  324. if (info[i].name == 'D438') {
  325. this.D438 = info[i].val;
  326. }
  327. if (info[i].name == 'D440') {
  328. this.D440 = info[i].val;
  329. }
  330. if (info[i].name == 'D218') {
  331. this.D218 = info[i].val;
  332. }
  333. if (info[i].name == 'D268') {
  334. this.D268 = info[i].val;
  335. }
  336. if (info[i].name == 'D318') {
  337. this.D318 = info[i].val;
  338. }
  339. if (info[i].name == 'D226') {
  340. this.D226 = info[i].val;
  341. }
  342. if (info[i].name == 'D276') {
  343. this.D276 = info[i].val;
  344. }
  345. if (info[i].name == 'D326') {
  346. this.D326 = info[i].val;
  347. }
  348. if (info[i].name == 'D228') {
  349. this.D228 = info[i].val;
  350. }
  351. if (info[i].name == 'D278') {
  352. this.D278 = info[i].val;
  353. }
  354. if (info[i].name == 'D328') {
  355. this.D328 = info[i].val;
  356. }
  357. }
  358. }
  359. }, _ => void uni.stopPullDownRefresh());
  360. },
  361. update(name, val) {
  362. const param = {};
  363. param['id'] = this.equipmentId;
  364. param['name'] = name;
  365. param['val'] = val;
  366. this.updateParameters(param).then(res => {
  367. if (res.data == 'SUCCESS') {
  368. uni.showToast({
  369. title: this.$t('common.success'),
  370. duration: 1000
  371. });
  372. }
  373. }, _ => void uni.stopPullDownRefresh());
  374. },
  375. },
  376. }
  377. </script>
  378. <style>
  379. .search{
  380. width: 100%;
  381. padding-top: 10upx;
  382. display: flex;
  383. flex-direction: row;
  384. justify-content: flex-start;
  385. }
  386. .search-title{
  387. width: 28%;
  388. text-align: center;
  389. font-size: 26upx;
  390. font-family: "PingFang-SC-Bold";
  391. }
  392. .search-input{
  393. width: 48%;
  394. height: 25px;
  395. text-align: center;
  396. font-size: 26upx;
  397. /* font-family: "PingFang-SC-Bold"; */
  398. box-shadow: 0upx 0upx 20upx #D3D3D3;
  399. border-radius: 5upx;
  400. }
  401. .search-button{
  402. width: 20%;
  403. padding-left: 10px;
  404. padding-bottom: 5px;
  405. text-align: center;
  406. height: 60upx;
  407. text-align: left;
  408. }
  409. .line {
  410. height: 50upx;
  411. }
  412. .line2 {
  413. height: 10upx;
  414. }
  415. .body {
  416. background-color: #FFFFFF;
  417. width: 95%;
  418. padding: 10upx 10upx 10upx 10upx;
  419. display: flex;
  420. flex-direction: row;
  421. justify-content: flex-start;
  422. font-size: 32upx;
  423. }
  424. .p {
  425. width: 60%;
  426. text-align: right;
  427. }
  428. .input {
  429. width: 20%;
  430. box-shadow: 0upx 0upx 20upx #D3D3D3;
  431. border-radius: 5upx;
  432. padding-top: 5px;
  433. text-align: center;
  434. }
  435. .button {
  436. width: 17%;
  437. height: 60upx;
  438. text-align: left;
  439. /* border-radius: 10upx; */
  440. }
  441. .p2 {
  442. font-size: 30upx;
  443. /* #ifndef H5 */
  444. padding-top: 3upx;
  445. /* #endif */
  446. position: absolute;
  447. /* 水平居中 */
  448. left: 50%;
  449. -webkit-transform: translateX(-50%);
  450. transform: translateX(-50%);
  451. }
  452. </style>