Merge remote-tracking branch 'origin/test'

This commit is contained in:
program-walker 2020-05-28 13:58:01 +08:00
commit caebf64dda
153 changed files with 9954 additions and 1427 deletions

View File

@ -38,6 +38,7 @@
"three": "^0.107.0",
"vue": "^2.6.10",
"vue-i18n": "^8.12.0",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.1.6",
"vuedraggable": "^2.23.2",
"vuex": "^3.1.0",

View File

@ -312,11 +312,11 @@ export function getSimulationConversationListNew(group) {
}
// 获取/创建仿真会话(新版地图)
export function getSimulationConversationIdNew(params, group) {
export function getSimulationConversationIdNew(data, group) {
return request({
url: `/simulation/${group}/wx/conversation`,
method: 'get',
params: params
method: 'post',
data
});
}
@ -336,3 +336,12 @@ export function getSimulationContextListNew(group, conversationId) {
method: 'get'
});
}
// 获取仿真会话消息列表(新版地图)
export function getSimulationChatMemberNew(group, conversationId) {
return request({
url: `/simulation/${group}/${conversationId}/members`,
method: 'get'
});
}

View File

@ -46,10 +46,10 @@ export function getQuestionListByMapId(params) {
});
}
// 加载实操及内容
export function loadQuestionList(competitionId, data) {
// 加载试卷
export function loadingPaper(competitionId, data) {
return request({
url: `api/v1/competitionPractical/competition/${competitionId}/distribute`,
url: `/api/v1/competition/${competitionId}/testPaper`,
method: 'post',
data
});
@ -64,41 +64,42 @@ export function postSignUp(id, data) {
}
/** 查询用户是否已经报名该竞赛 */
export function getIsSignUp(raceId) {
export function getIsSignUp(raceId, params = {}) {
return request({
url: `/api/race/${raceId}/isSignUp`,
method: 'get'
method: 'get',
params
});
}
/** 分页查询竞赛报名人员 */
export function getRaceUserList(params) {
return request({
url: `/api/race/${params.raceId}/raceUser`,
url: `/api/race/${params.raceId}/raceUser/page`,
method: 'get',
params
});
}
/** 分页查询理论题列表 */
export function getCompetitionTheory(params) {
return request({
url: `/api/v1/competitionTheory`,
method: 'get',
params
});
}
// /** 分页查询理论题列表 */
// export function getCompetitionTheory(params) {
// return request({
// url: `/api/v1/competitionTheory`,
// method: 'get',
// params
// });
// }
/** 提交试卷 */
export function postCompetitionTheory(theoryId, data) {
export function postCompetitionTheory(data) {
return request({
url: `/api/v1/competitionTheory/${theoryId}/submit`,
url: `/api/v1/competitionTheory/submit`,
method: 'post',
data
});
}
/** 查询用户是否已经报名该竞赛 */
/** 查询本竞赛用的实操列表 */
export function getCompetitionPractical(competitionId) {
return request({
url: `/api/v1/competitionPractical/competition/${competitionId}`,
@ -106,3 +107,42 @@ export function getCompetitionPractical(competitionId) {
});
}
/** 查询竞赛报名人员详情 */
export function getRaceUserById(raceId) {
return request({
url: `/api/race/${raceId}/raceUser`,
method: 'get'
});
}
/** 查询加载的实操题 */
export function getPracticalQuestion(competitionId) {
return request({
url: `/api/v1/competitionPractical/competition/${competitionId}`,
method: 'get'
});
}
/** 查询加载的理论题 */
export function getTheoryQuestion(competitionId) {
return request({
url: `/api/v1/competitionTheory/competition/${competitionId}`,
method: 'get'
});
}
/** 查询理论题作答详情 */
export function getCompetitionDetail(competitionId) {
return request({
url: `/api/v1/competitionTheory/detail/competition/${competitionId}`,
method: 'get'
});
}
/** 根据id查询竞赛信息 */
export function getRaceById(id) {
return request({
url: `/api/race/${id}`,
method: 'get'
});
}

45
src/api/questionBank.js Normal file
View File

@ -0,0 +1,45 @@
import request from '@/utils/request';
// 分页查询理论试题
export function listQuestionPage(params) {
return request({
url: `/api/questionBank/questions/paging`,
method: 'get',
params
});
}
// 创建题目
export function createQuestion(data) {
return request({
url: `/api/questionBank/questions`,
method: 'post',
data
});
}
// 删除题目
export function deleteQuestion(questionId) {
return request({
url: `/api/questionBank/questions/${questionId}`,
method: 'delete'
});
}
// 更新题目
export function updateOption(data) {
return request({
url: `/api/questionBank/questions/${data.id}`,
method: 'put',
data
});
}
// 获取题目信息
export function getQuestionInfo(questionId) {
return request({
url: `/api/questionBank/questions/${questionId}`,
method: 'get'
});
}

View File

@ -24,3 +24,54 @@ export function updateRace(id, data) {
data
});
}
/** 获取实操试题列表(题库)*/
export function getPracticeList() {
return request({
url: `/api/v1/competitionPractical/competition`,
method: 'get'
});
}
/** 获取单个实操试题详情(题库)*/
export function getPracticeByIdBasic() {
return request({
url: `/api/v1/competitionPractical/competition`,
method: 'get'
});
}
/** 创建实操试题 */
export function createPractice(data) {
return request({
url: `/api/v1/competitionPractical/competition`,
method: 'post',
data
});
}
/** 更新实操试题信息 */
export function putPracticeInfo(id, params) {
return request({
url: `/api/v1/competitionPractical/competition/${id}`,
method: 'put',
data: params
});
}
/** 删除实操试题 */
export function deletePractice(id) {
return request({
url: `/api/v1/competitionPractical/competition/${id}`,
method: 'delete'
});
}
/** 录制实操试题 */
export function practiceRecordNotify(practiceId) {
return request({
url: `/api/scriptSimulation/${practiceId}/scriptWrite`,
method: 'get'
});
}

View File

@ -685,3 +685,11 @@ export function simulationLoadRunPlan(group, templateId) {
method: 'put'
});
}
/** 根据车次号获取列车信息 */
export function getTrainDetailBytripNumber(group, params) {
return request({
url: `/simulation/${group}/planTripInfo`,
method: 'get',
params: params
});
}

BIN
src/assets/SAFS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,5 +1,5 @@
<template>
<div v-show="show" class="pop-menu" :style="{ height: height, left: tPosition.x+'px', top: tPosition.y+'px' }">
<div v-show="show" class="pop-menu" :class="popMenuClass" :style="{ height: height, left: tPosition.x+'px', top: tPosition.y+'px' }">
<div v-for="(item, index) in menu" :key="index" class="" :style="{ width: width }">
<div v-if="item.children">
<el-popover
@ -99,6 +99,12 @@ export default {
default() {
return '';
}
},
popMenuClass: {
type: String,
default() {
return '';
}
}
},
data() {

View File

@ -150,7 +150,7 @@
<template v-for="(button, index) in queryList.actions">
<el-button v-if="button.fileType==='file' && (button.hasOwnProperty('show') ? button.show: true)" :key="index" :type="button.type ? button.type: 'primary'" size="small" class="button_style uploadDemo" :disabled="button.disabled" :loading="button.disabled">
<input id="queryFormFilesInput" type="file" class="file_box" accept=".json, application/json" @change="button.handler">
{{ $t('map.importMap') }}
{{ button.text }}
</el-button>
<el-button
v-else-if="button.hasOwnProperty('show') ? button.show: true"

View File

@ -49,6 +49,20 @@
:sortable="column.sortable"
:sort-by="column.sortBy"
/>
<el-table-column
v-else-if="checkColumnTyep(column, 'html')"
:key="index"
:prop="column.prop"
:label="column.title"
:width="column.width"
show-overflow-tooltip
:sortable="column.sortable"
:sort-by="column.sortBy"
>
<template slot-scope="scope">
<div v-html="scope.row[column.prop]" />
</template>
</el-table-column>
<el-table-column
v-else-if="checkColumnTyep(column, 'basicText')"
:key="index"
@ -142,7 +156,7 @@
@click="queryList.selectAllClick(queryList.selection)"
>{{ $t('global.selectAdd') }}</el-button>
</div>
<div class="page-container " style="text-align: center; margin: 10px 0; height: 40px;">
<div v-if="!queryList.paginationHiden" class="page-container " style="text-align: center; margin: 10px 0; height: 40px;">
<el-pagination
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100] "

View File

@ -0,0 +1,116 @@
<template>
<div>
<quill-editor
ref="editor"
v-model="content"
:options="options"
:style="{height: height+'px', 'margin-bottom': '80px'}"
@change="onChange"
@blur="onBlur"
@focus="onFocus"
/>
</div>
</template>
<script>
import { quillEditor } from 'vue-quill-editor';
import 'quill/dist/quill.snow.css';
export default {
components: {
quillEditor
},
props: {
value: {
type: String,
default: ''
},
height: {
type: Number,
default: 200
},
placeholder: {
type: String,
default: ''
}
},
data() {
return {
content: '',
options: {
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'],
[],
[],
[{'list': 'ordered'}, {'list': 'bullet'}],
[{'script': 'sub'}, {'script': 'super'}],
[{'indent': '-1'}, {'indent': '+1'}],
[{'direction': 'rtl'}],
[{'size': ['small', 'large', 'huge']}],
[{'color': [], 'background': []}],
[{'font': []}],
[{'align': []}],
['clean']
]
}
}
};
},
computed: {
editor() {
return this.$refs.editor.quill;
},
titleConfig () {
return {
'ql-bold': '加粗',
'ql-color': '颜色',
'ql-font': '字体',
'ql-code': '插入代码',
'ql-italic': '斜体',
'ql-link': '添加链接',
'ql-background': '背景颜色',
'ql-size': '字体大小',
'ql-strike': '删除线',
'ql-script': '上标/下标',
'ql-underline': '下划线',
'ql-blockquote': '引用',
'ql-header': '标题',
'ql-indent': '缩进',
'ql-list': '列表',
'ql-align': '文本对齐',
'ql-direction': '文本方向',
'ql-code-block': '代码块',
'ql-formula': '公式',
'ql-image': '图片',
'ql-video': '视频',
'ql-clean': '清除字体样式'
};
}
},
watch: {
'value': function(val) {
this.$nextTick(() => {
if (val != this.$escapeHTML(this.content)) {
this.editor.enable(false);
this.content = val;
this.editor.enable(true);
this.editor.blur();
}
});
}
},
mounted() {
this.content = this.value;
},
methods: {
onChange(e) {
this.$emit('input', this.$escapeHTML(this.content));
},
onBlur(e) {
},
onFocus(e) {
}
}
};
</script>

View File

@ -1,18 +1,21 @@
export default {
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
if (obj.value) {
// 聚焦元素
el.focus();
}
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
const dom = el.querySelector('input') || el.querySelector('textarea');
dom.focus();
// el.focus();
// if (obj.value) {
// // 聚焦元素
// el.focus();
// }
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
};

View File

@ -77,5 +77,7 @@ export default {
iscsSystem: 'Iscs System',
studentManage: 'Student manage',
examDetail: 'Exam detail',
raceManage: 'Race manage'
raceManage: 'Race manage',
practiceManage:'Practice manage',
bankManage: 'Bank manage'
};

View File

@ -315,12 +315,12 @@ export default {
centralized: '是否集中站:',
stationRunPlanName: '真实名称:',
stationVisible: '是否显示:',
stationNameFont: '车站字体:',
stationNameFont: '车站字体大小:',
stationNameFontColor: '车站字体颜色:',
stationKmPostShow: '是否显示公里标名称:',
stationKmRange: '公里标距离:',
stationKmPost: '公里标名称:',
stationKmPostFont: '公里标字体:',
stationKmPostFont: '公里标字体大小:',
stationKmPostFontColor: '公里标字体颜色:',
stationPositionX: 'x坐标:',
stationPositionY: 'y坐标:',
@ -350,7 +350,7 @@ export default {
stationstandPosition: '车站坐标:',
subhead:'副标题:',
subheadDisplay:'是否显示副标题:',
subheadFont:'副标题字体:',
subheadFont:'副标题字体大小:',
subheadFontColor:'副标题字体颜色:',
subheadPosition:'副标题坐标:',
@ -377,7 +377,7 @@ export default {
textCode: '文字编码:',
textContent: '文本内容:',
textFont: '字体格式:',
textFont: '字体大小:',
textFontColor: '字体颜色:',
trainCode: '列车编号:',

View File

@ -82,5 +82,7 @@ export default {
homeJsxt: '首页',
examDetail: '考试详情',
raceManage: '竞赛管理',
recaList: '报名列表'
recaList: '报名列表',
bankManage: '题库列表',
practiceManage:'实操列表'
};

File diff suppressed because one or more lines are too long

View File

@ -354,7 +354,7 @@ export function Jl3dpassflow(dom) {
}
}
}
},3000);
},1000);
};
},1000);
@ -390,7 +390,7 @@ export function Jl3dpassflow(dom) {
}
moveanimateupdate();
scope.anime = requestAnimationFrame(animate);
requestAnimationFrame(animate);
}
@ -468,7 +468,7 @@ export function Jl3dpassflow(dom) {
}
if(humans[i].stage == 0){
console.log(humans[i].doors);
// console.log(humans[i].doors);
zhajiin[humans[i].doors].waiting = 0;
humans[i].stage = 1;
}
@ -805,8 +805,7 @@ export function Jl3dpassflow(dom) {
}
function zhajicontrol(type,door){
console.log(door);
console.log(zhajiin);
let devicenum = door-1;
if(type == "in"){
deviceaction[zhajiin[devicenum].id].action.reset();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,136 @@
import { ZoneModel } from '@/jlmap3d/jl3dpassflow/model/zonemodel.js';
let enter1 = {
code : '001',
name : "enter1",
type : "normal",
stage : "0",
railpoints : [
new THREE.Vector3(34,9.8,-6),
new THREE.Vector3(32,9.8,-6)
]
};
let enter2 = {
code : '002',
name : "enter2",
type : "normal",
stage : "0",
railpoints : [
new THREE.Vector3(35,9.8,31.5),
new THREE.Vector3(31,9.8,31.5)
]
};
let security = {
code : '003',
name : "security",
type : "device",
stage : "1",
railpoints : [
new THREE.Vector3(20.5,9.8,18),
new THREE.Vector3(21,9.8,21)
]
};
let entergate = {
code : '004',
name : "entergate",
type : "device",
stage : "2",
railpoints : [
new THREE.Vector3(6.3,9.8,17.4),
new THREE.Vector3(4.8,9.8,17.4),
new THREE.Vector3(3.4,9.8,17.4),
new THREE.Vector3(2.1,9.8,17.4),
new THREE.Vector3(0.7,9.8,17.4)
]
};
let standtop = {
code : '005',
name : "standtop",
type : "stand",
stage : "3",
railpoints : [
new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8)
]
};
let standdown = {
code : '006',
name : "standdown",
type : "stand",
stage : "3",
railpoints : [
new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24)
]
};
//4是刚下车状态
let exitgate = {
code : '007',
name : "exitgate",
type : "device",
stage : "5",
railpoints : [
new THREE.Vector3(18.8,9.8,-0.27),
new THREE.Vector3(18.8,9.8,1.18),
new THREE.Vector3(18.8,9.8,2.64),
new THREE.Vector3(18.8,9.8,4.1),
new THREE.Vector3(18.8,9.8,5.4)
]
};
let exit1 = {
code : '008',
name : "exit1",
type : "normal",
stage : "6",
railpoints : [
new THREE.Vector3(28.2,9.8,-7),
new THREE.Vector3(30.5,9.8,-7.4)
]
};
let exit2 = {
code : '009',
name : "exit2",
type : "normal",
stage : "6",
railpoints : [
new THREE.Vector3(28.3,9.8,28.8),
new THREE.Vector3(31.2,9.8,28.8)
]
};
export function ZoneManager() {
var scope = this;
this.name = "test";
this.list = [];
initzone();
function initzone(){
scope.list[enter1.name] = new ZoneModel(enter1);
scope.list[enter2.name] = new ZoneModel(enter2);
scope.list[security.name] = new ZoneModel(security);
scope.list[entergate.name] = new ZoneModel(entergate);
scope.list[standtop.name] = new ZoneModel(standtop);
scope.list[standdown.name] = new ZoneModel(standdown);
scope.list[exitgate.name] = new ZoneModel(exitgate);
scope.list[exit1.name] = new ZoneModel(exit1);
scope.list[exit2.name] = new ZoneModel(exit2);
}
this.getzoneposition = function(name){
// let random = Math.random();
let position = scope.list[name].railline.getPointAt(Math.random());
return position;
}
}

