This commit is contained in:
fan 2019-08-16 16:01:33 +08:00
commit 49f8ebe630
7 changed files with 523 additions and 493 deletions

View File

@ -3,8 +3,8 @@ 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 = 'http://192.168.3.5:9000'; // 袁琪
// 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.4:9000' // 琰培
} else {

View File

@ -45,20 +45,19 @@ export default {
left: 10,
containLabel: true
}],
xAxis: [{
type: 'value'
}],
yAxis: [{
xAxis: {
type: 'value',
show: false
},
yAxis: {
type: 'category',
data: [],
show: false,
axisLabel: {
interval: 0,
rotate: 30
},
splitLine: {
show: false
}
}],
data: []
},
series: [{
type: 'bar',
stack: 'chart',
@ -69,6 +68,7 @@ export default {
position: 'right'
}
},
barWidth: 30,
tooltip: {
formatter: params => { return `${params.marker} ${params.name}: ${params.value}`; }
},
@ -83,7 +83,7 @@ export default {
data: []
}]
},
mapName: '',
mapName: null,
mapNameList: [],
permissionList: [],
chart: null
@ -110,14 +110,16 @@ export default {
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.permissionList = resp.data.list.filter(elem => { return parseInt(elem.status) > 0; });
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) {
this.option.title.text = '所属用户剩余权限分布图';
if (mapName) {
var data = {};
var list = this.permissionList.filter(elem => { return elem.mapName == mapName; });
list.forEach(elem => {
@ -130,12 +132,19 @@ export default {
const keys = Object.keys(data);
const values = Object.values(data);
const sum = values.reduce((total, num) => total + num);
this.option.title.text = '所属用户剩余权限分布图';
const sum = keys.length > 0? values.reduce((total, num) => total + num) : 0;
this.option.title.subtext = `权限总计${sum}`;
this.option.yAxis[0].data = keys;
this.option.xAxis.show = true;
this.option.yAxis.show = true;
this.option.yAxis.data = keys;
this.option.series[0].data = values;
this.option.series[1].data = keys.map(name => { return {name, value: data[name]}; });
} else {
this.option.xAxis.show = false;
this.option.yAxis.show = false;
this.option.title.subtext = `暂无数据`;
}
this.chart.setOption(this.option);
}
}

View File

@ -1,13 +1,22 @@
<template>
<el-dialog :title="title" :visible.sync="show" width="400px" :before-close="doClose" :zIndex="2000" :modal="false"
:close-on-click-modal="false" append-to-body v-dialogDrag>
<el-input placeholder="输入名称进行过滤" v-model="filterText" clearable> </el-input>
<ul class="listBox" v-if="filterList.length">
<li class="listLi" v-for="item in filterList">
<el-radio v-model="selected" :label="item"><span>{{item.name}}</span></el-radio>
<el-dialog
v-dialogDrag
:title="title"
:visible.sync="show"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<el-input v-model="filterText" placeholder="输入名称进行过滤" clearable />
<ul v-if="filterList.length" class="listBox">
<li v-for="item in filterList" :key="item" class="listLi">
<el-radio v-model="selected" :label="item"><span>{{ item.name }}</span></el-radio>
</li>
</ul>
<span class="tipLable" v-else> 暂无数据 </span>
<span v-else class="tipLable"> 暂无数据 </span>
<span slot="footer" class="dialog-footer">
<el-button @click="doClose"> </el-button>
<el-button type="primary" :loading="loading" @click="commit"> </el-button>
@ -16,10 +25,7 @@
</template>
<script>
import { DeviceMenu } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
export default {
export default {
name: 'CmdNotice',
data() {
return {
@ -31,8 +37,8 @@
sourceList: [],
filterText: '',
selected: '',
loading: false,
}
loading: false
};
},
computed: {
show() {
@ -40,7 +46,7 @@
},
filterList() {
return this.sourceList.filter(p => p.name.indexOf(this.filterText) !== -1);
},
}
},
methods: {
doShow(obj) {
@ -57,7 +63,7 @@
this.doClose();
}
}
}
};
</script>

View File

