基础接口对接

This commit is contained in:
仲么了
2023-05-25 10:10:22 +08:00
parent cca66bab21
commit e9b1e9a417
11 changed files with 579 additions and 171 deletions

View File

@@ -1,7 +1,7 @@
import request from '../js/request'; import request from '../js/request';
import config from '../js/config'; import config from '../js/config';
export function addEngineering(params, files) { export function addEngineering(params) {
return request({ return request({
url: '/engineering/addEngineering', url: '/engineering/addEngineering',
method: 'post', method: 'post',

View File

@@ -6,13 +6,12 @@ export function addAppProject (params, files) {
url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址 url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址
files: files, files: files,
header: { header: {
"Authorization": "12", Authorization: '12',
}, },
formData: params, formData: params,
}); })
} }
export function getProjectList(params) { export function getProjectList(params) {
return request({ return request({
url: '/project/queryProject', 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
),
})
}

View File

@@ -12,7 +12,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
}) })
setTimeout(() => { setTimeout(() => {
call && call() call && call()
}, duration); }, duration)
} }
/** /**
* @description 格式化时间 * @description 格式化时间
@@ -44,7 +44,7 @@ function parseTime (time, cFormat) {
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay() a: date.getDay(),
} }
return format.replace(/{([ymdhisa])+}/g, (result, key) => { return format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key] let value = formatObj[key]
@@ -58,7 +58,6 @@ function parseTime (time, cFormat) {
}) })
} }
/** /**
* @description 格式化时间 * @description 格式化时间
* @param time * @param time
@@ -88,11 +87,7 @@ function formatTime (time, option) {
return '1天前' return '1天前'
} }
return ( return (
d.getMonth() + d.getMonth() + 1 + '月' + d.getDate() + '日'
1 +
'月' +
d.getDate() +
'日'
// + // +
// d.getHours() + // d.getHours() +
// '时' // '时'
@@ -122,24 +117,23 @@ const validatePhoneNumber = (phone) => {
return testReg.test(phone) return testReg.test(phone)
} }
const getUserLocation = (call) => { const getUserLocation = (call) => {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: function (address) { success: function (address) {
call(address) call(address)
}, },
fail: err => { fail: (err) => {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '定位失败,请打开定位权限', content: '定位失败,请打开定位权限',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
uni.openSetting({ uni.openSetting({
success: resSett => { success: (resSett) => {
if (resSett.authSetting['scope.userLocation']) { if (resSett.authSetting['scope.userLocation']) {
uni.getLocation({ uni.getLocation({
success: address => { success: (address) => {
call && call(address) call && call(address)
}, },
}) })
@@ -147,7 +141,7 @@ const getUserLocation = (call) => {
}, },
}) })
} }
} },
}) })
}, },
}) })
@@ -156,7 +150,7 @@ const getUserLocation = (call) => {
// 加载用户配置 // 加载用户配置
var globalConfigIsLoading = false, var globalConfigIsLoading = false,
global_config = null, global_config = null,
globalConfigCallbacks = []; globalConfigCallbacks = []
/** /**
* 加载用户配置 * 加载用户配置
* @param call 加载成功后的回调 * @param call 加载成功后的回调
@@ -164,41 +158,44 @@ var globalConfigIsLoading = false,
*/ */
const loadConfig = (call, need_fresh = false) => { const loadConfig = (call, need_fresh = false) => {
if (call && global_config && !need_fresh) { if (call && global_config && !need_fresh) {
call(global_config); call(global_config)
return; return
} }
if (globalConfigIsLoading) { if (globalConfigIsLoading) {
globalConfigCallbacks.push(call); globalConfigCallbacks.push(call)
return; return
} }
globalConfigIsLoading = true; globalConfigIsLoading = true
request({ request({
url: '/org/userResource/userMsg', url: '/org/userResource/userMsg',
}).then(rs => { })
.then((rs) => {
globalConfigIsLoading = false; globalConfigIsLoading = false
global_config = rs.data; global_config = rs.data
uni.setStorage({ uni.setStorage({
key: 'userInfo', key: 'userInfo',
data: global_config, data: global_config,
}) })
if (call) { if (call) {
call(global_config); call(global_config)
} }
for (var i = 0; i < globalConfigCallbacks.length; i++) { for (var i = 0; i < globalConfigCallbacks.length; i++) {
globalConfigCallbacks[i](global_config); globalConfigCallbacks[i](global_config)
} }
globalConfigCallbacks = []; globalConfigCallbacks = []
}).catch(err => { })
globalConfigIsLoading = false; .catch((err) => {
console.warn(err); globalConfigIsLoading = false
console.warn(err)
// uni.reLaunch({ url: '/pages/user/login' }) // uni.reLaunch({ url: '/pages/user/login' })
}) })
} }
const prePage = () => {
let pages = getCurrentPages()
let prePage = pages[pages.length - 2]
return prePage
}
export default { export default {
validatePhoneNumber, validatePhoneNumber,
@@ -208,4 +205,5 @@ export default {
h5Helper, h5Helper,
getUserLocation, getUserLocation,
loadConfig, loadConfig,
prePage,
} }

View File

@@ -309,6 +309,12 @@
"navigationBarTitleText": "工程列表" "navigationBarTitleText": "工程列表"
} }
}, },
{
"path": "pages/gc/detail",
"style": {
"navigationBarTitleText": "工程详情"
}
},
{ {
"path": "pages/user/erweima", "path": "pages/user/erweima",
"style": { "style": {

231
pages/gc/detail.vue Normal file
View 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>

View File

@@ -1,15 +1,24 @@
<template> <template>
<view :loading="loading"> <view :loading="loading">
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> --> <!-- <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'" <uni-nav-bar
background-color="#fff" color="#111" title="工程管理" @clickLeft="back" @clickRight="add" /> 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"> <view class="message">
<uni-card :title="item.name" :extra="item.projectType" @click="jump('XXX项目1')" <uni-card :title="item.name" :extra="item.projectType" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
v-for="(item, index) in store.data" :key="index">
<view class="term-list-bottom"> <view class="term-list-bottom">
<view class="term-list-bottom-item"> <view class="term-list-bottom-item">
<view>区域</view> <view>区域</view>
<view>{{ item.province +item.city}}</view> <view>{{ item.provinceName + item.cityName }}</view>
</view> </view>
<view class="term-list-bottom-item"> <view class="term-list-bottom-item">
<view>创建时间</view> <view>创建时间</view>
@@ -30,7 +39,7 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
userInfo: {} userInfo: {},
} }
}, },
methods: { methods: {
@@ -44,22 +53,23 @@ export default {
}, },
add() { add() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/gc/new` url: `/pages/gc/new`,
}) })
}, },
upgrade(code) { upgrade(code) {
console.log(code); console.log(code)
uni.showToast({ uni.showToast({
title: '升级成功', title: '升级成功',
icon: 'none' icon: 'none',
}) })
}, },
jump (type) { jump(gc) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/project/detail?project=${type}` url: `/pages/gc/detail?gc=${JSON.stringify(gc)}`,
}) })
}
}, },
},
onLoad() { onLoad() {
this.init() this.init()
}, },

