设备接口列表对接

This commit is contained in:
仲么了
2023-04-04 08:47:19 +08:00
parent 0325347e06
commit feb7d7b6ed
8 changed files with 184 additions and 169 deletions

View File

@@ -3,15 +3,15 @@
<view slot="body">
<view class="index">
<!-- 运维 -->
<YunWei v-if="userInfo.role == 1" />
<YunWei v-if="userInfo.role == 1" :store="store" :projectList="projectList" :projectType="projectType" />
<!-- 专职 -->
<ZhuanZhi v-if="userInfo.role == 2" />
<ZhuanZhi v-if="userInfo.role == 2" :store="store" :projectList="projectList" :projectType="projectType" />
<!-- 工程 -->
<GongCheng v-if="userInfo.role == 3" />
<GongCheng v-if="userInfo.role == 3" :store="store" :projectList="projectList" :projectType="projectType" />
<!-- 主用户 -->
<ZhuYongHu v-if="userInfo.role == 4" />
<ZhuYongHu v-if="userInfo.role == 4" :store="store" :projectList="projectList" :projectType="projectType" />
<!-- 子用户 -->
<ZiYongHu v-if="userInfo.role == 5" />
<ZiYongHu v-if="userInfo.role == 5" :store="store" :projectList="projectList" :projectType="projectType" />
<YouKe v-if="userInfo.role == 6"> </YouKe>
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content"
@trigger="trigger" />
@@ -26,7 +26,10 @@ import ZhuYongHu from "./comp/indexZhuYongHu.vue";
import ZiYongHu from "./comp/indexZiYongHu.vue";
import ZhuanZhi from "./comp/indexZhuanZhi.vue";
import YouKe from "./comp/indexYouKe.vue";
import list from '../../common/js/list'
import { getProjectList } from '../../common/api/project'
export default {
mixins: [list],
components: {
YunWei,
GongCheng,
@@ -35,16 +38,43 @@ export default {
ZhuanZhi,
YouKe
},
data () {
data() {
return {
loading: false,
loading: true,
userInfo: {
role: 4
}
},
projectList: [],
projectType: [
{
text: '全部类型',
value: 0
},
{
text: '监测',
value: 1
},
{
text: '用能',
value: 2
},
{
text: '环境',
value: 3
},
{
text: '安防',
value: 4
},
{
text: '其他',
value: 5
}
],
}
},
computed: {
content () {
content() {
let arr = [1, 3, 4]
let content = [{
iconPath: '/static/mine3.png',
@@ -70,7 +100,7 @@ export default {
}
},
methods: {
send () {
send() {
uni.createPushMessage({
title: '灿能',
content: '灿能推送',
@@ -83,7 +113,7 @@ export default {
})
},
trigger (e) {
trigger(e) {
if (e.index === 500) {
uni.navigateTo({
url: '/pages/device/new'
@@ -138,12 +168,38 @@ export default {
this.$util.toast(roleName + '角色切换成功')
}
this.$refs.fab.close()
},
init() {
this.store = this.DataSource('/EquipmentDelivery/queryEquipmentByProject')
this.store.reload()
this.store.firstCallBack = () => {
this.loading = false
console.log(this.store);
}
this.getProjectList()
},
getProjectList() {
getProjectList({
currentPage: 1,
pageSize: 9999
}).then(res => {
console.log(res)
this.projectList = [{
text: '全部项目',
value: ''
}, ...res.data.records.map(item => {
return {
text: item.name,
value: item.id
}
})]
})
}
},
onLoad (options) {
this.loading = false
onLoad(options) {
this.init()
},
onShow () {
onShow() {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
if (!this.userInfo) {
this.userInfo = {