创建项目接口修改

This commit is contained in:
仲么了
2023-05-24 08:58:48 +08:00
parent ff2fd537ec
commit cca66bab21
10 changed files with 511 additions and 449 deletions

View File

@@ -14,7 +14,7 @@
<div class="header-item-label">离线设备</div>
</div>
</div>
<view style="padding:20rpx 20rpx 0">
<view style="padding: 20rpx 20rpx 0">
<Cn-grid title="常用功能">
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
<Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item>
@@ -23,17 +23,23 @@
</view>
<view class="nav">
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{
select.projectName || '项目' }} </view>
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{ select.projectName || '项目' }} </view>
</picker>
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{
select.projectType || '类型' }} </view>
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{ select.projectType || '类型' }} </view>
</picker>
</view>
<view class="content device" :style="{ minHeight: minHeight }">
<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">
<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>
<Cn-empty v-if="store.empty || deviceListFilter.length == 0"></Cn-empty>
@@ -46,15 +52,15 @@ export default {
props: {
store: {
type: Object,
default: {}
default: {},
},
projectList: {
type: Array,
default: []
default: [],
},
projectType: {
type: Array,
default: []
default: [],
},
},
data() {
@@ -64,48 +70,47 @@ export default {
projectName: '',
projectNameIndex: 0,
projectType: '',
projectTypeIndex: 0
projectTypeIndex: 0,
},
navHeight: 0,
minHeight: ''
}
minHeight: '',
};
},
computed: {
deviceListFilter() {
return this.store.data.filter(item => {
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
}
})
}
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' }) },
submitFeedBack() {
uni.navigateTo({ url: '/pages/home/feedback' });
},
projectTypeChange(e) {
this.select.projectTypeIndex = e.detail.value
this.select.projectTypeIndex = e.detail.value;
if (e.detail.value === 0) {
this.select.projectType = ''
return
this.select.projectType = '';
return;
}
this.select.projectType = this.projectType[e.detail.value].text
this.select.projectType = this.projectType[e.detail.value].text;
},
projectNameChange(e) {
console.log(e);
this.select.projectNameIndex = e.detail.value
this.select.projectNameIndex = e.detail.value;
if (e.detail.value === 0) {
this.select.projectName = ''
return
this.select.projectName = '';
return;
}
this.select.projectName = this.projectList[e.detail.value].text
this.select.projectName = this.projectList[e.detail.value].text;
},
registerDevice() {
uni.showModal({
@@ -117,50 +122,47 @@ export default {
success: ({ confirm, cancel }) => {
if (confirm) {
uni.navigateTo({
url: '/pages/device/new'
})
url: '/pages/device/new',
});
} else if (cancel) {
uni.navigateTo({
url: '/pages/gateway/list'
})
url: '/pages/gateway/list',
});
}
}
})
},
});
},
registerGateway() {
uni.navigateTo({
url: '/pages/gateway/new'
})
url: '/pages/gateway/new',
});
},
navMenuClick(index) {
this.navMenuActive = index
this.navMenuActive = index;
},
jump(item) {
if (item.name.indexOf('APF') > -1) {
uni.navigateTo({
url: '/pages/device/APF/detail'
})
} else if (item.name.indexOf('DVR') > -1) {
uni.navigateTo({
url: '/pages/device/DVR/detail'
})
}
uni.navigateTo({
url: '/pages/device/APF/detail',
});
},
},
mounted() {
setTimeout(() => {
// 获取nav高度
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
this.navHeight = rect.height
// #ifdef H5
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
// #endif
// #ifdef APP-PLUS
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
// #endif
}).exec()
uni.createSelectorQuery()
.select('.nav')
.boundingClientRect((rect) => {
this.navHeight = rect.height;
// #ifdef H5
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)';
// #endif
// #ifdef APP-PLUS
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)';
// #endif
})
.exec();
}, 1000);
}
}
},
};
</script>
<style lang='scss'></style>
<style lang="scss"></style>