Commit 678ba089 authored by 李翠鸿's avatar 李翠鸿

v2

parent 56a81c58
......@@ -20,7 +20,6 @@
<style lang="scss">
@import url("./common/uni.scss");
/*每个页面公共css */
page {
background-color: #f2f2f2;
......
.page-view{
padding: 24rpx 24rpx;
padding: 12px 12px;
}
.uni-input{
background: #FFFFFF;
border: 2rpx solid #CECECE;
border-radius: 10rpx;
height: 93rpx;
border: 1px solid #CECECE;
border-radius: 5px;
height: 47px;
}
.base-style{
position: absolute;
}
\ No newline at end of file
......@@ -12,8 +12,15 @@ const toast = (str) => {
})
})
};
const showModal = (title, success) => {
return uni.showModal({
title: title,
success: success
})
}
export default {
toast: toast,
showModal: showModal,
// successToast: successToast,
// showLoading: showLoading,
// tipLoading: tipLoading,
......
......@@ -3,13 +3,22 @@ import App from './App'
import $ from './js/toast.js'
import store from './store'
import interceptor from './js/interceptor.js'
import api from './request/api.js'
import uView from "uview-ui"
// import VConsole from 'vconsole'
// const vConsole = new VConsole()
Vue.use(uView)
Vue.prototype.$api = api
Vue.prototype.$store = store
Vue.config.productionTip = false
Vue.prototype.$toast = $
App.mpType = 'app'
const app = new Vue({
...App,
})
app.$mount()
//switchTab路由拦截
......
......@@ -79,5 +79,28 @@
"landscape-secondary",
//自然方向
"default"
]
],
"h5": {
// "devServer": {
// "https": false,
// "proxy": {
// // "/web": {
// // "target": "http://192.168.1.151:8804",
// // "changeOrigin": true,
// // "secure": false,
// // "pathRewrite": {
// // "^/web": "/"
// // }
// // }
// "/api": {
// "target": "http://192.168.1.151:8804",
// "changeOrigin": true,
// "pathRewrite":{
// "^/api": "/api"
// }
// }
// }
// }
}
}
......@@ -59,6 +59,7 @@
}
}
},
{
"path": "pages/scan-code/app-scan/index",
"style": {
......@@ -125,6 +126,9 @@
"navigationBarBackgroundColor": "#00B2A5",
"backgroundColor": "#f2f2f2",
// "pageOrientation": "portrait",//横屏配置,全局屏幕旋转设置(仅 APP/微信/QQ小程序)
"pageOrientation": "auto"
"pageOrientation": "portrait-primary"
},
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
}
}
......@@ -28,19 +28,19 @@
<style lang="scss" scoped>
.title-bar{
padding: 0 40rpx;
line-height: 100rpx;
height: 100rpx;
padding: 0 1.25rem;
line-height: 3.125rem;
height:3.125rem;;
.view-icon {
margin-top:-4rpx;
width: 44rpx;
height:44rpx;
margin-top:-2px;
width: 22px;
height:22px;
vertical-align: middle;
}
.title-bar-text{
// line-height: 13rpx;
padding-left: 10rpx;
font-size:36rpx;;
padding-left: 5px;
font-size:18px;;
color: #ffffff;
}
......
<!-- 数据页面 -->
<template>
<view>这是数据页面</view>
<view>
<view class="data-style" v-if="isShowCompons" :style="mainStyleConfig">
<rectangular ref="rectangular" :componentsData="componentsData"></rectangular>
<kpi ref="kpi" :componentsData="componentsData"></kpi>
<text-item ref="textItem" :componentsData="componentsData"></text-item>
<list-item ref="listItem" :componentsData="componentsData"></list-item>
<!-- <div data-v-3873ec1c="" class="pressButton_box">
<button @click="test">fhsjsh</button>
</div> -->
</view>
</view>
</template>
<script>
export default{
data(){
return{
import {
arrayToString
} from '../../js/tool.js'
import jsonData from '../../js/test.json'
import Rectangular from '../data-conponent/rectangular.vue'
import Kpi from '../data-conponent/kpi.vue'
import TextItem from '../data-conponent/text.vue'
import ListItem from '../data-conponent/list.vue'
export default {
components: {
Rectangular,//矩形组件
Kpi,//kpi组件
TextItem,//文字组件
ListItem,//列表组件
},
data() {
return {
isShowCompons: false,
componentsData: null, //组件数据
mainStyleConfig: null, //页面样式
// children:null
}
},
created() {
this.componentsData = jsonData
let _this = this
// console.log(JSON.stringify(this.componentsData))
if (this.componentsData) {
//设置标题
uni.setNavigationBarTitle({
title: _this.componentsData.pageTitle
});
this.setMainStyle()
}
},
methods: {
setMainStyle() {
this.isShowCompons = true
let styleConfig = this.componentsData.styleConfig
styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
this.mainStyleConfig = styleConfig
}
// test(){
// uni.request({
// url: 'http://www.baidu.com',
// method:'GET',
// header: {
// // 'token': token
// },
// success(res) {
// console.log(666+JSON.stringify(res))
// //响应成功拦截
// // resolve(res)
// },
// fail(err) {
// //响应失败拦截
// // reject(err)
// },
// complete(res) {
// console.log(666+res)
// //请求完成拦截
// // uni.hideLoading()
// }
// })
// }
},
onReady() {
// console.log(jsonData.pageTitle)
},
onShow(){
onShow() {
// #ifdef APP-PLUS
plus.screen.lockOrientation('default'); //锁定
// #endif
......@@ -19,5 +102,15 @@
}
</script>
<style>
<style lang="scss" scoped>
.page-view {
padding:0;
}
.data-style {
position: relative;
width: 100%;
height: 100%;
// background: red;
}
</style>
......@@ -5,7 +5,14 @@
<!-- <button type="primary" class="loginBtn" @click="loginFun">登录</button> -->
<image @click="scanCodeFun" mode="aspectFit" class="login-sao-img" src="../../static/img1/saoyisao.png"></image>
<image mode="aspectFit" class="login-top-img" src="../../static/img1/loginlogo.png"></image>
<view class="login-logo-img">
<view style="display: flex;align-items:center;justify-content: center;height: 100%;">
<img style="height:100%;" :src="logoImg"></img>
</view>
</view>
<view class="login-from">
<view class="login-user">
<input class="uni-input login-input" v-model="userName" focus type="text" placeholder="请输入用户名" />
<image mode="aspectFit" class="login-input-img" src="../../static/img1/yonghuIcon.png"></image>
......@@ -26,14 +33,28 @@
data() {
return {
height: '100vh',
userName: 'admin',
password: '123'
userName: 'SuperAdmin',
password: 'SYC888888',
logoImg: '../../static/img/hello.png'
}
},
methods: {
getLogoImgFun() {
let projectInfo = uni.getStorageSync('projectInfo')
let _this = this
_this.logoImg = ''
let projectName =projectInfo.projectName? projectInfo.projectName:'test'
let logoFile = projectInfo.logoFile? projectInfo.logoFile:'hello.png'
let baseUrl = 'http://' + projectInfo.serviceAddress+_this.$store.state.GetProjectResourceBaseUrl
_this.logoImg =baseUrl+'?projectName=' + projectName +'&resourcePath=' + logoFile
},
// 登录
loginFun() {
console.log(this.$store.systemInfo)
// console.log(this.$store.systemInfo)
if (!this.userName.trim()) {
this.$toast.toast('用户名不能为空')
return
......@@ -42,28 +63,72 @@
this.$toast.toast('密码不能为空')
return
}
// #ifdef APP-PLUS
this.$api.login(this.userName, this.password).then(res => {
console.log(JSON.stringify(data))
let data = res.data.data
if (data) {
// console.log(data.LoginIsSuccess)
if (data.LoginIsSuccess) {
console.log(JSON.stringify(data))
uni.setStorageSync('userInfo1', data);
this.$toast.toast('登录成功')
this.$api.loginInOutRecord(data.SCMSUserName, '网页登录').then(res => {
console.log('登录成功')
uni.switchTab({
url: "/pages/monitoring/index"
})
})
} else {
this.$toast.toast('登录失败')
}
}
}).catch(error => {
this.$toast.toast(error)
})
// #endif
// #ifdef H5
uni.switchTab({
url: "/pages/monitoring/index"
})
// #endif
},
//调用扫码方法
scanCodeFun() {
this.$store.dispatch('getCodeInfoFun').then(res => {
console.log(JSON.stringify(res))
uni.switchTab({
url: "/pages/monitoring/index"
})
const data = res.data
if (data.code == 0) {
console.log(JSON.stringify(uni.getStorageSync('projectInfo')))
this.$toast.toast('更新工程信息成功')
this.getLogoImgFun()
}
// console.log(JSON.stringify(res))
// uni.switchTab({
// url: "/pages/monitoring/index"
// })
})
}
},
created() {
// this.getRouter()
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
mounted() {
this.getLogoImgFun()
}
}
</script>
......@@ -93,6 +158,16 @@
left: 50%;
margin-left: -5.5rem;
}
.login-logo-img {
width: 17rem;
height: 106px;
position: absolute;
top: 28vh; // background-color: #eeeeee;
// margin: 0 ;
margin-left: -8.5rem;
left: 50%
}
}
.login-input {
......
......@@ -8,6 +8,7 @@
</template>
<script>
// import '../../js/jquery.signalR-2.4.1.js'
import collapse from '../components/collapse/index.vue'
export default {
components: {
......@@ -15,49 +16,155 @@
},
data() {
return {
dataList:[{
title:'一楼加工厂线监控',
textList:[{
img:'../../static/img1/codelogo.png',
textTitle:'厂区布局',
textTime:'2021/04/12 20:12:24'
projectName:'',
dataList: [{
title: '一楼加工厂线监控',
textList: [{
img: '../../static/img1/codelogo.png',
textTitle: '厂区布局',
textTime: '2021/04/12 20:12:24'
},
{
img:'../../static/img1/codelogo.png',
textTitle:'一号供房印码车间',
textTime:'2021/04/12 20:12:24'
img: '../../static/img1/codelogo.png',
textTitle: '一号供房印码车间',
textTime: '2021/04/12 20:12:24'
}
]
},
{
title:'二楼加工厂线监控',
textList:[{
img:'../../static/img1/codelogo.png',
textTitle:'厂区布局',
textTime:'2021/04/12 20:12:24'
title: '二楼加工厂线监控',
textList: [{
img: '../../static/img1/codelogo.png',
textTitle: '厂区布局',
textTime: '2021/04/12 20:12:24'
}]
}
]
}
},
methods:{
onChangeFun(e){
methods: {
onChangeFun(e) {
},
//获取列表信息,data-当前折叠卡数据/item-当前点击数据/index-当前点击下标
getMonitoringViewInfo(data,item,index){
// console.log('eee')
getMonitoringViewInfo(data, item, index) {
// console.log(JSON.stringify(this.projectName))
if (item) {
if (item.SCMSMenuType == 'view') {
// console.log(JSON.stringify(item))
let title = item.SCMSChildMenuName
let id = item.SCMSChildMenuID
uni.navigateTo({
url: '/pages/monitoring/monitoring-view/index?data='+JSON.stringify(item)
url: '/pages/monitoring/monitoring-view/index?id=' + id + '&title=' + title+'&projectName='+this.projectName
})
}else{
this.$toast.toast('此菜单不是监控画面,不可查看')
}
} else {
this.$toast.toast('获取画面数据失败')
}
// let title = this.$store.state.routerInfo[0].children[0].title
// let id = this.$store.state.routerInfo[0].children[0].id
// uni.navigateTo({
// url: '/pages/monitoring/monitoring-view/index?id='+id+'&title='+title
// })
},
//获取变量类型
getSCMSTagsFun() {
this.$api.getSCMSTags().then(res => {
uni.setStorageSync('variable', JSON.stringify(res.data.data));
// console.log(JSON.stringify(res.data))
})
},
//请求路由权限的方法
getRouter() {
var userid = ''
this.$api.mainGetMenuKey(userid).then(res => {
const data = res.data
if (data.code == 0) {
if (data.data) {
uni.setStorageSync('routerInfo', JSON.stringify(data.data));
this.$store.state.routerInfo = data.data
// console.log(JSON.stringify(this.$store.state.routerInfo))
}
}
}).catch(error => {
console.log(error)
})
},
//获取监控列表
getMenuFun() {
let projectInfo = uni.getStorageSync('projectInfo')
// console.log('6566'+JSON.stringify(projectInfo))
this.projectName = projectInfo.projectName
this.$api.getMenu(this.projectName).then(res => {
// console.log('menu'+JSON.stringify(res))
const data = res.data
if (data.code == 0) {
if (data.data) {
const data1 = data.data
let mainMenus = JSON.parse(data1.mainMenus)
let childMenus = JSON.parse(data1.childMenus)
mainMenus.forEach(item => {
item.title = item.SCMSMainMenuName
item.textList = []
for (let i = 0; i < childMenus.length; i++) {
let childMenusItem = childMenus[i]
if (childMenusItem.SCMSMainMenuID == item.SCMSMainMenuID) {
childMenusItem.img = '../../static/img1/codelogo.png'
childMenusItem.textTitle = childMenusItem.SCMSChildMenuName
childMenusItem.textTime = '2021/04/12 20:12:24'
item.textList.push(childMenusItem)
}
}
})
this.dataList = mainMenus
}
} else {
this.$toast.toast(data.msg)
}
}).catch(err => {
console.log(err)
})
},
//建立WebSocket连接
getWebSocket() {
uni.connectSocket({
url: 'ws://api/hubs/chart', //仅为示例,并非真实接口地址
success: (res => {
// console.log('res==>' + JSON.stringify(res))
}),
complete: (res) => {
// console.log('res==>'+JSON.stringify(res))
}
});
// console.log(JSON.stringify(data))
// console.log(JSON.stringify(item))
// this.$toast.toast(index.toString())
uni.onSocketMessage(function(res) {
console.log('收到服务器内容:' + res.data);
});
}
},
mounted() {
},
created() {
this.getSCMSTagsFun()
// this.getWebSocket()
this.getRouter()
},
onShow() {
this.getMenuFun()
},
onLoad() {
// console.log('App Launch'),
......
<!-- 监控画面页面 -->
<template>
<view class="monitoring-view">
<view ref="movableView" class="monitoring-view">
<view id="viewTitleBar" ref="viewTitleBar" class="view-title-bar"
:class="{'show-title-bar':isTitleBar,'hide-title-bar':!isTitleBar}">
<view style="height: 60rpx;"></view>
<view style="height: 20px;"></view>
<title-bar @return-back-fun="returnBackFun" :title="viewTitle"></title-bar>
</view>
<image ref="viewSuoDing" @click="suoDingFun" class="view-icon view-suoding" :src="suoDingSrc"></image>
<image id="viewShuaxin" ref="viewShuaxin" @click="refreshFun" class="view-icon view-shuaxin"
:class="{'refresh-style':isRefresh}" src="../../../static/img1/shuaxin.png"></image>
<image v-show="isReduction" @click="reductionFun" class="view-icon view-huanyuan"
src="../../../static/img1/huanyuan.png"></image>
<view class="max-viewbody" @click="closeTitleBarFun">
<view ref="moveView" @click.stop="stopPartent" id="maxView"
:style="{height:maxViewMoveStyle.height+'px',width:maxViewMoveStyle.width+'px',transform:'scale('+view.transform+') translate('+view.translateX+'px,'+view.translateY+'px)',top:maxViewMoveStyle.top+'px',left:maxViewMoveStyle.left+'px'}"
class="max-view1" @touchstart="touchstartFun" @touchmove="touchmoveFun" @touchend="touchendFun">
<movable-area class="max-viewbody"
:style="{height:maxViewAreaStyle.height+'px',width:maxViewAreaStyle.width+'px',background:maxViewAreaStyle.background}">
<movable-view @click="closeTitleBarFun" :x="x" :y="y" ref="moveView" id="maxView" out-of-bounds="true"
class="max-view" :direction="isScale?'all':'none'" :scale="isScale" :scale-value="view.transform"
:style="{height:maxViewMoveStyle.height+'px',width:maxViewMoveStyle.width+'px',top:maxViewMoveStyle.top+'px',left:maxViewMoveStyle.left+'px',background:maxViewMoveStyle.background}"
@change="onChangeFun" @scale="onScale" :scale-min="view.transform">
<view id="maxView1" style="position: relative;width: 100%;height: 100%;">
<view style="position: absolute;top:5px;left: 20px;z-index: 2;width: 300px;">
<input placeholder="请输入内容" />
</view>
<line-echart :echartView="echartView" type="pie" :option="option" :chartData="chartData"
id="maxView1">
</line-echart>
</view>
<line-vue1 ref="lineVue1" :dae="data" :dataId="dataId"></line-vue1>
<rectangle-vue2 ref="rectangleVue2" :dae="data" :dataId="dataId"></rectangle-vue2>
<ellipse-vue3 ref="ellipseVue3" :dae="data" :dataId="dataId"></ellipse-vue3>
<corner-button6 ref="connerButton6" @click.stop="stopPartent" :dae="data" :dataId="dataId">
</corner-button6>
<static-image4 ref="staticImage4" :dae="data" :dataId="dataId" :name="viewTitle"></static-image4>
<static-text-block5 ref="staticTextBlock5" :dae="data" :dataId="dataId"></static-text-block5>
<press-button7 ref="pressButton7" :dae="data" :dataId="dataId"></press-button7>
<switch8 ref="switch8" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr"></switch8>
<tab-module-button9 ref="tabModuleButton9" :dae="data" :dataId="dataId"></tab-module-button9>
<popup-button10 ref="popupButton10" :dae="data" :dataId="dataId"></popup-button10>
<text-box11 ref="textBox11" :dae="data" :dataId="dataId"></text-box11>
<data-text-block12 ref="dataTextBlock12" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr">
</data-text-block12>
<r-w-text-box13 ref="rwTextBox13" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr">
</r-w-text-box13>
<alarm14 ref="alarm14" :dae="data" :dataId="dataId"></alarm14>
<flow-pipe ref="flowPipe" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr"></flow-pipe>
<tank ref="tank" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr"></tank>
<mobile-products :newTagArr="newTagDataArr" ref="mobileProducts" :dae="data" :dataId="dataId">
</mobile-products>
<dynamic-products ref="dynamicProducts" :dae="data" :dataId="dataId"></dynamic-products>
<ellipse-lamp15 ref="ellipseLamp15" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr">
</ellipse-lamp15>
<common-lamp16 ref="commonLamp16" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr">
</common-lamp16>
<dynamic-text17 ref="dynamicText17" :dae="data" :dataId="dataId" :newTagArr="newTagDataArr">
</dynamic-text17>
<image18 ref="image18" :dae="data" :dataId="dataId" :name="viewTitle" :newTagArr="newTagDataArr">
</image18>
<customreport ref="customreport" :dae="data" :dataId="dataId"></customreport>
<query-button25 @search-btn-fun="searchBtnFun" ref="queryButton25" :dae="data" :dataId="dataId">
</query-button25>
<output-button26 ref="outputButton26" :dae="data" :dataId="dataId">></output-button26>
<date-time-picker282 ref="dataTimePicker282" @show-picker="showPicker" :dae="data" :dataId="dataId">
</date-time-picker282>
<combobox299 ref="combobox299" :dae="data" :dataId="dataId"></combobox299>
<textimport27a ref="textimport27a" :dae="data" :dataId="dataId"></textimport27a>
<number-screen30 ref="numberScreen30" :dae="data" :dataId="dataId"></number-screen30>
<pie-chart20 ref="pieChart20" :dae="data" :dataId="dataId" :chartdata="contentData"
:newTagArr="newTagDataArr" :newTagData1="newTagData1"></pie-chart20>
<dash-board-chart21 :newTagData1="newTagData1" :newTagArr="newTagDataArr" ref="dashBoardChart21"
:dae="data" :dataId="dataId" :chartdata="contentData">
</dash-board-chart21>
<line-chart22 :newTagData1="newTagData1" :newTagArr="newTagDataArr" ref="lineChart22" :dae="data"
:dataId="dataId" :chartdata="contentData">
</line-chart22>
<column-chart23 :newTagData1="newTagData1" ref="columnChart23" :dae="data" :dataId="dataId"
:chartdata="contentData">
</column-chart23>
<polyline-column-chart24 :newTagData1="newTagData1" ref="polylineColumnChart24" :dae="data"
:dataId="dataId" :chartdata="contentData">
</polyline-column-chart24>
</view>
</view>
<!-- <view v-show="showMinView" class="min-view">
<movable-area class="min-view-area">
<movable-view style="width: 142rpx;height: 40px;" direction="all">
<view style="width: 142rpx;height: 40px;background: rgba(0,0,0,0.1);">
</view>
</movable-view>
</movable-area>
</view> -->
<!-- <movable-area id="maxViewArea" :style="{height:maxViewAreaStyle.height+'px',width:maxViewAreaStyle.width+'px',background:maxViewAreaStyle.background,'pointer-events': 'none'}">
</view>
<movable-view :style="{top:maxViewMoveStyle.top+'px',height:maxViewMoveStyle.height+'px',width:maxViewMoveStyle.width+'px',background:maxViewMoveStyle.background,'pointer-events': 'auto'}"
ref="movableView" scale="true" @change="onChangeFun" :scale-max="5" direction="all" :scale-value="scaleValue" :scale-min="0.5" @scale="onScale">
<view :style="maxViewStyle" id="maxView" ref="maxView" class="max-view">
<input placeholder="请输入内容" />
<line-echart :echartView="echartView" type="pie" :option="option" :chartData="chartData"
id="maxView1"></line-echart>
</view>
</movable-view>
</movable-area>
-->
<view>
<my-datetime ref="dateTimePop" @ok="changeTime"></my-datetime>
<!-- <u-picker mode="time" v-model="showPickerTime" :params="params" @confirm="changeTime"></u-picker> -->
<!-- <uni-datetime-picker v-model="showPickerTime" start="2010-6-10 08:30:30" end="2021-6-10 08:30:30">
</uni-datetime-picker> -->
</view>
</view>
</template>
<script>
import {
getRgbaFun,
unique
} from '../../../js/tool.js'
import CornerButton6 from '../../conponent/CornerButton6.vue'
import TextBox11 from '../../conponent/TextBox11.vue'
import titleBar from '../../components/title-bar/index.vue'
import lineEchart from '../../components/echarts/line-echart/index.vue'
import RectangleVue2 from '../../conponent/RectangleVue2.vue'
import LineVue1 from '../../conponent/LineVue1.vue'
// import lineEchart from '../../components/echarts/line-echart/index.vue'
import EllipseVue3 from '../../conponent/EllipseVue3.vue'
import StaticImage4 from '../../conponent/StaticImage4.vue'
import StaticTextBlock5 from '../../conponent/StaticTextBlock5.vue'
import PressButton7 from '../../conponent/PressButton7.vue'
import Switch8 from '../../conponent/Switch8.vue'
import TabModuleButton9 from '../../conponent/TabModuleButton9.vue'
import PopupButton10 from '../../conponent/PopupButton10.vue'
import DataTextBlock12 from '../../conponent/DataTextBlock12.vue'
import RWTextBox13 from '../../conponent/RWTextBox13.vue'
import Alarm14 from '../../conponent/Alarm14.vue'
import DynamicText17 from '../../conponent/DynamicText17.vue'
import FlowPipe from '../../conponent/FlowPipe.vue'
import Tank from '../../conponent/Tank.vue'
import MobileProducts from '../../conponent/MobileProducts.vue'
import DynamicProducts from '../../conponent/DynamicProducts.vue'
import EllipseLamp15 from '../../conponent/EllipseLamp15.vue'
import CommonLamp16 from '../../conponent/CommonLamp16.vue'
import Image18 from '../../conponent/Image18.vue'
import Customreport from '../../conponent/customreport.vue'
import QueryButton25 from '../../conponent/QueryButton25.vue'
import OutputButton26 from '../../conponent/outputbutton26.vue'
import DateTimePicker282 from '../../conponent/DateTimePicker282.vue'
import Combobox299 from '../../conponent/Combobox299.vue'
import Textimport27a from '../../conponent/textimport27.vue'
import NumberScreen30 from '../../conponent/NumberScreen30.vue'
import PieChart20 from '../../conponent/PieChart20.vue'
import DashBoardChart21 from '../../conponent/DashBoardChart21.vue'
import LineChart22 from '../../conponent/LineChart22.vue'
import ColumnChart23 from '../../conponent/ColumnChart23.vue'
import PolylineColumnChart24 from '../../conponent/PolylineColumnChart24.vue'
import myDatetime from '../../../components/my-datetime/my-datetime.vue'
export default {
components: {
lineEchart,
titleBar
// lineEchart,
myDatetime,
titleBar,
LineVue1, //直线控件
RectangleVue2, //矩形控件
EllipseVue3, //圆形控件
StaticImage4, //静态图片控件
StaticTextBlock5, //静态文本控件
CornerButton6, //控制按钮控件
PressButton7, //点动按钮控件
Switch8, //开关按钮控件
TabModuleButton9, //跳转按钮控件
PopupButton10, //弹窗按钮控件
TextBox11, //数值输入控件
DataTextBlock12, //数值显示控件
RWTextBox13, //读写框控件
Alarm14, //报警控件
EllipseLamp15, //圆形状态灯控件
CommonLamp16, //矩形状态灯控件
DynamicText17, //动态文本控件
Image18, //动态图片控件
QueryButton25, //查询控件
OutputButton26, //导出控件
MobileProducts, //静态产品线
DynamicProducts, //动态产品线
FlowPipe, //流动管道
Tank, //罐体
Customreport, //自定义报表
DateTimePicker282, //时间控件
Combobox299, //下拉文本控件
Textimport27a, //输入关键字控件
NumberScreen30, //数值筛选
PieChart20, //饼图控件,
DashBoardChart21, //仪表盘控件
LineChart22, //折线图控件
ColumnChart23, //柱形图控件
PolylineColumnChart24, //折线柱形图控件
},
data() {
return {
timer:'',//定时器
newTagData1: [], //图表实时刷新
tagArr: [], //画布变量集合
newTagDataArr: [],
timer1: '',
params: { //时间选择器显示类型
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true
},
showPickerTime: false, //是否显示时间选择器
viewRouterData: '',
contentData: '',
y: 0,
x: 0,
dataId: '',
data: '',
ControlsData: '',
Controls: '',
timer: '', //定时器
isTitleBar: true, //是否展示标题栏
isReduction: false, //是否展示还原图标
isRefresh: false, //点击刷新图标添加动画
viewTitle: '标题', //画面导航标题
projectName: '', //项目名称
showMinView: false,
scaleValue: 1,
viewHeight: 700,
maxViewMoveStyle: { //画面样式配置
height: 20,
width: 20,
background: 'red',
height: 375,
width: 667,
background: '#eee',
top: 0,
left: 0
},
maxViewAreaStyle: {
height: 20,
width: 20,
background: '#fff',
height: 667,
width: 375,
background: '#000',
},
maxViewStyle: {},
echartView: {}, //图表长宽配置
option: { //图表基础配置
// backgroundColor: '#2c343c',
legend: {
show: false
},
title: {
text: 'Customized Pie',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip: {
trigger: 'item'
obj: {},
start: [], //手指点击初始位置
end: [], //手指移动最后位置
isTouch: false, //是否触屏
view: { //画面缩放移动配置
transform: 1, //缩放比例
translateX: 0, //水平移动
translateY: 0 //上下移动
},
portraitUrl: 0,
oldTransform: 1,
marginLeft: 0,
suoDingSrc: '../../../static/img1/suoding.png',
isScale: true,
realyEchart: {
barEchart: [],
pieEchart: [],
lineEchart: [],
barLineEchart: [],
dashEchart: []
},
bindingData: []
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
seriesTemplate: {
name: '访问来源',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
roseType: 'radius',
label: {
color: 'rgba(255, 255, 255, 0.3)'
},
labelLine: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
},
itemStyle: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
onLoad(option) {
// #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary'); //锁定页面方向
// #endif
// console.log(JSON.stringify(option))
// console.log(data)
this.$nextTick(function() {
// console.log(JSON.stringify(option))
// this.viewTitle = data.textTitle
// this.viewRouterData =JSON.parse(option.data)
this.viewTitle = option.title
this.dataId = option.id
this.projectName = option.projectName
// console.log('333=>' + this.viewTitle)
})
},
onResize() {
let _this = this
uni.getSystemInfo({
success: function(res) {
if (res.windowWidth < res.windowHeight) {
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function(idx) {
return Math.random() * 200;
if (_this.portraitUrl == 1) {
uni.navigateBack()
}
} else if (res.windowWidth > res.windowHeight) {
_this.$nextTick(function() {
_this.getDataInfo()
})
}
},
chartData: { //图表数据
series: [{
data: [{
value: 335,
name: '直接访问'
},
{
value: 310,
name: '邮件营销'
}
})
},
{
value: 274,
name: '联盟广告'
onReady() {},
methods: {
suoDingFun() {
this.isScale = !this.isScale
if (this.isScale) {
this.suoDingSrc = '../../../static/img1/suoding.png'
} else {
this.suoDingSrc = '../../../static/img1/jiesuo.png'
}
},
{
value: 235,
name: '视频广告'
//图表历史,业务数据初始化查询
initEchart() {
// console.log('434=>')
this.$nextTick(() => {
// console.log('444=>'+JSON.stringify(this.$refs.queryButton25.dataValue))
let queryButtonList = this.$refs.queryButton25.dataValue
queryButtonList.forEach((item, index) => {
this.searchBtnFun(item)
})
})
},
{
value: 400,
name: '搜索引擎'
//点击查询按钮查询
searchBtnFun(item) {
// console.log(JSON.stringify(item))
//查询图表信息
if (this.bindingData.length > 0) {
let bindingData = this.bindingData
let picker = []
for (let i = 0; i < bindingData.length; i++) {
let Controls = bindingData[i].Controls
if (Controls.Query == item.class) {
picker.push(Controls.BeginTime, Controls.EndTime)
}
}
var myPicker = new Set(picker)
var pickerArray = [...myPicker]
// console.log(pureArray)
let dataValue = this.$refs.dataTimePicker282.dataValue
let getDataTimeList = {}
for (let i = 0; i < dataValue.length; i++) {
for (let j = 0; j < pickerArray.length; j++) {
if (dataValue[i].class == pickerArray[j]) {
getDataTimeList[pickerArray[j]] = {
Value: dataValue[i].value
}
}
}
]
}]
}
let queryChartData = {
"ViewName": this.viewTitle,
"ButtonName": item.class,
"ControlProviders": getDataTimeList
}
if (picker.length > 0) {
this.getChartQueryFun(queryChartData)
}
// console.log(22+JSON.stringify(getDataTimeList))
}
this.$refs.customreport.searchReport(item)
// console.log(this.$refs.customreport)
},
obj: {},
start: [], //手指点击初始位置
end: [], //手指移动最后位置
isTouch: false, //是否触屏
view: { //画面缩放移动配置
transform: 1, //缩放比例
translateX: 0, //水平移动
translateY: 0 //上下移动
//查询按钮查询图表
getChartQueryFun(data) {
// console.log(JSON.stringify(data))
this.$api.getChartQuery(data).then(res => {
const data = res.data.data
if (data.Data) {
this.$refs.pieChart20.getRefresh1(data.Data, 1)
this.$refs.dashBoardChart21.getRefresh(data.Data, 1)
this.$refs.lineChart22.getRefresh(data.Data, 1)
this.$refs.columnChart23.getRefresh(data.Data, 1)
this.$refs.polylineColumnChart24.getRefresh(data.Data, 1)
}
}).catch(err => {
console.log(err)
})
},
oldTransform: 1,
//变量实时轮询
postRediusTestFun(tagArr) {
clearInterval(this.timer1)
this.timer1 = ''
// this.$refs.mobileProducts.AxiosFlowList()
this.$api.postRediusTest(tagArr).then(res => {
if (res.data.code == 0) {
this.newTagDataArr = res.data.data
this.$refs.rwTextBox13.axio()
this.$refs.tank.axio()
this.$refs.flowPipe.axioImg2(this.newTagDataArr)
this.$refs.ellipseLamp15.axio()
this.$refs.commonLamp16.axio()
this.$refs.dynamicText17.axio()
// this.$refs.rwTextBox13.axio()
this.$refs.mobileProducts.AxiosFlowList()
this.$refs.dynamicProducts.AxiosFlowList()
this.$refs.dataTextBlock12.axio()
this.$refs.switch8.switchAxios()
this.$refs.image18.axioImg()
//是否有报警信息
if(this.ControlsData.AlarmTagItemList.length>0){
this.$refs.alarm14.axioss()
}
// this.$refs.pieChart20.getRefresh()
this.timer1 = setInterval(() => {
this.postRediusTestFun(tagArr)
this.getRelayEchartFun()
}, 2000)
}
}).catch(err => {
console.log(err)
})
marginLeft: 0
this.getRelayEchartFun()
}
// },10000)
// this.timer1 = setInterval(()=>{
// this.$refs.rwTextBox13.axio()
// this.$refs.tank.axio()
// },10000)
},
onLoad(option) {
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定页面方向
// #endif
let data = JSON.parse(option.data)
this.$nextTick(function() {
this.viewTitle = data.textTitle
//图表实时轮询
getRelayEchartFun() {
if (this.realyEchart.pieEchart.length > 0 || this.realyEchart.lineEchart.length > 0 || this.realyEchart
.barEchart.length > 0 || this.realyEchart.barLineEchart.length > 0 || this.realyEchart.dashEchart
.length > 0) {
this.$api.getRelayEchart(this.viewTitle).then(res => {
if (res) {
this.newTagData1 = res.data
if (this.realyEchart.pieEchart.length > 0) {
this.$refs.pieChart20.getRefresh1(this.realyEchart.pieEchart)
}
if (this.realyEchart.lineEchart.length > 0) {
this.$refs.lineChart22.getRefresh(this.realyEchart.lineEchart)
}
if (this.realyEchart.barEchart.length > 0) {
this.$refs.columnChart23.getRefresh(this.realyEchart.barEchart)
}
if (this.realyEchart.barLineEchart.length > 0) {
this.$refs.polylineColumnChart24.getRefresh(this.realyEchart.barLineEchart)
}
if (this.realyEchart.dashEchart.length > 0) {
this.$refs.dashBoardChart21.getRefresh(this.realyEchart.dashEchart)
}
}
}).catch(err => {
console.log(err)
})
}
},
onReady() {},
changeTime(str, obj) {
// let timer = val.year+'-'+val.month+'-'+val.day+' '+val.hour+':'+val.minute+':'+val.second
this.$refs.dataTimePicker282.getTime(str)
// console.log(JSON.stringify(val))
// console.log(JSON.stringify(timer))
methods: {
},
showPicker(item) {
// console.log(JSON.stringify(item))
this.showPickerTime = true
this.$refs.dateTimePop.open(item.value || '');
},
onScale(e) {
const qu = uni.createSelectorQuery().in(this);
qu.select('#maxView1').boundingClientRect(data => {
// console.log(JSON.stringify(data))
// console.log(JSON.stringify(this.maxViewMoveStyle))
let scale = e.detail.scale
if (scale > this.view.transform) {
this.isReduction = true
} else {
this.isReduction = false
}
// console.log(111+JSON.stringify(this.view.transform))
// const qu = uni.createSelectorQuery().in(this);
// qu.select('#maxView1').boundingClientRect(data => {
// // console.log(JSON.stringify(data))
}).exec();
// }).exec();
},
//返回上一页
returnBackFun() {
uni.navigateBack()
// #ifdef APP-PLUS
plus.screen.unlockOrientation()
plus.screen.lockOrientation('portrait-primary'); //锁定页面方向
this.portraitUrl = 1
// #endif
// uni.navigateBack()
// uni.navigateTo({
// url: '/pages/monitoring/go-back/index',
// animationType: 'none',
// animationDuration: 0
// })
},
//还原画面初始化
reductionFun() {
this.isReduction = false
this.$nextTick(function() {
// this.view.transform = 1.2
})
// console.log(JSON.stringify(this.$refs.moveView))
// this.isReduction = false
// this.view.transform = 0.5
},
//刷新
......@@ -222,46 +508,226 @@
this.isRefresh = false
}, 1000)
}
// this.scaleValue = 1
// this.view.transform = 1
// this.getInitFun()
// const qu = uni.createSelectorQuery().in(this);
// qu.select('#maxView').boundingClientRect(data => {
// console.log(JSON.stringify(data))
// }).exec();
},
stopPartent(){
stopPartent() {
},
onChangeFun(e) {
// this.x = e.detail.x
// this.y = e.detail.y
// console.log(JSON.stringify(e))
},
getTagArr(data) {
let tagArr = []
for (let key in data) {
// console.log(data[key])
if (data[key] != '' && data[key] != []) {
let dataKey = data[key]
for (let i = 0; i < dataKey.length; i++) {
let item = dataKey[i]
if (key == 'AlarmGroupItemList') {
} else if (key == 'AlarmTagItemList') {
// console.log(11+item.TagName)
} else if (key == 'AssociateDateTimePickerList') {
} else if (key == 'AssociateNumericalEntityList') {
} else if (key == 'BarChartItemList') {
let option = JSON.parse(item.option)
// let DataSource = option.DataSource
if (option.DataSource == 'Realy') {
this.realyEchart.barEchart.push(item)
}
// console.log('00'+JSON.stringify(option))
} else if (key == 'ComboBoxList') {
} else if (key == 'CommonButtonGroupList') {
} else if (key == 'CommonButtonList') {
} else if (key == 'DashBoardChartItemList') {
let variable = item.variable
variable.forEach(item1 => {
tagArr.push(item1.VariableName)
})
let option = JSON.parse(item.option)
// let DataSource = option.DataSource
if (option.DataSource == 'Realy') {
this.realyEchart.dashEchart.push(item)
}
} else if (key == 'DataAnimationList') {
} else if (key == 'DataStatusTextColorEffectAnimationList') {
// console.log(11+item.TagName)
tagArr.push(item.TagName)
} else if (key == 'EventScriptList') {
} else if (key == 'FlowPipeAnimationList') {
tagArr.push(item.LineTagName, item.SpeedTagName)
// tagArr.push(item.SpeedTagName)
} else if (key == 'ImageAnimationList') {
tagArr.push(item.TagName)
} else if (key == 'InputDataList') {
} else if (key == 'KeyboardControlList') {
} else if (key == 'LineBarChartItemList') {
let variable = item.variable
variable.forEach(item1 => {
tagArr.push(item1.VariableName)
})
let option = JSON.parse(item.option)
// let DataSource = option.DataSource
if (option.DataSource == 'Realy') {
this.realyEchart.barLineEchart.push(item)
}
} else if (key == 'LineChartItemList') {
let variable = item.variable
variable.forEach(item1 => {
tagArr.push(item1.VariableName)
})
let option = JSON.parse(item.option)
// let DataSource = option.DataSource
if (option.DataSource == 'Realy') {
this.realyEchart.lineEchart.push(item)
}
} else if (key == 'OutputButtonList') {
} else if (key == 'ParameterReportItemtList') {
} else if (key == 'PieChartItemList') {
let variable = item.variable
variable.forEach(item1 => {
tagArr.push(item1.VariableName)
})
let option = JSON.parse(item.option)
// let DataSource = option.DataSource
if (option.DataSource == 'Realy') {
this.realyEchart.pieEchart.push(item)
}
} else if (key == 'PopupButtonList') {
} else if (key == 'PressButtonList') {
} else if (key == 'PrintingButtonList') {
} else if (key == 'ProductFlowList') {
// tagArr.push(item.SpeedVariable)
let CorrelationInfos = item.CorrelationInfos
CorrelationInfos.forEach(item1 => {
tagArr.push(item1.Info.VariableName)
})
} else if (key == 'QueryButtonList') {
} else if (key == 'RWDataList') {
tagArr.push(item.TagName)
} else if (key == 'ScatterPlotChartItemList') {
} else if (key == 'StatusAnimationList') {
tagArr.push(item.TagName)
} else if (key == 'SwitchList') {
} else if (key == 'TDDesignerItemList') {
} else if (key == 'TabModuleButtonList') {
} else if (key == 'TabModuleButtonParaList') {
} else if (key == 'TankAnimationList') {
tagArr.push(item.FillTagName)
} else if (key == 'TextAnimationList') {
tagArr.push(item.TagName)
} else if (key == 'TextImportList') {
}
}
}
}
let tagArr1 = unique(tagArr)
this.tagArr = tagArr1
this.postRediusTestFun(tagArr1)
setTimeout(()=>{
this.initEchart()
})
// console.log(tagArr1)
// console.log('jj'+JSON.stringify(this.realyEchart))
},
getDataInfo() {
if (this.viewTitle) {
// console.log(JSON.stringify(this.viewTitle))
this.$api.getControlsJson(this.projectName, `${this.viewTitle}`).then(res => {
// console.log(JSON.stringify(res))
if (res) {
this.Controls = res.data.Controls
this.ControlsData = res.data.Data
// console.log(JSON.stringify(this.Controls))
this.maxViewMoveStyle.height = this.Controls.PropertyList.Height
this.maxViewMoveStyle.width = this.Controls.PropertyList.Width
// console.log(JSON.parse(this.Controls.PropertyList.Background).Data.Color)
this.maxViewMoveStyle.background = getRgbaFun(JSON.parse(this.Controls.PropertyList
.Background).Data.Color)
this.data = res.data
this.getInitFun()
this.getTagArr(this.ControlsData)
}
// console.log(JSON.stringify(res))
}).catch(err => {
console.log(err)
})
}
},
//获取查询按钮时间控件跟图表绑定信息
getChartControlNamesFun() {
this.$api.getChartControlNames(`${this.viewTitle}`).then(res => {
const data = res.data.data
if (data) {
this.bindingData = data
this.$refs.queryButton25.getBindingData(data)
}
}).catch(err => {
console.log(err)
})
},
//初始化
getInitFun() {
let _this = this
uni.getSystemInfo({
success: function(res) {
_this.$nextTick(function() {
_this.viewHeight = res.windowHeight
_this.maxViewMoveStyle.height = 400;
_this.maxViewMoveStyle.width = res.windowWidth
_this.maxViewAreaStyle.height = res.windowHeight
_this.maxViewAreaStyle.width = res.windowWidth
// const qu = uni.createSelectorQuery().in(_this);
// qu.select('#maxView').boundingClientRect(data => {
// _this.maxViewMoveStyle.top = (res.windowHeight - data.height) /2
// }).exec();
_this.maxViewMoveStyle.top = (res.windowHeight - _this.maxViewMoveStyle
.height) / 2
// console.log(JSON.stringify(_this.maxViewMoveStyle.top))
_this.view.transform = (res.windowWidth / this.Controls.PropertyList
.Width) >= 0.5 ? res.windowWidth / this.Controls.PropertyList
.Width :
0.5
// console.log(222+JSON.stringify(_this.view.transform))
_this.oldTransform = _this.view.transform
})
}
});
},
getViewAreaStyle() {
this.maxViewAreaStyle.height = this.maxViewMoveStyle.height * 3
this.maxViewAreaStyle.width = this.maxViewMoveStyle.height * 3
this.view.translateY = -this.maxViewMoveStyle.height
// this.view.translateX = -this.maxViewMoveStyle.
},
//缩放
touchstartFun(e) {
this.maxViewMoveStyle.top = Number(this.maxViewMoveStyle.top) + Number(this.view.translateY) * this.view
......@@ -300,7 +766,7 @@
var now = e.touches;
//得到缩放比例,getDistance是勾股定理的一个方法
if(this.view.transform >=1){
if (this.view.transform >= this.oldTransform) {
this.isReduction = true
let scale = this.getDistance(now[0], now[1]) / this.getDistance(this.start[0], this.start[1])
//得到旋转角度,getAngle是得到夹角的一个方法
......@@ -321,7 +787,7 @@
},
touchendFun(e) {
//将 isTouch 修改为false 表示 手指已经离开屏幕
if(this.view.transform == 1){
if (this.view.transform == this.oldTransform) {
this.isReduction = false
}
if (this.isTouch) {
......@@ -343,16 +809,16 @@
//关闭标题栏
closeTitleBarFun(type) {
clearTimeout(this.timer);
if(type == 1){
this.timer=setTimeout(() => {
if (type == 1) {
this.timer = setTimeout(() => {
this.isTitleBar = false
}, 3000)
}else{
if(this.isTitleBar){
} else {
if (this.isTitleBar) {
this.isTitleBar = false
}else{
} else {
this.isTitleBar = true
this.timer=setTimeout(() => {
this.timer = setTimeout(() => {
this.isTitleBar = false
}, 3000)
}
......@@ -364,13 +830,19 @@
},
created() {
this.echartView.height = 400
this.echartView.width = 350
// // #ifdef H5
// this.getChartControlNamesFun()
// // #endif
},
mounted() {
this.getChartControlNamesFun()
this.closeTitleBarFun(1)
// #ifdef H5
this.getDataInfo()
// #endif
// console.log(JSON.stringify(this.$store.systemInfo))
this.getInitFun()
},
......@@ -378,11 +850,30 @@
},
onUnload() {
if(this.timer) {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
if (this.timer1) {
clearInterval(this.timer1)
this.timer1 = null;
}
},
beforeDestroy() {
clearInterval(this.timer1)
this.timer1 = null;
// #ifdef APP-PLUS
plus.screen.unlockOrientation()
plus.screen.lockOrientation('portrait-primary'); //锁定页面方向
this.portraitUrl = 1
// #endif
// uni.navigateTo({
// url: '/pages/monitoring/go-back/index',
// animationType: 'none',
// animationDuration: 0
// })
},
}
</script>
......@@ -393,23 +884,25 @@
// overflow: auto;
.view-icon {
width: 64rpx;
height: 64rpx;
width: 32px;
height: 32px;
position: absolute;
z-index: 1;
}
@keyframes moveTop {
0%{
0% {
transform: translateY(0);
}
100% {
transform: translateY(-160rpx);
transform: translateY(-80px);
}
}
@keyframes getTop {
0%{
transform: translateY(-160rpx);
0% {
transform: translateY(-80px);
}
100% {
......@@ -428,28 +921,34 @@
}
.show-title-bar {
animation: getTop 0.5s;
transform: translateY(0);
}
.hide-title-bar {
animation: moveTop 0.5s;
transform: translateY(-160rpx)
transform: translateY(-80px)
}
.view-return {
top: 90rpx;
left: 40rpx;
top: 45px;
left: 20px;
}
.view-shuaxin {
bottom: 110rpx;
right: 40rpx;
bottom: 55px;
right: 20px;
}
.view-suoding {
bottom: 100px;
right: 20px;
}
.refresh-style {
......@@ -459,8 +958,8 @@
.view-huanyuan {
right: 40rpx;
bottom: 22rpx;
right: 20px;
bottom: 11px;
}
.min-view {
......
......@@ -52,51 +52,23 @@
},
//调用扫码方法
scanCodeFun() {
// uni.redirectTo({
// url: "/pages/login/index"
// })
this.$store.dispatch('getCodeInfoFun').then(res=>{
console.log(JSON.stringify(res))
// console.log(JSON.stringify(res))
const data = res.data
if(data.code == 0){
console.log(res.data)
this.$toast.toast('获取工程信息成功')
uni.redirectTo({
url: "/pages/login/index"
})
}
}).catch(res=>{
console.log(res)
})
// let _this = this
// // #ifdef APP-PLUS
// uni.scanCode({
// // onlyFromCamera: true,
// scanType: ['qrCode', 'barCode'],
// success: function(res) {
// console.log('条码类型:' + res.scanType);
// console.log('条码内容:' + res.result);
// //扫码成功跳转登录页面
// uni.redirectTo({
// url: "/pages/login/index"
// })
// },
// complete: function(res) {
// // uni.redirectTo({
// // url: "/pages/login/index"
// // })
// // setTimeout(function() {
// uni.hideLoading();
// // }, 2000);
// },
// fail: function(res) {
// console.log('失败条码类型:' + res.scanType);
// setTimeout(function() {
// uni.hideLoading();
// }, 2000);
// }
// });
// // uni.redirectTo({
// // url: "/pages/login/index"
// // })
// // #endif
// // #ifndef APP-PLUS || APP-NVUE
// uni.redirectTo({
// url: "/pages/login/index"
// })
// // #endif
},
......@@ -128,8 +100,8 @@
height: 100vh;
}
.title-img{
height: 152rpx;
width: 349rpx;
height: 4.75rem;
width: 11rem;
margin-top: 14vh;
}
......@@ -143,19 +115,19 @@
}
.content-title2{
width: 574rpx;
width: 18rem;
text-align: left;
margin-top: 9.3vh;
.title2-text{
margin-top: 33rpx;
margin-top: 1rem;
}
.text1{
font-size: 40rpx;
font-size: 1.25rem;
font-family: PingFang SC;
font-weight: bold;
}
.text2{
font-size: 32rpx;
font-size: 1rem;
font-family: PingFang-SC-Medium;
font-weight: Medium;
}
......@@ -169,18 +141,18 @@
}
.logo {
height: 147rpx;
width: 147rpx;
height: 4.6rem;
width: 4.6rem;
}
.text-area {
padding-top: 35rpx;
padding-top: 1.1rem;
display: flex;
justify-content: center;
}
.title {
font-size: 30rpx;
font-size: 1rem;
font-family: PingFang SC;
font-weight: 500;
color: #3F81FF;
......
......@@ -13,7 +13,7 @@
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary'); //锁定
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
......
// api接口
import api from "./request.js"
// 获取项目信息
// function getAppInfo(projectName) {
// // console.log('projectName=>'+projectName)
// return api.baseRequest('/api/view/GetAppInfo?projectName='+projectName, "GET",2)
// }
function getAppInfo(projectName) {
// console.log('projectName=>'+projectName)
return api.baseRequest(`${projectName}`, "GET",2)
}
//获取图片资源
function getProjectResource(projectName,pathName) {
return api.baseRequest('/api/view/GetProjectResource?projectName='+projectName+'&resourcePath='+pathName,'GET',1)
}
//获取监控列表
function getMenu(projectName) {
return api.baseRequest('/api/view/GetMenu?projectName='+projectName, "GET",0)
}
// 用户密码登录
function login(userName, password) {
return api.baseRequest('/api/Login/Login_GstLoginIsSuccess?argUserAccount=' +userName +'&argPassword='+password, "POST",1)
}
//记录用户登录、注销、退出系统日志
function loginInOutRecord(userName,type){
return api.baseRequest('/api/Login/Login_UserLogInOutRecord?UserName='+userName+'&Type='+type,"POST",1)
}
//获取控件JSON数据
// function getControlsJson(viewName){
// return api.baseRequest1('/ViewJson/'+viewName+'.json',"GET")
// }
function getControlsJson(projectName,viewName){
return api.baseRequest('/api/view/GetProjectResource?projectName='+projectName+'&resourcePath=ViewJson/'+viewName+'.json',"GET",0)
}
//请求权限接口
function mainGetMenuKey(userid){
return api.baseRequest('/api/Main/Main_GetMenuKey?argUserID='+userid,"POST",1)
}
//请求变量类型
function getSCMSTags(){
return api.baseRequest('/api/Base/GetSCMSTags',"POST",1)
}
//数值输入框、控制按钮、点动按钮、开关、读写框下发接口
function postIOServiceTest(data){
return api.baseRequest('/api/Base/PostIOServiceTest',"POST",1,data)
}
//数值显示请求、读写框、罐体、管道流动数值请求
function postRediusTest(data){
return api.baseRequest('/api/Base/PostRediusTest',"POST",1,data)
}
//权限请求接口
function canExcuteAuthorityControl(userinfoID,argChildMenuID,elementName){
return api.baseRequest(`/api/UserManage/UserManage_CanExcuteAuthorityControl?argUserID=${userinfoID}&argChildMenuID=${argChildMenuID}&argElementName=${elementName}`,"POST",1)
}
//获取跳转界面ID
function getViewId(arr,arrId){
return api.baseRequest('/api/HMI/HMI_GstViewId?argChildMenuID=' + arr +'&argChildMenuKey=' + arrId,"POST",1)
}
//下拉文本值
function getDataColumn(ComId,ComNmame){
return api.baseRequest(`/api/control/GetDataColumn?setId=${ComId}&columnName=${ComNmame}`,"GET",1)
}
//报警信息
function gstAlarms(data){
return api.baseRequest(`/api/HMI/HMI_GstAlarms`,"POST",1,data)
}
//获取报表信息
function searchExtensionData(data){
return api.baseRequest(`/api/ParameterReport/SearchExtensionData`,"POST",1,data)
}
//获取报表信息2
function searchItemData(data){
return api.baseRequest(`/api/ParameterReport/SearchItemData`,"POST",1,data)
}
//获取报表信息3
function executeScript(data){
return api.baseRequest(`/api/HMI/HMI_ExecuteScript`,"POST",1,data)
}
//获取图表实时刷新数据
function getRelayEchart(viewName){
return api.baseRequest(`/api/chart/GetRelay?viewName=${viewName}`,"GET",1)
}
//获取查询按钮时间控件跟图表绑定信息
function getChartControlNames(viewName){
return api.baseRequest(`/api/control/GetChartControlNames?viewName=${viewName}`,"GET",1)
}
//点击查询按钮获取图表信息
function getChartQuery(data){
return api.baseRequest(`/api/chart/query`,"POST",1,data)
}
export default {
// 密码登录
passwordLogin(params) {
return api.baseRequest("/platform/metadata/logon", "GET", params)
},
getAppInfo,
getProjectResource,
getMenu,
login,
loginInOutRecord,
mainGetMenuKey,
getControlsJson,
getSCMSTags,
postIOServiceTest,
postRediusTest,
canExcuteAuthorityControl,
getViewId,
getDataColumn,
gstAlarms,
searchExtensionData,
searchItemData,
executeScript,
getRelayEchart,
getChartControlNames,
getChartQuery
}
// 全局请求封装
const token = '自己的token令牌,最好读取缓存中的'
// const token = uni.getStorage('token')
const apiUrl = 'https://v1.shopapi.tpfeps.com'
//#ifdef APP-PLUS
const apiUrl = 'http://192.168.1.68:8804' //app ip
const apiUrl1 = 'http://192.168.1.68:8806' //web ip
//#endif
//#ifndef APP-PLUS
const apiUrl = 'http://192.168.1.68:8806'
//#endif
// const apiUrl = 'http://localhost:5000'
// url-api路径/method-请求类型/data-请求参数
const baseRequest = (url, method, data) => {
const baseRequest = (url,method,type,data) => {
//请求拦截
uni.showLoading({
title: "加载中"
});
return new Promise((resolve, reject) => {
// uni.request({
// url: apiUrl + url,
// data:params,
// method:method,
// header: {
// 'token':token
// }
// }).then((response)=>{
// let [error, res] = response;
// resolve(res.data);
// console.log(response[1].header.token) //获取请求头token
// }).catch(error => {
// let [err, res] = error;
// reject(err)
// })
// uni.showLoading({
// title: "加载中"
// });
let projectInfo = uni.getStorageSync('projectInfo')
let apiAddress = ''
let serviceAddress = ''
if(projectInfo){
apiAddress ='http://' + projectInfo.apiAddress
serviceAddress = 'http://' + projectInfo.serviceAddress
}
let newApiUrl = ''
if(type == 0){
newApiUrl = serviceAddress + url //app ip
}else if(type == 1){
newApiUrl = apiAddress + url //web ip
}else{
newApiUrl = url //完整路径
}
console.log('url1=>'+newApiUrl)
return new Promise((resolve, reject) => {
uni.request({
url: apiUrl + url,
url: newApiUrl,
data: data,
method: method,
header: {
'token': token
// 'token': token
},
success(res) {
// console.log(JSON.stringify(res))
//响应成功拦截
resolve(res)
},
fail(err) {
//响应失败拦截
reject(err)
},
complete(res) {
// console.log(JSON.stringify(res))
//请求完成拦截
// uni.hideLoading()
}
})
});
}
const baseRequest1 = (url, method, data) => {
//请求拦截
// uni.showLoading({
// title: "加载中"
// });
return new Promise((resolve, reject) => {
console.log(apiUrl1 + url)
uni.request({
url: apiUrl1 + url,
data: data,
method: method,
header: {
// 'token': token
},
success(res) {
// console.log(JSON.stringify(res))
//响应成功拦截
resolve(res)
},
......@@ -42,13 +85,15 @@ const baseRequest = (url, method, data) => {
reject(err)
},
complete(res) {
// console.log(JSON.stringify(res))
//请求完成拦截
uni.hideLoading()
// uni.hideLoading()
}
})
});
}
export default {
baseRequest
baseRequest,
baseRequest1
}
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex); //vue的插件机制
import $api from '../request/api.js'
import $toast from '../js/toast.js'
//Vuex.Store 构造器选项
const store = new Vuex.Store({
state: { //存放状态
routerInfo: '',
systemInfo: '', //系统信息
userInfo: '', //用户信息
GetProjectResourceBaseUrl:'/api/view/GetProjectResource',
baseUrl:'http://192.168.1.68:8806'
},
actions: {
//扫码获取信息
......@@ -15,18 +17,48 @@ const store = new Vuex.Store({
commit
}) {
uni.removeStorageSync('projectInfo');
return new Promise((resolve, reject) => {
// #ifdef APP-PLUS
uni.scanCode({
// onlyFromCamera: true,
scanType: ['qrCode', 'barCode'],
success: function(res) {
// console.log(333)
let projectName = res.result
// console.log(22+JSON.stringify(res))
if(projectName){
// console.log(88+JSON.stringify(projectName))
$api.getAppInfo(projectName).then(res=>{
console.log(88+JSON.stringify( res.data.data))
const code = res.data.code
// console.log(JSON.stringify( res.data.data))
if(code == 1){
$toast.toast(res.data.msg)
}else{
uni.setStorageSync('projectInfo', res.data.data);
resolve(res)
}
if(res.statusCode == 500){
$toast.toast('扫码失败')
}
}).catch(err=>{
console.log('err'+JSON.stringify(res))
$toast.toast('扫码失败')
})
}else{
// console.log(444)
$toast.toast('扫码失败')
}
},
complete: function(res) {
uni.hideLoading();
},
fail: function(res) {
reject(res)
console.log('失败条码类型:' + res.scanType);
}
......@@ -37,15 +69,57 @@ const store = new Vuex.Store({
// })
// #endif
// #ifndef APP-PLUS || APP-NVUE
$api.getAppInfo('test').then(res=>{
const code = res.data.code
if(code == 1){
$toast.toast(res.data.msg)
}else{
uni.setStorageSync('projectInfo', res.data.data);
uni.redirectTo({
url: "/pages/login/index"
})
resolve(res)
}
if(res.statusCode == 500){
$toast.toast('扫码失败')
}
}).catch(res=>{
$toast.toast('扫码失败')
})
// #endif
})
},
//权限请求
jurisdictionShow(context,payload) {
const {item,dataId } = payload
return new Promise((resolve, reject) => {
let userinfoID = ''
// console.log(uni.getStorageSync('userInfo1'))
if (uni.getStorageSync('userInfo1') == null) {
// userinfoID = JSON.parse(sessionStorage.getItem('sightseerInfo1')).SCMSUserID;
} else {
userinfoID = uni.getStorageSync('userInfo1').SCMSUserID;
}
let argChildMenuID = dataId
let elementName = item.class
$api.canExcuteAuthorityControl(userinfoID, argChildMenuID, elementName).then(res => {
console.log(JSON.stringify(dataId))
if (res.data.code == 0) {
resolve(res.data)
} else {
reject(res.data)
}
})
})
},
}
})
export default store
......@@ -15,6 +15,7 @@
/* 颜色变量 */
/* 行为相关颜色 */
@import 'uview-ui/theme.scss';
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
......
var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"auto"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"demo2","compilerVersion":"3.1.18","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"portrait-primary"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"demo2","compilerVersion":"3.1.18","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/scan-code/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扫码","titleNView":false}},{"path":"/pages/login/index","meta":{},"window":{"titleNView":false}},{"path":"/pages/monitoring/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"监控"}},{"path":"/pages/data/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"数据"}},{"path":"/pages/working/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"工作"}},{"path":"/pages/message/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"消息"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/monitoring/monitoring-view/index","meta":{},"window":{"titleNView":false,"bounce":false}},{"path":"/pages/scan-code/app-scan/index","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扫码"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment