创建项目接口修改
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import request from '../js/request';
|
||||
import config from '../js/config';
|
||||
|
||||
// 获取设备
|
||||
export function getDeviceList(params) {
|
||||
return request({
|
||||
url: '/EquipmentDelivery/queryEquipmentByProject',
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
"/api" : {
|
||||
"https" : true,
|
||||
// "target" : "https://china.indpecker.com",
|
||||
"target" : "http://192.168.1.114:10210",
|
||||
"target" : "http://192.168.1.115:10210",
|
||||
"changOrigin" : true,
|
||||
"pathRewrite" : {
|
||||
"/api" : ""
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
<uni-icons type="image" color="#007aff" size="26" class="ml20" @click="chooseGplot"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="监测点" v-if="pointList.length">
|
||||
<uni-forms-item label="监测点" v-if="pointList.length">
|
||||
<view class="point-item" v-for="(item2, index2) in pointList" :key="index2"
|
||||
@click="editPoint(item2, index2)">
|
||||
<view style="flex:1" v-if="item2.pointName">{{ item2.pointName }}</view>
|
||||
<view style="flex:1;color:#999" v-else>请选择监测点</view>
|
||||
<uni-icons type="compose" color="#007aff" size="26" class="ml20"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item> -->
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="监测点" v-if="pointList.length">
|
||||
<view class="point-item center" v-for="(item, index) in pointList" :key="index">
|
||||
<view style="flex:1" class="center">{{ item.pointName }}</view>
|
||||
|
||||
@@ -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>
|
||||
@@ -22,23 +22,31 @@
|
||||
</Cn-grid>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }" @click="showDrawer">{{
|
||||
select.projectName || '工程' }} </view>
|
||||
<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.engineeringName }" @click="showDrawer"
|
||||
>{{ select.engineeringName || '工程' }}
|
||||
</view>
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectListFilter" range-key="text">
|
||||
<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.name" :sub-title="item.project" :extra="item.type" 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>
|
||||
<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>
|
||||
<uni-drawer ref="showRight" mode="right" :mask-click="false" :width="375">
|
||||
<uni-indexed-list :options="gcListFilter" :showSelect="false" @click="closeDrawer"></uni-indexed-list>
|
||||
@@ -46,10 +54,28 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro';
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
|
||||
export default {
|
||||
name: 'IndexGongCheng',
|
||||
props: {
|
||||
store: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
projectList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
projectType: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
gcList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -58,53 +84,9 @@ export default {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0
|
||||
projectTypeIndex: 0,
|
||||
engineeringName: '',
|
||||
},
|
||||
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: [
|
||||
@@ -124,99 +106,83 @@ export default {
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2'
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3'
|
||||
}
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
gcList: [
|
||||
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
gcListFilter() {
|
||||
// [{
|
||||
// "letter": "A",
|
||||
// "data": [
|
||||
// "阿克苏机场",
|
||||
// "阿拉山口机场",
|
||||
// "阿勒泰机场",
|
||||
// "阿里昆莎机场",
|
||||
// "安庆天柱山机场",
|
||||
// "澳门国际机场"
|
||||
// ]
|
||||
// }, {
|
||||
// "letter": "B",
|
||||
// "data": [
|
||||
// "保山机场",
|
||||
// "包头机场",
|
||||
// "北海福成机场",
|
||||
// "北京南苑机场",
|
||||
// "北京首都国际机场"
|
||||
// ]
|
||||
// }]
|
||||
|
||||
let result = []
|
||||
this.gcList.forEach(item => {
|
||||
this.gcList.forEach((item) => {
|
||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
||||
let letter = arr[0][0].toUpperCase()
|
||||
console.log(letter);
|
||||
let index = result.findIndex(item => item.letter === letter)
|
||||
console.log(letter)
|
||||
let index = result.findIndex((item) => item.letter === letter)
|
||||
if (index === -1) {
|
||||
result.push({
|
||||
letter,
|
||||
data: [item.name]
|
||||
data: [item.name],
|
||||
})
|
||||
} else {
|
||||
result[index].data.push(item.name)
|
||||
}
|
||||
})
|
||||
return result
|
||||
|
||||
},
|
||||
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
|
||||
let arr = this.store.data
|
||||
if (this.select.projectName) {
|
||||
arr = arr.filter((item) => item.projectName === this.select.projectName)
|
||||
}
|
||||
if (this.select.projectType) {
|
||||
arr = arr.filter((item) => item.projectType === this.select.projectType)
|
||||
}
|
||||
if (this.select.engineeringName) {
|
||||
arr = arr.filter((item) => item.engineeringName === this.select.engineeringName)
|
||||
}
|
||||
return arr
|
||||
},
|
||||
projectListFilter() {
|
||||
return this.projectList.filter((item) => {
|
||||
if (this.select.engineeringName) {
|
||||
return item.engineeringName === this.select.engineeringName
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
showDrawer() {
|
||||
this.$refs.showRight.open();
|
||||
this.$refs.showRight.open()
|
||||
},
|
||||
closeDrawer(e) {
|
||||
console.log(e);
|
||||
|
||||
this.$refs.showRight.close();
|
||||
},
|
||||
submitFeedBack() { uni.navigateTo({ url: '/pages/home/feedback' }) },
|
||||
projectTypeChange(e) {
|
||||
// 重置name
|
||||
console.log(e)
|
||||
this.select.engineeringName = e.item.name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
|
||||
this.$refs.showRight.close()
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
|
||||
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e);
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
@@ -238,57 +204,52 @@ 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
|
||||
},
|
||||
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'
|
||||
})
|
||||
}
|
||||
},
|
||||
init(){
|
||||
queryEngineering().then(res => {
|
||||
this.gcList = res.data
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
}
|
||||
},
|
||||
init() {
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
// 获取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()
|
||||
}, 1000);
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -22,17 +22,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.name" :sub-title="item.project" :extra="item.type" padding="0"
|
||||
v-for="(item, index) in deviceListFilter" :key="index" @click="jump(item)" thumbnail="/static/device.png">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:sub-title="item.project"
|
||||
:extra="item.type"
|
||||
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>
|
||||
@@ -41,59 +47,58 @@
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5
|
||||
}
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
@@ -114,20 +119,20 @@ export default {
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2'
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3'
|
||||
}
|
||||
]
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter () {
|
||||
return this.deviceList.filter(item => {
|
||||
deviceListFilter() {
|
||||
return this.deviceList.filter((item) => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
@@ -136,11 +141,13 @@ export default {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitFeedBack () { uni.navigateTo({ url: '/pages/home/feedback' }) },
|
||||
projectTypeChange (e) {
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
@@ -151,11 +158,9 @@ export default {
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
|
||||
|
||||
},
|
||||
projectNameChange (e) {
|
||||
console.log(e);
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
@@ -167,7 +172,7 @@ export default {
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice () {
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
@@ -177,50 +182,53 @@ 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 () {
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new'
|
||||
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'
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
} else if (item.name.indexOf('DVR') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/DVR/detail'
|
||||
url: '/pages/device/DVR/detail',
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
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()
|
||||
}, 1000);
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -14,24 +14,30 @@
|
||||
<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/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||
</Cn-grid>
|
||||
</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.name" :sub-title="item.project" :extra="item.type" padding="0"
|
||||
v-for="(item, index) in deviceListFilter" :key="index" @click="jump(item)" thumbnail="/static/device.png">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:sub-title="item.project"
|
||||
:extra="item.type"
|
||||
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>
|
||||
@@ -40,7 +46,7 @@
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
@@ -48,52 +54,51 @@ export default {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5
|
||||
}
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
@@ -114,21 +119,20 @@ export default {
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2'
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3'
|
||||
}
|
||||
]
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
deviceListFilter () {
|
||||
return this.deviceList.filter(item => {
|
||||
deviceListFilter() {
|
||||
return this.deviceList.filter((item) => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
@@ -137,11 +141,13 @@ export default {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitFeedBack () { uni.navigateTo({ url: '/pages/home/feedback' }) },
|
||||
projectTypeChange (e) {
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
@@ -152,11 +158,9 @@ export default {
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
|
||||
|
||||
},
|
||||
projectNameChange (e) {
|
||||
console.log(e);
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
@@ -168,7 +172,7 @@ export default {
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice () {
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
@@ -178,50 +182,53 @@ 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 () {
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new'
|
||||
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'
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
} else if (item.name.indexOf('DVR') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/DVR/detail'
|
||||
url: '/pages/device/DVR/detail',
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
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()
|
||||
}, 1000);
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -7,28 +7,35 @@
|
||||
<!-- 专职 -->
|
||||
<ZhuanZhi v-if="userInfo.role == 2" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<!-- 工程 -->
|
||||
<GongCheng v-if="userInfo.role == 3" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<GongCheng
|
||||
v-if="userInfo.role == 3"
|
||||
:store="store"
|
||||
:gcList="gcList"
|
||||
:projectList="projectList"
|
||||
:projectType="projectType"
|
||||
/>
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu v-if="userInfo.role == 4" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<!-- 子用户 -->
|
||||
<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" />
|
||||
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content" @trigger="trigger" />
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import YunWei from "./comp/indexYunWei.vue";
|
||||
import GongCheng from "./comp/indexGongCheng.vue";
|
||||
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 YunWei from './comp/indexYunWei.vue'
|
||||
import GongCheng from './comp/indexGongCheng.vue'
|
||||
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'
|
||||
import { queryDictData } from '../../common/api/dictionary'
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
|
||||
export default {
|
||||
mixins: [list],
|
||||
components: {
|
||||
@@ -37,68 +44,75 @@ export default {
|
||||
ZhuYongHu,
|
||||
ZiYongHu,
|
||||
ZhuanZhi,
|
||||
YouKe
|
||||
YouKe,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
userInfo: {
|
||||
role: 4
|
||||
role: 4,
|
||||
},
|
||||
projectList: [],
|
||||
gcList: [],
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5
|
||||
}
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
content() {
|
||||
let arr = [1, 3, 4]
|
||||
let content = [{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '运维管理',
|
||||
}, {
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '专职管理',
|
||||
}, {
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '工程',
|
||||
}, {
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '主用户',
|
||||
}, {
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '子用户',
|
||||
}, {
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '游客',
|
||||
}
|
||||
let content = [
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '运维管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '专职管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '工程',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '主用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '子用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '游客',
|
||||
},
|
||||
]
|
||||
return content
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
send() {
|
||||
@@ -110,59 +124,59 @@ export default {
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('推送失败')
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
trigger(e) {
|
||||
if (e.index === 500) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new'
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else {
|
||||
this.userInfo.role = e.index + 1
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: e.index + 1
|
||||
role: e.index + 1,
|
||||
})
|
||||
let roleName = ''
|
||||
switch (e.index + 1) {
|
||||
case 1:
|
||||
roleName = '运维管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
roleName = '专职管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 3:
|
||||
roleName = '工程'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 4:
|
||||
roleName = '主用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6'
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 5:
|
||||
roleName = '子用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6'
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 6:
|
||||
roleName = '游客'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6'
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
}
|
||||
@@ -175,63 +189,81 @@ export default {
|
||||
this.store.reload()
|
||||
this.store.firstCallBack = () => {
|
||||
this.loading = false
|
||||
console.log(this.store);
|
||||
console.log(this.store)
|
||||
}
|
||||
this.getProjectList()
|
||||
// this.queryDictData()
|
||||
},
|
||||
getProjectList() {
|
||||
getProjectList({
|
||||
currentPage: 1,
|
||||
pageSize: 9999
|
||||
}).then(res => {
|
||||
pageSize: 9999,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
this.projectList = [{
|
||||
text: '全部项目',
|
||||
value: ''
|
||||
}, ...res.data.records.map(item => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id
|
||||
let arr = [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: '-1',
|
||||
},
|
||||
...res.data.records.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}
|
||||
}),
|
||||
]
|
||||
arr.forEach((item) => {
|
||||
if (this.projectList.findIndex((item2) => item2.value == item.value) === -1) {
|
||||
this.projectList.push(item)
|
||||
}
|
||||
})]
|
||||
})
|
||||
})
|
||||
},
|
||||
getGcList() {
|
||||
queryEngineering().then((res) => {
|
||||
this.gcList = res.data
|
||||
})
|
||||
},
|
||||
queryDictData() {
|
||||
queryDictData('项目类型').then(res => {
|
||||
this.projectType = [{
|
||||
text: '全部类型',
|
||||
value: ''
|
||||
}, ...res.data.map(item => {
|
||||
return {
|
||||
text: item.anotherName,
|
||||
value: item.id
|
||||
}
|
||||
})]
|
||||
queryDictData('项目类型').then((res) => {
|
||||
this.projectType = [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: '',
|
||||
},
|
||||
...res.data.map((item) => {
|
||||
return {
|
||||
text: item.anotherName,
|
||||
value: item.id,
|
||||
}
|
||||
}),
|
||||
]
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
onLoad() {
|
||||
this.init()
|
||||
},
|
||||
onShow() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
if (!this.userInfo) {
|
||||
this.userInfo = {
|
||||
role: 4
|
||||
role: 4,
|
||||
}
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: 4,
|
||||
id: 1
|
||||
id: 1,
|
||||
})
|
||||
}
|
||||
if (this.userInfo.role == 4 || this.userInfo.role == 5 || this.userInfo.role == 6) {
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6'
|
||||
text: '6',
|
||||
})
|
||||
}
|
||||
}
|
||||
this.getProjectList()
|
||||
if (this.userInfo.role == 3) {
|
||||
this.getGcList()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('gc')"
|
||||
v-if="userInfo.role == 4 || userInfo.role == 3 ">
|
||||
v-if=" userInfo.role == 3 ">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
|
||||
<view class="mine-nav-label">工程管理</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
@@ -91,10 +91,10 @@ export default {
|
||||
roleName = '工程'
|
||||
break
|
||||
case 4:
|
||||
roleName = '主用户'
|
||||
roleName = '普通用户'
|
||||
break
|
||||
case 5:
|
||||
roleName = '子用户'
|
||||
roleName = '普通用户'
|
||||
break
|
||||
case 6:
|
||||
roleName = '游客'
|
||||
|
||||
@@ -1,93 +1,144 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='new'>
|
||||
<Cn-page :loading="loading">
|
||||
<view slot="body">
|
||||
<view class="new">
|
||||
<view class="content">
|
||||
<uni-forms :label-width="80">
|
||||
<uni-forms-item label="工程名称">
|
||||
<uni-easyinput v-model="formData.engineeringName" placeholder="请输入项目名称" @click.native="showDrawer" :clearable="false" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="项目名称">
|
||||
<uni-easyinput type="number" v-model="formData.name" placeholder="请输入项目名称" />
|
||||
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="项目类别">
|
||||
<!-- <uni-forms-item label="项目类别">
|
||||
<uni-data-select v-model="formData.projectType" :localdata="TypeRange"></uni-data-select>
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="区域">
|
||||
<view style="display:flex;">
|
||||
<uni-easyinput :clearable="false" type="textarea" autoHeight v-model="formData.area"
|
||||
placeholder="请输入区域信息" />
|
||||
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
||||
@click="chooseLocation"></uni-icons>
|
||||
<view style="display: flex">
|
||||
<uni-easyinput
|
||||
:clearable="false"
|
||||
type="textarea"
|
||||
autoHeight
|
||||
v-model="formData.area"
|
||||
placeholder="请输入区域信息"
|
||||
/>
|
||||
<uni-icons type="location" color="#007aff" size="26" class="ml20" @click="chooseLocation"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="描述">
|
||||
<uni-easyinput type="textarea" autoHeight v-model="formData.description"
|
||||
placeholder="请输入项目描述" />
|
||||
<uni-easyinput type="textarea" autoHeight v-model="formData.description" placeholder="请输入项目描述" />
|
||||
</uni-forms-item>
|
||||
<uni-file-picker v-model="formData.files" title="请上传拓扑图" :sourceType="['album']"
|
||||
@select="select"></uni-file-picker>
|
||||
<uni-file-picker
|
||||
v-model="formData.files"
|
||||
title="请上传拓扑图"
|
||||
:sourceType="['album']"
|
||||
@select="select"
|
||||
></uni-file-picker>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<view class="btn-wrap">
|
||||
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
||||
</view>
|
||||
<uni-drawer ref="showRight" mode="right" :mask-click="false" :width="375">
|
||||
<uni-indexed-list :options="gcListFilter" :showSelect="false" @click="closeDrawer"></uni-indexed-list>
|
||||
</uni-drawer>
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import { addAppProject } from '../../common/api/project'
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
formData: {
|
||||
area: "",
|
||||
engineeringId: '',
|
||||
engineeringName: '',
|
||||
area: '',
|
||||
files: [],
|
||||
description: '',
|
||||
projectType: '1',
|
||||
name: '',
|
||||
userId: '123456',
|
||||
lat: '2',
|
||||
lng: '3'
|
||||
lng: '3',
|
||||
},
|
||||
TypeRange: [
|
||||
{
|
||||
text: '监测',
|
||||
value: '1'
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: '2'
|
||||
}
|
||||
]
|
||||
value: '2',
|
||||
},
|
||||
],
|
||||
gcList: [],
|
||||
}
|
||||
},
|
||||
onLoad () {
|
||||
computed: {
|
||||
gcListFilter() {
|
||||
let result = []
|
||||
this.gcList.forEach((item) => {
|
||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
||||
let letter = arr[0][0].toUpperCase()
|
||||
console.log(letter)
|
||||
let index = result.findIndex((item) => item.letter === letter)
|
||||
if (index === -1) {
|
||||
result.push({
|
||||
letter,
|
||||
data: [item.name],
|
||||
})
|
||||
} else {
|
||||
result[index].data.push(item.name)
|
||||
}
|
||||
})
|
||||
return result
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
console.log('当前位置的经度:' + res.longitude);
|
||||
console.log('当前位置的纬度:' + res.latitude);
|
||||
}
|
||||
});
|
||||
console.log(res)
|
||||
console.log('当前位置的经度:' + res.longitude)
|
||||
console.log('当前位置的纬度:' + res.latitude)
|
||||
},
|
||||
})
|
||||
queryEngineering().then((res) => {
|
||||
this.gcList = res.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
select (e) {
|
||||
console.log(e);
|
||||
showDrawer() {
|
||||
this.$refs.showRight.open()
|
||||
},
|
||||
chooseLocation () {
|
||||
|
||||
closeDrawer(e) {
|
||||
console.log(e)
|
||||
this.formData.engineeringName = e.item.name
|
||||
this.formData.engineeringId = this.gcList.find((item) => item.name === e.item.name).id
|
||||
this.$refs.showRight.close()
|
||||
},
|
||||
select(e) {
|
||||
console.log(e)
|
||||
console.log(this.formData.files)
|
||||
this.formData.files = this.formData.files.concat(e.tempFiles)
|
||||
},
|
||||
chooseLocation() {
|
||||
uni.chooseLocation({
|
||||
success: function (res) {
|
||||
this.address = res.name
|
||||
console.log('位置名称:' + res.name);
|
||||
console.log('详细地址:' + res.address);
|
||||
console.log('纬度:' + res.latitude);
|
||||
console.log('经度:' + res.longitude);
|
||||
}
|
||||
});
|
||||
console.log('位置名称:' + res.name)
|
||||
console.log('详细地址:' + res.address)
|
||||
console.log('纬度:' + res.latitude)
|
||||
console.log('经度:' + res.longitude)
|
||||
},
|
||||
})
|
||||
},
|
||||
async submit () {
|
||||
async submit() {
|
||||
console.log(this.formData)
|
||||
if (!this.formData.name) {
|
||||
this.$util.toast('请输入项目名称')
|
||||
return
|
||||
@@ -113,23 +164,23 @@ export default {
|
||||
let item = this.formData.files[i]
|
||||
arr.push({
|
||||
name: 'files',
|
||||
url: item.url
|
||||
url: item.url,
|
||||
})
|
||||
}
|
||||
let data = JSON.parse(JSON.stringify(this.formData))
|
||||
delete data.files
|
||||
addAppProject(data, arr).then(res => {
|
||||
addAppProject(data, arr).then((res) => {
|
||||
console.log(res)
|
||||
this.$util.toast('项目创建成功')
|
||||
// setTimeout(() => {
|
||||
// uni.navigateBack({ delta: 1 })
|
||||
// }, 1500);
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1500);
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.new {
|
||||
padding: 34rpx;
|
||||
|
||||
@@ -168,4 +219,4 @@ export default {
|
||||
/deep/ .uni-drawer__content {
|
||||
width: 100vw !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user