This commit is contained in:
fan 2019-08-16 15:03:11 +08:00
commit df1994ecfb
13 changed files with 257 additions and 42 deletions

View File

@ -1,7 +1,6 @@
import deviceType from '@/jmap/constant/deviceType';
import { parser } from '@/jmap/utils/parser';
import Vue from 'vue';
/**
* 查询向上受影响的Devices
* @param {Object} map
@ -180,6 +179,15 @@ function saveMapDeviceDefaultRelations(state) {
}
});
}
// 设置图片图层
if (map.resourceList && map.resourceList.length) {
map.resourceList.forEach(elem => {
if (!elem.zIndex) {
elem.zIndex = 1;
}
});
}
}
}

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {
BASE_API = process.env.VUE_APP_BASE_API;

View File

@ -34,6 +34,7 @@ export default {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}

View File

@ -43,6 +43,7 @@ export default {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}

View File

@ -34,6 +34,7 @@ export default {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
lineStyle: {
color: '#57617B'
}

View File

@ -0,0 +1,151 @@
<template>
<div>
<div :id="id" :style="{height: size.height+'px', width: size.width+'px'}" />
<div class="lesson-select">
<el-select v-model="mapName" placeholder="请选择课程" size="mini" style="width: 300px">
<el-option v-for="name in mapNameList" :key="name" :label="name" :value="name" />
</el-select>
</div>
</div>
</template>
<script>
import echarts from 'echarts';
import { listUserPermision } from '@/api/management/author';
export default {
props: {
id: {
type: String,
default: 'chart'
},
size: {
type: Object,
required: true
}
},
data() {
return {
option: {
color: ['#003366', '#006699', '#4cabce', '#e5323e'],
backgroundColor: '#F0F2F5',
title: {
text: '',
subtext: '',
y: 10,
left: 'center',
textAlign: 'center'
},
tooltip: {
},
grid: [{
top: 80,
width: '50%',
bottom: '5%',
left: 10,
containLabel: true
}],
xAxis: [{
type: 'value'
}],
yAxis: [{
type: 'category',
data: [],
axisLabel: {
interval: 0,
rotate: 30
},
splitLine: {
show: false
}
}],
series: [{
type: 'bar',
stack: 'chart',
z: 3,
label: {
normal: {
show: true,
position: 'right'
}
},
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
data: []
}, {
type: 'pie',
radius: [0, '70%'],
center: ['75%', '52%'],
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.percent}%`; }
},
data: []
}]
},
mapName: '',
mapNameList: [],
permissionList: [],
chart: null
};
},
watch: {
size() {
return this.chart.resize({...this.size, silent: false});
},
async mapName(val) {
await this.loadExamData(val);
}
},
mounted() {
this.initChart();
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
listUserPermision({pageSize: 9000, pageNum: 1}).then(resp => {
this.permissionList = resp.data.list;
this.mapNameList = [...new Set(this.permissionList.map(elem => { return elem.mapName; }))];
this.$nextTick(() => { this.mapName = this.mapNameList[0] || ''; });
});
this.chart = echarts.init(document.getElementById(this.id));
this.chart.setOption(this.option);
},
async loadExamData(mapName) {
var data = {};
var list = this.permissionList.filter(elem => { return elem.mapName == mapName; });
list.forEach(elem => {
if (!data[elem.mapProductName]) {
data[elem.mapProductName] = elem.remains;
} else {
data[elem.mapProductName] += elem.remains;
}
});
const keys = Object.keys(data);
const values = Object.values(data);
const sum = values.reduce((total, num) => total + num);
this.option.title.text = '所属用户剩余权限分布图';
this.option.title.subtext = `权限总计${sum}`;
this.option.yAxis[0].data = keys;
this.option.series[0].data = values;
this.option.series[1].data = keys.map(name => { return {name, value: data[name]}; });
this.chart.setOption(this.option);
}
}
};
</script>
<style scoped>
.lesson-select {
position: absolute;
display: flex;
top: 30px;
right: 30px;
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<div class="dashboard-container">
<div class="item-row" style="margin-top: 20px">
<!-- <div class="item-row" style="margin-top: 20px">
<div class="item-col">
<echarts-lesson id="lesson" ref="lesson" :size="{width: size.width, height: size.height}" />
</div>
@ -10,22 +10,25 @@
</div>
<div class="item-flex">
<echarts-demon id="demon" ref="demon" :size="{width: size.width * 2 + 4, height: size.height}" />
</div>
</div> -->
<echarts-permission ref="permission" class="perssmin-card" :size="{ width: size.width, height: size.height }" />
</div>
</template>
<script>
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import EchartsExam from './echarts/exam';
import EchartsLesson from './echarts/lesson';
import EchartsDemon from './echarts/demonstration';
// import EchartsExam from './echarts/exam';
// import EchartsLesson from './echarts/lesson';
// import EchartsDemon from './echarts/demonstration';
import EchartsPermission from './echarts/permission';
export default {
name: 'Dashboard',
components: {
EchartsExam,
EchartsLesson,
EchartsDemon
// EchartsExam,
// EchartsLesson,
// EchartsDemon,
EchartsPermission
},
mixins: [WindowResizeHandler],
data() {
@ -38,9 +41,13 @@ export default {
},
methods: {
resizeHandler() {
// this.size = {
// width: (this._clientWidth - 60) / 2,
// height: (this._clientHeight - 100) / 2
// };
this.size = {
width: (this._clientWidth - 60) / 2,
height: (this._clientHeight - 100) / 2
width: (this._clientWidth - 40),
height: (this._clientHeight - 100)
};
}
}
@ -49,7 +56,6 @@ export default {
<style lang="scss" scoped>
.dashboard {
background: #F0F2F5;
&-container {
margin: 0px;
}
@ -74,4 +80,10 @@ export default {
display: flex;
justify-content: center;
}
.perssmin-card {
display: flex;
justify-content: center;
margin-top: 20px;
}
</style>

View File

@ -19,7 +19,7 @@
<el-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="回复消息" class="conditionVO" prop="actionVO.reply" v-if="isConversitionAdd">
<el-form-item label="内容" class="conditionVO" prop="actionVO.reply" v-if="isConversitionAdd">
<el-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3"></el-input>
</el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd">
@ -97,7 +97,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' }
],
reply:[
{ required: true, message: '请输入回复消息', trigger: 'blur' }
{ required: true, message: '请输入内容', trigger: 'blur' }
],
targetId:[
{ required: true, message: '请选择目标角色', trigger: 'change' }
@ -155,6 +155,7 @@
this.initActionData();
this.$message.success('添加动作成功');
this.$emit('create');
this.resetDisabled();
}).catch(error => {
this.$messageBox(`添加动作失败: ${error.message}`);
});
@ -178,6 +179,19 @@
}
});
},
resetDisabled(){
if(this.$refs['modalData'])
{
debugger;
this.$refs['modalData'].resetFields();
}
},
clearValidate(){
if(this.$refs['modalData'])
{
this.$refs['modalData'].clearValidate();
}
},
initActionData(){
this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId="";
@ -198,6 +212,7 @@
this.isConversitionAdd=true;
this.isCommandAdd=false;
this.isJinLu=false;
this.clearValidate();
break;
}
case "Command":{
@ -212,12 +227,15 @@
{
this.isJinLu=false;
}
this.clearValidate();
break;
}
default:{
this.clearValidate();
break;
}
}
},
changeCommand(index){
switch(index)
@ -225,13 +243,16 @@
case "Train_Manual_Route_Blocking_Drive":{
this.isJinLu=true;
this.getDeviceCode();
this.clearValidate();
break;
}
default:{
this.isJinLu=false;
this.clearValidate();
break;
}
}
},
doShow(data){
if(data)

View File

@ -9,7 +9,7 @@
<el-table
v-loading="loading"
:data="actionList" border class="actionListTable">
<el-table-column prop="reply" label="回复消息" width="200">
<el-table-column prop="reply" label="内容" width="200">
</el-table-column>
<el-table-column prop="time" label="完成时间" width="200">
</el-table-column>

View File

@ -93,7 +93,6 @@ export default {
activeName: 'first',
mapData: null,
sectionsCollection: [],
skinDict: {},
editModel: {
code: '',
point: {
@ -151,6 +150,9 @@ export default {
});
}
return list;
},
style() {
return this.$jlmap.style;
}
},
watch: {
@ -190,13 +192,14 @@ export default {
const model = {
_type: 'TrainWindow',
code: getUID('TrainWindow'),
trainWindowShow: true,
point: {}
};
if (opts) {
var width = this.style.trainWindowWidth;
var height = this.style.trainWindowHeight;
const section = opts.section;
let width = this.skinDict.trainWindowWidth;
const height = this.skinDict.trainWindowHeight;
if (section) {
if (section.type !== '03' && opts.triangle) {
model.point = opts.triangle.middlePoint();
@ -215,7 +218,7 @@ export default {
};
}
const distance = (this.skinDict.trainDistance + this.skinDict.trainConflictR * 2 + height);
const distance = (this.style.trainDistance + this.style.trainConflictR * 2 + height);
let offsetx = 0;
let offsety = 0;
if (opts.triangle) {

View File

@ -32,8 +32,6 @@
</el-card>
</template>
<script>
// import { getPublishLessonTree, getPublishLessonDetail } from '@/api/jmap/lesson';
// import { PermissionType } from '@/scripts/ConstDic';
import { UrlConfig } from '@/router/index';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
import { listPublishMap } from '@/api/jmap/map';
@ -72,6 +70,7 @@ export default {
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data;
this.loading = false;
this.mapSelect=this.mapList[0].id;
this.getQuestPageList(this.mapSelect);
})
@ -80,12 +79,15 @@ export default {
this.loading = true;
this.getQuestPageList(id);
},
getQuestPageList(id){
getQuestPageList(id).then(response => {
this.loading = false;
this.treeList=response.data;
}).catch((err) => {
});
async getQuestPageList(id){
// getQuestPageList(id).then(response => {
// this.loading = false;
// this.treeList=response.data;
// }).catch((err) => {
// });
let response=await getQuestPageList(id);
this.loading = false;
this.treeList=response.data;
},
showContextMenu(e, obj, node, vueElem) {
if (obj) {
@ -94,15 +96,30 @@ export default {
}
},
clickEvent(obj, data, ele) {
setSessionStorage('scriptId', obj.id);
// setSessionStorage('scriptId', obj.id);
this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` });
},
addScript(){
this.refresh(null);
this.$router.push({ path: `${UrlConfig.script.prefix}` });
this.refresh();
},
refresh() {
this.getQuestPageList(this.mapSelect);
refresh(data) {
let that=this;
if(data)
{
let currentMapId=this.mapSelect;
if(currentMapId!=data.mapId)
{
this.mapSelect=data.mapId;
}
this.getQuestPageList(this.mapSelect).then(function(){
that.$refs.tree.setCurrentKey(data.scriptId);
});
}
else
{
this.getQuestPageList(this.mapSelect);
}
}
}
}

View File

@ -18,6 +18,7 @@
</template>
<script>
import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import {createQuest} from '@/api/quest';
@ -59,13 +60,15 @@
rules() {
let crules = {
name: [
{ required: true, message: '请输入剧本', trigger: 'blur' },
{ required: true, message: '请输入剧本名称', trigger: 'blur' },
{ required: true, message: '请输入剧本名称', trigger: 'change' },
],
mapId: [
{ required: true, message: '请选择地图', trigger: 'change' },
],
description:[
{ required: true, message: '请输入剧本描述', trigger: 'blur' },
{ required: true, message: '请输入剧本描述', trigger: 'change' },
]
}
return crules
@ -96,10 +99,12 @@
this.loading=true;
let data=this.formModel;
createQuest(data).then(resp => {
this.$emit('refresh');
let data={mapId:self.formModel.mapId,scriptId:resp.data};
this.$emit('refresh',data);
this.$message.success('创建剧本成功');
this.formModel={};
this.loading=false;
this.$router.push({ path: `${UrlConfig.script.detail}/${resp.data}` });
}).catch(error => {
this.loading=false;
this.$messageBox(`创建剧本失败: ${error.message}`);

View File

@ -36,14 +36,9 @@
drapWidth(width) {
this.widthLeft = Number(width);
},
refresh() {
this.$nextTick(() => {
this.$refs.scriptTree.refresh();
});
refresh(data) {
this.$refs.scriptTree.refresh(data);
}
// refresh(filterSelect) {
// this.$refs && this.$refs.tree && this.$refs.tree.refresh(filterSelect);
// }
},
}