@ -1,26 +1,26 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<choose-role ref="chooseRole" @setDriver="setDriver"></choose-role>
<pop-menu ref="popMenu" :menu="menu" />
<choose-role ref="chooseRole" @setDriver="setDriver" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import ChooseRole from './chooseRole';
import { putUserRoles } from '@/api/chat';
import { DeviceMenu } from '@/scripts/ConstDic';
import { UrlConfig } from '@/router/index';
import PopMenu from '@/components/PopMenu';
import ChooseRole from './chooseRole';
import { putUserRoles } from '@/api/chat';
import { DeviceMenu } from '@/scripts/ConstDic';
export default {
name: 'operateMenu',
export default {
name: 'OperateMenu',
components: {
PopMenu,
ChooseRole
},
props: {
group: {
type: String
type: String,
required: true
},
point: {
type: Object,
@ -37,7 +37,7 @@
driverMapDict: {
type: Object,
required: true
},
}
},
data() {
return {
@ -52,7 +52,7 @@
handler: this.cancelDriver
}
]
}
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
@ -68,10 +68,10 @@
},
methods: {
closeEvent() {
let self = this;
const self = this;
window.onclick = function (e) {
self.doClose();
}
};
},
doShow(point) {
this.closeEvent();
@ -87,8 +87,8 @@
this.menuShow = false;
},
chooseDriver() {
let arrs = Object.values(this.driverMapDict);
let list = this.driverList.filter(elem => {
const arrs = Object.values(this.driverMapDict);
const list = this.driverList.filter(elem => {
let ret = true;
arrs.forEach(item => {
if (item.id == elem.id) {
@ -102,7 +102,7 @@
},
async setDriver(obj) {
if (obj && this.selected) {
let params = [{
const params = [{
id: obj.id,
nickName: obj.name,
userRole: 'Driver',
@ -114,9 +114,9 @@
}
},
async cancelDriver() {
let data = this.driverMapDict[this.selected._code];
const data = this.driverMapDict[this.selected._code];
if (data) {
let params = [{
const params = [{
id: data.id,
nickName: data.name,
userRole: 'Driver',
@ -131,5 +131,5 @@
this.$emit('refresh');
}
}
}
};
</script>

View File

@ -46,7 +46,7 @@
/>
<div style="float: right; margin-right: 15px;">
<el-select
v-model="nor.stationCode"
v-model="nor.deviceCode"
placeholder="请选择"
size="mini"
:disabled="userId != roomInfo.creatorId"
@ -396,7 +396,7 @@ export default {
this.messageInfo('您被管理员踢出房间。', 'warning');
} else {
param.userRole = '';
param['stationCode'] = '';
param['deviceCode'] = '';
const arr = [];
arr.push(param);
this.addrolesList(arr); //
@ -490,7 +490,7 @@ export default {
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.stationCode) {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
@ -549,7 +549,7 @@ export default {
async start() {
let flag = true;
this.equipmentList.forEach(item => {
if (!item.stationCode) {
if (!item.deviceCode) {
flag = false;
}
});
@ -600,13 +600,13 @@ export default {
id: val.id,
nickName: val.nickName,
userRole: 'Attendant',
stationCode: val.stationCode
deviceCode: val.deviceCode
}];
putUserRoles(params, this.$route.query.group);
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.stationCode) {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
@ -693,7 +693,7 @@ export default {
this.stationList.forEach(item => {
item.disabled = false;
this.equipmentList.forEach(nor => {
if (item.code == nor.stationCode) {
if (item.code == nor.deviceCode) {
item.disabled = true;
}
});
@ -723,7 +723,7 @@ export default {
id: item.id,
nickName: item.nickName,
userRole: 'Audience',
stationCode: ''
deviceCode: ''
}];
putUserRoles(params, this.$route.query.group);
},

View File

@ -1,18 +1,18 @@
<template>
<div class="jointRoomMenu">
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
<pop-menu ref="popMenu" :menu="menu" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import { DeviceMenu } from '@/scripts/ConstDic';
import { putJointTrainingUserkicked } from '@/api/chat';
import PopMenu from '@/components/PopMenu';
import { DeviceMenu } from '@/scripts/ConstDic';
import { putJointTrainingUserkicked } from '@/api/chat';
export default {
export default {
name: 'TrainingOperateMenu',
components: {
PopMenu,
PopMenu
},
props: {
point: {
@ -31,10 +31,10 @@
{
label: '踢出房间',
handler: this.kicked
},
],
userId: '',
}
],
userId: ''
};
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
@ -51,10 +51,10 @@
},
methods: {
closeEvent() {
let self = this;
const self = this;
window.onclick = function (e) {
self.doClose();
}
};
},
doShow(point) {
this.closeEvent();
@ -75,9 +75,11 @@
},
async kicked() {
try {
let res = await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group);
} catch (error) { }
await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group);
} catch (error) {
console.error(error);
}
}
}
};
</script>

View File

@ -1,42 +1,52 @@
<template>
<!-- 聊天窗口 -->
<div class="train-chat">
<audio ref="audio" style="display: none;"></audio>
<div class="chatContent" ref="content">
<audio ref="audio" style="display: none;" />
<div ref="content" class="chatContent">
<ul class="newsList">
<div v-for="(nor, index) in textList" :key="index" style="margin-top: 5px;">
<li v-if="nor.self" style="position: relative">
<div class="userName" style="position: absolute; right: 4px; top: 4px; font-size: 14px;">
{{nor.chatTime}} {{nor.userName}}</div>
{{ nor.chatTime }} {{ nor.userName }}</div>
<div class="news">
<span>{{nor.value}}</span>
<span>{{ nor.value }}</span>
</div>
<div class="yuyin" v-if="nor.voice" @click="playAudio(nor)">
<i class="el-icon-caret-right"></i>
<div v-if="nor.voice" class="yuyin" @click="playAudio(nor)">
<i class="el-icon-caret-right" />
</div>
</li>
<li v-if="nor.other" style="position: relative">
<div class="userName" style="position: absolute; left: 12px; top: 4px; font-size: 14px;">
{{nor.userName}} {{nor.chatTime}}</div>
{{ nor.userName }} {{ nor.chatTime }}</div>
<div class="answers">
<span>{{nor.value}}</span>
<span>{{ nor.value }}</span>
</div>
<div class="yuyin1" v-if="nor.voice" @click="playAudio(nor)">
<i class="el-icon-caret-right"></i>
<div v-if="nor.voice" class="yuyin1" @click="playAudio(nor)">
<i class="el-icon-caret-right" />
</div>
</li>
<li v-if="nor.join" style="font-size: 12px; text-align: center;">{{nor.roomTip}}</li>
<li v-if="nor.join" style="font-size: 12px; text-align: center;">{{ nor.roomTip }}</li>
</div>
</ul>
</div>
<div class="footChat">
<div class="inputBox">
<textarea id="dope" v-model="text" style="width: 99%;height: 47px; border: none;outline: none;" name=""
rows="" cols=""></textarea>
<textarea
id="dope"
v-model="text"
style="width: 99%;height: 47px; border: none;outline: none;"
name=""
rows=""
cols=""
/>
<button class="sendBtn" @click="sendText()">发送文字</button>
<div class="sendBtn yuyin_start zIndex1" :style="{background: background}" @mousedown="startRecording()"
@mouseup="stopRecording()">{{speak}}</div>
<div class="sendBtn yuyin_start zIndex2" :style="{background: background}" v-show="sending">
<div
class="sendBtn yuyin_start zIndex1"
:style="{background: background}"
@mousedown="startRecording()"
@mouseup="stopRecording()"
>{{ speak }}</div>
<div v-show="sending" class="sendBtn yuyin_start zIndex2" :style="{background: background}">
发送中...</div>
</div>
</div>
@ -44,16 +54,15 @@
</template>
<script>
import Vue from 'vue';
import HZRecorder from '@/utils/HZRecorder';
import { postDataBd, postDataXf, getHistoryVoice, chatWithText, chatWithAudio, putJointTrainingSimulationEntrance } from '@/api/chat';
import StompClient from '@/utils/sock';
import HZRecorder from '@/utils/HZRecorder';
import { getHistoryVoice, chatWithText, chatWithAudio } from '@/api/chat';
export default {
name: 'trainChat',
export default {
name: 'TrainChat',
props: {
groupRoom: {
type: String,
required: true
}
},
data() {
@ -66,15 +75,15 @@
speak: '按住说话',
sending: false,
background: '',
userId: '',
}
userId: ''
};
},
watch: {
'$store.state.socket.chatContentList': function (val) { //
if (val.chatInfo) {
this.handelTextList(val);
}
},
}
},
async mounted() {
this.userId = this.$store.state.user.id;
@ -84,13 +93,15 @@
//
async sendText() {
if (!this.text.trim()) {
alert('内容为空,不可发送!')
alert('内容为空,不可发送!');
this.text = '';
} else {
try {
let res = await chatWithText(this.text, this.groupRoom);
await chatWithText(this.text, this.groupRoom);
this.text = '';
} catch (error) { }
} catch (error) {
console.error(error);
}
}
},
//
@ -113,10 +124,10 @@
if (this.recorders) {
this.recorders.stop();
var fd = new FormData();
fd.append("file", this.recorders.getBlob());
let res = await chatWithAudio(fd, this.$route.query.group).catch(error => {
fd.append('file', this.recorders.getBlob());
await chatWithAudio(fd, this.$route.query.group).catch(error => {
this.sending = false;
let message = JSON.parse(error.message);
const message = JSON.parse(error.message);
if (message.err_no == 3301) {
this.$message({
showClose: true,
@ -161,13 +172,13 @@
async getHistory(obj, node, data) {
this.textList = [];
try {
let res = await getHistoryVoice(this.code);
const res = await getHistoryVoice(this.code);
res.data.forEach(item => {
let isSelf = false;
if (item.userId == this.userId) {
isSelf = true;
}
let param = {
const param = {
join: false,
value: item.message,
self: isSelf,
@ -175,30 +186,32 @@
src: item.isAudio ? `${process.env.VOICE_API}/jlcloud/audio/${item.audioPath}` : '',
other: !isSelf,
userName: item.nickName,
chatTime: item.chatTime,
}
chatTime: item.chatTime
};
this.handelTextList(param);
})
} catch (error) { }
});
} catch (error) {
console.error(error);
}
},
// list
handelTextList(params) {
if (!params.inSimulation) {
this.textList.push(params);
this.textList.sort((a, b) => {
return a.date - b.date
})
return a.date - b.date;
});
}
this.sending = false;
this.$store.dispatch('socket/setChatContentList', {})
this.$store.dispatch('socket/setChatContentList', {});
this.$nextTick(() => {
if (this.$refs.content) {
this.$refs.content.scrollTop = this.$refs.content.scrollHeight;
}
})
},
});
}
}
};
</script>
<style scoped lang="scss">