路由调整

接口调整
This commit is contained in:
joylink_cuiweidong 2019-10-31 13:56:42 +08:00
parent b5b08a0afd
commit 681ac5e886
13 changed files with 1614 additions and 1631 deletions

View File

@ -91,6 +91,7 @@ function handleRoute(to, from, next, routeInfo) {
} else {
// 除没有动态改变权限的需求可直接next() 删下方权限判断
if (hasPermission(store.getters.roles, to.meta.roles)) {
debugger;
if (to.path === '/404' && to.redirectedFrom === '/') {
next(localStore.get('trainingPlatformRoute' + store.getters.id) || '/trainingPlatform');
} else {

View File

@ -338,7 +338,8 @@ export const asyncRouter = [
hidden: true
},
{
path: 'lesson/home/:mapId/:skinCode',
path: 'lesson/home/:mapId',
// /:skinCode
component: LessonHome,
hidden: true
},

View File

@ -213,7 +213,6 @@ function handleButtonReopenSignal(operates) {
* @param {*} operates
*/
function handleButtonHumanTrainRoute(operates) {
debugger;
if (operates.length >= 2) {
const operate = operates[operates.length - 1];
if (operate.type === SignalType && operate.code) {

View File

@ -95,12 +95,13 @@ export default {
switch (obj.type) {
case 'scriptDesign': {
setSessionStorage('designType', 'scriptDesign');
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}?skinCode=${obj.skinCode}` });
this.$router.push({ path: `${UrlConfig.design.scriptHome}/${obj.mapId}` });
break;
}
case 'lessonDesign': {
setSessionStorage('designType', 'lessonDesign');
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}/${obj.skinCode}`, query: {cityCode: obj.cityCode} });
// /${obj.skinCode}
this.$router.push({ path: `${UrlConfig.design.lessonHome}/${obj.mapId}`, query: {cityCode: obj.cityCode} });
break;
}
case 'runPlanDesign': {

View File

@ -20,8 +20,7 @@
<div id="jlsimulation" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
<div id="jlcctv" v-show="cctvshow" class="jlmap3cctv">
</div>
<div v-show="cctvshow" id="jlcctv" class="jlmap3cctv"/>
<Drive-Mmi v-if="mmishow" ref="mmiui" />

View File

@ -197,6 +197,7 @@ export default {
//
const res = await getPlaceholderList({ trainingType: data.trainingType });
this.placeholderList = res.data;
debugger;
this.formModel = {
id: data.id,
trainingName: this.repliceName(data.trainingName, this.placeholderList),
@ -227,7 +228,6 @@ export default {
},
changeList(val) {
//
debugger;
getPlaceholderList({ trainingType: val}).then(res => {
this.placeholderList = res.data;
});
@ -250,6 +250,7 @@ export default {
},
create() {
const self = this;
this.loading = true;
this.placeholderList.forEach(item => {
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
@ -261,7 +262,6 @@ export default {
}
});
this.loading = true;
postTrainingRulesData(this.formModel).then(response => {
self.loading = false;
self.$message.success(this.$t('lesson.createOperateSuccess'));

View File

@ -287,7 +287,6 @@ export default {
addAutoTraining(data).then(response => {
this.$message.success(this.$t('tip.automaticGenerationTrainingSuccess'));
debugger;
this.$emit('refresh');
this.close();
}).catch(() => {

View File

@ -2,15 +2,12 @@
<el-card :style="{height: height+'px'}">
<div class="scriptHeader">
<div class="scriptList">{{ $t('scriptRecord.scriptList') }}</div>
<el-button size="small" type="primary" @click="handleCreate" class="createScript">{{$t('scriptRecord.scriptCreate')}}</el-button>
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
</div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;display: inline-block;" />
<script-publish ref='publishScript' @reloadTable="reloadTable" @create="handleConfirmPublish" :title="$t('scriptRecord.publishScript')">
</script-publish>
<create-script ref='createScript' @reloadTable="reloadTable" @create="handleConfirmCreate" :title="$t('scriptRecord.createScript')">
</create-script>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" :title="$t('scriptRecord.modifyScript')">
</create-script>
<script-publish ref="publishScript" :title="$t('scriptRecord.publishScript')" @reloadTable="reloadTable" @create="handleConfirmPublish" />
<create-script ref="createScript" :title="$t('scriptRecord.createScript')" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-script ref="modifyScript" :title="$t('scriptRecord.modifyScript')" @reloadTable="reloadTable" @create="handleConfirmModify" />
</el-card>
</template>
@ -54,18 +51,18 @@ export default {
},
{
title: this.$t('scriptRecord.scriptDescription'),
prop: 'description',
prop: 'description'
},
{
title: this.$t('scriptRecord.status'),
prop: 'status',
type: 'tag',
columnValue: (row) => { return this.covertData(row)},
columnValue: (row) => { return this.covertData(row); },
tagType: (row) => { return ''; }
},
{
title: this.$t('scriptRecord.revokeReason'),
prop: 'explanation',
prop: 'explanation'
},
{
type: 'button',
@ -76,36 +73,36 @@ export default {
name: this.$t('scriptRecord.scriptRecord'),
handleClick: this.drawUp,
type: 'success',
showControl:(row) => { return !(row.status==1) },
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.$t('scriptRecord.scriptModify'),
handleClick: this.handleModify,
type: 'primary',
showControl:(row) => { return !(row.status==1) },
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.$t('scriptRecord.scriptDelete'),
handleClick: this.deleteScript,
type: 'danger',
showControl:(row) => { return !(row.status==1) },
showControl:(row) => { return !(row.status == 1); }
},
{
name: this.covertButtonname(),
handleClick: this.publishScript,
type: 'primary',
showControl:(row) => { return row.status==0 },
showControl:(row) => { return row.status == 0; }
},
{
name: this.$t('scriptRecord.applyRevoke'),
handleClick: this.revokeScript,
type: 'primary',
showControl:(row) => { return row.status==1 },
showControl:(row) => { return row.status == 1; }
},
{
name: this.$t('scriptRecord.preview'),
handleClick: this.previewScript,
type: 'success',
type: 'success'
// showControl:(row) => { return row.status==1},
}
]
@ -158,7 +155,7 @@ export default {
},
//
handleConfirmCreate(data) {
if(Cookies.get("user_lang")=="en"){
if (Cookies.get('user_lang') == 'en') {
data.lang = 'en';
} else {
data.lang = 'zh';
@ -168,7 +165,7 @@ export default {
this.$message.success(this.$t('scriptRecord.createScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.createScriptFail')}: ${error.message}`);
})
});
},
//
handleModify(index, row) {
@ -176,7 +173,7 @@ export default {
},
//
handleConfirmModify(data) {
if(Cookies.get("user_lang")=="en"){
if (Cookies.get('user_lang') == 'en') {
data.lang = 'en';
} else {
data.lang = 'zh';
@ -186,25 +183,25 @@ export default {
this.$message.success(this.$t('scriptRecord.modifyScriptSuccess'));
}).catch(error => {
this.$messageBox(`${this.$t('scriptRecord.modifyScriptFail')}: ${error.message}`);
})
});
},
//
handleCreate() {
this.$refs.createScript.doShow(null);
},
covertData(row) {
let releaseReview=ConstConfig.ConstSelect.releaseReview;
let lastData=Object.assign({}, row);
if(Cookies.get("user_lang")=="en"){
const releaseReview = ConstConfig.ConstSelect.releaseReview;
const lastData = Object.assign({}, row);
if (Cookies.get('user_lang') == 'en') {
releaseReview.forEach(function(element) {
let rolename=element.value;
const rolename = element.value;
if (lastData.status == rolename) {
lastData.status = element.enlabel;
}
});
} else {
releaseReview.forEach(function(element) {
let rolename=element.value;
const rolename = element.value;
if (lastData.status == rolename) {
lastData.status = element.label;
}
@ -264,7 +261,8 @@ export default {
},
previewScript(index, row) {
scriptDraftRecordNotify(row.id).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id,skinCode:this.$route.query.skinCode,try:0};
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, try:0};
// skinCode:this.$route.query.skinCode,
this.$router.push({ path: `${UrlConfig.design.display}/demon`, query });
launchFullscreen();
}).catch(error => {

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
@ -12,56 +12,56 @@
<script>
export default {
name: 'ScriptOperate',
props: {
title: String,
type:String
},
data() {
return {
dialogVisible: false,
formModel:{
scriptName:'',
id:'',
id:''
},
isShow: false,
}
},
props: {
title: String,
type:String,
isShow: false
};
},
computed: {
form() {
let form={
const form = {
labelWidth: '150px',
items: [
{ prop: 'scriptName', label: this.$t('approval.scriptName'), type: 'text', required: true},
{ prop: 'scriptName', label: this.$t('approval.scriptName'), type: 'text', required: true}
]
}
return form
};
return form;
},
rules() {
let crules ={
const crules = {
scriptName: [
{ required: true, message: this.$t('approval.inputScriptName'), trigger: 'blur' },
{ required: true, message: this.$t('approval.inputScriptName'), trigger: 'blur' }
]
};
return crules;
}
return crules
},
},
methods: {
doShow(row) {
this.formModel.scriptName = row.name;
this.formModel.id = row.id;
this.dialogVisible = true
this.dialogVisible = true;
},
doCreate() {
let self = this
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.isShow = false;
this.dialogVisible = false
this.dialogVisible = false;
}
}
};

View File

@ -66,7 +66,7 @@
import ConstConfig from '@/scripts/ConstConfig';
import {addScriptAction, modifyScriptAction, getAvailableDeviceCommand, getDeviceCodeByDeviceType, getScriptPlayMember} from '@/api/simulation';
export default {
name: 'addAction',
name: 'AddAction',
props: {
group: {
type: String,
@ -77,46 +77,28 @@
required: true
}
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
this.isPause=!(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
},
'$store.state.scriptRecord.simulationPause': function(val){
this.isPause=!(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
this.$refs['modalData'].clearValidate();
this.$refs['commandData'].clearValidate();
if(!val)
{
this.initActionData();
this.initCommandActionData();
}
},
},
data() {
return {
buttonName:this.$t('scriptRecord.addConversitionButton'),
operateType:"add",
operateType:'add',
modalData:{
actionVO:{
memberId:"",
targetId:"",
reply:"",
type:"Conversation",
memberId:'',
targetId:'',
reply:'',
type:'Conversation'
}
},
commandData:{
action:{
memberId:"",
deviceCommand:"",
memberId:'',
deviceCommand:'',
commandParamList:[],
type:"Command",
type:'Command'
},
param:{
startStation:"",
endStation:"",
startStation:'',
endStation:''
}
},
isPause:false,
@ -139,7 +121,7 @@
targetId:[
{ required: true, message: this.$t('scriptRecord.receiverRules'), trigger: 'change' }
]
},
}
},
commandRules:{
action:{
@ -159,6 +141,23 @@
]
}
}
};
},
watch:{
'$store.state.map.mapViewLoadedCount': function (val) {
Vue.prototype.$jlmap.setOptions(this.$store.state.scriptRecord.mapLocation);
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
},
'$store.state.scriptRecord.simulationPause': function(val) {
this.isPause = !(this.$store.state.scriptRecord.simulationPause);
this.$parent.$parent.$parent.setIsParse(this.isPause);
this.$refs['modalData'].clearValidate();
this.$refs['commandData'].clearValidate();
if (!val) {
this.initActionData();
this.initCommandActionData();
}
}
},
mounted() {
@ -167,14 +166,14 @@
methods:{
initData() {
this.buttonName = this.$t('scriptRecord.addConversitionButton');
this.operateType="add";
this.operateType = 'add';
getScriptPlayMember(this.group).then(resp => {
let roleTypeList=ConstConfig.ConstSelect.roleType;
const roleTypeList = ConstConfig.ConstSelect.roleType;
this.orginMemberList = resp.data;
let lastData = JSON.stringify(resp.data);
roleTypeList.forEach(function(element) {
let rolename=element.value;
if(Cookies.get("user_lang")=="en"){
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else {
@ -186,22 +185,22 @@
this.getDeviceCode();
this.resetDisabled();
this.initCommandActionData();
}).catch(error => {})
}).catch(error => {});
},
changeRole(index) {
let role=this.orginMemberList.find(elem=>{return elem.id==index}).role;
let data={role:role};
const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role;
const data = {role:role};
getAvailableDeviceCommand(data).then(response=>{
if(Cookies.get("user_lang")=="en"){
let tempData=response.data;
if (Cookies.get('user_lang') == 'en') {
const tempData = response.data;
tempData.forEach( element => {
switch (element.deviceCommand) {
case "Train_Manual_Limit_Drive":{
element.label="Confirm to run to the front station";
case 'Train_Manual_Limit_Drive': {
element.label = 'Confirm to run to the front station';
break;
}
case "Train_Manual_Route_Blocking_Drive":{
element.label="Drive as the route block method";
case 'Train_Manual_Route_Blocking_Drive': {
element.label = 'Drive as the route block method';
break;
}
}
@ -210,31 +209,29 @@
} else {
this.deviceCommandList = response.data;
}
if(response.data.length<=0)
{
this.commandData.action.deviceCommand="";
if (response.data.length <= 0) {
this.commandData.action.deviceCommand = '';
this.isJinLu = false;
}
});
},
getDeviceCode() {
let params = {deviceType:"StationStand"};
let group=this.group;
const params = {deviceType:'StationStand'};
const group = this.group;
getDeviceCodeByDeviceType(group, params).then(response =>{
let resultData = response.data;
resultData=JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g,"name"));
resultData = JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g, 'name'));
this.stationList = resultData;
})
});
},
addCommandAction(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let group=this.group;
this.commandData.action.type="Command";
if(this.commandData.action.deviceCommand=="Train_Manual_Route_Blocking_Drive")
{this.commandData.action.commandParamList=[this.commandData.param.startStation,this.commandData.param.endStation];}
let data=this.commandData.action;
let obj=this;
const group = this.group;
this.commandData.action.type = 'Command';
if (this.commandData.action.deviceCommand == 'Train_Manual_Route_Blocking_Drive') { this.commandData.action.commandParamList = [this.commandData.param.startStation, this.commandData.param.endStation]; }
const data = this.commandData.action;
const obj = this;
this.adding = true;
addScriptAction(group, data).then(response=>{
this.adding = false;
@ -247,8 +244,7 @@
this.adding = false;
this.$messageBox(`${this.$t('scriptRecord.addCommandFail')}: ${error.message}`);
});
}
else {
} else {
console.log('error submit!!');
return false;
}
@ -257,13 +253,12 @@
addScriptActionInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let group=this.group;
this.modalData.actionVO.type="Conversation";
let data=this.modalData.actionVO;
let obj=this;
const group = this.group;
this.modalData.actionVO.type = 'Conversation';
const data = this.modalData.actionVO;
const obj = this;
this.modifying = true;
if(this.operateType=="add")
{
if (this.operateType == 'add') {
addScriptAction(group, data).then(response=>{
this.modifying = false;
this.$message.success(this.$t('scriptRecord.addConversitionSuccess'));
@ -275,16 +270,14 @@
this.modifying = false;
this.$messageBox(`${this.$t('scriptRecord.addConversitionFail')}: ${error.message}`);
});
}
else
{
let actionId=this.modalData.actionVO.id;
} else {
const actionId = this.modalData.actionVO.id;
modifyScriptAction(group, actionId, data).then(response=>{
this.modifying = false;
this.isNotModify = true;
this.$emit("setDisabled",this.isNotModify);
this.$emit('setDisabled', this.isNotModify);
this.buttonName = this.$t('scriptRecord.addConversitionButton');
this.operateType="add";
this.operateType = 'add';
this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess'));
this.$emit('create');
// this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]);
@ -294,26 +287,23 @@
this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`);
});
}
}
else {
} else {
console.log('error submit!!');
return false;
}
});
},
resetDisabled() {
if(this.$refs['modalData'])
{
if (this.$refs['modalData']) {
this.$refs['modalData'].resetFields();
this.modalData.actionVO.type="Conversation";
this.modalData.actionVO.memberId="";
this.modalData.actionVO.targetId="";
this.modalData.actionVO.reply="";
this.modalData.actionVO.type = 'Conversation';
this.modalData.actionVO.memberId = '';
this.modalData.actionVO.targetId = '';
this.modalData.actionVO.reply = '';
}
},
clearValidate() {
if(this.$refs['commandData'])
{
if (this.$refs['commandData']) {
this.$refs['commandData'].clearValidate();
}
},
@ -321,20 +311,18 @@
this.resetDisabled();
},
initCommandActionData() {
if(this.$refs['commandData'])
{
if (this.$refs['commandData']) {
this.deviceCommandList = [];
this.$refs['commandData'].resetFields();
this.commandData.action.memberId="";
this.commandData.param.startStation="";
this.commandData.action.memberId = '';
this.commandData.param.startStation = '';
this.isJinLu = false;
this.commandData.param.endStation="";
this.commandData.param.endStation = '';
}
},
changeCommand(index) {
switch(index)
{
case "Train_Manual_Route_Blocking_Drive":{
switch (index) {
case 'Train_Manual_Route_Blocking_Drive': {
this.isJinLu = true;
this.getDeviceCode();
this.clearValidate();
@ -348,27 +336,24 @@
}
},
changeItem() {
if(!(this.isPause&&this.isNotModify))
{
let temp=this.modalData.actionVO.memberId;
if (!(this.isPause && this.isNotModify)) {
const temp = this.modalData.actionVO.memberId;
this.modalData.actionVO.memberId = this.modalData.actionVO.targetId;
this.modalData.actionVO.targetId = temp;
}
},
doShow(data) {
if(data)
{
if (data) {
this.buttonName = this.$t('scriptRecord.modifyConversition');
this.operateType="modify";
this.operateType = 'modify';
this.clearValidate();
this.isNotModify = false;
this.$emit("setDisabled",this.isNotModify);
this.$emit('setDisabled', this.isNotModify);
// this.initData();
this.modalData.actionVO.id = data.id;
this.modalData.actionVO.memberId = data.memberId;
this.modalData.actionVO.type = data.type;
if(data.type=="Conversation")
{
if (data.type == 'Conversation') {
this.isJinLu = false;
this.modalData.actionVO.targetId = data.targetId;
this.modalData.actionVO.reply = data.reply;
@ -376,7 +361,7 @@
}
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";