View File

@ -0,0 +1,15 @@
export function ZoneModel(data) {
var scope = this;
//code
this.code = data.code;
//命名
this.name = data.name;
this.type = data.type;
this.stage = data.stage;
this.status = 0;
//轨迹点
this.railpoints = data.railpoints;
this.railline = new THREE.CatmullRomCurve3(data.railpoints);
}

View File

@ -0,0 +1,123 @@
import { BinaryHeap } from './BinaryHeap';
import { Utils } from './Utils.js';
class AStar {
static init (graph) {
for (let x = 0; x < graph.length; x++) {
//for(var x in graph) {
const node = graph[x];
node.f = 0;
node.g = 0;
node.h = 0;
node.cost = 1.0;
node.visited = false;
node.closed = false;
node.parent = null;
}
}
static cleanUp (graph) {
for (let x = 0; x < graph.length; x++) {
const node = graph[x];
delete node.f;
delete node.g;
delete node.h;
delete node.cost;
delete node.visited;
delete node.closed;
delete node.parent;
}
}
static heap () {
return new BinaryHeap(function (node) {
return node.f;
});
}
static search (graph, start, end) {
this.init(graph);
//heuristic = heuristic || astar.manhattan;
const openHeap = this.heap();
openHeap.push(start);
while (openHeap.size() > 0) {
// Grab the lowest f(x) to process next. Heap keeps this sorted for us.
const currentNode = openHeap.pop();
// End case -- result has been found, return the traced path.
if (currentNode === end) {
let curr = currentNode;
const ret = [];
while (curr.parent) {
ret.push(curr);
curr = curr.parent;
}
this.cleanUp(ret);
return ret.reverse();
}
// Normal case -- move currentNode from open to closed, process each of its neighbours.
currentNode.closed = true;
// Find all neighbours for the current node. Optionally find diagonal neighbours as well (false by default).
const neighbours = this.neighbours(graph, currentNode);
for (let i = 0, il = neighbours.length; i < il; i++) {
const neighbour = neighbours[i];
if (neighbour.closed) {
// Not a valid node to process, skip to next neighbour.
continue;
}
// The g score is the shortest distance from start to current node.
// We need to check if the path we have arrived at this neighbour is the shortest one we have seen yet.
const gScore = currentNode.g + neighbour.cost;
const beenVisited = neighbour.visited;
if (!beenVisited || gScore < neighbour.g) {
// Found an optimal (so far) path to this node. Take score for node to see how good it is.
neighbour.visited = true;
neighbour.parent = currentNode;
if (!neighbour.centroid || !end.centroid) throw new Error('Unexpected state');
neighbour.h = neighbour.h || this.heuristic(neighbour.centroid, end.centroid);
neighbour.g = gScore;
neighbour.f = neighbour.g + neighbour.h;
if (!beenVisited) {
// Pushing to heap will put it in proper place based on the 'f' value.
openHeap.push(neighbour);
} else {
// Already seen the node, but since it has been rescored we need to reorder it in the heap
openHeap.rescoreElement(neighbour);
}
}
}
}
// No result was found - empty array signifies failure to find path.
return [];
}
static heuristic (pos1, pos2) {
return Utils.distanceToSquared(pos1, pos2);
}
static neighbours (graph, node) {
const ret = [];
for (let e = 0; e < node.neighbours.length; e++) {
ret.push(graph[node.neighbours[e]]);
}
return ret;
}
}
export { AStar };

View File

@ -0,0 +1,134 @@
// javascript-astar
// http://github.com/bgrins/javascript-astar
// Freely distributable under the MIT License.
// Implements the astar search algorithm in javascript using a binary heap.
class BinaryHeap {
constructor (scoreFunction) {
this.content = [];
this.scoreFunction = scoreFunction;
}
push (element) {
// Add the new element to the end of the array.
this.content.push(element);
// Allow it to sink down.
this.sinkDown(this.content.length - 1);
}
pop () {
// Store the first element so we can return it later.
const result = this.content[0];
// Get the element at the end of the array.
const end = this.content.pop();
// If there are any elements left, put the end element at the
// start, and let it bubble up.
if (this.content.length > 0) {
this.content[0] = end;
this.bubbleUp(0);
}
return result;
}
remove (node) {
const i = this.content.indexOf(node);
// When it is found, the process seen in 'pop' is repeated
// to fill up the hole.
const end = this.content.pop();
if (i !== this.content.length - 1) {
this.content[i] = end;
if (this.scoreFunction(end) < this.scoreFunction(node)) {
this.sinkDown(i);
} else {
this.bubbleUp(i);
}
}
}
size () {
return this.content.length;
}
rescoreElement (node) {
this.sinkDown(this.content.indexOf(node));
}
sinkDown (n) {
// Fetch the element that has to be sunk.
const element = this.content[n];
// When at 0, an element can not sink any further.
while (n > 0) {
// Compute the parent element's index, and fetch it.
const parentN = ((n + 1) >> 1) - 1;
const parent = this.content[parentN];
if (this.scoreFunction(element) < this.scoreFunction(parent)) {
// Swap the elements if the parent is greater.
this.content[parentN] = element;
this.content[n] = parent;
// Update 'n' to continue at the new position.
n = parentN;
} else {
// Found a parent that is less, no need to sink any further.
break;
}
}
}
bubbleUp (n) {
// Look up the target element and its score.
const length = this.content.length,
element = this.content[n],
elemScore = this.scoreFunction(element);
while (true) {
// Compute the indices of the child elements.
const child2N = (n + 1) << 1,
child1N = child2N - 1;
// This is used to store the new position of the element,
// if any.
let swap = null;
let child1Score;
// If the first child exists (is inside the array)...
if (child1N < length) {
// Look it up and compute its score.
const child1 = this.content[child1N];
child1Score = this.scoreFunction(child1);
// If the score is less than our element's, we need to swap.
if (child1Score < elemScore) {
swap = child1N;
}
}
// Do the same checks for the other child.
if (child2N < length) {
const child2 = this.content[child2N],
child2Score = this.scoreFunction(child2);
if (child2Score < (swap === null ? elemScore : child1Score)) {
swap = child2N;
}
}
// If the element needs to be moved, swap it, and continue.
if (swap !== null) {
this.content[n] = this.content[swap];
this.content[swap] = element;
n = swap;
}
// Otherwise, we are done.
else {
break;
}
}
}
}
export { BinaryHeap };

View File

@ -0,0 +1,200 @@
import {
Vector3,
} from 'three';
import { Utils } from './Utils';
class Builder {
/**
* Constructs groups from the given navigation mesh.
* @param {Geometry} geometry
* @return {Zone}
*/
static buildZone (geometry) {
const navMesh = this._buildNavigationMesh(geometry);
const zone = {};
navMesh.vertices.forEach((v) => {
v.x = Utils.roundNumber(v.x, 2);
v.y = Utils.roundNumber(v.y, 2);
v.z = Utils.roundNumber(v.z, 2);
});
zone.vertices = navMesh.vertices;
const groups = this._buildPolygonGroups(navMesh);
// TODO: This block represents a large portion of navigation mesh construction time
// and could probably be optimized. For example, construct portals while
// determining the neighbor graph.
zone.groups = new Array(groups.length);
groups.forEach((group, groupIndex) => {
const indexByPolygon = new Map(); // { polygon: index in group }
group.forEach((poly, polyIndex) => { indexByPolygon.set(poly, polyIndex); });
const newGroup = new Array(group.length);
group.forEach((poly, polyIndex) => {
const neighbourIndices = [];
poly.neighbours.forEach((n) => neighbourIndices.push(indexByPolygon.get(n)));
// Build a portal list to each neighbour
const portals = [];
poly.neighbours.forEach((n) => portals.push(this._getSharedVerticesInOrder(poly, n)));
const centroid = new Vector3( 0, 0, 0 );
centroid.add( zone.vertices[ poly.vertexIds[0] ] );
centroid.add( zone.vertices[ poly.vertexIds[1] ] );
centroid.add( zone.vertices[ poly.vertexIds[2] ] );
centroid.divideScalar( 3 );
centroid.x = Utils.roundNumber(centroid.x, 2);
centroid.y = Utils.roundNumber(centroid.y, 2);
centroid.z = Utils.roundNumber(centroid.z, 2);
newGroup[polyIndex] = {
id: polyIndex,
neighbours: neighbourIndices,
vertexIds: poly.vertexIds,
centroid: centroid,
portals: portals
};
});
zone.groups[groupIndex] = newGroup;
});
return zone;
}
/**
* Constructs a navigation mesh from the given geometry.
* @param {Geometry} geometry
* @return {Object}
*/
static _buildNavigationMesh (geometry) {
geometry.mergeVertices();
return this._buildPolygonsFromGeometry(geometry);
}
static _buildPolygonGroups (navigationMesh) {
const polygons = navigationMesh.polygons;
const polygonGroups = [];
const spreadGroupId = function (polygon) {
polygon.neighbours.forEach((neighbour) => {
if (neighbour.group === undefined) {
neighbour.group = polygon.group;
spreadGroupId(neighbour);
}
});
};
polygons.forEach((polygon) => {
if (polygon.group !== undefined) {
// this polygon is already part of a group
polygonGroups[polygon.group].push(polygon);
} else {
// we need to make a new group and spread its ID to neighbors
polygon.group = polygonGroups.length;
spreadGroupId(polygon);
polygonGroups.push([polygon]);
}
});
return polygonGroups;
}
static _buildPolygonNeighbours (polygon, vertexPolygonMap) {
const neighbours = new Set();
const groupA = vertexPolygonMap[polygon.vertexIds[0]];
const groupB = vertexPolygonMap[polygon.vertexIds[1]];
const groupC = vertexPolygonMap[polygon.vertexIds[2]];
// It's only necessary to iterate groups A and B. Polygons contained only
// in group C cannot share a >1 vertex with this polygon.
// IMPORTANT: Bublé cannot compile for-of loops.
groupA.forEach((candidate) => {
if (candidate === polygon) return;
if (groupB.includes(candidate) || groupC.includes(candidate)) {
neighbours.add(candidate);
}
});
groupB.forEach((candidate) => {
if (candidate === polygon) return;
if (groupC.includes(candidate)) {
neighbours.add(candidate);
}
});
return neighbours;
}
static _buildPolygonsFromGeometry (geometry) {
const polygons = [];
const vertices = geometry.vertices;
// Constructing the neighbor graph brute force is O(n²). To avoid that,
// create a map from vertices to the polygons that contain them, and use it
// while connecting polygons. This reduces complexity to O(n*m), where 'm'
// is related to connectivity of the mesh.
const vertexPolygonMap = new Array(vertices.length); // array of polygon objects by vertex index
for (let i = 0; i < vertices.length; i++) {
vertexPolygonMap[i] = [];
}
// Convert the faces into a custom format that supports more than 3 vertices
geometry.faces.forEach((face) => {
const poly = { vertexIds: [face.a, face.b, face.c], neighbours: null };
polygons.push(poly);
vertexPolygonMap[face.a].push(poly);
vertexPolygonMap[face.b].push(poly);
vertexPolygonMap[face.c].push(poly);
});
// Build a list of adjacent polygons
polygons.forEach((polygon) => {
polygon.neighbours = this._buildPolygonNeighbours(polygon, vertexPolygonMap);
});
return {
polygons: polygons,
vertices: vertices
};
}
static _getSharedVerticesInOrder (a, b) {
const aList = a.vertexIds;
const a0 = aList[0], a1 = aList[1], a2 = aList[2];
const bList = b.vertexIds;
const shared0 = bList.includes(a0);
const shared1 = bList.includes(a1);
const shared2 = bList.includes(a2);
// it seems that we shouldn't have an a and b with <2 shared vertices here unless there's a bug
// in the neighbor identification code, or perhaps a malformed input geometry; 3 shared vertices
// is a kind of embarrassing but possible geometry we should handle
if (shared0 && shared1 && shared2) {
return Array.from(aList);
} else if (shared0 && shared1) {
return [a0, a1];
} else if (shared1 && shared2) {
return [a1, a2];
} else if (shared0 && shared2) {
return [a2, a0]; // this ordering will affect the string pull algorithm later, not clear if significant
} else {
console.warn("Error processing navigation mesh neighbors; neighbors with <2 shared vertices found.");
return [];
}
}
}
export { Builder };

View File

@ -0,0 +1,93 @@
import { Utils } from './Utils';
class Channel {
constructor () {
this.portals = [];
}
push (p1, p2) {
if (p2 === undefined) p2 = p1;
this.portals.push({
left: p1,
right: p2
});
}
stringPull () {
const portals = this.portals;
const pts = [];
// Init scan state
let portalApex, portalLeft, portalRight;
let apexIndex = 0,
leftIndex = 0,
rightIndex = 0;
portalApex = portals[0].left;
portalLeft = portals[0].left;
portalRight = portals[0].right;
// Add start point.
pts.push(portalApex);
for (let i = 1; i < portals.length; i++) {
const left = portals[i].left;
const right = portals[i].right;
// Update right vertex.
if (Utils.triarea2(portalApex, portalRight, right) <= 0.0) {
if (Utils.vequal(portalApex, portalRight) || Utils.triarea2(portalApex, portalLeft, right) > 0.0) {
// Tighten the funnel.
portalRight = right;
rightIndex = i;
} else {
// Right over left, insert left to path and restart scan from portal left point.
pts.push(portalLeft);
// Make current left the new apex.
portalApex = portalLeft;
apexIndex = leftIndex;
// Reset portal
portalLeft = portalApex;
portalRight = portalApex;
leftIndex = apexIndex;
rightIndex = apexIndex;
// Restart scan
i = apexIndex;
continue;
}
}
// Update left vertex.
if (Utils.triarea2(portalApex, portalLeft, left) >= 0.0) {
if (Utils.vequal(portalApex, portalLeft) || Utils.triarea2(portalApex, portalRight, left) < 0.0) {
// Tighten the funnel.
portalLeft = left;
leftIndex = i;
} else {
// Left over right, insert right to path and restart scan from portal right point.
pts.push(portalRight);
// Make current right the new apex.
portalApex = portalRight;
apexIndex = rightIndex;
// Reset portal
portalLeft = portalApex;
portalRight = portalApex;
leftIndex = apexIndex;
rightIndex = apexIndex;
// Restart scan
i = apexIndex;
continue;
}
}
}
if ((pts.length === 0) || (!Utils.vequal(pts[pts.length - 1], portals[portals.length - 1].left))) {
// Append last point to path.
pts.push(portals[portals.length - 1].left);
}
this.path = pts;
return pts;
}
}
export { Channel };

