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