<template>
|
<view class="container">
|
<cu-custom :bgColor="NavBarColor">
|
<block slot="content">设备</block>
|
</cu-custom>
|
<view class="container">
|
|
<uni-search-bar @confirm="search" :focus="true" v-model="searchValue" placeholder="请通过名称检索"
|
@input="input" @cancel="cancel()" cancelButton="always">
|
</uni-search-bar>
|
<mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="top" @down="downCallback" @up="upCallback">
|
<!-- 列表信息开始 -->
|
<view class="content">
|
<uni-card margin="10px" spacing="1px" v-for="(item,index) in msgList" :key="index"
|
@click="onClickProductionTask(item)">
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">设备编号:</view>
|
<view
|
class="flex-sub bg-white padding-xs margin-xs text-bold text-blue radius text-right">
|
{{item.equipmentCode}}
|
</view>
|
</view>
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">设备名称:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs radius text-right">
|
{{item.equipmentName}}
|
</view>
|
</view>
|
<view class="flex">
|
<view class="flex-sub text-light bg-white padding-xs margin-xs radius">维修状态:</view>
|
<view class="flex-sub bg-white padding-xs margin-xs text-orange radius text-right">
|
{{item.assetStatus_dictText}}
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
|
</mescroll-uni>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
export default {
|
mixins: [MescrollMixin], // 使用mixin
|
data() {
|
return {
|
|
scrollLeft: 0,
|
searchValue: '',
|
formData: {
|
num: '',
|
partNumNameModel: ''
|
},
|
NavBarColor: this.NavBarColor,
|
url: {
|
|
stallList: "/eam/equipment/list"
|
},
|
|
upOption: {
|
page: {
|
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
size: 10 // 每页数据的数量
|
},
|
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
empty: {
|
tip: '~ 暂无数据 ~', // 提示
|
},
|
loading: '',
|
text: '全部',
|
isShowNoMore: false,
|
textNoMore: '我是有底线的 >_<'
|
},
|
styles: {
|
color: '#2979FF',
|
borderColor: '#2979FF'
|
},
|
msgList: [], //列表数据
|
announcement1: [],
|
msg1Count: 0,
|
msg2Count: 0,
|
msg1Title: "",
|
name: ''
|
}
|
},
|
computed: {
|
top() {
|
return this.CustomBar * 2 + 100
|
},
|
style() {
|
var StatusBar = this.StatusBar;
|
var CustomBar = this.CustomBar;
|
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
|
return style
|
},
|
},
|
|
|
onShow() {
|
if (this.mescroll) {
|
this.mescroll.resetUpScroll()
|
}
|
},
|
onBackPress() {
|
// #ifdef APP-PLUS
|
plus.key.hideSoftKeybord();
|
// #endif
|
},
|
created() {},
|
methods: {
|
|
cancel() {
|
|
this.mescroll.resetUpScroll()
|
},
|
search(res) {
|
this.name = res
|
this.getSera()
|
},
|
/**
|
* @param {Object} item
|
* 详情页面
|
*/
|
|
onClickProductionTask(item) {
|
uni.navigateTo({
|
url: '/pages/device/deviceDeils/deviceDeils?item=' + encodeURIComponent(JSON.stringify(item))
|
})
|
},
|
upCallback(page) {
|
this.$http.get(this.url.stallList, {
|
params: {
|
pageNo: page.num,
|
pageSize: page.size,
|
order: 'asc',
|
column: 'createTime',
|
|
},
|
|
}).then(res => {
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
})
|
},
|
|
|
|
/* 检索 */
|
getSera(res) {
|
this.msgList = [];
|
|
this.$http.get(this.url.stallList, {
|
params: {
|
pageNo: 1,
|
pageSize: 999,
|
order: "desc",
|
column: "createTime",
|
equipmentCode: this.name.value
|
}
|
}).then(res => {
|
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
})
|
|
},
|
|
mescrollInit(mescroll) {
|
console.log('mescrollInit')
|
this.mescroll = mescroll;
|
},
|
},
|
|
}
|
</script>
|
|
<style>
|
.is-hover {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: #55aaff;
|
border-color: #55aaff;
|
}
|
|
|
|
.content {
|
margin-top: 5px;
|
}
|
|
.content scroll-view {
|
scrollIndicator: "none"
|
}
|
|
.popupView {
|
margin-top: 85px;
|
height: auto;
|
}
|
</style>
|