Merge remote-tracking branch 'remotes/origin/test'

# Conflicts:
#	src/App.vue
#	src/views/display/menuDemon.vue
#	src/views/orderauthor/permission/create/permission.vue
#	src/views/scriptManage/create.vue
#	src/views/trainRoom/index.vue
This commit is contained in:
ival 2019-11-08 20:08:03 +08:00
commit a067444fd0
281 changed files with 18312 additions and 19329 deletions

View File

@ -7,7 +7,7 @@
<script>
import { handleToken } from '@/utils/auth';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import DeomonTopic from '@/views/demonstration/deomonTopic';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import { ProjectIcon } from '@/scripts/ConstDic';
@ -47,6 +47,7 @@ export default {
if (!this.$route.path.includes('/login') && this.$route.path != '/404') {
const header = { group: '', 'X-Token': handleToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
}
});
},

View File

@ -59,9 +59,9 @@ export function putLessonOffLine(id) {
/**
* 获取地图产品下的课程列表
*/
export function getCommodityProductLesson(prdCode) {
export function getCommodityProductLesson(prdId) {
return request({
url: `/api/lesson/${prdCode}/list`,
url: `/api/lesson/${prdId}/list`,
method: 'get'
});
}

View File

@ -8,11 +8,18 @@ export function getPublishMapList(params) {
params: params
});
}
/** 获取所有可用地图列表*/
export function getPublishMapListOnline() {
return request({
url: '/api/map/listOnline',
method: 'get'
});
}
/** 根据皮肤获取发布地图列表*/
export function getPublishMapListBySkinCode(skinCode) {
export function getPublishMapListByLineCode(lineCode) {
return request({
url: `/api/map/${skinCode}/list`,
url: `/api/map/${lineCode}/list`,
method: 'get'
});
}
@ -33,7 +40,7 @@ export function getPublishMapDetailById(id) {
});
}
/** 获取发布地图列表*/
/** 获取发布地图列表(不包含项目线路)*/
export function listPublishMap(params) {
return request({
url: `/api/map/list`,

View File

@ -44,14 +44,6 @@ export function sendTrainingNextStep(data, group) {
});
}
/** 获取实训树*/
export function getTrainingTree() {
return request({
url: `/api/training/tree`,
method: 'get'
});
}
/** 获取章节基本信息*/
export function getTrainingDetail(trainingId) {
return request({

View File

@ -69,16 +69,6 @@ export function getPermissionList(id) {
});
}
/**
* 查询仿真权限列表
*/
export function queryPermissionSimulation(data) {
return request({
url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`,
method: 'get'
});
}
/** 获取大屏权限列表*/
export function queryPermissionScreen() {
return request({

View File

@ -139,3 +139,22 @@ export function setCommodityStatus(id) {
method: 'get'
});
}
/** 获取用户可以分发/转增的权限*/
export function getAvailableUserPermission(params) {
return request({
url: `/api/userPermission/getAvailableUserPermission`,
method: 'get',
params: params
});
}
/** 用户权限转增分发打包生成权限*/
export function givePermission(data) {
return request({
url: `/api/distribute/packageUserPermission`,
method: 'post',
data: data
});
}

View File

@ -1,6 +1,6 @@
import request from '@/utils/request';
/** 分页查询皮肤*/
/** 分页查询真实线路*/
export function getSkinCodePageList(params) {
return request({
url: `/api/realLine`,
@ -9,7 +9,7 @@ export function getSkinCodePageList(params) {
});
}
/** 添加皮肤*/
/** 添加真实线路*/
export function addSkinCode(data) {
return request({
url: `/api/realLine`,
@ -18,7 +18,7 @@ export function addSkinCode(data) {
});
}
/** 删除皮肤*/
/** 删除真实线路*/
export function delSkinCode(id) {
return request({
url: `/api/realLine/${id}`,
@ -26,7 +26,7 @@ export function delSkinCode(id) {
});
}
/** 查询地图皮肤 */
/** 根据id查询真实线路 */
export function querySkinCode(id) {
return request({
url: `/api/realLine/${id}`,
@ -34,7 +34,7 @@ export function querySkinCode(id) {
});
}
/** 修改地图皮肤*/
/** 修改真实线路*/
export function updateSkinCode(data) {
return request({
url: `/api/realLine/${data.id}`,
@ -52,7 +52,7 @@ export function updateSkinCodeByCode(data) {
});
}
/** 查询皮肤是否存在*/
/** 检查code是否存在*/
export function querySkinCodeExistByCode(code) {
return request({
url: `/api/realLine/${code}/exist`,
@ -60,8 +60,8 @@ export function querySkinCodeExistByCode(code) {
});
}
/** 获取皮肤列表*/
export function getSkinCodeList() {
/** 获取真实线路列表*/
export function getLineCodeList() {
return request({
url: `/api/realLine/list`,
method: 'get'

View File

@ -9,9 +9,9 @@ export function getPublishMapTree(cityCode) {
}
/** 获取产品详细内容*/
export function getProductDetail(prdCode) {
export function getProductDetail(prdId) {
return request({
url: `/api/mapPrd/${prdCode}`,
url: `/api/mapPrd/${prdId}`,
method: 'get'
});
}
@ -72,9 +72,9 @@ export function getCommodityMapProduct(mapId) {
/**
* 获取地图下的产品详情
*/
export function getMapProductDetail(prdCode) {
export function getMapProductDetail(prdId) {
return request({
url: `/api/mapPrd/${prdCode}`,
url: `/api/mapPrd/${prdId}`,
method: 'get'
});
}

View File

@ -106,8 +106,7 @@ export function getPlaceholderList(data) {
url: `/api/operate/placeholder`,
method: 'get',
params: {
trainingType: data.trainingType,
skinCode: data.skinCode
trainingType: data.trainingType
}
});
}

10
src/api/pushMessage.js Normal file
View File

@ -0,0 +1,10 @@
import request from '@/utils/request';
/** 推送通知消息*/
export function pushMessage(data) {
return request({
url: `/api/pushMessage`,
method: 'post',
data: data
});
}

View File

@ -1,15 +1,5 @@
import request from '@/utils/request';
/**
* 获取地图速度等级列表
*/
export function getSpeedLevels(skinCode) {
return request({
url: `/api/runPlan/draft/${skinCode}/speed`,
method: 'get'
});
}
/**
* 新建地图速度等级列表
*/
@ -52,7 +42,7 @@ export function queryRunPlan(planId) {
});
}
// 根据skinCode查询发布运行图列表
// 根据mapId查询发布运行图列表
export function queryRunPlanList(mapId) {
return request({
url: `/api/runPlan/template/${mapId}/list`,
@ -108,14 +98,6 @@ export function importRunPlan(data) {
});
}
/** 获取运行图停车点列表*/
export function getRunPlanStopPointList(skinCode) {
return request({
url: `/api/runPlan/draft/stopPoint/${skinCode}`,
method: 'get'
});
}
/** 运行图*/
export function getRpListByMapId(mapId) {
return request({
@ -297,14 +279,6 @@ export function deleteRunPlanEveryDay(planId) {
});
}
/** 获取地图运行图的车次号*/
// export function getPublishMapTrainNos(skinCode) {
// return request({
// url: `/api/runPlan/daily/${skinCode}/trainNos`,
// method: 'get'
// });
// }
/** 分页查询加载计划*/
export function getRunPlanLoadList(params) {
return request({

View File

@ -69,9 +69,9 @@ export function runDiagramIsStart(group) {
* 仿真系统CBTC
* @param {*} mapId
*/
export function simulationNotify({ mapId, code }) {
export function simulationNotify({ mapId, mapPrdId }) {
return request({
url: `/api/simulation/${mapId}/${code}`,
url: `/api/simulation/${mapId}/${mapPrdId}`,
method: 'get'
});
}

View File

@ -9,15 +9,6 @@ export function getTrainingSystemList(cityCode, params) {
});
}
export function querySystemByTypeAndPrdCode(params, prodCode) {
/** 根据系统类型和地图产品code查询系统的内容课程、章节、考试*/
return request({
url: `/api/mapSystem/queryByTypeAndPrdCode/${prodCode}`,
method: 'get',
params
});
}
export function getTrainingSystemListByMapId(mapId) {
/** 根据mapId去获取其子系统 */
return request({

View File

@ -127,6 +127,7 @@ export default {
},
methods: {
resetShowPosition(point) {
console.log(point);
if (point) {
this.show = true;
const self = this;

View File

@ -39,7 +39,7 @@
<el-input
v-model="formModel[item.prop]"
type="textarea"
:autosize='item.isAutoSize||false'
:autosize="item.isAutoSize||false"
:placeholder="item.placeholder"
:disabled="item.disabled"
:style="{width: item.tooltip ? 'calc(100% - 50px)' : '100%'}"
@ -114,6 +114,7 @@
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</template>
@ -132,6 +133,7 @@
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</template>
@ -147,6 +149,7 @@
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</template>
@ -163,6 +166,7 @@
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</template>
@ -178,6 +182,7 @@
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</template>

View File

@ -473,6 +473,9 @@ export default {
if (row.change) {
row.change(form);
}
if ( typeof row.selectChange === 'function') {
row.selectChange && row.selectChange(form);
}
}
}
};

View File

@ -10,6 +10,7 @@ export default {
deleteFailed: 'Failed to delete',
exportFailed: 'Export Execution Exceptions',
getListFailed: 'Failed to retrieve list data',
getPermissionListFailed: 'Failed to get permission list',
getDistributeQrcodeFailed: 'Failure to obtain permission to distribute two-dimensional code',
obtainMaxNumberFailed: 'Failed to obtain the maximum number of user privileges',
getTransferQrcodeFailed: 'Failure to obtain permission to transfer two-dimensional code',
@ -102,5 +103,6 @@ export default {
connectToRealDeviceFailed: 'Connect to real device failed!',
getRealDeviceListFailed: 'Get real device list failed!',
deleteRealDeviceFailed: 'Delete real device failed!',
checkTheValidityFirst: 'Please check the validity first!'
checkTheValidityFirst: 'Please check the validity first!',
permissionAtLeast:'At least one of the number of permissions is more than 0'
};

View File

@ -196,5 +196,6 @@ export default {
america: 'America',
companyInfo:'Beijing Jiulian Technology Co., Ltd',
companyTel:'Tel: +86 13289398171',
companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522'
companyICP:'Copyright ©2018 Beijing Jiulian Technology Co., Ltd ICP: 18028522',
enterPermissionNum:'please input permission number'
};

View File

@ -120,5 +120,6 @@ export default {
explanation: 'Explanation',
courseDetails: 'Course details',
courseTree: 'Course tree:',
mapName:'Map Name'
mapName:'Map Name',
copy: 'Copy'
};

View File

@ -88,6 +88,7 @@ export default {
button: 'button',
mapName: 'Name of the map:',
skinName: 'Skin style:',
selectCity: 'city:',
offsetXColon: 'X Offset:',
offsetYColon: 'Y Offset:',
@ -375,6 +376,7 @@ export default {
pointSystem2: 'TwoPointSystem',
pointSystem5: 'FivePointSystem',
skinType: 'SkinType',
lineCode:'Line Type',
turnoverTime: 'TurnoverTime',
productList: 'ProductList',
belongsToMapName: 'BelongsToMapName',
@ -543,5 +545,6 @@ export default {
horizontal: 'Horizontal',
vertical: 'Vertical',
piece: 'piece'
piece: 'piece',
setStationCode: 'Batch set up centralized station'
};

View File

@ -492,5 +492,6 @@ export default {
sourceTrainWindow: 'Source train window',
trainWindow: 'Train window',
targetTrainWindow: 'Target train window',
category: 'category'
category: 'category',
lineCode:'Line Type'
};

View File

@ -31,5 +31,10 @@ export default {
private: 'Private',
public: 'Public',
userName: 'User Name',
statusType: 'Status Type'
statusType: 'Status Type',
isPackage:'Package',
numOfDistribute:'Num of distribute',
numOfTransfer:'Num of transfer',
transferTips:'You can receive multiple permissions at a time, and the permissions you receive can continue to be transferred.',
distributeTips:'Only one permission can be obtained at a time. The permission received is a dedicated permission and cannot be redistributed.'
};

View File

@ -119,5 +119,8 @@ export default {
theBelongsProjectCannotBeEmpty: 'The belongs project cannot be empty',
pleaseSelectTheBelongsProject: 'Please select the belongs project',
copyMapAs: 'Copy map as',
whetherToCopyData: 'Whether to copy data'
whetherToCopyData: 'Whether to copy data',
copy:'Copy',
lineType:'Line Type',
belongsToMap: 'Belongs to map'
};

View File

@ -67,5 +67,6 @@ export default {
courseApplication: 'Course release application',
scriptReleaseApplication: 'Script release application',
runGraphReleaseApplication: 'Run graph release application',
subsystemGeneration: 'Subsystem generation'
subsystemGeneration: 'Subsystem generation',
newsBulletin: 'New bulletin'
};

View File

@ -36,6 +36,8 @@ export default {
sectionRelSwitchCode: 'sectionRelSwitchCode',
pleaseSelectSectionName: 'Select the section name',
pleaseSelectSection: 'Select the section',
pleaseSelectStationCode: 'Select the section station code',
pleaseFillOffset: 'Please fill in the offset',
pleaseFillValue: 'Please fill in the value',
pleaseSelectLeftSectionName: 'Please select the left section name',
@ -310,5 +312,8 @@ export default {
enterTheKeyDirection: 'Please select the key direction',
enterTheUpperText: 'Please enter the upper text',
enterTheLowerText: 'Please enter the lower text',
enterRejectReason: 'Please enter reject reason'
enterRejectReason: 'Please enter reject reason',
enterTheNewsTitle: 'Please enter news title',
enterTheNewsContent: 'Please enter news content',
chooseNewsCanBeClosed: 'Please select the news can be closed'
};

View File

@ -67,6 +67,12 @@ export default {
startStationRules: 'Please select start station ',
endStation: 'End Station',
endStationRules: 'Please select end station',
drivingMode:'Driving Mode',
drivingModeRules:'Please select driving mode',
speed:'Speed',
signal:'Signal',
speedRules:'Please input speed',
signalRules:'Please select signal',
addCommandButton: 'Add Command',
addConversitionButton: 'Add Dialogue',

View File

@ -48,5 +48,10 @@ export default {
editTrainingDetail: 'Editor Training Details',
trainingTime: 'Training duration',
subscribeToTheMapList: 'Subscribe to the map list:',
editSimulationDetails: 'Edit simulation details'
editSimulationDetails: 'Edit simulation details',
newsBulletin: 'News bulletin:',
newsHeadlines: 'News headlines:',
newsContent: 'News content:',
whetherTheNewsCanBeClosed: 'Whether the news can be closed:',
push: 'Push'
};

View File

@ -219,5 +219,7 @@ export default {
setProjectSuccess: 'Set belongs project success!',
setProjectFail: 'Set belongs project fail!',
copyMapSuccess: 'Copy map success!',
copyMapFail: 'Copy map fail!'
copyMapFail: 'Copy map fail!',
pushNewsSuccess: 'Push news success!',
pushNewsFailed: 'Push news failed!'
};

View File

@ -32,5 +32,6 @@ export default {
plcGatewayOnline: '[PLC gateway online]',
plcGatewayOffline: '[PLC gateway offline]',
uplinkPlatform: 'Uplink platform',
downlinkPlatform: 'Downlink platform'
downlinkPlatform: 'Downlink platform',
ibp:'IBP'
};

View File

@ -10,6 +10,7 @@ export default {
deleteFailed: '删除失败',
exportFailed: '导出执行异常',
getListFailed: '获取列表数据失败',
getPermissionListFailed: '获取权限列表数据失败',
getDistributeQrcodeFailed: '获取权限分发二维码失败',
obtainMaxNumberFailed: '获取用户最大权限个数失败',
getTransferQrcodeFailed: '获取权限转赠二维码失败',
@ -102,5 +103,6 @@ export default {
connectToRealDeviceFailed: '关联真实设备失败!',
getRealDeviceListFailed: '获取真实设备列表失败!',
deleteRealDeviceFailed: '删除真实设备失败!',
checkTheValidityFirst: '请先进行有效性检查!'
checkTheValidityFirst: '请先进行有效性检查!',
permissionAtLeast:'至少有一种权限的数量大于0'
};

View File

@ -196,5 +196,6 @@ export default {
america: '美国',
companyInfo:'北京玖琏科技有限公司',
companyTel:'联系电话: 13289398171',
companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号'
companyICP:'Copyright ©2018 北京玖琏科技有限公司 京ICP备18028522号',
enterPermissionNum:'请输入权限数量'
};

View File

@ -119,6 +119,7 @@ export default {
explanation: '驳回说明',
courseDetails: '课程详情',
courseTree: '课程树:',
mapName:'地图名称'
mapName:'地图名称',
copy: '复制'
};

View File

@ -488,6 +488,7 @@ export default {
pointSystem2: '2分制',
pointSystem5: '5分制',
skinType: '皮肤风格',
lineCode:'线路类型',
turnoverTime: '更新时间',
productList: '产品列表',
belongsToMapName: '所属地图名称',
@ -539,6 +540,7 @@ export default {
horizontal: '水平',
vertical: '垂直',
piece: 'piece'
piece: 'piece',
setStationCode: '批量设置集中站'
};

View File

@ -488,6 +488,7 @@ export default {
sourceTrainWindow: '源车次窗',
trainWindow: '车次窗',
targetTrainWindow: '目的车次窗',
category: '类别'
category: '类别',
lineCode:'线路类型'
};

View File

@ -38,5 +38,11 @@ export default {
permissionList: '查看权限列表',
lastShep: '上一步',
userName: '用户名称',
statusType: '状态类型'
statusType: '状态类型',
isPackage:'是否万能',
numOfDistribute:'分发权限数量',
numOfTransfer:'转赠权限数量',
transferTips:'一次可以领取多个权限,领到的权限可以继续转赠',
distributeTips:'一次只能领取一个权限,领到的权限是专用权限,不可再次分发'
};

View File

@ -123,5 +123,8 @@ export default {
theBelongsProjectCannotBeEmpty: '所属项目不能为空',
pleaseSelectTheBelongsProject: '请选择归属项目',
copyMapAs: '复制地图为',
whetherToCopyData: '是否复制数据'
whetherToCopyData: '是否复制数据',
copy:'复制',
lineType:'线路类型',
belongsToMap: '所属地图'
};

View File

@ -5,6 +5,7 @@ export default {
designUserPage: '个人地图',
mapManage: '地图管理',
skinManage: '皮肤管理',
mapDraw: '地图绘制',
runPlanManage: '运行图管理',
productEdit: '产品编辑',
@ -67,5 +68,6 @@ export default {
courseApplication: '课程发布申请',
scriptReleaseApplication: '剧本发布申请',
runGraphReleaseApplication: '运行图发布申请',
subsystemGeneration: '子系统生成'
subsystemGeneration: '子系统生成',
newsBulletin: '消息公告'
};

View File

@ -34,6 +34,8 @@ export default {
basisLink: '基础Link:',
pleaseSelectSectionName: '请选择区段名称',
pleaseSelectSection: '请选择区段',
pleaseSelectStationCode: '请选择设备集中站',
pleaseFillOffset: '请填写偏移量',
pleaseFillValue: '请填写数值',
pleaseSelectLeftSectionName: '请选择左侧区段名称',
@ -312,5 +314,8 @@ export default {
selectTheKeyDirection: '请选择钥匙朝向',
enterTheUpperText: '请输入上侧文字',
enterTheLowerText: '请输入下侧文字',
enterRejectReason: '请输入驳回说明'
enterRejectReason: '请输入驳回说明',
enterTheNewsTitle: '请输入消息标题',
enterTheNewsContent: '请输入消息内容',
chooseNewsCanBeClosed: '请选择消息是否可关闭'
};

View File

@ -67,6 +67,12 @@ export default {
startStationRules: '请选择起始站台',
endStation: '终点站台',
endStationRules: '请选择终点站台',
drivingMode:'列车驾驶模式',
drivingModeRules:'请选择列车驾驶模式',
speed:'速度',
signal:'信号机',
speedRules:'请输入速度',
signalRules:'请选择信号机',
addCommandButton: '添加指令',
addConversitionButton: '添加对话',

View File

@ -48,5 +48,10 @@ export default {
editTrainingDetail: '编辑实训详情',
trainingTime: '实训时长',
subscribeToTheMapList: '订阅地图列表:',
editSimulationDetails: '编辑仿真详情'
editSimulationDetails: '编辑仿真详情',
newsBulletin: '消息公告',
newsHeadlines: '消息标题:',
newsContent: '消息内容:',
whetherTheNewsCanBeClosed: '消息是否可关闭:',
push: '推送'
};

View File

@ -219,5 +219,7 @@ export default {
setProjectSuccess: '设置归属项目成功!',
setProjectFail: '设置归属项目失败!',
copyMapSuccess: '复制地图成功!',
copyMapFail: '复制地图失败!'
copyMapFail: '复制地图失败!',
pushNewsSuccess: '推送消息成功!',
pushNewsFailed: '推送消息失败!'
};

View File

@ -32,5 +32,6 @@ export default {
plcGatewayOnline: '[PLC网关在线]',
plcGatewayOffline: '[PLC网关离线]',
uplinkPlatform: '上行站台',
downlinkPlatform: '下行站台'
downlinkPlatform: '下行站台',
ibp:'IBP'
};

View File

@ -107,4 +107,10 @@ deviceRender[deviceType.Alarm] = {
z: 4
};
deviceRender[deviceType.CheckBox] = {
_type: deviceType.CheckBox,
zlevel: 10,
z: 0
};
export default deviceRender;

View File

@ -12,7 +12,8 @@ const deviceType = {
Key: 'Key',
TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
RotateTip: 'RotateTip'
RotateTip: 'RotateTip',
CheckBox: 'CheckBox'
};
export default deviceType;

View File

@ -303,5 +303,25 @@ class IbpPan {
}
}
}
renderCheckBox(model) {
const type = model._type;
const code = model.code;
const oDevice = this.ibpDevice[code] || deviceFactory(type, model);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, model));
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
if (!model._dispose) {
this.ibpDevice[code] = nDevice;
this.$painter.add(nDevice);
}
}
deleteCheckBox(code) {
const oDevice = this.ibpDevice[code];
if (oDevice) {
delete this.ibpDevice[code];
this.$painter.delete(oDevice);
}
}
}
export default IbpPan;

View File

@ -27,9 +27,14 @@ class MouseController extends Eventful {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false;
this.isAllowDragging = ibp.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = ibp.getEvents();
this._dragging = false;
this._dragging = false; // 是否在拖拽状态
this.deviceList = [];
this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.initHandler(this.$zr);
}
@ -79,31 +84,25 @@ class MouseController extends Eventful {
}
mousedown(e) {
if (eventTool.notLeftMouse(e)) {
return;
}
e.event.preventDefault();
e.event.stopPropagation();
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer');
}
this._offsetX = e.offsetX;
this._offsetY = e.offsetY;
this._x = e.offsetX;
this._y = e.offsetY;
this._dragging = true;
if (e.which === 3) {
this.handleMouseDownRight(e);
} else if (e.which === 1) {
this.handleMouseDownLeft(e);
} else if (e.which === 2) {
this.handleMouseDownWheel(e);
}
}
mousemove(e) {
if (eventTool.notLeftMouse(e) ||
!this._moveOnMouseMove ||
!this._dragging || !this.isAllowDragging
) {
return;
}
const oldX = this._x;
const oldY = this._y;
@ -112,32 +111,38 @@ class MouseController extends Eventful {
this._x = e.offsetX;
this._y = e.offsetY;
if (this._dragging) {
if ((this.eventTarget && this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
return true;
} else if (this.isAllowDragging && this.eventTarget) {
this.eventTarget.grouper.drift(dx, dy, e);
if (e.which === 3) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
} else if (e.which === 1) {
this.handleMouseMoveLeft(e, dx, dy, oldX, oldY);
}
} else {
return true;
}
}
mouseup(e) {
if (!eventTool.notLeftMouse(e)&&this.isAllowDragging && this.eventTarget) {
if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
return;
}
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
});
this.deviceList = [];
this.$ibp.deleteCheckBox('check_box');
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
return;
}
if (this.isAllowDragging) {
this.eventTarget.setModel(e.offsetX - this._offsetX, e.offsetY - this._offsetY);
this.eventTarget.dirty();
}
// debugger;
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
// console.log('111-------');
if (this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('default');
}
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
}
contextmenu(e) {
@ -191,6 +196,90 @@ class MouseController extends Eventful {
return newEm;
}
/** 处理鼠标右键按下事件 */
handleMouseDownRight(e) {
this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY;
}
/** 处理鼠标左键按下事件 */
handleMouseDownLeft(e) {
if (this.eventTarget && this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('pointer');
this.$ibp.deleteCheckBox('check_box');
} else if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) {
this.handleBoundingRect(this.eventTarget);
} else {
this.$ibp.deleteCheckBox('check_box');
}
}
/** 处理滚轮按下事件 */
handleMouseDownWheel(e) {
this.deviceList = [];
Object.values(this.$ibp.ibpDevice).forEach(item => {
if (item.instance._type !== deviceType.Background) {
this.deviceList.push(item.instance);
}
});
}
/** 处理右键拖动事件--- 改变选中区域大小 */
handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint;
const x = Math.min(point1.x, point2.x) + this.$ibp.$options.offsetX;
const y = Math.min(point1.y, point2.y) + this.$ibp.$options.offsetY;
const width = Math.abs(point1.x - point2.x);
const height = Math.abs(point1.y - point2.y);
this.$ibp.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height });
}
/** 处理左键拖动事件--- 图形移动 */
handleMouseMoveLeft(e, dx, dy, oldX, oldY) {
if (!this._moveOnMouseMove || !this._dragging || !this.isAllowDragging) {
return;
}
// 选中区域图形移动
if (this.deviceList.length) {
this.deviceList.forEach(item => {
item.grouper.drift(dx, dy, e);
});
} else if (this._dragging && this.eventTarget) { // 选中元素图形移动
if (( this.eventTarget._type === deviceType.Background) || !this.isAllowDragging) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (this.isAllowDragging) {
this.eventTarget.grouper.drift(dx, dy, e);
}
}
}
/** 通过包围盒筛选选中区域的元素 */
handleBoundingRect(eventTarget) {
this.deviceList = [];
let boundingRect = eventTarget.grouper.getBoundingRect();
boundingRect = this.createFakeBoundingRect(eventTarget, boundingRect);
const deviceList = Object.values(this.$ibp.ibpDevice);
const includeDeviceList = [];
deviceList.forEach( item =>{
if (item.instance._type !== deviceType.Background) {
let deviceBoundingRect = item.instance.grouper.getBoundingRect();
deviceBoundingRect = this.createFakeBoundingRect(item.instance, deviceBoundingRect);
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item.instance);
}
}
});
this.deviceList = includeDeviceList;
}
/** 创建假包围盒对象 */
createFakeBoundingRect(instance, boundingRect) {
return {
x1: instance.model.point.x + boundingRect.x,
y1: instance.model.point.y + boundingRect.y,
x2: instance.model.point.x + boundingRect.width,
y2: instance.model.point.y + boundingRect.height
};
}
/** 判断元素包围盒是否在选中区域 */
whetherInclude(boundingRect1, boundingRect2) {
return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2;
}
}
export default MouseController;

46
src/ibp/shape/checkBox.js Normal file
View File

@ -0,0 +1,46 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class checkBox extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.box = new Rect({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
},
style: {
fill: 'rgb(135,206,250,0.2)'
}
});
this.grouper.add(this.box);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
setSize(width, height) {
this.model.width = width;
this.model.height = height;
}
}

View File

@ -13,6 +13,7 @@ import Key from './key';
import TeleTerminal from './teleTerminal';
import Clock from './clock';
import RotateTip from './rotateTip';
import CheckBox from './checkBox';
const ibpShape = {};
ibpShape[deviceType.Arrow] = Arrow;
@ -29,6 +30,7 @@ ibpShape[deviceType.Key] = Key;
ibpShape[deviceType.TeleTerminal] = TeleTerminal;
ibpShape[deviceType.Clock] = Clock;
ibpShape[deviceType.RotateTip] = RotateTip;
ibpShape[deviceType.CheckBox] = CheckBox;
function shapefactory(device, ibp) {
const type = device.model._type;

View File

@ -8,6 +8,7 @@ export default class ibpLine extends Group {
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.model.point = this.model.point1;
this.z = device.model.z;
this.create();
}

View File

@ -120,7 +120,7 @@ export function Jlmap3ddata(mapid,scope){
}
function init3d(mapid,netdata){
console.log(netdata)
// console.log(netdata)
getMapDetail(mapid).then(data => {
jlmap3ddata.id = netdata.id;
jlmap3ddata.mapId = mapid;
@ -141,8 +141,8 @@ export function Jlmap3ddata(mapid,scope){
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
console.log(mapdata);
assetloader.setmodellist(netdata.assets);
// console.log(mapdata);
assetloader.setmodellist(netdata.assets,5);
assetloader.assetpromise(scene)
.then(function(data){
//console.log(data);
@ -162,7 +162,7 @@ export function Jlmap3ddata(mapid,scope){
})
.then(function(data){
//console.log(data);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader,"0");
})
// .then(function(data){
// //console.log(data);

View File

@ -48,7 +48,7 @@ export function SectionList() {
}
}
buildsuidao(linkdata,scope.sections,assetloader,scene);
console.log(scope.sections.datalist);
// console.log(scope.sections.datalist);
//定义区分道岔组
let switchlist = [];
//遍历道岔数据
@ -105,7 +105,7 @@ export function SectionList() {
}
}
scope.switchs.datalist = switchlist;
console.log(switchlist);
// console.log(switchlist);
//道岔贴图
let switchmesh1;
let switchmesh2;
@ -142,9 +142,9 @@ export function SectionList() {
let switchposz = sectionA.position.z;
let switchposx;
if(switchlist[i].code == "Switch_135_0.16369"){
console.log(switchlist[i]);
}
// if(switchlist[i].code == "Switch_135_0.16369"){
// console.log(switchlist[i]);
// }
if(switchlist[i].pa[0].x>switchlist[i].pb[0].x){
if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[0].y){
if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){
@ -270,7 +270,7 @@ export function SectionList() {
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
console.log(sectiondata);
// console.log(sectiondata);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist;

View File

@ -159,13 +159,13 @@ export function Jl3dDriving(updatemmi,sound,translation) {
if (trainlisttest.list[code].runMode == '02') {
if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/25/trainlisttest.list[code].len);
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/25/trainlisttest.list[code].len);
}
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/25/trainlisttest.list[code].len);
}
if (code == drivingcode) {
@ -309,7 +309,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
if (rails.linkrail[data.body[i].linkCode]) {
console.log(trainlisttest.group);
// console.log(trainlisttest.group);
if(trainlisttest.group.children.length<1){
trainlisttest.group.add(trainlisttest.list[code]);
}
@ -363,7 +363,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
// 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/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/25/trainlisttest.list[code].len);
}
@ -421,7 +421,41 @@ export function Jl3dDriving(updatemmi,sound,translation) {
}
}
if (trainlisttest.list[code].status != data.body[i].directionType) {
if (data.body[i].directionType == '02') { // 向右
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;
trainlisttest.list[code].position.x = rotaposx;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = rotaposz;
}
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].len = rails.linkrail[data.body[i].linkCode].lengthfact;
} else if (data.body[i].directionType == '03') { // 向左
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].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;
}
}
@ -485,7 +519,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
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/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
}else if(data.body[i].directionType == '03'){
if(rails.linkrail[data.body[i].linkCode].lineright){
@ -499,7 +533,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
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/24/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
}
trainlisttest.list[code].nextcode = nextcode;

View File

@ -12,6 +12,7 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null;
// console.log(traindata.group.children[0].progress);
if(traindata.group.children[0].progress >=0&&traindata.group.children[0].progress<=1){
let movecurve = trainmodel.curve;
@ -19,8 +20,9 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[0].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.001){
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
@ -37,6 +39,7 @@ export function UpdateTrain(camera,traindata,control){
let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z);
trainmodel.children[0].position.z += offsetz;
// trainmodel.position.z = point.z;
}
@ -52,7 +55,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]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -78,8 +81,9 @@ 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.001){
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
@ -94,12 +98,13 @@ export function UpdateTrain(camera,traindata,control){
}
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++){
@ -110,7 +115,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]+6)>=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -146,7 +151,7 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
trainmodel.nowcode = trainmodel.nextcode;
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/24/trainmodel.len);
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
trainmodel.curve = trainmodel.nextcurve;
trainmodel.nextcurve = null;
@ -178,7 +183,7 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.status == "03" && trainmodel.progress>0){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[0].progress);
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.01){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();
@ -210,7 +215,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]-6)<=trainmodel.children[rs].rotalist[0].posr.x){
if((trainmodel.children[rs].matrixWorld.elements[12]-9)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
let asd = trainmodel.children[rs].rotalist[0];
@ -240,7 +245,7 @@ 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.01){
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
trainmodel.children[0].up = new THREE.Vector3(1,0,0);
let tangent = movecurve.getTangentAt(traindata.group.children[0].progress).normalize();
trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize();

View File

@ -114,13 +114,13 @@ export function Jlmap3dSubscribe(jlmap3d) {
trainlisttest.list[code].speed = data.body[tl].v;
if (trainlisttest.list[code].runMode == '02') {
if (trainlisttest.list[code].isStandTrack == true) {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/17/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
}
} else {
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/21/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
}
if (code == drivingcode) {
@ -313,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/21/trainlisttest.list[code].len);
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
}
}
@ -622,9 +622,9 @@ export function Jlmap3dSubscribe(jlmap3d) {
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]);
// 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;

View File

@ -36,6 +36,7 @@ let defaultstation = {
picUrl:"",
assetUrl:modelurl+"/models/station/fuzhou/fuzhou.FBX"
}
//modelurl+"/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
@ -64,11 +65,12 @@ let defaultsuidao = {
deviceType:"suidao",
type:"suidao",
picUrl:"",
assetUrl:"../../static/model/suidao/suidao.FBX"
assetUrl:modelurl+"/models/suidao/suidao.FBX"
}
//modelurl+"/models/suidao/suidao.FBX"
//https://test.joylink.club/oss/models/suidao/suidao.FBX
//https://joylink.club/oss/models/suidao/suidao.FBX
//../../static/model/
//../../static/model/suidao/suidao.FBX
let defaultautorail = {
id:"100",
@ -112,11 +114,16 @@ export function AssetLoader(){
this.name = null;
this.trainoffset = 0;
this.modellist = [];
this.materiallist = [];
//初始化资源加载器
this.setmodellist = function (data){
this.setmodellist = function (data,trainoffset){
if(trainoffset){
scope.trainoffset = trainoffset;
}
// console.log("setmodellist");
let defaultmodel1 = new AssetModel(defaultsignal);
scope.modellist.push(defaultmodel1);
@ -464,7 +471,8 @@ 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;
object.children[i].position.x = object.children[i].position.x+scope.trainoffset;
//object.children[i].position.y = j*10;
realtrain.add(object.children[i]);
i--;

View File

@ -554,7 +554,7 @@ THREE.FBXLoader = ( function () {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
// parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
@ -567,7 +567,7 @@ THREE.FBXLoader = ( function () {
if(materialNode.Opacity.value<1 && materialNode.Opacity.value>0.9){
parameters.side = THREE.DoubleSide;
parameters.transparent = true;
parameters.alphaTest = 0.7;
// parameters.alphaTest = 0.7;
parameters.opacity = 1;
}else{
parameters.opacity = parseFloat( materialNode.Opacity.value );
@ -577,7 +577,7 @@ THREE.FBXLoader = ( function () {
if ( parameters.opacity < 1.0 ) {
parameters.transparent = true;
parameters.alphaTest = 0.1;
// parameters.alphaTest = 0.1;
}
if ( materialNode.ReflectionFactor ) {

View File

@ -66,7 +66,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
// console.log(netdata.assets);
assetloader.setmodellist(netdata.assets);
assetloader.setmodellist(netdata.assets,5);
assetloader.assetpromise(sceneload)
.then(function(data){
@ -75,12 +75,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,store
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"02");
})
.then(function(data){
//console.log(data);
//console.log(assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
})
.then(function(data){
//console.log(data);

View File

@ -73,12 +73,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
})
.then(function(data){
//console.log(data);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions);
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0");
})
.then(function(data){
//console.log(data);
//console.log(assetloader);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions);
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0");
})
.then(function(data){
//console.log(data);
@ -104,7 +104,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
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;
scope.assetloader.modellist[mn].mesh.position.y -=0.1;
// scope.assetloader.modellist[mn].mesh.position.y -=0.1;
// console.log(scope.assetloader.modellist[mn].mesh);
scene.add(scope.assetloader.modellist[mn].mesh);
}

View File

@ -23,24 +23,8 @@ export function RailList(){
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.2,0,scope.linkrail[linkdata[i].code].lp.z-0.2));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.2,0,scope.linkrail[linkdata[i].code].rp.z+0.2));
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.2,0,scope.linkrail[linkdata[i].code].lp.z+0.2));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-2.2,0,scope.linkrail[linkdata[i].code].rp.z-0.2));
}
}
}
for(let i=0;i<switchdata.length;i++){
scope.switchrail[switchdata[i].code] = {
alink:switchdata[i].alink,
@ -52,64 +36,101 @@ export function RailList(){
};
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-1,switchdata[i].position.y,switchdata[i].position.z));
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+1.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.1));
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.2,0,scope.linkrail[switchdata[i].alink].lp.z-0.2));
}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+1.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.1));
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.2,0,scope.linkrail[switchdata[i].alink].lp.z+0.2));
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
scope.linkrail[switchdata[i].blink].rswitch = switchdata[i].code;
}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+1,switchdata[i].position.y,switchdata[i].position.z));
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-1.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.1));
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.2,0,scope.linkrail[switchdata[i].alink].rp.z+0.2));
}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-1.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.1));
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.2,0,scope.linkrail[switchdata[i].alink].rp.z-0.2));
}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";
scope.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
scope.linkrail[switchdata[i].blink].lswitch = switchdata[i].code;
}
//
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-1,switchdata[i].position.y,switchdata[i].position.z));
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(switchdata[i].position.x+1,switchdata[i].position.y,switchdata[i].position.z-0.11));
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+1.1,0,scope.linkrail[switchdata[i].alink].lp.z-0.1));
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.2,0,scope.linkrail[switchdata[i].alink].lp.z-0.2));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x+1,switchdata[i].position.y,switchdata[i].position.z+0.11));
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+1.1,0,scope.linkrail[switchdata[i].alink].lp.z+0.1));
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+2.2,0,scope.linkrail[switchdata[i].alink].lp.z+0.2));
scope.linkrail[switchdata[i].alink].lswitch = switchdata[i].code;
scope.linkrail[switchdata[i].clink].rswitch = switchdata[i].code;
}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.linkrail[switchdata[i].alink].rswitch = switchdata[i].code;
scope.linkrail[switchdata[i].clink].lswitch = switchdata[i].code;
}
scope.switchrail[switchdata[i].code].directtype = "1";
}
for(let i=0;i<linkdata.length;i++){
if(linkdata[i].rotation._z == 0){
scope.linkrail[linkdata[i].code].type = 0;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,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,0,scope.linkrail[linkdata[i].code].rp.z));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+1,switchdata[i].position.y,switchdata[i].position.z));
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(switchdata[i].position.x-1,switchdata[i].position.y,switchdata[i].position.z+0.11));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-1.1,0,scope.linkrail[switchdata[i].alink].rp.z+0.1));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.2,0,scope.linkrail[switchdata[i].alink].rp.z+0.2));
}else if(scope.linkrail[switchdata[i].alink].type == 2){
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1,switchdata[i].position.y,switchdata[i].position.z-0.11));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-1.1,0,scope.linkrail[switchdata[i].alink].rp.z-0.1));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-2.2,0,scope.linkrail[switchdata[i].alink].rp.z-0.2));
if(linkdata[i].rotation._z>0){
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
]);
scope.linkrail[linkdata[i].code].type = 1;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z-0.05));
}
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z+0.05));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}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));
let testline = new THREE.CatmullRomCurve3([
new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z),
new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z)
]);
scope.linkrail[linkdata[i].code].type = 2;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+4.5,0,switchpoint.z+0.05));
}
scope.switchrail[switchdata[i].code].directtype = "2";
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82));
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-4.5,0,switchpoint.z-0.05));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}
}
}
for(let i=0;i<switchdata.length;i++){
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
@ -123,7 +144,6 @@ export function RailList(){
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;
@ -133,10 +153,38 @@ export function RailList(){
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}
}
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-2,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.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+2,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.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-3.5,switchdata[i].position.y,switchdata[i].position.z+0.02));
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.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+3.5,switchdata[i].position.y,switchdata[i].position.z-0.02));
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
//
scope.switchrail[switchdata[i].code].directtype = "2";
}
}
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.curveType = "centripetal";
// scope.linkrail[linkdata[i].code].lineleft.tension = 0.2;
let rightpoints = [];
scope.linkrail[linkdata[i].code].points.forEach(item=>{
@ -145,10 +193,10 @@ export function RailList(){
);
rightpoints.reverse();
scope.linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.linkrail[linkdata[i].code].lineright.curveType = "chordal";
scope.linkrail[linkdata[i].code].lineright.curveType = "centripetal";
//
// for(let n=0,nm=scope.linkrail[linkdata[i].code].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.5, 16 );
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle = new THREE.Mesh( geometry, material );
// console.log(n);
@ -177,7 +225,7 @@ export function RailList(){
// // Create the final object to add to the scene
// var curveObject = new THREE.Line( geometry, material );
//
// curveObject.position.y = Math.random()/10;
// curveObject.position.y = Math.random();
// scene.add(curveObject);
}

View File

@ -12,7 +12,7 @@ export function StationStandList() {
this.textlist = [];
this.initpromise = function(stationdata,stationstanddata,scene,assetloader,netdata,mixers,actionss){
this.initpromise = function(stationdata,stationstanddata,scene,assetloader,netdata,mixers,actionss,mode){
return new Promise(function(resolve, reject){
let netstand = null;
@ -164,25 +164,33 @@ 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;
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 271, 374, 1 );
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].num].code;
map[k].type = "station";
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;
//textplane.position.x = -30;
scope.textlist.push(textplane);
map[k].mesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
map[k].type = "station";
map[k].rname = stationdata[map[k].num].runPlanName;
map[k].kmmark = stationdata[map[k].num].kmPost;
scope.group.add(map[k].mesh);
}
@ -354,9 +362,9 @@ function getTextCanvas(text){
ctx.fillText("信息", 114,100);
ctx.fillText("备忘", 190,100);
ctx.fillText("车站序号: "+text.name, 40,155);
ctx.fillText("车站序号: "+text.name, 10,155);
ctx.fillText("公里标记:"+text.kmPost,40 ,256*3/4);
ctx.fillText("公里标记:"+text.kmPost,10 ,256*3/4);
let data = ctx.getImageData(0, 0,256,512);
return data;

View File

@ -12,7 +12,7 @@ export function TrainList() {
this.textlist = [];
this.initpromise = function(data,scene,assetloader,mixers,actionss){
this.initpromise = function(data,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
//遍历列车数据
for(let i=0;i<data.length;i++){
@ -118,6 +118,8 @@ export function TrainList() {
// newmesh.children[n-1].add(newmesh.children[n]);
// }
//创建列车字牌
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 150, 100, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
@ -130,10 +132,14 @@ export function TrainList() {
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.children[0].add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
//group.add(textplane);
newmesh.first = false;
newmesh.name = data[i].code;
@ -187,24 +193,24 @@ function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 128;
canvas.height = 96;
canvas.height = 64;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,128,96);
ctx.font = "10px Verdana";
ctx.fillRect(0, 0,128,64);
ctx.font = "8px Verdana";
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,96);
ctx.clearRect(0,0,128,64);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,128, 96);
ctx.fillText("车组号:"+text.groupNumber, 60,15);
ctx.fillText("车组人员:XXX", 60,31);
ctx.fillText("速度:XXX.XXX", 60,43);
ctx.drawImage(beauty,0,0,128, 64);
ctx.fillText("车组号:"+text.groupNumber, 40,10);
ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,128,96);
let data = ctx.getImageData(0, 0,128,64);
return data;
}

View File

@ -20,7 +20,8 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.status == "03"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(traindata.group.children[j].progress);
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
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();
@ -46,8 +47,7 @@ export function UpdateTrain(camera,traindata){
//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++){
@ -84,6 +84,8 @@ export function UpdateTrain(camera,traindata){
if(trainmodel.status == "02"){
if(movecurve.points.length>1){
let point = movecurve.getPointAt(trainmodel.progress);
trainmodel.position.x = point.x;
trainmodel.position.y = 0;
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();
@ -103,8 +105,7 @@ export function UpdateTrain(camera,traindata){
//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++){

View File

@ -260,6 +260,14 @@ class SkinCode extends defaultStyle {
},
arrow: {
show: true // 控制模式箭头显隐
},
mouseOverStyle: { // 鼠标悬浮样式
fontSize: null,
fontFormat: 'consolas',
fontColor: '#000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top'
}
};
@ -294,7 +302,7 @@ class SkinCode extends defaultStyle {
offset: {x: 0, y: 8}, // 道岔名称与区段距离
fontSize: 11, // 字体大小
fontColor: '#C0C0C0', // 道岔名称颜色
fontWeight: 'normal', // 字体粗细
fontWeight: 'bold', // 字体粗细
borderColor: '#FE0000', // 道岔边框颜色
lossColor: '#FFFFFF', // 道岔失去颜色
locateColor: '#00FF00', // 道岔定位颜色
@ -309,8 +317,8 @@ class SkinCode extends defaultStyle {
contentRectShow: false // 道岔封锁显示
},
monolock: { // 道岔单锁配置
locationColor: '#870E10', // 道岔单锁定位颜色 (红色)
inversionColor: '#870E10', // 道岔单锁反位颜色 (红色)
locationColor: '#ea282c', // 道岔单锁定位颜色 (红色)
inversionColor: '#ea282c', // 道岔单锁反位颜色 (红色)
rectShow: false // 道岔单锁 矩形框是否显示
}
};
@ -319,11 +327,71 @@ class SkinCode extends defaultStyle {
lineColor: '#FFFFFF' // 线条颜色
};
this[deviceType.LcControl] = {};
this[deviceType.LcControl] = {
text: {
fontSize: 10, // 灯字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#FFFF00' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
arcColor: '#00FFFF',
textColor: '#000000'
}
};
this[deviceType.ZcControl] = {};
this[deviceType.ZcControl] = {
text: {
fontSize: 10, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#00FF00' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
arcColor: '#00FFFF',
textColor: '#000000'
}
};
this[deviceType.LimitControl] = {};
this[deviceType.LimitControl] = {
text: {
fontSize: 10, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
lamp: {
radiusR: 6, // 灯大小
controlColor: '#ECE9D8' // 灯颜色
},
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
fontColor: '#FFF000',
fontWeight: 'normal',
textAlign: 'middle',
textVerticalAlign: 'top',
textColor: '#000000',
arcColor: '#00FFFF'
}
};
this[deviceType.TrainWindow] = {
lineColor: '#4DD43F', // 车次窗颜色

View File

@ -126,5 +126,10 @@ deviceRender[deviceType.TRain] = {
zlevel: 1
// progressive: 4
};
/** CheckBox渲染配置*/
deviceRender[deviceType.CheckBox] = {
_type: deviceType.CheckBox,
zlevel: 1
};
export default deviceRender;

View File

@ -16,7 +16,8 @@ const deviceType = {
Train: 'Train',
TrainWindow: 'TrainWindow',
Line: 'Line',
Text: 'Text'
Text: 'Text',
CheckBox: 'CheckBox'
};
export default deviceType;

View File

@ -0,0 +1,80 @@
import Eventful from 'zrender/src/mixin/Eventful';
class KeyboardController extends Eventful {
constructor(jmap) {
super();
this.$jmap = jmap;
this.$zr = jmap.getZr();
this.events = jmap.getEvents();
this.initData();
this.initHandler(this.$zr);
}
initHandler(zr) {
if (zr) {
var keydownHandle = this.keydown.bind(this);
var keyupHandle = this.keyup.bind(this);
this.enable = function (opts) {
opts = opts || {};
this._keyOnDownUp = opts.keyOnDownUp || true;
window.addEventListener('keydown', keydownHandle, false);
window.addEventListener('keyup', keyupHandle, false);
};
this.disable = function () {
window.removeEventListener('keydown', keydownHandle, false);
window.removeEventListener('keyup', keyupHandle, false);
};
this.dispose = function() {
this.disable();
};
}
}
initData() {
this._keyboards = [
{ key: 'Control', keyCode: 17, active: false },
{ key: 'Shift', keyCode: 16, active: false },
{ key: 'Alt', keyCode: 18, active: false }
];
}
keydown(e) {
if (this._keyOnDownUp && !e.repeat) {
var index = this._keyboards.findIndex(
elem=> { return elem.keyCode == e.keyCode; }
);
if (index >= 0) {
this._keyboards[index].active = true;
} else {
var str = '';
this._keyboards.forEach(elem => {
if (elem.active) {
str += elem.key;
str += '_';
}
});
str += e.key.toUpperCase();
this.trigger(this.events.Keyboard, str);
this._keyboards.forEach(elem => { elem.active = false; });
}
}
}
keyup(e) {
if (this._keyOnDownUp && !e.repeat) {
this._keyboards.forEach(elem=> {
if (elem.keyCode == e.keyCode) {
elem.active = false;
}
});
}
}
}
export default KeyboardController;

View File

@ -4,6 +4,7 @@ import localStore from 'storejs';
import Painter from './painter';
import Options from './options';
import MouseController from './mouseController';
import KeyboardController from './keyboardController';
import deviceState from './constant/deviceState';
import deviceType from './constant/deviceType';
import { selectSkinCode } from './config/deviceStyle';
@ -19,7 +20,7 @@ class Jlmap {
this.methods = opts.methods;
// 鼠标事件
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom'};
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom', Keyboard: 'keyboard'};
// 皮肤参数
this.skinCode = '';
@ -56,6 +57,9 @@ class Jlmap {
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
this.$mouseController.on(this.events.__Zoom, this.optionsHandler);
this.$keyboardController = new KeyboardController(this);
this.$keyboardController.enable();
}
loadStyle(skinCode) {
@ -324,6 +328,7 @@ class Jlmap {
this.clear();
this.$mouseController.dispose();
this.$keyboardController.dispose();
this.$zr && zrender.dispose(this.$zr);
this.$painter.dispose();
}
@ -341,6 +346,8 @@ class Jlmap {
case this.events.DataZoom:
this.$mouseController.on(this.events.DataZoom, cb, context);
break;
case this.events.Keyboard:
this.$keyboardController.on(this.events.Keyboard, cb, context);
}
}
}
@ -358,9 +365,32 @@ class Jlmap {
case this.events.DataZoom:
this.$mouseController.off(this.events.DataZoom, cb);
break;
case this.events.Keyboard:
this.$keyboardController.off(this.events.keyboard, cb);
break;
}
}
}
renderCheckBox(model) {
const type = model._type;
const code = model.code;
const oDevice = this.mapDevice[code] || deviceFactory(type, model);
const nDevice = deviceFactory(type, Object.assign(oDevice.model || {}, model));
delete this.mapDevice[code];
this.$painter.delete(oDevice);
if (!model._dispose) {
this.mapDevice[code] = nDevice;
this.$painter.add(nDevice);
}
}
deleteCheckBox(code) {
const oDevice = this.mapDevice[code];
if (oDevice) {
delete this.mapDevice[code];
this.$painter.delete(oDevice);
}
}
}
export default Jlmap;

View File

@ -13,6 +13,7 @@ class EventModel {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.eventTarget = view;
break;
}
@ -32,6 +33,11 @@ class MouseController extends Eventful {
constructor(jmap) {
super();
this.$jmap = jmap;
this.deviceList = [];
this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.$zr = jmap.getZr();
this.events = jmap.getEvents();
this.initHandler(this.$zr);
@ -76,25 +82,31 @@ class MouseController extends Eventful {
}
mousedown(e) {
if (eventTool.notLeftMouse(e)) {
return;
}
// if (eventTool.notLeftMouse(e)) {
// return;
// }
if (e.which == 1 || e.which == 3) {
var x = e.offsetX;
var y = e.offsetY;
this._x = x;
this._y = y;
this._dragging = true;
if (e.which == 3 && this._zoomOnMouseWheel) {
this.handleMouseDownRight(e);
} else if (e.which == 1 && this._zoomOnMouseWheel) {
this.handleMouseDownLeft(e);
}
}
}
mousemove(e) {
if (eventTool.notLeftMouse(e) ||
!this._moveOnMouseMove ||
!this._dragging
) {
return;
}
// if (eventTool.notLeftMouse(e) ||
// !this._moveOnMouseMove ||
// !this._dragging
// ) {
// return;
// }
const oldX = this._x;
const oldY = this._y;
@ -105,15 +117,25 @@ class MouseController extends Eventful {
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which == 1) {
this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (e.which === 3 && this._zoomOnMouseWheel) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
}
}
mouseup(e) {
if (!eventTool.notLeftMouse(e)) {
this._dragging = false;
}
if (this._zoomOnMouseWheel && this.$jmap.mapDevice['check_box']) {
this.eventTarget = this.$jmap.mapDevice['check_box'].instance;
this.handleBoundingRect(this.eventTarget);
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
}
mousewheel(e) {
@ -192,6 +214,91 @@ class MouseController extends Eventful {
return newEm;
}
// 处理鼠标右键按下事件
handleMouseDownRight(e) {
this.rightClickPoint.x = e.offsetX;
this.rightClickPoint.y = e.offsetY;
}
// 处理鼠标左键按下事件
handleMouseDownLeft(e) {
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
if (this.eventTarget && this.eventTarget._type === deviceType.CheckBox) {
this.handleBoundingRect(this.eventTarget);
} else {
this.$jmap.deleteCheckBox('check_box');
this.eventTarget = '';
this.deviceList = [];
}
}
// 通过包围盒筛选选中区域的元素
handleBoundingRect(eventTarget) {
this.deviceList = [];
const boundingRect = this.createFakeBoundingRect(eventTarget);
const deviceList = Object.values(this.$jmap.mapDevice);
const includeDeviceList = [];
deviceList.forEach( item =>{
if (item.instance._type == deviceType.Section) {
let deviceBoundingRect = {};
if (item.type == '03') {
deviceBoundingRect = {
x1: item.namePosition.x,
y1: item.namePosition.y,
x2: item.namePosition.x,
y2: item.namePosition.y
};
} else {
deviceBoundingRect = {
x1: item.points[0].x,
y1: item.points[0].y,
x2: item.points[item.points.length - 1].x,
y2: item.points[item.points.length - 1].y
};
}
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
}
if (item.instance._type == deviceType.Switch) {
const deviceBoundingRect = {
x1: item.intersection.x,
y1: item.intersection.y,
x2: item.intersection.x,
y2: item.intersection.y
};
if (this.whetherInclude(boundingRect, deviceBoundingRect )) {
includeDeviceList.push(item);
}
}
});
this.deviceList = includeDeviceList;
store.dispatch('map/setSeclectDeviceList', this.deviceList);
}
// 生成包围盒对象坐标
createFakeBoundingRect(instance) {
return {
x1: instance.model.point.x,
y1: instance.model.point.y,
x2: instance.model.point.x + instance.model.width,
y2: instance.model.point.y + instance.model.height
};
}
// 判断元素包围盒是否在选中区域
whetherInclude(boundingRect1, boundingRect2) {
return boundingRect1.x1 <= boundingRect2.x1 && boundingRect1.y1 <= boundingRect2.y1 && boundingRect1.x2 >= boundingRect2.x2 && boundingRect1.y2 >= boundingRect2.y2;
}
// 右键拖动区域大小
handleMouseMoveRight(point2) {
const point1 = this.rightClickPoint;
const x = Math.min(point1.x, point2.x) + this.$jmap.$options.offsetX;
const y = Math.min(point1.y, point2.y) + this.$jmap.$options.offsetY;
const width = Math.abs(point1.x - point2.x);
const height = Math.abs(point1.y - point2.y);
this.$jmap.renderCheckBox({code: 'check_box', _type: 'CheckBox', point: {x: x, y: y}, width: width, height: height });
}
}
export default MouseController;

View File

@ -2,7 +2,7 @@ class Options {
constructor(opts, trigger) {
this.scaleIndex = 0;
this.scaleList = [
0.5, 0.6, 0.7, 0.8, 0.9,
0.8, 0.9,
1, 1.2, 1.4, 1.6, 1.8,
2, 2.2, 2.4, 2.6, 2.8,
3, 3.2, 3.4, 3.6, 3.8,
@ -10,7 +10,7 @@ class Options {
5, 5.2, 5.4, 5.6, 5.8,
6, 6.2, 6.4, 6.6, 6.8,
7, 7.2, 7.4, 7.6, 7.8,
8, 8.2, 8.4, 8.6, 8.8
8
];
if (Number.isFinite(opts.scaleRate)) {

View File

@ -372,7 +372,7 @@ export default class Section extends Group {
}
/** 目的码名称*/
if (model.destinationCode && model.destinationCodeShow && style.Section.destinationText.show) {
if (model.destinationCode && style.Section.destinationText.show) {
const opposite = style.Section.destinationText.opposite ? -1 : 1;
const tempx = x + traingle.getSin(style.Section.destinationText.distance);
const tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict);

View File

@ -19,7 +19,7 @@ export default class EMouse extends Group {
fontWeight: this.device.style.StationControl.mouseOverStyle.fontWeight,
fontSize: this.device.style.StationControl.mouseOverStyle.fontSize,
fontFamily: this.device.style.StationControl.mouseOverStyle.fontFormat,
text: '填充',
text: '',
textFill: this.device.style.StationControl.mouseOverStyle.fontColor,
textAlign: this.device.style.StationControl.mouseOverStyle.textAlign,
textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign

View File

@ -0,0 +1,46 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class checkBox extends Group {
constructor(model, style) {
super();
this.model = model;
this._type = model._type;
this._code = model.code;
this.zlevel = model.zlevel;
this.z = model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.box = new Rect({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
},
style: {
fill: 'rgb(135,206,250,0.2)'
}
});
this.grouper.add(this.box);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
setSize(width, height) {
this.model.width = width;
this.model.height = height;
}
}

View File

@ -17,6 +17,7 @@ import TrainWindow from './TrainWindow/index.js';
import Train from './Train/index.js';
import Line from './Line/index.js';
import Text2 from './Text/index.js';
import CheckBox from './checkBox/checkBox.js';
/** 图库*/
const mapShape = {};
@ -38,6 +39,7 @@ mapShape[deviceType.TrainWindow] = TrainWindow;
mapShape[deviceType.Train] = Train;
mapShape[deviceType.Line] = Line;
mapShape[deviceType.Text] = Text2;
mapShape[deviceType.CheckBox] = CheckBox;
function shapefactory(device, jmap) {
const type = device._type;

View File

@ -19,7 +19,7 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
@ -52,7 +52,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -74,7 +74,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -54,7 +54,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -16,7 +16,7 @@
<script>
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
@ -87,7 +87,7 @@ export default {
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];

View File

@ -19,7 +19,7 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
@ -52,7 +52,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -74,7 +74,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -54,7 +54,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -16,7 +16,7 @@
<script>
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
@ -87,7 +87,7 @@ export default {
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];

View File

@ -19,7 +19,7 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
@ -52,7 +52,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -74,7 +74,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -54,7 +54,7 @@ export default {
prop: 'name'
},
{
title: '皮肤类型',
title: '线路类型',
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -16,7 +16,7 @@
<script>
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
@ -87,7 +87,7 @@ export default {
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];

View File

@ -19,7 +19,7 @@
<script>
import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ChooseTemplatePlan',
@ -52,7 +52,7 @@ export default {
prop: 'name'
},
{
title: this.$t('menu.skinType'),
title: this.$t('menu.lineCode'),
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -74,7 +74,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -21,7 +21,7 @@
import { runPlanTemplateList } from '@/api/runplan';
import { getStationList } from '@/api/runplan';
import { getEveryDayRunPlanData, generateDayRunPlan } from '@/api/simulation';
import { getSkinCodeList } from '@/api/management/mapskin';
import { getLineCodeList } from '@/api/management/mapline';
export default {
name: 'ReloadTodayPlan',
@ -54,7 +54,7 @@ export default {
prop: 'name'
},
{
title: this.$t('menu.skinType'),
title: this.$t('menu.lineCode'),
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
@ -76,7 +76,7 @@ export default {
methods: {
loadInitData() {
this.skinCodeList = [];
getSkinCodeList().then(response => {
getLineCodeList().then(response => {
this.skinCodeList = response.data;
});
},

View File

@ -16,7 +16,7 @@
<script>
import { getRunPlanLoadList, deleteRunPlanLoad, listAllTempLateRunPlan } from '@/api/runplan';
import { listPublishMap } from '@/api/jmap/map';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'ManagePlanList',
@ -87,7 +87,7 @@ export default {
methods: {
loadPageData() {
this.mapList = [];
listPublishMap().then(resp => {
getPublishMapListOnline().then(resp => {
this.mapList = resp.data;
});
this.templatePlanList = [];

View File

@ -26,7 +26,7 @@ export default {
const dataList = convertSheetToList(Sheet, true);
const needList = Object.keys(this.ExcelConfig.columns);
const tripObj = { upTrack: '', downTrack: '' };
if (dataList && dataList.length) {
if (dataList && dataList.length && dataList[1] && dataList[0]) {
const tIndex = dataList.findIndex(it => { return it[0]; });
if (dataList[0][0] == needList[0] && dataList[1][0] == needList[1]) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += 1) {

View File

@ -34,8 +34,8 @@ export function deviceFactory(type, elem) {
return {...deviceRender[type], ...elem};
}
export function createDevice(type, model, propConvert) {
const device = deviceFactory(type, model);
export function createDevice(type, elem, propConvert) {
const device = deviceFactory(type, Object.assign(elem, { _type: type } ));
return propConvert ? propConvert.initPrivateProps(device) : device;
}
@ -169,50 +169,47 @@ export function parser(data, skinCode) {
}
// 同步绘制数据到原始数据
export function updateForList(model, map, liststr) {
const list = map[liststr];
export function updateForList(model, state, liststr) {
const list = state.map[liststr];
if (list && list instanceof Array) {
const i = list.findIndex(elem => { return elem.code == model.code; });
if (model._dispose) {
i >= 0 && list.splice(i, 1);
i >= 0 && list.splice(i, 1); // 删除
} else if (!list[i]) {
list.push(deepClone(model));
list.push(deepClone(model)); // 新增
} else if (i >= 0) {
// const item = list[i];
list[i] = deepClone(model); // item map 数据 model 页面表单数据
// Object.keys(model).forEach(key => {
// if (key != 'instance') {
// item[key] = model[key];
// }
// });
// state.mapDevice[model.code] = deepClone(model);
// console.log(list[i], '更新');
}
} else {
map[liststr] = [model];
state.map[liststr] = [model];
}
}
export function updateMapData(state, model) {
const map = state.map;
if (map && model) {
// const map = state.map;
// const mapDevice = state.mapDevice;
if (state.map && model) {
switch (model._type) {
case deviceType.Link: updateForList(model, map, 'linkList'); break;
case deviceType.Section: updateForList(model, map, 'sectionList'); break;
case deviceType.Switch: updateForList(model, map, 'switchList'); break;
case deviceType.Signal: updateForList(model, map, 'signalList'); break;
case deviceType.Station: updateForList(model, map, 'stationList'); break;
case deviceType.StationStand: updateForList(model, map, 'stationStandList'); break;
case deviceType.StationControl: updateForList(model, map, 'stationControlList'); break;
case deviceType.StationCounter: updateForList(model, map, 'stationCounterList'); break;
case deviceType.ZcControl: updateForList(model, map, 'zcControlList'); break;
case deviceType.StationDelayUnlock:updateForList(model, map, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, map, 'lcControlList'); break;
case deviceType.ButtonControl: updateForList(model, map, 'buttonList'); break;
case deviceType.LimitControl: updateForList(model, map, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, map, 'imageControl'); break;
case deviceType.Train: updateForList(model, map, 'trainList'); break;
case deviceType.TrainWindow: updateForList(model, map, 'trainWindowList'); break;
case deviceType.Line: updateForList(model, map, 'lineList'); break;
case deviceType.Text: updateForList(model, map, 'textList'); break;
case deviceType.Link: updateForList(model, state, 'linkList'); break;
case deviceType.Section: updateForList(model, state, 'sectionList'); break;
case deviceType.Switch: updateForList(model, state, 'switchList'); break;
case deviceType.Signal: updateForList(model, state, 'signalList'); break;
case deviceType.Station: updateForList(model, state, 'stationList'); break;
case deviceType.StationStand: updateForList(model, state, 'stationStandList'); break;
case deviceType.StationControl: updateForList(model, state, 'stationControlList'); break;
case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break;
case deviceType.ZcControl: updateForList(model, state, 'zcControlList'); break;
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
case deviceType.LcControl: updateForList(model, state, 'lcControlList'); break;
case deviceType.ButtonControl: updateForList(model, state, 'buttonList'); break;
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
case deviceType.ImageControl: updateForList(model, state, 'imageControl'); break;
case deviceType.Train: updateForList(model, state, 'trainList'); break;
case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break;
case deviceType.Line: updateForList(model, state, 'lineList'); break;
case deviceType.Text: updateForList(model, state, 'textList'); break;
}
}
}

View File

@ -189,6 +189,7 @@ export default {
this.visible = true;
const token = getToken() || getDesignToken();
getInfo(token).then(response => {
debugger;
const user = response.data;
this.userInfo = {
name: user.name,

View File

@ -3,11 +3,9 @@
<div class="main-container">
<navbar />
<section class="app-main" :style="{height: height+'px'}">
<!-- <el-scrollbar wrap-class="scrollbar-wrapper app_scrollbar_box"> -->
<transition name="fade" mode="out-in">
<router-view />
</transition>
<!-- </el-scrollbar> -->
</section>
<el-footer class="footers" style="height:30px;">
<div style="font-size:14px;float:left;">{{ $t('global.companyInfo') }} &nbsp;{{ $t('global.companyTel') }}</div>

View File

@ -27,8 +27,6 @@ import UserExam from '@/views/system/userExam/index';
import UserSimulation from '@/views/system/userSimulation/index';
import ExistingSimulation from '@/views/system/existingSimulation/index';
import CacheControl from '@/views/system/cacheControl/index';
import Trainingrecord from '@/views/system/trainingrecord/index';
import TrainingrecordManage from '@/views/system/trainingrecord/trainingrecordmanage/index';
import SystemGenerate from '@/views/system/systemGenerate/index';
import IbpDraw from '@/views/system/ibpDraw/index';
@ -49,10 +47,10 @@ import TeachDetail from '@/views/teach/detail/index';
import TeachHome from '@/views/teach/index';
import Pay from '@/views/components/pay/index';
import ExamDetail from '@/views/exam/detail/examDetail';
import ExamHome from '@/views/exam/index';
import ExamCourseDetail from '@/views/exam/detail/courseDetail';
import ExamResult from '@/views/exam/result';
import ExamDetail from '@/views/exam/detail/examDetail';
import ExamCourseDetail from '@/views/exam/detail/courseDetail';
import DemonstrationDetail from '@/views/demonstration/detail/index';
@ -66,7 +64,6 @@ import MapPreview from '@/views/designPlatform/mapPreview';
import DesignPlatformUser from '@/views/designUser/index';
// import Replay from '@/views/replay/index';
import Package from '@/views/package/index';
import PackageDraft from '@/views/package/draft/ruleForm';
import PackageDetail from '@/views/package/detail';
@ -101,6 +98,7 @@ import UserRulesDetail from '@/views/orderauthor/rules/detail';
import LessonApproval from '@/views/approval/lesson/index';
import ScriptApproval from '@/views/approval/script/index';
import RunPlanApproval from '@/views/approval/runPlan/index';
import News from '@/views/news/index';
import { loginTitle } from '@/scripts/ConstDic';
import { getSessionStorage } from '@/utils/auth';
@ -362,11 +360,6 @@ export const asyncRouter = [
}
]
},
{
path: 'lesson/training/:trainingId/:trainingName',
component: TrainingrecordManage,
hidden: true
},
{ // 地图预览
path: 'mapPreview/:mapId',
component: MapPreview,
@ -428,7 +421,7 @@ export const asyncRouter = [
},
hidden: true
},
{
{ // 剧本编辑 战场图
path: '/scriptDisplay/:mode',
component: ScriptDisplay,
meta: {
@ -758,6 +751,7 @@ export const asyncRouter = [
}
},
{
// 用户管理
path: 'userManage',
component: UserControl,
meta: {
@ -765,6 +759,7 @@ export const asyncRouter = [
}
},
{
// 缓存管理
path: 'cache',
component: CacheControl,
meta: {
@ -800,6 +795,7 @@ export const asyncRouter = [
}
},
{
// 子系统生成
path: 'systemGenerate',
component: SystemGenerate,
meta: {
@ -807,6 +803,7 @@ export const asyncRouter = [
}
},
{
// 产品编辑
path: 'product',
component: MapProduct,
meta: {
@ -814,20 +811,11 @@ export const asyncRouter = [
}
},
{
path: 'record',
redirect: 'record/training/0/null',
component: Trainingrecord,
path: 'news',
component: News,
meta: {
i18n: 'router.trainingRecord'
},
hidden: !isDev,
children: [
{
path: 'training/:trainingId/:trainingName',
component: TrainingrecordManage,
hidden: true
i18n: 'router.newsBulletin'
}
]
}
]
},

View File

@ -48,8 +48,7 @@ OperateHandler.prototype = {
*/
validate: function (operate) {
// 按钮操作之后,第二步错误操作菜单的情况,需要直接返回
if ((this.operates.length && operate.start === true) &&
(this.operates[0].type === 'mbm')) {
if ((this.operates.length && operate.start === true) && (this.operates[0].type === 'mbm')) {
return false;
}

View File

@ -1,6 +1,8 @@
import deviceType from '@/jmap/constant/deviceType';
import { parser, updateMapData } from '@/jmap/utils/parser';
import Vue from 'vue';
import { deepAssign } from '@/utils/index';
/**
* 查询向上受影响的Devices
* @param {Object} map
@ -199,6 +201,84 @@ function saveMapDeviceDefaultRelations(state) {
}
}
function handleOperation(state, models) {
const list = [];
models.forEach(item => {
if (item._dispose) {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) });
} else if (state.mapDevice[item.code]) {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) });
} else {
list.push({ operation: 'add', data: deepAssign({}, item) });
}
});
// console.log(list, '步骤数据');
if (list.length) {
if (state.stepData.length >= 15) { // 步骤数据最多储存15步
state.stepData.pop();
}
state.stepData.unshift(list);
state.recoverStepData = [];
}
}
// 撤销
function revocation(state, models) {
if (models && models.length) {
const list = [];
const stepList = [];
models.forEach(item => {
switch (item.operation) {
case 'add': {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])});
stepList.push({...item.data, _dispose: true});
break;
}
case 'del': {
list.push({ operation: 'add', data: deepAssign({}, item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
case 'edit': {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
}
});
state.recoverStepData.unshift(list);
return stepList;
}
}
// 恢复
function recover(state, models) {
if (models && models.length) {
const list = [];
const stepList = [];
models.forEach(item => {
switch (item.operation) {
case 'add': {
list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code])});
stepList.push({...item.data, _dispose: true});
break;
}
case 'del': {
list.push({ operation: 'add', data: deepAssign({}, item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
case 'edit': {
list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data)});
stepList.push({...item.data, _dispose: false});
break;
}
}
});
state.stepData.unshift(list);
return stepList;
}
}
/**
* 实训状态数据
*/
@ -206,6 +286,9 @@ const map = {
namespaced: true,
state: {
stepData: [], // 缓存数据
recoverStepData: [], // 缓存恢复数据
seclectDeviceList: [], // 包围框选中元素列表
map: null, // 地图数据
dataZoom: {}, // 缩放位置
mapDevice: {}, // 解析后的地图数据
@ -220,6 +303,15 @@ const map = {
mapList: (state) => {
return state.mapList;
},
seclectDeviceList: (state) => {
return state.seclectDeviceList;
},
stepData: (state) => {
return state.stepData;
},
recoverStepData: (state) => {
return state.recoverStepData;
},
map: (state) => {
return state.map;
},
@ -378,6 +470,9 @@ const map = {
trainDetails: (state) => {
return state.trainDetails;
},
mapDevice: (state) => {
return state.mapDevice;
},
getDeviceByCode: (state) => (code) => {
return state.mapDevice[code];
},
@ -439,16 +534,21 @@ const map = {
state.mapDevice = {};
}
},
setSeclectDeviceList: (state, list) => {
state.seclectDeviceList = list;
},
setDataZoom: (state, dataZoom) => {
state.dataZoom = dataZoom;
},
mapRender: (state, devices) => {
if (devices && devices.length) {
if (state.map) {
devices.forEach(elem => { updateMapData(state, elem); });
}
if (Vue.prototype.$jlmap) {
Vue.prototype.$jlmap.render(devices);
}
}
},
setTrainDetails: (state, details) => {
state.trainDetails = details;
@ -506,6 +606,10 @@ const map = {
mapClear: ({ commit }) => {
commit('mapClear');
},
// 获取包围框选中元素列表
setSeclectDeviceList: ({ commit }, list) => {
commit('setSeclectDeviceList', list);
},
// 设置缩放位置
updateZoom: ({ commit }, dataZoom) => {
@ -530,19 +634,7 @@ const map = {
setMapDataIdList: ({ state }, data) => {
state.mapIdList[`mapDate_${data.mapId}`] = data.mapData;
},
updateMapDevices: ({ commit }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
}
commit('mapRender', models);
resolve(models);
});
},
deleteMapDevices: ({ commit, state }, models) => {
updateMapDevices: ({ commit, state }, models) => {
return new Promise((resolve) => {
if (!(models instanceof Array)) {
models = [models];
@ -550,16 +642,29 @@ const map = {
// 查找向上关联需要一起删除的设备
const effectedModelList = [];
models.forEach((device) => {
queryEffectedModels(state.map, device, effectedModelList);
models.forEach((model) => {
if (model['_dispose']) {
queryEffectedModels(state.map, model, effectedModelList);
} else {
effectedModelList.push(model);
}
});
effectedModelList.forEach(elem => { elem['_dispose'] = true; });
handleOperation(state, effectedModelList);
commit('mapRender', effectedModelList);
resolve(effectedModelList);
});
},
setRevocation({ state, commit }) {
commit('mapRender', revocation(state, state.stepData.shift() || [])); // 撤销
},
setRecover({ state, commit }) {
commit('mapRender', recover(state, state.recoverStepData.shift() || [])); // 恢复
},
saveMapDeviceDefaultRelations({ state }) {
saveMapDeviceDefaultRelations(state);
},

View File

@ -36,6 +36,9 @@ const menuOperation = {
},
checkDialogIsOpen: (state) => (menu) => {
return state.menu == menu;
},
selectedCount:(state)=>{
return state.selectedCount;
}
},

View File

@ -1,5 +1,5 @@
import store from '@/store';
import { Notification } from 'element-ui';
function handle(state, data) {
// console.log(data, 'socket订阅');
@ -47,26 +47,6 @@ function handle(state, data) {
case 'JointTraining_User_Permit': // 综合演练室-用户获取权限消息
state.userPermit = msg;
break;
case 'JointTraining_User_RoomKickOut': // 综合演练室-用户被踢出房间消息
state.userRoomKickOut = msg; // 没有给被踢用户发送
handleMessageInfo(state, 'userRoomKickOut', msg);
break;
case 'JointTraining_User_InRoom': // 综合演练室-用户从外部进入房间消息
state.userInRoom = msg;
handleMessageInfo(state, 'userInRoom', msg);
break;
case 'JointTraining_User_OutRoom': // 综合演练室-用户退出房间消息
state.userOutRoom = msg;
handleMessageInfo(state, 'userOutRoom', msg);
break;
case 'JointTraining_User_InSimulation': // 综合演练室-用户进入仿真消息
state.userInSimulation = msg;
handleMessageInfoSimulation(state, 'userInSimulation', msg);
break;
case 'JointTraining_User_BackRoom': // 综合演练室-用户从仿真返回房间消息
state.userBackRoom = msg;
handleMessageInfoSimulation(state, 'userBackRoom', msg);
break;
case 'JointTraining_Room_Invite': // 综合演练室-房间邀请消息
state.roomInvite = msg;
break;
@ -93,6 +73,17 @@ function handle(state, data) {
break;
case 'Simulation_Control_Pause': // 暂停中
store.dispatch('scriptRecord/updateSimulationPause', msg);
break;
case 'BROADCAST': // 升级通知消息
Notification.warning({
title: msg.title,
center: true,
message: msg.message,
position: 'bottom-right',
showClose: msg.showClose,
duration: 0
});
break;
}
}
@ -119,7 +110,7 @@ function handleRecordList(state, data) {
inRoom: true,
date: +new Date(`${myDate1} ${data.chatTime}`)
};
state.chatContentList = param;
state.chatContent = param;
}
// 仿真内部聊天
function handleSimulationInfo(state, data) {
@ -180,62 +171,11 @@ function handleSimulationInfo(state, data) {
}
state.simulationText = param;
}
function handleUserinfo(state, data) {
if (data.length) { // 分配角色信息
state.roleInfo = data;
}
}
function handleMessageInfo(state, type, data) {
const message = {
join: true,
id: data.id,
userName: data.nickName,
userRole: data.userRole,
name: data.name,
roomTip: '',
chatInfo: true,
inSimulation: data.inSimulation,
inRoom: data.inRoom,
session: 'session',
type: type,
oneself: data.id === store.state.user.id
};
switch (type) {
case 'userInRoom':
message.roomTip = `${data.nickName}进入房间`;
break;
case 'userRoomKickOut':
message.roomTip = `${data.nickName}被踢出房间`;
break;
case 'userOutRoom':
message.roomTip = `${data.nickName}退出房间`;
break;
}
state.chatContentList = message;
}
function handleMessageInfoSimulation(state, type, data) {
const message = {
join: true,
id: data.id,
userName: data.nickName,
userRole: data.userRole,
name: data.name,
simulationTip: '',
chatInfo: true,
inSimulation: data.inSimulation,
inRoom: data.inRoom,
session: 'session'
};
switch (type) {
case 'userInSimulation':
message.simulationTip = `${data.nickName}进入仿真`;
break;
case 'userBackRoom':
message.simulationTip = `${data.nickName}退出仿真`;
break;
}
state.chatContentSimuList = message;
state.roleList = (data instanceof Array) ? data : [data];
}
function handlePushMsgQueue(state, msg) {
if (msg instanceof Array) {
state.msgQueue.concat(msg);
@ -254,8 +194,8 @@ const socket = {
state: {
payOrder: {}, // 支付消息
jointRoomInfo: {}, // 受邀请房间信息
chatContentList: {}, // 聊天室聊天内容
roleInfo: [], // 设置角色信息
chatContent: {}, // 聊天室聊天内容
roleList: [], // 设置角色信息
jointRoomPrepare: false, // 演练房间准备状态
equipmentStatus: [], // 仿真-设备状态消息
trainStationList: [], // 仿真-列车实际到发车站消息
@ -263,6 +203,7 @@ const socket = {
simulationStart: '', // 仿真-开始消息
simulationReset: '', // 仿真-异常消息
simulationText: {}, // 仿真-用户交互消息(聊天/命令)
message: {}, // 仿真聊天
msgQueue: [], // 命令请求列表
msgHead: null, // 消息头
@ -274,7 +215,6 @@ const socket = {
userInSimulation: {}, // 用户进入仿真消息
userBackRoom: {}, // 用户从仿真返回房间消息
roomInvite: {}, // 用户扫码信息
chatContentSimuList: {}, // 进入仿真,离开仿真信息
permissionOver: {}, // 权限结束
@ -289,8 +229,8 @@ const socket = {
state.jointRoomInfo = jointRoomInfo;
},
setChatContentList: (state, chatContentList) => {
state.chatContentList = chatContentList;
setChatContent: (state, chatContent) => {
state.chatContent = chatContent;
},
setEquipmentStatus: (state, equipmentStatus) => {
@ -340,8 +280,8 @@ const socket = {
handle(state, res);
},
setChatContentList: ({ commit }, chatContentList) => {
commit('setChatContentList', chatContentList);
setChatContent: ({ commit }, chatContent) => {
commit('setChatContent', chatContent);
},
setJointRoomInfo: ({ commit }) => {

View File

@ -3,7 +3,7 @@ import { login, logout, getInfo } from '@/api/login';
import { getToken, setToken, removeToken, getDesignToken, setDesignToken, removeDesignToken, handleToken, handleRemoveToken } from '@/utils/auth';
import { getUserConfigInfo } from '@/api/management/user';
import { LoginParams } from '@/utils/login';
import { creatSubscribe, perpetualTopic } from '@/utils/stomp';
import { creatSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
import Cookies from 'js-cookie';
const user = {
@ -75,6 +75,7 @@ const user = {
commit('SET_TOKENDESIGN', token);
const header = { group: '', 'X-Token': getDesignToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
};
} else {
params = Object.assign({ account: username, password }, LoginParams.LianKeTang);
@ -83,6 +84,7 @@ const user = {
commit('SET_TOKEN', token);
const header = { group: '', 'X-Token': getToken() };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
};
}
@ -101,6 +103,7 @@ const user = {
commit(token.key, token.value);
const header = { group: '', 'X-Token': token.value };
creatSubscribe(perpetualTopic, header);
creatSubscribe(commonTopic, header);
// 获取用户参数
dispatch('GetUserConfigInfo').then(response => {
resolve(response);

View File

@ -62,3 +62,11 @@
}
.el-tooltip__popper{max-width:40%;line-height:160%;}
.el-notification {
white-space:pre-wrap;
width: 505.5px;
}
.el-notification__group{
width: 90%;
}

View File

@ -40,9 +40,7 @@ export function removeSessionStorage(key) {
// 根据路径判断获取token
export function handleToken() {
const path = window.location.href;
if (path.includes('/dp/') || path.includes('/display/dp')) {
return getScreenToken();
} else if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/manage') || path.includes('/apply/')) {
if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/manage') || path.includes('/apply/')) {
return getDesignToken();
} else if (path.includes('/plan') || path.includes('/display/plan')) {
return getDesignToken() || getToken();
@ -54,9 +52,7 @@ export function handleToken() {
// 根据路径清除token
export function handleRemoveToken() {
const path = window.location.href;
if (path.includes('/dp/') || path.includes('/display/dp')) {
return removeScreenToken();
} else if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/plan') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/plan') || path.includes('/display/manage') || path.includes('/apply/')) {
if (path.includes('/design') || path.includes('/scriptDisplay') || path.includes('/plan') || path.includes('/publish') || path.includes('/orderauthor') || path.includes('/system') || path.includes('/display/plan') || path.includes('/display/manage') || path.includes('/apply/')) {
return removeDesignToken();
} else {
return removeToken();

View File

@ -3,10 +3,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 杜闪
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

14
src/utils/mapList.js Normal file
View File

@ -0,0 +1,14 @@
import { getSessionStorage } from '@/utils/auth';
import { listPublishMap, getMapListByProjectCode } from '@/api/jmap/map';
import { ProjectCode } from '@/scripts/ConstDic';
export async function getMapListByProject() {
const project = getSessionStorage('project');
let mapList = [];
if (project.endsWith('xty')) {
mapList = await getMapListByProjectCode(ProjectCode[project]);
} else {
mapList = await listPublishMap();
}
return mapList;
}

View File

@ -6,6 +6,8 @@ export const perpetualTopic = '/user/topic/message'; // 公用topic
export const displayTopic = '/user/queue/simulation'; // 其他仿真topic
export const screenTopic = '/user/queue/simulation/bigScreen'; // 大屏仿真
export const planTopic = '/user/queue/simulation/plan'; // 测试运行仿真
export const commonTopic = '/topic/message'; // 公共topic(不区分用户)
export const designDisplayTopic = '/user/queue/simulation/design'; // 设计平台仿真订阅路径
// 建立连接并订阅地址
export function creatSubscribe(topic, header) {

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