123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <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" 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 >
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('parameters.cabinetHd')}}:</p>
- <input class="input" type="text" v-model="cabinetHd" />
- </view>
- <!-- 320和330特有 -->
- <view class="" v-show="equimentType=='MG330'||equimentType=='MG320'">
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('parameters.allUpdate')}}:</p>
- <input class="input" type="text" v-model="allUpdate" />
- <button type="primary" class="button" @click="update('allUpdate',allUpdate)">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- </view>
- <!-- //320特有 -->
- <view class="" v-show="equimentType=='MG320'">
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('parameters.winter')}}:</p>
- <button type="primary" class="button" @click="update('winter','winter')">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- <view class="body">
- <p class="p">{{$t('parameters.summer')}}:</p>
- <button type="primary" class="button" @click="update('summer','summer')">
- <p class="p2">{{$t('parameters.update')}}</P>
- </button>
- </view>
- <view class="line2"></view>
- </view>
- <!-- 301和280特有 -->
- <view class="" v-show="equimentType=='MG301'||equimentType=='MG280'">
- </view>
- <!-- 280特有 -->
- <view class="" v-show="equimentType=='MG280'">
-
- </view>
- </view>
- <view class="line2"></view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- export default {
- data() {
- return {
- index: null,
- allUpdate:null,
- equipmentName: null,
- equimentType: null,
- equipmentId:null,
- cabinetHd:'',
- equipmentNameList: [],
- globalUser: null,
- show: true,
- searchClientId:null
- }
- },
- onShow() {
- var token = uni.getStorageSync("token");
- this.globalUser = uni.getStorageSync("globalUser");
- if (token.length > 1) {
- this.getEquipmentListData();
- // this.getParam();
- } else {
- uni.reLaunch({
- url: '../Login/Login',
- });
- }
- },
- methods: {
- ...mapActions('chart', ['getParameters', 'humidityParameters', '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("名称:" + listName[i].name + " 编号:" + 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");
- 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.index = i;
- var id = list[i].id;
- this.equipmentId = id;
- this.cabinetHd = list[i].cabinetHd;
- 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: "提示",
- content: "找不到该机器",
- success: (res) => {
-
- }
- })
- }
- },
- //改变机器
- changeEquipment: function(e) {
- this.searchClientId = null;
- this.index = e.target.value;
- var list = uni.getStorageSync("listName");
- // this.getProName(list[e.target.value].id);
- this.equipmentId = list[e.target.value].id;
- this.cabinetHd = list[e.target.value].cabinetHd;
- this.equimentType = list[e.target.value].equimentType;
- this.clientId = list[e.target.value].clientId;
- this.show = true;
- if (this.equimentType == 'MG280') {
- this.show = false;
- }
- // console.log("eid==" + this.equipmentId);
- // console.log("equimentType==" + this.equimentType);
- // this.getParam();
- },
- update(name, val) {
- const param = {};
- param['id'] = this.equipmentId;
- param['name'] = name;
- param['val'] = val;
- this.humidityParameters(param).then(res => {
- if (res.data == 'SUCCESS') {
- uni.showToast({
- title: '发送成功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: 45%;
- 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: 7upx;
- text-align: center;
- }
- .line {
- height: 50upx;
- }
- .line2 {
- height: 10upx;
- }
- .body {
- background-color: #FFFFFF;
- width: 700upx;
- padding: 10upx 10upx 10upx 10upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- font-size: 32upx;
- }
- .p {
- width: 350upx;
- text-align: right;
- }
- .input {
- width: 200upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- text-align: center;
- }
- .button {
- width: 120upx;
- 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>
|