接口对接修改
This commit is contained in:
8
App.vue
8
App.vue
@@ -3,6 +3,7 @@ import { queryDictDataCache } from './common/api/dictionary.js'
|
|||||||
import encrypt from './common/js/aes.js'
|
import encrypt from './common/js/aes.js'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
|
console.log(window);
|
||||||
// this.connect()
|
// this.connect()
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
let devCode = uni.getStorageSync('devCode')
|
let devCode = uni.getStorageSync('devCode')
|
||||||
@@ -13,13 +14,12 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
queryDictDataCache().then((res) => {
|
|
||||||
uni.setStorageSync(this.$cacheKey.dictData, res.data)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
|
queryDictDataCache().then((res) => {
|
||||||
|
uni.setStorageSync(this.$cacheKey.dictData, res.data)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ export function getModel(nDid) {
|
|||||||
url: '/access-boot/device/model',
|
url: '/access-boot/device/model',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
nDid
|
nDid,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 直连设备接入
|
// 直连设备接入
|
||||||
export function addDevice(params) {
|
export function addDevice(params) {
|
||||||
return request({
|
return request({
|
||||||
@@ -54,7 +53,37 @@ export function registerDevice(nDid) {
|
|||||||
url: '/access-boot/device/register',
|
url: '/access-boot/device/register',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
nDid
|
nDid,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询拓扑图模板
|
||||||
|
export const getTopoTemplate = () => {
|
||||||
|
return request({
|
||||||
|
url: '/cs-device-boot/topologyTemplate/queryImage',
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询拓扑图模板监测点
|
||||||
|
export const queryByTopoId = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/cs-device-boot/lineTemplate/queryByTopoId',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
topoId:id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查询装置拓扑图
|
||||||
|
export const queryTopologyDiagram = (devId) => {
|
||||||
|
return request({
|
||||||
|
url: '/cs-device-boot/lineTopologyDiagram/queryTopologyDiagram',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
devId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ export function apiPwdLogin(params) {
|
|||||||
|
|
||||||
//登录获取公钥
|
//登录获取公钥
|
||||||
export function gongkey(data) {
|
export function gongkey(data) {
|
||||||
|
console.log(data);
|
||||||
return request({
|
return request({
|
||||||
url: '/user-boot/user/generateSm2Key',
|
url: '/user-boot/user/generateSm2Key',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ page {
|
|||||||
|
|
||||||
.grid-card-content-4,
|
.grid-card-content-4,
|
||||||
.grid-card-content-2,
|
.grid-card-content-2,
|
||||||
|
.grid-card-content-1,
|
||||||
.grid-card-content-3,
|
.grid-card-content-3,
|
||||||
.grid-card-content-5,
|
.grid-card-content-5,
|
||||||
.grid-card-content-6 {
|
.grid-card-content-6 {
|
||||||
@@ -114,15 +115,19 @@ page {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 2rpx solid #ccc;
|
border-bottom: 2rpx solid #ccc;
|
||||||
border-right: 2rpx solid #ccc;
|
border-right: 2rpx solid #ccc;
|
||||||
min-height: 100rpx;
|
padding: 4rpx;
|
||||||
background: $uni-theme-white;
|
background: $uni-theme-white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
background: unset;
|
background: unset;
|
||||||
|
padding: 8rpx 4rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid-card-content-1 {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
.grid-card-content-2 {
|
.grid-card-content-2 {
|
||||||
grid-template-columns: 1fr 2fr;
|
grid-template-columns: 1fr 2fr;
|
||||||
}
|
}
|
||||||
@@ -253,4 +258,25 @@ page {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: red;
|
background: red;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.popup-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 20rpx 20rpx 0 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
.popup-header-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.popup-header-close {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
const debug = true // true 是连地服务端本地,false 是连接线上
|
const debug = true // true 是连地服务端本地,false 是连接线上
|
||||||
|
|
||||||
const development = {
|
const development = {
|
||||||
domain: 'http://192.168.1.114:10210',
|
domain: 'http://192.168.1.139:10215',
|
||||||
devCode: "2aaecd0b124df819eda75e639a1f91fd",
|
devCode: "2aaecd0b124df819eda75e639a1f91fd",
|
||||||
key: "f81804778c89c779"
|
key: "f81804778c89c779"
|
||||||
}
|
}
|
||||||
|
|
||||||
const production = {
|
const production = {
|
||||||
domain: 'http://192.168.1.60:8094',
|
domain: 'http://192.168.1.13:10215',
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = debug ? development : production
|
const config = debug ? development : production
|
||||||
|
|||||||
71
common/js/drawMixin.js
Normal file
71
common/js/drawMixin.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// 屏幕适配 mixin 函数
|
||||||
|
|
||||||
|
// * 默认缩放值
|
||||||
|
const scale = {
|
||||||
|
width: '1',
|
||||||
|
height: '1',
|
||||||
|
};
|
||||||
|
|
||||||
|
// * 设计稿尺寸(px)
|
||||||
|
const baseWidth = 375;
|
||||||
|
const baseHeight = 667;
|
||||||
|
|
||||||
|
// * 需保持的比例(默认1.77778)
|
||||||
|
const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5));
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// * 定时函数
|
||||||
|
drawTiming: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.calcRate();
|
||||||
|
window.addEventListener('resize', this.resize);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.resize);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
calcRate() {
|
||||||
|
const appRef = this.$refs['appRef'];
|
||||||
|
const fatherRef = this.$refs['fatherRef'];
|
||||||
|
if (!appRef) return;
|
||||||
|
// 当前宽高比
|
||||||
|
const currentRate = parseFloat(
|
||||||
|
(fatherRef.offsetWidth / fatherRef.offsetHeight).toFixed(5)
|
||||||
|
);
|
||||||
|
if (appRef) {
|
||||||
|
if (currentRate > baseProportion) {
|
||||||
|
// 表示更宽
|
||||||
|
scale.width = (
|
||||||
|
(fatherRef.offsetHeight * baseProportion) /
|
||||||
|
baseWidth
|
||||||
|
).toFixed(5);
|
||||||
|
scale.height = (
|
||||||
|
fatherRef.offsetHeight / baseHeight
|
||||||
|
).toFixed(5);
|
||||||
|
appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`;
|
||||||
|
} else {
|
||||||
|
// 表示更高
|
||||||
|
scale.height = (
|
||||||
|
fatherRef.offsetWidth /
|
||||||
|
baseProportion /
|
||||||
|
baseHeight
|
||||||
|
).toFixed(5);
|
||||||
|
scale.width = (fatherRef.offsetWidth / baseWidth).toFixed(
|
||||||
|
5
|
||||||
|
);
|
||||||
|
appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resize() {
|
||||||
|
clearTimeout(this.drawTiming);
|
||||||
|
this.drawTiming = setTimeout(() => {
|
||||||
|
this.calcRate();
|
||||||
|
}, 200);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
export const MQTT_IP = '60.204.148.71:9001'//mqtt地址端口, 使用emqx时一定要加mqtt
|
export const MQTT_IP = '192.168.1.18:8083/mqtt'//mqtt地址端口, 使用emqx时一定要加mqtt
|
||||||
const MQTT_USERNAME = 'test'//mqtt用户名
|
const MQTT_USERNAME = 't_user'//mqtt用户名
|
||||||
const MQTT_PASSWORD = 'test'//密码
|
const MQTT_PASSWORD = 'njcnpqs'//密码
|
||||||
|
|
||||||
export const MQTT_OPTIONS = {
|
export const MQTT_OPTIONS = {
|
||||||
connectTimeout: 5000,
|
connectTimeout: 5000,
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import CryptoJS from 'crypto-js'
|
import CryptoJS from 'crypto-js'
|
||||||
|
if(typeof navigator === 'undefined') {
|
||||||
|
var navigator = {
|
||||||
|
appName: 'Netscape',
|
||||||
|
};
|
||||||
|
var window = {};
|
||||||
|
}
|
||||||
function SM2Cipher(a) {
|
function SM2Cipher(a) {
|
||||||
this.ct = 1;
|
this.ct = 1;
|
||||||
this.sm3c3 = this.sm3keybase = this.p2 = null;
|
this.sm3c3 = this.sm3keybase = this.p2 = null;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import request from './request'
|
import request from './request'
|
||||||
import cache from './cacheKey.js'
|
import cache from './cacheKey.js'
|
||||||
|
import { queryDictDataCache } from '../api/dictionary.js'
|
||||||
|
import cacheKey from './cacheKey.js'
|
||||||
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
||||||
if (Boolean(title) === false) {
|
if (Boolean(title) === false) {
|
||||||
return
|
return
|
||||||
@@ -198,14 +200,23 @@ const prePage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loginSuccess = (data) => {
|
const loginSuccess = (data) => {
|
||||||
|
console.log(data);
|
||||||
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
||||||
uni.setStorageSync('refresh_token', data.refresh_token)
|
uni.setStorageSync('refresh_token', data.refresh_token)
|
||||||
let strings = data.access_token.split('.') //截取token,获取载体
|
let strings = data.access_token.split('.') //截取token,获取载体
|
||||||
var userInfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
console.log(escape,atob);
|
||||||
|
var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||||
userInfo.authorities = userInfo.authorities[0]
|
userInfo.authorities = userInfo.authorities[0]
|
||||||
uni.setStorageSync('userInfo', userInfo)
|
uni.setStorageSync('userInfo', userInfo)
|
||||||
uni.reLaunch({
|
console.log('reLaunch');
|
||||||
url: '/pages/index/index',
|
queryDictDataCache().then((res) => {
|
||||||
|
uni.setStorageSync(cacheKey.dictData, res.data)
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index',
|
||||||
|
fail: (err) => {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,15 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 生成图片需要调用的方法
|
// 生成图片需要调用的方法
|
||||||
generateImage(domId) {
|
generateImage(domId) {
|
||||||
console.log(123);
|
|
||||||
// 获取设备dpi
|
// 获取设备dpi
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let dom = document.getElementById(domId);
|
let dom = document.getElementById(domId);
|
||||||
|
console.log(dom.offsetWidth, dom.offsetHeight);
|
||||||
html2canvas(dom, {
|
html2canvas(dom, {
|
||||||
scale: 8,
|
scale: 8,
|
||||||
useCORS: true,
|
useCORS: true,
|
||||||
|
width: dom.offsetWidth,
|
||||||
|
height: dom.offsetHeight,
|
||||||
}).then((canvas) => {
|
}).then((canvas) => {
|
||||||
// this.$refs.header.appendChild(canvas);
|
// this.$refs.header.appendChild(canvas);
|
||||||
const posterImg = canvas.toDataURL()
|
const posterImg = canvas.toDataURL()
|
||||||
@@ -45,7 +47,7 @@ export default {
|
|||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
}, 300);
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
main.js
1
main.js
@@ -6,6 +6,7 @@ import config from './common/js/config'
|
|||||||
import cacheKey from './common/js/cacheKey'
|
import cacheKey from './common/js/cacheKey'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import share from "@/common/js/share.js";
|
import share from "@/common/js/share.js";
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.prototype.$request = request
|
Vue.prototype.$request = request
|
||||||
Vue.prototype.$util = util
|
Vue.prototype.$util = util
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"name" : "灿能物联",
|
"name" : "灿能物联",
|
||||||
"appid" : "__UNI__88BC25B",
|
"appid" : "__UNI__88BC25B",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.2",
|
"versionName" : "1.0.3",
|
||||||
"versionCode" : 101,
|
"versionCode" : 102,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@@ -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.139:10215",
|
"target" : "http://192.168.1.115:10215",
|
||||||
"changOrigin" : true,
|
"changOrigin" : true,
|
||||||
"pathRewrite" : {
|
"pathRewrite" : {
|
||||||
"/api" : ""
|
"/api" : ""
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"mqtt": "3.0.0",
|
"mqtt": "3.0.0",
|
||||||
"pinyin-pro": "^3.13.2",
|
"pinyin-pro": "^3.13.2",
|
||||||
"qs": "^6.11.2"
|
"qs": "^6.11.2",
|
||||||
|
"vconsole": "^3.15.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/html5plus": "^1.0.2",
|
"@types/html5plus": "^1.0.2",
|
||||||
|
|||||||
@@ -306,7 +306,8 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/engineering/list",
|
"path": "pages/engineering/list",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工程列表"
|
"navigationBarTitleText": "工程列表",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -437,11 +438,7 @@
|
|||||||
//模式配置,仅开发期间生效
|
//模式配置,仅开发期间生效
|
||||||
"current": 0, //当前激活的模式(list 的索引项)
|
"current": 0, //当前激活的模式(list 的索引项)
|
||||||
"list": [
|
"list": [
|
||||||
{
|
|
||||||
"name": "login", //模式名称
|
|
||||||
"path": "pages/project/new", //启动页面,必选
|
|
||||||
"query": "" //启动参数,在页面的onLoad函数里面得到。
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='basic'>
|
<view class="basic">
|
||||||
<!-- <view class="grid-card">
|
<!-- <view class="grid-card">
|
||||||
<view class="grid-card-title">模块</view>
|
<view class="grid-card-title">模块</view>
|
||||||
<view class="grid-card-content-4">
|
<view class="grid-card-content-4">
|
||||||
@@ -28,27 +28,15 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
<view class="grid-card-title">电网电流</view>
|
<view class="grid-card-title">电网电流</view>
|
||||||
<view class="grid-card-content-4">
|
<view class="grid-card-content-3">
|
||||||
<view class="item item-title">名称</view>
|
<view class="item item-title">名称</view>
|
||||||
<view class="item item-title">有效值(A)</view>
|
<view class="item item-title">有效值(A)</view>
|
||||||
<view class="item item-title">cosp</view>
|
|
||||||
<view class="item item-title">THDI(%)</view>
|
<view class="item item-title">THDI(%)</view>
|
||||||
<view class="item">L1</view>
|
<template v-for="(item, index) in renderData.电网侧">
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item">{{ item['A(A)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['ThdPhI(%)'] }}</view>
|
||||||
<view class="item">L2</view>
|
</template>
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">N</view>
|
|
||||||
<view class="item">3.9</view>
|
|
||||||
<view class="item"></view>
|
|
||||||
<view class="item"></view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
@@ -58,74 +46,112 @@
|
|||||||
<view class="item item-title">电压(V)</view>
|
<view class="item item-title">电压(V)</view>
|
||||||
<view class="item item-title">频率(Hz)</view>
|
<view class="item item-title">频率(Hz)</view>
|
||||||
<view class="item item-title">THDU(%)</view>
|
<view class="item item-title">THDU(%)</view>
|
||||||
<view class="item">L1</view>
|
<template v-for="(item, index) in renderData.电网侧">
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item">{{ item['PhV(V)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['Hz(Hz)'] }}</view>
|
||||||
<view class="item">L2</view>
|
<view class="item">{{ item['ThdPhV(%)'] }}</view>
|
||||||
<view class="item">226.8</view>
|
</template>
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
<view class="grid-card-title">负载电流</view>
|
<view class="grid-card-title">负载电流</view>
|
||||||
<view class="grid-card-content-4">
|
<view class="grid-card-content-3">
|
||||||
<view class="item item-title">名称</view>
|
<view class="item item-title">名称</view>
|
||||||
<view class="item item-title">有效值(A)</view>
|
<view class="item item-title">有效值(A)</view>
|
||||||
<view class="item item-title">cosp</view>
|
|
||||||
<view class="item item-title">THDI(%)</view>
|
<view class="item item-title">THDI(%)</view>
|
||||||
<view class="item">L1</view>
|
<template v-for="(item, index) in renderData.负载侧">
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item">{{ item['A(A)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['ThdPhI(%)'] }}</view>
|
||||||
<view class="item">L2</view>
|
</template>
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
<view class="grid-card-title">补偿电流</view>
|
<view class="grid-card-title">补偿电流</view>
|
||||||
<view class="grid-card-content-4">
|
<view class="grid-card-content-3">
|
||||||
<view class="item item-title">名称</view>
|
<view class="item item-title">名称</view>
|
||||||
<view class="item item-title">有效值(A)</view>
|
<view class="item item-title">有效值(A)</view>
|
||||||
<view class="item item-title">负载率(%)</view>
|
<view class="item item-title">负载率(%)</view>
|
||||||
<view class="item item-title"></view>
|
<template v-for="(item, index) in renderData.输出侧">
|
||||||
<view class="item">L1</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item['A(A)'] }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item"></view>
|
||||||
<view class="item"></view>
|
</template>
|
||||||
<view class="item">L2</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item"></view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item"></view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
renderData: {
|
||||||
|
电网侧: {},
|
||||||
|
负载侧: {},
|
||||||
|
输出侧: {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
props: {
|
||||||
}
|
deviceInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
deviceInfo: {
|
||||||
|
handler: function (newVal, oldVal) {
|
||||||
|
let arr = [
|
||||||
|
{
|
||||||
|
name: '电网侧',
|
||||||
|
position: 'cb23b9ede3b652cd6da194fd7b318124',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '负载侧',
|
||||||
|
position: '32624d4bb3a86f2b9a01bab272e50125',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '输出侧',
|
||||||
|
position: '26eae70fb5ff1c090d2dc7c3a0743948',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
this.deviceInfo.appsLineTopologyDiagramPO.forEach((item1) => {
|
||||||
|
if (item1.value.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let index = arr.findIndex((item2) => {
|
||||||
|
return item2.position === item1.linePostion
|
||||||
|
})
|
||||||
|
if(index === -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item1.value.forEach((item) => {
|
||||||
|
if(item.phase === 'avg'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.renderData[arr[index]['name']][item.phase]) {
|
||||||
|
this.renderData[arr[index]['name']][item.phase][item.statisticalName] = item.statisticalData
|
||||||
|
} else {
|
||||||
|
this.renderData[arr[index]['name']][item.phase] = {
|
||||||
|
phase: item.phase,
|
||||||
|
[item.statisticalName]: item.statisticalData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
console.warn(this.renderData)
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang="scss">
|
||||||
.basic {}
|
.basic {
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='basic'>
|
<view class="basic">
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
<view class="grid-card-title">电网侧</view>
|
<view class="grid-card-title">电网侧</view>
|
||||||
<view class="grid-card-content-5">
|
<view class="grid-card-content-5">
|
||||||
@@ -8,21 +8,13 @@
|
|||||||
<view class="item item-title">无功功率(kVar)</view>
|
<view class="item item-title">无功功率(kVar)</view>
|
||||||
<view class="item item-title">视在功率(kVA)</view>
|
<view class="item item-title">视在功率(kVA)</view>
|
||||||
<view class="item item-title">功率因数</view>
|
<view class="item item-title">功率因数</view>
|
||||||
<view class="item">L1</view>
|
<template v-for="(item, index) in renderData.电网侧">
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item">{{ item['W(W)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['VAr(var)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['VA(VA)'] }}</view>
|
||||||
<view class="item">L2</view>
|
<view class="item">{{ item['ThdPhI(%)'] }}</view>
|
||||||
<view class="item">226.8</view>
|
</template>
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="grid-card">
|
<view class="grid-card">
|
||||||
@@ -33,35 +25,87 @@
|
|||||||
<view class="item item-title">无功功率(kVar)</view>
|
<view class="item item-title">无功功率(kVar)</view>
|
||||||
<view class="item item-title">视在功率(kVA)</view>
|
<view class="item item-title">视在功率(kVA)</view>
|
||||||
<view class="item item-title">功率因数</view>
|
<view class="item item-title">功率因数</view>
|
||||||
<view class="item">L1</view>
|
<template v-for="(item, index) in renderData.电网侧">
|
||||||
<view class="item">226.8</view>
|
<view class="item">{{ item.phase }}</view>
|
||||||
<view class="item">50.0</view>
|
<view class="item">{{ item['W(W)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['VAr(var)'] }}</view>
|
||||||
<view class="item">4.6</view>
|
<view class="item">{{ item['VA(VA)'] }}</view>
|
||||||
<view class="item">L2</view>
|
<view class="item">{{ item['ThdPhI(%)'] }}</view>
|
||||||
<view class="item">226.8</view>
|
</template>
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">226.8</view>
|
|
||||||
<view class="item">50.0</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
<view class="item">4.6</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
renderData: {
|
||||||
|
电网侧: {},
|
||||||
|
负载侧: {},
|
||||||
|
输出侧: {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
props: {
|
||||||
}
|
deviceInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
deviceInfo: {
|
||||||
|
handler: function (newVal, oldVal) {
|
||||||
|
let arr = [
|
||||||
|
{
|
||||||
|
name: '电网侧',
|
||||||
|
position: 'cb23b9ede3b652cd6da194fd7b318124',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '负载侧',
|
||||||
|
position: '32624d4bb3a86f2b9a01bab272e50125',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '输出侧',
|
||||||
|
position: '26eae70fb5ff1c090d2dc7c3a0743948',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
this.deviceInfo.appsLineTopologyDiagramPO.forEach((item1) => {
|
||||||
|
if (item1.value.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let index = arr.findIndex((item2) => {
|
||||||
|
return item2.position === item1.linePostion
|
||||||
|
})
|
||||||
|
if (index === -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item1.value.forEach((item) => {
|
||||||
|
if(item.phase === 'avg'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.renderData[arr[index]['name']][item.phase]) {
|
||||||
|
this.renderData[arr[index]['name']][item.phase][item.statisticalName] = item.statisticalData
|
||||||
|
} else {
|
||||||
|
this.renderData[arr[index]['name']][item.phase] = {
|
||||||
|
phase: item.phase,
|
||||||
|
[item.statisticalName]: item.statisticalData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
console.warn(this.renderData)
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang="scss">
|
||||||
.basic {}
|
.basic {
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,44 +1,22 @@
|
|||||||
<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="detail-header">
|
<view class="detail-header">
|
||||||
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
<Cn-htmlToImg domId="header" @renderFinish="renderFinish">
|
||||||
<view class="header" ref="header" @click="previewImg">
|
<view class="header" ref="header" @click="previewImg">
|
||||||
<img src="http://ruuf2hujc.bkt.clouddn.com/%E7%94%B5%E8%B7%AF%E5%9B%BE.svg"
|
<image :src="deviceInfo.filePath" style="width: 375px" mode="widthFix" />
|
||||||
style="width: 100%;height:475rpx;object-fit:cover" />
|
<view
|
||||||
<view class="point" :style="{ left: '480rpx', top: '80rpx' }">负载THDI(%)
|
class="point"
|
||||||
<view class="grid-card mt10">
|
:style="{ left: item.lat + 'px', top: item.lng + 'px' }"
|
||||||
<view class="grid-card-content-2">
|
v-for="(item, index) in showtTarget"
|
||||||
<view class="item">L1</view>
|
:key="index"
|
||||||
<view class="item">
|
>
|
||||||
558.2
|
<view class="grid-card mt10" style="width: fit-content">
|
||||||
</view>
|
<view class="grid-card-content-1">
|
||||||
<view class="item">L2</view>
|
<view class="item">{{ item.label }}</view>
|
||||||
<view class="item">
|
<view class="item" v-for="(child, childIndex) in item.value" :key="childIndex">
|
||||||
883.7
|
{{ child.showText }}
|
||||||
</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">
|
|
||||||
403.4
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="point" :style="{ left: '200rpx', top: '80rpx' }">电网THDI(%)
|
|
||||||
<view class="grid-card mt10">
|
|
||||||
<view class="grid-card-content-2">
|
|
||||||
<view class="item">L1</view>
|
|
||||||
<view class="item">
|
|
||||||
55.3
|
|
||||||
</view>
|
|
||||||
<view class="item">L2</view>
|
|
||||||
<view class="item">
|
|
||||||
61.4
|
|
||||||
</view>
|
|
||||||
<view class="item">L3</view>
|
|
||||||
<view class="item">
|
|
||||||
55.2
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,42 +27,26 @@
|
|||||||
<view class="item">模块一</view>
|
<view class="item">模块一</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="status-point-success mr10"></view>
|
<view class="status-point-success mr10"></view>
|
||||||
<view style="width:30rpx">
|
<view style="width: 30rpx"> 15 </view>
|
||||||
15
|
<view> °C </view>
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
°C
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="item">模块二</view>
|
<view class="item">模块二</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="status-point-error mr10"></view>
|
<view class="status-point-error mr10"></view>
|
||||||
<view style="width:30rpx">
|
<view style="width: 30rpx"> 0 </view>
|
||||||
0
|
<view> °C </view>
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
°C
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="item">模块三</view>
|
<view class="item">模块三</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="status-point-success mr10"></view>
|
<view class="status-point-success mr10"></view>
|
||||||
<view style="width:30rpx">
|
<view style="width: 30rpx"> 15 </view>
|
||||||
15
|
<view> °C </view>
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
°C
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="item">模块四</view>
|
<view class="item">模块四</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="status-point-success mr10"></view>
|
<view class="status-point-success mr10"></view>
|
||||||
<view style="width:30rpx">
|
<view style="width: 30rpx"> 15 </view>
|
||||||
15
|
<view> °C </view>
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
°C
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -95,43 +57,56 @@
|
|||||||
<text>设备基础信息</text>
|
<text>设备基础信息</text>
|
||||||
<text class="ml10">设备状态</text>
|
<text class="ml10">设备状态</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="nav" style="margin-top:-10rpx">
|
<view class="nav" style="margin-top: -10rpx">
|
||||||
<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>
|
</view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view v-if="navMenuActive == 0">
|
<view v-if="navMenuActive == 0">
|
||||||
<basic></basic>
|
<basic :deviceInfo="deviceInfo"></basic>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="navMenuActive == 1">
|
<view v-else-if="navMenuActive == 1">
|
||||||
<xieBo></xieBo>
|
<xieBo></xieBo>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="navMenuActive == 2">
|
<view v-else-if="navMenuActive == 2">
|
||||||
<power></power>
|
<power :deviceInfo="deviceInfo"></power>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="navMenuActive == 3">
|
<view v-else-if="navMenuActive == 3">
|
||||||
<oscillogram></oscillogram>
|
<oscillogram></oscillogram>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="navMenuActive == 4">
|
<view v-else-if="navMenuActive == 4">
|
||||||
<IO></IO>
|
<IO :deviceInfo="deviceInfo"></IO>
|
||||||
</view>
|
</view>
|
||||||
<view style="height:20rpx"></view>
|
<view style="height: 20rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content"
|
<uni-fab
|
||||||
@trigger="trigger" />
|
ref="fab"
|
||||||
|
direction="vertical"
|
||||||
|
horizontal="right"
|
||||||
|
vertical="bottom"
|
||||||
|
:content="content"
|
||||||
|
@trigger="trigger"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</Cn-page>
|
</Cn-page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import basic from "./comp/basic.vue";
|
import basic from './comp/basic.vue'
|
||||||
import xieBo from "./comp/xieBo.vue";
|
import xieBo from './comp/xieBo.vue'
|
||||||
import power from "./comp/power.vue";
|
import power from './comp/power.vue'
|
||||||
import oscillogram from "./comp/oscillogram.vue";
|
import oscillogram from './comp/oscillogram.vue'
|
||||||
import IO from "./comp/IO.vue";
|
import IO from './comp/IO.vue'
|
||||||
|
import { queryTopologyDiagram } from '@/common/api/device'
|
||||||
|
import { MQTT_IP, MQTT_OPTIONS } from '@/common/js/mqtt.js'
|
||||||
|
import mqtt from 'mqtt/dist/mqtt.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -141,39 +116,67 @@ export default {
|
|||||||
oscillogram,
|
oscillogram,
|
||||||
IO,
|
IO,
|
||||||
},
|
},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: true,
|
||||||
|
deviceInfo: {},
|
||||||
navMenuActive: 0,
|
navMenuActive: 0,
|
||||||
navHeight: 0,
|
navHeight: 0,
|
||||||
img: '',
|
img: '',
|
||||||
navMenuList: [{
|
navMenuList: [
|
||||||
text: '基本'
|
{
|
||||||
}, {
|
text: '基本',
|
||||||
text: '谐波'
|
},
|
||||||
}, {
|
{
|
||||||
text: '功率'
|
text: '谐波',
|
||||||
}, {
|
},
|
||||||
text: '波形'
|
{
|
||||||
}, {
|
text: '功率',
|
||||||
text: 'I/O'
|
},
|
||||||
}],
|
{
|
||||||
content: [{
|
text: '波形',
|
||||||
iconPath: '/static/report.png',
|
},
|
||||||
text: '告警',
|
{
|
||||||
}, {
|
text: 'I/O',
|
||||||
iconPath: '/static/record.png',
|
},
|
||||||
text: '记录',
|
],
|
||||||
}, {
|
content: [
|
||||||
iconPath: '/static/about.png',
|
{
|
||||||
text: '关于',
|
iconPath: '/static/report.png',
|
||||||
},
|
text: '告警',
|
||||||
]
|
},
|
||||||
|
{
|
||||||
|
iconPath: '/static/record.png',
|
||||||
|
text: '记录',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
iconPath: '/static/about.png',
|
||||||
|
text: '关于',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
client: null,
|
||||||
|
timer: null,
|
||||||
|
devId: '',
|
||||||
|
dictData: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
showtTarget() {
|
||||||
|
if (this.loading) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let arr = JSON.parse(JSON.stringify(this.deviceInfo.appsLineTopologyDiagramPO))
|
||||||
|
arr.forEach((item) => {
|
||||||
|
item.value = item.value?.filter((item2) => {
|
||||||
|
return item2.showText
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return arr
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
trigger (e) {
|
trigger(e) {
|
||||||
console.log(e);
|
console.log(e)
|
||||||
if (e.item.text === '分享') {
|
if (e.item.text === '分享') {
|
||||||
this.$refs.share.open()
|
this.$refs.share.open()
|
||||||
} else if (e.item.text === '删除') {
|
} else if (e.item.text === '删除') {
|
||||||
@@ -186,8 +189,8 @@ export default {
|
|||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
} else if (e.item.text === '下载') {
|
} else if (e.item.text === '下载') {
|
||||||
this.$util.toast('下载成功')
|
this.$util.toast('下载成功')
|
||||||
} else if (e.item.text === '记录') {
|
} else if (e.item.text === '记录') {
|
||||||
@@ -211,100 +214,215 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$refs.fab.close()
|
this.$refs.fab.close()
|
||||||
},
|
},
|
||||||
navMenuClick (idx) {
|
navMenuClick(idx) {
|
||||||
this.navMenuActive = idx
|
this.navMenuActive = idx
|
||||||
uni.pageScrollTo({ scrollTop: 0, duration: 0 })
|
uni.pageScrollTo({ scrollTop: 0, duration: 0 })
|
||||||
},
|
},
|
||||||
init () {
|
init() {
|
||||||
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||||
console.log(userInfo.authorities);
|
console.log(userInfo.authorities)
|
||||||
switch (userInfo.authorities) {
|
switch (userInfo.authorities) {
|
||||||
case 1:
|
case 1:
|
||||||
this.content.splice(0, 1)
|
this.content.splice(0, 1)
|
||||||
this.content.splice(0, 0, {
|
this.content.splice(
|
||||||
iconPath: '/static/version.png',
|
0,
|
||||||
text: '版本',
|
0,
|
||||||
}, {
|
{
|
||||||
iconPath: '/static/template.png',
|
iconPath: '/static/version.png',
|
||||||
text: '模版',
|
text: '版本',
|
||||||
})
|
},
|
||||||
break;
|
{
|
||||||
|
iconPath: '/static/template.png',
|
||||||
|
text: '模版',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
break
|
||||||
case 2:
|
case 2:
|
||||||
this.content.splice(0, 1)
|
this.content.splice(0, 1)
|
||||||
break;
|
break
|
||||||
case 3:
|
case 3:
|
||||||
this.content.splice(0, 0, {
|
this.content.splice(0, 0, {
|
||||||
iconPath: '/static/transfer.png',
|
iconPath: '/static/transfer.png',
|
||||||
text: '移交',
|
text: '移交',
|
||||||
})
|
})
|
||||||
break;
|
break
|
||||||
case 4:
|
case 4:
|
||||||
this.content.splice(1, 0, {
|
this.content.splice(
|
||||||
iconPath: '/static/delate.png',
|
1,
|
||||||
text: '报表',
|
0,
|
||||||
}, {
|
{
|
||||||
iconPath: '/static/table.png',
|
iconPath: '/static/delate.png',
|
||||||
text: '删除',
|
text: '报表',
|
||||||
}, {
|
},
|
||||||
iconPath: '/static/feedback.png',
|
{
|
||||||
text: '反馈',
|
iconPath: '/static/table.png',
|
||||||
})
|
text: '删除',
|
||||||
break;
|
},
|
||||||
|
{
|
||||||
|
iconPath: '/static/feedback.png',
|
||||||
|
text: '反馈',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
break
|
||||||
case 5:
|
case 5:
|
||||||
this.content.splice(2, 0, {
|
this.content.splice(
|
||||||
iconPath: '/static/table.png',
|
2,
|
||||||
text: '报表',
|
0,
|
||||||
}, {
|
{
|
||||||
iconPath: '/static/feedback.png',
|
iconPath: '/static/table.png',
|
||||||
text: '反馈',
|
text: '报表',
|
||||||
})
|
},
|
||||||
break;
|
{
|
||||||
|
iconPath: '/static/feedback.png',
|
||||||
|
text: '反馈',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break;
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
|
||||||
// 获取nav高度
|
|
||||||
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
|
|
||||||
this.navHeight = rect.height
|
|
||||||
}).exec()
|
|
||||||
}, 1000);
|
|
||||||
},
|
},
|
||||||
renderFinish (e) {
|
renderFinish(e) {
|
||||||
this.img = e
|
this.img = e
|
||||||
},
|
},
|
||||||
previewImg () {
|
previewImg() {
|
||||||
if (!this.img) {
|
if (!this.img) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '图片生成中',
|
title: '图片生成中',
|
||||||
mask: false
|
mask: false,
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.previewImg()
|
this.previewImg()
|
||||||
}, 500);
|
}, 500)
|
||||||
} else {
|
} else {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: [this.img],
|
urls: [this.img],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}
|
initMqtt() {
|
||||||
|
MQTT_OPTIONS.clientId = uni.getStorageSync('devCode')
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
this.client = mqtt.connect('wx://' + MQTT_IP, MQTT_OPTIONS)
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
this.client = mqtt.connect('ws://' + MQTT_IP, MQTT_OPTIONS)
|
||||||
|
// #endif
|
||||||
|
this.client
|
||||||
|
.on('connect', () => {
|
||||||
|
console.log('连接成功')
|
||||||
|
this.client.subscribe(`/zl/devData/${this.devId}`, (err) => {
|
||||||
|
if (!err) {
|
||||||
|
console.log(`订阅成功:/zl/devData/${this.devId}`)
|
||||||
|
this.client.publish(`/zl/askDevData/${this.devId}`)
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.client.publish(`/zl/askDevData/${this.devId}`)
|
||||||
|
}, 10000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.on('reconnect', function (error) {
|
||||||
|
console.log(error)
|
||||||
|
console.log('正在重连...', that.topic)
|
||||||
|
})
|
||||||
|
.on('error', function (error) {
|
||||||
|
console.log('连接失败...', error)
|
||||||
|
})
|
||||||
|
.on('end', function () {
|
||||||
|
console.log('连接断开')
|
||||||
|
})
|
||||||
|
.on('message', (topic, message) => {
|
||||||
|
console.log('接收推送信息:', message.toString())
|
||||||
|
this.loading = false
|
||||||
|
let dataList = []
|
||||||
|
this.deviceInfo.appsLineTopologyDiagramPO.forEach((element) => {
|
||||||
|
element.value = []
|
||||||
|
})
|
||||||
|
JSON.parse(message.toString()).forEach((item) => {
|
||||||
|
this.deviceInfo.appsLineTopologyDiagramPO.forEach((element) => {
|
||||||
|
if (element.linePostion === item.position) {
|
||||||
|
// element.value.push({
|
||||||
|
// label: item.statisticalName,
|
||||||
|
// value: item.statisticalData,
|
||||||
|
// })
|
||||||
|
element.value.push({
|
||||||
|
...item,
|
||||||
|
showText:
|
||||||
|
item.statisticalName.indexOf('ThdPh') > -1 && item.phase === 'avg'
|
||||||
|
? item.statisticalName + ':' + item.statisticalData
|
||||||
|
: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.$forceUpdate()
|
||||||
|
console.log(this.deviceInfo.appsLineTopologyDiagramPO)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onLoad (options) {
|
// 页面销毁
|
||||||
|
onUnload() {
|
||||||
|
clearInterval(this.timer)
|
||||||
|
this.client.end()
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
this.dictData = uni.getStorageSync(this.$cacheKey.dictData)
|
||||||
|
this.devId = options.id
|
||||||
this.init()
|
this.init()
|
||||||
|
queryTopologyDiagram(options.id).then((res) => {
|
||||||
|
this.deviceInfo = res.data
|
||||||
|
console.log(this.dictData);
|
||||||
|
this.dictData.forEach((item) => {
|
||||||
|
if (item.code == 'Line_Position') {
|
||||||
|
item.children.forEach((item2) => {
|
||||||
|
this.deviceInfo.appsLineTopologyDiagramPO.forEach((element) => {
|
||||||
|
if (element.linePostion === item2.id) {
|
||||||
|
element.label = item2.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.initMqtt()
|
||||||
|
console.log(this.loading, 'loading')
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// // 获取nav高度
|
||||||
|
// uni.createSelectorQuery()
|
||||||
|
// .select('.nav')
|
||||||
|
// .boundingClientRect((rect) => {
|
||||||
|
// this.navHeight = rect.height
|
||||||
|
// })
|
||||||
|
// .exec()
|
||||||
|
// })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss'>
|
<style lang="scss">
|
||||||
.detail {
|
.detail {
|
||||||
|
|
||||||
// background: $uni-theme-white;
|
// background: $uni-theme-white;
|
||||||
|
.header-bg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
.header {
|
.header {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: 375px;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
image {
|
||||||
|
image-rendering: -moz-crisp-edges;
|
||||||
|
image-rendering: -o-crisp-edges;
|
||||||
|
image-rendering: -webkit-optimize-contrast;
|
||||||
|
image-rendering: crisp-edges;
|
||||||
|
-ms-interpolation-mode: nearest-neighbor;
|
||||||
|
}
|
||||||
.point {
|
.point {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
color: #111;
|
color: #111;
|
||||||
@@ -314,11 +432,13 @@ export default {
|
|||||||
width: 110rpx;
|
width: 110rpx;
|
||||||
font-size: 16rpx;
|
font-size: 16rpx;
|
||||||
|
|
||||||
.grid-card-content-2 {
|
.grid-card-content-2,
|
||||||
|
.grid-card-content-1 {
|
||||||
font-size: 16rpx;
|
font-size: 16rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
min-height: unset;
|
min-height: unset;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,7 +449,8 @@ export default {
|
|||||||
right: 20rpx;
|
right: 20rpx;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
|
|
||||||
.grid-card-content-2 {
|
.grid-card-content-2,
|
||||||
|
.grid-card-content-1 {
|
||||||
font-size: 16rpx;
|
font-size: 16rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
@@ -348,7 +469,6 @@ export default {
|
|||||||
.content {
|
.content {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-header {
|
.detail-header {
|
||||||
@@ -358,6 +478,5 @@ export default {
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
background: #f3f4f5;
|
background: #f3f4f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
},
|
},
|
||||||
jump () {
|
jump () {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/device/APF/detail'
|
url: '/pages/device/APF/detail?id=' + item.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
trigger (e) {
|
trigger (e) {
|
||||||
|
|||||||
@@ -56,12 +56,9 @@
|
|||||||
<uni-forms-item label="拓扑图" v-if="formData.projectId">
|
<uni-forms-item label="拓扑图" v-if="formData.projectId">
|
||||||
<view style="display: flex">
|
<view style="display: flex">
|
||||||
<view style="flex: 1">
|
<view style="flex: 1">
|
||||||
<image
|
<view v-if="formData.topologyDiagramUrl">
|
||||||
v-if="formData.topologyDiagramUrl"
|
<image :src="formData.topologyDiagramUrl" style="width: 100%" mode="widthFix" />
|
||||||
class="gplot"
|
</view>
|
||||||
:src="formData.topologyDiagramUrl"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图 </view>
|
<view v-else class="gplot gplot-empty center" @click="chooseGplot"> 选择拓扑图 </view>
|
||||||
</view>
|
</view>
|
||||||
<uni-icons
|
<uni-icons
|
||||||
@@ -85,17 +82,9 @@
|
|||||||
<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">
|
|
||||||
<view class="point-item center" v-for="(item, index) in pointList" :key="index">
|
|
||||||
<view style="flex:1" class="center">{{ item.pointName }}</view>
|
|
||||||
<uni-icons type="trash" color="#007aff" size="26" class="ml20"
|
|
||||||
@click="deletePoint(index)"></uni-icons>
|
|
||||||
<uni-icons type="compose" color="#007aff" size="26" class="ml20"
|
|
||||||
@click="editPoint(index)"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</uni-forms-item> -->
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
|
<image class="gplot-image" ref="gplot-image" :src="formData.topologyDiagramUrl" mode="widthFix" />
|
||||||
<view class="btn-wrap">
|
<view class="btn-wrap">
|
||||||
<!-- <view class="btn-wrap-item" @click="add"> 添加监测点 </view> -->
|
<!-- <view class="btn-wrap-item" @click="add"> 添加监测点 </view> -->
|
||||||
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
<view class="btn-wrap-item" @click="submit"> 提交 </view>
|
||||||
@@ -113,7 +102,8 @@
|
|||||||
:key="key"
|
:key="key"
|
||||||
/>
|
/>
|
||||||
<view class="btn-wrap">
|
<view class="btn-wrap">
|
||||||
<view class="btn-wrap-item ml20" @click="closeDrawer"> 确定 </view>
|
<view class="btn-wrap-item" @click="closeDrawer"> 取消 </view>
|
||||||
|
<view class="btn-wrap-item ml20" @click="confirmGplot"> 确定 </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -161,7 +151,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { registerDevice, getModel, addDevice } from '@/common/api/device.js'
|
import { registerDevice, getModel, addDevice, queryByTopoId } from '@/common/api/device.js'
|
||||||
import { getProjectList, queryTopologyDiagramPage } from '@/common/api/project.js'
|
import { getProjectList, queryTopologyDiagramPage } from '@/common/api/project.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -176,14 +166,12 @@ export default {
|
|||||||
topologyDiagram: '',
|
topologyDiagram: '',
|
||||||
},
|
},
|
||||||
projectRange: [],
|
projectRange: [],
|
||||||
point: {
|
point: {},
|
||||||
x: 170,
|
|
||||||
y: 100,
|
|
||||||
},
|
|
||||||
pointList: [],
|
pointList: [],
|
||||||
activeGplot: 0,
|
activeGplot: 0,
|
||||||
positionList: [],
|
positionList: [],
|
||||||
imageList: [],
|
imageList: [],
|
||||||
|
isAdaptive: false, // 是否适应当前项目
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -219,8 +207,30 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resize(){
|
||||||
|
console.log(this.$refs['gplot-image']);
|
||||||
|
},
|
||||||
|
confirmGplot() {
|
||||||
|
this.formData.topologyDiagramUrl = this.imageList[this.activeGplot].filePath
|
||||||
|
this.formData.topologyDiagram = this.imageList[this.activeGplot].id
|
||||||
|
this.pointList.forEach((item) => {
|
||||||
|
console.log(item.position)
|
||||||
|
this.imageList[this.activeGplot].csLineTopologyTemplateVOList.forEach((item3) => {
|
||||||
|
console.log(item3.linePostion)
|
||||||
|
if (item3.linePostion === item.position) {
|
||||||
|
item.lat = item3.lat
|
||||||
|
item.lng = item3.lng
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
console.log(this.pointList)
|
||||||
|
this.$forceUpdate()
|
||||||
|
this.closeDrawer()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resize()
|
||||||
|
})
|
||||||
|
},
|
||||||
queryTopologyDiagramPage() {
|
queryTopologyDiagramPage() {
|
||||||
console.log(this.formData)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.formData.projectId) {
|
if (!this.formData.projectId) {
|
||||||
return
|
return
|
||||||
@@ -229,8 +239,8 @@ export default {
|
|||||||
projectId: this.formData.projectId,
|
projectId: this.formData.projectId,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.imageList = res.data.records
|
this.imageList = res.data.records
|
||||||
this.formData.topologyDiagramUrl = res.data.records[0].filePath
|
this.activeGplot = 0
|
||||||
this.formData.topologyDiagram = res.data.records[0].id
|
this.confirmGplot()
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
},
|
},
|
||||||
@@ -253,8 +263,7 @@ export default {
|
|||||||
if (!this.formData.nDid) {
|
if (!this.formData.nDid) {
|
||||||
return this.$util.toast('请输入设备识别码')
|
return this.$util.toast('请输入设备识别码')
|
||||||
}
|
}
|
||||||
registerDevice(this.formData.nDid).then(res=>{
|
registerDevice(this.formData.nDid).then((res) => {
|
||||||
|
|
||||||
getModel(this.formData.nDid).then((res) => {
|
getModel(this.formData.nDid).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
this.pointList = res.data.map((item) => {
|
this.pointList = res.data.map((item) => {
|
||||||
@@ -285,9 +294,6 @@ export default {
|
|||||||
closeDrawer() {
|
closeDrawer() {
|
||||||
this.$refs.gplot.close()
|
this.$refs.gplot.close()
|
||||||
this.$refs.point.close()
|
this.$refs.point.close()
|
||||||
this.formData.topologyDiagramUrl = this.imageList[this.activeGplot].filePath
|
|
||||||
this.formData.topologyDiagram = this.imageList[this.activeGplot].id
|
|
||||||
this.$forceUpdate()
|
|
||||||
},
|
},
|
||||||
add() {
|
add() {
|
||||||
this.$refs.point.open()
|
this.$refs.point.open()
|
||||||
@@ -315,6 +321,7 @@ export default {
|
|||||||
},
|
},
|
||||||
editPoint(item, index) {
|
editPoint(item, index) {
|
||||||
this.point = item
|
this.point = item
|
||||||
|
console.log(this.point)
|
||||||
this.editIndex = index
|
this.editIndex = index
|
||||||
if (!this.point.alias) {
|
if (!this.point.alias) {
|
||||||
let every = this.positionList.every((item) => item.name != this.point.name)
|
let every = this.positionList.every((item) => item.name != this.point.name)
|
||||||
@@ -466,4 +473,9 @@ export default {
|
|||||||
.point-item:first-of-type {
|
.point-item:first-of-type {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
.gplot-image {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
width: 375px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
>{{ engineering.name }}
|
>{{ engineering.name }}
|
||||||
<!-- <view class="header-title-extra">用能</view> -->
|
<!-- <view class="header-title-extra">用能</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="header-des-mini mb10">{{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }}</view>
|
<view class="header-des-mini mb10"
|
||||||
|
>{{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }}</view
|
||||||
|
>
|
||||||
<view class="header-des">{{ engineering.description }} </view>
|
<view class="header-des">{{ engineering.description }} </view>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav">
|
<view class="nav">
|
||||||
@@ -41,10 +43,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
<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>
|
<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 == 2">
|
<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="/static/test2.pic.png"
|
||||||
|
v-for="(item, key) in 3"
|
||||||
|
:key="key"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<uni-fab
|
<uni-fab
|
||||||
@@ -75,11 +86,16 @@ export default {
|
|||||||
{
|
{
|
||||||
text: '项目',
|
text: '项目',
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// text: '拓扑图',
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
content: [
|
||||||
{
|
{
|
||||||
text: '拓扑图',
|
iconPath: '/static/share.png',
|
||||||
|
text: '编辑',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
content: [],
|
|
||||||
navHeight: 0,
|
navHeight: 0,
|
||||||
navMenuActive: 0,
|
navMenuActive: 0,
|
||||||
}
|
}
|
||||||
@@ -93,6 +109,10 @@ export default {
|
|||||||
})
|
})
|
||||||
} else if (e.item.text == '分享') {
|
} else if (e.item.text == '分享') {
|
||||||
this.$refs.share.open()
|
this.$refs.share.open()
|
||||||
|
} else if (e.item.text == '编辑') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/engineering/new?engineering=' + encodeURIComponent(JSON.stringify(this.engineering)),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navMenuClick(index) {
|
navMenuClick(index) {
|
||||||
@@ -124,7 +144,7 @@ export default {
|
|||||||
},
|
},
|
||||||
jumpProject(item) {
|
jumpProject(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/project/detail?project=' + JSON.stringify(item),
|
url: '/pages/project/detail?project=' + encodeURIComponent(JSON.stringify(item)),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
@@ -134,7 +154,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.engineering = JSON.parse(option.engineering)
|
this.engineering = JSON.parse(decodeURIComponent(option.engineering))
|
||||||
let userInfo = uni.getStorageSync('userInfo')
|
let userInfo = uni.getStorageSync('userInfo')
|
||||||
if (userInfo.authorities == '3') {
|
if (userInfo.authorities == '3') {
|
||||||
this.content.push({
|
this.content.push({
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ export default {
|
|||||||
let engineering = uni.getStorageSync('engineering')
|
let engineering = uni.getStorageSync('engineering')
|
||||||
if (!engineering) {
|
if (!engineering) {
|
||||||
uni.setStorageSync('engineering',this.store.data[0])
|
uni.setStorageSync('engineering',this.store.data[0])
|
||||||
|
}else{
|
||||||
|
this.store.data.forEach((item) => {
|
||||||
|
if (item.id == engineering.id) {
|
||||||
|
uni.setStorageSync('engineering',item)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -77,7 +83,7 @@ export default {
|
|||||||
},
|
},
|
||||||
jump(engineering) {
|
jump(engineering) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/engineering/detail?engineering=${JSON.stringify(engineering)}`,
|
url: `/pages/engineering/detail?engineering=${encodeURIComponent(JSON.stringify(engineering))}`,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,10 +14,16 @@
|
|||||||
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
<uni-icons type="location" color="#007aff" size="26" class="ml20"
|
||||||
@click="chooseLocation"></uni-icons>
|
@click="chooseLocation"></uni-icons>
|
||||||
</view> -->
|
</view> -->
|
||||||
<uni-data-picker :localdata="localdata" @change="areaChange"> </uni-data-picker>
|
<uni-data-picker :localdata="localdata" @change="areaChange" v-model="value">
|
||||||
|
</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" placeholder="请输入工程描述" />
|
<uni-easyinput
|
||||||
|
type="textarea"
|
||||||
|
autoHeight
|
||||||
|
v-model="formData.description"
|
||||||
|
placeholder="请输入工程描述"
|
||||||
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
</view>
|
</view>
|
||||||
@@ -29,22 +35,36 @@
|
|||||||
</Cn-page>
|
</Cn-page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { addEngineering } from '../../common/api/engineering'
|
import { addEngineering, auditEngineering } from '../../common/api/engineering'
|
||||||
import area from '../../common/js/area.json'
|
import area from '../../common/js/area.json'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
localdata: area,
|
localdata: area,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
value: '',
|
||||||
formData: {
|
formData: {
|
||||||
city: '',
|
city: '',
|
||||||
description: '',
|
description: '',
|
||||||
name: '',
|
name: '',
|
||||||
province: '',
|
province: '',
|
||||||
},
|
},
|
||||||
|
engineering: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
|
if (options.engineering) {
|
||||||
|
this.engineering = JSON.parse(decodeURIComponent(options.engineering))
|
||||||
|
console.log(this.engineering)
|
||||||
|
for (let key in this.formData) {
|
||||||
|
if (this.engineering[key]) {
|
||||||
|
this.formData[key] = this.engineering[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.value = this.engineering.city
|
||||||
|
this.formData.id = this.engineering.id
|
||||||
|
uni.setNavigationBarTitle({ title: '工程编辑' })
|
||||||
|
}
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@@ -54,13 +74,17 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
// console.log(area);
|
// console.log(area);
|
||||||
console.log( this.$util.prePage());
|
console.log(this.$util.prePage())
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
areaChange(e) {
|
areaChange(e) {
|
||||||
console.log(e)
|
if (e.detail.value.length) {
|
||||||
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
|
||||||
|
} else {
|
||||||
|
this.formData.province = ''
|
||||||
|
this.formData.city = ''
|
||||||
|
}
|
||||||
},
|
},
|
||||||
select(e) {
|
select(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
@@ -91,14 +115,20 @@ export default {
|
|||||||
this.$util.toast('请输入工程描述')
|
this.$util.toast('请输入工程描述')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
addEngineering(this.formData).then((res) => {
|
if (this.formData.id) {
|
||||||
console.log(res)
|
await auditEngineering(this.formData)
|
||||||
this.$util.toast('工程创建成功')
|
this.$util.toast('工程修改成功')
|
||||||
this.$util.prePage().store?.reload()
|
let pages = getCurrentPages()
|
||||||
|
let prePage = pages[pages.length -3]
|
||||||
|
prePage.store.reload()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack({ delta: 1 })
|
uni.navigateBack({ delta: 2 })
|
||||||
}, 1500)
|
}, 1500)
|
||||||
})
|
} else {
|
||||||
|
await addEngineering(this.formData)
|
||||||
|
this.$util.prePage().store?.reload()
|
||||||
|
this.$util.toast('工程创建成功')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,13 @@
|
|||||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="openDrawer"
|
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="openDrawer"
|
||||||
>{{ select.engineeringName || '工程' }}
|
>{{ select.engineeringName || '工程' }}
|
||||||
</view>
|
</view>
|
||||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text" v-if="engineeringList.length">
|
<picker
|
||||||
|
@change="projectNameChange"
|
||||||
|
:value="select.projectNameIndex"
|
||||||
|
:range="projectList"
|
||||||
|
range-key="text"
|
||||||
|
v-if="engineeringList.length"
|
||||||
|
>
|
||||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }"
|
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }"
|
||||||
>{{ select.projectName || '项目' }}
|
>{{ select.projectName || '项目' }}
|
||||||
</view>
|
</view>
|
||||||
@@ -150,7 +156,7 @@ export default {
|
|||||||
this.store.params.pageSize = 999
|
this.store.params.pageSize = 999
|
||||||
this.store.params.engineerId = this.select.engineeringId
|
this.store.params.engineerId = this.select.engineeringId
|
||||||
this.store.reload()
|
this.store.reload()
|
||||||
|
|
||||||
},
|
},
|
||||||
getProjectList() {
|
getProjectList() {
|
||||||
getProjectList({
|
getProjectList({
|
||||||
@@ -272,7 +278,7 @@ export default {
|
|||||||
},
|
},
|
||||||
jump(item) {
|
jump(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/device/APF/detail',
|
url: '/pages/device/APF/detail?id=' + item.equipmentId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<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>
|
||||||
</view>
|
</view>
|
||||||
<view class="mine-nav" @click="jump('engineering')" v-if="userInfo.authorities === 'engineering_user'">
|
<view class="mine-nav" @click="jump('engineering')" v-if="userInfo.authorities === 'engineering_user' || userInfo.authorities === 'app_vip_user'">
|
||||||
<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>
|
||||||
|
|||||||
@@ -26,23 +26,36 @@
|
|||||||
sub-title="创建时间"
|
sub-title="创建时间"
|
||||||
v-for="item in store.data"
|
v-for="item in store.data"
|
||||||
:key="item.equipmentId"
|
:key="item.equipmentId"
|
||||||
@click="goDevice"
|
@click="goDevice(item)"
|
||||||
padding="0"
|
padding="0"
|
||||||
thumbnail="/static/device.png"
|
thumbnail="/static/device.png"
|
||||||
>
|
>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
<Cn-empty v-if="store.empty"></Cn-empty>
|
<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>
|
<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>
|
||||||
<uni-list-item title="张三" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
|
<uni-list-item
|
||||||
|
title="张三"
|
||||||
|
note="2023-02-10 14:55"
|
||||||
|
thumb="/static/head.png"
|
||||||
|
thumb-size="lg"
|
||||||
|
>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
|
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
|
||||||
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
|
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
|
||||||
</template>
|
</template>
|
||||||
</uni-list-item>
|
</uni-list-item>
|
||||||
<uni-list-item title="李四" note="2023-02-10 14:55" thumb="/static/head.png" thumb-size="lg">
|
<uni-list-item
|
||||||
|
title="李四"
|
||||||
|
note="2023-02-10 14:55"
|
||||||
|
thumb="/static/head.png"
|
||||||
|
thumb-size="lg"
|
||||||
|
>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
|
<view class="footer-btn mt20" style="background: #e47470" @click="del">移除</view>
|
||||||
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
|
<!-- <view class="footer-btn mt20 ml10" @click="goUserDetail">查看</view> -->
|
||||||
@@ -65,6 +78,7 @@
|
|||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
@select="addAppTopologyDiagram"
|
@select="addAppTopologyDiagram"
|
||||||
@delete="deleteTopologyDiagramPage"
|
@delete="deleteTopologyDiagramPage"
|
||||||
|
readonly
|
||||||
></uni-file-picker>
|
></uni-file-picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -75,7 +89,6 @@
|
|||||||
vertical="bottom"
|
vertical="bottom"
|
||||||
:content="content"
|
:content="content"
|
||||||
@trigger="trigger"
|
@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>
|
||||||
@@ -118,7 +131,7 @@ export default {
|
|||||||
projectId: this.project.id,
|
projectId: this.project.id,
|
||||||
topologyDiagramName: e.tempFiles[0].name,
|
topologyDiagramName: e.tempFiles[0].name,
|
||||||
},
|
},
|
||||||
e.tempFiles[0].path
|
e.tempFiles[0].path,
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.length > 1) {
|
if (res.length > 1) {
|
||||||
@@ -161,6 +174,10 @@ export default {
|
|||||||
})
|
})
|
||||||
} else if (e.item.text == '分享') {
|
} else if (e.item.text == '分享') {
|
||||||
this.$refs.share.open()
|
this.$refs.share.open()
|
||||||
|
} else if (e.item.text == '编辑') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/project/new?project=' + encodeURIComponent(JSON.stringify(this.project)),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navMenuClick(index) {
|
navMenuClick(index) {
|
||||||
@@ -185,9 +202,9 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goDevice() {
|
goDevice(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/device/APF/detail',
|
url: '/pages/device/APF/detail?id=' + item.equipmentId,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
@@ -212,6 +229,10 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
let userInfo = uni.getStorageSync('userInfo')
|
let userInfo = uni.getStorageSync('userInfo')
|
||||||
|
this.content.push({
|
||||||
|
iconPath: '/static/share.png',
|
||||||
|
text: '编辑',
|
||||||
|
})
|
||||||
if (userInfo.authorities == '3') {
|
if (userInfo.authorities == '3') {
|
||||||
this.content.push({
|
this.content.push({
|
||||||
iconPath: '/static/transfer.png',
|
iconPath: '/static/transfer.png',
|
||||||
@@ -232,7 +253,8 @@ export default {
|
|||||||
})
|
})
|
||||||
.exec()
|
.exec()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
this.project = JSON.parse(option.project)
|
console.log(option.project)
|
||||||
|
this.project = JSON.parse(decodeURIComponent(option.project))
|
||||||
this.init()
|
this.init()
|
||||||
// uni.setNavigationBarTitle({ title: this.project })
|
// uni.setNavigationBarTitle({ title: this.project })
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ export default {
|
|||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},
|
},
|
||||||
add() {
|
add() {
|
||||||
|
if (!uni.getStorageSync('engineering')) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请先创建一个工程',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/project/new`,
|
url: `/pages/project/new`,
|
||||||
})
|
})
|
||||||
@@ -64,8 +70,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
jump(project) {
|
jump(project) {
|
||||||
|
console.log(project);
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/project/detail?project=${JSON.stringify(project)}`,
|
url: `/pages/project/detail?project=${encodeURIComponent(JSON.stringify(project))}`,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,9 +15,6 @@
|
|||||||
<uni-forms-item label="项目名称">
|
<uni-forms-item label="项目名称">
|
||||||
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
|
<uni-easyinput v-model="formData.name" placeholder="请输入项目名称" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<!-- <uni-forms-item label="项目类别">
|
|
||||||
<uni-data-select v-model="formData.projectType" :localdata="TypeRange"></uni-data-select>
|
|
||||||
</uni-forms-item> -->
|
|
||||||
<uni-forms-item label="区域">
|
<uni-forms-item label="区域">
|
||||||
<view style="display: flex">
|
<view style="display: flex">
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
@@ -27,15 +24,44 @@
|
|||||||
v-model="formData.area"
|
v-model="formData.area"
|
||||||
placeholder="请输入区域信息"
|
placeholder="请输入区域信息"
|
||||||
/>
|
/>
|
||||||
<uni-icons type="location" color="#007aff" size="26" class="ml20" @click="chooseLocation"></uni-icons>
|
<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" placeholder="请输入项目描述" />
|
<uni-easyinput
|
||||||
|
type="textarea"
|
||||||
|
autoHeight
|
||||||
|
v-model="formData.description"
|
||||||
|
placeholder="请输入项目描述"
|
||||||
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
<view class="temp-choose">
|
||||||
|
<view class="temp-choose-title">从模版库选择拓扑图</view>
|
||||||
|
<view class="temp-choose-content">
|
||||||
|
<view class="temp-choose-content-item" v-for="(item, index) in formData.tempFiles">
|
||||||
|
<image
|
||||||
|
class="temp-choose-content-item-img"
|
||||||
|
:src="item.filePath"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
<view class="temp-choose-content-item-close" @click="deleteImg(index)">
|
||||||
|
<uni-icons style="font-size: 18px" type="closeempty" color="#fff" size="20" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="temp-choose-content-item" @click="openTemp">
|
||||||
|
<uni-icons type="plusempty" size="70" color="#f1f1f1"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<uni-file-picker
|
<uni-file-picker
|
||||||
v-model="formData.files"
|
v-model="formData.files"
|
||||||
title="请上传拓扑图"
|
title="从本地上传拓扑图"
|
||||||
:sourceType="['album']"
|
:sourceType="['album']"
|
||||||
@select="select"
|
@select="select"
|
||||||
></uni-file-picker>
|
></uni-file-picker>
|
||||||
@@ -44,9 +70,34 @@
|
|||||||
<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-drawer ref="showRight" mode="right" :mask-click="false">
|
||||||
<uni-indexed-list :options="gcListFilter" :showSelect="false" @click="closeDrawer"></uni-indexed-list>
|
<uni-indexed-list
|
||||||
|
:options="engineeringListFilter"
|
||||||
|
:showSelect="false"
|
||||||
|
@click="closeDrawer"
|
||||||
|
></uni-indexed-list>
|
||||||
</uni-drawer>
|
</uni-drawer>
|
||||||
|
<uni-popup ref="showTemp" type="bottom" :mask-click="false">
|
||||||
|
<view class="popup-header">
|
||||||
|
<view class="popup-header-title">模版库</view>
|
||||||
|
<view class="popup-header-close" @click="closeTemp">
|
||||||
|
<uni-icons type="closeempty" color="#111" size="20" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="temp-list">
|
||||||
|
<view
|
||||||
|
class="temp-list-item"
|
||||||
|
:class="{
|
||||||
|
'temp-list-item-active': formData.tempFiles.some((item2) => item2.id === item.id),
|
||||||
|
}"
|
||||||
|
v-for="(item, index) in tempList"
|
||||||
|
@click="chooseTempItem(item)"
|
||||||
|
>
|
||||||
|
<image class="temp-list-item-img" :src="item.filePath" mode="aspectFill" />
|
||||||
|
<view class="temp-list-item-name">{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</Cn-page>
|
</Cn-page>
|
||||||
@@ -54,6 +105,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { pinyin } from 'pinyin-pro'
|
import { pinyin } from 'pinyin-pro'
|
||||||
import { addAppProject } from '../../common/api/project'
|
import { addAppProject } from '../../common/api/project'
|
||||||
|
import { getTopoTemplate } from '../../common/api/device'
|
||||||
import { queryEngineering } from '@/common/api/engineering.js'
|
import { queryEngineering } from '@/common/api/engineering.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -64,29 +116,22 @@ export default {
|
|||||||
engineeringName: '',
|
engineeringName: '',
|
||||||
area: '',
|
area: '',
|
||||||
files: [],
|
files: [],
|
||||||
|
tempFiles: [],
|
||||||
|
topoIds: [],
|
||||||
description: '',
|
description: '',
|
||||||
projectType: '1',
|
|
||||||
name: '',
|
name: '',
|
||||||
lat: '2',
|
lat: '2',
|
||||||
lng: '3',
|
lng: '3',
|
||||||
},
|
},
|
||||||
TypeRange: [
|
engineeringList: [],
|
||||||
{
|
tempList: [],
|
||||||
text: '监测',
|
project: '',
|
||||||
value: '1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '用能',
|
|
||||||
value: '2',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
gcList: [],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
gcListFilter() {
|
engineeringListFilter() {
|
||||||
let result = []
|
let result = []
|
||||||
this.gcList.forEach((item) => {
|
this.engineeringList.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)
|
||||||
@@ -103,7 +148,16 @@ export default {
|
|||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
|
if (options.project) {
|
||||||
|
this.project = JSON.parse(decodeURIComponent(options.project))
|
||||||
|
console.log(this.project)
|
||||||
|
for (let key in this.formData) {
|
||||||
|
if (this.project[key]) {
|
||||||
|
this.formData[key] = this.project[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@@ -113,17 +167,37 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
queryEngineering().then((res) => {
|
queryEngineering().then((res) => {
|
||||||
this.gcList = res.data
|
this.engineeringList = res.data
|
||||||
|
})
|
||||||
|
getTopoTemplate().then((res) => {
|
||||||
|
console.log(res)
|
||||||
|
this.tempList = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
deleteImg(index) {
|
||||||
|
this.formData.tempFiles.splice(index, 1)
|
||||||
|
},
|
||||||
|
chooseTempItem(item) {
|
||||||
|
if (this.formData.tempFiles.some((item2) => item2.id === item.id)) {
|
||||||
|
this.formData.tempFiles = this.formData.tempFiles.filter((item2) => item2.id !== item.id)
|
||||||
|
} else {
|
||||||
|
this.formData.tempFiles.push(item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeTemp() {
|
||||||
|
this.$refs.showTemp.close()
|
||||||
|
},
|
||||||
|
openTemp() {
|
||||||
|
this.$refs.showTemp.open()
|
||||||
|
},
|
||||||
showDrawer() {
|
showDrawer() {
|
||||||
this.$refs.showRight.open()
|
this.$refs.showRight.open()
|
||||||
},
|
},
|
||||||
closeDrawer(e) {
|
closeDrawer(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
this.formData.engineeringName = e.item.name
|
this.formData.engineeringName = e.item.name
|
||||||
this.formData.engineeringId = this.gcList.find((item) => item.name === e.item.name).id
|
this.formData.engineeringId = this.engineeringList.find((item) => item.name === e.item.name).id
|
||||||
this.$refs.showRight.close()
|
this.$refs.showRight.close()
|
||||||
},
|
},
|
||||||
select(e) {
|
select(e) {
|
||||||
@@ -148,10 +222,6 @@ export default {
|
|||||||
this.$util.toast('请输入项目名称')
|
this.$util.toast('请输入项目名称')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.formData.projectType) {
|
|
||||||
this.$util.toast('请选择项目类别')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.formData.area) {
|
if (!this.formData.area) {
|
||||||
this.$util.toast('请输入区域信息')
|
this.$util.toast('请输入区域信息')
|
||||||
return
|
return
|
||||||
@@ -160,35 +230,39 @@ export default {
|
|||||||
this.$util.toast('请输入项目描述')
|
this.$util.toast('请输入项目描述')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.formData.files.length) {
|
if (!this.formData.files.length && !this.formData.tempFiles.length) {
|
||||||
this.$util.toast('请上传拓扑图')
|
this.$util.toast('请至少选择一张拓扑图')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
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);
|
console.log(item)
|
||||||
arr.push({
|
arr.push({
|
||||||
name: 'files',
|
name: 'files',
|
||||||
uri: item.url,
|
uri: item.url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.formData.topoIds = this.formData.tempFiles.map((item) => item.id)
|
||||||
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)
|
||||||
console.warn(res);
|
|
||||||
if (res.length === 1) {
|
if (res.length === 1) {
|
||||||
this.$util.toast(res[0].message)
|
this.$util.toast(res[0].message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(res)
|
console.log(res)
|
||||||
this.$util.toast('项目创建成功')
|
let result = JSON.parse(res[1].data)
|
||||||
this.$util.prePage().store?.reload()
|
if (result.code === 'A0000') {
|
||||||
setTimeout(() => {
|
this.$util.toast('项目创建成功')
|
||||||
uni.navigateBack({ delta: 1 })
|
this.$util.prePage().store?.reload()
|
||||||
}, 1500)
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({ delta: 1 })
|
||||||
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
this.$util.toast(result.message)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -228,6 +302,79 @@ export default {
|
|||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.temp-choose {
|
||||||
|
margin-bottom: 44rpx;
|
||||||
|
.temp-choose-title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.temp-choose-content {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 198rpx);
|
||||||
|
grid-gap: 10rpx;
|
||||||
|
.temp-choose-content-item {
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px #eee solid;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 198rpx;
|
||||||
|
.temp-choose-content-item-img {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background: skyblue;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.temp-choose-content-item-close {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: absolute;
|
||||||
|
top: 3px;
|
||||||
|
right: 3px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 2;
|
||||||
|
height: 52rpx;
|
||||||
|
width: 52rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.temp-list {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 750rpx;
|
||||||
|
height: 80vh;
|
||||||
|
padding: 20rpx;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.temp-list-item {
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 4px solid #f1f1f1;
|
||||||
|
.temp-list-item-img {
|
||||||
|
height: 280rpx;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.temp-list-item-name {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
background: #fff;
|
||||||
|
padding: 4rpx 8rpx;
|
||||||
|
}
|
||||||
|
&-active {
|
||||||
|
border: 4rpx solid $uni-theme-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uni-drawer__content {
|
/deep/ .uni-drawer__content {
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
// 密码需要包含特殊字符字母数字,长度为8-16
|
// 密码需要包含特殊字符字母数字,长度为8-16
|
||||||
if (
|
if (
|
||||||
!/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[#@!~%^&*])[a-zA-Z\d#@!~%^&*]{8,16}$/.test(
|
!/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[#@!~%^&*.])[a-zA-Z\d#@!~%^&*.]{8,16}$/.test(
|
||||||
this.formData.password,
|
this.formData.password,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<input
|
<input
|
||||||
class="login-box-input-main"
|
class="login-box-input-main"
|
||||||
maxlength="11"
|
maxlength="11"
|
||||||
v-model="yzmForm.phone"
|
v-model="phone"
|
||||||
placeholder="请输入手机号"
|
placeholder="请输入手机号"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view class="login-box-input mt100">
|
<view class="login-box-input mt100">
|
||||||
<input class="login-box-input-main" maxlength="11" v-model="pwdForm.phone" placeholder="请输入账号" />
|
<input class="login-box-input-main" maxlength="11" v-model="phone" placeholder="请输入账号" />
|
||||||
</view>
|
</view>
|
||||||
<view class="login-box-input mt40">
|
<view class="login-box-input mt40">
|
||||||
<input
|
<input
|
||||||
@@ -78,15 +78,14 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
loginType: 'pwd',
|
loginType: 'pwd',
|
||||||
|
phone:'13999999999',
|
||||||
pwdForm: {
|
pwdForm: {
|
||||||
phone: '13888888888',
|
pwd: '',
|
||||||
pwd: 'gwo6H8Kb',
|
|
||||||
imgCode: '',
|
imgCode: '',
|
||||||
},
|
},
|
||||||
yzmForm: {
|
yzmForm: {
|
||||||
phone: '',
|
|
||||||
code: '',
|
code: '',
|
||||||
imgCode: '',
|
imgCode: '123456789',
|
||||||
},
|
},
|
||||||
waitTime: 0,
|
waitTime: 0,
|
||||||
tenantId: '',
|
tenantId: '',
|
||||||
@@ -96,14 +95,14 @@ export default {
|
|||||||
components: {},
|
components: {},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
if (!this.yzmForm.phone) {
|
if (!this.phone) {
|
||||||
return this.$util.toast('请输入手机号!')
|
return this.$util.toast('请输入手机号!')
|
||||||
}
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '请稍等',
|
title: '请稍等',
|
||||||
})
|
})
|
||||||
apiGetYms({
|
apiGetYms({
|
||||||
phone: this.yzmForm.phone,
|
phone: this.phone,
|
||||||
type: 0,
|
type: 0,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -132,10 +131,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
pwdLogin() {
|
pwdLogin() {
|
||||||
if (!this.pwdForm.phone && !this.pwdForm.pwd) {
|
if (!this.phone && !this.pwdForm.pwd) {
|
||||||
return this.$util.toast('请填写登录信息!')
|
return this.$util.toast('请填写登录信息!')
|
||||||
}
|
}
|
||||||
let loginName = encrypt(this.pwdForm.phone)
|
console.log(this.phone);
|
||||||
|
let loginName = encrypt(this.phone)
|
||||||
|
console.log(loginName);
|
||||||
gongkey({ loginName }).then((response) => {
|
gongkey({ loginName }).then((response) => {
|
||||||
let publicKey = response.data
|
let publicKey = response.data
|
||||||
let sm3Pwd = sm3Digest(this.pwdForm.pwd)
|
let sm3Pwd = sm3Digest(this.pwdForm.pwd)
|
||||||
@@ -152,11 +153,11 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
yzmLogin() {
|
yzmLogin() {
|
||||||
if (!this.yzmForm.phone && !this.yzmForm.code) {
|
if (!this.phone && !this.yzmForm.code) {
|
||||||
return this.$util.toast('请填写登录信息!')
|
return this.$util.toast('请填写登录信息!')
|
||||||
}
|
}
|
||||||
apiYsmLogin({
|
apiYsmLogin({
|
||||||
phone: this.yzmForm.phone,
|
phone: this.phone,
|
||||||
smsCode: this.yzmForm.code,
|
smsCode: this.yzmForm.code,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.$util.loginSuccess(res.data)
|
this.$util.loginSuccess(res.data)
|
||||||
@@ -165,7 +166,8 @@ export default {
|
|||||||
},
|
},
|
||||||
onLoad(o) {
|
onLoad(o) {
|
||||||
// 移除所有的缓存
|
// 移除所有的缓存
|
||||||
uni.clearStorageSync()
|
// uni.clearStorageSync()
|
||||||
|
uni.removeStorageSync('access_token')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
36
pnpm-lock.yaml
generated
36
pnpm-lock.yaml
generated
@@ -8,6 +8,7 @@ specifiers:
|
|||||||
mqtt: 3.0.0
|
mqtt: 3.0.0
|
||||||
pinyin-pro: ^3.13.2
|
pinyin-pro: ^3.13.2
|
||||||
qs: ^6.11.2
|
qs: ^6.11.2
|
||||||
|
vconsole: ^3.15.1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
crypto-js: 4.1.1
|
crypto-js: 4.1.1
|
||||||
@@ -15,6 +16,7 @@ dependencies:
|
|||||||
mqtt: 3.0.0
|
mqtt: 3.0.0
|
||||||
pinyin-pro: 3.13.2
|
pinyin-pro: 3.13.2
|
||||||
qs: 6.11.2
|
qs: 6.11.2
|
||||||
|
vconsole: 3.15.1
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/html5plus': 1.0.2
|
'@types/html5plus': 1.0.2
|
||||||
@@ -40,6 +42,13 @@ packages:
|
|||||||
'@babel/types': 7.22.5
|
'@babel/types': 7.22.5
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@babel/runtime/7.22.6:
|
||||||
|
resolution: {integrity: sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==}
|
||||||
|
engines: {node: '>=6.9.0'}
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime: 0.13.11
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@babel/types/7.22.5:
|
/@babel/types/7.22.5:
|
||||||
resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==}
|
resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
@@ -145,6 +154,16 @@ packages:
|
|||||||
typedarray: 0.0.6
|
typedarray: 0.0.6
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/copy-text-to-clipboard/3.2.0:
|
||||||
|
resolution: {integrity: sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/core-js/3.31.1:
|
||||||
|
resolution: {integrity: sha512-2sKLtfq1eFST7l7v62zaqXacPc7uG8ZAya8ogijLhTtaKNcpzpB4TMoTw2Si+8GYKRwFPMMtUT0263QFWFfqyQ==}
|
||||||
|
requiresBuild: true
|
||||||
|
dev: false
|
||||||
|
|
||||||
/core-util-is/1.0.3:
|
/core-util-is/1.0.3:
|
||||||
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -479,6 +498,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/mutation-observer/1.0.3:
|
||||||
|
resolution: {integrity: sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/nanoid/3.3.6:
|
/nanoid/3.3.6:
|
||||||
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
|
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
|
||||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||||
@@ -585,6 +608,10 @@ packages:
|
|||||||
util-deprecate: 1.0.2
|
util-deprecate: 1.0.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/regenerator-runtime/0.13.11:
|
||||||
|
resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/reinterval/1.1.0:
|
/reinterval/1.1.0:
|
||||||
resolution: {integrity: sha512-QIRet3SYrGp0HUHO88jVskiG6seqUGC5iAG7AwI/BV4ypGcuqk9Du6YQBUOUqm9c8pw1eyLoIaONifRua1lsEQ==}
|
resolution: {integrity: sha512-QIRet3SYrGp0HUHO88jVskiG6seqUGC5iAG7AwI/BV4ypGcuqk9Du6YQBUOUqm9c8pw1eyLoIaONifRua1lsEQ==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -712,6 +739,15 @@ packages:
|
|||||||
base64-arraybuffer: 1.0.2
|
base64-arraybuffer: 1.0.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/vconsole/3.15.1:
|
||||||
|
resolution: {integrity: sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==}
|
||||||
|
dependencies:
|
||||||
|
'@babel/runtime': 7.22.6
|
||||||
|
copy-text-to-clipboard: 3.2.0
|
||||||
|
core-js: 3.31.1
|
||||||
|
mutation-observer: 1.0.3
|
||||||
|
dev: false
|
||||||
|
|
||||||
/vue/2.7.14:
|
/vue/2.7.14:
|
||||||
resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==}
|
resolution: {integrity: sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-file-picker__container">
|
<view class="uni-file-picker__container">
|
||||||
<view class="file-picker__box" v-for="(item,index) in filesList" :key="index" :style="boxStyle">
|
<view class="file-picker__box" v-for="(item,index) in filesList" :key="index" :style="boxStyle">
|
||||||
<view class="file-picker__box-content" :style="borderStyle">
|
<view class="file-picker__box-content" :style="borderStyle">
|
||||||
<image class="file-image" :src="item.url" mode="aspectFill" @click.stop="prviewImage(item,index)"></image>
|
<image class="file-image" :src="item.url" mode="aspectFill" @click.stop="prviewImage(item,index)"></image>
|
||||||
<view v-if="delIcon && !readonly" class="icon-del-box" @click.stop="delFile(index)">
|
<view v-if="delIcon && !readonly" class="icon-del-box" @click.stop="delFile(index)">
|
||||||
<view class="icon-del"></view>
|
<view class="icon-del"></view>
|
||||||
@@ -37,10 +37,10 @@
|
|||||||
default () {
|
default () {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disabled:{
|
disabled:{
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
disablePreview: {
|
disablePreview: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -63,10 +63,10 @@
|
|||||||
delIcon: {
|
delIcon: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
readonly:{
|
readonly:{
|
||||||
type:Boolean,
|
type:Boolean,
|
||||||
default:false
|
default:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -104,20 +104,20 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
obj.width = this.value2px(width)
|
obj.width = this.value2px(width)
|
||||||
}
|
}
|
||||||
|
|
||||||
let classles = ''
|
let classles = ''
|
||||||
for(let i in obj){
|
for(let i in obj){
|
||||||
classles+= `${i}:${obj[i]};`
|
classles+= `${i}:${obj[i]};`
|
||||||
}
|
}
|
||||||
return classles
|
return classles
|
||||||
},
|
},
|
||||||
borderStyle() {
|
borderStyle() {
|
||||||
let {
|
let {
|
||||||
border
|
border
|
||||||
} = this.styles
|
} = this.styles
|
||||||
let obj = {}
|
let obj = {}
|
||||||
const widthDefaultValue = 1
|
const widthDefaultValue = 1
|
||||||
const radiusDefaultValue = 3
|
const radiusDefaultValue = 3
|
||||||
if (typeof border === 'boolean') {
|
if (typeof border === 'boolean') {
|
||||||
obj.border = border ? '1px #eee solid' : 'none'
|
obj.border = border ? '1px #eee solid' : 'none'
|
||||||
@@ -132,10 +132,10 @@
|
|||||||
'border-color': (border && border.color) || '#eee',
|
'border-color': (border && border.color) || '#eee',
|
||||||
'border-radius': radius
|
'border-radius': radius
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let classles = ''
|
let classles = ''
|
||||||
for(let i in obj){
|
for(let i in obj){
|
||||||
classles+= `${i}:${obj[i]};`
|
classles+= `${i}:${obj[i]};`
|
||||||
}
|
}
|
||||||
return classles
|
return classles
|
||||||
}
|
}
|
||||||
@@ -151,11 +151,11 @@
|
|||||||
this.$emit('delFile', index)
|
this.$emit('delFile', index)
|
||||||
},
|
},
|
||||||
prviewImage(img, index) {
|
prviewImage(img, index) {
|
||||||
let urls = []
|
let urls = []
|
||||||
if(Number(this.limit) === 1&&this.disablePreview&&!this.disabled){
|
if(Number(this.limit) === 1&&this.disablePreview&&!this.disabled){
|
||||||
this.$emit("choose")
|
this.$emit("choose")
|
||||||
}
|
}
|
||||||
if(this.disablePreview) return
|
if(this.disablePreview) return
|
||||||
this.filesList.forEach(i => {
|
this.filesList.forEach(i => {
|
||||||
urls.push(i.url)
|
urls.push(i.url)
|
||||||
})
|
})
|
||||||
@@ -180,10 +180,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.uni-file-picker__container {
|
.uni-file-picker__container {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin: -5px;
|
margin: -5px;
|
||||||
@@ -194,9 +194,9 @@
|
|||||||
// flex: 0 0 33.3%;
|
// flex: 0 0 33.3%;
|
||||||
width: 33.3%;
|
width: 33.3%;
|
||||||
height: 0;
|
height: 0;
|
||||||
padding-top: 33.33%;
|
padding-top: 33.33%;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +225,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-picker__mask {
|
.file-picker__mask {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -246,9 +246,9 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-add {
|
.is-add {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -266,9 +266,9 @@
|
|||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-del-box {
|
.icon-del-box {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -289,4 +289,4 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user