Merge branch 'test'

# Conflicts:
#	src/utils/baseUrl.js
This commit is contained in:
zyy 2019-10-22 16:32:29 +08:00
commit 3bc3e66085
254 changed files with 13797 additions and 6674 deletions

188
src/api/designPlatform.js Normal file
View File

@ -0,0 +1,188 @@
import request from '@/utils/request';
export function getDraftLesson(params, mapId) {
/** 根据mapId获取草稿课程 */
return request({
url: `/api/mapSystem/findDraftLessonBy/${mapId}`,
method: 'get',
params
});
}
/** 获取用户地图树 */
export function getUserMapTree(cityCode) {
return request({
url: `/api/mapSystem/findDraftMapByCityCode?cityCode=${cityCode}`,
method: 'get'
});
}
/** 运行图*/
export function getRpListByUserMapId(mapId) {
return request({
url: `/api/draftMap/runPlan/findByDraftMapId/${mapId}`,
method: 'get'
});
}
export function getMapList(cityCode) {
/** 根据cityCode获取地图列表 */
return request({
url: `/api/mapSystem/queryMapByCityCode/${cityCode}`,
method: 'get'
});
}
/** 获取用户自己的运行图详情*/
export function getRpDetailByUserMapId(planId) {
return request({
url: `/api/draftMap/runPlan/selectDiagramData/${planId}`,
method: 'get'
});
}
/** 获取用户自己创建的草稿地图详情*/
export function getUserMapDetailByMapId(mapId) {
return request({
url: `/api/mapBuild/findById/${mapId}`,
method: 'get'
});
}
/** 用户自己的运行图仿真测试*/
export function runUserPlanNotify({ planId }) {
return request({
url: `/api/draftMap/runPlan/simulationCheck/${planId}`,
method: 'get'
});
}
/** 管理员获取需审核的课程列表 */
export function reviewLessonList(params) {
return request({
url: `/api/review/query/lesson`,
method: 'get',
params
});
}
/** 管理员发布课程接口 */
export function adminPublishLesson(data, id) {
return request({
url: `/api/review/${id}/publishLesson`,
method: 'post',
data: data
});
}
/** 管理员驳回课程发布申请 */
export function rejectedLessonRelease(data, id) {
return request({
url: `/api/review/lesson/${id}`,
method: 'post',
data: data
});
}
/** 普通用户申请课程发布和撤销申请 */
export function releaseOrCancel(id, status) {
return request({
url: `/api/review/lesson/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}
/** 管理员获取需审核的剧本列表 ok */
export function reviewScriptList(params) {
return request({
url: `/api/review/query/script`,
method: 'get',
params
});
}
/** 管理员发布剧本 ok */
export function publishScript(id) {
return request({
url: `/api/review/${id}/publishScript`,
method: 'post'
});
}
/** 管理员剧本申请驳回 ok */
export function rejectScript(id, data) {
return request({
url: `/api/review/script/${id}`,
method: 'post',
data: data
});
}
/** 管理员获取需审核的运行图列表 */
export function reviewRunPlanList(params) {
return request({
url: `/api/review/query/runPlan`,
method: 'get',
params
});
}
/** 管理员发布运行图 */
export function publishRunPlan(planId, data) {
return request({
url: `/api/review/${planId}/publishRunPlan`,
method: 'post',
data: data
});
}
/** 普通用户申请或撤销运行图发布 */
export function releaseOrCancelRunPlan(planId, status) {
return request({
url: `/api/review/runPlan/releaseOrCancel/${planId}/${status}`,
method: 'get'
});
}
/** 管理员运行图申请驳回 */
export function rejectRunPlan(id, data) {
return request({
url: `/api/review/runPlan/${id}`,
method: 'post',
data: data
});
}
/** 用户申请发布剧本或者撤销剧本申请 */
export function releaseScript(id, status) {
return request({
url: `/api/review/script/releaseOrCancel/${id}/${status}`,
method: 'get'
});
}
/** 查看课程详情 */
export function reviewLessonDetail(id) {
return request({
url: `/api/review/previewLesson/${id}`,
method: 'get'
});
}
/** 管理员预览草稿运行图*/
export function previewRunPlan(planId) {
return request({
url: `/api/review/previewRunPlan/${planId}`,
method: 'get'
});
}
/** 加载剧本 */
export function loadDraftScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/scriptDraft/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 获取已发布的有地图的城市列表*/
export function publisMapCityList(data) {
return request({
url: `/api/map/city?dicCode=${data}`,
method: 'get'
});
}

View File

@ -8,11 +8,10 @@ export function getPublishLessonList() {
});
}
/** 获取发布列表树*/
export function getPublishLessonTree(params) {
export function getPublishLessonTree(id) {
return request({
url: '/api/lesson/tree',
method: 'get',
params: params || {}
url: `/api/lesson/${id}/tree`,
method: 'get'
});
}

View File

@ -1,11 +1,10 @@
import request from '@/utils/request';
/** 获取课程树*/
export function getLessonTree(params) {
export function getLessonTree(skinCode) {
return request({
url: '/api/lessonDraft/tree',
method: 'get',
params: params
url: `/api/lessonDraft/${skinCode}/tree`,
method: 'get'
});
}
@ -103,3 +102,11 @@ export function getLessonNameByMapIdAndLessonId(model) {
method: 'get'
});
}
export function getLessonDrftList(params) {
return request({
url: `/api/lessonDraft`,
method: 'get',
params: params
});
}

View File

@ -58,10 +58,11 @@ export function getPublishTrainList(skinCode) {
}
/** 获取发布地图列表*/
export function listPublishMap() {
export function listPublishMap(params) {
return request({
url: '/api/map/list',
method: 'get'
url: `/api/map/list`,
method: 'get',
params
});
}

View File

@ -264,3 +264,10 @@ export function putAutoSignal(data) {
});
}
export function getListByCityCode(cityCode) {
return request({
url: `/api/mapBuild/${cityCode}/list`,
method: 'get'
});
}

View File

@ -1,14 +1,5 @@
import request from '@/utils/request';
/** 获取考试列表树*/
export function getCourseLessonTree(params) {
return request({
url: '/api/exam/tree',
method: 'get',
params: params
});
}
/** 创建对应课程考题 */
export function setCourseList(data) {
return request({

View File

@ -1,16 +1,17 @@
import request from '@/utils/request';
/** 查找个人录制的仿真任务*/
export function getQuestPageList(mapId) {
/** 分页查找个人录制的仿真任务*/
export function getQuestPageList(mapId, params) {
return request({
url: `/api/script/${mapId}/list`,
method: 'get'
url: `/api/script/draft/${mapId}/list`,
method: 'get',
params: params
});
}
/** 创建任务 */
export function createQuest(data) {
return request({
url: `/api/script`,
url: `/api/script/draft`,
method: 'post',
data
});
@ -18,28 +19,28 @@ export function createQuest(data) {
/** 根据任务id删除任务 */
export function deleteQuest(id) {
return request({
url: `/api/script/${id}`,
url: `/api/script/draft/${id}`,
method: 'delete'
});
}
/** 根据id查询任务基础信息 */
export function getQuestById(id) {
return request({
url: `/api/script/${id}/basic`,
url: `/api/script/draft/${id}`,
method: 'get'
});
}
/** 根据id查询任务基础信息 */
/** 根据id查询任务详情信息 */
export function getQuestByIdList(id) {
return request({
url: `/api/quest/${id}/detail`,
url: `/api/script/draft/${id}/detail`,
method: 'get'
});
}
/** 更新任务基本信息 */
export function updateQuest(id, data) {
return request({
url: `/api/script/${id}`,
url: `/api/script/draft/${id}`,
method: 'put',
data
});
@ -53,3 +54,21 @@ export function getQuestPageListOnline(params) {
params: params
});
}
/** 剧本发布 */
export function publishQuest(id, data) {
return request({
url: `/api/script/draft/${id}/publish`,
method: 'put',
data
});
}
/** 剧本撤销发布 */
export function retractQuest(id, data) {
return request({
url: `/api/script/draft/${id}/retract`,
method: 'put'
});
}

View File

@ -4,6 +4,7 @@ import request from '@/utils/request';
export function getScriptPageListOnline(params) {
return request({
url: `/api/script/paging/online`,
// url: `/api/script/paging/published`,
method: 'get',
params: params
});
@ -17,10 +18,17 @@ export function getScriptByIdList(id) {
});
}
/** 通过ID查询剧本的基础信息 */
/** 通过ID查询发布的剧本的详细信息 */
export function getScriptById(id) {
return request({
url: `/api/script/${id}/detail`,
method: 'get'
});
}
/** 通过ID查询未发布剧本的详细信息 */
export function getDraftScriptById(id) {
return request({
url: `/api/script/draft/${id}/detail`,
method: 'get'
});
}

View File

@ -0,0 +1,87 @@
import request from '@/utils/request';
export function getTrainingSystemList(cityCode, params) {
/** 根据cityCode后去对应地图及其子系统 */
return request({
url: `/api/mapSystem/city/${cityCode}`,
method: 'get',
params
});
}
export function querySystemByTypeAndPrdCode(params, prodCode) {
/** 根据系统类型和地图产品code查询系统的内容课程、章节、考试*/
return request({
url: `/api/mapSystem/queryByTypeAndPrdCode/${prodCode}`,
method: 'get',
params
});
}
export function getTrainingSystemListByMapId(mapId) {
/** 根据mapId去获取其子系统 */
return request({
url: `/api/mapSystem/${mapId}`,
method: 'get'
});
}
export function generateMapSystem(mapId) {
/** 根据mapId生成地图子系统 */
return request({
url: `/api/mapSystem/generate/${mapId}`,
method: 'post'
});
}
export function getSubSystemInfo(id) {
/** 查询子系统信息 */
return request({
url: `/api/mapSystem/${id}`,
method: 'get'
});
}
export function getSubSystemDetail(id) {
/** 查询子系统详情*/
return request({
url: `/api/mapSystem/${id}/detail`,
method: 'get'
});
}
export function getMapSystemPageList(params) {
/** 分页查询地图系统 */
return request({
url: `/api/mapSystem`,
method: 'get',
params
});
}
export function createMapSubSystem(data) {
/** 创建地图系统 */
return request({
url: `/api/mapSystem`,
method: 'post',
data: data
});
}
export function updateSubSystem(id, data) {
/** 查询子系统信息 */
return request({
url: `/api/mapSystem/${id}`,
method: 'put',
data: data
});
}
export function deleteSubSystem(id) {
/** 删除地图系统 */
return request({
url: `/api/mapSystem/${id}`,
method: 'delete'
});
}

BIN
src/assets/erCode.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
src/assets/logo_changan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -127,7 +127,7 @@
</el-row>
</template>
</el-col>
<el-col :span="6" :offset="0">
<el-col :span="5" :offset="1">
<el-button type="primary" size="small" :disabled="!canQuery" @click="query">{{ $t('global.query') }}</el-button>
<el-button v-if="queryForm.reset" type="primary" size="small" :disabled="!canQuery" @click="doClean">{{ $t('global.reset') }}</el-button>
<el-button v-if="exportFlag" type="primary" size="small" :disabled="!canQuery" @click="doExport">{{ $t('global.export') }}</el-button>
@ -139,6 +139,7 @@
size="small"
:style="button.style"
@click="button.handler"
class="button_style"
>{{ button.text }}</el-button>
</template>
</el-col>
@ -480,4 +481,7 @@ export default {
max-width: 240px;
min-width: 100px;
}
.button_style {
margin-bottom: 10px;
}
</style>

View File

@ -453,7 +453,10 @@ export default {
currentChoose() {
return this.choose;
},
refresh() {
refresh(flag) {
if (flag) {
this.commitQuery();
}
this.queryList.data = [...this.queryList.data];
}
}

View File

@ -0,0 +1,54 @@
import store from '@/store';
export default {
bind(el) {
const dialogHeaderEl = el.querySelector('.el-dialog__header');
const dragDom = el.querySelector('.el-dialog');
dialogHeaderEl.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
// eslint-disable-next-line no-useless-escape
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
// eslint-disable-next-line no-useless-escape
styL = +sty.left.replace(/\px/g, '');
// eslint-disable-next-line no-useless-escape
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 刷新提示标签位置*/
store.dispatch('training/emitTipFresh');
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './dialogDrag';
const dialogDrag = function(Vue) {
Vue.directive('dialogDrag', install);
};
Vue.use(dialogDrag);

View File

@ -0,0 +1,25 @@
export default {
bind(el, binding) {
const dragDom = binding.value.$el.querySelector('.el-dialog');
el.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - el.offsetLeft;
document.onmousemove = function (e) {
/** 移动时禁用默认事件*/
e.preventDefault();
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
dragDom.style.width = `${l}px`;
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './dialogDragWidth';
const dialogDragWidth = function(Vue) {
Vue.directive('dialogDragWidth', install);
};
Vue.use(dialogDragWidth);

106
src/directive/drag/drag.js Normal file
View File

@ -0,0 +1,106 @@
export default {
bind(el) {
const dragDom = el.querySelector('.reminder-box');
const dragRight = el.querySelector('.drag-right');
const dragLeft = el.querySelector('.drag-left');
const dragBottom = el.querySelector('.drag-bottom');
const dragTop = el.querySelector('.drag-top');
const dragBody = el.querySelector('.tip-body');
const body = el.querySelector('.tip-body-box');
dragRight.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disW + (iEvent.clientX - disX) > 350) {
dragDom.style.width = disW + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragLeft.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
var OFFLeft = dragDom.offsetLeft;
document.onmousemove = function (e) {
const iEvent = e || event;
const width = disW - (iEvent.clientX - disX);
if (width > 350) {
dragDom.style.width = disW - (iEvent.clientX - disX) + 'px';
dragDom.style.left = OFFLeft + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragBottom.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH + (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH + (iEvent.clientY - disY) + 'px';
body.style.height = disH + (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH + (iEvent.clientY - disY) - 100 + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragTop.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
var OOFTop = dragDom.offsetTop;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH - (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH - (iEvent.clientY - disY) + 'px';
body.style.height = disH - (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH - (iEvent.clientY - disY) - 100 + 'px';
dragDom.style.top = OOFTop + (iEvent.clientY - disY) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './drag';
const drag = function(Vue) {
Vue.directive('drag', install);
};
Vue.use(drag);

View File

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

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './focus';
const focus = function(Vue) {
Vue.directive('focus', install);
};
Vue.use(focus);

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './quickMenuDrag';
const quickMenuDrag = function(Vue) {
Vue.directive('quickMenuDrag', install);
};
Vue.use(quickMenuDrag);

View File

@ -0,0 +1,45 @@
export default {
bind(el) {
const dragDom = el;
dragDom.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dragDom.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX;
const disY = e.clientY;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
};

View File

@ -0,0 +1,8 @@
import Vue from 'vue';
import install from './waves';
const waves = function(Vue) {
Vue.directive('waves', install);
};
Vue.use(waves);

View File

@ -0,0 +1,26 @@
.waves-ripple {
position: absolute;
border-radius: 100%;
background-color: rgba(0, 0, 0, 0.15);
background-clip: padding-box;
pointer-events: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
opacity: 1;
}
.waves-ripple.z-active {
opacity: 0;
-webkit-transform: scale(2);
-ms-transform: scale(2);
transform: scale(2);
-webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
transition: opacity 1.2s ease-out, transform 0.6s ease-out;
transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out;
}

View File

@ -0,0 +1,72 @@
import './waves.css';
const context = '@@wavesContext';
function handleClick(el, binding) {
function handle(e) {
const customOpts = Object.assign({}, binding.value);
const opts = Object.assign({
ele: el, // 波纹作用元素
type: 'hit', // hit 点击位置扩散 center中心点扩展
color: 'rgba(0, 0, 0, 0.15)' // 波纹颜色
},
customOpts
);
const target = opts.ele;
if (target) {
target.style.position = 'relative';
target.style.overflow = 'hidden';
const rect = target.getBoundingClientRect();
let ripple = target.querySelector('.waves-ripple');
if (!ripple) {
ripple = document.createElement('span');
ripple.className = 'waves-ripple';
ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px';
target.appendChild(ripple);
} else {
ripple.className = 'waves-ripple';
}
switch (opts.type) {
case 'center':
ripple.style.top = rect.height / 2 - ripple.offsetHeight / 2 + 'px';
ripple.style.left = rect.width / 2 - ripple.offsetWidth / 2 + 'px';
break;
default:
ripple.style.top =
(e.pageY - rect.top - ripple.offsetHeight / 2 - document.documentElement.scrollTop ||
document.body.scrollTop) + 'px';
ripple.style.left =
(e.pageX - rect.left - ripple.offsetWidth / 2 - document.documentElement.scrollLeft ||
document.body.scrollLeft) + 'px';
}
ripple.style.backgroundColor = opts.color;
ripple.className = 'waves-ripple z-active';
return false;
}
}
if (!el[context]) {
el[context] = {
removeHandle: handle
};
} else {
el[context].removeHandle = handle;
}
return handle;
}
export default {
bind(el, binding) {
el.addEventListener('click', handleClick(el, binding), false);
},
update(el, binding) {
el.removeEventListener('click', el[context].removeHandle, false);
el.addEventListener('click', handleClick(el, binding), false);
},
unbind(el) {
el.removeEventListener('click', el[context].removeHandle, false);
el[context] = null;
delete el[context];
}
};

View File

@ -1,283 +0,0 @@
/* eslint-disable no-useless-escape */
import Vue from 'vue';
import store from '@/store';
/**
*元素获取焦点v-dialogDrag
* @param {*} el
* @param {*} binding
*/
Vue.directive('focus', {
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
if (obj.value) {
// 聚焦元素
el.focus();
}
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
});
/**
*弹窗拖拽v-dialogDrag
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('dialogDrag', {
bind(el) {
const dialogHeaderEl = el.querySelector('.el-dialog__header');
const dragDom = el.querySelector('.el-dialog');
dialogHeaderEl.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dialogHeaderEl.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
// eslint-disable-next-line no-useless-escape
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
// eslint-disable-next-line no-useless-escape
styL = +sty.left.replace(/\px/g, '');
// eslint-disable-next-line no-useless-escape
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 刷新提示标签位置*/
store.dispatch('training/emitTipFresh');
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
*弹窗宽度拖大,拖小dialogDragWidth
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('dialogDragWidth', {
bind(el, binding) {
const dragDom = binding.value.$el.querySelector('.el-dialog');
el.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX - el.offsetLeft;
document.onmousemove = function (e) {
/** 移动时禁用默认事件*/
e.preventDefault();
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
dragDom.style.width = `${l}px`;
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
* 弹窗拖拽v-quickEntryDrag
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @param {*} oldvNode
*/
Vue.directive('quickMenuDrag', {
bind(el) {
const dragDom = el;
dragDom.style.cursor = 'move';
/** 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);*/
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dragDom.onmousedown = (e) => {
/** 鼠标按下,计算当前元素距离可视区的距离*/
const disX = e.clientX;
const disY = e.clientY;
/** 获取到的值带px 正则匹配替换*/
let styL, styT;
/** 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px*/
if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
} else {
styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, '');
}
document.onmousemove = function (e) {
/** 通过事件委托,计算移动的距离*/
const l = e.clientX - disX;
const t = e.clientY - disY;
/** 移动当前元素*/
dragDom.style.left = `${l + styL}px`;
dragDom.style.top = `${t + styT}px`;
/** 将此时的位置传出去*/
// binding.value({ x: e.pageX, y: e.pageY });
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
};
}
});
/**
*vue-自定义指令-拖拽 v-drag
*/
Vue.directive('drag', {
bind(el) {
const dragDom = el.querySelector('.reminder-box');
const dragRight = el.querySelector('.drag-right');
const dragLeft = el.querySelector('.drag-left');
const dragBottom = el.querySelector('.drag-bottom');
const dragTop = el.querySelector('.drag-top');
const dragBody = el.querySelector('.tip-body');
const body = el.querySelector('.tip-body-box');
dragRight.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disW + (iEvent.clientX - disX) > 350) {
dragDom.style.width = disW + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragLeft.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disX = iEvent.clientX;
var disW = dragDom.offsetWidth;
var OFFLeft = dragDom.offsetLeft;
document.onmousemove = function (e) {
const iEvent = e || event;
const width = disW - (iEvent.clientX - disX);
if (width > 350) {
dragDom.style.width = disW - (iEvent.clientX - disX) + 'px';
dragDom.style.left = OFFLeft + (iEvent.clientX - disX) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragBottom.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH + (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH + (iEvent.clientY - disY) + 'px';
body.style.height = disH + (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH + (iEvent.clientY - disY) - 100 + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
dragTop.onmousedown = (e) => {
document.onselectstart = function () {
return false;
};
// 宽度拖拽
var iEvent = e || event;
var disY = iEvent.clientY;
var disH = dragDom.offsetHeight;
var OOFTop = dragDom.offsetTop;
document.onmousemove = function (e) {
var iEvent = e || event;
if (disH - (iEvent.clientY - disY) > 200) {
dragDom.style.height = disH - (iEvent.clientY - disY) + 'px';
body.style.height = disH - (iEvent.clientY - disY) - 40 + 'px';
dragBody.style.height = disH - (iEvent.clientY - disY) - 100 + 'px';
dragDom.style.top = OOFTop + (iEvent.clientY - disY) + 'px';
}
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
document.onselectstart = null;
};
};
}
});

View File

@ -0,0 +1,36 @@
export default {
applicant: 'Applicant',
map: 'Map',
status: 'Status',
unpublished: 'Unpublished',
pendingReview: 'PendingReview',
releaseSuccess: 'ReleaseSuccess',
overrule: 'Overrule',
scriptName: 'Script Name',
scriptDescription: 'Script Description',
applyTime: 'Apply Time',
applyPassed: 'Apply Passed',
applyReject: 'Apply Reject',
scriptPreview: 'Script Preview',
passedScript: 'Passed Script',
rejectScript: 'Reject Script',
explanation: 'Explanation',
inputScriptName: 'Please input script name',
inputRejectExplanation: 'Please input reject explanation',
passedScriptSuccess: 'Passed script success',
passedScriptFailed: 'Passed script failed',
rejectScriptSuccess: 'Reject script success',
rejectScriptFailed: 'Reject script failed',
runPlanName: 'Run Plan Name',
passedRunPlan: 'Passed Run Plan',
rejectRunPlan: 'Reject Run Plan',
runPlanPreview: 'RunPlan Preview',
inputRunPlanName: 'Please input run plan name',
courseDescription: 'Course description',
lookOver: 'Look over',
courseDetails: 'Course details',
instructions: 'Instructions',
chapterTrainingName: 'Chapter/training name',
revokeScriptSuccess: 'Revoke script success',
revokeScriptFailed: 'Revoke script failed'
};

View File

@ -1,7 +1,7 @@
export default {
simulationSystem: 'Urban rail transit simulation system',
simulationSystemDescription: 'Based on the subway signal system, the urban rail transit simulation system is reformed for the training part, aiming to build a set of professional simulation system for driving demonstration. The system has high flexibility for future expansion and upgrading. Meanwhile, the simulation system has two modes of normal operation and fault operation. Besides normal functional operation, it can also conduct fault simulation of equipment.',
simulationName: 'Simulation name:',
simulationName: 'Simulation module:',
noSimulationProducts: 'No simulation products',
productDescription: 'Product description:',
startSimulation: 'Start the simulation',

View File

@ -79,6 +79,7 @@ export default {
schema: {
selectProduct: 'Please select product type',
loadScript: 'Load Script',
selectRoles: 'Select Roles',
previewRunDiagram: 'Preview Run Diagram',
loadRunDiagram: 'Load Run Diagram',
faultSetting: 'Fault Setting',
@ -123,6 +124,7 @@ export default {
dispatcher: 'Dispatcher',
attendant: 'Station',
audience: 'Audience',
repair: 'Repair',
driver: 'Train',
none: 'None'
},

View File

@ -91,5 +91,8 @@ export default {
getRunGraphDataFailed: 'Failed to get run graph data',
getStationListFail: 'Failed to get station list',
obtainTrainGroupNumberFailed: 'Failed to obtain train group number',
getTrainListFailed: 'Failed to get train list'
getTrainListFailed: 'Failed to get train list',
getDraftCourseDataFailed: 'Failed to get draft course data!',
failedToGetCourseData: 'Failed to get course data!',
failedToGetSystemData: 'Failed to get system data!'
};

View File

@ -15,20 +15,21 @@ export default {
returnToExamList: 'Return to the exam list',
totalScore: 'Total score',
itemList: 'Item list',
courseName: 'Course name',
permissionsDetails: 'Permissions for details',
courseName: 'Examination subject',
permissionsDetails: 'Permission details',
buy: 'buy',
distributePermission: 'Permission distribution (examination)',
viewCoursePapers: 'View course papers',
examStartTime: 'Exam start time',
theExamIsReadyAnyTime: 'The exam is ready any time',
testExplanation: 'Test Explanation',
examTimeAvailable: 'Exam time available',
fullMarksInTheExam: 'Full marks in the exam',
passMarkTheExam: 'Pass mark the exam',
examinationRules: 'Examination rules',
examStartTime: 'Start time',
theExamIsReadyAnyTime: 'Anytime you are available',
minutes: 'min',
testExplanation: 'Notes',
examTimeAvailable: 'Duration',
fullMarksInTheExam: 'Full marks',
passMarkTheExam: 'Passing score',
examinationRules: 'Rules',
trainingType: 'Training type',
numberOfQuestions: 'Number of questions',
numberOfQuestions: 'Quantity',
score: 'Score',
startTheExam: 'Start the exam',
examinationTiming: 'Examination timing',

View File

@ -40,7 +40,7 @@ export default {
mobile: 'mobile',
name: 'Name',
code: 'Code',
status: 'Status',
status: 'State',
remarks: 'Remarks',
selectionTime: 'Selection of time',
permissionNumber: 'Number of permissions',
@ -56,11 +56,11 @@ export default {
transferScreenPermission: 'Large screen rights transfer',
today: 'Today',
total: 'Total',
index: 'Indexes',
startTime: 'Start time',
endTime: 'End time',
isForever: 'Forever',
remains: 'Remainder',
index: 'Index',
startTime: 'Start',
endTime: 'End',
isForever: 'Timelimit',
remains: 'Remaining',
hasPermissionTip: 'Public permission is {0}, private permission is {1}',
create: 'Create',
update: 'Update',
@ -158,5 +158,6 @@ export default {
processFailure: 'Process failure',
enterLastStep: 'Please enter a hint and click next',
pleaseOpearte: 'Please proceed',
help: 'help'
help: 'help',
city: 'City'
};

View File

@ -24,6 +24,8 @@ import joinTraining from './joinTraining';
import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default {
...enLocale,
@ -51,5 +53,7 @@ export default {
joinTraining,
trainRoom,
menu,
ibp
ibp,
approval,
systemGenerate
};

View File

@ -102,5 +102,19 @@ export default {
train: 'Train',
station: 'Station',
trainWindow: 'Train window',
editStepInfo: 'Edit step information'
editStepInfo: 'Edit step information',
trainingRecord: 'Training recording',
lesson: 'Lesson',
taskManage: 'Task manage',
trainingRule: 'Training rule',
trainingManage: 'Training manage',
newConstruction: 'New',
applicationForRelease: 'Application for release',
rejectReason: 'Reason for rejection',
withdraw: 'Withdraw',
notRelease: 'Not release',
pendingReview: 'Pending review',
published: 'Published',
rejected: 'Rejected',
review: 'Review'
};

View File

@ -11,6 +11,7 @@ export default {
saveMapAs: 'Save the map as',
create: 'establish',
dataVerification: 'data verification',
edit3d: '3D editor',
logicalView: 'logical view',
physicalView: 'Physical view',
mixedView: 'The mixed view',

View File

@ -491,5 +491,6 @@ export default {
settingTrain: 'Setting train',
sourceTrainWindow: 'Source train window',
trainWindow: 'Train window',
targetTrainWindow: 'Target train window'
targetTrainWindow: 'Target train window',
category: 'category'
};

View File

@ -1,16 +1,16 @@
export default {
updateStation: {
level1: 'level one: ',
level2: 'level two: ',
level3: 'level three: ',
level4: 'level four: ',
level5: 'level five: ',
level1: 'level1: ',
level2: 'level2: ',
level3: 'level3: ',
level4: 'level4: ',
level5: 'level5: ',
updateData: 'Update data',
pleaseInputLevel1: 'Please input level one',
pleaseInputLevel2: 'Please input level two',
pleaseInputLevel3: 'Please input level three',
pleaseInputLevel4: 'Please input level four',
pleaseInputLevel5: 'Please input level five',
pleaseInputLevel1: 'Please input level1',
pleaseInputLevel2: 'Please input level2',
pleaseInputLevel3: 'Please input level3',
pleaseInputLevel4: 'Please input level4',
pleaseInputLevel5: 'Please input level5',
systemOutPut: 'System output',
selectPrintArea: 'Selec print area',
selectDeleteRoute: 'Select delete route',
@ -229,5 +229,9 @@ export default {
editPlanningTrain: 'Edit planning train',
runGraphName: 'Run graph name',
tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】',
serverTrainNum: '表号车次号'
serverTrainNum: '表号车次号',
explanation: 'Explanation',
creationDate: 'Creation date',
load: 'Load',
modifyName: 'Modify name'
};

View File

@ -7,6 +7,9 @@ export default {
runPlanManage: 'Run plan',
productEdit: 'Product editor',
designhomePage: 'Public map',
designUserPage: 'Personal map',
lessaonManage: 'Lesson',
lessonEdit: 'Lesson editor',
trainingRecord: 'Trainning recording',
@ -58,5 +61,11 @@ export default {
userExamManage: 'User examination management',
userSimulationManage: 'User simulation management',
existingSimulation: 'Existence simulation management',
ibpDraw: 'ibp Draw'
ibpDraw: 'Ibp Draw',
trainingPlatform: 'trainingPlatform',
releaseApplication: 'Release application',
courseApplication: 'Course release application',
scriptReleaseApplication: 'Script release application',
runGraphReleaseApplication: 'Run graph release application',
subsystemGeneration: 'Subsystem generation'
};

View File

@ -239,9 +239,9 @@ export default {
selectOneTrainingType: 'Only one training type can be selected',
enterProductType: 'Please enter product type',
selectAssociatedStation: 'Please select the associated station',
pleaseSelectTrainDir: '请选择列车所在方向',
pleaseEnterSplit: '请输入拆分数量',
pleaseEnterSplitNumber: '请输入合理的拆分数量',
pleaseSelectTrainDir: 'Please select the direction of the train',
pleaseEnterSplit: 'Please enter the split number',
pleaseEnterSplitNumber: 'Please enter a reasonable number of split',
enterScale: 'Please enter the zoom ratio',
enterXOffset: 'Please enter X offset',
enterYOffset: 'Please enter Y offset',
@ -276,7 +276,7 @@ export default {
accessNumber: 'Please input the number of permissions',
courseNameEmpty: 'Course name cannot be empty',
purchaseMonth: 'Please input the number of months to buy',
pleaseEnterGoodPrice: '请输入商品价格',
pleaseEnterGoodPrice: 'Please enter the price of the goods',
enterTheNameOfTheRunGraph: 'Please enter the name of the run graph',
chooseToPublishTheRunGraph: 'Please choose to publish the run chart',
enterTheAlarmCode: 'Please enter the alarm code',
@ -306,5 +306,6 @@ export default {
enterTheKeyWidth: 'Please enter the key width',
enterTheKeyDirection: 'Please select the key direction',
enterTheUpperText: 'Please enter the upper text',
enterTheLowerText: 'Please enter the lower text'
enterTheLowerText: 'Please enter the lower text',
enterRejectReason: 'Please enter reject reason'
};

View File

@ -4,6 +4,7 @@ export default {
saveData: 'Save Data',
mapList: 'Map List',
createScript: 'Create Script',
modifyScript: 'Modify Script',
scriptName: 'Script Name',
addScript: 'Add Script',
map: 'Map',
@ -15,6 +16,7 @@ export default {
createScriptFail: 'Create script failure',
scriptDetail: 'Script Detail',
scriptRecord: 'Edit',
scriptCreate: 'Create',
scriptModify: 'Modify',
scriptDelete: 'Delete',
getScriptFail: 'Get script information failure',
@ -81,7 +83,25 @@ export default {
scriptBack: 'Back',
speakTo: 'to',
executeCommandTips: 'execute command: ',
operate: 'Operate',
scriptList: 'Script List',
applyPublish: 'Apply for release',
preview: 'Preview',
status: 'Status',
applyRevoke: 'Revoke',
publish: 'Publish',
revokeReason: 'Revoke explanation',
language: 'language',
chinese: 'Chinese Simplified',
english: 'English'
english: 'English',
publishScript: 'Publish Script',
releaseScriptSuccess: 'release script success',
releaseScriptFailed: 'release script failed',
publishScriptSuccess: 'Publish Script Success',
publishScriptFailed: 'Publish Script Failed',
releaseScriptTip: 'This action will apply to release script, whether to continue?',
revokeScriptTip: 'This action will undo release script, whether to continue?',
inputScriptName: 'Please input script name',
selectMap: 'Please select map',
inputScriptDescription: 'Please input script description'
};

View File

@ -0,0 +1,30 @@
export default {
map: 'Map',
mapName: 'Map Name',
prdName: 'Product Name',
name: 'Name',
type: 'Type',
updateData: 'Modify',
generate: 'Generate',
selectMap: 'Please select map',
generateSuccess: 'The subsystem under the map is generated successfully!',
generateFail: 'The subsystem under the map failed to generate!',
inputName: 'Please input subsystem name',
selectType: 'Please select type',
selectPrdName: 'Please select product name',
createSubSystem: 'Commission SubSystem',
modifySubSystem: 'Modify SubSystem',
commission: 'Commission',
customized: 'Project',
selectProject: 'Please select project',
createMapSystemSuccess: 'Create map system success',
createMapSystemFail: 'Create map system failed',
getSubSystemInfoFail: 'Get subsystem infomation failed',
updateMapSystemSuccess: 'Update map system success',
updateMapSystemFail: 'Update map system failed',
generation: 'One-click Generation',
deleteData: 'Delete',
deleteMapSystemSuccess: 'Delete map system success',
deleteMapSystemFail: 'Delete map system fail',
deleteMapSystemTip: 'This action will apply to delete map system, whether to continue?'
};

View File

@ -198,5 +198,12 @@ export default {
runGraphNameModifiedSuccessfully: 'Run graph name modified successfully!',
modifyRunGraphNameFailed: 'Modify run graph name failed!',
planCreationSuccessful: 'Plan creation successful!',
createPlanFailed: 'Failed to create plan!'
createPlanFailed: 'Failed to create plan!',
cancelCoursePublicationHint: 'This action will cancel the course publication application, is it OK?',
cancelTheSuccessfulApplicationOfTheCourseRelease: 'Cancel the successful application of the course release!',
cancellationOfCoursePublicationApplicationFailed: 'Cancellation of course publication application failed!',
publishTheCourseHint: 'This operation will publish the course. Are you sure?',
rejectedCourseReleaseApplicationSuccessful: 'Rejected course release application successful!',
rejectedCourseReleaseApplicationFailed: 'Rejected course release application failed!',
duplicatePlanFailedTips: 'The interval needs to be more than 30 seconds or the times is more than 1'
};

View File

@ -0,0 +1,37 @@
export default {
applicant: '申请人',
map: '地图',
status: '状态',
unpublished: '未发布',
pendingReview: '待审核',
releaseSuccess: '发布成功',
overrule: '驳回',
scriptName: '剧本名称',
scriptDescription: '剧本简介',
applyTime: '申请时间',
applyPassed: '通过',
applyReject: '驳回',
scriptPreview: '预览',
passedScript: '通过剧本',
rejectScript: '驳回剧本',
explanation: '驳回说明',
inputScriptName: '请输入剧本名称',
inputRejectExplanation: '请输入驳回说明',
passedScriptSuccess: '通过剧本成功',
passedScriptFailed: '通过剧本失败',
rejectScriptSuccess: '驳回剧本成功',
rejectScriptFailed: '驳回剧本失败',
runPlanName: '运行图名称',
passedRunPlan: '通过运行图',
rejectRunPlan: '驳回运行图',
runPlanPreview: '预览',
inputRunPlanName: '请输入运行图名称',
courseDescription: '课程说明',
lookOver: '查看',
courseDetails: '课程详情',
instructions: '说明',
chapterTrainingName: '章节/课程名称',
revokeScriptSuccess: '撤回成功',
revokeScriptFailed: '撤回失败'
};

View File

@ -79,6 +79,7 @@ export default {
schema: {
selectProduct: '请选择产品类型',
loadScript: '加载剧本',
selectRoles: '选择角色',
previewRunDiagram: '运行图预览',
loadRunDiagram: '运行图加载',
faultSetting: '故障设置',
@ -123,6 +124,7 @@ export default {
dispatcher: '行调',
attendant: '车站',
audience: '观众',
repair: '通号',
driver: '列车',
none: '无'
},

View File

@ -91,5 +91,8 @@ export default {
getRunGraphDataFailed: '获取运行图数据失败',
getStationListFail: '获取车站列表失败',
obtainTrainGroupNumberFailed: '获取列车车组号失败',
getTrainListFailed: '获取列车列表失败'
getTrainListFailed: '获取列车列表失败',
getDraftCourseDataFailed: '获取草稿课程数据失败!',
failedToGetCourseData: '获取课程数据失败!',
failedToGetSystemData: '获取系统数据失败!'
};

View File

@ -22,6 +22,7 @@ export default {
viewCoursePapers: '查看课程试卷',
nameOfTestPaper: '试卷名称',
examStartTime: '考试时间',
minutes: '分钟',
theExamIsReadyAnyTime: '随时都可以考试',
testExplanation: '考试说明',
examTimeAvailable: '考试时长',

View File

@ -158,6 +158,6 @@ export default {
processFailure: '处理失败',
enterLastStep: '请输入提示并点击下一步',
pleaseOpearte: '请开始操作',
help: '帮助'
help: '帮助',
city: '城市'
};

View File

@ -24,6 +24,8 @@ import joinTraining from './joinTraining';
import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
export default {
...cnLocale,
@ -51,5 +53,7 @@ export default {
joinTraining,
trainRoom,
menu,
ibp
ibp,
approval,
systemGenerate
};

View File

@ -101,6 +101,21 @@ export default {
train: '列车',
station: '车站',
trainWindow: '车次窗',
countSkinCode: '复制皮肤与被复制皮肤类型不能一样'
countSkinCode: '复制皮肤与被复制皮肤类型不能一样',
trainingRecord: '实训录制',
lesson: '课程',
taskManage: '任务管理',
trainingRule: '操作定义',
trainingManage: '实训管理',
newConstruction: '新建',
applicationForRelease: '申请发布',
rejectReason: '驳回原因',
withdraw: '撤销',
notRelease: '未发布',
pendingReview: '待审核',
published: '已发布',
rejected: '已驳回',
review: '查看'
};

View File

@ -12,6 +12,7 @@ export default {
saveMapAs: '地图另存为',
create: '创建',
dataVerification: '数据校验',
edit3d: '三维编辑',
logicalView: '逻辑视图',
physicalView: '物理视图',
mixedView: '混合视图',
@ -116,7 +117,7 @@ export default {
editAutoRouting: '编辑自动信号',
setSwitch: '联动道岔',
pathUnit: '路径单元',
jlmap3d: '三维编辑',
jlmap3d: '三维编辑',
automaticSignalList: '自动信号列表',
automaticSignalCode: '自动信号编码',

View File

@ -487,6 +487,7 @@ export default {
settingTrain: '设置列车',
sourceTrainWindow: '源车次窗',
trainWindow: '车次窗',
targetTrainWindow: '目的车次窗'
targetTrainWindow: '目的车次窗',
category: '类别'
};

View File

@ -232,5 +232,9 @@ export default {
endTime: '终到时间',
editPlanningTrain: '编辑计划车',
tipOperationTime: '请先设置区段站间运行时间, 【文件】-> 【修改站间运行时间】',
serverTrainNum: '表号车次号'
serverTrainNum: '表号车次号',
explanation: '驳回说明',
creationDate: '创建日期',
load: '加载',
modifyName: '修改名称'
};

View File

@ -1,6 +1,9 @@
export default {
homePage: '首页',
designhomePage: '公共地图',
designUserPage: '个人地图',
mapManage: '地图管理',
skinManage: '皮肤管理',
mapDraw: '地图绘制',
@ -59,5 +62,11 @@ export default {
userSimulationManage: '用户仿真统计',
existingSimulation: '存在仿真管理',
ibpDraw: 'Ibp盘绘制'
ibpDraw: 'Ibp盘绘制',
trainingPlatform: '实训平台',
releaseApplication: '发布申请',
courseApplication: '课程发布申请',
scriptReleaseApplication: '剧本发布申请',
runGraphReleaseApplication: '运行图发布申请',
subsystemGeneration: '子系统生成'
};

View File

@ -308,5 +308,6 @@ export default {
enterTheKeyWidth: '请输入钥匙宽度',
selectTheKeyDirection: '请选择钥匙朝向',
enterTheUpperText: '请输入上侧文字',
enterTheLowerText: '请输入下侧文字'
enterTheLowerText: '请输入下侧文字',
enterRejectReason: '请输入驳回说明'
};

View File

@ -4,6 +4,7 @@ export default {
saveData: '保存数据',
mapList: '地图列表',
createScript: '创建剧本',
modifyScript: '修改剧本',
scriptName: '剧本名称',
addScript: '添加剧本',
map: '所属地图',
@ -15,6 +16,7 @@ export default {
createScriptFail: '创建剧本失败',
scriptDetail: '剧本详情',
scriptRecord: '编制',
scriptCreate: '创建',
scriptModify: '修改',
scriptDelete: '删除',
getScriptFail: '获取剧本信息失败',
@ -82,7 +84,25 @@ export default {
scriptBack: '返回',
speakTo: '对',
executeCommandTips: '执行指令: ',
operate: '操作',
scriptList: '剧本列表',
applyPublish: '申请发布',
preview: '预览',
status: '状态',
applyRevoke: '撤回',
publish: '发布',
revokeReason: '驳回原因',
language: '语言',
chinese: '中文',
english: '英文'
english: '英文',
publishScript: '发布剧本',
releaseScriptSuccess: '申请发布成功',
releaseScriptFailed: '申请发布失败',
publishScriptSuccess: '发布成功',
publishScriptFailed: '发布失败',
releaseScriptTip: '此操作将申请发布剧本, 是否继续?',
revokeScriptTip: '此操作将撤销发布剧本申请, 是否继续?',
inputScriptName: '请输入剧本',
selectMap: '请选择地图',
inputScriptDescription: '请输入剧本描述'
};

View File

@ -0,0 +1,31 @@
export default {
map: '地图',
mapName: '地图名称',
prdName: '产品名称',
name: '名称',
type: '类型',
updateData: '更新',
generate: '生成',
selectMap: '请选择地图',
generateSuccess: '生成该地图下子系统成功!',
generateFail: '生成该地图下子系统失败!',
inputName: '请输入子系统名称',
selectType: '请选择类型',
selectPrdName: '请选择产品名称',
createSubSystem: '定制子系统',
modifySubSystem: '修改子系统',
commission: '定制',
customized: '项目',
selectProject: '请选择项目',
createMapSystemSuccess: '创建地图系统成功',
createMapSystemFail: '创建地图系统失败',
getSubSystemInfoFail: '获取子系统信息失败',
updateMapSystemSuccess: '更新地图系统成功',
updateMapSystemFail: '更新地图系统失败',
generation: '一键生成',
deleteData: '删除',
deleteMapSystemSuccess: '删除地图系统成功',
deleteMapSystemFail: '删除地图系统失败',
deleteMapSystemTip: '此操作将删除地图系统, 是否继续?'
};

View File

@ -198,5 +198,12 @@ export default {
runGraphNameModifiedSuccessfully: '修改运行图名称成功!',
modifyRunGraphNameFailed: '修改运行图名称失败!',
planCreationSuccessful: '创建计划成功!',
createPlanFailed: '创建计划失败!'
createPlanFailed: '创建计划失败!',
cancelCoursePublicationHint: '此操作将撤销课程发布申请,是否确定?',
cancelTheSuccessfulApplicationOfTheCourseRelease: '撤销课程发布申请成功!',
cancellationOfCoursePublicationApplicationFailed: '撤销课程发布申请失败!',
publishTheCourseHint: '此操作将发布课程,是否确定?',
rejectedCourseReleaseApplicationSuccessful: '驳回课程发布申请成功!',
rejectedCourseReleaseApplicationFailed: '驳回课程发布申请失败!',
duplicatePlanFailedTips: '间隔时间需要大于30秒或次数大于1'
};

View File

@ -154,7 +154,7 @@ export function Jlmap3ddata(mapid,scope){
})
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader);
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
})
.then(function(data){
//console.log(data);

View File

@ -48,7 +48,8 @@ export function getmodels(data) {
rightlist:data.mapdata.linklist.linksgroup.children[i].rightlist,
leftlist:data.mapdata.linklist.linksgroup.children[i].leftlist,
lp:data.mapdata.linklist.linksgroup.children[i].lp,
rp:data.mapdata.linklist.linksgroup.children[i].rp
rp:data.mapdata.linklist.linksgroup.children[i].rp,
rail:data.mapdata.linklist.linksgroup.children[i].rail,
}
links.push(link);
}
@ -57,6 +58,7 @@ export function getmodels(data) {
//section隧道
console.log(data.mapdata.sectionlist.sections);
let sections = [];
for(let i=0;i<data.mapdata.sectionlist.sections.datalist.length;i++){
let section = {
uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
@ -80,6 +82,7 @@ export function getmodels(data) {
sections.push(section);
}
console.log(links);
let arrray = {
link:links,
section:sections,

View File

@ -89,7 +89,7 @@ function linkhelp(data,scene){
testmesh2.lengthfact = data[i].lengthfact;
for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-29;
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
@ -208,7 +208,7 @@ function linkhelp(data,scene){
let testmesh2 = autorail.clone(true);
for(let i=0;i<autorail.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-26;
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
@ -240,11 +240,11 @@ function linkhelp(data,scene){
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.197;
testmesh2.rotation.z = 0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.197;
testmesh2.rotation.z = -0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else{
@ -272,11 +272,11 @@ function linkhelp(data,scene){
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.197;
testmesh2.rotation.z = 0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.197;
testmesh2.rotation.z = -0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}

View File

@ -15,7 +15,7 @@ export function RailList(){
let raillink = mapdata.linklist.linksgroup.children;
for(let i=0;i<raillink.length;i++){
var geometry = new THREE.PlaneBufferGeometry( raillink[i].lengthfact-20.5, 0.1, 0.1 );
var geometry = new THREE.PlaneBufferGeometry( raillink[i].lengthfact-25, 0.1, 0.1 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
var plane = new THREE.Mesh( geometry, material );
plane.position.x = raillink[i].position.x;
@ -29,15 +29,23 @@ export function RailList(){
var geometry2 = new THREE.CircleBufferGeometry( 1, 16 );
var material2 = new THREE.MeshBasicMaterial( { color: 0xff2000 } );
var circle1 = new THREE.Mesh( geometry1, material1 );
circle1.position.x = plane.position.x + (raillink[i].lengthfact-20.5)/2*Math.cos(plane.rotation.z);
circle1.position.z = plane.position.z - (raillink[i].lengthfact-20.5)/2*Math.sin(plane.rotation.z);
circle1.position.x = plane.position.x + (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle1.position.z = plane.position.z - (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
var circle2 = new THREE.Mesh( geometry2, material2 );
circle2.position.x = plane.position.x - (raillink[i].lengthfact-20.5)/2*Math.cos(plane.rotation.z);
circle2.position.z = plane.position.z + (raillink[i].lengthfact-20.5)/2*Math.sin(plane.rotation.z);
circle2.position.x = plane.position.x - (raillink[i].lengthfact-25)/2*Math.cos(plane.rotation.z);
circle2.position.z = plane.position.z + (raillink[i].lengthfact-25)/2*Math.sin(plane.rotation.z);
circle2.rotation.x = -Math.PI/2;
mapdata.linklist.linksgroup.children[i].rail = [{
x:circle2.position.x,
z:circle2.position.z
},{
x:circle1.position.x,
z:circle1.position.z
}];
scene.add( circle2 );
scene.add( plane );
}
@ -51,6 +59,8 @@ export function RailList(){
circle1.rotation.x = -Math.PI/2;
scene.add( circle1 );
}
};
this.getrail = function(){

View File

@ -6,11 +6,11 @@ export function SectionList() {
this.type = "sectionlist";
let sectiongroup = new THREE.Group();
sectiongroup.name = "section";
this.sectiongroup = new THREE.Group();
this.sectiongroup.name = "section";
let switchgroup = new THREE.Group();
switchgroup.name = "switch";
this.switchgroup = new THREE.Group();
this.switchgroup.name = "switch";
this.sections = {
datalist:[],
@ -24,8 +24,8 @@ export function SectionList() {
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
scene.add(sectiongroup);
scene.add(switchgroup);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist;
//遍历区段
for(let i=0;i<sectiondata.length;i++){
@ -187,7 +187,7 @@ export function SectionList() {
testswitch.position.z = switchposz;
scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch);
scope.switchgroup.add(testswitch);
}
resolve("loadersection");
@ -271,8 +271,8 @@ export function SectionList() {
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
console.log(sectiondata);
scene.add(sectiongroup);
scene.add(switchgroup);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist;
for(let i=0;i<sectiondata.length;i++){
@ -347,12 +347,12 @@ export function SectionList() {
if(testmesh1.isStandTrack == false){
sectiongroup.add(testmesh1);
// scope.sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
// scope.sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
@ -367,7 +367,8 @@ export function SectionList() {
switchmesh2 = assetloader.modellist[i].mesh;
}
}
// switchmesh1.rotation.x = Math.PI/2;
// switchmesh2.rotation.z = Math.PI/2;
for(let i=0;i<switchdata.length;i++){
let newswitch = {
code:switchdata[i].code,
@ -406,6 +407,7 @@ export function SectionList() {
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}else{
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
@ -420,19 +422,20 @@ export function SectionList() {
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}
testswitch.position.x = switchdata[i].position.x;
testswitch.position.y = switchdata[i].position.y;
testswitch.position.z = switchdata[i].position.z;
testswitch.rotation.x = switchdata[i].rotation._x;
testswitch.rotation.y = switchdata[i].rotation._y;
testswitch.rotation.z = switchdata[i].rotation._z;
// testswitch.rotation.x = switchdata[i].rotation._x;
// testswitch.rotation.y = switchdata[i].rotation._y;
// testswitch.rotation.z = switchdata[i].rotation._z;
scope.switchs.datalist.push(newswitch);
scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch);
scope.switchgroup.add(testswitch);
}
resolve("loadersection");
@ -538,17 +541,21 @@ export function SectionList() {
testmesh1.lengthfact = len;
testmesh1.linkCode = suidao.linkCode;
if(suidaodata.datalist[i].isStandTrack == false){
sectiongroup.add(testmesh1);
scope.sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
scope.sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
}
this.resetsection = function(scene){
scene.remove(scope.sectiongroup);
};
this.reposition = function(){
}

View File

@ -59,7 +59,10 @@ export function SignalList() {
newmesh.scale.x = 0.05;
newmesh.scale.y = 0.05;
newmesh.scale.z = 0.05;
newmesh.offset = data[i].offset;
newmest.linkCode = data[i].linkCode;
newsignal.mesh = newmesh;
newsignal.offset = data[i].offset;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list.push(newsignal);
@ -101,7 +104,7 @@ export function SignalList() {
});
}
this.loadpromise = function(signaldata,scene,assetloader){
this.loadpromise = function(signaldata,scene,assetloader,data){
return new Promise(function(resolve, reject){
for(let i=0;i<signaldata.length;i++){
let newsignal = new SignalModel(signaldata[i]);
@ -111,11 +114,15 @@ export function SignalList() {
num = j;
}
}
let newmesh = assetloader.modellist[num].mesh.clone(true);
newmesh.uuid = signaldata[i].id;
newmesh.name = signaldata[i].name;
newmesh.modelid = assetloader.modellist[num].id;
newmesh.code = signaldata[i].code;
newmesh.offset = data[i].offset;
newmesh.linkCode = data[i].linkCode;
newmesh.directionType = data[i].directionType;
newmesh.position.x = signaldata[i].position.x;
newmesh.position.y = signaldata[i].position.y;
newmesh.position.z = signaldata[i].position.z;
@ -132,7 +139,30 @@ export function SignalList() {
resolve("loadedsignal");
});
};
this.resetsignal = function(jlmap3ddata){
console.log(jlmap3ddata.linksgroup);
console.log(scope);
let linkdata = jlmap3ddata.linksgroup;
for(let i=0;i<scope.group.children.length;i++){
let signaldata = scope.group.children[i];
let link = linkdata.getObjectByProperty("code",signaldata.linkCode);
let posx = null;
if(signaldata.offset > link.lengthfact/2){
posx = link.position.x + signaldata.offset - link.lengthfact/2-10;
}else{
posx = link.position.x - (link.lengthfact/2 - signaldata.offset)+10;
}
//根据线路方向修改信号灯位置
if(signaldata.directionType == "01"){
signaldata.position.set(posx,0,link.position.z-3);
signaldata.rotation.z = ( Math.PI / 2 );
}else if(signaldata.directionType == "02"){
signaldata.position.set(posx,0,link.position.z+3);
signaldata.rotation.z = ( - Math.PI / 2 );
}
}
};
this.init = function(data,realsectionlist,scene,assetloader){

View File

@ -158,9 +158,12 @@ export function JLmap3dEdit(dom, data, mapid) {
};
this.export = function(){
var exporter = new THREE.OBJExporter();
console.log(scope.exportmodel);
var result = exporter.parse( scope.exportmodel );
let exporter = new THREE.OBJExporter();
console.log(scope.mapdata);
// let exportmodels = scope.mapdata.linklist.linksgroup;
// let exportmodels = scope.mapdata.sectionlist.switchgroup;
let exportmodels = scope.mapdata.stationstandlist.group;
let result = exporter.parse( exportmodels );
console.log(result);
}
@ -243,6 +246,8 @@ export function JLmap3dEdit(dom, data, mapid) {
this.autoss = function(){
console.log("autoss");
console.log(scope.mapdata);
scope.mapdata.signallist.resetsignal(scope.mapdata.linklist);
};
function onWindowResize() {

View File

@ -6,11 +6,6 @@ import {OBJLoader} from '@/jlmap3d/main/loaders/OBJLoader.js';
import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js';
import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader.js';
// controls
import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
// component
// data
import { Jl3ddata } from '@/jlmap3d/main/model/jl3ddata';
@ -20,11 +15,14 @@ import { SetRender } from '@/jlmap3d/config/SetRender';
import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights';
// controls
import {OrbitControls} from '@/jlmap3d/main/control/OrbitControls.js';
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
// 加载器
import { ModelLoad } from '@/jlmap3d/main/loaders/simulationloader';
// connect
import {Jl3dDriving} from '@/jlmap3d/jl3ddrive/moveupdate/DrivingConnect';
import { getPublishMapVersion, getPublishMapDetail, getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
// utils
@ -38,9 +36,9 @@ import {MouseControls} from '@/jlmap3d/main/control/FirstControls';
var clock = new THREE.Clock();
export function JLmapDriving(dom, data, skinCode) {
export function JLmapDriving(dom, data, skinCode,storemod) {
const scope = this;
let scope = this;
//界面更新函数
let updatemmi = {};
@ -49,7 +47,7 @@ export function JLmapDriving(dom, data, skinCode) {
this.animateswitch = false;
this.cctvswitch = false;
// 初始化webgl渲染
const renderer = SetRender(dom);
let renderer = SetRender(dom);
renderer.domElement.style.position = 'absolute';
renderer.domElement.style.top = '0';
@ -63,9 +61,9 @@ export function JLmapDriving(dom, data, skinCode) {
// 定义相机
//let camera = SetCamera(dom);
// 定义场景(渲染容器)
const scene = SetScene();
let scene = SetScene();
const speed = 0;
let speed = 0;
let drivingcode = null;
@ -98,11 +96,11 @@ export function JLmapDriving(dom, data, skinCode) {
// 地图模型数据
let mapdata = new Jl3ddata();
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1100);
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 11000);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
camera.rotation.x = 0;
let listener = new THREE.AudioListener();
listener.position.y = -2;
camera.add( listener );
@ -119,12 +117,13 @@ export function JLmapDriving(dom, data, skinCode) {
sound.play();
});
const controls3 = new MouseControls(camera, 1.6);
let controls3 = new MouseControls(camera, 1.6);
controls3.enabled = true;
// controls3.getObject().rotation.x = Math.PI/2;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 120);
cameracctv.position.set( 5, -3,27 );
cameracctv.position.set( 2, -1,27 );
cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv);
@ -133,18 +132,46 @@ export function JLmapDriving(dom, data, skinCode) {
this.Subscribe.socketon(scope.Subscribe.topic);
var timer = setInterval(function() {
if(mapdata.trainlisttest.group){
if(mapdata.trainlisttest.group.children[0]){
if(mapdata.trainlisttest){
if(mapdata.trainlisttest.group){
if(mapdata.trainlisttest.group.children[0]){
updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name);
for(let k in mapdata.rails.switchrail){
const ddd = storemod.getters['map/getDeviceByCode'](k);
let switchdata = mapdata.rails.switchrail[k];
mapdata.rails.switchrail[k].locateType = ddd.locateType;
updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name);
clearInterval(timer);
if(ddd.locateType == "01"){
//1--向左 2--向右
//__\__ __/__
if(mapdata.rails.switchrail[k].directtype == "1"){
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
mapdata.rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
}else if(mapdata.rails.switchrail[k].directtype == "2"){
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
mapdata.rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
}
}else if(ddd.locateType == "02"){
if(mapdata.rails.switchrail[k].directtype == "1"){
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
mapdata.rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
}else if(mapdata.rails.switchrail[k].directtype == "2"){
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
mapdata.rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
}
}
}
clearInterval(timer);
}
}
}
}, 1000);
}, 2000);
// 初始化加载数据和模型
getPublish3dMapDetail(skinCode).then(netdata => {
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers);
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers,storemod);
});
// let stats = new Stats();
// dom.appendChild( stats.dom );
@ -170,7 +197,7 @@ export function JLmapDriving(dom, data, skinCode) {
renderercctv.render(scene,cameracctv);
}
//相机按键位移
//controls3.update();
// controls3.update();
delta = clock.getDelta();
for (let i=mixers.length-1; i>=0; i--) {
mixers[i].update( delta );
@ -186,6 +213,8 @@ export function JLmapDriving(dom, data, skinCode) {
controls3.getObject().position.y=10;
controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
console.log(controls3);
}
}
@ -227,12 +256,11 @@ export function JLmapDriving(dom, data, skinCode) {
updatemmi.updatedrivingcode = function(code) {
drivingcode = code;
mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
mapdata.trainlisttest.list[drivingcode].children[0].add(scope.assetloader.modellist[4].mesh);
controls3.getObject().position.x = 40;
controls3.getObject().position.y= 12.5;
controls3.getObject().position.x = 10;
controls3.getObject().position.y = 0;
controls3.getObject().position.z = 2.5;
controls3.getObject().rotation.x = Math.PI/2;
controls3.getObject().rotation.y = -Math.PI/2;
scope.assetloader.modellist[4].mesh.position.x = 34;
scope.assetloader.modellist[4].mesh.position.y = 0;
};
this.dispose = function() {
@ -253,6 +281,7 @@ export function JLmapDriving(dom, data, skinCode) {
scope.actions = null;
scope.Subscribe = null;
sound.stop();
scope.webwork.terminate();
// console.log(scope);
// scope = null;
};
@ -373,9 +402,9 @@ export function JLmapDriving(dom, data, skinCode) {
if (event.button == '0') {
// 定义光线
const raycaster = new THREE.Raycaster();
let raycaster = new THREE.Raycaster();
// 定义平面鼠标点击坐标
const mouse = new THREE.Vector2();
let mouse = new THREE.Vector2();
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
@ -387,7 +416,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'stand') {
// 从站台对象组获取点击目标
const intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
let intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
// 获取最近处点击到的模型对象
if (intersects1[0]) {
// 遍历对象组获取对象坐标更新相机数据
@ -405,7 +434,7 @@ export function JLmapDriving(dom, data, skinCode) {
}
if (scope.raycasterswitch == 'train') {
const intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
let intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
if (intersects[0]) {
for (let j=0; j<mapdata.trainlisttest.list.length; j++) {
if (intersects[0].object.name == mapdata.trainlisttest.list[j].name) {
@ -419,7 +448,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'section') {
// console.log(mapdata.sectionlist.sections.modellist);
const intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true);
let intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -429,7 +458,7 @@ export function JLmapDriving(dom, data, skinCode) {
if (scope.raycasterswitch == 'signal') {
const intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true);
let intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
@ -438,7 +467,7 @@ export function JLmapDriving(dom, data, skinCode) {
}
if (scope.raycasterswitch == 'switch') {
const intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true);
let intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true);
if (intersects[0]) {
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );

View File

@ -19,6 +19,9 @@ export function Jl3dDriving(updatemmi,sound) {
var sectionlist = null;
var materials = null;
var actions = null;
var rails = null;
var links = null;
var scenes = null;
var code = null;
@ -52,7 +55,8 @@ export function Jl3dDriving(updatemmi,sound) {
materials = materiallist;
scenes = scene;
actions = nowaction;
links = this.map.linklist;
rails = this.map.rails;
};
this.initdrivercode = function(code) {
@ -98,16 +102,16 @@ export function Jl3dDriving(updatemmi,sound) {
//
// }
switch (data.type) {
case 'Simulation_Driver_Change':
drivingcode = data.body.code;
// sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
break;
case 'Simulation_TrainSpeed':
trainspeed(data);
break;
case 'Simulation_Drive_Data_Routing':
updatemmi.updatedrivedata(data.body);
break;
case 'Simulation_Driver_Change':
drivingcode = data.body.code;
sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
break;
case 'SJL3D_TrainStatus':
trainstatus(data);
@ -153,13 +157,13 @@ export function Jl3dDriving(updatemmi,sound) {
if (trainlisttest.list[code].runMode == '02') {
if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/19.5/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20.3/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
}
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
}
if (code == drivingcode) {
@ -168,6 +172,8 @@ export function Jl3dDriving(updatemmi,sound) {
// } else {
updatemmi.updatenowspeed(Math.abs(data.body[tl].v));
// console.log(data.body[i]);
// }
}
}
@ -189,6 +195,25 @@ export function Jl3dDriving(updatemmi,sound) {
} else {
updatemmi.updateatospeed(-1);
}
if(trainlisttest.list[code].progress<1){
let syncdata = {
type: 'Train',
code: code,
linkCode: trainlisttest.list[code].nowcode,
percent: 0
};
if (trainlisttest.list[code].status == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
// console.log(syncdata);
// console.log(trainlisttest.list[code].nextcurve);
// console.log("=============");
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
}
}
}
@ -208,29 +233,6 @@ export function Jl3dDriving(updatemmi,sound) {
//更新车组号
updatemmi.updatetrainnum(data.body[i].groupNumber);
//更新列车
let syncdata = {
type: 'Train',
code: code,
sectionCode: data.body[i].sectionCode,
percent: 0
};
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
if (data.body[i].directionType == '02') {
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
} else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
}
//scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
} else {
if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
//scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
if (data.body[i].parkRemainTime>0) {
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
} else {
@ -304,91 +306,49 @@ export function Jl3dDriving(updatemmi,sound) {
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
if (rails.linkrail[data.body[i].linkCode]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
trainlisttest.list[code].progress = 0;
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
trainlisttest.list[code].dispose = false;
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
trainlisttest.list[code].nowcode = data.body[i].linkCode;
let vexlist = [];
let endrotation = null;
if (data.body[i].directionType == '02') { // 向右
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
trainlisttest.list[code].children[tl].position.z = point.z;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].status = '02';
trainlisttest.list[code].progress = data.body[i].sectionOffsetPercent;
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].dispose = false;
trainlisttest.group.add(trainlisttest.list[code]);
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
trainlisttest.list[code].children[tl].position.z = -point.z;
}
// if(trainlisttest.list[code].rname == "006"){
// console.log("0000000000000000");
// console.log(data.body[i].linkOffsetPercent);
// }
trainlisttest.list[code].status = '03';
trainlisttest.list[code].progress = 1-data.body[i].sectionOffsetPercent;
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
if(data.body[i].speed == 0){
@ -397,9 +357,10 @@ export function Jl3dDriving(updatemmi,sound) {
// trainlisttest.list[code].startmark = 1;
}else{
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/22/trainlisttest.list[code].len);
}
}
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
@ -415,7 +376,7 @@ export function Jl3dDriving(updatemmi,sound) {
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
if (rails.linkrail[data.body[i].linkCode]) {
if (driverswitch == '02' && code == drivingcode) {
updatemmi.updatenowspeed(data.body[i].speed);
if (data.body[i].atpSpeed) {
@ -433,8 +394,19 @@ export function Jl3dDriving(updatemmi,sound) {
} else {
updatemmi.updatenowlen(0);
}
// if(trainlisttest.list[code].isStandTrack == true){
// pointstand = null;
// if(data.body[i].directionType == "02"){
// pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent);
// }else{
// pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent);
// }
// console.log(data.body[i].sectionOffsetPercent)
// console.log(pointstand.x);
//
// trainlisttest.list[code].position.x = pointstand.x;
// }
}
if (driverswitch == '05' && code == drivingcode) {
if (data.body[i].maLen) {
updatemmi.updatenowlen(data.body[i].maLen);
@ -442,15 +414,10 @@ export function Jl3dDriving(updatemmi,sound) {
updatemmi.updatenowlen(0);
}
}
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode) {
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
const vexlist = [];
const endrotation = null;
if (data.body[i].directionType == '02') { // 向右
if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
trainlisttest.list[code].rotation.y = 0;
@ -458,126 +425,110 @@ export function Jl3dDriving(updatemmi,sound) {
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if(data.body[i].speed > 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}else if(data.body[i].speed < 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
} else {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
}
}
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
trainlisttest.list[code].nextcurve = null;
}
trainlisttest.list[code].status = '02';
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
} else if (data.body[i].directionType == '03') { // 向左
if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if(data.body[i].speed > 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}else if(data.body[i].speed < 0){
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
}
}
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
trainlisttest.list[code].nextcurve = null;
}
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
}
// console.log(data.body[i].directionType);
// console.log(data.body[i].linkCode);
// console.log(rails.linkrail[data.body[i].linkCode].lengthfact);
// console.log(rails.linkrail[data.body[i].linkCode].lconnect);
// console.log(rails.linkrail[data.body[i].linkCode].rconnect);
// console.log("--------------------");
// console.log(rails.linkrail[rails.linkrail[data.body[i].linkCode].lconnect].lconnect);
// console.log(rails.linkrail[rails.linkrail[data.body[i].linkCode].lconnect].rconnect);
// console.log("---------------------");
// console.log(trainlisttest.list[code].curve.points);
// console.log(rails.linkrail[nextcode].lineleft.points);
// console.log("***********************");
// console.log(rails.linkrail[nextcode].lineleft.points);
if(code == drivingcode){
let nextcode;
if(data.body[i].directionType == '02'){
trainlisttest.list[code].status = '02';
nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}else if(data.body[i].directionType == '03'){
trainlisttest.list[code].status = '03';
}
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
trainlisttest.list[code].speed = data.body[i].speed;
if(data.body[i].speed>0){
trainlisttest.list[code].progress = 0;
}else if(data.body[i].speed<0){
trainlisttest.list[code].progress = 0.999;
}
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].nextcode = nextcode;
// console.log(trainlisttest.list[code].nowcode);
// console.log(trainlisttest.list[code].nextcode);
// console.log(trainlisttest.list[code].curve.points);
// console.log(trainlisttest.list[code].nextcurve.points);
// console.log("=========================");
}else{
let nextcode;
if(data.body[i].directionType == '02'){
if(rails.linkrail[data.body[i].linkCode].lineleft){
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/21/trainlisttest.list[code].len);
}
}else if(data.body[i].directionType == '03'){
if(rails.linkrail[data.body[i].linkCode].lineright){
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/21/trainlisttest.list[code].len);
}
}
trainlisttest.list[code].nextcode = nextcode;
}
// console.log(data.body[i].linkOffsetPercent);
// console.log(trainlisttest.list[code].progress);
// console.log(trainlisttest.list[code].curve.points);
// console.log(trainlisttest.list[code].nextcurve.points);
// console.log(trainlisttest.list[code].len);
// console.log(trainlisttest.list[code].nextlen);
// console.log("==========================================");
}
}
}
@ -734,9 +685,11 @@ export function Jl3dDriving(updatemmi,sound) {
function switchupdate(data) {
code = data.code;
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
if (sectionlist.switchs.modellist[j].code == code) {
if (sectionlist.switchs.modellist[j].locateType != data.locateType) {
if (rails.switchrail[code]) {
if (rails.switchrail[code].locateType != data.locateType) {
// console.log("道岔变化:"+code);
if (data.locateType == '02') {
// console.log("02 反位");
if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType;
actions[sectionlist.switchs.modellist[j].code].reset();
@ -744,7 +697,26 @@ export function Jl3dDriving(updatemmi,sound) {
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
actions[sectionlist.switchs.modellist[j].code].play();
}
rails.switchrail[code].locateType = "02";
let testswitch = rails.switchrail[code];
if(rails.switchrail[code].directtype == "1"){
// console.log("道岔朝向1向左");
// console.log("aleft:"+testswitch.clink);
// console.log("cright:"+testswitch.alink);
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
// console.log("道岔朝向2向右");
// console.log("aright:"+testswitch.clink);
// console.log("cleft:"+testswitch.alink);
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
}
} else if (data.locateType == '01') {
// console.log("01 定位");
if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType;
actions[sectionlist.switchs.modellist[j].code].reset();
@ -752,6 +724,23 @@ export function Jl3dDriving(updatemmi,sound) {
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
actions[sectionlist.switchs.modellist[j].code].play();
}
rails.switchrail[code].locateType = "01";
let testswitch = rails.switchrail[code];
if(rails.switchrail[code].directtype == "1"){
// console.log("道岔朝向1向左");
// console.log("aleft"+testswitch.blink);
// console.log("cright:"+testswitch.alink);
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
// console.log("道岔朝向2向右");
// console.log("aright:"+testswitch.blink);
// console.log("cleft:"+testswitch.alink);
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
}
}
}
j = 0;

View File

@ -4,7 +4,7 @@ export function UpdateTrain(camera,traindata,control){
for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件
//if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].progress != null){
@ -12,22 +12,26 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null;
if(traindata.group.children[j].progress<1){
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
let movecurve = trainmodel.curve;
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
@ -48,7 +52,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -56,7 +60,7 @@ export function UpdateTrain(camera,traindata,control){
}
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -74,16 +78,19 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
@ -103,7 +110,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -112,7 +119,7 @@ export function UpdateTrain(camera,traindata,control){
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -127,32 +134,62 @@ export function UpdateTrain(camera,traindata,control){
}
// console.log(trainmodel.rotalist);
}
trainmodel.progress += trainmodel.speeds;
}
}
}else{
if(trainmodel.nextcurve){
// if(trainmodel.status == '02'){
// }else if(trainmodel.status == '03'){
// }
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
trainmodel.nowcode = trainmodel.nextcode;
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/21/trainmodel.len);
trainmodel.curve = trainmodel.nextcurve;
trainmodel.nextcurve = null;
trainmodel.nextlen = null;
trainmodel.nextcode = null;
}
// console.log(trainmodel.name);
// console.log(trainmodel.progress);
// console.log(trainmodel.nextcurve);
// if(trainmodel.status == "02"){
// trainmodel.progress = 0;
// }else if(trainmodel.status == "03"){
// trainmodel.progress = 1;
// }
// trainmodel.curve = trainmodel.nextcurve;
}
}else if(trainmodel.speeds < 0 && trainmodel.speeds){
let speed = null;
if(traindata.group.children[j].progress<1){
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
let movecurve = trainmodel.curve;
if(trainmodel.status == "03" && trainmodel.progress>0){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
@ -173,7 +210,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -181,7 +218,7 @@ export function UpdateTrain(camera,traindata,control){
}
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -203,16 +240,18 @@ export function UpdateTrain(camera,traindata,control){
if(movecurve.points.length>1 && trainmodel.progress>0){
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
@ -232,7 +271,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -241,7 +280,7 @@ export function UpdateTrain(camera,traindata,control){
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -257,7 +296,7 @@ export function UpdateTrain(camera,traindata,control){
// console.log(trainmodel.rotalist);
}
console.log(trainmodel.nextcurve);
if(trainmodel.progress > -(trainmodel.speeds)){
trainmodel.progress += trainmodel.speeds;
}
@ -269,7 +308,7 @@ export function UpdateTrain(camera,traindata,control){
}
//}
}
}

View File

@ -19,6 +19,9 @@ export function Jlmap3dSubscribe(jlmap3d) {
var sectionlist = null;
var materials = null;
var actions = null;
var rails = null;
var links = null;
var scenes = null;
var code = null;
@ -52,6 +55,8 @@ export function Jlmap3dSubscribe(jlmap3d) {
materials = materiallist;
scenes = scene;
actions = nowaction;
links = this.map.linklist;
rails = this.map.rails;
};
@ -111,11 +116,11 @@ export function Jlmap3dSubscribe(jlmap3d) {
if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/17/trainlisttest.list[code].len);
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
}
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
}
if (code == drivingcode) {
@ -150,30 +155,31 @@ export function Jlmap3dSubscribe(jlmap3d) {
if ( trainlisttest.list[code]) {
if (code == drivingcode) {
driverswitch = data.body[i].runMode;
//更新车组号
jlmap3d.updatetrainnum(data.body[i].groupNumber);
// console.log(trainlisttest.list[code].progress);
const syncdata = {
//更新列车
let syncdata = {
type: 'Train',
code: code,
sectionCode: data.body[i].sectionCode,
percent: 0
};
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
if (data.body[i].directionType == '02') {
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
} else {
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
}
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
} else {
if (data.body[i].directionType == '02') {
syncdata.percent = trainlisttest.list[code].progress;
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
// if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
// if (data.body[i].directionType == '02') {
// syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
// } else {
// syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
// }
// scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
// } else {
// if (data.body[i].directionType == '02') {
// syncdata.percent = trainlisttest.list[code].progress;
// } else {
// syncdata.percent = 1 - trainlisttest.list[code].progress;
// }
// scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
// }
if (data.body[i].parkRemainTime>0) {
jlmap3d.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
@ -181,21 +187,21 @@ export function Jlmap3dSubscribe(jlmap3d) {
if (data.body[i].runMode == '02') {
jlmap3d.updatestoptime('列车自动驾驶中');
} else {
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
// if(stoptimer){
//
// }else{
// stoptimer = setInterval(function(){
// if(num >=0){
// jlmap3d.updatestoptime("停站时间:"+num);
// num --;
// }
// },1000);
// }
} else {
jlmap3d.updatestoptime('列车人工驾驶中');
}
// if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
// // if(stoptimer){
// //
// // }else{
// // stoptimer = setInterval(function(){
// // if(num >=0){
// // jlmap3d.updatestoptime("停站时间:"+num);
// // num --;
// // }
// // },1000);
// // }
//
// } else {
// jlmap3d.updatestoptime('列车人工驾驶中');
// }
}
}
@ -252,106 +258,53 @@ export function Jlmap3dSubscribe(jlmap3d) {
// }
// }
// 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
if (rails.linkrail[data.body[i].linkCode]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
trainlisttest.list[code].progress = 0;
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
trainlisttest.list[code].oldoffset = data.body[i].linkOffsetPercent;
trainlisttest.list[code].dispose = false;
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
let vexlist = [];
let endrotation = null;
if (data.body[i].directionType == '02') { // 向右
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
trainlisttest.list[code].children[tl].position.z = point.z;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
trainlisttest.list[code].status = '02';
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].dispose = false;
trainlisttest.group.add(trainlisttest.list[code]);
let offset = null;
let rotaposx = null;
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
} else {
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
}
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].children[tl].position.z = -point.z;
}
// if(trainlisttest.list[code].rname == "006"){
// console.log("0000000000000000");
// console.log(data.body[i].linkOffsetPercent);
// }
trainlisttest.list[code].status = '03';
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].progress = 0;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
// trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
if(data.body[i].speed == 0){
@ -360,7 +313,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
// trainlisttest.list[code].startmark = 1;
}else{
trainlisttest.list[code].speeds = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/21/trainlisttest.list[code].len);
}
}
@ -377,7 +330,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
if (rails.linkrail[data.body[i].linkCode]) {
if (driverswitch == '02' && code == drivingcode) {
jlmap3d.updatenowspeed(data.body[i].speed);
if (data.body[i].atpSpeed) {
@ -415,13 +368,11 @@ export function Jlmap3dSubscribe(jlmap3d) {
jlmap3d.updatenowlen(0);
}
}
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
const vexlist = [];
const endrotation = null;
if(trainlisttest.list[code].nowcode != data.body[i].linkCode){
trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
if (data.body[i].directionType == '02') { // 向右
trainlisttest.list[code].progress = 0;
if (trainlisttest.list[code].status != data.body[i].directionType) {
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
@ -430,81 +381,52 @@ export function Jlmap3dSubscribe(jlmap3d) {
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
}
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].progress = 0;
if (trainlisttest.list[code].status != data.body[i].directionType) {
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = rotaposx;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
} else {
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
}
} else {
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
} else {
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
}
}
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
}
trainlisttest.list[code].status = '03';
}
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
trainlisttest.list[code].progress = 0;
trainlisttest.list[code].speed = data.body[i].speed;
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
// console.log(rails.linkrail[data.body[i].linkCode]);
// console.log(data.body[i].linkCode)
// console.log(nextcode);
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
}
if(data.body[i].directionType == '02'){
let nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
}
}else if(data.body[i].directionType == '03'){
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
}
}
}
}
}
@ -514,6 +436,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
}
if (data.type == 'Simulation_DeviceStatus') {
for (let i=data.body.length-1; i>=0; i--) {
// 0xFFFFFF
// 0xCD0000 红
@ -663,8 +586,8 @@ export function Jlmap3dSubscribe(jlmap3d) {
function switchupdate(data) {
code = data.code;
for (let j=sectionlist.switchs.modellist.length-1; j>=0; j--) {
if (sectionlist.switchs.modellist[j].code == code) {
if (sectionlist.switchs.modellist[j].locateType != data.locateType) {
if (rails.switchrail[code]) {
if (rails.switchrail[code].locateType != data.locateType) {
if (data.locateType == '02') {
if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType;
@ -673,6 +596,21 @@ export function Jlmap3dSubscribe(jlmap3d) {
actions[sectionlist.switchs.modellist[j].code].timeScale = 1;
actions[sectionlist.switchs.modellist[j].code].play();
}
rails.switchrail[code].locateType = "02";
let testswitch = rails.switchrail[code];
// console.log(testswitch);
// console.log(rails.linkrail[testswitch.alink]);
// console.log(rails.linkrail[testswitch.clink]);
if(rails.switchrail[code].directtype == "1"){
rails.linkrail[testswitch.alink].lconnect = testswitch.clink;
rails.linkrail[testswitch.clink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
rails.linkrail[testswitch.alink].rconnect = testswitch.clink;
rails.linkrail[testswitch.clink].lconnect = testswitch.alink;
}
} else if (data.locateType == '01') {
if (actions[sectionlist.switchs.modellist[j].code]) {
sectionlist.switchs.modellist[j].locateType = data.locateType;
@ -681,6 +619,20 @@ export function Jlmap3dSubscribe(jlmap3d) {
actions[sectionlist.switchs.modellist[j].code].timeScale = -1;
actions[sectionlist.switchs.modellist[j].code].play();
}
rails.switchrail[code].locateType = "01";
let testswitch = rails.switchrail[code];
console.log(testswitch);
console.log(rails.linkrail[testswitch.alink]);
console.log(rails.linkrail[testswitch.clink]);
if(rails.switchrail[code].directtype == "1"){
rails.linkrail[testswitch.alink].lconnect = testswitch.blink;
rails.linkrail[testswitch.blink].rconnect = testswitch.alink;
}else if(rails.switchrail[code].directtype == "2"){
rails.linkrail[testswitch.alink].rconnect = testswitch.blink;
rails.linkrail[testswitch.blink].lconnect = testswitch.alink;
}
}
}
j = 0;

View File

@ -17,7 +17,6 @@ import { SetRender } from '@/jlmap3d/config/SetRender';
import { SetScene } from '@/jlmap3d/config/SetScene';
import { SetLights } from '@/jlmap3d/config/SetLights';
//controls
import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { DragControls } from '@/jlmap3d/main/control/DragControls';
@ -29,15 +28,15 @@ import {Jlmap3dSubscribe } from '@/jlmap3d/jl3dsimulation/connect/TrainingConnec
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
//utils
import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
//import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrainTest';
// import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrain';
import { UpdateTrain } from '@/jlmap3d/main/utils/UpdateTrainTest';
// import { ReStart } from '@/jlmap3d/main/utils/ReStart';
import {Stats} from '@/jlmap3d/main/lib/stats.min.js';
var clock = new THREE.Clock();
export function JLmap3d(dom, data,skinCode) {
export function JLmap3d(dom, data,skinCode,storemod) {
let scope = this;
@ -55,7 +54,6 @@ export function JLmap3d(dom, data,skinCode) {
//定义场景(渲染容器)
let scene = SetScene();
//定义镜头操作
console.log(THREE.OrbitControls);
let controls = new THREE.OrbitControls(camera);
controls.maxPolarAngle = Math.PI/2;
//controls.minPolarAngle = Math.PI/8;
@ -83,14 +81,13 @@ export function JLmap3d(dom, data,skinCode) {
this.Subscribe = new Jlmap3dSubscribe(this.webwork);
//连接到通信
//console.log(this.Subscribe.config);
//this.webwork.postMessage(this.Subscribe.teststomp);
this.Subscribe.socketon(scope.Subscribe.topic);
//初始化加载数据和模型
getPublish3dMapDetail(skinCode).then(netdata => {
ModelLoad(data,scope,netdata.data,mapdata,camera,controls,scene);
ModelLoad(data,scope,netdata.data,mapdata,camera,controls,scene,storemod);
});
//
// let stats = new Stats();

View File

@ -142,7 +142,7 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) {
// _movemesh.geometry.computeBoundingBox();
_movemesh.geometry.computeBoundingSphere();
_movemesh.geometry.center();
_movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+20.5;
_movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+28;
// testmesh2.position.z = 50;
// testmesh2.geometry.center();

View File

@ -9,7 +9,7 @@ let defaultsignal = {
deviceType:"signal",
type:"low",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/signal/d3d.FBX"
assetUrl:"https://test.joylink.club/oss/models/signal/d3d.FBX"
}
let defaulttrain = {
@ -18,7 +18,7 @@ let defaulttrain = {
deviceType:"train",
type:"num4",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/train/train.FBX"
assetUrl:"https://test.joylink.club/oss/models/train/train.FBX"
}
@ -28,8 +28,10 @@ let defaultstation = {
deviceType:"stand",
type:"num4",
picUrl:"",
assetUrl:"../../static/model/station/fuzhou.FBX"
}//https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX
assetUrl:"https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX"
}
//https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX
//https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX
//../../static/model/station/zhantai715(2).FBX
let defaultswitch = {
@ -38,7 +40,7 @@ let defaultswitch = {
deviceType:"switch",
type:"fuzhou",
picUrl:"",
assetUrl:"../../static/model/daocha/daocha.FBX"
assetUrl:"https://test.joylink.club/oss/models/daocha/daocha.FBX"
}
let defaultdriver = {
@ -56,8 +58,10 @@ let defaultsuidao = {
deviceType:"suidao",
type:"suidao",
picUrl:"",
assetUrl:"https://joylink.club/oss/models/suidao/suidao.FBX"
}//https://joylink.club/oss/models/suidao/suidao.FBX
assetUrl:"https://test.joylink.club/oss/models/suidao/suidao.FBX"
}
//https://test.joylink.club/oss/models/suidao/suidao.FBX
//https://joylink.club/oss/models/suidao/suidao.FBX
//../../static/model/
let defaultautorail = {
@ -75,7 +79,7 @@ let defaultautosuidao = {
deviceType:"autosuidao",
type:"autosuidao",
picUrl:"",
assetUrl:"../../static/model/auto/suidao.FBX"
assetUrl:"https://test.joylink.club/oss/models/auto/suidao.FBX"
}
let autoswitch1 = {
@ -84,7 +88,7 @@ let autoswitch1 = {
deviceType:"autoswitch1",
type:"fuzhou",
picUrl:"",
assetUrl:"../../static/model/auto/switch1.FBX"
assetUrl:"https://test.joylink.club/oss/models/auto/switch1.FBX"
}
let autoswitch2 = {
@ -93,7 +97,7 @@ let autoswitch2 = {
deviceType:"autoswitch2",
type:"fuzhou",
picUrl:"",
assetUrl:"../../static/model/auto/switch2.FBX"
assetUrl:"https://test.joylink.club/oss/models/auto/switch2.FBX"
}
export function AssetLoader(){
@ -107,7 +111,7 @@ export function AssetLoader(){
this.materiallist = [];
//初始化资源加载器
this.setmodellist = function (data){
// console.log("setmodellist");
let defaultmodel1 = new AssetModel(defaultsignal);
scope.modellist.push(defaultmodel1);
@ -129,7 +133,6 @@ export function AssetLoader(){
let defaultswitch2 = new AssetModel(autoswitch2);
scope.modellist.push(defaultswitch2);
let modeldata = JSON.parse(data);
for(let j=0;j<modeldata.length;j++){
@ -444,10 +447,9 @@ export function AssetLoader(){
var loader = new THREE.FBXLoader();
loader.load( asset.assetUrl, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
// object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true;
//
// });
//object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true;
//});
if(asset.deviceType == "train"){
@ -456,7 +458,7 @@ export function AssetLoader(){
let name = "c"+j;
for(let i=0;i<object.children.length;i++){
if(object.children[i].name == name){
object.children[i].position.x = object.children[i].position.x+38.1;
object.children[i].position.x = object.children[i].position.x;
//object.children[i].position.y = j*10;
realtrain.add(object.children[i]);
i--;

View File

@ -4,13 +4,15 @@ import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
import {RailList} from '@/jlmap3d/main/model/RailList.js';
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,storemod){
//console.log(mapdata);
Materialload(scope);
//console.log(data);
@ -28,13 +30,13 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
let isSection = false;
if(netdata.assets){
let assetsdata = JSON.parse(netdata.assets);
for(let i=0;i<assetsdata.length;i++){
if(assetsdata[i].deviceType == "mapSection"){
isSection = true;
}
let assetsdata = JSON.parse(netdata.sections);
if(assetsdata.link){
isSection = true;
}
}
if(isSection == true){
init3d(data,netdata);
}else{
@ -48,7 +50,9 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
// console.log(data);
//初始化轨道和道岔 暂时
lengthfact(data);
jlmap3ddata.linklist = new LinkList();
jlmap3ddata.sectionlist = new SectionList();
//初始化信号机
jlmap3ddata.signallist = new SignalList();
//初始化站台
jlmap3ddata.stationstandlist = new StationStandList();
@ -56,10 +60,19 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
jlmap3ddata.trainlisttest = new TrainList();
jlmap3ddata.realsectionlist = new RealSectionList();
jlmap3ddata.rails = new RailList();
let loaderdata = JSON.parse(netdata.sections);
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
// console.log(netdata.assets);
assetloader.setmodellist(netdata.assets);
assetloader.assetpromise(sceneload)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
@ -71,53 +84,31 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.initpromise(mapdata.sectionList,mapdata.switchList,sceneload);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
})
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
// })
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
})
.then(function(data){
return new Promise(function(resolve, reject){
let loader = new THREE.OBJLoader( );
loader.load( '../../static/rail/fuzhoupath.obj', function ( obj ) {
let object = obj;
//console.log(object.children.length);
let rail = [];
for(let i=0;i<object.children.length;i++){
let name = object.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
let vexlist = [];
//console.log( object.children[i].geometry.attributes.position.array);
for(let j=0;j<object.children[i].geometry.attributes.position.array.length;j){
//console.log(object.children[i].geometry.attributes.position.array[j]);
let ved = new THREE.Vector3( object.children[i].geometry.attributes.position.array[j], object.children[i].geometry.attributes.position.array[j+1], object.children[i].geometry.attributes.position.array[j+2] );
j=j+3;
vexlist.push(ved);
}
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname].code){
jlmap3ddata.sectionlist.sections.datalist[newmeshname].rail = vexlist;
//console.log(jlmap3ddata.sectionlist.sections.datalist[n].rail.length);
}
}
resolve("loadedrealsection");
}, onProgress, onError );
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
resolve("loadrail");
});
})
.then(function(data){
// for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
// if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// // scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
// console.log(scope.assetloader.modellist[mn].mesh.position);
// scene.add(scope.assetloader.modellist[mn].mesh);
// }
// }
scope.animateswitch = true;

View File

@ -4,13 +4,15 @@ import {SignalList} from '@/jlmap3d/main/model/SignalList.js';
import {StationStandList} from '@/jlmap3d/main/model/StationStandList.js';
import {TrainList} from '@/jlmap3d/main/model/TrainList.js';
import {RealSectionList} from '@/jlmap3d/main/model/RealSectionList.js';
import {LinkList} from '@/jlmap3d/main/model/LinkList.js';
import {RailList} from '@/jlmap3d/main/model/RailList.js';
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss){
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss,storemod){
//console.log(mapdata);
Materialload(scope);
//console.log(data);
@ -27,12 +29,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
let isSection = false;
if(netdata.assets){
let assetsdata = JSON.parse(netdata.assets);
for(let i=0;i<assetsdata.length;i++){
if(assetsdata[i].deviceType == "mapSection"){
isSection = true;
}
let assetsdata = JSON.parse(netdata.sections);
// console.log(netdata);
if(assetsdata.link){
isSection = true;
}
}
if(isSection == true){
@ -48,6 +50,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
// console.log(data);
//初始化轨道和道岔 暂时
lengthfact(data);
jlmap3ddata.linklist = new LinkList();
jlmap3ddata.sectionlist = new SectionList();
jlmap3ddata.signallist = new SignalList();
//初始化站台
@ -56,10 +59,18 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
jlmap3ddata.trainlisttest = new TrainList();
jlmap3ddata.realsectionlist = new RealSectionList();
jlmap3ddata.rails = new RailList();
let loaderdata = JSON.parse(netdata.sections);
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
assetloader.setmodellist(netdata.assets);
assetloader.assetpromise(sceneload)
.then(function(data){
//console.log(data);
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
@ -71,64 +82,34 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
})
.then(function(data){
//console.log(data);
return jlmap3ddata.sectionlist.initpromise(mapdata.sectionList,mapdata.switchList,sceneload);
})
.then(function(data){
//console.log(data);
return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
})
// .then(function(data){
// //console.log(data);
// return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,sceneload,assetloader,mixers,actions);
// })
.then(function(data){
//console.log(data);
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
})
.then(function(data){
return new Promise(function(resolve, reject){
let loader = new THREE.OBJLoader( );
loader.load( '../../static/rail/fuzhoupath.obj', function ( obj ) {
let object = obj;
//console.log(object.children.length);
let rail = [];
for(let i=0;i<object.children.length;i++){
let name = object.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
let vexlist = [];
//console.log( object.children[i].geometry.attributes.position.array);
for(let j=0;j<object.children[i].geometry.attributes.position.array.length;j){
//console.log(object.children[i].geometry.attributes.position.array[j]);
let ved = new THREE.Vector3( object.children[i].geometry.attributes.position.array[j], object.children[i].geometry.attributes.position.array[j+1], object.children[i].geometry.attributes.position.array[j+2] );
j=j+3;
vexlist.push(ved);
}
if(jlmap3ddata.sectionlist.sections.datalist[newmeshname].code){
jlmap3ddata.sectionlist.sections.datalist[newmeshname].rail = vexlist;
//console.log(jlmap3ddata.sectionlist.sections.datalist[n].rail.length);
}
}
resolve("loadedrealsection");
}, onProgress, onError );
jlmap3ddata.rails.init(loaderdata.link,switchdata,sceneload,storemod);
resolve("loadrail");
});
})
.then(function(data){
.then(function(data){
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "驾驶台"){
scope.assetloader.modellist[mn].mesh.position.y = -50000;
scene.add(scope.assetloader.modellist[mn].mesh);
}
if(scope.assetloader.modellist[mn].name && scope.assetloader.modellist[mn].name == "suidao"){
// scope.assetloader.modellist[mn].mesh.rotation.x = Math.PI/2;
scope.assetloader.modellist[mn].mesh.position.y -=0.1;
scene.add(scope.assetloader.modellist[mn].mesh);
}
}
scope.animateswitch = true;
mapdata = jlmap3ddata;

View File

@ -0,0 +1,309 @@
export function LinkList(data){
let scope = this;
this.type = "linklist";
this.linkdata = [];
this.linksgroup = new THREE.Group();
this.linksgroup.name = "link";
this.initpromise = function(linkdata,scene,assetloader){
return new Promise(function(resolve, reject){
linkhelp(linkdata,scene);
scene.add(scope.linksgroup);
linktest(linkdata,scene,assetloader);
resolve("loadedrealsection");
});
};
this.loadpromise = function(linkdata,scene,assetloader){
return new Promise(function(resolve, reject){
scene.add(scope.linksgroup);
loadlink(linkdata,scene,assetloader);
resolve("loadedrealsection");
});
};
function linkhelp(data,scene){
let groups = new THREE.Group();
for(let i=0;i<data.length;i++){
let lineGeometry = new THREE.Geometry();//生成几何体
lineGeometry.vertices.push(new THREE.Vector3(data[i].lp.x, 1, data[i].lp.y));//线段的两个顶点
lineGeometry.vertices.push(new THREE.Vector3(data[i].rp.x, 1, data[i].rp.y));
let line = new THREE.Line(lineGeometry, new THREE.LineDashedMaterial({
color: 0xffffff,//线段的颜色
dashSize: 1,//短划线的大小
gapSize: 3//短划线之间的距离
}));
line.name = data[i].code;
line.lengthFact = data[i].lengthFact;
line.lp = data[i].lp;
line.rp = data[i].rp;
line.distancex = data[i].rp.x-data[i].lp.x;
line.distancey = data[i].rp.y-data[i].lp.y;
line.computeLineDistances();//不可或缺的,若无,则线段不能显示为虚线
groups.add(line);
}
groups.position.z = 2000;
scene.add(groups);
}
function loadlink(data,scene,assetloader){
let autorail;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let count = autorail.geometry.attributes.position.count;
let rightlist = [];
let leftlist = [];
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
for(let i=0;i<data.length;i++){
let testmesh2 = autorail.clone(true);
testmesh2.code = data[i].code;
testmesh2.name = data[i].name;
testmesh2.rightlist = rightlist;
testmesh2.leftlist = leftlist;
testmesh2.rp = data[i].rp;
testmesh2.lp = data[i].lp;
testmesh2.lengthfact = data[i].lengthfact;
for(let i=0;i<testmesh2.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
testmesh2.geometry.attributes.uv.array[testmesh2.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
testmesh2.position.x = data[i].position.x;
testmesh2.position.y = data[i].position.y;
testmesh2.position.z = data[i].position.z;
// testmesh2.rotation.x = data[i].rotation._x;
// testmesh2.rotation.y = data[i].rotation._y;
testmesh2.rotation.z = data[i].rotation._z;
scope.linkdata.push(testmesh2);
scope.linksgroup.add(testmesh2);
}
}
// return linklist;
function linktest(data,scene,assetloader){
let autorail = null;
let autosuidao = null;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autorail"){
autorail = assetloader.modellist[i].mesh.children[0];
}
}
let rightlist = [];
let leftlist = [];
let count = autorail.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autorail.geometry.attributes.position.array[i*3] >0.49){
rightlist.push(i);
}
if(autorail.geometry.attributes.position.array[i*3] <-0.49){
leftlist.push(i);
}
}
autorail.rightlist = rightlist;
autorail.leftlist = leftlist;
let reallinks = [];
let testlink;
testlink = data;
if(data){
let index,startdata;
for(let n=0;n<data.length;n++){
if(data[n].leftFdCode == undefined && data[n].leftSdCode == undefined && data[n].rightFdCode ){
if(startdata){
if(data[n].lp.x<startdata.lp.x){
startdata = data[n];
index = n;
}
}else{
startdata = data[n];
index = n;
}
}
}
buildmodel(startdata);
reallinks.push(startdata);
data.splice(index,1);
for(let i=0;i<reallinks.length;i++){
for(let j=0;j<data.length;j++){
if(reallinks[i].leftFdCode && j>=0){
if(reallinks[i].leftFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].leftSdCode && j>=0){
if(reallinks[i].leftSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"left");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightFdCode && j>=0){
if(reallinks[i].rightFdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
if(reallinks[i].rightSdCode && j>=0){
if(reallinks[i].rightSdCode == data[j].code){
buildmodel(data[j],reallinks[i],j,"right");
reallinks.push(data[j]);
data.splice(j,1);
j--;
}
}
}
}
function buildmodel(data,mdata,sx,direct){
let len = data.lengthFact;
let testmesh2 = autorail.clone(true);
for(let i=0;i<autorail.rightlist.length;i++){
testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len-25;
testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
}
let newrail = new THREE.BufferGeometry();
newrail.copy(testmesh2.geometry);
testmesh2.geometry = newrail;
testmesh2.geometry.attributes.position.needsUpdate = true;
testmesh2.geometry.attributes.uv.needsUpdate = true;
testmesh2.geometry.computeBoundingSphere();
testmesh2.geometry.center();
// data.lp.y *= 10;
// data.rp.y *= 10;
if(mdata){
if(direct == "left"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.lp.x = (data.lp.x-data.rp.x)*data.lengthFact/distance+mdata.lp.x;
data.lp.y = (data.lp.y-data.rp.y)*data.lengthFact/distance+mdata.lp.y;
data.rp.x = mdata.lp.x;
data.rp.y = mdata.lp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else{
testmesh2.rotation.z = rotenum;
}
testmesh2.position.x = (data.rp.x + data.lp.x)/2;
testmesh2.position.z = (data.rp.y + data.lp.y)/2;
}
if(direct == "right"){
let dx = Math.abs(data.lp.x - data.rp.x);
    let dy = Math.abs(data.lp.y - data.rp.y);
    let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
data.rp.x = (data.rp.x-data.lp.x)*data.lengthFact/distance+mdata.rp.x;
data.rp.y = (data.rp.y-data.lp.y)*data.lengthFact/distance+mdata.rp.y;
data.lp.x = mdata.rp.x;
data.lp.y = mdata.rp.y;
let axix = new THREE.Vector3(1,0,0);
let axixnow = new THREE.Vector3(data.rp.x-data.lp.x,0,data.rp.y-data.lp.y);
let rotenum = axixnow.angleTo(axix);
//不同坐标系方向值不同
if(data.lp.y>data.rp.y){
testmesh2.rotation.z = 0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}else if(data.lp.y<data.rp.y){
testmesh2.rotation.z = -0.218;
data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z);
data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z);
}
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
}else{
data.lp.x = data.lp.x;
data.rp.x = data.lp.x + data.lengthFact;
testmesh2.position.x = (data.lp.x + data.rp.x)/2;
testmesh2.position.z = (data.lp.y + data.rp.y)/2;
}
// testmesh2.position.y = 10;
testmesh2.code = data.code;
testmesh2.name = data.name;
testmesh2.meshtype = "link";
testmesh2.lp = data.lp;
testmesh2.rp = data.rp;
testmesh2.rightlist = autorail.rightlist;
testmesh2.leftlist = autorail.leftlist;
testmesh2.lengthfact = data.lengthFact;
scope.linksgroup.add( testmesh2 );
scope.linkdata.push(testmesh2);
}
}
}
}

View File

@ -0,0 +1,149 @@
export function RailList(){
let scope = this;
this.linkrail = [];
this.switchrail = [];
this.setrail = function(){
};
this.init = function(linkdata,switchdata,scene,storemod){
for(let i=0;i<linkdata.length;i++){
scope.linkrail[linkdata[i].code] = {
lp:linkdata[i].rail[0],
rp:linkdata[i].rail[1],
lconnect:null,
rconnect:null,
lengthfact:linkdata[i].lengthfact,
lineleft:null,
lineright:null,
points:[],
type:null
};
if(linkdata[i].rotation._z == 0){
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2,0,scope.linkrail[linkdata[i].code].lp.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2,0,scope.linkrail[linkdata[i].code].rp.z));
scope.linkrail[linkdata[i].code].type = 0;
}else{
if(linkdata[i].rotation._z>0){
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2.1,0,scope.linkrail[linkdata[i].code].lp.z-0.6));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.1,0,scope.linkrail[linkdata[i].code].rp.z+0.6));
scope.linkrail[linkdata[i].code].type = 1;
}else{
scope.linkrail[linkdata[i].code].type = 2;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+2.1,0,scope.linkrail[linkdata[i].code].lp.z+0.6));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.1,0,scope.linkrail[linkdata[i].code].rp.z-0.6));
}
}
}
for(let i=0;i<switchdata.length;i++){
scope.switchrail[switchdata[i].code] = {
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink,
position:switchdata[i].position,
directtype:null,
locateType:0
};
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.6));
}else{
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1";
}else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.6));
}else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2,0,scope.linkrail[switchdata[i].alink].rp.z));
}
scope.switchrail[switchdata[i].code].directtype = "2";
}
//
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.6));
}else{
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1";
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.6));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.6));
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2,0,scope.linkrail[switchdata[i].alink].rp.z));
}
scope.switchrail[switchdata[i].code].directtype = "2";
}
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
if(ddd.locateType == "01"){
//1--向左 2--向右
//__\__ __/__
if(scope.switchrail[switchdata[i].code].directtype == "1"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
}else if(scope.switchrail[switchdata[i].code].directtype == "2"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
}
}else if(ddd.locateType == "02"){
if(switchdata[i].directtype == "1"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
}else if(switchdata[i].directtype == "2"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}
}
}
for(let i=0;i<linkdata.length;i++){
scope.linkrail[linkdata[i].code].lineleft = new THREE.CatmullRomCurve3(scope.linkrail[linkdata[i].code].points);
// scope.linkrail[linkdata[i].code].lineleft.curveType = "catmullrom";
// scope.linkrail[linkdata[i].code].lineleft.tension = 0.2;
let rightpoints = [];
scope.linkrail[linkdata[i].code].points.forEach(item=>{
rightpoints.push(item);
}
);
rightpoints.reverse();
scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
// scope.linkrail[linkdata[i].code].lineright.curveType = "catmullrom";
// scope.linkrail[linkdata[i].code].lineright.tension = 0.1;
var points = scope.linkrail[linkdata[i].code].lineleft.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
// scene.add(curveObject);
}
}
this.getrail = function(){
};
}

View File

@ -6,6 +6,12 @@ export function SectionList() {
this.type = 'sectionlist';
let sectiongroup = new THREE.Group();
sectiongroup.name = "section";
let switchgroup = new THREE.Group();
switchgroup.name = "switch";
this.sections = {
datalist: [],
modellist: []
@ -15,6 +21,7 @@ export function SectionList() {
datalist: [],
modellist: []
};
this.standtrack = [];
this.initpromise = function (sectiondata, switchdata, scene) {
return new Promise(function(resolve, reject) {
@ -97,78 +104,287 @@ export function SectionList() {
});
};
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
// scene.add(sectiongroup);
scene.add(switchgroup);
let linkdata = jlmap3ddata.linklist;
for(let i=0;i<sectiondata.length;i++){
if(sectiondata[i].type == "01"){
//初始化区段对象数据
let newsection = new SectionModel(sectiondata);
newsection.name = sectiondata[i].code;
newsection.code = sectiondata[i].code;
newsection.index = i;
newsection.isStandTrack = sectiondata[i].isStandTrack;
newsection.relStandCode = sectiondata[i].relStandCode;
newsection.type = sectiondata[i].type;
newsection.offsetRight = sectiondata[i].offsetRight;
newsection.offsetLeft = sectiondata[i].offsetLeft;
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
}
}
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
for(let i = 0;i < sectiondata.length;i++){
let testmesh1 = autosuidao.clone(true);
testmesh1.code = sectiondata[i].code;
testmesh1.name = sectiondata[i].code;
if(sectiondata[i].relStandCode){
testmesh1.relStandCode = sectiondata[i].relStandCode;
}else{
testmesh1.relStandCode = "";
}
testmesh1.rightlist = sectiondata[i].rightlist;
testmesh1.leftlist = sectiondata[i].leftlist;
testmesh1.rightpoint = sectiondata[i].rightpoint;
testmesh1.leftpoint = sectiondata[i].leftpoint;
testmesh1.isStandTrack = sectiondata[i].isStandTrack;
testmesh1.lengthfact = sectiondata[i].lengthfact;
for(let i=0;i<testmesh1.rightlist.length;i++){
testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
}
let newsuidao = new THREE.BufferGeometry();
newsuidao.copy(testmesh1.geometry);
testmesh1.geometry = newsuidao;
testmesh1.geometry.attributes.position.needsUpdate = true;
testmesh1.geometry.attributes.uv.needsUpdate = true;
testmesh1.geometry.computeBoundingSphere();
testmesh1.geometry.center();
testmesh1.position.x = sectiondata[i].position.x;
testmesh1.position.y = sectiondata[i].position.y;
testmesh1.position.z = sectiondata[i].position.z;
testmesh1.rotation.x = -Math.PI/2;
testmesh1.rotation.z = sectiondata[i].rotation._z;
let newsection = new SectionModel(sectiondata);
newsection.name = sectiondata[i].code;
newsection.code = sectiondata[i].code;
newsection.isStandTrack = sectiondata[i].isStandTrack;
newsection.relStandCode = sectiondata[i].relStandCode;
newsection.linkCode = sectiondata[i].linkCode;
scope.sections.datalist.push(newsection);
if(testmesh1.isStandTrack == false){
sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
let switchmesh1;
let switchmesh2;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autoswitch1"){
switchmesh1 = assetloader.modellist[i].mesh;
}
if(assetloader.modellist[i].deviceType == "autoswitch2"){
switchmesh2 = assetloader.modellist[i].mesh;
}
}
// switchmesh1.rotation.x = Math.PI/2;
// switchmesh2.rotation.z = Math.PI/2;
for(let i=0;i<switchdata.length;i++){
let newswitch = {
code:switchdata[i].code,
pa:switchdata[i].pa,
pb:switchdata[i].pb,
pc:switchdata[i].pc,
paname:switchdata[i].paname,
pbname:switchdata[i].pbname,
pcname:switchdata[i].pcname,
alink:switchdata[i].alink,
blink:switchdata[i].blink,
clink:switchdata[i].clink
};
let sectionA,sectionB,sectionC;
for(let j=0;j<scope.sections.modellist.length;j++){
if(newswitch.paname == scope.sections.modellist[j].code){
sectionA = scope.sections.modellist[j];
}else if(newswitch.pbname == scope.sections.modellist[j].code){
sectionB = scope.sections.modellist[j];
}else if(newswitch.pcname == scope.sections.modellist[j].code){
sectionC = scope.sections.modellist[j];
}
}
let testswitch;
if(switchdata[i].pa[0].x>switchdata[i].pb[0].x){
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}else{
if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh1.clone(true);
}else{
testswitch = switchmesh2.clone(true);
}
}else{
if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){
testswitch = switchmesh2.clone(true);
}else{
testswitch = switchmesh1.clone(true);
}
testswitch.rotation.z = Math.PI;
}
}
testswitch.position.x = switchdata[i].position.x;
testswitch.position.y = switchdata[i].position.y;
testswitch.position.z = switchdata[i].position.z;
// testswitch.rotation.x = switchdata[i].rotation._x;
// testswitch.rotation.y = switchdata[i].rotation._y;
// testswitch.rotation.z = switchdata[i].rotation._z;
scope.switchs.datalist.push(newswitch);
scope.switchs.modellist.push(testswitch);
switchgroup.add(testswitch);
}
resolve("loadersection");
});
}
function buildsuidao(linkdata,suidaodata,assetloader,scene){
let autosuidao;
for(let i=0;i<assetloader.modellist.length;i++){
if(assetloader.modellist[i].deviceType == "autosuidao"){
autosuidao = assetloader.modellist[i].mesh.children[0];
}
}
let rightlist = [];
let leftlist = [];
let rightpoint = 0;
let leftpoint = 0;
let count = autosuidao.geometry.attributes.position.count;
for(let i=0;i<count;i++){
if(autosuidao.geometry.attributes.position.array[i*3] >7){
rightlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){
rightpoint = i;
}
}
if(autosuidao.geometry.attributes.position.array[i*3] <-7){
leftlist.push(i);
if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){
leftpoint = i;
}
}
}
autosuidao.rightlist = rightlist;
autosuidao.leftlist = leftlist;
autosuidao.rightpoint = rightpoint;
autosuidao.leftpoint = leftpoint;
// console.log(autosuidao);
// console.log(linkdata.linksgroup.children);
// console.log(suidaodata.datalist);
for(let i = 0;i < suidaodata.datalist.length;i++){
let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode);
let suidao = suidaodata.datalist[i];
let len = suidao.offsetRight-suidao.offsetLeft;
// console.log("-------------------------------------");
// console.log("name:"+link.name);
// console.log(link.lengthfact);
// console.log(len);
// console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight);
// console.log("-------------------------------------");
let testmesh1 = autosuidao.clone(true);
for(let i=0;i<autosuidao.rightlist.length;i++){
testmesh1.geometry.attributes.position.array[autosuidao.rightlist[i]*3] = len-7.5;
testmesh1.geometry.attributes.uv.array[autosuidao.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
}
let newsuidao = new THREE.BufferGeometry();
newsuidao.copy(testmesh1.geometry);
testmesh1.geometry = newsuidao;
testmesh1.geometry.attributes.position.needsUpdate = true;
testmesh1.geometry.attributes.uv.needsUpdate = true;
testmesh1.geometry.computeBoundingSphere();
testmesh1.geometry.center();
let lenfact = link.lengthfact;
testmesh1.rotation.x = -Math.PI/2;
testmesh1.rotation.z = link.rotation.z;
//
// console.log(link.lp.x);
// console.log(link.rp.x);
// console.log(suidao.offsetLeft*(len/lenfact));
// console.log((link.rp.x-link.lp.x)*(len/lenfact)/2);
// console.log("==============");
//
if(testmesh1.rotation.z != 0){
testmesh1.position.x = link.lp.x+suidao.offsetLeft*(len/lenfact)+ (link.rp.x-link.lp.x)*(len/lenfact)/2;
if(link.lp.y > link.rp.y){
testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}else{
testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2;
}
}else{
testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2;
testmesh1.position.z = link.position.z;
}
testmesh1.position.y = 3.5;
// testmesh1.rotation.x = Math.PI/4;
testmesh1.code = suidaodata.datalist[i].code;
testmesh1.name = suidaodata.datalist[i].code;
// testmesh1.position.z = link.position.z;
testmesh1.relStandCode = suidaodata.datalist[i].relStandCode;
// testmesh1.stationCode = suidaodata.datalist[i].stationCode;
testmesh1.rightlist = autosuidao.rightlist;
testmesh1.leftlist = autosuidao.leftlist;
testmesh1.rightpoint = autosuidao.rightpoint;
testmesh1.leftpoint = autosuidao.leftpoint;
testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack;
testmesh1.lengthfact = len;
testmesh1.linkCode = suidao.linkCode;
if(suidaodata.datalist[i].isStandTrack == false){
sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
sectiongroup.add( box );
}
scope.sections.modellist.push(testmesh1);
}
}
// this.init = function(sectiondata,switchdata,scene){
//
// //遍历区段
// for(let i=0;i<sectiondata.length;i++){
// if(sectiondata[i].type == "01"){
// //初始化区段对象数据
// let newsection = new SectionModel(sectiondata);
//
// newsection.name = sectiondata[i].code;
// newsection.code = sectiondata[i].code;
// newsection.index = i;
// newsection.isStandTrack = sectiondata[i].isStandTrack;
// newsection.type = sectiondata[i].type;
//
// scope.sections.datalist.push(newsection);
// scope.sections.modellist.push("");
// }
//
// }
//
// //定义区分道岔组
// let switchlist = [];
// //遍历道岔数据
// for(let i=0;i<switchdata.length;i++){
// //道岔信息
// let newswitch = {
// code:null,
// pa:null,
// pb:null,
// pc:null,
// paname:null,
// pbname:null,
// pcname:null
// };
// //获取道岔分辨的点 PS:可能修改动态判断
// for(let j=0;j<sectiondata.length;j++){
// if(switchdata[i].sectionACode == sectiondata[j].code){
// newswitch.pa = sectiondata[j].points;
// newswitch.paname = switchdata[i].sectionACode;
// }
// if(switchdata[i].sectionBCode == sectiondata[j].code){
// newswitch.pb = sectiondata[j].points;
// newswitch.pbname = switchdata[i].sectionBCode;
// }
// if(switchdata[i].sectionCCode == sectiondata[j].code){
// newswitch.pc = sectiondata[j].points;
// newswitch.pcname = switchdata[i].sectionCCode;
// }
// if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
// newswitch.code = switchdata[i].code;
// switchlist.push(newswitch);
// j = sectiondata.length;
// }
// }
// }
//
// //道岔贴图
// //遍历道岔信息组合轨道
// for(let i=0;i<switchlist.length;i++){
// //道岔对象组
// let newswitch = new SwitchModel();
//
// newswitch.name = switchlist[i].code;
// newswitch.code = switchlist[i].code;
//
// newswitch.index = i;
//
// scope.switchs.datalist.push(newswitch);
// scope.switchs.modellist.push("");
// }
//
// }
}

View File

@ -8,8 +8,10 @@ export function SectionModel(data) {
this.index = null;
//轨迹点
this.rail = [];
this.railline = null;
//长度
this.distance = null;
this.distance = [];
this.isStandTrack = null;

View File

@ -50,11 +50,13 @@ export function StationStandList() {
}
}
}
newstationstand.index = i;
newstationstand.num = i;
scope.list[stationdata[i].code] = newstationstand;
}
}
let map = scope.list;
for(let k in map){
@ -65,10 +67,6 @@ export function StationStandList() {
num = j;
}
}
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
map[k].id = assetloader.modellist[num].id;
map[k].mesh.code = map[k].code;
@ -98,25 +96,19 @@ export function StationStandList() {
textmaterial.dispose();
textt.dispose();
}else{
for(let netnum =0;netnum <netstand.length;netnum++){
if(netstand[netnum].code == k ){
for(let netnum =0;netnum <netstand.length;netnum++){
if(netstand[netnum].code == k ){
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].id == netstand[netnum].modelid){
num = j;
map[k].index = netnum;
j = assetloader.modellist.length;
}
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].id == netstand[netnum].modelid){
num = j;
map[k].index = netnum;
j = assetloader.modellist.length;
}
netnum = netstand.length;
}
}
netnum = netstand.length;
}
}
map[k].mesh = assetloader.modellist[num].mesh.clone(true);
let newclip = assetloader.modellist[num].mesh.animations[ 0 ];
@ -172,16 +164,15 @@ export function StationStandList() {
map[k].mesh.scale.x = netstand[map[k].index].scale.x;
map[k].mesh.scale.y = netstand[map[k].index].scale.y;
map[k].mesh.scale.z = netstand[map[k].index].scale.z;
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].index]));
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[map[k].num]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[map[k].index].code;
textplane.name = stationdata[map[k].num].code;
map[k].type = "station";
map[k].rname = stationdata[map[k].index].runPlanName;
map[k].kmmark = stationdata[map[k].index].kmPost;
map[k].rname = stationdata[map[k].num].runPlanName;
map[k].kmmark = stationdata[map[k].num].kmPost;
textplane.position.y = 300;
textplane.rotation.x = Math.PI/2;

View File

@ -10,7 +10,7 @@ export function StationStandModel(opts) {
this.ismodel = false;
this.istexture = false;
this.modelurl = null;
this.index = null;
this.direction1= {
position:null,
name:null,

View File

@ -38,6 +38,7 @@ export function TrainList() {
top:[],
down:[]
};
for(let j=0;j<newmesh.children.length;j++){
if(newmesh.children[j].name == "c1" || newmesh.children[j].name == "c6"){
@ -122,8 +123,9 @@ export function TrainList() {
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = data[i].code;
textplane.position.x = -50;
textplane.position.y = 130;
textplane.position.x = 0;
textplane.position.y = 0;
textplane.position.z = 60;
textplane.tcode = data[i].code;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
@ -139,7 +141,7 @@ export function TrainList() {
newmesh.groupNumber = data[i].groupNumber;
newmesh.position.set(0,-50000,0);
newmesh.children[0].position.y = 0;
// newmesh.children[0].position.y = 0;
//newmesh.rotation.y = Math.PI/2;
newmesh.status = "00";
newmesh.nowcode = null;

View File

@ -12,107 +12,61 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null;
if(traindata.group.children[j].progress<1){
if(traindata.group.children[j].progress >=0&&traindata.group.children[j].progress<=1){
// console.log(trainmodel.rname);
// console.log(trainmodel.speeds);
// console.log(trainmodel.progress);
let movecurve = trainmodel.curve;
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(trainmodel.status == "03"){//向左
let point = movecurve.getPointAt(traindata.group.children[j].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
}
trainmodel.children[1].rotalist.push(rotas);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
}
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-38)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainmodel.children[rs].rotalist.length;
}
}
//console.log(trainmodel.children[rs].rotalist.length);
// console.log(trainmodel.children[0].rotation.x);
// console.log(trainmodel.children[0].rotation.y);
// console.log(trainmodel.children[0].rotation.z);
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
}
}
trainmodel.progress += trainmodel.speeds;
}
if(trainmodel.status == "02"){
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.1){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.y
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z);
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+38)>=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-8)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.y = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
@ -120,17 +74,94 @@ export function UpdateTrain(camera,traindata){
}
}
//console.log(trainmodel.children[rs].rotalist.length);
}
}
}
// console.log(trainmodel.rotalist);
trainmodel.progress += trainmodel.speeds;
}
trainmodel.progress += trainmodel.speeds;
}
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
let radians = Math.acos(trainmodel.children[0].up.dot(tangent));
trainmodel.children[0].quaternion.setFromAxisAngle(trainmodel.children[0].axis, radians);
trainmodel.children[0].rotation.x = -Math.PI/2;
trainmodel.children[0].rotation.z = trainmodel.children[0].rotation.y;
trainmodel.children[0].rotation.y = 0;
let rotas = {
posr:point,
rota:trainmodel.children[0].rotation.z
}
trainmodel.children[1].rotalist.push(rotas);
let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]);
trainmodel.children[0].position.z += offsetz;
//trainmodel.position.z = point.z;
}
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
trainmodel.children[rs].position.z += offsetz;
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+8)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
}
//let offsetx = trainmodel.children[1].matrixWorld.elements[12]-trainmodel.children[0].children[3].matrixWorld.elements[12];
trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota;
trainmodel.children[rs].rotalist.splice(0,1)
xh--;
}else{
xh = trainmodel.children[rs].rotalist.length;
}
}
//console.log(trainmodel.children[rs].rotalist.length);
}
}
// console.log(trainmodel.rotalist);
}
trainmodel.progress += trainmodel.speeds;
}
}
}
else{
if(trainmodel.status == '02'){
trainmodel.curve = trainmodel.nextcurve;
}else if(trainmodel.status == '03'){
trainmodel.curve = trainmodel.nextcurve;
}
// console.log(trainmodel.name);
// console.log(trainmodel.progress);
// console.log(trainmodel.nextcurve);
// if(trainmodel.status == "02"){
// trainmodel.progress = 0;
// }else if(trainmodel.status == "03"){
// trainmodel.progress = 1;
// }
// trainmodel.curve = trainmodel.nextcurve;
}
}

View File

@ -250,6 +250,7 @@ class StationStand extends Group {
/** 中心+车站扣车*/
standAndCenterDetainTrain() {
this.detain && this.detain.show();
this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor);
}
/** 人工设置停战时间*/

View File

@ -70,7 +70,7 @@ export default {
this.$store.state.training.roles == 'BigScreen';
},
isShowMenu() {
return this.$store.state.training.prdType != '';
return this.$store.state.training.prdType;
}
},
watch: {

View File

@ -72,7 +72,7 @@ export default {
this.$store.state.training.roles != 'BigScreen';
},
isShowBar() {
return this.$store.state.training.prdType != '';
return this.$store.state.training.prdType;
}
},
watch: {

View File

@ -157,7 +157,7 @@ export default {
operate: OperationEvent.Command.mBar.system,
children: [
{
title: '登',
title: '登',
click: this.undeveloped
},
{
@ -424,7 +424,7 @@ export default {
operate: OperationEvent.Command.mBar.system,
children: [
{
title: '登',
title: '登',
click: this.undeveloped
},
{

View File

@ -1,355 +0,0 @@
<template>
<el-dialog class="chengdou-03__systerm stand-detain-train" :title="title" :visible.sync="show" width="380px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div class="head_content content">
<span class="base-label" style="left: 0px;">会话管理</span>
<el-col :span="8">
<el-button class="status">查询会话状态</el-button>
</el-col>
<el-col :span="15" :offset="1">
<el-input :value="messageText" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="12">
<el-button class="status_btn" :id="openMessageId" @click="handleMessage('open')"
:disabled="isOpenMessage">打开会话</el-button>
</el-col>
<el-col :span="12">
<el-button class="status_btn" :id="closeMessageId" @click="handleMessage('close')"
:disabled="!isOpenMessage">关闭会话
</el-button>
</el-col>
</div>
<div class="content cotnent_body">
<span class="base-label" style="left: 0px;">操作</span>
<el-col :span="3">
<div class="text">操作</div>
</el-col>
<el-col :span="11" :offset="1">
<el-input :value="messageText1" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="8" :offset="1">
<el-button class="status_btn" :id="confirmId1" @click="confirm1" :disabled="disabledConfirm1">确认
</el-button>
</el-col>
</div>
<div class="content cotnent_body">
<span class="base-label" style="left: 0px;">确认</span>
<el-col :span="3">
<div class="text">操作</div>
</el-col>
<el-col :span="11" :offset="1">
<el-input :value="messageText2" placeholder="" size="mini" disabled></el-input>
</el-col>
<el-col :span="8" :offset="1">
<el-button class="status_btn" :id="confirmId2" @click="confirm2" :disabled="disabledConfirm2">确认
</el-button>
</el-col>
</div>
<div class="body_cont">
<el-col :span="7">
<div class="text">操作倒计时</div>
</el-col>
<el-col :span="17">
<div style="border: 2px inset #E9E9E9; height: 30px; width: 100%;">
{{timeCountConfirm == -1 ? '' : timeCountConfirm}}</div>
</el-col>
</div>
<div class="body_cont">
<div class="status_text">状态</div>
<div class="textarea_content"></div>
</div>
<el-button class="close_btn" :id="domIdConfirm" type="primary" @click="commit">关闭</el-button>
<confirm-tip ref='ConfirmTip' @close="closeMessage"></confirm-tip>
</el-dialog>
</template>
<script>
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import ConfirmTip from './childDialog/confirmTip';
export default {
name: 'StandDetainTrain',
components: {
ConfirmTip
},
data() {
return {
dialogShow: false,
standName: '',
stationName: '',
selected: null,
operation: null,
radio: '1',
radio1: '1',
earlyDepar: false,
messageText: '',
messageText1: '',
messageText2: '',
isOpenMessage: false,
timeCountConfirm: -1,
disabledConfirm1: false,
disabledConfirm2: false,
}
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
openMessageId() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.openMessage.domId : '';
},
closeMessageId() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.closeMessage.domId : '';
},
confirmId1() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm1.domId : '';
},
confirmId2() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm2.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.LimitControl.CancelAllLimit.confirm.domId : '';
},
title() {
return '取消全线临时限速';
},
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
this.timer = setInterval(() => {
if (this.timeCountConfirm > 0) {
this.timeCountConfirm--;
} else if (this.timeCountConfirm == 0) { //
this.timeCountConfirm = -1;
this.disabledConfirm2 = true;
}
}, 1000)
},
methods: {
doShow(operate, selected) {
this.selected = selected;
if (!this.dialogShow) {
this.standName = '';
this.stationName = '';
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
handleMessage(message) {
if (message == 'open') {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.openMessage.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText1 = '取消全线临时限速';
}
}).catch(error => {
this.doClose();
});
} else {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.closeMessage.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = false;
this.messageText1 = '';
this.messageText2 = '';
this.disabledConfirm1 = false;
this.disabledConfirm2 = false;
this.timeCountConfirm = -1; //
}
}).catch(error => {
this.doClose();
});
}
},
confirm1() {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm1.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText1 = '**************';
this.messageText2 = '取消全线临时限速';
this.disabledConfirm1 = true;
this.timeCountConfirm = 60; //
}
}).catch(error => {
this.doClose();
});
},
confirm2() {
let operate = {
send: true,
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm2.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.isOpenMessage = true;
this.messageText2 = '**************';
this.disabledConfirm2 = true;
this.timeCountConfirm = -1;
}
}).catch(error => {
this.doClose();
});
},
commit() {
let operate = {
send: true,
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.confirm.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (!this.isOpenMessage) {
this.doClose();
} else {
let operate = {
message: `是否关闭会话,并关闭窗口`,
confirmId: OperationEvent.LimitControl.CancelAllLimit.close.domId,
}
this.$refs.ConfirmTip.doShow(operate);
}
}).catch(error => {
console.log(error);
})
},
closeMessage() {
let operate = {
type: MapDeviceType.LimitControl.type,
operation: OperationEvent.LimitControl.CancelAllLimit.close.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.ConfirmTip.doClose();
this.isOpenMessage = false;
this.messageText1 = '';
this.messageText2 = '';
this.disabledConfirm1 = false;
this.disabledConfirm2 = false;
this.timeCountConfirm = -1; //
this.doClose();
}).catch(error => {
console.log(error);
})
}
}
}
</script>
<style scoped lang="scss">
.stand-detain-train .context {
height: 80px !important;
}
.content {
width: 100%;
border: 1px solid lightgray;
padding: 18px 5px;
position: relative;
.base-label {
position: absolute;
top: -5px;
left: 20px;
background-color: #F0F0F0;
padding: 0 5px;
}
.el-button {
width: 100%;
line-height: 28px;
}
.status_btn {
width: 110px;
margin: 15px auto 0;
display: block;
}
}
.head_content {
height: 110px;
margin-bottom: 10px;
}
.cotnent_body {
height: 60px;
margin-bottom: 10px;
.text {
line-height: 30px;
text-align: center;
font-size: 15px;
}
.status_btn {
width: 80px;
margin: 0 auto
}
}
.close_btn {
margin: 0 auto;
width: 80px;
display: block;
}
.body_cont {
margin-bottom: 10px;
padding: 0 3px;
overflow: hidden;
.text {
line-height: 30px;
text-align: center;
font-size: 15px;
}
.status_text {
margin-bottom: 3px;
font-size: 14px;
padding-left: 8px;
}
.textarea_content {
height: 85px;
width: 100%;
border: 2px solid #E9E9E9;
box-shadow: 2px 2px #959595 inset;
}
}
</style>

View File

@ -107,11 +107,7 @@ export default {
}
},
domIdConfirm() {
if (this.operate && this.operate.operateCode) {
return this.dialogShow ? getDomIdByOperation(this.operate.operateCode) : '';
} else {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
return this.dialogShow ? getDomIdByOperation(this.operate.operateNext) : '';
}
},
mounted() {
@ -135,29 +131,10 @@ export default {
this.$store.dispatch('training/emitTipFresh');
},
commit() {
const operate = {
send: this.operate.operateCode != null,
type: this.operate.type,
operation: this.operate.operateCode != null ? this.operate.operateCode : OperationEvent.Command.close.confirm.operation
};
if (this.operate.val) {
operate['val'] = this.operate.val;
}
if (this.passwordCheck === this.correctPassword) {
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$emit('checkOver');
this.doClose();
this.inputClear();
}
}).catch(() => {
this.loading = false;
this.$refs.noticeInfo && this.$refs.noticeInfo.doShow(operate);
});
this.$emit('checkOver', this.operate);
this.doClose();
this.inputClear();
} else {
this.showMistake = true;
}

View File

@ -27,7 +27,7 @@
</el-col>
</el-row>
<confirm-control ref="confirmControl" />
<password-box ref="password" @checkOver="doClose" />
<password-box ref="password" @checkOver="passWordCommit" />
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
@ -79,10 +79,6 @@ export default {
return '信号封锁';
} else if (this.operation == OperationEvent.Signal.unlock.menu.operation) {
return '信号解封';
} else if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return '进路收人工控';
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return '进路交自动控';
} else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) {
return '信号关灯';
}
@ -138,17 +134,26 @@ export default {
} else if (this.operation == OperationEvent.Signal.unlock.menu.operation) {
/** 信号解封*/
this.unlock();
} else if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路收人工控*/
this.humanControl();
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
this.atsAutoControl();
} else if (this.operation == OperationEvent.Signal.signalClose.menu.operation) {
/** 信号关灯*/
this.signalClose();
}
},
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) { this.doClose(); }
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
cancelTrainRoute() {
if (this.$store.state.training.prdType == '01') {
@ -174,7 +179,6 @@ export default {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
@ -194,7 +198,6 @@ export default {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
@ -204,7 +207,7 @@ export default {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanTrainRoute.menu.operation,
operateCode: OperationEvent.Signal.humanTrainRoute.confirm.operation
operateNext: OperationEvent.Signal.humanTrainRoute.confirm.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -213,7 +216,6 @@ export default {
this.$refs.password.doShow(operate);
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
@ -233,7 +235,6 @@ export default {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
@ -243,7 +244,7 @@ export default {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.lock.menu.operation,
operateCode: OperationEvent.Signal.lock.confirm.operation
operateNext: OperationEvent.Signal.lock.confirm.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -259,7 +260,7 @@ export default {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.unlock.menu.operation,
operateCode: OperationEvent.Signal.unlock.confirm.operation
operateNext: OperationEvent.Signal.unlock.confirm.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -270,51 +271,6 @@ export default {
}).catch(() => {
});
},
//
humanControl() {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation,
operateCode: OperationEvent.Signal.humanControl.confirm.operation,
val: this.operateCode
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.password.doShow(operate);
}
}).catch(() => {
this.loading = false;
// this.doClose();
// this.$refs.noticeInfo.doShow(operate);
});
},
//
atsAutoControl() {
const operate = {
// send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation,
operateCode: OperationEvent.Signal.atsAutoControl.confirm.operation,
val: this.operateCode
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.password.doShow(operate);
}
}).catch(() => {
this.loading = false;
// this.doClose();
// this.$refs.noticeInfo.doShow(operate);
});
},
//
signalClose() {
const operate = {

View File

@ -22,17 +22,7 @@
</el-row>
<div class="route-table-box">
<span class="route-table-tip">进路列表</span>
<el-table
ref="table"
:data="tempData"
border
:cell-style="tableStyle"
style="width: 99%;"
size="mini"
height="90"
highlight-current-row
@row-click="clickEvent"
>
<el-table ref="table" :data="tempData" border :cell-style="tableStyle" style="width: 99%;" size="mini" height="90" highlight-current-row @row-click="clickEvent">
<el-table-column :id="domIdChoose" prop="name" label="进路" style="margin-left:30px" />
<el-table-column :id="domIdChoose" prop="controlType" label="进路属性" style="margin-left:30px">
<template slot-scope="scope">{{ controlTypeNameMap[scope.row.controlType] }} </template>
@ -55,7 +45,7 @@
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" />
<password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog>
</template>
@ -78,7 +68,6 @@ export default {
dialogShow: false,
loading: false,
selected: null,
row: null,
operation: '',
display: true,
stationName: '',
@ -160,47 +149,40 @@ export default {
this.$store.dispatch('training/emitTipFresh');
});
},
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
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);
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.guide();
this.$refs.table.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
guide() {
//
if (this.beforeSectionList && this.beforeSectionList.length) {
this.beforeSectionList.forEach(elem => {
elem.cutOff = false;
});
}
this.$store.dispatch('training/updateMapState', [...this.beforeSectionList]);
this.beforeSectionList = [];
},
clickEvent(row, event, column) {
this.row = row;
if (row) {
//
this.guide();
row.canSetting = true;
//
if (row.containSectionList && row.containSectionList.length) {
//
row.containSectionList.forEach(elem => {
elem.cutOff = true;
});
}
this.$store.dispatch('training/updateMapState', [...row.containSectionList]);
this.beforeSectionList = row.containSectionList || [];
//
const operate = {
repeat: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.guide.choose.operation,
val: row.code
val: row.code,
selection: row
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
@ -216,7 +198,7 @@ export default {
const operate = {
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.guide.menu.operation,
operateCode: OperationEvent.Signal.guide.confirm.operation
operateNext: OperationEvent.Signal.guide.confirm.operation
};
this.loading = true;

View File

@ -0,0 +1,285 @@
<template>
<div>
<el-dialog v-dialogDrag class="chengdou-03__systerm route-hand-control" :title="title" :visible.sync="show" width="500px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<el-row class="header">
<el-col :span="11"><span>车站</span></el-col>
<el-col :span="11" :offset="2"><span>始端信号机</span></el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-input v-model="stationName" size="small" disabled />
</el-col>
<el-col :span="11" :offset="2">
<el-input v-model="signalName" size="small" disabled />
</el-col>
</el-row>
<div class="table">
<el-table ref="tempTable" :data="tempData" border style="width: 100%" size="mini" :highlight-current-row="highlight" :height="140" @row-click="clickEvent">
<el-table-column :id="domIdChoose" prop="name" width="155" label="描述" style="margin-left:30px">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="方向" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">111</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="属性" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">1111</span>
</template>
</el-table-column>
<el-table-column :id="domIdChoose" prop="name" label="控制" style="">
<template slot-scope="scope">
<span :style="{color: scope.row.disabled ? '#CBCBCB':'unset'}">{{ scope.row.controlType == '01' ? '自动' : '人工' }}</span>
</template>
</el-table-column>
</el-table>
</div>
<el-row justify="center" class="button-group">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :disabled="commitDisabled" :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>
<confirm-control ref="confirmControl" />
<notice-info ref="noticeInfo" />
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent, getDomIdByOperation } from '@/scripts/ConstDic';
import ConfirmControl from './childDialog/confirmControl';
import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'RouteHandControl',
components: {
ConfirmControl,
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
selected: null,
tempData: [],
operation: null,
selection: [],
stationName: '',
signalName: '',
allSelect: false,
highlight: true
};
},
computed: {
...mapGetters('map', [
'signalList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdChoose() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return OperationEvent.Signal.humanControl.choose.domId;
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return OperationEvent.Signal.atsAutoControl.choose.domId;
}
return '';
},
domIdConfirm() {
return this.dialogShow ? getDomIdByOperation(this.operation) : '';
},
title() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
return '进路交人工控';
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
return '进路交自动控';
}
return '';
},
commitDisabled() {
let disabled = true;
if (this.selection && this.selection.length) {
disabled = false;
}
return disabled;
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
doShow(operate, selected, tempData) {
this.selected = selected;
//
if (!this.dialogShow) {
this.signalName = '';
this.stationName = '';
if (selected && selected._type.toUpperCase() === 'Signal'.toUpperCase()) {
this.signalName = selected.name;
const station = this.$store.getters['map/getDeviceByCode'](selected.stationCode);
if (station) {
this.stationName = station.name;
}
}
if (tempData && tempData.length > 0) {
tempData.forEach(elem => {
elem.check = false;
elem.disabled = false;
//
if (operate.operation === OperationEvent.Signal.humanControl.menu.operation && elem.controlType == '01') {
elem.disabled = true;
} if (operate.operation === OperationEvent.Signal.atsAutoControl.menu.operation && elem.controlType == '02') {
elem.disabled = true;
}
});
}
this.tempData = tempData || [];
this.operation = operate.operation;
}
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$refs.tempTable.setCurrentRow();
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
allSelectChange() {
if (this.allSelect) {
this.tempData.forEach(item => {
if (!item.disabled) {
item.check = true;
}
});
} else {
this.tempData.forEach(item => {
if (!item.disabled) {
item.check = false;
}
});
}
},
// code
serializeCodeListWithSeparator(sep) {
const codeList = [];
if (this.selection && this.selection.length) {
this.selection.forEach(elem => {
codeList.push(elem.code);
});
}
return codeList.join(sep);
},
clickEvent(row, event, column) {
this.highlight = false;
if (row && !row.disabled) {
this.highlight = true;
this.selection = [row];
this.beforeSectionList = row.containSectionList || [];
//
const operate = {
repeat: true,
type: MapDeviceType.Signal.type,
operation: '',
val: row.code,
selection: row
};
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
operate.operation = OperationEvent.Signal.humanControl.choose.operation;
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
operate.operation = OperationEvent.Signal.atsAutoControl.choose.operation;
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
});
}
},
commit() {
if (this.operation == OperationEvent.Signal.humanControl.menu.operation) {
/** 进路交人工控*/
this.humanControl();
} else if (this.operation == OperationEvent.Signal.atsAutoControl.menu.operation) {
/** 进路交自动控*/
this.atsAutoControl();
}
},
//
humanControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.humanControl.menu.operation
};
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);
});
},
//
atsAutoControl() {
const operate = {
send: true,
type: MapDeviceType.Signal.type,
operation: OperationEvent.Signal.atsAutoControl.menu.operation
};
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.Signal.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>

View File

@ -27,7 +27,7 @@
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" />
<password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog>
</template>
@ -129,6 +129,22 @@ export default {
this.fault();
}
},
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
lock() {
const operate = {
@ -192,10 +208,9 @@ export default {
//
fault() {
const operate = {
// send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.fault.menu.operation,
operateCode: OperationEvent.Section.fault.confirm.operation
operateNext: OperationEvent.Section.fault.confirm.operation
};
this.loading = true;

View File

@ -31,7 +31,7 @@
</el-col>
</el-row>
<notice-info ref="noticeInfo" />
<password-box ref="passwordBox" @checkOver="doClose" />
<password-box ref="passwordBox" @checkOver="passWordCommit" />
</el-dialog>
</template>
@ -153,6 +153,22 @@ export default {
this.openPasswordBox(this.operation, OperationEvent.Switch.fault.confirm.operation);
}
},
passWordCommit(data) {
const operate = {
send: true,
type: data.type,
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
//
lock() {
const operate = {
@ -311,11 +327,11 @@ export default {
});
},
//
openPasswordBox(operation, code) {
openPasswordBox(operation, operateNext) {
const operate = {
type: MapDeviceType.Switch.type,
operation: operation,
operateCode: code
operateNext: operateNext
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {

View File

@ -1,158 +1,153 @@
<template>
<el-dialog class="chengdou-03__systerm route-create" :title="title" :visible.sync="show" width="580px"
label-position="top" :before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false"
v-dialogDrag>
<div style="padding: 10px 20px; border: 1px solid lightgray;">
<el-form size="small" label-width="100px">
<el-form-item label="列车:" prop="trainCode">
<el-select v-model="trainCode" filterable placeholder="列车">
<el-option v-for="item in trainList" :key="item.code" :label="item.groupNumber"
:value="item.code"></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="列车车次:" prop="tripNumber">
<el-select v-model="tripNumber" filterable placeholder="列车车次">
<el-option v-for="no in trainNoList" :key="no" :label="no" :value="no"></el-option>
</el-select>
<div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div>
</el-form-item> -->
<el-form-item label="列车方向:" prop="direction">
<el-select v-model="direction" filterable placeholder="列车方向">
<el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value">
</el-option>
</el-select>
<!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> -->
</el-form-item>
</el-form>
<el-row>
<el-col style="text-align: right;">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</div>
<notice-info ref="noticeInfo"></notice-info>
</el-dialog>
<el-dialog v-dialogDrag class="chengdou-03__systerm route-create" :title="title" :visible.sync="show" width="380px" label-position="top" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<div style="padding: 10px 20px; border: 1px solid lightgray;">
<el-form size="small" label-width="100px">
<el-form-item label="列车:" prop="trainCode">
<el-select v-model="trainCode" filterable placeholder="列车">
<el-option
v-for="item in trainList"
:key="item.code"
:label="item.groupNumber"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item label="列车方向:" prop="direction">
<el-select v-model="direction" filterable placeholder="列车方向">
<el-option v-for="no in directionList" :key="no.value" :label="no.label" :value="no.value" />
</el-select>
<!-- <div style="font-size: 12px;">(上行路线车次号选择偶数下行路线车次号选择基数)</div> -->
</el-form-item>
</el-form>
<el-row>
<el-col style="text-align: right;">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
<el-button :id="domIdCancel" @click="cancel"> </el-button>
</el-col>
</el-row>
</div>
<notice-info ref="noticeInfo" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo'
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { getPublishTrainList } from '@/api/jmap/map';
import { mouseCancelState } from '../utils/menuItemStatus';
import NoticeInfo from './childDialog/childDialog/noticeInfo';
export default {
name: 'RouteCreate',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
trainList: [],
trainNoList: [],
directionList: [
{
value: '2',
label: '上行'
},
{
value: '1',
label: '下行'
}
],
trainCode: '',
tripNumber: '',
direction: '',
selected: null
}
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (Object.keys(map || {}).length) {
getPublishTrainList(map.skinCode).then(response => {
this.trainList = response.data;
}).catch(error => {
this.$messageBox(`获取列车列表失败`);
})
}
},
doShow(operate, selected) {
this.dialogShow = true;
this.selected = selected;
export default {
name: 'RouteCreate',
components: {
NoticeInfo
},
data() {
return {
dialogShow: false,
loading: false,
trainList: [],
trainNoList: [],
directionList: [
{
value: '2',
label: '上行'
},
{
value: '1',
label: '下行'
}
],
trainCode: '',
tripNumber: '',
direction: '',
selected: null
};
},
computed: {
...mapGetters('map', [
'map'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return OperationEvent.Section.newtrain.menu.domId;
},
title() {
return '设置列车';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (Object.keys(map || {}).length) {
getPublishTrainList(map.skinCode).then(response => {
this.trainList = response.data;
}).catch(() => {
this.$messageBox(`获取列车列表失败`);
});
}
},
doShow(operate, selected) {
this.dialogShow = true;
this.selected = selected;
console.log(this.map);
/** 加载列车数据*/
this.loadInitData(this.map);
/** 加载列车数据*/
this.loadInitData(this.map);
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.trainCode = '';
this.direction = '';
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
commit() {
const operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode
};
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.Section.type,
operation: OperationEvent.Command.cancel.menu.operation
};
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
doClose() {
this.trainCode = '';
this.direction = '';
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
mouseCancelState(this.selected);
},
commit() {
let operate = {
send: true,
type: MapDeviceType.Section.type,
operation: OperationEvent.Section.newtrain.menu.operation,
val: '' + this.direction + '::' + this.trainCode
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
this.$refs.noticeInfo.doShow(operate);
});
},
cancel() {
let operate = {
type: MapDeviceType.Section.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(error => {
this.doClose();
});
}
}
}
</script>
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => {
this.doClose();
});
}
}
};
</script>

View File

@ -1,180 +1,174 @@
<template>
<el-dialog class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px"
:before-close="doClose" :zIndex="2000" :modal="false" :close-on-click-modal="false" v-dialogDrag>
<div class="el-dialog-div">
<el-form size="small" label-width="80px" :model="addModel" :rules="rules" ref="form" label-position="left">
<el-row>
<el-col :span="11">
<el-form-item prop="stationName">
<span slot="label">车站</span>
<el-input v-model="addModel.stationName" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item prop="trainWindowCode">
<span slot="label">车次窗</span>
<el-input v-model="addModel.trainWindowCode" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="旧车组号" prop="oldGroupNumber">
<el-select v-model="addModel.oldGroupNumber" filterable disabled>
<el-option v-for="train in trainList" :key="train.oldGroupNumber" :label="train.oldGroupNumber"
:value="train.oldGroupNumber">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item label="新车组号" prop="newGroupNumber">
<el-select v-model="addModel.newGroupNumber">
<el-option v-for="train in trainList" :key="train.newGroupNumber" :label="train.newGroupNumber"
:value="train.newGroupNumber">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<el-row justify="center" class="button-group-train">
<el-col :span="10" :offset="2">
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">确定</el-button>
<el-dialog v-dialogDrag class="chengdou-03__systerm stand-stop-time" :title="title" :visible.sync="show" width="480px" :before-close="doClose" :z-index="2000" :modal="false" :close-on-click-modal="false">
<div class="el-dialog-div">
<el-form ref="form" size="small" label-width="80px" :model="addModel" :rules="rules" label-position="left">
<el-form-item>
<el-col :span="11">
<el-form-item prop="stationName">
<span slot="label">车站</span>
<el-input v-model="addModel.stationName" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="8" :offset="4">
<el-button :id="domIdCancel" @click="cancel"> </el-button>
<el-col :span="11" :offset="1">
<el-form-item prop="trainWindowCode">
<span slot="label">车次窗</span>
<el-input v-model="addModel.trainWindowCode" :disabled="true" />
</el-form-item>
</el-col>
</el-form-item>
<el-row>
<el-col :span="11">
<el-form-item label="旧车组号" prop="oldGroupNumber">
<el-select v-model="addModel.oldGroupNumber" filterable disabled>
<el-option v-for="train in trainList" :key="train.oldGroupNumber" :label="train.oldGroupNumber" :value="train.oldGroupNumber" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" :offset="1">
<el-form-item label="新车组号" prop="newGroupNumber">
<el-select v-model="addModel.newGroupNumber">
<el-option v-for="train in trainList" :key="train.newGroupNumber" :label="train.newGroupNumber" :value="train.newGroupNumber" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-dialog>
</el-form>
</div>
<el-row justify="center" class="button-group-train">
<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 { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
import { mapGetters } from 'vuex';
import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
import { mouseCancelState } from '../utils/menuItemStatus';
import { getPublishTrainList } from '@/api/jmap/map';
export default {
name: 'TrainEditNumber',
components: {
},
data() {
return {
trainNoList: [],
trainList: [],
selected: null,
addModel: {
stationName:'',
trainWindowCode: '',
oldGroupNumber:'',
newGroupNumber:'',
},
export default {
name: 'TrainEditNumber',
components: {
},
data() {
return {
trainNoList: [],
trainList: [],
selected: null,
addModel: {
stationName: '',
trainWindowCode: '',
oldGroupNumber: '',
newGroupNumber: ''
},
rules: {
newGroupNumber: [
{ required: true, message: '请输入新车组号', trigger: 'blur'}
],
},
dialogShow: false,
loading: false,
}
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
},
title() {
return '修改车组号'
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
})
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(error => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel ={
stationName:'',
trainWindowCode: '',
oldGroupNumber:'',
newGroupNumber:'',
}
}
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);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
let operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainNo.menu.operation,
}
rules: {
newGroupNumber: [
{ required: true, message: '请输入新车组号', trigger: 'blur'}
]
},
dialogShow: false,
loading: false
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
domIdCancel() {
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
},
domIdConfirm() {
return this.dialogShow ? OperationEvent.Train.editTrainNo.menu.domId : '';
},
title() {
return '修改车组号';
}
},
mounted() {
this.$nextTick(() => {
this.$store.dispatch('training/tipReload');
});
},
methods: {
loadInitData(map) {
if (map) {
getPublishTrainList(map.skinCode).then(resp => {
this.trainList = resp.data;
}).catch(() => {
this.$messageBox(`获取列车车组号失败`);
});
}
},
doShow(operate, selected) {
this.selected = selected;
//
if (!this.dialogShow) {
this.addModel ={
stationName: '',
trainWindowCode: '',
oldGroupNumber: '',
newGroupNumber: ''
};
}
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);
mouseCancelState(this.selected);
},
commit() {
this.$refs['form'].validate((valid) => {
if (valid) {
const operate = {
send: true,
type: MapDeviceType.Train.type,
operation: OperationEvent.Train.editTrainNo.menu.operation
};
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(error => {
this.loading = false;
this.doClose();
// this.$refs.noticeInfo.doShow(operate);
})
} else {
return false;
}
});
},
cancel() {
let operate = {
type: MapDeviceType.Train.type,
operation: OperationEvent.Command.cancel.menu.operation,
}
this.loading = true;
this.$store.dispatch('training/next', operate).then(({ valid }) => {
this.loading = false;
if (valid) {
this.doClose();
}
}).catch(() => {
this.loading = false;
this.doClose();
});
} else {
return false;
}
});
},
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(error => { this.doClose(); });
}
}
}
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.doClose();
}
}).catch(() => { this.doClose(); });
}
}
};
</script>
<style scoped>
.chengdou-03__systerm .el-dialog .base-label {

View File

@ -13,7 +13,6 @@
<menu-section ref="menuSection" :selected="selected" />
<menu-train ref="menuTrain" :selected="selected" />
<menu-station ref="menuStation" :selected="selected" />
<!-- <menu-limit ref="menuLimit" :selected="selected" /> -->
<passive-alarm ref="passiveAlarm" />
<passive-contorl ref="passiveControl" />
<passive-Timeout ref="passiveTimeout" />
@ -33,7 +32,6 @@ import MenuSection from './menuSection';
import MenuTrain from './menuTrain';
import MenuStation from './menuStation';
import MenuBar from './menuBar';
// import MenuLimit from './menuLimit';
import PassiveAlarm from './passiveDialog/alarm';
import PassiveContorl from './passiveDialog/control';
import PassiveTimeout from './passiveDialog/timeout';
@ -51,7 +49,6 @@ export default {
MenuStationStand,
MenuStation,
MenuTrain,
// MenuLimit,
PassiveAlarm,
PassiveContorl,
PassiveTimeout
@ -74,7 +71,7 @@ export default {
this.$store.state.training.roles != 'BigScreen';
},
isShowBar() {
return this.$store.state.training.prdType != '';
return this.$store.state.training.prdType;
}
},
watch: {

View File

@ -133,7 +133,7 @@ export default {
operate: OperationEvent.Command.mBar.system,
children: [
{
title: '登',
title: '登',
click: this.undeveloped
},
{
@ -400,7 +400,7 @@ export default {
operate: OperationEvent.Command.mBar.system,
children: [
{
title: '登',
title: '登',
click: this.undeveloped
},
{

View File

@ -97,13 +97,13 @@
<center><b></b><b></b></center>
</span>
</button>
<button id="mbm_clear" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown('mbm_clear')">
<button :id="Command.cancel.clearMbm.domId" class="button_box" :style="{width: width+'px', backgroundColor:buttonUpColor}" @click="buttonDown(Command.cancel.clearMbm.operation)">
<span style="color: black">
<center><b></b></center>
<center><b></b></center>
</span>
</button>
<password-box ref="password" @checkOver="doClose" />
<password-box ref="password" @checkOver="passWordCommit" />
</div>
</template>
@ -146,6 +146,9 @@ export default {
MixinCommand() {
return OperationEvent.MixinCommand;
},
Command() {
return OperationEvent.Command;
},
isShowBtn() {
return this.$store.state.training.prdType == '01';
}
@ -165,8 +168,19 @@ export default {
this.resetPosition();
},
methods: {
doClose() {
passWordCommit(data) {
const operate = {
type: 'mbm',
operation: data.operateNext
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
}
}).catch(() => {
this.$refs.noticeInfo.doShow(operate);
});
},
resetPosition() {
this.$nextTick(() => {
@ -199,30 +213,50 @@ export default {
}
},
buttonDown(operation) {
if (operation != 'mbm_clear') {
if (operation != this.Command.cancel.clearMbm.operation) {
const operate = {
type: 'mbm',
operation: operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.operation = operation;
this.$store.dispatch('menuOperation/setButtonOperation', operation); //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (operation == this.Signal.humanTrainRoute.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Section.fault.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.Switch.unlock.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
} else if (operation == this.MixinCommand.unblock.button.operation) { //
operate['operateNext'] = this.Command.close.password.operation;
this.$refs.password.doShow(operate);
}
this.$store.dispatch('training/emitTipFresh');
}
});
} else {
OperateHandler.cleanOperates(); //
this.$store.dispatch('menuOperation/setButtonOperation', null);
const operate = {
type: 'mbm',
operation: operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/setButtonOperation', null);
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
OperateHandler.cleanOperates(); //
}
});
}
},
selectedChange() {
//
if (this.$store.state.menuOperation.buttonOperation) {
const model = this.$store.state.menuOperation.selected;
const model = this.$store.state.menuOperation.selected; //
if (model._type) {
const deviceType = MapDeviceType[model._type];
const modelData = deepAssign({}, model);
@ -239,7 +273,12 @@ export default {
if (valid) {
if (response) {
this.tempData = response.data;
// console.log(this.tempData, '');
}
if (this.operation == this.Signal.guide.button.operation) { //
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
operate['operateNext'] = this.Command.close.password.operation;
this.operation = '0';
this.$refs.password.doShow(operate);
}
}
});

View File

@ -1,120 +0,0 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<cancel-all-limit ref="cancelAllLimit" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import CancelAllLimit from './dialog/cancelAllLimit';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
import { MapDeviceType, OperationEvent, DeviceMenu } from '@/scripts/ConstDic';
import { MenuDisabledState } from './utils/menuItemStatus';
export default {
name: 'MenuLimit',
components: {
PopMenu,
CancelAllLimit
},
props: {
selected: {
type: Object,
default() {
return null;
}
}
},
data() {
return {
menu: [{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: '',
auth: { station: true, center: false }
}],
menuNormal: {
local: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: true, center: false }
}
],
central: [
{
label: '取消全线临时限速',
handler: this.cancelSpeed,
disabledCallback: MenuDisabledState.Section.cancelSpeed,
auth: { station: false, center: true }
}
]
}
};
},
computed: {
...mapGetters('training', [
'mode',
'operatemode'
]),
...mapGetters('menuOperation', [
'buttonOperation'
])
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.LimitControl) && !this.buttonOperation) {
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
this.doClose();
}
}
},
methods: {
clickEvent() {
const self = this;
window.onclick = function (e) {
self.doClose();
};
},
initMenu() {
//
if (this.operatemode === OperateMode.ADMIN) {
this.menu = [...this.menu];
}
},
doShow(point) {
this.clickEvent();
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
this.$refs.popMenu.resetShowPosition(point);
}
},
doClose() {
if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close();
}
},
//
cancelSpeed() {
const operate = {
start: true,
send: true,
code: this.selected.code,
type: MapDeviceType.LimitControl.type,
label: MapDeviceType.LimitControl.label,
operation: OperationEvent.LimitControl.CancelAllLimit.menu.operation
};
this.$store.dispatch('training/next', operate).then(({ valid }) => {
if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.cancelAllLimit.doShow(operate, this.selected);
}
});
}
}
};
</script>

View File

@ -5,6 +5,7 @@
<route-control ref="routeControl" />
<route-detail ref="routeDetail" />
<route-guide ref="routeGuide" />
<route-hand-control ref="routeHandControl" />
<notice-info ref="noticeInfo" />
</div>
</template>
@ -14,6 +15,7 @@ import PopMenu from '@/components/PopMenu';
import RouteControl from './dialog/routeControl';
import RouteSelection from './dialog/routeSelection';
import RouteDetail from './dialog/routeDetail';
import RouteHandControl from './dialog/routeHandControl';
import RouteGuide from './dialog/routeGuide';
import NoticeInfo from './dialog/childDialog/childDialog/noticeInfo';
import { mapGetters } from 'vuex';
@ -28,6 +30,7 @@ export default {
PopMenu,
RouteControl,
RouteSelection,
RouteHandControl,
RouteDetail,
RouteGuide,
NoticeInfo
@ -441,7 +444,7 @@ export default {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData);
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},
@ -462,7 +465,7 @@ export default {
tempData = response.data;
}
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$refs.routeControl.doShow(operate, this.selected, tempData);
this.$refs.routeHandControl.doShow(operate, this.selected, tempData);
}
});
},

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