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 deviceType from '@/jmap/constant/deviceType';
import { parser } from '@/jmap/utils/parser'; import { parser } from '@/jmap/utils/parser';
import Vue from 'vue'; import Vue from 'vue';
/** /**
* 查询向上受影响的Devices * 查询向上受影响的Devices
* @param {Object} map * @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; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // 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.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' // 琰培 // BASE_API = 'http://192.168.3.4:9000' // 琰培
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;

View File

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

View File

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

View File

@ -34,6 +34,7 @@ export default {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow',
lineStyle: { lineStyle: {
color: '#57617B' 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> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<div class="item-row" style="margin-top: 20px"> <!-- <div class="item-row" style="margin-top: 20px">
<div class="item-col"> <div class="item-col">
<echarts-lesson id="lesson" ref="lesson" :size="{width: size.width, height: size.height}" /> <echarts-lesson id="lesson" ref="lesson" :size="{width: size.width, height: size.height}" />
</div> </div>
@ -10,22 +10,25 @@
</div> </div>
<div class="item-flex"> <div class="item-flex">
<echarts-demon id="demon" ref="demon" :size="{width: size.width * 2 + 4, height: size.height}" /> <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> </div>
</template> </template>
<script> <script>
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import EchartsExam from './echarts/exam'; // import EchartsExam from './echarts/exam';
import EchartsLesson from './echarts/lesson'; // import EchartsLesson from './echarts/lesson';
import EchartsDemon from './echarts/demonstration'; // import EchartsDemon from './echarts/demonstration';
import EchartsPermission from './echarts/permission';
export default { export default {
name: 'Dashboard', name: 'Dashboard',
components: { components: {
EchartsExam, // EchartsExam,
EchartsLesson, // EchartsLesson,
EchartsDemon // EchartsDemon,
EchartsPermission
}, },
mixins: [WindowResizeHandler], mixins: [WindowResizeHandler],
data() { data() {
@ -38,9 +41,13 @@ export default {
}, },
methods: { methods: {
resizeHandler() { resizeHandler() {
// this.size = {
// width: (this._clientWidth - 60) / 2,
// height: (this._clientHeight - 100) / 2
// };
this.size = { this.size = {
width: (this._clientWidth - 60) / 2, width: (this._clientWidth - 40),
height: (this._clientHeight - 100) / 2 height: (this._clientHeight - 100)
}; };
} }
} }
@ -49,7 +56,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.dashboard { .dashboard {
background: #F0F2F5;
&-container { &-container {
margin: 0px; margin: 0px;
} }
@ -74,4 +80,10 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.perssmin-card {
display: flex;
justify-content: center;
margin-top: 20px;
}
</style> </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-option v-for="member in memberList" :key="member.id" :label="member.name" :value="member.id"></el-option>
</el-select> </el-select>
</el-form-item> </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-input v-model="modalData.actionVO.reply" type="textarea" class="textareaStyle" rows="3"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd"> <el-form-item label="设备指令" class="conditionVO" prop="actionVO.type" v-if="isCommandAdd">
@ -97,7 +97,7 @@
{ required: true, message: '请选择主体角色', trigger: 'change' } { required: true, message: '请选择主体角色', trigger: 'change' }
], ],
reply:[ reply:[
{ required: true, message: '请输入回复消息', trigger: 'blur' } { required: true, message: '请输入内容', trigger: 'blur' }
], ],
targetId:[ targetId:[
{ required: true, message: '请选择目标角色', trigger: 'change' } { required: true, message: '请选择目标角色', trigger: 'change' }
@ -155,6 +155,7 @@
this.initActionData(); this.initActionData();
this.$message.success('添加动作成功'); this.$message.success('添加动作成功');
this.$emit('create'); this.$emit('create');
this.resetDisabled();
}).catch(error => { }).catch(error => {
this.$messageBox(`添加动作失败: ${error.message}`); 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(){ initActionData(){
this.modalData.actionVO.memberId=""; this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId=""; this.modalData.actionVO.targetId="";
@ -198,6 +212,7 @@
this.isConversitionAdd=true; this.isConversitionAdd=true;
this.isCommandAdd=false; this.isCommandAdd=false;
this.isJinLu=false; this.isJinLu=false;
this.clearValidate();
break; break;
} }
case "Command":{ case "Command":{
@ -212,12 +227,15 @@
{ {
this.isJinLu=false; this.isJinLu=false;
} }
this.clearValidate();
break; break;
} }
default:{ default:{
this.clearValidate();
break; break;
} }
} }
}, },
changeCommand(index){ changeCommand(index){
switch(index) switch(index)
@ -225,13 +243,16 @@
case "Train_Manual_Route_Blocking_Drive":{ case "Train_Manual_Route_Blocking_Drive":{
this.isJinLu=true; this.isJinLu=true;
this.getDeviceCode(); this.getDeviceCode();
this.clearValidate();
break; break;
} }
default:{ default:{
this.isJinLu=false; this.isJinLu=false;
this.clearValidate();
break; break;
} }
} }
}, },
doShow(data){ doShow(data){
if(data) if(data)

View File

@ -9,7 +9,7 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="actionList" border class="actionListTable"> :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>
<el-table-column prop="time" label="完成时间" width="200"> <el-table-column prop="time" label="完成时间" width="200">
</el-table-column> </el-table-column>

View File

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

View File

@ -32,8 +32,6 @@
</el-card> </el-card>
</template> </template>
<script> <script>
// import { getPublishLessonTree, getPublishLessonDetail } from '@/api/jmap/lesson';
// import { PermissionType } from '@/scripts/ConstDic';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest'; import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
import { listPublishMap } from '@/api/jmap/map'; import { listPublishMap } from '@/api/jmap/map';
@ -72,6 +70,7 @@ export default {
this.mapList = []; this.mapList = [];
listPublishMap().then(response => { listPublishMap().then(response => {
this.mapList = response.data; this.mapList = response.data;
this.loading = false;
this.mapSelect=this.mapList[0].id; this.mapSelect=this.mapList[0].id;
this.getQuestPageList(this.mapSelect); this.getQuestPageList(this.mapSelect);
}) })
@ -80,12 +79,15 @@ export default {
this.loading = true; this.loading = true;
this.getQuestPageList(id); this.getQuestPageList(id);
}, },
getQuestPageList(id){ async getQuestPageList(id){
getQuestPageList(id).then(response => { // getQuestPageList(id).then(response => {
this.loading = false; // this.loading = false;
this.treeList=response.data; // this.treeList=response.data;
}).catch((err) => { // }).catch((err) => {
}); // });
let response=await getQuestPageList(id);
this.loading = false;
this.treeList=response.data;
}, },
showContextMenu(e, obj, node, vueElem) { showContextMenu(e, obj, node, vueElem) {
if (obj) { if (obj) {
@ -94,15 +96,30 @@ export default {
} }
}, },
clickEvent(obj, data, ele) { clickEvent(obj, data, ele) {
setSessionStorage('scriptId', obj.id); // setSessionStorage('scriptId', obj.id);
this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` }); this.$router.push({ path: `${UrlConfig.script.detail}/${obj.id}` });
}, },
addScript(){ addScript(){
this.refresh(null);
this.$router.push({ path: `${UrlConfig.script.prefix}` }); this.$router.push({ path: `${UrlConfig.script.prefix}` });
this.refresh();
}, },
refresh() { refresh(data) {
this.getQuestPageList(this.mapSelect); 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> </template>
<script> <script>
import { UrlConfig } from '@/router/index';
import {listPublishMap} from '@/api/jmap/map'; import {listPublishMap} from '@/api/jmap/map';
import WindowResizeHandler from '@/mixin/WindowResizeHandler'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import {createQuest} from '@/api/quest'; import {createQuest} from '@/api/quest';
@ -59,13 +60,15 @@
rules() { rules() {
let crules = { let crules = {
name: [ name: [
{ required: true, message: '请输入剧本', trigger: 'blur' }, { required: true, message: '请输入剧本名称', trigger: 'blur' },
{ required: true, message: '请输入剧本名称', trigger: 'change' },
], ],
mapId: [ mapId: [
{ required: true, message: '请选择地图', trigger: 'change' }, { required: true, message: '请选择地图', trigger: 'change' },
], ],
description:[ description:[
{ required: true, message: '请输入剧本描述', trigger: 'blur' }, { required: true, message: '请输入剧本描述', trigger: 'blur' },
{ required: true, message: '请输入剧本描述', trigger: 'change' },
] ]
} }
return crules return crules
@ -96,10 +99,12 @@
this.loading=true; this.loading=true;
let data=this.formModel; let data=this.formModel;
createQuest(data).then(resp => { createQuest(data).then(resp => {
this.$emit('refresh'); let data={mapId:self.formModel.mapId,scriptId:resp.data};
this.$emit('refresh',data);
this.$message.success('创建剧本成功'); this.$message.success('创建剧本成功');
this.formModel={}; this.formModel={};
this.loading=false; this.loading=false;
this.$router.push({ path: `${UrlConfig.script.detail}/${resp.data}` });
}).catch(error => { }).catch(error => {
this.loading=false; this.loading=false;
this.$messageBox(`创建剧本失败: ${error.message}`); this.$messageBox(`创建剧本失败: ${error.message}`);

View File

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