advancedParameters.vue 12 KB

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