设备接口列表对接
This commit is contained in:
@@ -32,17 +32,32 @@
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card :title="item.name" :sub-title="item.project" :extra="item.type" padding="0"
|
||||
<uni-card :title="item.equipmentName" :sub-title="item.projectName" :extra="item.projectType" padding="0"
|
||||
v-for="(item, index) in deviceListFilter" :key="index" @click="jump(item)" thumbnail="/static/device.png">
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
<Cn-empty v-if="store.empty || deviceListFilter.length == 0"></Cn-empty>
|
||||
<uni-load-more v-if="deviceListFilter && deviceListFilter.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
props: {
|
||||
store: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
projectList: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
projectType: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
select: {
|
||||
@@ -51,101 +66,29 @@ export default {
|
||||
projectType: '',
|
||||
projectTypeIndex: 0
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5
|
||||
}
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1
|
||||
},
|
||||
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
deviceList: [
|
||||
{
|
||||
name: '设备APF-1',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-2',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2'
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3'
|
||||
}
|
||||
]
|
||||
minHeight: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter () {
|
||||
return this.deviceList.filter(item => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
return item.type === this.select.projectType
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
deviceListFilter() {
|
||||
return this.store.data.filter(item => {
|
||||
if (this.select.projectName && this.select.projectType) {
|
||||
return item.project === this.select.projectName && item.type === this.select.projectType
|
||||
} else
|
||||
if (this.select.projectName) {
|
||||
return item.projectId === this.projectList[this.select.projectNameIndex].id
|
||||
} else if (this.select.projectType) {
|
||||
return item.projectType === this.projectType[this.select.projectTypeIndex].id
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitFeedBack () { uni.navigateTo({ url: '/pages/home/feedback' }) },
|
||||
projectTypeChange (e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
|
||||
submitFeedBack() { uni.navigateTo({ url: '/pages/home/feedback' }) },
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
@@ -155,12 +98,8 @@ export default {
|
||||
|
||||
|
||||
},
|
||||
projectNameChange (e) {
|
||||
projectNameChange(e) {
|
||||
console.log(e);
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
@@ -168,7 +107,7 @@ export default {
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice () {
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
@@ -188,15 +127,15 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
registerGateway () {
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new'
|
||||
})
|
||||
},
|
||||
navMenuClick (index) {
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump (item) {
|
||||
jump(item) {
|
||||
if (item.name.indexOf('APF') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail'
|
||||
@@ -208,7 +147,7 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
|
||||
|
||||
Reference in New Issue
Block a user