diff --git a/common/api/gc.js b/common/api/gc.js
index fa8b05a..109b936 100644
--- a/common/api/gc.js
+++ b/common/api/gc.js
@@ -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',
diff --git a/common/api/project.js b/common/api/project.js
index 71a52fa..306b989 100644
--- a/common/api/project.js
+++ b/common/api/project.js
@@ -1,19 +1,18 @@
import request from '../js/request'
import config from '../js/config'
-export function addAppProject (params, files) {
+export function addAppProject(params, files) {
return uni.uploadFile({
url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址
files: files,
header: {
- "Authorization": "12",
+ Authorization: '12',
},
formData: params,
- });
+ })
}
-
-export function getProjectList (params) {
+export function getProjectList(params) {
return request({
url: '/project/queryProject',
method: 'post',
@@ -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
+ ),
+ })
+}
diff --git a/common/js/util.js b/common/js/util.js
index f82f35b..7f39edc 100644
--- a/common/js/util.js
+++ b/common/js/util.js
@@ -12,7 +12,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
})
setTimeout(() => {
call && call()
- }, duration);
+ }, duration)
}
/**
* @description 格式化时间
@@ -20,7 +20,7 @@ const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
* @param cFormat
* @returns {string|null}
*/
-function parseTime (time, cFormat) {
+function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null
}
@@ -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,14 +58,13 @@ function parseTime (time, cFormat) {
})
}
-
/**
* @description 格式化时间
* @param time
* @param option
* @returns {string}
*/
-function formatTime (time, option) {
+function formatTime(time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
@@ -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;
- uni.setStorage({
- key: 'userInfo',
- data: global_config,
- })
- if (call) {
- call(global_config);
- }
- for (var i = 0; i < globalConfigCallbacks.length; i++) {
- globalConfigCallbacks[i](global_config);
- }
- globalConfigCallbacks = [];
- }).catch(err => {
- globalConfigIsLoading = false;
- console.warn(err);
- // uni.reLaunch({ url: '/pages/user/login' })
})
+ .then((rs) => {
+ globalConfigIsLoading = false
+ global_config = rs.data
+ uni.setStorage({
+ key: 'userInfo',
+ data: global_config,
+ })
+ if (call) {
+ call(global_config)
+ }
+ for (var i = 0; i < globalConfigCallbacks.length; i++) {
+ globalConfigCallbacks[i](global_config)
+ }
+ 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,
}
diff --git a/pages.json b/pages.json
index 5560919..32fbb7f 100644
--- a/pages.json
+++ b/pages.json
@@ -309,6 +309,12 @@
"navigationBarTitleText": "工程列表"
}
},
+ {
+ "path": "pages/gc/detail",
+ "style": {
+ "navigationBarTitleText": "工程详情"
+ }
+ },
{
"path": "pages/user/erweima",
"style": {
diff --git a/pages/gc/detail.vue b/pages/gc/detail.vue
new file mode 100644
index 0000000..2c2aa3d
--- /dev/null
+++ b/pages/gc/detail.vue
@@ -0,0 +1,231 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备个数
+ 3
+
+
+ 用户个数
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/gc/list.vue b/pages/gc/list.vue
index 5b2b817..e06160f 100644
--- a/pages/gc/list.vue
+++ b/pages/gc/list.vue
@@ -1,23 +1,32 @@
-
+
-
+
区域
- {{ item.province +item.city}}
+ {{ item.provinceName + item.cityName }}
创建时间
- {{ item.createTime}}
+ {{ item.createTime }}
-
+
@@ -27,40 +36,41 @@
import list from '../../common/js/list'
export default {
mixins: [list],
- data () {
+ data() {
return {
loading: false,
- userInfo: {}
+ userInfo: {},
}
},
methods: {
- init () {
+ init() {
this.store = this.DataSource('/engineering/queryEngineeringPage')
- this.store.params.userId = uni.getStorageSync('userInfo').id
+ this.store.params.userId = uni.getStorageSync('userInfo').id
this.store.reload()
},
- back () {
+ back() {
uni.navigateBack()
},
- add () {
+ add() {
uni.navigateTo({
- url: `/pages/gc/new`
+ url: `/pages/gc/new`,
})
},
- upgrade (code) {
- console.log(code);
+ upgrade(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 () {
+
+ onLoad() {
this.init()
},
}
@@ -140,4 +150,4 @@ export default {
margin-bottom: 0;
}
}
-
\ No newline at end of file
+
diff --git a/pages/gc/new.vue b/pages/gc/new.vue
index 560034e..db5538b 100644
--- a/pages/gc/new.vue
+++ b/pages/gc/new.vue
@@ -1,7 +1,7 @@
-
-
-
+
+
+
@@ -17,8 +17,7 @@
-
+
@@ -38,10 +37,10 @@ export default {
localdata: area,
loading: false,
formData: {
- city: "",
- description: "",
- name: "",
- province: "",
+ city: '',
+ description: '',
+ name: '',
+ province: '',
},
}
},
@@ -49,40 +48,41 @@ 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
}
-
+
if (!this.formData.province) {
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)
})
- }
- }
+ },
+ },
}
-
\ No newline at end of file
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index fac9980..41570ba 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -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,
diff --git a/pages/project/detail.vue b/pages/project/detail.vue
index 5b00246..65fb4e8 100644
--- a/pages/project/detail.vue
+++ b/pages/project/detail.vue
@@ -1,48 +1,80 @@
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/pages/project/list.vue b/pages/project/list.vue
index 8f884d1..74e87e8 100644
--- a/pages/project/list.vue
+++ b/pages/project/list.vue
@@ -1,11 +1,20 @@
-
+
-
+
设备个数
@@ -17,7 +26,7 @@
-
+
@@ -27,39 +36,39 @@
import list from '../../common/js/list'
export default {
mixins: [list],
- data () {
+ data() {
return {
loading: false,
- userInfo: {}
+ userInfo: {},
}
},
methods: {
- init () {
+ init() {
this.store = this.DataSource('/project/queryProject')
this.store.reload()
},
- back () {
+ back() {
uni.navigateBack()
},
- add () {
+ add() {
uni.navigateTo({
- url: `/pages/project/new`
+ url: `/pages/project/new`,
})
},
- upgrade (code) {
- console.log(code);
+ upgrade(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 () {
+ onLoad() {
this.init()
},
}
@@ -139,4 +148,4 @@ export default {
margin-bottom: 0;
}
}
-
\ No newline at end of file
+
diff --git a/pages/project/new.vue b/pages/project/new.vue
index ac52cd1..129beda 100644
--- a/pages/project/new.vue
+++ b/pages/project/new.vue
@@ -5,7 +5,12 @@
-
+
@@ -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)
})
},
},