View File

@@ -1,7 +1,7 @@
<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-forms-item label="工程名称">
@@ -17,8 +17,7 @@
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker> <uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
</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-forms> </uni-forms>
</view> </view>
@@ -38,10 +37,10 @@ export default {
localdata: area, localdata: area,
loading: false, loading: false,
formData: { formData: {
city: "", city: '',
description: "", description: '',
name: "", name: '',
province: "", province: '',
}, },
} }
}, },
@@ -49,35 +48,36 @@ export default {
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)
} },
}); })
// console.log(area); // console.log(area);
console.log( this.$util.prePage());
}, },
methods: { methods: {
areaChange(e) { areaChange(e) {
console.log(e); console.log(e)
this.formData.province = e.detail.value[0].value this.formData.province = e.detail.value[0].value
this.formData.city = e.detail.value[1].value this.formData.city = e.detail.value[1].value
}, },
select(e) { select(e) {
console.log(e); console.log(e)
}, },
chooseLocation() { 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
@@ -91,18 +91,19 @@ export default {
this.$util.toast('请输入工程描述') this.$util.toast('请输入工程描述')
return return
} }
addEngineering(this.formData).then(res => { addEngineering(this.formData).then((res) => {
console.log(res) console.log(res)
this.$util.toast('工程创建成功') this.$util.toast('工程创建成功')
this.$util.prePage().store?.reload()
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;

View File

@@ -137,6 +137,7 @@ export default {
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,
id: 1,
}) })
let roleName = '' let roleName = ''
switch (e.index + 1) { switch (e.index + 1) {
@@ -247,6 +248,7 @@ export default {
if (!this.userInfo) { if (!this.userInfo) {
this.userInfo = { this.userInfo = {
role: 4, role: 4,
id: 1,
} }
uni.setStorageSync('userInfo', { uni.setStorageSync('userInfo', {
role: 4, role: 4,

View File

@@ -1,23 +1,38 @@
<template> <template>
<Cn-page :loading='loading' noPadding> <Cn-page :loading="loading" noPadding>
<view slot='body'> <view slot="body">
<view class='detail'> <view class="detail">
<view class="header"> <view class="header">
<view class="header-title">{{ project }} <view class="header-title"
<view class="header-title-extra">用能</view> >{{ project.name }}
<!-- <view class="header-title-extra">用能</view> -->
</view> </view>
<view class="header-des">项目详情</view> <view class="header-des">{{ project.description }}</view>
</view> </view>
<view class="nav"> <view class="nav">
<view class="nav-menu " :class="{ 'nav-menu-active': navMenuActive == index }" <view
v-for="(item, index) in navMenuList" :key="index" @click="navMenuClick(index)">{{ item.text }} 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> </view>
<view class="content device" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }"> <view class="content device" :style="{ minHeight: 'calc(100vh - ' + navHeight + 'px)' }">
<view v-show="navMenuActive == 0"> <view v-show="navMenuActive == 0">
<uni-card :title="'设备' + item" :sub-title="project" extra="用能" v-for="item in 2" :key="item" <uni-card
@click="goDevice" padding="0" thumbnail="/static/device.png"> :title="item.equipmentName"
sub-title="创建时间"
v-for="item in store.data"
:key="item.equipmentId"
@click="goDevice"
padding="0"
thumbnail="/static/device.png"
>
</uni-card> </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>
<view style="padding: 0 20rpx" v-show="navMenuActive == 1"> <view style="padding: 0 20rpx" v-show="navMenuActive == 1">
<uni-list> <uni-list>
@@ -36,13 +51,30 @@
</uni-list> </uni-list>
</view> </view>
<view style="padding: 0 20rpx" v-show="navMenuActive == 2"> <view style="padding: 0 20rpx" v-show="navMenuActive == 2">
<image class="gplot gplot-box" mode="aspectFill" src="/static/test2.pic.png" <!-- <image
v-for="(item, key) in 3" :key="key" /> 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> </view>
<uni-load-more status="nomore"></uni-load-more>
</view> </view>
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content" <uni-fab
@trigger="trigger" v-if="content.length" /> 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 ref="share" type="share" background-color="#fff">
<uni-popup-share title="分享到"></uni-popup-share> <uni-popup-share title="分享到"></uni-popup-share>
</uni-popup> </uni-popup>
@@ -51,29 +83,55 @@
</Cn-page> </Cn-page>
</template> </template>
<script> <script>
import list from '../../common/js/list'
import { queryTopologyDiagramPage, deleteAppTopologyDiagram, addAppTopologyDiagram } from '../../common/api/project'
export default { export default {
mixins: [list],
data() { data() {
return { return {
loading: false, loading: false,
project: '', project: {},
navMenuList: [{ navMenuList: [
text: '设备' {
}, { text: '设备',
text: '子用户' },
}, { {
text: '拓扑图' text: '子用户',
}], },
{
text: '拓扑图',
},
],
content: [], content: [],
navHeight: 0, navHeight: 0,
navMenuActive: 0 navMenuActive: 0,
topologyDiagramPage: [],
} }
}, },
methods: { 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) { trigger(e) {
console.log(this.$refs); console.log(this.$refs)
if (e.item.text == '移交') { if (e.item.text == '移交') {
uni.navigateTo({ uni.navigateTo({
url: '/pages/project/transfer' url: '/pages/project/transfer',
}) })
} else if (e.item.text == '分享') { } else if (e.item.text == '分享') {
this.$refs.share.open() this.$refs.share.open()
@@ -84,11 +142,11 @@ export default {
}, },
goUserDetail() { goUserDetail() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/mine/userDetail' url: '/pages/mine/userDetail',
}) })
}, },
del() { del() {
console.log('del'); console.log('del')
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确定要移除该成员吗?', content: '确定要移除该成员吗?',
@@ -98,18 +156,35 @@ export default {
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消') console.log('用户点击取消')
} }
} },
}) })
}, },
goDevice() { goDevice() {
uni.navigateTo({ 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) { onLoad(option) {
this.project = option.project
let userInfo = uni.getStorageSync('userInfo') let userInfo = uni.getStorageSync('userInfo')
if (userInfo.role == '3') { if (userInfo.role == '3') {
this.content.push({ this.content.push({
@@ -124,15 +199,20 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
// 获取nav高度 // 获取nav高度
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => { uni.createSelectorQuery()
.select('.nav')
.boundingClientRect((rect) => {
this.navHeight = rect.height this.navHeight = rect.height
}).exec() })
}, 1000); .exec()
}, 1000)
this.project = JSON.parse(option.project)
this.init()
// uni.setNavigationBarTitle({ title: this.project }) // uni.setNavigationBarTitle({ title: this.project })
} },
} }
</script> </script>
<style lang='scss'> <style lang="scss">
.detail { .detail {
.content { .content {
box-sizing: border-box; box-sizing: border-box;
@@ -162,7 +242,6 @@ export default {
} }
} }
.footer-btn { .footer-btn {
padding: 0 20rpx; padding: 0 20rpx;
height: 50rpx; height: 50rpx;
@@ -173,9 +252,13 @@ export default {
line-height: 50rpx; line-height: 50rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
/deep/ .is-add {
background-color: #fff;
}
} }
.gplot { .gplot {
box-sizing: border-box;
position: relative; position: relative;
width: 100%; width: 100%;
border: 8rpx solid #ccc; border: 8rpx solid #ccc;

View File

@@ -1,11 +1,20 @@
<template> <template>
<view :loading="loading"> <view :loading="loading">
<!-- <uni-nav-bar left-icon="left" right-icon="cart" title="标题" /> --> <!-- <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'" <uni-nav-bar
background-color="#fff" color="#111" title="项目管理" @clickLeft="back" @clickRight="add" /> 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"> <view class="message">
<uni-card :title="item.name" :extra="item.projectType" @click="jump('XXX项目1')" <uni-card :title="item.name" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
v-for="(item, index) in store.data" :key="index">
<view class="term-list-bottom"> <view class="term-list-bottom">
<view class="term-list-bottom-item"> <view class="term-list-bottom-item">
<view>设备个数</view> <view>设备个数</view>
@@ -17,7 +26,7 @@
</view> </view>
</view> </view>
</uni-card> </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> <uni-load-more v-if="store.data && store.data.length > 0" :status="store.status"></uni-load-more>
</view> </view>
</view> </view>
@@ -30,7 +39,7 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
userInfo: {} userInfo: {},
} }
}, },
methods: { methods: {
@@ -43,21 +52,21 @@ export default {
}, },
add() { add() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/project/new` url: `/pages/project/new`,
}) })
}, },
upgrade(code) { upgrade(code) {
console.log(code); console.log(code)
uni.showToast({ uni.showToast({
title: '升级成功', title: '升级成功',
icon: 'none' icon: 'none',
}) })
}, },
jump (type) { jump(project) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/project/detail?project=${type}` url: `/pages/project/detail?project=${JSON.stringify(project)}`,
}) })
} },
}, },
onLoad() { onLoad() {
this.init() this.init()

View File

@@ -5,7 +5,12 @@
<view class="content"> <view class="content">
<uni-forms :label-width="80"> <uni-forms :label-width="80">
<uni-forms-item label="工程名称"> <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>
<uni-forms-item label="项目名称"> <uni-forms-item label="项目名称">
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" /> <uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
@@ -162,19 +167,27 @@ export default {
let arr = [] let arr = []
for (let i = 0; i < this.formData.files.length; i++) { for (let i = 0; i < this.formData.files.length; i++) {
let item = this.formData.files[i] let item = this.formData.files[i]
console.log(item);
arr.push({ arr.push({
name: 'files', name: 'files',
url: item.url, uri: 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.warn(res);
if (res.length === 1) {
this.$util.toast(res[0].message)
return
}
console.log(res) console.log(res)
this.$util.toast('项目创建成功') this.$util.toast('项目创建成功')
this.$util.prePage().store?.reload()
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ delta: 1 }) uni.navigateBack({ delta: 1 })
}, 1500); }, 1500)
}) })
}, },
}, },