基础接口对接
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import request from '../js/request';
|
||||
import config from '../js/config';
|
||||
|
||||
export function addEngineering(params, files) {
|
||||
export function addEngineering(params) {
|
||||
return request({
|
||||
url: '/engineering/addEngineering',
|
||||
method: 'post',
|
||||
|
||||
@@ -6,13 +6,12 @@ export function addAppProject (params, files) {
|
||||
url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址
|
||||
files: files,
|
||||
header: {
|
||||
"Authorization": "12",
|
||||
Authorization: '12',
|
||||
},
|
||||
formData: params,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function getProjectList(params) {
|
||||
return request({
|
||||
url: '/project/queryProject',
|
||||
@@ -23,3 +22,59 @@ export function getProjectList (params) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 查询拓扑图
|
||||
|
||||
export function queryTopologyDiagramPage(params) {
|
||||
return request({
|
||||
url: '/topologyDiagram/queryTopologyDiagramPage',
|
||||
method: 'post',
|
||||
data: Object.assign(
|
||||
{
|
||||
currentPage: 1,
|
||||
pageSize: 999,
|
||||
projectId: '',
|
||||
searchValue: '',
|
||||
},
|
||||
params
|
||||
),
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 删除拓扑图
|
||||
export function deleteAppTopologyDiagram(id) {
|
||||
return request({
|
||||
url: '/topologyDiagram/AuditAppTopologyDiagram',
|
||||
method: 'post',
|
||||
data: {
|
||||
id,
|
||||
status: 0,
|
||||
},
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 新增拓扑图
|
||||
|
||||
export function addAppTopologyDiagram(params, filePath) {
|
||||
return uni.uploadFile({
|
||||
url: config.domain + '/topologyDiagram/addAppTopologyDiagram', //仅为示例,非真实的接口地址
|
||||
filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
Authorization: '12',
|
||||
},
|
||||
formData: Object.assign(
|
||||
{
|
||||
topologyDiagramName: '',
|
||||
projectId: '',
|
||||
},
|
||||
params
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
||||
})
|
||||
setTimeout(() => {
|
||||
call && call()
|
||||
}, duration);
|
||||
}, duration)
|
||||
}
|
||||
/**
|
||||
* @description 格式化时间
|
||||
@@ -44,7 +44,7 @@ function parseTime (time, cFormat) {
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
a: date.getDay(),
|
||||
}
|
||||
return format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
@@ -58,7 +58,6 @@ function parseTime (time, cFormat) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 格式化时间
|
||||
* @param time
|
||||
@@ -88,11 +87,7 @@ function formatTime (time, option) {
|
||||
return '1天前'
|
||||
}
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
'日'
|
||||
d.getMonth() + 1 + '月' + d.getDate() + '日'
|
||||
// +
|
||||
// d.getHours() +
|
||||
// '时'
|
||||
@@ -122,24 +117,23 @@ const validatePhoneNumber = (phone) => {
|
||||
return testReg.test(phone)
|
||||
}
|
||||
|
||||
|
||||
const getUserLocation = (call) => {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (address) {
|
||||
call(address)
|
||||
},
|
||||
fail: err => {
|
||||
fail: (err) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '定位失败,请打开定位权限',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
uni.openSetting({
|
||||
success: resSett => {
|
||||
success: (resSett) => {
|
||||
if (resSett.authSetting['scope.userLocation']) {
|
||||
uni.getLocation({
|
||||
success: address => {
|
||||
success: (address) => {
|
||||
call && call(address)
|
||||
},
|
||||
})
|
||||
@@ -147,7 +141,7 @@ const getUserLocation = (call) => {
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -156,7 +150,7 @@ const getUserLocation = (call) => {
|
||||
// 加载用户配置
|
||||
var globalConfigIsLoading = false,
|
||||
global_config = null,
|
||||
globalConfigCallbacks = [];
|
||||
globalConfigCallbacks = []
|
||||
/**
|
||||
* 加载用户配置
|
||||
* @param call 加载成功后的回调
|
||||
@@ -164,41 +158,44 @@ var globalConfigIsLoading = false,
|
||||
*/
|
||||
const loadConfig = (call, need_fresh = false) => {
|
||||
if (call && global_config && !need_fresh) {
|
||||
call(global_config);
|
||||
return;
|
||||
call(global_config)
|
||||
return
|
||||
}
|
||||
if (globalConfigIsLoading) {
|
||||
globalConfigCallbacks.push(call);
|
||||
return;
|
||||
globalConfigCallbacks.push(call)
|
||||
return
|
||||
}
|
||||
globalConfigIsLoading = true;
|
||||
globalConfigIsLoading = true
|
||||
request({
|
||||
url: '/org/userResource/userMsg',
|
||||
}).then(rs => {
|
||||
|
||||
globalConfigIsLoading = false;
|
||||
global_config = rs.data;
|
||||
})
|
||||
.then((rs) => {
|
||||
globalConfigIsLoading = false
|
||||
global_config = rs.data
|
||||
uni.setStorage({
|
||||
key: 'userInfo',
|
||||
data: global_config,
|
||||
})
|
||||
if (call) {
|
||||
call(global_config);
|
||||
call(global_config)
|
||||
}
|
||||
for (var i = 0; i < globalConfigCallbacks.length; i++) {
|
||||
globalConfigCallbacks[i](global_config);
|
||||
globalConfigCallbacks[i](global_config)
|
||||
}
|
||||
globalConfigCallbacks = [];
|
||||
}).catch(err => {
|
||||
globalConfigIsLoading = false;
|
||||
console.warn(err);
|
||||
globalConfigCallbacks = []
|
||||
})
|
||||
.catch((err) => {
|
||||
globalConfigIsLoading = false
|
||||
console.warn(err)
|
||||
// uni.reLaunch({ url: '/pages/user/login' })
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const prePage = () => {
|
||||
let pages = getCurrentPages()
|
||||
let prePage = pages[pages.length - 2]
|
||||
return prePage
|
||||
}
|
||||
|
||||
export default {
|
||||
validatePhoneNumber,
|
||||
@@ -208,4 +205,5 @@ export default {
|
||||
h5Helper,
|
||||
getUserLocation,
|
||||
loadConfig,
|
||||
prePage,
|
||||
}
|
||||
|
||||
@@ -309,6 +309,12 @@
|
||||
"navigationBarTitleText": "工程列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gc/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工程详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/erweima",
|
||||
"style": {
|
||||
|
||||
231
pages/gc/detail.vue
Normal file
231
pages/gc/detail.vue
Normal file
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<Cn-page :loading="loading" noPadding>
|
||||
<view slot="body">
|
||||
<view class="detail">
|
||||
<view class="header">
|
||||
<view class="header-title"
|
||||
>{{ gc.name }}
|
||||
<!-- <view class="header-title-extra">用能</view> -->
|
||||
</view>
|
||||
<view class="header-des-mini mb10">{{ gc.provinceName + gc.cityName }} {{ gc.createTime }}</view>
|
||||
<view class="header-des">{{ gc.description }} </view>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': navMenuActive == index }"
|
||||
v-for="(item, index) in navMenuList"
|
||||
:key="index"
|
||||
@click="navMenuClick(index)"
|
||||
>{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }">
|
||||
<view v-show="navMenuActive == 0">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:extra="item.projectType"
|
||||
@click="jumpProject(item)"
|
||||
v-for="(item, index) in store.data"
|
||||
:key="index"
|
||||
>
|
||||
<view class="term-list-bottom">
|
||||
<view class="term-list-bottom-item">
|
||||
<view>设备个数</view>
|
||||
<view>3</view>
|
||||
</view>
|
||||
<view class="term-list-bottom-item">
|
||||
<view>用户个数</view>
|
||||
<view>1</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
<view style="padding: 0 20rpx" v-show="navMenuActive == 2">
|
||||
<image class="gplot gplot-box" mode="aspectFill" src="/static/test2.pic.png" v-for="(item, key) in 3" :key="key" />
|
||||
</view>
|
||||
</view>
|
||||
<uni-fab
|
||||
ref="fab"
|
||||
direction="vertical"
|
||||
horizontal="right"
|
||||
vertical="bottom"
|
||||
:content="content"
|
||||
@trigger="trigger"
|
||||
v-if="content.length"
|
||||
/>
|
||||
<uni-popup ref="share" type="share" background-color="#fff">
|
||||
<uni-popup-share title="分享到"></uni-popup-share>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import list from '../../common/js/list'
|
||||
export default {
|
||||
mixins: [list],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
gc: '',
|
||||
navMenuList: [
|
||||
{
|
||||
text: '项目',
|
||||
},
|
||||
{
|
||||
text: '拓扑图',
|
||||
},
|
||||
],
|
||||
content: [],
|
||||
navHeight: 0,
|
||||
navMenuActive: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
trigger(e) {
|
||||
console.log(this.$refs)
|
||||
if (e.item.text == '移交') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gc/transfer',
|
||||
})
|
||||
} else if (e.item.text == '分享') {
|
||||
this.$refs.share.open()
|
||||
}
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
goUserDetail() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/userDetail',
|
||||
})
|
||||
},
|
||||
del() {
|
||||
console.log('del')
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要移除该成员吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
goDevice() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
},
|
||||
jumpProject(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/project/detail?project=' + JSON.stringify(item),
|
||||
})
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/project/queryProject')
|
||||
this.store.params.engineeringId = this.gc.id
|
||||
this.store.reload()
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
this.gc = JSON.parse(option.gc)
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
if (userInfo.role == '3') {
|
||||
this.content.push({
|
||||
iconPath: '/static/transfer.png',
|
||||
text: '移交',
|
||||
})
|
||||
} else if (userInfo.role == '4') {
|
||||
this.content.push({
|
||||
iconPath: '/static/share.png',
|
||||
text: '分享',
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
this.init()
|
||||
// uni.setNavigationBarTitle({ title: this.gc })
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.detail {
|
||||
.content {
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 20rpx 20rpx 0;
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 40rpx;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.header-title-extra {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.header-des {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
.header-des-mini {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-btn {
|
||||
padding: 0 20rpx;
|
||||
height: 50rpx;
|
||||
background-color: #007aff;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 50rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.gplot {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border: 8rpx solid #ccc;
|
||||
}
|
||||
|
||||
.term-list-bottom {
|
||||
.term-list-bottom-item {
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// view:first-of-type{
|
||||
// color: #111;
|
||||
// }
|
||||
}
|
||||
|
||||
.term-list-bottom-item:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,15 +1,24 @@
|
||||
<template>
|
||||
<view :loading="loading">
|
||||
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> -->
|
||||
<uni-nav-bar dark :fixed="true" status-bar left-icon="left" :rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff" color="#111" title="工程管理" @clickLeft="back" @clickRight="add" />
|
||||
<uni-nav-bar
|
||||
dark
|
||||
:fixed="true"
|
||||
status-bar
|
||||
left-icon="left"
|
||||
:rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff"
|
||||
color="#111"
|
||||
title="工程管理"
|
||||
@clickLeft="back"
|
||||
@clickRight="add"
|
||||
/>
|
||||
<view class="message">
|
||||
<uni-card :title="item.name" :extra="item.projectType" @click="jump('XXX项目1')"
|
||||
v-for="(item, index) in store.data" :key="index">
|
||||
<uni-card :title="item.name" :extra="item.projectType" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
|
||||
<view class="term-list-bottom">
|
||||
<view class="term-list-bottom-item">
|
||||
<view>区域</view>
|
||||
<view>{{ item.province +item.city}}</view>
|
||||
<view>{{ item.provinceName + item.cityName }}</view>
|
||||
</view>
|
||||
<view class="term-list-bottom-item">
|
||||
<view>创建时间</view>
|
||||
@@ -30,7 +39,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {}
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -44,22 +53,23 @@ export default {
|
||||
},
|
||||
add() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/gc/new`
|
||||
url: `/pages/gc/new`,
|
||||
})
|
||||
},
|
||||
upgrade(code) {
|
||||
console.log(code);
|
||||
console.log(code)
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
jump (type) {
|
||||
jump(gc) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/project/detail?project=${type}`
|
||||
url: `/pages/gc/detail?gc=${JSON.stringify(gc)}`,
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.init()
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<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="工程名称">
|
||||
@@ -17,8 +17,7 @@
|
||||
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
|
||||
</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-forms>
|
||||
</view>
|
||||
@@ -38,10 +37,10 @@ export default {
|
||||
localdata: area,
|
||||
loading: false,
|
||||
formData: {
|
||||
city: "",
|
||||
description: "",
|
||||
name: "",
|
||||
province: "",
|
||||
city: '',
|
||||
description: '',
|
||||
name: '',
|
||||
province: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -49,35 +48,36 @@ export default {
|
||||
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)
|
||||
},
|
||||
})
|
||||
// console.log(area);
|
||||
console.log( this.$util.prePage());
|
||||
},
|
||||
methods: {
|
||||
areaChange(e) {
|
||||
console.log(e);
|
||||
console.log(e)
|
||||
this.formData.province = e.detail.value[0].value
|
||||
this.formData.city = e.detail.value[1].value
|
||||
},
|
||||
select(e) {
|
||||
console.log(e);
|
||||
console.log(e)
|
||||
},
|
||||
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() {
|
||||
console.log(this.formData)
|
||||
if (!this.formData.name) {
|
||||
this.$util.toast('请输入工程名称')
|
||||
return
|
||||
@@ -91,18 +91,19 @@ export default {
|
||||
this.$util.toast('请输入工程描述')
|
||||
return
|
||||
}
|
||||
addEngineering(this.formData).then(res => {
|
||||
addEngineering(this.formData).then((res) => {
|
||||
console.log(res)
|
||||
this.$util.toast('工程创建成功')
|
||||
this.$util.prePage().store?.reload()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1500);
|
||||
}, 1500)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.new {
|
||||
padding: 34rpx;
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ export default {
|
||||
this.userInfo.role = e.index + 1
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: e.index + 1,
|
||||
id: 1,
|
||||
})
|
||||
let roleName = ''
|
||||
switch (e.index + 1) {
|
||||
@@ -247,6 +248,7 @@ export default {
|
||||
if (!this.userInfo) {
|
||||
this.userInfo = {
|
||||
role: 4,
|
||||
id: 1,
|
||||
}
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: 4,
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading' noPadding>
|
||||
<view slot='body'>
|
||||
<view class='detail'>
|
||||
<Cn-page :loading="loading" noPadding>
|
||||
<view slot="body">
|
||||
<view class="detail">
|
||||
<view class="header">
|
||||
<view class="header-title">{{ project }}
|
||||
<view class="header-title-extra">用能</view>
|
||||
<view class="header-title"
|
||||
>{{ project.name }}
|
||||
<!-- <view class="header-title-extra">用能</view> -->
|
||||
</view>
|
||||
<view class="header-des">项目详情。。。。。。。。</view>
|
||||
<view class="header-des">{{ project.description }}</view>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<view class="nav-menu " :class="{ 'nav-menu-active': navMenuActive == index }"
|
||||
v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text }}
|
||||
<view
|
||||
class="nav-menu"
|
||||
:class="{ 'nav-menu-active': navMenuActive == index }"
|
||||
v-for="(item, index) in navMenuList"
|
||||
:key="index"
|
||||
@click="navMenuClick(index)"
|
||||
>{{ item.text }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }">
|
||||
<view v-show="navMenuActive == 0">
|
||||
<uni-card :title="'设备' + item" :sub-title="project" extra="用能" v-for="item in 2" :key="item"
|
||||
@click="goDevice" padding="0" thumbnail="/static/device.png">
|
||||
<uni-card
|
||||
:title="item.equipmentName"
|
||||
sub-title="创建时间"
|
||||
v-for="item in store.data"
|
||||
:key="item.equipmentId"
|
||||
@click="goDevice"
|
||||
padding="0"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
<view style="padding: 0 20rpx" v-show="navMenuActive == 1">
|
||||
<uni-list>
|
||||
@@ -36,13 +51,30 @@
|
||||
</uni-list>
|
||||
</view>
|
||||
<view style="padding: 0 20rpx" v-show="navMenuActive == 2">
|
||||
<image class="gplot gplot-box" mode="aspectFill" src="/static/test2.pic.png"
|
||||
v-for="(item, key) in 3" :key="key" />
|
||||
<!-- <image
|
||||
class="gplot gplot-box"
|
||||
mode="aspectFill"
|
||||
:src="item.filePath"
|
||||
v-for="(item, key) in topologyDiagramPage"
|
||||
:key="key"
|
||||
/> -->
|
||||
<uni-file-picker
|
||||
v-model="topologyDiagramPage"
|
||||
:sourceType="['album']"
|
||||
@select="addAppTopologyDiagram"
|
||||
@delete="deleteTopologyDiagramPage"
|
||||
></uni-file-picker>
|
||||
</view>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content"
|
||||
@trigger="trigger" v-if="content.length" />
|
||||
<uni-fab
|
||||
ref="fab"
|
||||
direction="vertical"
|
||||
horizontal="right"
|
||||
vertical="bottom"
|
||||
:content="content"
|
||||
@trigger="trigger"
|
||||
v-if="content.length"
|
||||
/>
|
||||
<uni-popup ref="share" type="share" background-color="#fff">
|
||||
<uni-popup-share title="分享到"></uni-popup-share>
|
||||
</uni-popup>
|
||||
@@ -51,29 +83,55 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import list from '../../common/js/list'
|
||||
import { queryTopologyDiagramPage, deleteAppTopologyDiagram, addAppTopologyDiagram } from '../../common/api/project'
|
||||
export default {
|
||||
mixins: [list],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
project: '',
|
||||
navMenuList: [{
|
||||
text: '设备'
|
||||
}, {
|
||||
text: '子用户'
|
||||
}, {
|
||||
text: '拓扑图'
|
||||
}],
|
||||
project: {},
|
||||
navMenuList: [
|
||||
{
|
||||
text: '设备',
|
||||
},
|
||||
{
|
||||
text: '子用户',
|
||||
},
|
||||
{
|
||||
text: '拓扑图',
|
||||
},
|
||||
],
|
||||
content: [],
|
||||
navHeight: 0,
|
||||
navMenuActive: 0
|
||||
navMenuActive: 0,
|
||||
topologyDiagramPage: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addAppTopologyDiagram(e) {
|
||||
console.log(e)
|
||||
addAppTopologyDiagram(
|
||||
{
|
||||
projectId: this.project.id,
|
||||
topologyDiagramName: e.tempFiles[0].name,
|
||||
},
|
||||
e.tempFiles[0].path
|
||||
).then((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
deleteTopologyDiagramPage(e) {
|
||||
console.log(e)
|
||||
deleteAppTopologyDiagram(e.tempFile.id).then((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
trigger(e) {
|
||||
console.log(this.$refs);
|
||||
console.log(this.$refs)
|
||||
if (e.item.text == '移交') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/project/transfer'
|
||||
url: '/pages/project/transfer',
|
||||
})
|
||||
} else if (e.item.text == '分享') {
|
||||
this.$refs.share.open()
|
||||
@@ -84,11 +142,11 @@ export default {
|
||||
},
|
||||
goUserDetail() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/userDetail'
|
||||
url: '/pages/mine/userDetail',
|
||||
})
|
||||
},
|
||||
del() {
|
||||
console.log('del');
|
||||
console.log('del')
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要移除该成员吗?',
|
||||
@@ -98,18 +156,35 @@ export default {
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
goDevice() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail'
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store.params.projectId = this.project.id
|
||||
this.store.reload()
|
||||
|
||||
queryTopologyDiagramPage({
|
||||
projectId: this.project.id,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
this.topologyDiagramPage = res.data.records.map((item) => {
|
||||
return {
|
||||
name: item.name,
|
||||
extname: 'img',
|
||||
url: item.filePath,
|
||||
...item,
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
this.project = option.project
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
if (userInfo.role == '3') {
|
||||
this.content.push({
|
||||
@@ -124,15 +199,20 @@ export default {
|
||||
}
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
}).exec()
|
||||
}, 1000);
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
this.project = JSON.parse(option.project)
|
||||
this.init()
|
||||
// uni.setNavigationBarTitle({ title: this.project })
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
<style lang="scss">
|
||||
.detail {
|
||||
.content {
|
||||
box-sizing: border-box;
|
||||
@@ -162,7 +242,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.footer-btn {
|
||||
padding: 0 20rpx;
|
||||
height: 50rpx;
|
||||
@@ -173,9 +252,13 @@ export default {
|
||||
line-height: 50rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
/deep/ .is-add {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.gplot {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border: 8rpx solid #ccc;
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<template>
|
||||
<view :loading="loading">
|
||||
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> -->
|
||||
<uni-nav-bar dark :fixed="true" status-bar left-icon="left" :rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff" color="#111" title="项目管理" @clickLeft="back" @clickRight="add" />
|
||||
<uni-nav-bar
|
||||
dark
|
||||
:fixed="true"
|
||||
status-bar
|
||||
left-icon="left"
|
||||
:rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff"
|
||||
color="#111"
|
||||
title="项目管理"
|
||||
@clickLeft="back"
|
||||
@clickRight="add"
|
||||
/>
|
||||
<view class="message">
|
||||
<uni-card :title="item.name" :extra="item.projectType" @click="jump('XXX项目1')"
|
||||
v-for="(item, index) in store.data" :key="index">
|
||||
<uni-card :title="item.name" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
|
||||
<view class="term-list-bottom">
|
||||
<view class="term-list-bottom-item">
|
||||
<view>设备个数</view>
|
||||
@@ -17,7 +26,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
||||
<Cn-empty v-if="store.empty" style="padding-top: 200px"></Cn-empty>
|
||||
<uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
@@ -30,7 +39,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {}
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -43,21 +52,21 @@ export default {
|
||||
},
|
||||
add() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/project/new`
|
||||
url: `/pages/project/new`,
|
||||
})
|
||||
},
|
||||
upgrade(code) {
|
||||
console.log(code);
|
||||
console.log(code)
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
jump (type) {
|
||||
jump(project) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/project/detail?project=${type}`
|
||||
url: `/pages/project/detail?project=${JSON.stringify(project)}`,
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.init()
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
<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-easyinput
|
||||
v-model="formData.engineeringName"
|
||||
placeholder="请输入项目名称"
|
||||
@click.native="showDrawer"
|
||||
:clearable="false"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="项目名称">
|
||||
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
|
||||
@@ -162,19 +167,27 @@ export default {
|
||||
let arr = []
|
||||
for (let i = 0; i < this.formData.files.length; i++) {
|
||||
let item = this.formData.files[i]
|
||||
console.log(item);
|
||||
arr.push({
|
||||
name: 'files',
|
||||
url: item.url,
|
||||
uri: item.url,
|
||||
})
|
||||
}
|
||||
let data = JSON.parse(JSON.stringify(this.formData))
|
||||
delete data.files
|
||||
addAppProject(data, arr).then((res) => {
|
||||
console.warn(res);
|
||||
if (res.length === 1) {
|
||||
this.$util.toast(res[0].message)
|
||||
return
|
||||
}
|
||||
|
||||
console.log(res)
|
||||
this.$util.toast('项目创建成功')
|
||||
this.$util.prePage().store?.reload()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1500);
|
||||
}, 1500)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user