123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- <template>
- <view class="">
- <!-- <view class="line">
- </view> -->
- <view class="search">
- <view class="search-title">
- {{$t('dosugar.equipmentClientID')}}
- </view>
- <view class="search-input">
- <input type="text" :placeholder="$t('dosugar.placeholder')" v-model="searchClientId" />
- </view>
- <view class="search-button">
- <button type="primary" size="mini" class="" @click="search()">
- <p class="">{{$t('dosugar.search')}}</P>
- </button>
- </view>
- </view>
- <view class="td-right">
- <view class="uni-list">
- <view class="uni-list-cell">
- <view class="uni-list-cell-left">
- {{$t('dosugar.chooseEquipment')}}
- </view>
- <view class="uni-list-cell-db" style="overflow: hidden;text-overflow: ellipsis;">
- <picker @change="changeEquipment" :value="index" :range="equipmentNameList">
- <view class="uni-input">{{equipmentNameList[index]}}</view>
- </picker>
- </view>
- </view>
- </view>
- </view>
- <view v-show="show">
- <view class="body">
- <p class="p">{{$t('advancedParameters.Xzerocompensation')}}:</p>
- <input class="input" type="text" v-model="D436" />
- <button type="primary" class="button" @click="update('D436',D436)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.Yzerocompensation')}}:</p>
- <input class="input" type="text" v-model="D438" />
- <button type="primary" class="button" @click="update('D438',D438)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.Zzerocompensation')}}:</p>
- <input class="input" type="text" v-model="D440" />
- <button type="primary" class="button" @click="update('D440',D440)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.sugarPositionX')}}:</p>
- <input class="input" type="text" v-model="D218" />
- <button type="primary" class="button" @click="update('D218',D218)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.sugarPositionY')}}:</p>
- <input class="input" type="text" v-model="D268" />
- <button type="primary" class="button" @click="update('D268',D268)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.sugarPositionZ')}}:</p>
- <input class="input" type="text" v-model="D318" />
- <button type="primary" class="button" @click="update('D318',D318)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <!-- //301特有 -->
- <view class="" v-show="equimentType=='MG301'">
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionX')}}:</p>
- <input class="input" type="text" v-model="D226" />
- <button type="primary" class="button" @click="update('D226',D226)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionY')}}:</p>
- <input class="input" type="text" v-model="D276" />
- <button type="primary" class="button" @click="update('D276',D276)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionZ')}}:</p>
- <input class="input" type="text" v-model="D326" />
- <button type="primary" class="button" @click="update('D326',D326)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- </view>
- <!-- //320特有 -->
- <view class="" v-show="equimentType=='MG320'">
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionX')}}:</p>
- <input class="input" type="text" v-model="D228" />
- <button type="primary" class="button" @click="update('D228',D228)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionY')}}:</p>
- <input class="input" type="text" v-model="D278" />
- <button type="primary" class="button" @click="update('D278',D278)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.stickPositionZ')}}:</p>
- <input class="input" type="text" v-model="D328" />
- <button type="primary" class="button" @click="update('D328',D328)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.materialShortageMonitor')}}</p>
- <button type="primary" class="button" @click="update('M502','0')">
- <p class="p2">{{$t('advancedParameters.on')}}</P>
- </button>
- <button type="primary" class="button" @click="update('M502','1')">
- <p class="p2">{{$t('advancedParameters.off')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('advancedParameters.outerLoopButton')}}</p>
- <button type="primary" class="button" @click="update('M506','0')">
- <p class="p2">{{$t('advancedParameters.on')}}</P>
- </button>
- <button type="primary" class="button" @click="update('M506','1')">
- <p class="p2">{{$t('advancedParameters.off')}}</P>
- </button>
- </view>
- </view>
- </view>
- <view class="line2"></view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex';
- import {
- dateUtils
- } from '@/common/util.js';
- export default {
- data() {
- return {
- D436: 0,
- D438: 0,
- D440: 0,
- D218: 0,
- D268: 0,
- D318: 0,
- D226: 0,
- D276: 0,
- D326: 0,
- D228: 0,
- D278: 0,
- D328: 0,
- M502: 0,
- M506: 0,
- index: null,
- equipmentName: null,
- equimentType: null,
- equipmentId:null,
- equipmentNameList: [],
- globalUser: null,
- show: true,
- searchClientId:null
- }
- },
- onShow() {
- var token = uni.getStorageSync("token");
- this.globalUser = uni.getStorageSync("globalUser");
- this.globalUser.todayDate = dateUtils.getCurrentDate();
- uni.setNavigationBarTitle({
- title: this.$t('parameters.advanced')
- });
- if (token.length > 1) {
- this.getEquipmentListData();
- // this.getParam();
- } else {
- uni.reLaunch({
- url: '../Login/Login',
- });
- }
- },
- methods: {
- ...mapActions('chart', ['getParameters', 'updateParameters', 'getEquipmentListByUser']),
- getEquipmentListData() {
- this.getEquipmentListByUser(this.globalUser)
- .then(data => {
- // this.merchantList = data;
- var listName = data[0].equipmentList;
- var equipmentNameList = [];
- for (var i = 0; i < listName.length; i++) {
- equipmentNameList.push(this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
- listName[i].clientId.length - 6, listName[i].clientId.length));
- }
- this.equipmentNameList = equipmentNameList;
- var listId = data[0].id;
- if (listId != null && listId != '1') {
- uni.setStorageSync("listName", listName);
- }
- uni.stopPullDownRefresh();
- }, _ => void uni.stopPullDownRefresh());
- },
- search(){
- var clientId = this.searchClientId;
- var list = uni.getStorageSync("listName");
- console.log(clientId);
- var n = 0;
- for (var i = 0; i < list.length; i++) {
- var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
- if(code==clientId){
- n++;
- this.D436 = null;
- this.D438 = null;
- this.D440 = null;
- this.D218 = null;
- this.D268 = null;
- this.D318 = null;
- this.D226 = null;
- this.D276 = null;
- this.D326 = null;
- this.D228 = null;
- this.D278 = null;
- this.D328 = null;
- this.M502 = null;
- this.M506 = null;
- this.index = i;
- var id = list[i].id;
- this.equipmentId = id;
- this.equimentType = list[i].equimentType;
- this.clientId = list[i].clientId;
- this.show = true;
- if (this.equimentType == 'MG280') {
- this.show = false;
- }
- this.getParam();
- break;
- }
- }
- if(n==0){
- uni.showModal({
- title: this.$t('common.tip'),
- content: this.$t('common.noDevice'),
- success: (res) => {
-
- }
- })
- }
- },
- //改变机器
- changeEquipment: function(e) {
- this.D436 = null;
- this.D438 = null;
- this.D440 = null;
- this.D218 = null;
- this.D268 = null;
- this.D318 = null;
- this.D226 = null;
- this.D276 = null;
- this.D326 = null;
- this.D228 = null;
- this.D278 = null;
- this.D328 = null;
- this.M502 = null;
- this.M506 = null;
- this.searchClientId = null;
- this.index = e.target.value;
- var list = uni.getStorageSync("listName");
- this.equipmentId = list[e.target.value].id;
- this.equimentType = list[e.target.value].equimentType;
- this.clientId = list[e.target.value].clientId;
- this.show = true;
- if (this.equimentType == 'MG280') {
- this.show = false;
- }
- this.getParam();
- },
- getParam() {
- const param = {};
- param['id'] = this.equipmentId;
- // 0:通用参数; 1:进阶参数
- param['status'] = '1';
- param['clientId'] = this.clientId;
- this.getParameters(param).then(res => {
- var code = res.code;
- if(code==false){
- uni.showToast({
- title: this.$t('common.noData'),
- duration: 2000
- });
- return;
- }
- var info = res.data;
- if (info != null || info != '') {
- for (var i = 0; i < info.length; i++) {
- if (info[i].name == 'D436') {
- this.D436 = info[i].val;
- }
- if (info[i].name == 'D438') {
- this.D438 = info[i].val;
- }
- if (info[i].name == 'D440') {
- this.D440 = info[i].val;
- }
- if (info[i].name == 'D218') {
- this.D218 = info[i].val;
- }
- if (info[i].name == 'D268') {
- this.D268 = info[i].val;
- }
- if (info[i].name == 'D318') {
- this.D318 = info[i].val;
- }
- if (info[i].name == 'D226') {
- this.D226 = info[i].val;
- }
- if (info[i].name == 'D276') {
- this.D276 = info[i].val;
- }
- if (info[i].name == 'D326') {
- this.D326 = info[i].val;
- }
- if (info[i].name == 'D228') {
- this.D228 = info[i].val;
- }
- if (info[i].name == 'D278') {
- this.D278 = info[i].val;
- }
- if (info[i].name == 'D328') {
- this.D328 = info[i].val;
- }
- }
- }
- }, _ => void uni.stopPullDownRefresh());
- },
- update(name, val) {
- const param = {};
- param['id'] = this.equipmentId;
- param['name'] = name;
- param['val'] = val;
- this.updateParameters(param).then(res => {
- if (res.data == 'SUCCESS') {
- uni.showToast({
- title: this.$t('common.success'),
- duration: 1000
- });
- }
- }, _ => void uni.stopPullDownRefresh());
- },
- },
- }
- </script>
- <style>
- .search{
- width: 100%;
- padding-top: 10upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .search-title{
- width: 28%;
- text-align: center;
- font-size: 26upx;
- font-family: "PingFang-SC-Bold";
- }
- .search-input{
- width: 48%;
- height: 25px;
- text-align: center;
- font-size: 26upx;
- /* font-family: "PingFang-SC-Bold"; */
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .search-button{
- width: 20%;
- padding-left: 10px;
- padding-bottom: 5px;
- text-align: center;
- height: 60upx;
- text-align: left;
- }
- .line {
- height: 50upx;
- }
- .line2 {
- height: 10upx;
- }
- .body {
- background-color: #FFFFFF;
- width: 95%;
- padding: 10upx 10upx 10upx 10upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- font-size: 32upx;
- }
- .p {
- width: 60%;
- text-align: right;
- }
- .input {
- width: 20%;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- padding-top: 5px;
- text-align: center;
- }
- .button {
- width: 17%;
- height: 60upx;
- text-align: left;
- /* border-radius: 10upx; */
- }
- .p2 {
- font-size: 30upx;
- /* #ifndef H5 */
- padding-top: 3upx;
- /* #endif */
- position: absolute;
- /* 水平居中 */
- left: 50%;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- </style>
|