View File

@ -0,0 +1,315 @@
import {
Vector3,
Plane,
Geometry,
Triangle,
} from 'three';
import { Utils } from './Utils';
import { AStar } from './AStar';
import { Builder } from './Builder';
import { Channel } from './Channel';
/**
* Defines an instance of the pathfinding module, with one or more zones.
*/
class Pathfinding {
constructor () {
this.zones = {};
}
/**
* (Static) Builds a zone/node set from navigation mesh geometry.
* @param {BufferGeometry} geometry
* @return {Zone}
*/
static createZone (geometry) {
if ( geometry.isGeometry ) {
// Haven't actually implemented support for BufferGeometry yet, but Geometry is somewhat
// not-recommended these days, so go ahead and start warning.
console.warn('[three-pathfinding]: Use BufferGeometry, not Geometry, to create zone.');
} else {
geometry = new Geometry().fromBufferGeometry(geometry);
}
return Builder.buildZone(geometry);
}
/**
* Sets data for the given zone.
* @param {string} zoneID
* @param {Zone} zone
*/
setZoneData (zoneID, zone) {
this.zones[zoneID] = zone;
}
/**
* Returns a random node within a given range of a given position.
* @param {string} zoneID
* @param {number} groupID
* @param {Vector3} nearPosition
* @param {number} nearRange
* @return {Node}
*/
getRandomNode (zoneID, groupID, nearPosition, nearRange) {
if (!this.zones[zoneID]) return new Vector3();
nearPosition = nearPosition || null;
nearRange = nearRange || 0;
const candidates = [];
const polygons = this.zones[zoneID].groups[groupID];
polygons.forEach((p) => {
if (nearPosition && nearRange) {
if (Utils.distanceToSquared(nearPosition, p.centroid) < nearRange * nearRange) {
candidates.push(p.centroid);
}
} else {
candidates.push(p.centroid);
}
});
return Utils.sample(candidates) || new Vector3();
}
/**
* Returns the closest node to the target position.
* @param {Vector3} position
* @param {string} zoneID
* @param {number} groupID
* @param {boolean} checkPolygon
* @return {Node}
*/
getClosestNode (position, zoneID, groupID, checkPolygon = false) {
const nodes = this.zones[zoneID].groups[groupID];
const vertices = this.zones[zoneID].vertices;
let closestNode = null;
let closestDistance = Infinity;
nodes.forEach((node) => {
const distance = Utils.distanceToSquared(node.centroid, position);
if (distance < closestDistance
&& (!checkPolygon || Utils.isVectorInPolygon(position, node, vertices))) {
closestNode = node;
closestDistance = distance;
}
});
return closestNode;
}
/**
* Returns a path between given start and end points. If a complete path
* cannot be found, will return the nearest endpoint available.
*
* @param {Vector3} startPosition Start position.
* @param {Vector3} targetPosition Destination.
* @param {string} zoneID ID of current zone.
* @param {number} groupID Current group ID.
* @return {Array<Vector3>} Array of points defining the path.
*/
findPath (startPosition, targetPosition, zoneID, groupID) {
const nodes = this.zones[zoneID].groups[groupID];
const vertices = this.zones[zoneID].vertices;
const closestNode = this.getClosestNode(startPosition, zoneID, groupID, true);
const farthestNode = this.getClosestNode(targetPosition, zoneID, groupID, true);
// If we can't find any node, just go straight to the target
if (!closestNode || !farthestNode) {
return null;
}
const paths = AStar.search(nodes, closestNode, farthestNode);
const getPortalFromTo = function (a, b) {
for (var i = 0; i < a.neighbours.length; i++) {
if (a.neighbours[i] === b.id) {
return a.portals[i];
}
}
};
// We have the corridor, now pull the rope.
const channel = new Channel();
channel.push(startPosition);
for (let i = 0; i < paths.length; i++) {
const polygon = paths[i];
const nextPolygon = paths[i + 1];
if (nextPolygon) {
const portals = getPortalFromTo(polygon, nextPolygon);
channel.push(
vertices[portals[0]],
vertices[portals[1]]
);
}
}
channel.push(targetPosition);
channel.stringPull();
// Return the path, omitting first position (which is already known).
const path = channel.path.map((c) => new Vector3(c.x, c.y, c.z));
path.shift();
return path;
}
}
/**
* Returns closest node group ID for given position.
* @param {string} zoneID
* @param {Vector3} position
* @return {number}
*/
Pathfinding.prototype.getGroup = (function() {
const plane = new Plane();
return function (zoneID, position, checkPolygon = false) {
if (!this.zones[zoneID]) return null;
let closestNodeGroup = null;
let distance = Math.pow(50, 2);
const zone = this.zones[zoneID];
for (let i = 0; i < zone.groups.length; i++) {
const group = zone.groups[i];
for (const node of group) {
if (checkPolygon) {
plane.setFromCoplanarPoints(
zone.vertices[node.vertexIds[0]],
zone.vertices[node.vertexIds[1]],
zone.vertices[node.vertexIds[2]]
);
if (Math.abs(plane.distanceToPoint(position)) < 0.01) {
const poly = [
zone.vertices[node.vertexIds[0]],
zone.vertices[node.vertexIds[1]],
zone.vertices[node.vertexIds[2]]
];
if(Utils.isPointInPoly(poly, position)) {
return i;
}
}
}
const measuredDistance = Utils.distanceToSquared(node.centroid, position);
if (measuredDistance < distance) {
closestNodeGroup = i;
distance = measuredDistance;
}
}
}
return closestNodeGroup;
};
}());
/**
* Clamps a step along the navmesh, given start and desired endpoint. May be
* used to constrain first-person / WASD controls.
*
* @param {Vector3} start
* @param {Vector3} end Desired endpoint.
* @param {Node} node
* @param {string} zoneID
* @param {number} groupID
* @param {Vector3} endTarget Updated endpoint.
* @return {Node} Updated node.
*/
Pathfinding.prototype.clampStep = (function () {
const point = new Vector3();
const plane = new Plane();
const triangle = new Triangle();
const endPoint = new Vector3();
let closestNode;
let closestPoint = new Vector3();
let closestDistance;
return function (startRef, endRef, node, zoneID, groupID, endTarget) {
const vertices = this.zones[zoneID].vertices;
const nodes = this.zones[zoneID].groups[groupID];
const nodeQueue = [node];
const nodeDepth = {};
nodeDepth[node.id] = 0;
closestNode = undefined;
closestPoint.set(0, 0, 0);
closestDistance = Infinity;
// Project the step along the current node.
plane.setFromCoplanarPoints(
vertices[node.vertexIds[0]],
vertices[node.vertexIds[1]],
vertices[node.vertexIds[2]]
);
plane.projectPoint(endRef, point);
endPoint.copy(point);
for (let currentNode = nodeQueue.pop(); currentNode; currentNode = nodeQueue.pop()) {
triangle.set(
vertices[currentNode.vertexIds[0]],
vertices[currentNode.vertexIds[1]],
vertices[currentNode.vertexIds[2]]
);
triangle.closestPointToPoint(endPoint, point);
if (point.distanceToSquared(endPoint) < closestDistance) {
closestNode = currentNode;
closestPoint.copy(point);
closestDistance = point.distanceToSquared(endPoint);
}
const depth = nodeDepth[currentNode.id];
if (depth > 2) continue;
for (let i = 0; i < currentNode.neighbours.length; i++) {
const neighbour = nodes[currentNode.neighbours[i]];
if (neighbour.id in nodeDepth) continue;
nodeQueue.push(neighbour);
nodeDepth[neighbour.id] = depth + 1;
}
}
endTarget.copy(closestPoint);
return closestNode;
};
}());
/**
* Defines a zone of interconnected groups on a navigation mesh.
*
* @type {Object}
* @property {Array<Group>} groups
* @property {Array<Vector3>} vertices
*/
const Zone = {}; // jshint ignore:line
/**
* Defines a group within a navigation mesh.
*
* @type {Object}
*/
const Group = {}; // jshint ignore:line
/**
* Defines a node (or polygon) within a group.
*
* @type {Object}
* @property {number} id
* @property {Array<number>} neighbours IDs of neighboring nodes.
* @property {Array<number>} vertexIds
* @property {Vector3} centroid
* @property {Array<Array<number>>} portals Array of portals, each defined by two vertex IDs.
* @property {boolean} closed
* @property {number} cost
*/
const Node = {}; // jshint ignore:line
export { Pathfinding };

View File

@ -0,0 +1,53 @@
import {
Color,
Object3D,
LineBasicMaterial,
MeshBasicMaterial,
SphereBufferGeometry,
BoxGeometry,
Mesh,
SphereGeometry,
Geometry,
Vector3,
Line,
} from 'three';
const OFFSET = 0.2;
/**
* Helper for debugging pathfinding behavior.
*/
class PathfindingHelper extends Object3D {
constructor () {
super();
this._playerMarker = null;
this._markers = [
this._playerMarker,
];
this._markers.forEach( ( marker ) => {
this.add( marker );
} );
}
/**
* @param {Vector3} position
* @return {this}
*/
setPlayerPosition( position ) {
// this._playerMarker.lookAt(position);
this._playerMarker.position.copy( position );
return this;
}
}
export { PathfindingHelper };

View File

