|
@@ -3,9 +3,9 @@
|
|
<view class="xiugai">
|
|
<view class="xiugai">
|
|
{{$t('equipmentname.title')}}
|
|
{{$t('equipmentname.title')}}
|
|
</view>
|
|
</view>
|
|
- <view v-for="(list,index) in listName" :key="index" class="body">
|
|
|
|
|
|
+ <view v-for="(list,index) in equipmentList" :key="index" class="body">
|
|
<view class="input-two">
|
|
<view class="input-two">
|
|
- <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value=list.name @input="getValue" />
|
|
|
|
|
|
+ <input :id=list.id type="text" class="input" @focus="setStyle()" @blur="setStyle2()" :value="list.name==null? list.clientId:list.name" @input="getValue" />
|
|
<p id="p2" class="p2" :style="{display:showOrNo}">如:粤A张先生1</p>
|
|
<p id="p2" class="p2" :style="{display:showOrNo}">如:粤A张先生1</p>
|
|
</view>
|
|
</view>
|
|
<view class="button2">
|
|
<view class="button2">
|
|
@@ -15,6 +15,10 @@
|
|
</view>
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
|
+ <view v-if="btnShow" class="button-container">
|
|
|
|
+ <button v-if="upBtn" class="left-button" :disabled="isLoading" @click="previousPage">{{$t('equipmentStatusList.previousPage')}}</button>
|
|
|
|
+ <button v-if="nextBtn" class="right-button" :disabled="isLoading" @click="nextPage">{{$t('equipmentStatusList.nextPage')}}</button>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -32,6 +36,7 @@
|
|
name: '',
|
|
name: '',
|
|
show: false,
|
|
show: false,
|
|
listName: [],
|
|
listName: [],
|
|
|
|
+ equipmentList: [],
|
|
value: null,
|
|
value: null,
|
|
id: null,
|
|
id: null,
|
|
parm: {
|
|
parm: {
|
|
@@ -41,7 +46,12 @@
|
|
showOrNo: null,
|
|
showOrNo: null,
|
|
avatarUrl: null,
|
|
avatarUrl: null,
|
|
weixinUp: false,
|
|
weixinUp: false,
|
|
- weixinDown: true
|
|
|
|
|
|
+ weixinDown: true,
|
|
|
|
+ btnShow:false, // 按钮显示
|
|
|
|
+ upBtn:false, // 上一页按钮
|
|
|
|
+ nextBtn:true, // 下一页按钮
|
|
|
|
+ equipmentTotal:0, // 设备总数
|
|
|
|
+ isLoading: false, //是否加载中
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onPullDownRefresh() {
|
|
onPullDownRefresh() {
|
|
@@ -52,25 +62,38 @@
|
|
onShow() {
|
|
onShow() {
|
|
uni.setNavigationBarTitle({title: this.$t('equipmentname.title')});
|
|
uni.setNavigationBarTitle({title: this.$t('equipmentname.title')});
|
|
// uni.startPullDownRefresh();
|
|
// uni.startPullDownRefresh();
|
|
- var me = this;
|
|
|
|
- var name = uni.getStorageSync("name");
|
|
|
|
- me.name = name;
|
|
|
|
- var listName = uni.getStorageSync("listName");
|
|
|
|
- me.listName = listName;
|
|
|
|
- if (listName != '' && listName != null) {
|
|
|
|
- var adminId = listName[0].adminId;
|
|
|
|
- if (adminId != '1' && adminId != null) {
|
|
|
|
- me.show = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- var newparm = uni.getStorageSync("newparm");
|
|
|
|
- if (newparm.toString().length > 1) {
|
|
|
|
- if (newparm.avatarUrl.length > 1) {
|
|
|
|
- this.avatarUrl = newparm.avatarUrl;
|
|
|
|
- this.weixinUp = true;
|
|
|
|
- this.weixinDown = false;
|
|
|
|
- }
|
|
|
|
|
|
+ this.globalUser = uni.getStorageSync("globalUser");
|
|
|
|
+ this.globalUser.offset = 0;
|
|
|
|
+ this.globalUser.limit = 10;
|
|
|
|
+ var token = uni.getStorageSync("token");
|
|
|
|
+ if (token.length > 1) {
|
|
|
|
+ this.getEquipmentListData();
|
|
|
|
+ this.upBtn = false;
|
|
|
|
+ this.nextBtn = true;
|
|
|
|
+ } else {
|
|
|
|
+ uni.reLaunch({
|
|
|
|
+ url: '../Login/Login',
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+ // var me = this;
|
|
|
|
+ // var name = uni.getStorageSync("name");
|
|
|
|
+ // me.name = name;
|
|
|
|
+ // var listName = uni.getStorageSync("listName");
|
|
|
|
+ // me.listName = listName;
|
|
|
|
+ // if (listName != '' && listName != null) {
|
|
|
|
+ // var adminId = listName[0].adminId;
|
|
|
|
+ // if (adminId != '1' && adminId != null) {
|
|
|
|
+ // me.show = true;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // var newparm = uni.getStorageSync("newparm");
|
|
|
|
+ // if (newparm.toString().length > 1) {
|
|
|
|
+ // if (newparm.avatarUrl.length > 1) {
|
|
|
|
+ // this.avatarUrl = newparm.avatarUrl;
|
|
|
|
+ // this.weixinUp = true;
|
|
|
|
+ // this.weixinDown = false;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -92,7 +115,45 @@
|
|
this.parm.name = value;
|
|
this.parm.name = value;
|
|
this.parm.id = id;
|
|
this.parm.id = id;
|
|
},
|
|
},
|
|
- ...mapActions('chart', ['updata']),
|
|
|
|
|
|
+ getEquipmentListData() {
|
|
|
|
+ this.isLoading = true;
|
|
|
|
+ this.getEquipmentListByUser(this.globalUser)
|
|
|
|
+ .then(data => {
|
|
|
|
+ this.equipmentList = data[0].equipmentList;
|
|
|
|
+ this.equipmentTotal = data[0].equipmentTotal;
|
|
|
|
+ if(this.equipmentTotal > this.globalUser.limit) {
|
|
|
|
+ this.btnShow = true;
|
|
|
|
+ }
|
|
|
|
+ console.log(this.equipmentList);
|
|
|
|
+ this.isLoading = false;
|
|
|
|
+ }, _ => void uni.stopPullDownRefresh());
|
|
|
|
+ },
|
|
|
|
+ // 更改按钮显示状态
|
|
|
|
+ changeBtnshow() {
|
|
|
|
+ if(this.globalUser.offset != 0) {
|
|
|
|
+ this.upBtn = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.upBtn = false;
|
|
|
|
+ }
|
|
|
|
+ if(this.globalUser.offset + this.globalUser.limit < this.equipmentTotal) {
|
|
|
|
+ this.nextBtn = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.nextBtn = false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 点击上一页
|
|
|
|
+ previousPage() {
|
|
|
|
+ this.globalUser.offset = this.globalUser.offset - this.globalUser.limit;
|
|
|
|
+ this.getEquipmentListData();
|
|
|
|
+ this.changeBtnshow();
|
|
|
|
+ },
|
|
|
|
+ // 点击下一页
|
|
|
|
+ nextPage() {
|
|
|
|
+ this.globalUser.offset = this.globalUser.offset + this.globalUser.limit;
|
|
|
|
+ this.getEquipmentListData();
|
|
|
|
+ this.changeBtnshow();
|
|
|
|
+ },
|
|
|
|
+ ...mapActions('chart', ['updata', 'getEquipmentListByUser']),
|
|
updata1() {
|
|
updata1() {
|
|
if (this.parm.id != null) {
|
|
if (this.parm.id != null) {
|
|
this.updata(this.parm)
|
|
this.updata(this.parm)
|
|
@@ -248,4 +309,12 @@
|
|
height: 50upx;
|
|
height: 50upx;
|
|
border: 1px;
|
|
border: 1px;
|
|
}
|
|
}
|
|
|
|
+ .button-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .left-button,
|
|
|
|
+ .right-button {
|
|
|
|
+ flex: 1;
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|