123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- <template>
- <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('alarmClock.add')}}</P>
- </button>
- </view>
- </view>
- <!-- //多选下拉框 -->
- <view class="select-item">
- <ld-select :multiple="true" :list="equipmentNameList" label-key="label" value-key="value"
- :placeholder="$t('alarmClock.placeholder')" clearable v-model="equipmentIds" @change="selectChange2"></ld-select>
- </view>
- <view class="search">
- <view class="search-title">
- {{$t('updatePassword.adminPwd')}}:
- </view>
- <view class="search-input2">
- <input type="text" v-model="adminPwd" />
- </view>
- </view>
- <view class="search">
- <view class="search-title">
- {{$t('updatePassword.guestPwd')}}:
- </view>
- <view class="search-input2">
- <input type="text" v-model="guestPwd" />
- </view>
- </view>
- <view class="line"></view>
- <!-- //提交按钮 -->
- <view class="tr">
- <button type="primary" formType="submit" @click="update()" class="button">
- <p class="p1">{{$t('alarmClock.update')}}</p>
- </button>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- import MxDatePicker from "../../components/mx-datepicker/mx-datepicker.vue";
- // import ldSelect from "../../components/ld-select/ld-select.vue";
- import ldSelect from "../../components/ld-select/ld-select.vue"
- import likeButton from "../../components/like-button/like-button.vue";
- export default {
- components: {
- MxDatePicker,
- ldSelect,
- likeButton
- },
- data() {
- return {
- value: '',
- searchClientId: null,
- equipmentName: null,
- equipmentNameList: [],
- globalUser: {},
- equipmentIds: [],
- adminPwd:null,
- guestPwd:null
- }
- },
- onShow() {
- this.globalUser = uni.getStorageSync("globalUser");
- uni.setNavigationBarTitle({
- title: this.$t('remoteList.password')
- });
- var token = uni.getStorageSync("token");
- if (token.length > 1) {
- this.getEquipmentListData();
- } else {
- uni.reLaunch({
- url: '../../../pages/Login/Login',
- });
- }
- },
- onLoad() {
- },
- methods: {
- ...mapActions('chart', ['getEquipmentListByUser', 'addAlarmClock', 'addAlarmClockItem', 'updateAlarmClock']),
- getEquipmentListData() {
- this.getEquipmentListByUser(this.globalUser)
- .then(data => {
- // this.merchantList = data;
- // console.log("1223");
- var listName = data[0].equipmentList;
- var equipmentNameList = this.equipmentNameList;
- var co = {};
- co["value"] = 'all';
- co["label"] = '全部机器ALL machine';
- equipmentNameList.push(co);
- for (var i = 0; i < listName.length; i++) {
- var cov = {};
- cov["value"] = listName[i].id;
- cov["label"] = this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
- listName[i].clientId.length - 6, listName[i].clientId.length);
- equipmentNameList.push(cov);
- }
- this.equipmentNameList = equipmentNameList;
- var listId = data[0].id;
- if (listId != null && listId != '1') {
- uni.setStorageSync("listName", listName);
- }
- uni.stopPullDownRefresh();
- }, _ => void uni.stopPullDownRefresh());
- },
- onSelected(e) { //选择
- this.showPicker = false;
- if (e) {
- this[this.type] = e.value;
- //选择的值
- // console.log('value => ' + e.value);
- //原始的Date对象
- // console.log('date => ' + e.date);
- }
- },
- // bindPickerChange: function(e) {
- // this.indexType = e.target.value
- // },
- addEids(equipmentIds) {
- // console.log('equipmentIds' + equipmentIds);
- var eids = equipmentIds.split(",");
- var idss = this.equipmentIds;
- var is = this.equipmentNameList
- for (var k = 0; k < eids.length; k++) {
- var id = eids[k];
- if (id != "" && id != '') {
- this.equipmentIds.push(parseInt(id));
- }
- }
- },
- search() {
- // console.log("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++;
- var id = list[i].id;
- this.equipmentIds.push(id);
- break;
- }
- }
- if (n == 0) {
- uni.showModal({
- title: "提示",
- content: "找不到该机器",
- success: (res) => {
- }
- })
- }
- if (n > 0) {
- uni.showModal({
- title: "提示",
- content: "已添加该机器",
- success: (res) => {
- }
- })
- }
- },
- selectChange2(val) {
- //有改动文件 import likeButton from "../../components/like-button/like-button.vue";
- if (val == "all") {
- this.equipmentIds = [];
- var list = uni.getStorageSync("listName");
- for (var i = 0; i < list.length; i++) {
- this.equipmentIds.push(list[i].id);
- }
- } else {
- this.equipmentIds = val
- }
- // console.log('this.equipmentIds => ' + this.equipmentIds);
- },
- switchChange: function(e) {
- this.status = e.target.value;
- },
- update() {
- var that = this;
- uni.showModal({
- title: that.$t('equipmentStatusList.tip'),
- content:that.$t('updatePassword.sure') ,
- success: (re) => {
- if (re.confirm) {
- var serverurl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverurl + '/TEquipment/updatePassword?equipmentIds='+that.equipmentIds+'&guestPwd='+that.guestPwd+'&adminPwd='+that.adminPwd,
- // data: {
- // "equipmentIds": that.equipmentIds,
- // "guestPwd": that.guestPwd,
- // "adminPwd": that.adminPwd,
- // },
- method: "POST",
- header: {
- 'token': token
- },
- success: (res) => {
- if(res.data.code){
- uni.showToast({
- title: res.data.message,
- duration: 1000
- });
- }
- }
- });
- }
- }
- })
- },
- }
- }
- </script>
- <style>
- .test {
- text-align: center;
- padding: 10px 0;
- }
- .time {
- font-size: 78upx;
- }
- .btime {
- margin: 20upx;
- font-size: 28upx;
- }
- /* button {
- margin: 20upx;
- font-size: 28upx;
- } */
- /* #ifdef MP-ALIPAY */
- .uni-badge {
- margin-left: 20rpx;
- }
- /* #endif */
- .uni-badge {
- font-size: 40upx;
- }
- .example-body {
- flex-direction: row;
- justify-content: flex-start;
- padding-bottom: 15upx;
- font-size: 40upx;
- }
- .uni-badge-left-margin {
- font-size: 40upx;
- margin-left: 50upx;
- }
- .uni-list-cell {
- padding-top: 20upx;
- padding-bottom: 10upx;
- font-size: 35upx;
- }
- .line {
- height: 2upx;
- background: #8C959F;
- }
- .search {
- width: 100%;
- padding-top: 15upx;
- 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;
- }
- .search-input2 {
- width: 65%;
- text-align: center;
- font-size: 26upx;
- font-family: "PingFang-SC-Bold";
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .select-item {
- /* padding-top: 20upx; */
- }
- .tr {
- padding-top: 15upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- font-size: 48upx;
- font-family: "PingFang-SC-Bold";
- position: fixed;
- bottom: 100upx;
- width: 100%;
- }
- .button {
- margin: auto;
- width: 60%;
- height: 100upx;
- }
- .p1 {
- font-size: 48upx;
- }
- </style>
|