@ -0,0 +1,66 @@
class Utils {
static roundNumber (value, decimals) {
const factor = Math.pow(10, decimals);
return Math.round(value * factor) / factor;
}
static sample (list) {
return list[Math.floor(Math.random() * list.length)];
}
static distanceToSquared (a, b) {
var dx = a.x - b.x;
var dy = a.y - b.y;
var dz = a.z - b.z;
return dx * dx + dy * dy + dz * dz;
}
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/math/is-point-in-poly [rev. #0]
static isPointInPoly (poly, pt) {
for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
((poly[i].z <= pt.z && pt.z < poly[j].z) || (poly[j].z <= pt.z && pt.z < poly[i].z)) && (pt.x < (poly[j].x - poly[i].x) * (pt.z - poly[i].z) / (poly[j].z - poly[i].z) + poly[i].x) && (c = !c);
return c;
}
static isVectorInPolygon (vector, polygon, vertices) {
// reference point will be the centroid of the polygon
// We need to rotate the vector as well as all the points which the polygon uses
var lowestPoint = 100000;
var highestPoint = -100000;
var polygonVertices = [];
polygon.vertexIds.forEach((vId) => {
lowestPoint = Math.min(vertices[vId].y, lowestPoint);
highestPoint = Math.max(vertices[vId].y, highestPoint);
polygonVertices.push(vertices[vId]);
});
if (vector.y < highestPoint + 0.5 && vector.y > lowestPoint - 0.5 &&
this.isPointInPoly(polygonVertices, vector)) {
return true;
}
return false;
}
static triarea2 (a, b, c) {
var ax = b.x - a.x;
var az = b.z - a.z;
var bx = c.x - a.x;
var bz = c.z - a.z;
return bx * az - ax * bz;
}
static vequal (a, b) {
return this.distanceToSquared(a, b) < 0.00001;
}
}
export { Utils };

View File

@ -0,0 +1,4 @@
import { Pathfinding } from './Pathfinding';
import { PathfindingHelper } from './PathfindingHelper';
export { Pathfinding, PathfindingHelper };

View File

@ -53,12 +53,12 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
jsonwebwork.onmessage = function (event) {
// console.log(event.data);
// if(event.data.deviceType == "TRAIN"){
// // console.log(event.data);
//
// }
console.log(event.data);
// console.log(event.data);
if(event.data.type == "Device_Load_Destroy_3D"){
DeviceDestroy(event.data);
return;
@ -150,7 +150,6 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
@ -442,27 +441,28 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].deviceType == "SWITCH"){
initswitch(data[i]);
}
if(data[i].deviceType == "PSD"){
}else if(data[i].deviceType == "PSD"){
initstand(data[i]);
}else{
console.log(data[i]);
}
}
}
function DeviceDestroy(data){
for(let i=0,leni=data.body.length;i<leni;i++){
for(let i=0,leni=data.body.deviceList.length;i<leni;i++){
if(data.body[i].type == "TRAIN"){
code =data.body[i].code;
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "0") {
if(data.body.deviceList[i].type == "TRAIN"){
code =data.body.deviceList[i].code;
if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "0") {
if (rails.sectionrail[data.body[i].section]) {
if (rails.sectionrail[data.body.deviceList[i].section]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
// trainlisttest.list[code].progress = 0;
trainlisttest.list[code].dispose = "0";
trainlisttest.list[code].nowcode = data.body[i].section;
trainlisttest.list[code].nowcode = data.body.deviceList[i].section;
trainlisttest.list[code].nextcode = null;
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
@ -476,7 +476,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].mixerpush = true;
}
}
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "1") {
} else if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "1") {
trainlisttest.list[code].status = 1;
trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null;
@ -493,17 +493,17 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}
}
if(data.body[i].type == "SIGNAL"){
signalupdate(data.body[i]);
if(data.body.deviceList[i].type == "SIGNAL"){
signalupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "SWITCH"){
switchupdate(data.body[i]);
if(data.body.deviceList[i].type == "SWITCH"){
switchupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "PSD"){
standupdate(data.body[i]);
if(data.body.deviceList[i].type == "PSD"){
standupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body[i]);
if(data.body.deviceList[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body.deviceList[i]);
}
}
}

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -541,6 +542,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 0.1, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -491,6 +492,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 1, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [], // 特殊列车类型需设置显示格式

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: true // 进路触发颜色
@ -659,6 +660,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 1, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -523,6 +524,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 0, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -515,6 +516,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 0, // 车身line宽
changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -540,6 +541,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 2, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -521,6 +522,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 1, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [], // 特殊列车类型需设置显示格式

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -545,16 +546,17 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 0, // 车身line宽
changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [
{
type: '03',
type: 'MANUAL',
serviceNumber: 'MM',
nameFormat: 'serviceNumber:groupNumber'
},
{
type: '02',
type: 'HEAD',
nameFormat: 'targetCode:groupNumber'
}
], // 特殊列车类型需设置显示格式
@ -574,7 +576,8 @@ class SkinCode extends defaultStyle {
normalColor: '#FFF'
},
hsda: {
trainHSDATextFontSize: 8// 列车HDSA字号
trainHSDATextFontSize: 8, // 列车HDSA字号
upPaddingHSDA: 0
},
trainNumber: {
targetCodePrefix: '000', // 目的地码前缀
@ -585,7 +588,8 @@ class SkinCode extends defaultStyle {
trainServer: {
serviceNumberPrefix: '00', // 服务号(表号)前缀
defaultServiceNumber: 'BB', // 默认服务号(表号)
trainServerOffset: { x: 26, y: 1}// 列车服务号偏移
trainServerOffset: { x: 26, y: 1}, // 列车服务号偏移
manualTypeText: 'MM' // 人工车填充
},
trainTarget: {
tripNumberPrefix: '0000', // 车次号前缀
@ -595,14 +599,14 @@ class SkinCode extends defaultStyle {
smallColor: '#70ECEE', // 小交路颜色
bigColor: '#FFFFFF', // 大交路颜色
inboundColor: '#00FF00', // 回库颜色
planTypeColor: '#FFFFFF', // 计划车颜色
manualTypeColor: '#FF0', // 人工车
headTypeColor: '#FF0' // 头码车
planTypeColor: '#FFFFFF' // 计划车颜色
},
trainTargetNumber: {
groupNumberPrefix: '000', // 车组号前缀
defaultGroupNumber: 'EEE', // 默认车组号
trainTargetNumberOffset: {x: -1, y: 1}// 车组号偏移量
trainTargetNumberOffset: {x: -1, y: 1}, // 车组号偏移量
manualTypeColor: '#FF0', // 人工车
headTypeColor: '#FF0' // 头码车
},
trainHead: {
trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框

View File

@ -4,6 +4,7 @@ import deviceType from '../../constant/deviceType';
class SkinCode extends defaultStyle {
constructor() {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
active: {
routeColor: false // 进路触发颜色
@ -659,6 +660,7 @@ class SkinCode extends defaultStyle {
};
this[deviceType.Train] = {
trainBody: {
fontFamily: 'consolas',
trainBodyLineWidth: 2, // 车身line宽
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
specialTrainType: [], // 特殊列车类型需设置显示格式

View File

@ -291,6 +291,13 @@ class Jlmap {
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
if (elem.deviceType === 'TRAIN' && elem.type === 'HEAD') {
elem.serviceNumber = '';
} else if (elem.deviceType === 'TRAIN' && elem.type === 'MANUAL') {
elem.serviceNumber = '';
elem.tripNumber = '';
elem.destinationCode = '';
}
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
this.hookHandle(oDevice, elem);
});
@ -371,7 +378,6 @@ class Jlmap {
update(list) {
this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
const signalDeviceList = [];
const signalStatusList = [];
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
@ -386,13 +392,9 @@ class Jlmap {
}
}
const signalDevice = this.mapDevice[route.startSignalCode];
const signalStatus = {atsControl: elem.atsControl, fleetMode: elem.fleetMode};
const index = signalDeviceList.indexOf(signalDevice);
if (index === -1) {
signalDeviceList.push(signalDevice);
signalStatusList.push(signalStatus);
} else {
signalStatusList[index] = {atsControl: signalStatusList[index].atsControl && elem.atsControl, fleetMode: signalStatusList[index].fleetMode || elem.fleetMode};
}
} else if (elem.deviceType === 'CYCLE') {
store.dispatch('map/updateAutoReentryState', elem);
@ -431,15 +433,28 @@ class Jlmap {
}
}
});
this.handleRouteSignalStatus(signalDeviceList, signalStatusList);
this.handleRouteSignalStatus(signalDeviceList);
// 状态后处理
this.postHandle(list || []);
if (this.methods.stateUpdate instanceof Function) { this.methods.stateUpdate(list); }
}
handleRouteSignalStatus(signalDeviceList, signalStatusList) {
handleRouteSignalStatus(signalDeviceList) {
const routeStartSignalData = store.state.map.routeStartSignalData;
signalDeviceList.forEach((item, index)=> {
if (item && this.hookHandle(item, signalStatusList[index])) {
const status = {};
if (routeStartSignalData[item.code] && routeStartSignalData[item.code].length) {
routeStartSignalData[item.code].forEach((elem, index)=> {
if (index) {
status.atsControl = status.atsControl && elem.atsControl;
status.fleetMode = status.fleetMode || elem.fleetMode;
} else {
status.atsControl = elem.atsControl;
status.fleetMode = elem.fleetMode;
}
});
}
if (item && this.hookHandle(item, status)) {
this.$painter.update(item);
}
});

View File

@ -17,7 +17,7 @@ export default class EMouse extends Group {
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,

View File

@ -9,7 +9,7 @@ import EMouse from './EMouse';
import BoundingRect from 'zrender/src/core/BoundingRect';
import {isShowThePrdType} from '../../utils/handlePath';
export default class Automactic extends Group {
export default class AutoTurnBack extends Group {
constructor(model, style) {
super();
this.z = 20;

View File

@ -17,7 +17,7 @@ export default class EMouse extends Group {
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,

View File

@ -17,7 +17,7 @@ export default class EMouse extends Group {
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,

View File

@ -17,7 +17,7 @@ export default class EMouse extends Group {
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,

View File

@ -2,52 +2,52 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class EMouse extends Group {
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
zlevel: this.device.zlevel,
z: this.device.z+1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance-30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
zlevel: this.device.zlevel,
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.style.LcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.LcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LcControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
}

View File

@ -2,53 +2,53 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class EMouse extends Group {
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
_subType: 'Text',
zlevel: this.device.zlevel,
z: this.device.z+1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LimitControl.lamp.radiusR + this.device.style.LimitControl.text.distance-30,
fontWeight: this.device.style.LimitControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.LimitControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.LimitControl.mouseOverStyle.fontFormat,
text: this.device.model.name,
textFill: this.device.style.LimitControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LimitControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.LimitControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.LimitControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
_subType: 'Text',
zlevel: this.device.zlevel,
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.LimitControl.lamp.radiusR + this.device.style.LimitControl.text.distance - 30,
fontWeight: this.device.style.LimitControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.LimitControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFormat,
text: this.device.model.name,
textFill: this.device.style.LimitControl.mouseOverStyle.fontColor,
textAlign: this.device.style.LimitControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.LimitControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.LimitControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.LimitControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.LimitControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
}

View File

@ -17,7 +17,7 @@ export default class EMouse extends Group {
y: this.device.model.position.y + this.device.deviceStyle.lamp.radiusR + this.device.deviceStyle.text.distance - 30,
fontWeight: 'normal',
fontSize: this.device.deviceStyle.mouseOverStyle.fontSize,
fontFamily: this.device.deviceStyle.mouseOverStyle.fontFamily,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.deviceStyle.mouseOverStyle.fontColor,
textAlign: this.device.deviceStyle.mouseOverStyle.textAlign,

View File

@ -59,6 +59,7 @@ class EMouse extends Group {
x: rect.x + (rect.width / 2),
y: rect.y + (rect.height / 2),
text: this.device.model.name,
fontFamily: this.device.style.fontFamily,
textFill: this.device.style.Section.mouseOverStyle.textShadowColor, // 黄色
textAlign: 'middle',
textVerticalAlign: 'top',

View File

@ -8,7 +8,7 @@ export default class ESeparator extends Group {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.style.Section.separator.z || 6;
this.z = model.z || 6;
this.style = model.style;
this.setType();
}

View File

@ -481,6 +481,7 @@ export default class Section extends Group {
this.lPartition = new ESeparator({
style: style,
zlevel: this.zlevel,
z: this.z + 3,
traingle: traingle,
point: {
x: model.points[0].x,
@ -495,6 +496,7 @@ export default class Section extends Group {
this.rPartition = new ESeparator({
style: style,
zlevel: this.zlevel,
z: this.z + 3,
traingle: traingle,
point: {
x: model.points[model.points.length - 1].x,

View File

@ -33,6 +33,7 @@ class ESigPost extends Group {
this.hor = new Polyline({
zlevel: model.zlevel,
z: model.z,
_val: '3',
shape: {
points: [
[model.x, model.y],

View File

@ -67,6 +67,7 @@ class Signal extends Group {
this.ciConfirm = new Text({
zlevel: this.zlevel,
z: this.z,
_val: '3',
silent: false,
_subType: 'enabled',
style: {
@ -110,6 +111,7 @@ class Signal extends Group {
this.tText = new Text({
zlevel: this.zlevel,
z: this.z,
_val: '3',
style: {
x: endPoint.x,
y: endPoint.y,

View File

@ -53,7 +53,7 @@ export default class ESingleControl extends Group {
y: model.point.y + model.style.Station.StationControl.lamp.radiusR + model.style.Station.StationControl.text.distance,
fontWeight: model.style.Station.StationControl.text.fontWeight,
fontSize: model.style.Station.StationControl.text.fontSize,
fontFamily: model.style.Station.StationControl.text.fontFormat,
fontFamily: model.style.fontFamily,
text: model.context,
textFill: model.style.Station.StationControl.text.fontColor,
textAlign: model.style.Station.StationControl.text.textAlign,

View File

@ -23,7 +23,8 @@ class EDetain extends Group {
x: model.x,
y: model.y,
text: style.StationStand.detainCar.text,
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
fontSize: `${style.StationStand.detainCar.fontSize}px`,
fontFamily: style.fontFamily,
textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor,
textAlign: style.textStyle.textAlign,

View File

@ -99,7 +99,7 @@ export default class TrainBody extends Group {
textAlign: 'middle',
textVerticalAlign: 'top'
}) : '';
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号
@ -320,9 +320,9 @@ export default class TrainBody extends Group {
if (type === 'PLAN') {
this.style.Train.trainTarget.planTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.planTypeColor});
} else if (type === 'MANUAL') {
this.style.Train.trainTarget.manualTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.manualTypeColor});
this.style.Train.trainTargetNumber.manualTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle({textFill: this.style.Train.trainTargetNumber.manualTypeColor});
} else if (type === 'HEAD') {
this.style.Train.trainTarget.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.headTypeColor});
this.style.Train.trainTargetNumber.headTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle({textFill: this.style.Train.trainTargetNumber.headTypeColor});
}
}
setSoonerOrLater(dt) {

View File

@ -29,12 +29,11 @@ export default class Train extends Group {
style.Train.trainBody.specialTrainType.some((item) => {
if (model.type === item.type) {
this.nameFormat = item.nameFormat;
model.serviceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber;
model.specialServiceNumber = item.serviceNumber ? item.serviceNumber : model.serviceNumber;
return true;
}
});
}
this.create();
this.setState(model, this);
this.initShowStation(model);
@ -408,8 +407,8 @@ export default class Train extends Group {
this.setHoldStatus(model.hold);
this.setJumpStatus(model.jump);
this.setSoonerOrLater(model.dt);
this.setPlanRoutingTypeColor(model.planRoutingType);
this.setTrainTypeColor(model.type);
this.setPlanRoutingTypeColor(model.planRoutingType);
const style = this.style;
if (style.Section.trainPosition.display) {
this.updateSection(object);

View File

@ -2,53 +2,53 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
export default class EMouse extends Group {
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
_subType: 'Text',
zlevel: this.device.zlevel,
z: this.device.z+1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.ZcControl.lamp.radiusR + this.device.style.ZcControl.text.distance-30,
fontWeight: this.device.style.ZcControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.ZcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.ZcControl.mouseOverStyle.fontFormat,
text: this.device.model.name,
textFill: this.device.style.ZcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.ZcControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.ZcControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.ZcControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
constructor(device) {
super();
this.device = device;
this.create();
}
create() {
this.text = new Text({
_subType: 'Text',
zlevel: this.device.zlevel,
z: this.device.z + 1,
position: [0, 0],
style: {
x: this.device.model.position.x,
y: this.device.model.position.y + this.device.style.ZcControl.lamp.radiusR + this.device.style.ZcControl.text.distance - 30,
fontWeight: this.device.style.ZcControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.ZcControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.fontFamily,
text: this.device.model.name,
textFill: this.device.style.ZcControl.mouseOverStyle.fontColor,
textAlign: this.device.style.ZcControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.ZcControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}
mouseover(e) {
if (e.target && e.target._subType == 'Text') {
this.text.show();
} else {
this.device.control.setControlColor(this.device.style.ZcControl.mouseOverStyle.arcColor);
this.device.control.setTextColor(this.device.style.ZcControl.mouseOverStyle.textColor);
this.device.control.setTextBorder(true);
this.device.control.setArcBorder(true);
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
mouseout(e) {
if (!this.device.model.down) {
if (e.target && e.target._subType == 'Text') {
this.text.hide();
} else {
this.device.control.setControlColor(this.device.style.ZcControl.lamp.controlColor);
this.device.control.setTextColor('#FFFFFF');
this.device.control.setTextBorder(false);
this.device.control.setArcBorder(false);
}
}
}
}

View File

@ -17,7 +17,7 @@ import Line from './Line/index.js';
import Text2 from './Text/index.js';
import AxleReset from './AxleReset/index';
import GuideLock from './GuideLock/index';
import AutoTurnBack from './Automactic/index.js';
import AutoTurnBack from './AutoTurnBack/index.js';
import OutFrame from './OutFrame/index.js';
import CheckBox from './checkBox/checkBox.js';
import AutomaticRoute from './AutomacticRoute/index.js';

View File

@ -21,7 +21,7 @@
<el-radio-group
:id="domIdTrainType"
v-model="formModel.type"
style="margin-left: 15px;"
style="margin-left: 45px;"
@change="trainTypeChange"
>
<el-radio :label="'PLAN'">{{ $t('menu.planTrain') }}</el-radio>
@ -29,15 +29,15 @@
<el-radio :label="'MANUAL'" style="margin-top:5px;">{{ $t('menu.artificialTrain') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'" prop="serviceNumber">
<span slot="label">{{ $t('menu.serviceNumber') }}</span>
<el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" prop="serviceNumber">
<span slot="label">{{ $t('menu.serviceNumber') + '' }}</span>
<el-input
:id="domIdServerNo"
v-model="formModel.serviceNumber"
:disabled="serverNoIsDisabled"
/>
</el-form-item>
<el-form-item v-if="formModel.type == 'PLAN'|| formModel.type == 'HEAD'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-form-item v-if="formModel.type == 'PLAN'" :label="this.$t('menu.tripNumber')+this.$t('global.colon')" prop="tripNumber">
<el-input
:id="domIdTrainNo"
v-model="formModel.tripNumber"
@ -48,23 +48,24 @@
<el-input
:id="domIdTargetCode"
v-model="formModel.destinationCode"
:disabled="formModel.type !== 'HEAD'"
/>
</el-form-item>
<!--<el-form-item v-if="formModel.type == '03'" :label="this.$t('menu.category')+this.$t('global.colon')" prop="category">-->
<!--<el-select-->
<!--:id="domIdTrainNumber"-->
<!--v-model="formModel.category"-->
<!--filterable-->
<!--:disabled="true"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="item in categoryList"-->
<!--:key="item.value"-->
<!--:label="item.name"-->
<!--:value="item.value"-->
<!--/>-->
<!--</el-select>-->
<!--</el-form-item>-->
<el-form-item v-if="formModel.type == 'MANUAL'" :label="this.$t('menu.category')+this.$t('global.colon')" prop="category">
<el-select
:id="domIdTrainNumber"
v-model="formModel.category"
filterable
:disabled="true"
>
<el-option
v-for="item in categoryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
@ -82,11 +83,11 @@
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import ConfirmTrain from './childDialog/confirmTrain';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
import Handler from '@/scripts/cmdPlugin/Handler';
import { menuOperate, commitOperate } from '../utils/menuOperate';
import {getTrainDetailBytripNumber} from '@/api/simulation';
export default {
name: 'TrainControl',
@ -97,9 +98,7 @@ export default {
data() {
return {
trainList: [],
categoryList: [
{ name: 'MM', value: '01' }
],
serviceNumber:'',
formModel: {
tripNumber: '',
groupNumber: '',
@ -108,7 +107,9 @@ export default {
destinationCode: '',
category: 'MM'
},
categoryList: [
{ name: 'MM', value: '01' }
],
rules: {
groupNumber: [
{ required: true, message: this.$t('rules.selectGroupNumber'), trigger: 'change' }
@ -116,9 +117,6 @@ export default {
type: [
{ required: true, message: this.$t('rules.selectATrainType'), trigger: 'change' }
],
serviceNumber: [
{ required: true, message: this.$t('rules.enterTheServiceNumber'), trigger: 'blur' }
],
tripNumber: [
{ required: true, message: this.$t('rules.enterTheTripNumber'), trigger: 'blur' }
],
@ -136,27 +134,15 @@ export default {
...mapGetters('map', [
'map'
]),
trainNoIsDisabled() {
return false;
},
serverNoIsDisabled() {
return true;
},
targetCodeIsDisabled() {
return true;
},
trainNumberIsDisabled() {
if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
return true;
}
return '';
},
// trainTypeIsDisabled() {
// if (this.operation != OperationEvent.Train.addTrainId.menu.operation) {
// return true;
// }
// return '';
// },
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
@ -242,29 +228,23 @@ export default {
return this.$t('menu.menuTrain.editTrainId');
}
return '';
},
istargetCode() {
if (this.formModel.serviceNumber && this.formModel.targetCode) {
return false;
}
return true;
}
},
watch: {
// 'formModel.tripNumber': function(val) {
// if (val.length == 4) {
// // this.trainNoChange(val);
// } else {
// this.formModel = {
// groupNumber: this.formModel.groupNumber,
// tripNumber: val,
// type: this.formModel.type,
// serviceNumber: '',
// destinationCode: '',
// category: 'MM'
// };
// }
// }
'formModel.tripNumber': function(val) {
if (val.length == 4) {
this.trainNoChange(val);
} else {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: val,
type: this.formModel.type,
serviceNumber: '',
targetCode: '',
category: 'MM'
};
}
}
},
mounted() {
this.$nextTick(() => {
@ -279,6 +259,7 @@ export default {
this.operation = operate.operation;
}
const model = this.$store.getters['map/getDeviceByCode'](selected.code);
this.serviceNumber = model.serviceNumber;
this.formModel = {
groupNumber: model.groupNumber,
tripNumber: model.tripNumber,
@ -302,37 +283,37 @@ export default {
},
trainNumberChange(groupNumber) {
const operate = {
val: `${groupNumber}`,
groupNumber: groupNumber,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNumberChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNumberChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
trainTypeChange(trainType) {
if (trainType === 'HEAD') {
this.formModel.serviceNumber = '';
} else if (trainType === 'PLAN' && this.serviceNumber) {
this.formModel.serviceNumber = this.serviceNumber;
}
const operate = {
val: `${trainType}`,
type: trainType,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainTypeChange.operation;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainTypeChange.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
@ -340,42 +321,26 @@ export default {
},
trainNoChange(tripNumber) {
const operate = {
send: true,
val: tripNumber,
tripNumber: tripNumber,
operation: ''
};
if (this.operation == OperationEvent.Train.addTrainId.menu.operation) {
operate.operation = OperationEvent.Train.addTrainId.trainNoChange.operation;
operate.cmdType = CMD.Train.addTrainId;
} else if (this.operation == OperationEvent.Train.editTrainId.menu.operation) {
operate.operation = OperationEvent.Train.editTrainId.trainNoChange.operation;
operate.cmdType = CMD.Train.editTrainId;
}
Handler.undo(1);
this.$store.dispatch('training/next', operate).then(({ valid, response }) => {
getTrainDetailBytripNumber(this.$route.query.group, {tripNumber:tripNumber}).then(resp => {
if (resp.data) {
this.formModel.serviceNumber = resp.data.serviceNumber;
this.formModel.destinationCode = resp.data.destinationCode;
}
}).catch(() => {
this.$message.error('获取列车信息失败!');
});
this.$store.dispatch('training/tripNumber', operate).then(({ valid }) => {
if (valid) {
if (response.data) {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber,
trainType: this.formModel.trainType,
serviceNumber: response.data.serviceNumber,
targetCode: response.data.targetCode,
category: 'MM'
};
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
this.formModel = {
groupNumber: this.formModel.groupNumber,
tripNumber: tripNumber,
trainType: this.formModel.trainType,
serviceNumber: '',
targetCode: '',
category: 'MM'
};
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
@ -392,23 +357,25 @@ export default {
addTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
const model = this.formModel;
const operate = {
send: true,
operation: OperationEvent.Train.addTrainId.menu.operation,
cmdType: CMD.Train.CMD_ADD_TRAIN_ID,
messages: [this.$t('tip.addTrainIdTip')],
val: `${model.groupNumber}::${model.trainType}::${model.serviceNumber}::${model.tripNumber}::${model.targetCode}`
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
serviceNumber: '',
tripNumber: '',
destinationCode: ''
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (this.formModel.type === 'PLAN') {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === 'HEAD') {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
}
commitOperate(menuOperate.TrainWindow.addTrainId, params, 2).then(({valid})=>{
this.loading = false;
if (valid) {
this.doClose();
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.confirmTrain.doShow(operate);
}
}).catch(() => {
this.loading = false;
@ -424,28 +391,6 @@ export default {
editTrainId() {
this.$refs['form'].validate((valid) => {
if (valid) {
// const operate = {
// send: true,
//
// operation: OperationEvent.Train.editTrainId.menu.operation,
// cmdType: CMD.Train.CMD_EDIT_TRAIN_ID,
// messages: [this.$t('tip.editTrainIdTip')],
// val: `${this.formModel.trainType}::${this.formModel.tripNumber}`
// };
//
// this.loading = true;
// this.$store.dispatch('training/next', operate).then(({ valid }) => {
// this.loading = false;
// if (valid) {
// this.doClose();
// this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
// this.$refs.confirmTrain.doShow(operate);
// }
// }).catch(() => {
// this.loading = false;
// this.doClose();
// this.$refs.noticeInfo.doShow();
// });
const params = {
groupNumber: this.formModel.groupNumber,
type: this.formModel.type,
@ -453,11 +398,11 @@ export default {
tripNumber: '',
destinationCode: ''
};
if (this.formModel.type === '01') {
if (this.formModel.type === 'PLAN') {
params.serviceNumber = this.formModel.serviceNumber;
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
} else if (this.formModel.type === '02') {
} else if (this.formModel.type === 'HEAD') {
params.tripNumber = this.formModel.tripNumber;
params.destinationCode = this.formModel.destinationCode;
}

View File

@ -3,6 +3,8 @@
<el-select
v-model="groupNumber"
filterable
size="small"
style="width: 100%;"
:disabled="true"
>
<el-option
@ -12,7 +14,13 @@
:value="train.groupNumber"
/>
</el-select>
<el-table :data="tableData" :show-header="false">
<div style="margin-top: 5px;">
<div :class="[tabType==='baseInfo'?'simulate-tabs-button-active':'simulate-tabs-button']" style="margin-right: 6px" @click="changeTabs('baseInfo')">基本信息</div>
<div :class="[tabType==='groupInfo'?'simulate-tabs-button-active':'simulate-tabs-button']" style="margin-right: 6px" @click="changeTabs('groupInfo')">车组信息</div>
<div :class="[tabType==='planInfo'?'simulate-tabs-button-active':'simulate-tabs-button']" style="margin-right: 6px" @click="changeTabs('planInfo')">计划信息</div>
<div :class="[tabType==='atcInfo'?'simulate-tabs-button-active':'simulate-tabs-button']" @click="changeTabs('atcInfo')">ATC信息</div>
</div>
<el-table :data="tableData" :show-header="false" border style="margin-top: 5px;height: 360px;">
<el-table-column prop="key" label="key" />
<el-table-column prop="value" label="value" />
</el-table>
@ -32,6 +40,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import Handler from '@/scripts/cmdPlugin/Handler';
import { menuOperate, commitOperate } from '../utils/menuOperate';
import {TrainType} from '@/scripts/ConstDic';
export default {
name: 'TrainControl',
@ -42,13 +51,14 @@ export default {
trainList: [],
tableData: [],
baseInfo: [],
marshallingInfo: [],
groupInfo: [],
planInfo: [],
atcInfo: [],
operation: null,
dialogShow: false,
loading: false,
groupNumber: ''
groupNumber: '',
tabType: 'baseInfo'
};
},
computed: {
@ -80,64 +90,7 @@ export default {
if (!this.dialogShow) {
this.operation = operate.operation;
}
const model = this.$store.getters['map/getDeviceByCode'](selected.code);
this.groupNumber = model.groupNumber;
this.baseInfo = [
{key: '车组号', value: model.groupNumber},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '目的地号', value: ''},
{key: '类型', value: ''},
{key: '司机号', value: ''},
{key: '车站', value: ''},
{key: '所处设备', value: ''},
{key: '跟踪模式', value: ''},
{key: 'ATP切除', value: ''},
{key: '停站状态', value: ''}
];
this.marshallingInfo = [
{key: '车组号', value: ''},
{key: '设备ID', value: ''},
{key: '车头号1', value: ''},
{key: '车头号2', value: ''},
{key: '车厢号1', value: ''},
{key: '车厢号2', value: ''},
{key: '车厢号3', value: ''},
{key: '车厢号4', value: ''},
{key: '车厢号5', value: ''},
{key: '车厢号6', value: ''},
{key: '车厢号7', value: ''},
{key: '车厢号8', value: ''}
];
this.planInfo = [
{key: '车组号', value: ''},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '运行等级', value: ''},
{key: '状态', value: ''},
{key: '计划偏离', value: ''},
{key: '停站时间', value: ''},
{key: '计划到站', value: ''},
{key: '计划到点', value: ''},
{key: '计划发点', value: ''},
{key: '终端发车站台', value: ''},
{key: '终端发车时间', value: ''},
{key: '预计离开站台', value: ''},
{key: '预计离开时间', value: ''},
{key: '预计到达站台', value: ''},
{key: '预计到达时间', value: ''},
{key: '区间运行时分', value: ''}
];
this.atcInfo = [
{key: '车组号', value: ''},
{key: '车次号', value: ''},
{key: '表号', value: ''},
{key: '运行方向', value: ''},
{key: '扣车状态', value: ''},
{key: '车门状态', value: ''},
{key: '驾驶模式', value: ''},
{key: '目的地号', value: ''}
];
this.initData(selected);
this.tableData = this.baseInfo;
/** 加载列车数据*/
this.dialogShow = true;
@ -174,7 +127,118 @@ export default {
}).catch(() => {
this.doClose();
});
},
changeTabs(type) {
switch (type) {
case 'baseInfo':
this.tableData = this.baseInfo;
this.tabType = 'baseInfo';
break;
case 'groupInfo':
this.tableData = this.groupInfo;
this.tabType = 'groupInfo';
break;
case 'planInfo':
this.tableData = this.planInfo;
this.tabType = 'planInfo';
break;
case 'atcInfo':
this.tableData = this.atcInfo;
this.tabType = 'atcInfo';
break;
}
},
initData(model) {
this.groupNumber = model.groupNumber;
this.baseInfo = [
{key: '车组号', value: model.groupNumber},
{key: '车次号', value: model.tripNumber},
{key: '表号', value: model.serviceNumber},
{key: '目的地号', value: model.destinationCode},
{key: '类型', value: TrainType[model.type]},
{key: '司机号', value: ''},
{key: '车站', value: ''},
{key: '所处设备', value: ''},
{key: '跟踪模式', value: ''},
{key: 'ATP切除', value: ''},
{key: '停站状态', value: ''}
];
this.groupInfo = [
{key: '车组号', value: model.groupNumber},
{key: '设备ID', value: ''},
{key: '车头号1', value: ''},
{key: '车头号2', value: ''},
{key: '车厢号1', value: ''},
{key: '车厢号2', value: ''},
{key: '车厢号3', value: ''},
{key: '车厢号4', value: ''},
{key: '车厢号5', value: ''},
{key: '车厢号6', value: ''},
{key: '车厢号7', value: ''},
{key: '车厢号8', value: ''}
];
this.planInfo = [
{key: '车组号', value: model.groupNumber},
{key: '车次号', value: model.tripNumber},
{key: '表号', value: model.serviceNumber},
{key: '运行等级', value: model.runLevel},
{key: '状态', value: ''},
{key: '计划偏离', value: model.dt},
{key: '停站时间', value: ''},
{key: '计划到站', value: ''},
{key: '计划到点', value: ''},
{key: '计划发点', value: ''},
{key: '终端发车站台', value: ''},
{key: '终端发车时间', value: ''},
{key: '预计离开站台', value: ''},
{key: '预计离开时间', value: ''},
{key: '预计到达站台', value: ''},
{key: '预计到达时间', value: ''},
{key: '区间运行时分', value: ''}
];
this.atcInfo = [
{key: '车组号', value: model.groupNumber},
{key: '车次号', value: model.tripNumber},
{key: '表号', value: model.serviceNumber},
{key: '运行方向', value: model.right ? '上行' : '下行'},
{key: '扣车状态', value: model.runControlStatus === '01' ? '正常' : model.runControlStatus === '03' ? '跳停' : '扣车'},
{key: '车门状态', value: model.speed ? '关闭' : '开启'},
{key: '驾驶模式', value: 'SM模式'},
{key: '目的地号', value: model.destinationCode}
];
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.simulate-tabs-button {
display: inline;
border-top: solid 1px #FBFAEF;
border-left: solid 1px #FBFAEF;
border-bottom: solid 1px #858273;
border-right: solid 1px #858273;
width: 90px;
height: 28px;
font-size: 14px;
line-height: 28px;
padding: 2px 10px;
}
.simulate-tabs-button:active{
border-top: solid 1px #858273;
border-left: solid 1px #858273;
border-bottom: solid 1px #FBFAEF;
border-right: solid 1px #FBFAEF;
}
.simulate-tabs-button-active{
display: inline;
border-top: solid 1px #858273;
border-left: solid 1px #858273;
border-bottom: solid 1px #FBFAEF;
border-right: solid 1px #FBFAEF;
width: 90px;
height: 28px;
font-size: 14px;
line-height: 28px;
padding: 2px 10px;
}
</style>

View File

@ -96,6 +96,21 @@ export default {
overflow: hidden !important;
}
.xian-01__systerm.pop-menu{
padding: 0;
padding-left: 20px;
}
.xian-01__systerm.pop-menu .dsp-block {
display: block;
text-align: left;
width: 100%;
border-radius: unset;
border: 1px solid transparent;
color: #000;
padding: 6px 6px;
border-left: 1px solid #bdbcbc;
}
.xian-01__systerm .el-dialog {
background: rgba(100, 100, 100, 0.3);
border: 2px solid rgb(144, 144, 144, 0.8);

View File

@ -1,12 +1,10 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<section-control ref="sectionControl" />
<section-cmd-control ref="sectionCmdControl" />
<speed-cmd-control ref="speedCmdControl" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
<train-add-plan ref="trainAddPlan" />
</div>
</template>
@ -21,9 +19,7 @@ import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from './utils/menuOperate';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import TrainAddPlan from './dialog/trainAddPlan';
export default {
name: 'SectionMenu',
@ -32,9 +28,7 @@ export default {
SectionControl,
SectionCmdControl,
SpeedCmdControl,
NoticeInfo,
SetFault,
TrainAddPlan
NoticeInfo
},
props: {
selected: {
@ -199,7 +193,7 @@ export default {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainAddPlan.doShow(step, this.selected);
this.$store.dispatch('training/setCommonMenuStep', step);
}
});
},
@ -207,7 +201,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -215,7 +209,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<route-selection ref="routeSelection" />
<route-lock ref="routeLock" />
<route-control ref="routeControl" />
@ -8,7 +8,6 @@
<route-hand-control ref="routeHandControl" />
<route-detail ref="routeDetail" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div>
</template>
@ -26,7 +25,6 @@ import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import { menuOperate, commitOperate } from './utils/menuOperate';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
export default {
name: 'SignalMenu',
@ -38,8 +36,7 @@ export default {
RouteCmdControl,
RouteHandControl,
RouteDetail,
NoticeInfo,
SetFault
NoticeInfo
},
props: {
selected: {
@ -231,7 +228,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -239,7 +236,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<station-cmd-control ref="stationCmdControl" />
<station-human-control-all ref="stationHumanControlAll" />
<station-set-route-control-all ref="stationSetRouteControlAll" />

View File

@ -1,6 +1,6 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<stand-control ref="standControl" />
<stand-detail ref="standDetail" />
<stand-run-level ref="standRunLevel" />
@ -8,7 +8,6 @@
<stand-detain-train-all ref="standDetainTrainAll" />
<notice-info ref="noticeInfo" />
<stand-back-strategy ref="standBackStrategy" />
<set-fault ref="setFault" />
</div>
</template>
@ -22,12 +21,11 @@ import StandStopTime from './dialog/standStopTime';
import StandDetainTrainAll from './dialog/standDetainTrainAll';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
// import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from './utils/menuOperate';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
export default {
name: 'StationStandMenu',
@ -39,8 +37,7 @@ export default {
NoticeInfo,
StandBackStrategy,
StandStopTime,
StandDetainTrainAll,
SetFault
StandDetainTrainAll
},
props: {
selected: {
@ -196,7 +193,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -204,7 +201,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -1,11 +1,10 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<switch-control ref="switchControl" />
<switch-cmd-control ref="switchCmdControl" />
<speed-cmd-control ref="speedCmdControl" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div>
</template>
@ -20,7 +19,6 @@ import { mapGetters } from 'vuex';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from './utils/menuOperate';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
export default {
name: 'SwitchMenu',
@ -29,8 +27,7 @@ export default {
SwitchControl,
SwitchCmdControl,
SpeedCmdControl,
NoticeInfo,
SetFault
NoticeInfo
},
props: {
selected: {
@ -220,7 +217,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -228,7 +225,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -1,12 +1,13 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<pop-menu ref="popMenu" :menu="menu" pop-menu-class="xian-01__systerm" />
<notice-info ref="noticeInfo" />
<train-control ref="trainControl" />
<train-delete ref="trainDelete" />
<train-move ref="trainMove" />
<train-switch ref="trainSwitch" />
<train-edit-number ref="trainEditNumber" />
<train-detail ref="trainDetail" />
</div>
</template>
@ -22,6 +23,7 @@ import TrainDelete from './dialog/trainDelete';
import TrainMove from './dialog/trainMove';
import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import TrainDetail from './dialog/trainDetail';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
export default {
@ -33,7 +35,8 @@ export default {
TrainDelete,
TrainMove,
TrainSwitch,
TrainEditNumber
TrainEditNumber,
TrainDetail
},
props: {
selected: {
@ -50,48 +53,48 @@ export default {
Local: [],
Center: [
{
label: this.$t('menu.menuTrain.addTrainId'),
handler: this.addTrainId,
cmdType:''
label: '添加列车识别号',
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: this.$t('menu.menuTrain.deleteTrainId'),
handler: this.delTrainId,
cmdType:''
label: '删除列车识别号',
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: this.$t('menu.menuTrain.editTrainId'),
label: '修改列车识别号',
handler: this.editTrainId,
cmdType:CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: this.$t('menu.menuTrain.editTrainNo'),
handler: this.editTrainNo,
cmdType:''
label: '修改车组号',
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: this.$t('menu.menuTrain.moveTrainId'),
handler: this.moveTrainId,
cmdType:''
label: '移动列车识别号',
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: this.$t('menu.menuTrain.switchTrainId'),
handler: this.switchTrainId,
cmdType:''
label: '交换列车识别号',
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '标记ATP切除',
handler: this.undeveloped(),
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_TAG_ATP_CUT
},
{
label: '标记ATP激活',
handler: this.undeveloped(),
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_TAG_ATP_RECOVER
},
{
label: '查看列车详细运行信息',
handler: this.undeveloped(),
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_INFO
}
]
@ -144,10 +147,9 @@ export default {
},
initMenu() {
//
// this.menu = MenuContextHandler.menuFiltration(this.menuNormal);
this.menu = MenuContextHandler.covert(this.menuNormal);
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu, ...this.menuForce, ...this.menuSpeed];
this.menu = [...this.menu, ...this.menuForce];
}
//
@ -159,28 +161,26 @@ export default {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
if (this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
if (this.$refs.popMenu) {
this.$refs.popMenu.close();
// this.$store.dispatch('map/setTrainWindowShow', false);
}
},
//
setStoppage() {
const step = {
start: true,
operation: OperationEvent.Train.stoppage.menu.operation,
cmdType: CMD.Train.CMD_STOPPAGE,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
@ -194,14 +194,13 @@ export default {
cancelStoppage() {
const step = {
start: true,
operation: OperationEvent.Train.cancelStoppage.menu.operation,
cmdType: CMD.Train.CMD_CANCEL_STOPPAGE,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
@ -215,14 +214,13 @@ export default {
limitSpeed() {
const step = {
start: true,
operation: OperationEvent.Train.limitSpeed.menu.operation,
cmdType: CMD.Train.CMD_LIMIT_SPEED,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
} else {
@ -236,13 +234,12 @@ export default {
addTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.addTrainId.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(step, this.selected);
@ -253,13 +250,12 @@ export default {
delTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.delTrainId.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDelete.doShow(step, this.selected);
@ -270,13 +266,12 @@ export default {
editTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.editTrainId.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainControl.doShow(step, this.selected);
@ -287,13 +282,12 @@ export default {
editTrainNo() {
const step = {
start: true,
operation: OperationEvent.Train.editTrainNo.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainEditNumber.doShow(step, this.selected);
@ -304,36 +298,57 @@ export default {
moveTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.moveTrainId.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainMove.doShow(step, this.selected);
}
});
},
undeveloped() {},
undeveloped() {
this.doClose();
this.$alert('实现中......', '提示', {
confirmButtonText: '确定',
callback: action => {
}
});
},
//
switchTrainId() {
const step = {
start: true,
operation: OperationEvent.Train.switchTrainId.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/next', step).then(({ valid }) => {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainSwitch.doShow(step, this.selected);
}
});
},
checkTrainDetails() {
const step = {
start: true,
code: this.selected.code,
operation: OperationEvent.Train.trainDetailInfo.menu.operation,
param: {
code: this.selected.code
}
};
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainDetail.doShow(step, this.selected);
}
});
}
}
};

View File

@ -60,7 +60,7 @@ export const menuOperate = {
cancelTrainRoute:{
// 取消进路
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
cmdType: CMD.Signal.CMD_SIGNAL_FORCE_CANCEL_ROUTE
},
lock:{
// 信号封锁
@ -268,15 +268,19 @@ export const menuOperate = {
editTrainId: {
operation: OperationEvent.Train.editTrainId.menu.operation,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
addTrainId: {
operation: OperationEvent.Train.addTrainId.menu.operation,
cmdType: ''
}
},
Common: {
setFault: {
operation: OperationEvent.Section.stoppage.menu.operation,
operation: OperationEvent.MixinCommand.stoppage.menu.operation,
cmdType: CMD.Fault.CMD_SET_FAULT
},
cancelFault: {
operation: OperationEvent.Section.cancelStoppage.menu.operation,
operation: OperationEvent.MixinCommand.cancelStoppage.menu.operation,
cmdType: CMD.Fault.CMD_CANCEL_FAULT
}
}

View File

@ -220,7 +220,7 @@ export default {
serie.markPoint.data.push(createMartPoint({
directionCode: elem.directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`,
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`,
color: lineStyle.color || '#000'
}));
}

View File

@ -1,212 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="xian-02__system stand-stop-time"
:title="title"
:visible.sync="show"
width="340px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" size="small" label-width="80px" :model="addModel" :rules="rules">
<div style="width: 96%;">
<el-form-item label="车 次 号:" label-width="95px" prop="tripNumber">
<el-select v-model="addModel.tripNumber" filterable @change="tripNumberChange">
<el-option
v-for="tripNum in tripNumberList"
:key="tripNum"
:label="tripNum"
:value="tripNum"
/>
</el-select>
</el-form-item>
<el-form-item label="服 务 号:" label-width="95px" prop="serviceNumber">
<el-select v-model="addModel.serviceNumber" filterable>
<el-option
v-for="serviceNumber in serviceNumberList"
:key="serviceNumber"
:label="serviceNumber"
:value="serviceNumber"
/>
</el-select>
</el-form-item>
</div>
</el-form>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { getTripNumberList, getServiceNumbersByTripNum } from '@/api/simulation';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
export default {
// name: 'TrainMove',
name: 'TrainAddPlan',
components: {
},
data() {
return {
trainNoList: [],
selected: null,
tripNumberList: [],
serviceNumberList: [],
addModel: {
serviceNumber: '', //
tripNumber: '' //
},
rules: {
serviceNumber: [
{ required: true, message: '请输入服务号', trigger: 'blur' }
],
tripNumber: [
{ required: true, message: '请输入车次号', trigger: 'change' }
]
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'trainList',
'stationStandList',
'trainWindowSectionCode'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.createPlanTrain.menu.domId : '';
},
title() {
return '创建计划车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
tripNumberChange(tripNumber) {
getServiceNumbersByTripNum(this.$route.query.group, tripNumber).then(resp => {
this.serviceNumberList = [];
if (typeof resp.data == 'string') {
this.serviceNumberList.push(resp.data);
} else {
resp.data.forEach(item => {
if (!this.serviceNumberList.includes(item)) {
this.serviceNumberList.push(item);
}
});
}
if (this.serviceNumberList.length === 1) {
this.addModel.serviceNumber = this.serviceNumberList[0];
}
});
},
doShow(operate, selected) {
this.selected = selected;
//
// if (!this.dialogShow) {
// }
this.addModel = {
tripNumber:'',
serviceNumber:''
};
getTripNumberList(this.$route.query.group).then(resp => {
this.tripNumberList = [];
resp.data.forEach(item => {
if (!this.tripNumberList.includes(item)) {
this.tripNumberList.push(item);
}
});
}).catch(error => {
console.log(error);
// this.$messageBox(error.message);
});
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
// this.mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
over: true,
operation: OperationEvent.Train.createPlanTrain.menu.operation,
cmdType: CMD.Section.CMD_Train_Init_Plan,
param: {
serviceNumber: this.addModel.serviceNumber, //
tripNumber: this.addModel.tripNumber //
}
};
this.loading = true;
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
});
} else {
return false;
}
});
},
cancel() {
const operate = {
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store
.dispatch('training/nextNew', operate)
.then(({ valid }) => {
if (valid) {
this.doClose();
}
})
.catch(() => {
this.doClose();
});
}
}
};
</script>
<style scoped>
.xian-02__system .el-dialog .base-label {
background: rgba(0, 0, 0, x);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
}
</style>

View File

@ -0,0 +1,190 @@
<template>
<el-dialog
v-dialogDrag
class="xian-02__system train-move"
:title="title"
:visible.sync="show"
width="760px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-row>
<el-col :span="12">车体号:</el-col>
<el-col :span="12">追踪号:</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-input :id="domIdInput" v-model="addModel.groupNumber" style="width: 100px;" @change="inputGroupNumber" />
</el-col>
<el-col :span="12">
<el-input :id="domIdInput" v-model="addModel.groupNumber" style="width: 100px;" @change="inputGroupNumber" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">实际的DID</el-col>
<el-col :span="12">
<el-input :id="domIdInput" v-model="addModel.groupNumber" @change="inputGroupNumber" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">被请求的DID</el-col>
<el-col :span="12">
<el-input :id="domIdInput" v-model="addModel.groupNumber" @change="inputGroupNumber" />
</el-col>
</el-row>
<el-row>
<el-col :span="12">DID浏览选项</el-col>
<el-col :span="12">
<el-input :id="domIdInput" v-model="addModel.groupNumber" @change="inputGroupNumber" />
</el-col>
</el-row>
<el-row justify="center" class="button-group">
<el-col :span="10">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
</el-col>
<el-col :span="8" :offset="5">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'TrainMove',
components: {
NoticeInfo
},
data() {
return {
trainNoList: [],
selected: null,
addModel: {
stationName: '',
trainWindowCode: '',
groupNumber: ''
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdInput() {
return this.dialogShow ? OperationEvent.Train.addTrainId.input.domId : '';
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.addTrainId.menu.domId : '';
},
title() {
return '移动车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
const section = this.$store.getters['map/getDeviceByCode'](selected.sectionCode);
if (section) {
const station = this.$store.getters['map/getDeviceByCode'](section.stationCode);
if (station) {
this.addModel.stationName = station.name;
}
}
this.addModel.trainWindowCode = selected.code;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
this.$store.dispatch('map/setTrainWindowShow', false);
this.mouseCancelState(this.selected);
},
inputGroupNumber() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.input.operation,
val: this.addModel.groupNumber
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
},
commit() {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.addTrainId.menu.operation,
val: this.addModel.groupNumber
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
const operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-row {
margin: 10px
}
.xian-02__system .el-dialog .base-label {
background: rgba(0, 0, 0, 0.3);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
}
</style>

View File

@ -6,8 +6,6 @@
<speed-limit-control ref="speedLimitControl" />
<alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" />
<train-add-plan ref="trainAddPlan" />
<set-fault ref="setFault" />
</div>
</template>
@ -24,8 +22,6 @@ import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
// import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from './utils/menuOperate';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
import TrainAddPlan from './dialog/trainAddPlan';
export default {
name: 'SectionMenu',
@ -36,8 +32,6 @@ export default {
SpeedLimitControl,
AlxeEffective,
NoticeInfo,
SetFault,
TrainAddPlan
},
props: {
selected: {
@ -205,7 +199,8 @@ export default {
this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.trainAddPlan.doShow(step, this.selected);
// this.$refs.trainAddPlan.doShow(step, this.selected);
this.$store.dispatch('training/setCommonMenuStep', step);
}
});
},
@ -213,7 +208,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -221,7 +216,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -9,7 +9,6 @@
<route-detail ref="routeDetail" />
<router-command ref="routerCommand" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div>
</template>
@ -29,7 +28,6 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
export default {
name: 'SignalMenu',
@ -42,8 +40,7 @@ export default {
RouteHandControl,
RouteDetail,
RouterCommand,
NoticeInfo,
SetFault
NoticeInfo
},
props: {
selected: {
@ -268,7 +265,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -276,7 +273,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -6,7 +6,6 @@
<speed-limit-control ref="speedLimitControl" />
<alxe-effective ref="alxeEffective" />
<notice-info ref="noticeInfo" />
<set-fault ref="setFault" />
</div>
</template>
@ -24,7 +23,6 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import {menuOperate, commitOperate} from './utils/menuOperate';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
export default {
name: 'SwitchMenu',
@ -34,8 +32,7 @@ export default {
SwitchUnLock,
SpeedLimitControl,
AlxeEffective,
NoticeInfo,
SetFault
NoticeInfo
},
props: {
selected: {
@ -245,7 +242,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -253,7 +250,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -1,18 +1,15 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" :tip-msg="topTip" :tip-subhead="tipSubhead" />
<pop-menu ref="popMenu" :menu="menu" :tip-msg="topTip" :tip-subhead="tipSubhead" pop-class="xian-02__pop_tip_station" />
<notice-info ref="noticeInfo" />
<train-delete ref="trainDelete" />
<train-define ref="trainDefine" />
<train-move ref="trainMove" />
<!-- <train-edit ref="trainEdit" /> -->
<train-set-plan ref="trainSetPlan" />
<train-add-plan ref="trainAddPlan" />
<!-- <train-move-evently ref="trainMoveEvently" /> -->
<!-- <train-delete-plan ref="trainDeletePlan" /> -->
<train-set-head ref="trainSetHead" />
<train-set-work ref="trainSetWork" />
<trainSetWorkATP ref="trainSetWorkATP" />
<train-destination ref="trainDestination" />
</div>
</template>
@ -24,10 +21,10 @@ import TrainDelete from './dialog/trainDelete';
import TrainDefine from './dialog/trainDefine';
import TrainMove from './dialog/trainMove';
import TrainSetPlan from './dialog/trainSetPlan';
import TrainAddPlan from './dialog/trainAddPlan';
import TrainSetHead from './dialog/trainSetHead';
import TrainSetWork from './dialog/trainSetWork';
import trainSetWorkATP from './dialog/trainSetWorkATP';
import TrainDestination from './dialog/trainDestination';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
@ -44,10 +41,10 @@ export default {
TrainDefine,
TrainMove,
TrainSetPlan,
TrainAddPlan,
TrainSetHead,
TrainSetWork,
trainSetWorkATP
trainSetWorkATP,
TrainDestination
},
props: {
selected: {
@ -64,75 +61,6 @@ export default {
menu: [],
menuNormal: {
Local: [
// {
// label: '',
// handler: this.addTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.delTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.moveTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.addPlanTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.setPlanTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.setHeadTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.setWorkTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: 'ATP',
// handler: this.setTrainATPdel,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: 'ATP',
// handler: this.setTrainATPRec,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// }
],
Center: [
{
@ -140,41 +68,51 @@ export default {
children: [
{
label: '目的地ID',
handler: this.atsAutoControlALL
// handler: this.updateDestination,
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '删除ID',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '更改追踪号',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '交换追踪号',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '运行等级',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '列车模式',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '惰性模式',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '旁路模式',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
]
},
{
label: '列车明细',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '请求',
@ -184,37 +122,45 @@ export default {
children:[
{
label: '扣车',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '发车 ',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
]
},
{
label: '停车/放行',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '就绪状态',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '测试',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '救援列车',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '开车门',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '关车门',
handler: this.atsAutoControlALL
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
]
},
@ -223,19 +169,23 @@ export default {
children: [
{
label: '创建设备标签',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '查看设备标签',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '更改设备标签',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '删除设备标签',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
]
},
@ -244,87 +194,21 @@ export default {
children: [
{
label: '完整性报警确认',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
]
},
{
label: '更新列车计划',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
},
{
label: '帮助',
handler: this.undeveloped
handler: this.undeveloped,
cmdType: CMD.TrainWindow.CMD_TRAIN_UPDATE_TYPE
}
// {
// label: '',
// handler: this.addTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.delTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.moveTrainId,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.addPlanTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.setPlanTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.setHeadTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.setWorkTrain,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: 'ATP',
// handler: this.setTrainATPdel,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: 'ATP',
// handler: this.setTrainATPRec,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// type: 'separator'
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// },
// {
// label: '',
// handler: this.undeveloped,
// cmdType: CMD.TrainWindow.CMD_Train_Init_Plan
// }
]
},
menuForce: [
@ -375,14 +259,16 @@ export default {
},
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
if (this.$store.state.training.prdType === '02') {
this.menu = this.menuNormal.Center;
}
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
doShow(point) {
this.topTip = `道岔: ${this.selected.name}`;
this.topTip = `车辆: ${this.selected.serviceNumber}`;
this.clickEvent();
this.initMenu();
@ -604,6 +490,23 @@ export default {
this.$refs.trainSetWorkATP.doShow(operate, this.selected);
}
});
},
updateDestination() {
const operate = {
start: true,
code: this.selected.code,
operation: OperationEvent.Train.destinationTrainId.menu.operation,
param: {
trainCode: this.selected.code
}
};
this.$store.dispatch('training/nextNew', operate).then(({ valid }) =>{
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', {break: true});
this.$refs.trainDestination.doShow(operate, this.selected);
this.doClose();
}
});
}
}
};

View File

@ -5,7 +5,6 @@
<update-stand-plan ref="updateStandPlan" :selected="selected" />
<warning-confirm ref="warningConfirm" :selected="selected" />
<stop-profile ref="stopProfile" :selected="selected" />
<set-fault ref="setFault" />
</div>
</template>
@ -19,7 +18,6 @@ import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import SetFault from '@/views/newMap/mapsystemNew/plugin/setFault';
import {menuOperate, commitOperate} from './utils/menuOperate';
export default {
@ -29,8 +27,7 @@ export default {
NoticeInfo,
UpdateStandPlan,
WarningConfirm,
StopProfile,
SetFault
StopProfile
},
props: {
selected: {
@ -282,7 +279,7 @@ export default {
setStoppage() {
commitOperate(menuOperate.Common.setFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.setFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.setFault);
}
});
},
@ -290,7 +287,7 @@ export default {
cancelStoppage() {
commitOperate(menuOperate.Common.cancelFault, { code: this.selected.code }, 0).then(({valid, operate})=>{
if (valid) {
this.$refs.setFault.doShow(menuOperate.Common.cancelFault, this.selected);
this.$store.dispatch('training/setCommonMenuStep', menuOperate.Common.cancelFault);
}
});
},

View File

@ -260,11 +260,11 @@ export const menuOperate = {
},
Common: {
setFault: {
operation: OperationEvent.Section.stoppage.menu.operation,
operation: OperationEvent.MixinCommand.stoppage.menu.operation,
cmdType: CMD.Fault.CMD_SET_FAULT
},
cancelFault: {
operation: OperationEvent.Section.cancelStoppage.menu.operation,
operation: OperationEvent.MixinCommand.cancelStoppage.menu.operation,
cmdType: CMD.Fault.CMD_CANCEL_FAULT
}
}

View File

@ -4,6 +4,7 @@ import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss'; // global css
import 'quill/dist/quill.snow.css';
import LangStorage from '@/utils/lang';
import App from './App';

View File

@ -19,7 +19,7 @@ function hasPermission(roles, permissionRoles) {
const whiteList = ['/login', '/design/login', '/gzzbxy/relay']; // 不重定向白名单
const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/iscs/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/, /^\/displayNew\/record/, /^\/displayNew\/manage/, /^\/displayNew\/plan/];
const designPageRegex = [/^\/design/, /^\/scriptDisplay/, /^\/publish/, /^\/orderauthor/, /^\/system/, /^\/iscs/, /^\/display\/record/, /^\/display\/manage/, /^\/apply/, /^\/plan/, /^\/display\/plan/, /^\/displayNew\/record/, /^\/displayNew\/manage/, /^\/displayNew\/plan/, /^\/practiceDisplayNew/];
function isDesignPage(toRoutePath) {
return designPageRegex.some(item => item.test(toRoutePath) );
@ -47,6 +47,10 @@ function getRouteInfo(to) {
} else {
const whitePage = PermissionParam[current_session] ? PermissionParam[current_session].whitePage : '';
loginPath = whitePage || loginPage;
if (current_session && current_session.startsWith('jsxt') || current_session && current_session.startsWith('refereeJsxt')) {
const raceId = getSessionStorage('raceId'); // 登陆时候保存 竞赛id
loginPath = `${loginPath}?raceId=${raceId}`;
}
if (current_session && current_session.startsWith('design')) {
removeToken();
}

View File

@ -64,6 +64,7 @@ const LessonDetail = () => import('@/views/lesson/details');
const ScriptmanageHome = () => import('@/views/scriptManage/home');
const ScriptDisplay = () => import('@/views/scriptManage/display/index');
const ScriptDisplayNew = () => import('@/views/scriptManage/display/indexNew');
const PracticeDisplayNew = () => import('@/views/competitionManage/practiceList/display/index');
const IbpHome = () => import('@/views/ibp/home');
const IbpDraw = () => import('@/views/ibp/ibpDraw/index');
@ -122,7 +123,12 @@ const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const DeviceManage = () => import('@/views/system/deviceManage/index');
const MapSort = () => import('@/views/publish/publishMap/mapSort');
const StudentManage = () => import('@/views/studentManage');
const RaceManage = () => import('@/views/competitionManage/index');
const RaceManage = () => import('@/views/competitionManage/competition/index');
const BankManage = () => import('@/views/competitionManage/bankList/index');
const PracticeManage = () => import('@/views/competitionManage/practiceList/index');
const QuestionCreatePage = () => import('@/views/competitionManage/bankList/question-create-page');
const QuestionUpdatePage = () => import('@/views/competitionManage/bankList/question-update-page');
const GeneratePaper = () => import('@/views/competitionManage/generatePaper');
const CompetitionDetail = () => import('@/views/jsxt/competition/examDetail');
const CompetitionManage = () => import('@/views/jsxt/competition/index');
@ -277,6 +283,11 @@ export const publicAsyncRoute = [
component: ScriptDisplayNew,
hidden: true
},
{ // 实操试题编辑 战场图
path: '/practiceDisplayNew/:mode',
component: PracticeDisplayNew,
hidden: true
},
{
path: '/displayBigScreen/:mapId',
component: BigScreen,
@ -914,11 +925,10 @@ export const asyncRouter = [
]
},
{
path: '/design/race',
redirect: '/design/race/manage',
path: '/design/race', // 竞赛管理
component: Layout,
meta: {
i18n: 'route.raceManage',
i18n: 'router.raceManage',
roles: [admin]
},
children: [
@ -929,6 +939,37 @@ export const asyncRouter = [
i18n: 'router.raceManage',
icon: 'design'
}
},
{
path: 'bank',
component: BankManage,
meta: {
i18n: 'router.bankManage',
icon: 'design'
}
},
{
path: 'practice',
component: PracticeManage,
meta: {
i18n: 'router.practiceManage',
icon: 'design'
}
},
{
path: 'questionCreate',
component: QuestionCreatePage,
hidden: true
},
{
path: 'questionUpdate/:questionId',
component: QuestionUpdatePage,
hidden: true
},
{
path: 'generate',
component: GeneratePaper,
hidden: true
}
]
}

View File

@ -147,6 +147,10 @@ export default {
{ label: '控制模式', value: 'ControlConvertMenu' },
{ label: '车次窗', value: 'TrainWindow' }
],
QuestionTypeList: [
{ label: '选择题', value: 'select' },
{ label: '判断题', value: 'judge' }
],
// 新版的产品类型枚举
prdType:[
{ enlabel: 'ATS local workstation', label: 'ATS现地工作站', value: '01'},

View File

@ -2211,12 +2211,18 @@ export const IbpShowCondition = {
Show_Open_Screen_Door: {statusKey: 'screenDoorOpenStatus', statusValue:['02'], defaultStatus: 'close'},
Show_Close_Screen_Door: {statusKey: 'screenDoorOpenStatus', statusValue: ['01'], defaultStatus: 'open'}
};
/** 列车类型 */
export const TrainType = {
PLAN: '计划车',
HEAD: '头码车',
MANUAL: '人工车'
};
export const UrlConfig = {
display: '/display',
displayNew: '/displayNew',
scriptDisplay: '/scriptDisplay',
scriptDisplayNew:'/scriptDisplayNew',
practiceDisplayNew:'/practiceDisplayNew',
examRuleDraft: '/examRule/draft',
examRuleManage: '/examRule/manage',
lesson: {
@ -2307,5 +2313,9 @@ export const UrlConfig = {
draft: '/trainingPlatform/draft',
pay: '/trainingPlatform/pay',
runPlan: '/trainingPlatform/runPlan/manage'
},
bank: {
questionCreate: '/design/race/questionCreate',
questionUpdate: '/design/race/questionUpdate'
}
};

View File

@ -5,11 +5,13 @@ import TurnbackBar from '@/components/TurnbackBar';
import ConstConfig from '@/scripts/ConstConfig';
import Dictionary from '@/scripts/DictionaryData';
import Theme from '@/jmapNew/theme/factory';
import QuillEditor from '@/components/QuillEditor/index';
// 全局组件
Vue.component('DataForm', DataForm);
Vue.component('QueryListPage', QueryListPage);
Vue.component('TurnbackBar', TurnbackBar);
Vue.component('QuillEditor', QuillEditor);
Vue.prototype.$ConstSelect = (function() {
ConstConfig.ConstSelect.translate = function(value, codeName) {
@ -116,7 +118,7 @@ Vue.prototype.$copyClone = function(obj1, obj2 = {}) {
};
Vue.prototype.$escapeHTML = function (context) {
const pattern = /<\w*>(.*)<\/\w*>/;
const pattern = /<\p>(.*)<\/\p>/;
if (pattern.test(context)) {
context = pattern.exec(context)[1];

View File

@ -78,6 +78,8 @@ export default {
CMD_SIGNAL_SET_ROUTE: {value:'Signal_Set_Route', label: '排列进路'},
/** 取消进路 */
CMD_SIGNAL_CANCEL_ROUTE: {value:'Signal_Cancel_Route', label: '取消进路'},
/** 强制取消进路 */
CMD_SIGNAL_FORCE_CANCEL_ROUTE: {value: 'Signal_Force_Cancel_Route', label: '强制取消进路'},
/** 人解进路 */
CMD_SIGNAL_HUMAN_RELEASE_ROUTE: {value:'Signal_Human_Release_Route', label: '人解进路'},
/** 信号关灯 */

View File

@ -2079,6 +2079,18 @@ export const OperationEvent = {
operation: '2994',
domId: '_Tips-TotalCancel-Button{TOP}'
}
},
// 取消故障
cancelStoppage: {
menu: {
operation: '2995'
}
},
// 道岔故障
stoppage: {
menu: {
operation: '2996'
}
}
}

View File

@ -181,6 +181,7 @@ const map = {
state: {
routeData: {}, // 进路数据
routeList: [], // 进路list
routeStartSignalData: {}, // 进路始端信号机数据
autoReentryData: {}, // 自动折返数据
autoReentryList: [], // 自动折返list
signalApproachSectionData: {}, // 信号机接近区段数据
@ -232,6 +233,13 @@ const map = {
routeData: (state) => {
return state.routeData;
},
routeStartSignalData: (state) => {
if (state.map) {
return state.map.routeStartSignalData || {};
} else {
return {};
}
},
overlapData: (state) => {
return state.overlapData;
},
@ -719,6 +727,11 @@ const map = {
setRouteData: (state, routeDataList) => {
routeDataList.forEach(data => {
state.routeData[data.code] = data;
if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) {
state.routeStartSignalData[data.startSignalCode].push(data);
} else {
state.routeStartSignalData[data.startSignalCode] = [data];
}
});
state.map.automaticRouteButtonList && state.map.automaticRouteButtonList.forEach(item => {
state.routeData[item.automaticRouteCode].automaticRouteCode = item.code;

View File

@ -163,7 +163,7 @@ function handleSimulationInfo(state, data) {
targetOnline:data.targetMember ? data.targetMember.online : null,
targetName:data.targetMember ? data.targetMember : 'All',
targetRole:data.targetMember ? data.targetMember.role : null,
group: data.group,
all: data.all,
date: +new Date(`${myDate1} ${chatTime}`)
};
state.simulationText = params;

View File

@ -35,7 +35,9 @@ const training = {
prdType: '', // 产品类型
roles: '', // 角色权限类型
group: '', // 设置全局 group
centerStationCode:'' // 当前居中的集中站code
centerStationCode:'', // 当前居中的集中站code
commonMenuCount: 0, // 公共菜单计数
commonMenuStep: null // 公共菜单步骤
},
getters: {
@ -92,6 +94,12 @@ const training = {
});
return trainList;
},
commonMenuCount: (state) => {
return state.commonMenuCount;
},
commonMenuStep: (state) => {
return state.commonMenuStep;
}
},
@ -209,6 +217,10 @@ const training = {
},
setCenterStationCode:(state, centerStationCode) => {
state.centerStationCode = centerStationCode;
},
setCommonMenuStep: (state, commonMenuStep) => {
state.commonMenuStep = commonMenuStep;
state.commonMenuCount++;
}
},
@ -611,6 +623,11 @@ const training = {
/** 设置当前居中的集中站code */
setCenterStationCode:({ commit }, centerStationCode) => {
commit('setCenterStationCode', centerStationCode);
},
/** 公共菜单操作 */
setCommonMenuStep:({ commit }, commonMenuStep) => {
commit('setCommonMenuStep', commonMenuStep);
}
}
};

View File

@ -7,10 +7,9 @@ export function getBaseUrl() {
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -0,0 +1,78 @@
<template>
<el-dialog v-dialogDrag :close-on-click-moda="false" :title="title" :visible.sync="show" width="860px" :close-on-click-modal="false" :before-close="doClose">
<div class="ql-editor" v-html="$escapeHTML(` : ${form.topic}`)" />
<template v-if="checkType(form, 'judge')">
<div class="answer">
:
<template v-for="(el,i) in options">
<span v-if="el.correct" :key="i">{{ el.content }} </span>
</template>
</div>
</template>
<template v-else-if="checkType(form, 'select')">
<div v-for="(el,i) in options" :key="i" class="option" :label="$str2number(el.id)">
<span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
</div>
<div class="answer">
:
<template v-for="(el,i) in options">
<span v-if="el.correct" :key="i">{{ $asc2chart(i+65) }} </span>
</template>
</div>
</template>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">关闭</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
show: false,
form: {
optionList: []
}
};
},
computed: {
title() {
return '详 情';
},
options() {
return this.form.optionList;
}
},
methods: {
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index) {
return `${index + 1}. ${str}`;
},
doShow(node) {
this.form = node.row || {};
this.show = true;
},
doClose(done) {
this.show = false;
}
}
};
</script>
<style lang="scss" scoped>
.option {
line-height: 22px;
padding-left: 20px;
}
.answer {
line-height: 32px;
color: #000;
padding-left: 15px;
}
</style>

View File

@ -0,0 +1,46 @@
<template>
<el-dialog v-dialogDrag :close-on-click-moda="false" :title="title" :visible.sync="show" width="40%" :close-on-click-modal="false" :before-close="doClose">
<quill-editor v-model="content" placeholder="请输入内容" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doInput"> </el-button>
<el-button @click="show = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
show: false,
content: '',
node: {
model: {},
prop: ''
}
};
},
computed: {
title() {
return '富文本输入';
}
},
methods: {
doShow(node) {
this.node = node;
this.content = (node.model || {})[node.prop] || '';
this.show = true;
},
doClose(done) {
this.show = false;
},
doInput() {
const node = this.node;
node.model[node.prop] = this.content;
this.$emit('update', node.model);
this.doClose();
}
}
};
</script>

View File

@ -0,0 +1,158 @@
<template>
<div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<dialog-detail ref="detail" />
</div>
</template>
<script>
import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage, deleteQuestion } from '@/api/questionBank.js';
import DialogDetail from './dialog-detail';
export default {
components: {
DialogDetail
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
queryObject: {
type: {
type: 'select',
label: '类 型',
config: {
data: this.$ConstSelect.QuestionTypeList
}
},
topic: {
type: 'text',
label: '题 目'
}
}
},
queryList: {
query: listQuestionPage,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '题 目',
prop: 'topic'
},
{
title: '类 型',
prop: 'type',
type: 'tag',
width: '120',
columnValue: (row) => { return this.$ConstSelect.translate(row.type, 'QuestionTypeList'); },
tagType: (row) => {
return '';
}
},
{
title: '答 案',
prop: 'answer',
type: 'tagMore',
width: '100',
columnValue: (row) => { return this.answerTags(row); },
tagType: (row) => {
return '';
}
},
// {
// title: '',
// prop: 'createUserName',
// width: '100'
// },
{
type: 'button',
title: '操 作',
width: '420',
buttons: [
{
name: '编辑',
handleClick: this.edit
},
{
name: '删 除',
handleClick: this.doDelete,
// showControl: (row) => { return row.createUserId == this.userId; },
type: 'danger'
},
{
name: '预 览',
handleClick: this.doDetail
}
]
}
],
actions: [
{ text: '添 加', handler: this.doCreate }
]
}
};
},
computed: {
userId() {
return this.$store.state.user.id;
}
},
methods: {
doCreate() {
this.$router.push({path: `${UrlConfig.bank.questionCreate}`});
},
edit(index, row) {
this.$router.push({path: `${UrlConfig.bank.questionUpdate}/${row.id}`});
},
doDelete(index, row) {
this.$confirm('删除试题,是否继续?', '提 示', {
confirmButtonText: '确 定',
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
deleteQuestion(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除试题失败: ${error.message}`);
});
}).catch( () => { });
},
doDetail(index, row) {
this.$refs.detail.doShow({index, row});
},
answerTags(row) {
const answer = [];
row.optionList.forEach((el, i) => {
switch (row.type) {
case 'select':
if (el.correct) {
answer.push(this.$asc2chart(i + 65));
}
break;
case 'judge':
if (el.correct) {
answer.push(el.content);
}
break;
}
});
return answer;
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -0,0 +1,55 @@
<template>
<div>
<template v-if="type=='select'">
<el-radio-group v-model="active" @change="onChange">
<el-radio v-for="(el,i) in optionList" :key="i" :label="i"> 选项-{{ $asc2chart(65+i) }} </el-radio>
</el-radio-group>
</template>
<template v-if="type=='judge'">
<el-radio-group v-model="active" @change="onChange">
<el-radio :label="0"> </el-radio>
<el-radio :label="1"> × </el-radio>
</el-radio-group>
</template>
</div>
</template>
<script>
export default {
props: {
value: {
type: Number,
default: 0
},
optionList: {
type: Array,
required: true
},
type: {
type: String,
required: true
}
},
data() {
return {
active: 0
};
},
watch: {
value(val) {
this.active = val;
}
},
methods: {
onChange(e) {
this.$emit('input', e);
this.$emit('change', e);
}
}
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,62 @@
<template>
<div class="option">
<template v-if="type=='select'">
<div v-for="(el,i) in optionList" :key="i" class="option__item">
<div> 选项-{{ $asc2chart(65+i) }} </div>
<item-rich v-model="el.content" :remove="remove" @modify="doModify(el)" @remove="doRemove(i)" />
</div>
<el-button v-if="add" class="item__button" type="primary" size="mini" icon="el-icon-plus" @click="doAppend" />
</template>
</div>
</template>
<script>
import ItemRich from './item-rich';
export default {
components: {
ItemRich
},
props: {
optionList: {
type: Array,
required: true
},
type: {
type: String,
required: true
},
add: {
type: Boolean,
default: false
},
remove: {
type: Boolean,
default: false
}
},
data() {
return {
};
},
methods: {
doModify(el) {
this.$emit('modify', {model: el, prop: 'content'});
},
doRemove(index) {
this.$emit('remove', index);
},
doAppend() {
this.$emit('append');
}
}
};
</script>
<style lang="scss" scoped>
.option {
&__item {
margin-bottom: 10px;
}
}
</style>

View File

@ -0,0 +1,55 @@
<template>
<div class="item no-select" :style="{height: height+'px'}">
<div class="ql-editor item__text" @click="doModify" v-html="$escapeHTML(`${value}`)" />
<el-button class="item__button" type="primary" size="mini" icon="el-icon-edit" circle @click="doModify" />
<el-button v-if="remove" class="item__button" type="danger" size="mini" icon="el-icon-delete" circle @click="doRemove" />
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
default: ''
},
height: {
type: Number,
default: 60
},
remove: {
type: Boolean,
default: false
}
},
methods: {
doModify() {
this.$emit('modify', this.value);
},
doRemove() {
this.$emit('remove', this.value);
}
}
};
</script>
<style lang="scss" scoped>
.item {
display: flex;
justify-content: space-between;
align-items: center;
&__text {
flex: 1;
background: #f1f1f1;
}
&__button {
width: 32px;
margin-left: 10px;
place-self: flex-end;
}
}
</style>

View File

@ -0,0 +1,110 @@
<template>
<div class="page">
<div class="page__container">
<el-card class="page__container-body">
<question-form ref="info" :option="formModel" :remove="true" @modify="doModify" />
</el-card>
<div class="page__container-footer">
<el-button type="primary" :is-create="true" @click="create"> </el-button>
<el-button @click="back"> </el-button>
</div>
</div>
<dialog-modify-rich ref="rich" />
</div>
</template>
<script>
import QuestionForm from './question-form.vue';
import DialogModifyRich from './dialog-modify-rich';
import { createQuestion } from '@/api/questionBank.js';
import * as authUtils from '@/utils/auth.js';
export default {
components: {
QuestionForm,
DialogModifyRich
},
data() {
return {
active: 0,
formModel: {
id: '',
topic: '',
type: 'select',
answer: 0,
optionList: []
}
};
},
computed: {
deviceId() {
return this.$route.params.deviceId;
},
path() {
return this.$route.path;
}
},
created() {
const value = authUtils.getSessionStorage(this.path);
if (value) {
const model = JSON.parse(value);
this.formModel.type = model.type;
}
},
methods: {
doBack() {
this.$router.go(-1);
},
doModify(node) {
this.$refs.rich.doShow(node);
},
create() {
this.$refs.info.validate().then(valid => {
if (valid) {
createQuestion(this.formModel).then(resp => {
authUtils.setSessionStorage(this.path, JSON.stringify({
type: this.formModel.type
}));
this.doBack();
}).catch(error => {
this.$message.error(`创建试题失败: ${error.message}`);
});
}
}).catch(error => { this.$message.warning(error.message); });
},
back() {
this.$router.go(-1);
}
}
};
</script>
<style lang="scss" scoped>
.page {
width: 100%;
&__container {
width: 55%;
margin: auto;
padding:20px 0px;
&-header {
margin-bottom: 10px;
.step-group {
margin: 10px 0;
.box {
display: flex;
justify-content: flex-end;
}
}
}
&-body {
padding: 40px;
}
&-footer {
margin-top: 20px;
display: flex;
justify-content: center;
}
}
}
</style>

View File

@ -0,0 +1,129 @@
<template>
<div>
<el-form ref="form" :model="option" :rules="rules" label-width="80px">
<el-form-item label="类 型" prop="type">
<el-select v-model="option.type" :disabled="update" placeholder="请选择试题类型" @change="onTypeChnage">
<el-option v-for="it in QuestionTypeList" :key="it.value" :label="it.label" :value="it.value" />
</el-select>
</el-form-item>
<el-form-item label="问 题" prop="topic">
<item-rich v-model="option.topic" @modify="onModify({model: option, prop: 'topic'})" />
</el-form-item>
<template v-if="isCreate">
<el-form-item v-if="option.type != 'judge'" label="选 项" prop="optionList">
<item-options :option-list="optionList" :type="option.type" :add="isSelect" :remove="remove" @remove="onRemove" @modify="onModify" @append="onAppend" />
</el-form-item>
<el-form-item label="答 案" prop="answer">
<item-answer v-model="option.answer" :option-list="optionList" :type="option.type" @change="onAnswerChnage" />
</el-form-item>
</template>
</el-form>
</div>
</template>
<script>
import ItemRich from './item-rich';
import ItemOptions from './item-options';
import ItemAnswer from './item-answer';
export default {
components: {
ItemRich,
ItemOptions,
ItemAnswer
},
props: {
option: {
type: Object,
required: true
},
isCreate: {
type: Boolean,
default: true
},
remove: {
type: Boolean,
default: false
},
update: {
type: Boolean,
default: false
}
},
data() {
return {
};
},
computed: {
isSelect() {
return this.remove && this.option.type == 'select';
},
templateMap() {
return {
select: function() {
return [
{ content: '', correct: true },
{ content: '', correct: false },
{ content: '', correct: false },
{ content: '', correct: false }
];
},
judge: function() {
return [
{ content: '√', correct: true },
{ content: '×', correct: false }
];
}
};
},
optionList() {
return this.option.optionList;
},
QuestionTypeList() {
return this.$ConstSelect.QuestionTypeList;
},
rules() {
return {
topic: [
{ required: true, message: '请输入试题内容', trigger: 'blur' }
],
type: [
{ required: true, message: '请输入试题类型', trigger: 'change' }
],
answer: [
{ required: true, message: '请选择正确答案', trigger: 'change' }
]
};
}
},
mounted() {
this.onTypeChnage(this.option.type);
},
methods: {
validate() {
return new Promise((resolve, reject) => {
this.$refs['form'].validate((valid) => {
resolve(valid);
});
});
},
onTypeChnage(type) {
if (this.templateMap[type]) {
this.option.optionList = this.templateMap[type]();
}
},
onAnswerChnage(answer) {
this.option.optionList.forEach((el, i) => { el.correct = i == answer; });
},
onModify(node) {
this.$emit('modify', node);
},
onAppend() {
this.option.optionList.push({content: '', correct: false});
},
onRemove(index) {
this.option.optionList.splice(index, 1);
}
}
};
</script>

View File

@ -0,0 +1,109 @@
<template>
<div class="page">
<div class="page__container">
<el-card class="page__container-body">
<question-form ref="info" :option="formModel" :remove="true" :update="true" @modify="doModify" />
</el-card>
</div>
<div class="page__container-footer">
<el-button type="primary" :is-create="true" @click="update"> </el-button>
<el-button @click="back"> </el-button>
</div>
<dialog-modify-rich ref="rich" />
</div>
</template>
<script>
import QuestionForm from './question-form.vue';
import DialogModifyRich from './dialog-modify-rich';
import { getQuestionInfo, updateOption } from '@/api/questionBank.js';
export default {
components: {
QuestionForm,
DialogModifyRich
},
data() {
return {
formModel: {
id: '',
topic: '',
type: 'select',
answer: 0,
optionList: []
},
optionList: []
};
},
computed: {
questionId() {
return this.$route.params.questionId;
}
},
watch: {
'$router': function() {
this.loadInitData();
}
},
created() {
this.loadInitData();
},
methods: {
loadInitData() {
getQuestionInfo(this.questionId).then(resp => {
this.formModel = resp.data;
this.formModel.answer = this.formModel.optionList.findIndex(ele => ele.correct);
});
},
doBack() {
this.$router.go(-1);
},
doModify(node) {
this.$refs.rich.doShow(node);
},
update() {
this.$refs.info.validate().then(valid => {
if (valid) {
updateOption(this.formModel).then(resp => {
this.doBack();
}).catch(error => {
this.$message.error(`创建试题失败: ${error.message}`);
});
}
}).catch(error => { this.$message.warning(error.message); });
},
back() {
this.$router.go(-1);
}
}
};
</script>
<style lang="scss" scoped>
.page {
width: 100%;
&__container {
width: 55%;
margin: auto;
&-header {
margin-bottom: 10px;
.step-group {
margin: 10px 0;
.box {
display: flex;
justify-content: flex-end;
}
}
}
&-body {
padding: 40px;
}
&-footer {
margin-top: 20px;
display: flex;
justify-content: center;
}
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More