This commit is contained in:
zyy 2019-11-07 18:46:23 +08:00
commit 5a2ff68b15
44 changed files with 1551 additions and 1525 deletions

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

@ -3,125 +3,115 @@ import request from '@/utils/request';
/** 分页获取课程权限数据*/
export function getLessonPermissonPageList(params) {
return request({
url: '/api/permission',
method: 'get',
params: params
});
return request({
url: '/api/permission',
method: 'get',
params: params
});
}
/** 创建课程权限*/
export function createLessonPermisson(data) {
return request({
url: '/api/permission',
method: 'post',
data: data
});
return request({
url: '/api/permission',
method: 'post',
data: data
});
}
/** 获取权限详情*/
export function getPermissonDetail(id) {
return request({
url: `/api/permission/${id}/package`,
method: 'get'
});
return request({
url: `/api/permission/${id}/package`,
method: 'get'
});
}
/** 修改权限*/
export function putPermissonDetail(data) {
return request({
url: `/api/permission/${data.id}`,
method: 'put',
data: data
});
return request({
url: `/api/permission/${data.id}`,
method: 'put',
data: data
});
}
/** 一键生成所有权限*/
export function postPermissonList(mapId) {
return request({
url: `/api/permission/${mapId}/generate`,
method: 'post'
});
return request({
url: `/api/permission/${mapId}/generate`,
method: 'post'
});
}
/** 获取用户某课程某段时间内可用的权限数量*/
export function getTotalRemains(params) {
return request({
url: '/api/userPermission/totalRemains',
method: 'get',
params: params
});
return request({
url: '/api/userPermission/totalRemains',
method: 'get',
params: params
});
}
/** 设置权限失效或有效*/
export function setLessonPermisson(data) {
return request({
url: `/api/userPermission/${data.id}/status`,
method: 'put',
data: data
});
return request({
url: `/api/userPermission/${data.id}/status`,
method: 'put',
data: data
});
}
/** 设置权限失效或有效*/
export function getPermissionList(id) {
return request({
url: `/api/permission/${id}`,
method: 'get'
});
}
/**
* 查询仿真权限列表
*/
export function queryPermissionSimulation(data) {
return request({
url: `/api/userPermission/${data.mapId}/${data.prdCode}/simulation`,
method: 'get'
});
return request({
url: `/api/permission/${id}`,
method: 'get'
});
}
/** 获取大屏权限列表*/
export function queryPermissionScreen() {
return request({
url: `/api/userPermission/bigScreen`,
method: 'get'
});
return request({
url: `/api/userPermission/bigScreen`,
method: 'get'
});
}
/**
* 用户权限列表
*/
export function listPermision(params) {
return request({
url: `/api/userPermission`,
method: 'get',
params: params
});
return request({
url: `/api/userPermission`,
method: 'get',
params: params
});
}
/**
* 个人权限列表
*/
export function listUserPermision(params) {
return request({
url: `/api/userPermission/my`,
method: 'get',
params: params
});
return request({
url: `/api/userPermission/my`,
method: 'get',
params: params
});
}
/** 用户权限列表 */
export function getDistribute(id) {
return request({
url: `/api/distribute/${id}`,
method: 'get'
});
return request({
url: `/api/distribute/${id}`,
method: 'get'
});
}
/** 设置权限所有者 */
export function putPermissionOwner(data) {
return request({
url: `/api/userPermission/${data.id}/owner`,
method: 'put',
data: data.owner
});
return request({
url: `/api/userPermission/${data.id}/owner`,
method: 'put',
data: data.owner
});
}

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

@ -2,78 +2,78 @@ import request from '@/utils/request';
/** 获取故障规则列表*/
export function getFailureGenerateRules(params) {
return request({
url: `/api/simulation/failureGenerateRules`,
method: 'get',
params: params
});
return request({
url: `/api/simulation/failureGenerateRules`,
method: 'get',
params: params
});
}
/** 设置自动故障*/
export function setFailureMode(data, group) {
return request({
url: `/api/simulation/${group}/failureMode`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/${group}/failureMode`,
method: 'post',
data: data
});
}
/**
* 仿真系统按计划行车
*/
export function runDiagramStart(params, group) {
return request({
url: `/api/simulation/${group}/start`,
method: 'put',
params: params
});
return request({
url: `/api/simulation/${group}/start`,
method: 'put',
params: params
});
}
/**
* 仿真系统结束计划行车
*/
export function runDiagramOver(group) {
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/over`,
method: 'put'
});
}
/**
* 退出仿真系统
*/
export function runDiagramQuit(group) {
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/quit`,
method: 'put'
});
}
/** 获取仿真系统时间*/
export function runDiagramGetTime(group) {
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/systemTime`,
method: 'get'
});
}
// 查看是否开始按计划行车
export function runDiagramIsStart(group) {
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/isRunPlanStart`,
method: 'get'
});
}
/**
* 仿真系统CBTC
* @param {*} mapId
*/
export function simulationNotify({ mapId, code }) {
return request({
url: `/api/simulation/${mapId}/${code}`,
method: 'get'
});
export function simulationNotify({ mapId, mapPrdId }) {
return request({
url: `/api/simulation/${mapId}/${mapPrdId}`,
method: 'get'
});
}
/**
@ -81,10 +81,10 @@ export function simulationNotify({ mapId, code }) {
* @param {*} mapId
*/
export function bitScreenNotify({ mapId }) {
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
return request({
url: `/api/simulation/bigScreen/${mapId}`,
method: 'get'
});
}
/**
@ -92,10 +92,10 @@ export function bitScreenNotify({ mapId }) {
* @param {*} data
*/
export function trainingNotify({ trainingId }) {
return request({
url: `/api/simulation/training/${trainingId}`,
method: 'get'
});
return request({
url: `/api/simulation/training/${trainingId}`,
method: 'get'
});
}
/**
@ -103,334 +103,334 @@ export function trainingNotify({ trainingId }) {
* @param {*} data
*/
export function examNotify({ examId }) {
return request({
url: `/api/simulation/exam/${examId}`,
method: 'get'
});
return request({
url: `/api/simulation/exam/${examId}`,
method: 'get'
});
}
/** 获取用户实训列表*/
export function getSimulationList(data) {
return request({
url: `/api/simulation/stats`,
method: 'get',
params: data
});
return request({
url: `/api/simulation/stats`,
method: 'get',
params: data
});
}
/** 添加用户仿真数据*/
export function postSimulationStats(data) {
return request({
url: `/api/simulation/stats`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/stats`,
method: 'post',
data: data
});
}
/** 更新用户仿真数据*/
export function putSimulationStats(data) {
return request({
url: `/api/simulation/${data.id}/stats`,
method: 'put',
data: data
});
return request({
url: `/api/simulation/${data.id}/stats`,
method: 'put',
data: data
});
}
/** 删除用户仿真数据*/
export function deleteSimulationStats(statsId) {
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
return request({
url: `/api/simulation/${statsId}`,
method: 'delete'
});
}
/** 获取用户鼠标左键选中的设备信息*/
export function letfMouseSelectDevice(deviceCode, group) {
return request({
url: `/api/simulation/${group}/device/${deviceCode}`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/device/${deviceCode}`,
method: 'get'
});
}
/** 获取每日运行图*/
export function getEveryDayRunPlanData(group) {
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/runPlan`,
method: 'get'
});
}
/** 录制脚本仿真*/
export function scriptRecordNotify(scriptId) {
return request({
url: `/api/simulation/scriptWrite/${scriptId}`,
method: 'get'
});
return request({
url: `/api/simulation/scriptWrite/${scriptId}`,
method: 'get'
});
}
/** 保存剧本背景*/
export function saveScriptScenes(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/scenes`,
method: 'put'
});
}
/** 保存录制任务数据*/
export function saveScriptData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'put'
});
}
/** 更新任务地图定位信息*/
export function updateMapLocation(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/mapLocation`,
method: 'put',
data
});
}
/** 获取剧本编制的所有成员角色*/
export function getScriptMemberData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite/members`,
method: 'get'
});
}
/** 获取剧本出演成员角色 */
export function getScriptPlayMember(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/players`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite/players`,
method: 'get'
});
}
/** 取消剧本演出成员角色 */
export function cancleScriptMembers(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/removePlayers`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/removePlayers`,
method: 'put',
data
});
}
/** 选择剧本演出成员角色 */
export function selectScriptMembers(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/choosePlayers`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/choosePlayers`,
method: 'put',
data
});
}
/** 修改剧本演出成员性别 */
export function modifyScriptMemberSex(group, playerId, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/scriptWrite/player/${playerId}?gender=${data.gender}`,
method: 'put'
});
}
/** 清除仿真剧本数据*/
export function dumpScriptData(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/scriptWrite/saveData`,
method: 'delete'
});
}
/** 查询录制剧本步骤*/
export function queryScriptStep(group) {
return request({
url: `/api/simulation/${group}/scriptRecordStage`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptRecordStage`,
method: 'get'
});
}
/** 获取指定时间里可加载列车的个数*/
export function getDesignatedTimeTrainNum(params, group) {
return request({
url: `/api/simulation/${group}/plan/trainNum`,
method: 'get',
params
});
return request({
url: `/api/simulation/${group}/plan/trainNum`,
method: 'get',
params
});
}
/** 添加剧本动作 */
export function addScriptAction(group, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/action`,
method: 'post',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/action`,
method: 'post',
data
});
}
/** 删除剧本动作 */
export function deleteScriptAction(group, actionId) {
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'delete'
});
}
/** 修改剧本动作 */
export function modifyScriptAction(group, actionId, data) {
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
data
});
return request({
url: `/api/simulation/${group}/scriptWrite/action/${actionId}`,
method: 'put',
data
});
}
/** 分页查询存在的仿真 */
export function getExistingSimulation(params) {
return request({
url: `/api/simulation/manage/page`,
method: 'get',
params
});
return request({
url: `/api/simulation/manage/page`,
method: 'get',
params
});
}
/** 删除存在的仿真 */
export function deleteExistingSimulation(group) {
return request({
url: `/api/simulation/manage/${group}`,
method: 'delete'
});
return request({
url: `/api/simulation/manage/${group}`,
method: 'delete'
});
}
/** 根据设备类型获取设备列表 */
export function getDeviceCodeByDeviceType(group, params) {
return request({
url: `/api/simulation/${group}/deviceType/devices`,
method: 'get',
params
});
return request({
url: `/api/simulation/${group}/deviceType/devices`,
method: 'get',
params
});
}
/** 获取任务录制的数据 */
export function getScriptRecord(group) {
return request({
url: `/api/simulation/${group}/scriptWrite`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/scriptWrite`,
method: 'get'
});
}
/** 加载任务*/
export function loadQuest(questId, memberId, group) {
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/quest/${questId}?memberId=${memberId}`,
method: 'post'
});
}
/** 加载剧本 */
export function loadScript(scriptId, memberId, group) {
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
return request({
url: `api/simulation/${group}/script/${scriptId}?memberId=${memberId}`,
method: 'post'
});
}
/** 退出剧本*/
export function quitScript(group) {
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
return request({
url: `/api/simulation/${group}/script`,
method: 'delete'
});
}
/** 退出任务*/
export function quitQuest(group) {
return request({
url: `/api/simulation/${group}/quest`,
method: 'put'
});
return request({
url: `/api/simulation/${group}/quest`,
method: 'put'
});
}
/** 根据group获取仿真对象*/
export function getSimulationInfo(group) {
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
return request({
url: `/api/simulation/${group}`,
method: 'get'
});
}
/** 获取可用的设备指令*/
export function getAvailableDeviceCommand(params) {
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get',
params
});
return request({
url: `/api/simulation/deviceCommand/available`,
method: 'get',
params
});
}
/** 保存/修改任务剧本*/
export function saveTaskScript(group, data) {
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
return request({
url: `/api/simulation/${group}/questRecord/script`,
method: 'post',
data
});
}
/** 暂停剧本编制的仿真 */
export function scriptPause(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/pause`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/scriptWrite/pause`,
method: 'post'
});
}
/** 恢复仿真运行并执行刚编辑的剧本动作 */
export function executeScript(group) {
return request({
url: `/api/simulation/${group}/scriptWrite/execute`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/scriptWrite/execute`,
method: 'post'
});
}
/** 生成用户自己的当日运行图*/
export function generateDayRunPlan(planId, group) {
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
return request({
url: `/api/simulation/${group}/loadRunPlan/${planId}`,
method: 'post'
});
}
/** 创建派班计划仿真*/
export function schedulingNotify(params) {
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
return request({
url: `/api/scheduling/simulation`,
method: 'post',
params
});
}
/** 获取PLC网关 */
export function getPlcGateway(group) {
return request({
url: `/api/simulation/${group}/plcGateway`,
method: 'get'
});
return request({
url: `/api/simulation/${group}/plcGateway`,
method: 'get'
});
}
/** 处理ibp盘事件 */
export function handlerIbpEvent(group, data) {
return request({
url: `/api/simulation/${group}/ibp/event`,
method: 'post',
data: data
});
return request({
url: `/api/simulation/${group}/ibp/event`,
method: 'post',
data: data
});
}
/** 预览脚本仿真*/
export function scriptDraftRecordNotify(scriptId) {
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
method: 'get'
});
return request({
url: `/api/simulation/scriptDraft/${scriptId}`,
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

@ -4,107 +4,113 @@ const deviceRender = {};
/** IbpText渲染配置*/
deviceRender[deviceType.IbpText] = {
_type: deviceType.IbpText,
zlevel: 1,
z: 4
_type: deviceType.IbpText,
zlevel: 1,
z: 4
};
/** SquareButton渲染配置*/
deviceRender[deviceType.SquareButton] = {
_type: deviceType.SquareButton,
zlevel: 1,
z: 4
_type: deviceType.SquareButton,
zlevel: 1,
z: 4
};
/** WarnButton渲染配置*/
deviceRender[deviceType.WarnButton] = {
_type: deviceType.WarnButton,
zlevel: 1,
z: 4
_type: deviceType.WarnButton,
zlevel: 1,
z: 4
};
/** Arrow渲染配置*/
deviceRender[deviceType.Arrow] = {
_type: deviceType.Arrow,
zlevel: 1,
z: 2
_type: deviceType.Arrow,
zlevel: 1,
z: 2
};
/** TipBox渲染配置*/
deviceRender[deviceType.TipBox] = {
_type: deviceType.TipBox,
zlevel: 1,
z: 3
_type: deviceType.TipBox,
zlevel: 1,
z: 3
};
/** BackGround渲染配置*/
deviceRender[deviceType.Background] = {
_type: deviceType.Background,
zlevel: 1,
z: 0
_type: deviceType.Background,
zlevel: 1,
z: 0
};
/** CircularLamp渲染配置 */
deviceRender[deviceType.CircularLamp] = {
_type: deviceType.CircularLamp,
zlevel: 1,
z: 4
_type: deviceType.CircularLamp,
zlevel: 1,
z: 4
};
/** AppendageBox渲染配置 */
deviceRender[deviceType.AppendageBox] = {
_type: deviceType.AppendageBox,
zlevel: 1,
z: 1
_type: deviceType.AppendageBox,
zlevel: 1,
z: 1
};
/** IbpLine渲染配置 */
deviceRender[deviceType.IbpLine] = {
_type: deviceType.IbpLine,
zlevel: 1,
z: 1
_type: deviceType.IbpLine,
zlevel: 1,
z: 1
};
/** Elevator 渲染配置 */
deviceRender[deviceType.Elevator] = {
_type: deviceType.Elevator,
zlevel: 1,
z: 2
_type: deviceType.Elevator,
zlevel: 1,
z: 2
};
/** Key 渲染配置 */
deviceRender[deviceType.Key] = {
_type: deviceType.Key,
zlevel: 1,
z: 4
_type: deviceType.Key,
zlevel: 1,
z: 4
};
/** TeleTerminal 渲染配置 */
deviceRender[deviceType.TeleTerminal] = {
_type: deviceType.TeleTerminal,
zlevel: 1,
z: 4
_type: deviceType.TeleTerminal,
zlevel: 1,
z: 4
};
/** Clock 渲染配置*/
deviceRender[deviceType.Clock] = {
_type: deviceType.Clock,
zlevel: 1,
z: 4
_type: deviceType.Clock,
zlevel: 1,
z: 4
};
/** RotateTip 渲染配置 */
deviceRender[deviceType.RotateTip] = {
_type: deviceType.RotateTip,
zlevel: 1,
z: 4
_type: deviceType.RotateTip,
zlevel: 1,
z: 4
};
/** Alarm */
deviceRender[deviceType.Alarm] = {
_type: deviceType.Alarm,
zlevel: 1,
z: 4
_type: deviceType.Alarm,
zlevel: 1,
z: 4
};
deviceRender[deviceType.CheckBox] = {
_type: deviceType.CheckBox,
zlevel: 10,
z: 0
};
export default deviceRender;

View File

@ -1,18 +1,19 @@
const deviceType = {
IbpText: 'IbpText',
SquareButton: 'SquareButton',
Arrow: 'Arrow',
TipBox: 'TipBox',
Background: 'Background',
CircularLamp: 'CircularLamp',
IbpLine: 'IbpLine',
AppendageBox: 'AppendageBox',
Alarm: 'Alarm',
Elevator: 'Elevator',
Key: 'Key',
TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
RotateTip: 'RotateTip'
IbpText: 'IbpText',
SquareButton: 'SquareButton',
Arrow: 'Arrow',
TipBox: 'TipBox',
Background: 'Background',
CircularLamp: 'CircularLamp',
IbpLine: 'IbpLine',
AppendageBox: 'AppendageBox',
Alarm: 'Alarm',
Elevator: 'Elevator',
Key: 'Key',
TeleTerminal: 'TeleTerminal',
Clock: 'Clock',
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

@ -4,193 +4,284 @@ import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
class EventModel {
constructor(e) {
this.clientX = e.event.clientX;
this.clientY = e.event.clientY;
constructor(e) {
this.clientX = e.event.clientX;
this.clientY = e.event.clientY;
let view = e.target;
while (view) {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.deviceModel = view.model;
this.eventTarget = view;
break;
}
view = view.parent;
}
}
let view = e.target;
while (view) {
if (Object.values(deviceType).includes(view._type)) {
this.deviceCode = view._code;
this.deviceType = view._type;
this.deviceModel = view.model;
this.eventTarget = view;
break;
}
view = view.parent;
}
}
}
class MouseController extends Eventful {
constructor(ibp) {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging=ibp.isAllowDragging||false;
this.events = ibp.getEvents();
this._dragging = false;
this.initHandler(this.$zr);
}
constructor(ibp) {
super();
this.$ibp = ibp;
this.$zr = ibp.getZr();
this.isAllowDragging = ibp.isAllowDragging || false; // 是否在绘图中,仅绘图状态下可拖拽
this.events = ibp.getEvents();
this._dragging = false; // 是否在拖拽状态
this.deviceList = [];
this.rightClickPoint = {
x: 0,
y: 0
}; // 右键点击坐标
this.initHandler(this.$zr);
}
initHandler(zr) {
if (zr) {
zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this);
initHandler(zr) {
if (zr) {
zr.on('contextmenu', this.contextmenu, this);
zr.on('mousemove', this.moveEvent, this);
zr.on('click', this.click, this);
this.enable = function (opts) {
opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.enable = function (opts) {
opts = opts || {};
this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this.disable();
this.disable();
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
};
zr.on('mousedown', this.mousedown, this);
zr.on('mousemove', this.mousemove, this);
zr.on('mouseup', this.mouseup, this);
zr.on('touchstart', this.mousedown, this);
zr.on('touchmove', this.mousemove, this);
zr.on('touchend', this.mouseup, this);
};
this.disable = function () {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
};
this.disable = function () {
zr.off('mousedown', this.mousedown);
zr.off('mousemove', this.mousemove);
zr.off('mouseup', this.mouseup);
zr.off('touchstart', this.mousedown);
zr.off('touchmove', this.mousemove);
zr.off('touchend', this.mouseup);
};
this.dispose = function () {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
this.disable();
};
this.dispose = function () {
zr.off('click', this.click);
zr.off('contextmenu', this.contextmenu);
zr.off('mousemove', this.moveEvent);
this.disable();
};
this.isDragging = function () { return this._dragging; };
}
}
this.isDragging = function () { return this._dragging; };
}
}
setAllowDragging(data) {
this.isAllowDragging=data;
}
setAllowDragging(data) {
this.isAllowDragging = data;
}
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;
}
mousedown(e) {
e.event.preventDefault();
e.event.stopPropagation();
const em = new EventModel(e);
this.eventTarget = em.eventTarget;
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;
}
mousemove(e) {
const oldX = this._x;
const oldY = this._y;
const oldX = this._x;
const oldY = this._y;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
const dx = e.offsetX - oldX;
const dy = e.offsetY - oldY;
this._x = e.offsetX;
this._y = e.offsetY;
if (e.which === 3) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
} else if (e.which === 1) {
this.handleMouseMoveLeft(e, dx, dy, oldX, oldY);
}
}
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);
}
} else {
return true;
}
mouseup(e) {
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();
}
if (this.eventTarget._type === deviceType.Background) {
this.eventTarget.setCursor('default');
}
this.eventTarget = '';
this._dragging = false;
this.deviceList = [];
}
}
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
}
click(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
moveEvent(e) {
const newEm = new EventModel(e);
const trainDetails = store.state.map.trainDetails;
if (trainDetails) {
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
var instance = (this.$ibp.getDeviceByCode(trainDetails.code) || {} ).instance;
instance && instance.removeTrainDetail && instance.removeTrainDetail();
}
}
}
mouseup(e) {
if (!eventTool.notLeftMouse(e)&&this.isAllowDragging && this.eventTarget) {
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-------');
this.eventTarget.setCursor('default');
}
this.eventTarget = '';
this._dragging = false;
}
checkEvent(e) {
var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
var newEm = new EventModel(e);
if ([1, 3].includes(e.which)) {
// 查找之前和当前鼠标选中的实例
var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
contextmenu(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Contextmenu, em);
}
click(e) {
var em = this.checkEvent(e);
this.trigger(this.events.Selected, em);
}
moveEvent(e) {
const newEm = new EventModel(e);
const trainDetails = store.state.map.trainDetails;
if (trainDetails) {
if (newEm.deviceType != deviceType.Train || trainDetails.code != newEm.deviceCode) {
var instance = (this.$ibp.getDeviceByCode(trainDetails.code) || {} ).instance;
instance && instance.removeTrainDetail && instance.removeTrainDetail();
}
}
}
// 如果之前和当前选中的实例不一致
if (oldInstance != newInstance) {
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
checkEvent(e) {
var oldEm = new EventModel(this.$zr.curEvent || { event: {} });
var newEm = new EventModel(e);
if ([1, 3].includes(e.which)) {
// 查找之前和当前鼠标选中的实例
var oldDevice = this.$ibp.getDeviceByCode(oldEm.deviceCode) || {};
var newDevice = this.$ibp.getDeviceByCode(newEm.deviceCode) || {};
var oldInstance = (this.$ibp.getDeviceByCode(oldEm.deviceCode) || {}).instance || {};
var newInstance = (this.$ibp.getDeviceByCode(newEm.deviceCode) || {}).instance || {};
// 如果实例有选中函数并且被点击,则执行选中函数
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
newDevice['down'] = true;
newInstance.mouseEvent['mouseover'](e);
}
}
// 如果之前和当前选中的实例不一致
if (oldInstance != newInstance) {
// 如果实例有取消选择函数并且被点击,则执行取消选中函数
if (oldInstance.mouseEvent && oldInstance.mouseEvent.mouseout) {
// 视图数据设置点击标志,同步执行
oldDevice['down'] = false;
oldInstance.mouseEvent['mouseout'](e);
}
// 保存当前实例到全局
this.$zr.curEvent = e;
}
// 如果实例有选中函数并且被点击,则执行选中函数
if (e.which == 3 && newInstance.mouseEvent && newInstance.mouseEvent.mouseover) {
newDevice['down'] = true;
newInstance.mouseEvent['mouseover'](e);
}
}
// 保存当前实例到全局
this.$zr.curEvent = e;
}
return newEm;
}
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);
});
return;
}
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);
}
}
}
/** 通过包围盒筛选选中区域的元素 */
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,14 +30,15 @@ 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;
const shape = ibpShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
const type = device.model._type;
const shape = ibpShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
return new shape(device, ibp.style);
}
}
}
export default shapefactory;

View File

@ -2,43 +2,44 @@ import Group from 'zrender/src/container/Group';
import Line from 'zrender/src/graphic/shape/Line';
export default class ibpLine 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.point1.x, model.point1.y]
});
this.ibpLine = new Line({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x1: 0,
y1: 0,
x2: model.point2.x-model.point1.x,
y2: model.point2.y-model.point1.y
},
style: {
lineWidth: this.model.lineWidth,
stroke: this.model.fillColor
}
});
this.grouper.add(this.ibpLine);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point1.x += dx;
this.model.point1.y += dy;
this.model.point2.x += dx;
this.model.point2.y += dy;
}
constructor(device) {
super();
this.model = device.model;
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();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point1.x, model.point1.y]
});
this.ibpLine = new Line({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x1: 0,
y1: 0,
x2: model.point2.x - model.point1.x,
y2: model.point2.y - model.point1.y
},
style: {
lineWidth: this.model.lineWidth,
stroke: this.model.fillColor
}
});
this.grouper.add(this.ibpLine);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point1.x += dx;
this.model.point1.y += dy;
this.model.point2.x += dx;
this.model.point2.y += dy;
}
}

View File

@ -124,270 +124,271 @@ import { getUserinfoName, getUserinfoNickname, getUserinfoMobile, getUserinfoMob
import { setInterval, clearInterval } from 'timers';
export default {
data() {
return {
visible: false,
userInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
editInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
emailShow: true,
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
data() {
return {
visible: false,
userInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
editInfo: {
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
emailShow: true,
passwordShow: true,
mobileCode: null,
emailCode: null,
passWordCode: null,
oldPassWord: null,
newPassWord1: null,
oldPassWord: null,
newPassWord1: null,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
mobileCodeTime: 0,
emailCodeTime: 0,
passWordCodeTime: 0,
emailTime: null,
mobileTime: null,
passWordTime: null,
countryList: [
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: '86' //
};
},
computed: {
info() {
return this.$store.state.user;
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2');
},
doShow() {
this.visible = true;
const token = getToken() || getDesignToken();
getInfo(token).then(response => {
const user = response.data;
this.userInfo = {
name: user.name,
nickname: user.nickname,
mobile: user.mobile,
email: user.email,
passWord: ''
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode ? user.nationCode : '86';
}).catch(error => {
console.log(error, '请求个人信息失败');
});
},
doClose() {
this.visible = false;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow;
},
async saveName() {
if (this.editInfo.name) {
try {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, '错误');
}
}
},
emailTime: null,
mobileTime: null,
passWordTime: null,
countryList: [
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: '86' //
};
},
computed: {
info() {
return this.$store.state.user;
}
},
methods: {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
return tel.replace(reg, '$1****$2');
},
doShow() {
this.visible = true;
const token = getToken() || getDesignToken();
getInfo(token).then(response => {
debugger;
const user = response.data;
this.userInfo = {
name: user.name,
nickname: user.nickname,
mobile: user.mobile,
email: user.email,
passWord: ''
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode ? user.nationCode : '86';
}).catch(error => {
console.log(error, '请求个人信息失败');
});
},
doClose() {
this.visible = false;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
this.nameShow = !this.nameShow;
},
async saveName() {
if (this.editInfo.name) {
try {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow;
},
async saveNickName() {
if (this.editInfo.nickname) {
try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname);
this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherNickname() {
this.editInfo.nickname = this.userInfo.nickname;
this.nickNameShow = !this.nickNameShow;
},
async saveNickName() {
if (this.editInfo.nickname) {
try {
await getUserinfoNickname(this.info.id, this.editInfo.nickname);
this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow;
this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) {
console.log(error, '错误');
}
}
},
switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) {
try {
const params = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
validCode: this.mobileCode
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendMobileCode() {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => {
this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0;
clearInterval(this.mobileTime);
this.mobileTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherMobile() {
// this.editInfo.mobile = this.userInfo.mobile;
this.mobileShow = !this.mobileShow;
},
async saveMobile() {
if (this.editInfo.mobile && this.mobileCode) {
try {
const params = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
validCode: this.mobileCode
};
await getUserinfoMobile(this.info.id, params);
this.userInfo.mobile = this.editInfo.mobile;
this.nationCodeInit = this.nationCode;
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendMobileCode() {
const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCode}${this.editInfo.mobile}${random}`;
const param = {
mobile: this.editInfo.mobile,
nationCode: this.nationCode,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.mobileCodeTime = 30;
this.mobileTime = setInterval(() => {
this.mobileCodeTime--;
if (this.mobileCodeTime <= 0) {
this.mobileCodeTime = 0;
clearInterval(this.mobileTime);
this.mobileTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
if (this.editInfo.email && this.emailCode) {
try {
const params = {
email: this.editInfo.email,
validCode: this.emailCode
};
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendEmailCode() {
try {
this.emailCodeTime = 30;
this.emailTime = setInterval(() => {
this.emailCodeTime--;
if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0;
clearInterval(this.emailTime);
this.emailTime = null;
}
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherEmail() {
// this.editInfo.email = this.userInfo.email;
this.emailShow = !this.emailShow;
},
async saveEmail() {
if (this.editInfo.email && this.emailCode) {
try {
const params = {
email: this.editInfo.email,
validCode: this.emailCode
};
await getUserinfoEmail(this.info.id, params);
this.userInfo.email = this.editInfo.email;
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t('global.codeError'));
}
}
},
async sendEmailCode() {
try {
this.emailCodeTime = 30;
this.emailTime = setInterval(() => {
this.emailCodeTime--;
if (this.emailCodeTime <= 0) {
this.emailCodeTime = 0;
clearInterval(this.emailTime);
this.emailTime = null;
}
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
},
switcherPassWord() {
this.passwordShow = !this.passwordShow;
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t('global.passWordSome'));
}
},
async sendPassWordCode() {
if (this.userInfo.mobile) {
const random = Math.floor((Math.random()*10000)+1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = {
mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => {
this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0;
clearInterval(this.mobileTime);
this.passWordTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}
switcherPassWord() {
this.passwordShow = !this.passwordShow;
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
},
async uploadPassword() {
if (this.newPassWord1) {
//
const param = {
password: md5(this.newPassWord1),
vfCode: this.passWordCode
};
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t('global.passWordSome'));
}
},
async sendPassWordCode() {
if (this.userInfo.mobile) {
const random = Math.floor((Math.random() * 10000) + 1);
const timeCount = Date.parse(new Date()) / 1000;
const pass = `${timeCount}${this.nationCodeInit}${this.userInfo.mobile}${random}`;
const param = {
mobile: this.userInfo.mobile,
nationCode: this.nationCodeInit,
rd: random,
time: timeCount,
token: md5(pass)
};
try {
this.passWordCodeTime = 30;
this.passWordTime = setInterval(() => {
this.passWordCodeTime--;
if (this.passWordCodeTime <= 0) {
this.passWordCodeTime = 0;
clearInterval(this.mobileTime);
this.passWordTime = null;
}
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}
};
</script>

View File

@ -218,6 +218,7 @@ function handleOperation(state, models) {
state.stepData.pop();
}
state.stepData.unshift(list);
state.recoverStepData = [];
}
}

View File

@ -143,7 +143,7 @@ export default {
cityCode: row.cityCode,
mapId: row.mapId,
name: row.name,
prdCode: row.prdCode
prdId: row.prdId
};
adminPublishLesson(params, row.id).then(response => {
this.loading = false;

View File

@ -13,8 +13,7 @@
export default {
name: 'ScriptOperate',
props: {
title:{type:String, required:true},
type:{type:String, required:true}
title:{type:String, required:true}
},
data() {
return {

View File

@ -87,7 +87,7 @@ export default {
endTime: '',
date: ''
},
prdCode: '',
prdId: '',
mapId: '',
numberMessage: '',
PermissionType: '',
@ -149,7 +149,7 @@ export default {
changeSelectDate() {
if (this.formModel.date) {
this.isLoading = true;
const data = {mapId:this.mapId, proCode:this.prdCode, startTime:this.formModel.date[0], endTime:this.formModel.date[1], type:this.PermissionType};
const data = {mapId:this.mapId, prdId:this.prdId, startTime:this.formModel.date[0], endTime:this.formModel.date[1], type:this.PermissionType};
if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId;
}
@ -175,7 +175,7 @@ export default {
if (data) {
this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name;
this.prdCode = data.prdCode;
this.prdId = data.prdId;
this.mapId = data.mapId;
this.PermissionType = data.PermissionType;
this.setTotalMax();

View File

@ -87,7 +87,7 @@ export default {
endTime: '',
date: ''
},
prdCode: '',
prdId: '',
mapId: '',
numberMessage: '',
PermissionType: '',
@ -149,7 +149,7 @@ export default {
changeSelectDate() {
if (this.formModel.date) {
this.isLoading = true;
const data = {mapId:this.mapId, proCode:this.prdCode, startTime:`${this.formModel.date[0]} 00:00:00`, endTime:`${this.formModel.date[1]} 23:59:59`, type:this.PermissionType};
const data = {mapId:this.mapId, prdId:this.prdId, startTime:`${this.formModel.date[0]} 00:00:00`, endTime:`${this.formModel.date[1]} 23:59:59`, type:this.PermissionType};
if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
data.lessonId = this.formModel.lessonId;
}
@ -175,7 +175,7 @@ export default {
if (data) {
this.formModel.lessonId = data.id;
this.formModel.lessonName = data.name;
this.prdCode = data.prdCode;
this.prdId = data.prdId;
this.mapId = data.mapId;
this.PermissionType = data.PermissionType;
this.setTotalMax();
@ -219,35 +219,6 @@ export default {
});
}
});
// this.$refs.dataform.validateForm(() => {
// const model = {
// startTime: `${this.formModel.date[0]} 00:00:00`,
// endTime: `${this.formModel.date[1]} 23:59:59`,
// amount: this.formModel.total,
// permissionType: this.PermissionType
// };
// if (this.PermissionType == PermissionType.LESSON || this.PermissionType == PermissionType.EXAM) {
// model['lessonId'] = this.formModel.lessonId;
// model['mapId'] = this.mapId;
// model['prdCode'] = this.prdCode;
// } else if (this.PermissionType == PermissionType.SIMULATION) {
// model['mapId'] = this.mapId;
// model['prdCode'] = this.prdCode;
// }
// //
// permissionTurnAdd(model).then(response => {
// const url = response.data;
// this.$emit('QrCodeShow', {
// url: url,
// title: this.$t('global.transferQrcode')
// });
// this.dialogVisible = false;
// this.$emit('initLoadPage');
// this.handleClose();
// }).catch(() => {
// this.$messageBox(this.$t('error.getTransferQrcodeFailed'));
// });
// });
},
close() {
this.dialogVisible = false;

View File

@ -46,98 +46,98 @@ import ConfirmDraft from './confirm';
import FinishDraft from './finish';
export default {
name: 'LessonDetail',
components: {
CommitDraft,
ConfirmDraft,
FinishDraft
},
data() {
return {
active: -1,
order: {},
title: '',
finishStatus: '02',
orderData: {},
routeDict: {
0: 'commit',
1: 'confirm',
2: 'finish'
}
};
},
computed: {
systemName() {
switch (this.$route.query.permissionType) {
case PermissionType.LESSON: return this.$t('global.coursePrice');
case PermissionType.EXAM: return this.$t('global.testPrice');
case PermissionType.SIMULATION: return this.$t('global.simulationPrice');
case PermissionType.SCREEN: return this.$t('global.timeUnitPrice');
}
return '';
},
height() {
if (/\/dp\//.test(this.$route.path) ||
name: 'LessonDetail',
components: {
CommitDraft,
ConfirmDraft,
FinishDraft
},
data() {
return {
active: -1,
order: {},
title: '',
finishStatus: '02',
orderData: {},
routeDict: {
0: 'commit',
1: 'confirm',
2: 'finish'
}
};
},
computed: {
systemName() {
switch (this.$route.query.permissionType) {
case PermissionType.LESSON: return this.$t('global.coursePrice');
case PermissionType.EXAM: return this.$t('global.testPrice');
case PermissionType.SIMULATION: return this.$t('global.simulationPrice');
case PermissionType.SCREEN: return this.$t('global.timeUnitPrice');
}
return '';
},
height() {
if (/\/dp\//.test(this.$route.path) ||
/\/plan\//.test(this.$route.path)) {
return this.$store.state.app.height;
}
return this.$store.state.app.height;
}
return this.$store.state.app.height - 61;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
//
initLoadPage() {
const data = {
permissionType: this.$route.query.permissionType
};
if (this.$route.query.permissionType != '04') {
data['mapId'] = this.$route.query.mapId;
data['prdCode'] = this.$route.query.prdCode;
data['lessonId'] = this.$route.query.lessonId;
}
getCommodityDetailByParams(data).then(response => {
this.active = 0;
this.orderData = response.data;
}).catch(() => {
this.$messageBox(this.$t('tip.failedCourse'));
});
},
//
commit(data) {
this.active = 1;
this.order = data;
},
//
confirm(data) {
this.active = 2;
this.finishStatus = data;
this.$refs.finish.createCountTimer();
},
//
finish(data) {
this.active = 0;
const type = this.$route.query.permissionType;
if (type === PermissionType.LESSON) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.query.subSystem}`, query: {lessonId: this.$route.query.lessonId, mapId: this.$route.query.mapId, prdCode: this.$route.query.prdCode}});
} else if (type === PermissionType.EXAM) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`});
} else if (type === PermissionType.SCREEN) {
this.$router.replace({ path: `${UrlConfig.dp.detail}/${this.$route.params.lessonId}` });
} else if (type === PermissionType.SIMULATION) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.prodDetail}/${this.$route.query.subSystem}`, query: { mapId: this.$route.query.mapId} });
} else {
this.$router.replace({ path: `/` });
}
}
}
return this.$store.state.app.height - 61;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
//
initLoadPage() {
const data = {
permissionType: this.$route.query.permissionType
};
if (this.$route.query.permissionType != '04') {
data['mapId'] = this.$route.query.mapId;
data['prdId'] = this.$route.query.prdId;
data['lessonId'] = this.$route.query.lessonId;
}
getCommodityDetailByParams(data).then(response => {
this.active = 0;
this.orderData = response.data;
}).catch(() => {
this.$messageBox(this.$t('tip.failedCourse'));
});
},
//
commit(data) {
this.active = 1;
this.order = data;
},
//
confirm(data) {
this.active = 2;
this.finishStatus = data;
this.$refs.finish.createCountTimer();
},
//
finish(data) {
this.active = 0;
const type = this.$route.query.permissionType;
if (type === PermissionType.LESSON) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.query.subSystem}`, query: {lessonId: this.$route.query.lessonId, mapId: this.$route.query.mapId, prdId: this.$route.query.prdId}});
} else if (type === PermissionType.EXAM) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.query.subSystem}`});
} else if (type === PermissionType.SCREEN) {
this.$router.replace({ path: `${UrlConfig.dp.detail}/${this.$route.params.lessonId}` });
} else if (type === PermissionType.SIMULATION) {
this.$router.replace({ path: `${UrlConfig.trainingPlatform.prodDetail}/${this.$route.query.subSystem}`, query: { mapId: this.$route.query.mapId} });
} else {
this.$router.replace({ path: `/` });
}
}
}
};
</script>

View File

@ -48,7 +48,7 @@ export default {
loading: true,
buttonLoading: false,
currentLessonId: '',
currentPrdCode: '',
currentPrdId: '',
productList: [],
courseModel: {
id: '',
@ -57,7 +57,7 @@ export default {
skinCode: '',
remarks: '',
prdType: '',
prdCode: '',
prdId: '',
pmsList: []
},
jointShow: false,
@ -108,11 +108,11 @@ export default {
skinCode: resp.data.mapPrd.skinCode,
remarks: resp.data.mapPrd.remarks,
prdType: resp.data.mapPrd.prdType,
prdCode: resp.data.mapPrd.code,
prdId: resp.data.mapPrd.id,
pmsList: resp.data.permissionList || [],
PermissionType: PermissionType.SIMULATION
};
this.currentPrdCode = resp.data.mapPrd.code;
this.currentPrdId = resp.data.mapPrd.id;
if (resp.data.mapPrd.prdType === '03') {
this.getJointTrainingList();
}
@ -121,7 +121,7 @@ export default {
this.tryUser = 1;
const paras = {
mapId: this.mapId,
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
permissionType: PermissionType.SIMULATION
};
@ -166,7 +166,7 @@ export default {
this.buttonLoading = true;
const param = {
mapId: Number(this.mapId),
prdCode: this.courseModel.prdCode
prdId: this.courseModel.prdId
};
const res = await postCreateRoom(param);
if (res && res.code == 200) {
@ -212,9 +212,9 @@ export default {
},
jumpScheduling() {
this.buttonLoading = true;
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
const data = { mapId: this.courseModel.mapId, prdId: this.currentPrdId };
schedulingNotify(data).then(resp => {
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
@ -223,10 +223,10 @@ export default {
});
},
jump() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
const data = { mapId: this.courseModel.mapId, mapPrdId: this.currentPrdId };
this.buttonLoading = true;
simulationNotify(data).then(resp => {
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdId, goodsId: this.goodsId, try: this.tryUser };
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
launchFullscreen();
}).catch(error => {
@ -238,7 +238,7 @@ export default {
this.buttonLoading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
query: { permissionType: PermissionType.SIMULATION, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
},
transfer() {

View File

@ -396,7 +396,7 @@ export default {
const resp = await getTrainingDetail(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
const rest = await getProductDetail(detail.prdCode);
const rest = await getProductDetail(detail.prdId);
if (rest && rest.code == 200) {
const data = rest.data;
await this.$store.dispatch('training/setPrdType', data.prdType);

View File

@ -388,7 +388,7 @@ export default {
const resp = await getTrainingDetail(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
const rest = await getProductDetail(detail.prdCode);
const rest = await getProductDetail(detail.prdId);
if (rest && rest.code == 200) {
const data = rest.data;
await this.$store.dispatch('training/setPrdType', data.prdType);

View File

@ -130,7 +130,7 @@ export default {
loadInitData() {
const data = {
mapId: this.$route.query.mapId,
prdCode: this.$route.query.code,
prdId: this.$route.query.code,
permissionType: PermissionType.SIMULATION
};
getGoodsTryUse(data).then(res => {

View File

@ -122,7 +122,7 @@ export default {
id: resp.data.id,
name: resp.data.name,
pmsList: resp.data.permissionList || [],
prdCode: resp.data.prdCode,
prdId: resp.data.prdId,
mapId: resp.data.mapId,
PermissionType: PermissionType.EXAM,
treeList: resp.data.examDefinitionList
@ -140,7 +140,7 @@ export default {
this.loading = true;
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
query: { permissionType: PermissionType.EXAM, lessonId: this.courseModel.id, prdId: this.courseModel.prdId, mapId: this.courseModel.mapId, subSystem: this.$route.params.subSystem }
});
},
checkCourse() {

View File

@ -183,7 +183,7 @@ export default {
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.examDetails.lessonId}`,
query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdCode: res.data.prdCode, mapId: res.data.mapId }
query: { permissionType: PermissionType.EXAM, lessonId: this.examDetails.lessonId, prdId: res.data.prdId, mapId: res.data.mapId }
});
}).catch(() => {
this.$messageBox(this.$t('error.obtainCourseDetailsFailed'));

View File

@ -98,7 +98,7 @@ export default {
},
detail: {
mapId: '',
prdCode: ''
prdId: ''
}
};
},
@ -175,7 +175,7 @@ export default {
loadTrainingList(data) {
getLessonDetail({ id: data.lessonId }).then(resp => {
this.detail.mapId = resp.data.mapId;
this.detail.prdCode = resp.data.prdCode;
this.detail.prdId = resp.data.prdId;
this.chapterModel.lessonId = resp.data.id;
this.chapterModel.lessonName = resp.data.name;
if (data.type === 'Chapter') {

View File

@ -92,9 +92,9 @@ export default {
},
{
title: this.$t('lesson.product'),
prop: 'prdCode',
prop: 'prdId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
columnValue: (row) => { return this.$convertField(row.prdId, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
@ -147,7 +147,7 @@ export default {
},
async queryFunction(params) {
params['mapId'] = this.detail.mapId;
params['prdCode'] = this.detail.prdCode;
params['prdId'] = this.detail.prdId;
const res = await pageQueryTraining(params);
this.trainings.forEach(ele => {
res.data.list.forEach(item => {

View File

@ -20,13 +20,13 @@
/>
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.associatedProducts')" prop="prdCode">
<el-select v-model="courseModel.prdCode" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-form-item :label="this.$t('lesson.associatedProducts')" prop="prdId">
<el-select v-model="courseModel.prdId" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-option
v-for="(item,index) in productList"
:key="index"
:label="item.name"
:value="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
@ -74,7 +74,7 @@ export default {
mapIdList: [],
courseModel: {
id: '',
prdCode: '',
prdId: '',
product: [],
mapId: '',
name: '',
@ -94,7 +94,7 @@ export default {
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
prdCode: [
prdId: [
{ required: true, message: this.$t('rules.selectAssociatedProduct'), trigger: 'change' }
],
remarks: [
@ -133,7 +133,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
const model = {
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
name: this.courseModel.name,
mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks
@ -153,7 +153,7 @@ export default {
if (valid) {
const model = {
id: this.courseModel.id,
prdCode: this.courseModel.prdCode,
prdId: this.courseModel.prdId,
name: this.courseModel.name,
mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks
@ -174,7 +174,7 @@ export default {
this.courseModel = {
id: data.id,
mapId: this.$route.query.mapId,
prdCode: data.prdCode,
prdId: data.prdId,
name: data.name,
remarks: data.remarks
};

View File

@ -35,7 +35,7 @@ export default {
id: '',
name: '',
mapId: '',
prdCode: '',
prdId: '',
cityCode: ''
}
};
@ -68,7 +68,7 @@ export default {
id: model.id,
name: model.name,
mapId: this.$route.params.mapId,
prdCode: model.prdCode,
prdId: model.prdId,
cityCode: model.cityCode
};
this.dialogShow = true;

View File

@ -15,13 +15,13 @@
</el-select>
</el-form-item>
<el-form-item :label="this.$t('lesson.productType')" prop="prdCode">
<el-select v-model="operateModel.prdCode" style="width: 300px" @change="prdChange">
<el-form-item :label="this.$t('lesson.productType')" prop="prdId">
<el-select v-model="operateModel.prdId" style="width: 300px" @change="prdChange">
<el-option
v-for="option in productList"
:key="option.code"
:key="option.id"
:label="option.name"
:value="option.code"
:value="option.id"
/>
</el-select>
</el-form-item>
@ -147,7 +147,7 @@ export default {
name: '',
type: '',
mapId: this.$route.query.mapId,
prdCode: '',
prdId: '',
operateType: [],
maxDuration: 0,
minDuration: 0,
@ -167,7 +167,7 @@ export default {
mapId: [
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
],
prdCode: [
prdId: [
{ required: true, message: this.$t('rules.enterProductType'), trigger: 'change' }
],
type: [
@ -212,7 +212,7 @@ export default {
this.loading = false;
},
mapIdChoose(mapId) {
this.operateModel.prdCode = '';
this.operateModel.prdId = '';
this.productList = [];
if (mapId) {
getCommodityMapProduct(mapId).then((response) => {
@ -221,12 +221,12 @@ export default {
});
}
},
async prdChange(prdCode) {
async prdChange(prdId) {
this.trainingTypeMap = {};
this.operateModel.operateType = [];
const mapIdObj = this.mapIdList.find(elem => { return elem.id === this.operateModel.mapId; }) || {};
const prdTypeObj = this.productList.find(elem => { return elem.code === prdCode; }) || {};
const prdTypeObj = this.productList.find(elem => { return elem.id === prdId; }) || {};
const res = await getOperateTrainingList({ mapId: mapIdObj.id, productType: prdTypeObj.prdType });
if (res && res.code == 200) {
this.trainingTypeLists = res.data;
@ -280,7 +280,7 @@ export default {
const data = {
mapId: this.operateModel.mapId,
name: this.operateModel.name,
prdCode: this.operateModel.prdCode,
prdId: this.operateModel.prdId,
trainingType: this.operateModel.type,
operateType: this.operateModel.operateType
};
@ -298,7 +298,7 @@ export default {
const data = {
mapId: this.operateModel.mapId,
name: this.operateModel.name,
prdCode: this.operateModel.prdCode,
prdId: this.operateModel.prdId,
trainingType: this.operateModel.type,
operateType: this.operateModel.operateType,
remarks: this.operateModel.remarks,
@ -319,7 +319,7 @@ export default {
const data = {
mapId: this.operateModel.mapId,
name: this.operateModel.name,
prdCode: this.operateModel.prdCode,
prdId: this.operateModel.prdId,
trainingType: `${this.operateModel.type}`,
operateType: `${this.operateModel.operateType.join(',')}`
};
@ -336,7 +336,7 @@ export default {
const data = {
name: this.operateModel.name,
type: this.operateModel.type,
prdCode: this.operateModel.prdCode,
prdId: this.operateModel.prdId,
mapId: this.operateModel.mapId,
operateType: this.operateModel.operateType[0],
minDuration: this.operateModel.minDuration,

View File

@ -44,7 +44,7 @@ export default {
queryForm: {
labelWidth: '120px',
queryObject: {
prdCode: {
prdId: {
type: 'select',
label: this.$t('lesson.product'),
change: this.prdChoose,
@ -91,9 +91,9 @@ export default {
},
{
title: this.$t('lesson.product'),
prop: 'prdCode',
prop: 'prdId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
columnValue: (row) => { return this.$convertField(row.prdId, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
@ -155,13 +155,13 @@ export default {
await this.loadInitData();
const json = localStore.get(this.$route.path);
json.type = '';
json.prdCode = '';
json.prdId = '';
json.operateType = '';
},
methods: {
async loadInitData() {
this.mapIdList = [];
this.queryForm.queryObject.prdCode.config.data = [];
this.queryForm.queryObject.prdId.config.data = [];
listPublishMap().then(response => {
this.mapIdList = response.data;
});
@ -171,7 +171,7 @@ export default {
productList.forEach(elem => {
//
if (elem.prdType != '03') {
this.queryForm.queryObject.prdCode.config.data.push({ value: elem.code, label: elem.name });
this.queryForm.queryObject.prdId.config.data.push({ value: elem.code, label: elem.name });
}
});
}

View File

@ -42,7 +42,7 @@ export default {
permissionType: '',
mapId: '',
lessonId: '',
prdCode: '',
prdId: '',
date: '',
amount: 0,
ownerId: '',
@ -67,7 +67,7 @@ export default {
items: [
{ prop: 'permissionType', label: this.$t('permission.permissionType'), type: 'select', required: false, disabled: !this.isAdd, options: this.permissionTypeList, change: true, onChange: this.permissionTypeChange },
{ prop: 'mapId', label: this.$t('permission.mapName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMap, options: this.publishMapList, change: true, onChange: this.mapChange },
{ prop: 'prdCode', label: this.$t('permission.mapProductName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange },
{ prop: 'prdId', label: this.$t('permission.mapProductName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowMapProduct, options: this.mapProductList, change: true, onChange: this.mapProductChange },
{ prop: 'lessonId', label: this.$t('permission.lessonName'), type: 'select', required: false, disabled: !this.isAdd, show: this.isShowLesson, options: this.filterPublisLessonList },
{ prop: 'roleName', label: this.$t('permission.belonger'), type: 'complete', required: false, disabled: !this.isAdd && this.isAdministrator, show: this.isShowRole, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
{ prop: 'date', label: this.$t('permission.selectDate'), type: 'daterange', required: false, viewFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss' },
@ -85,7 +85,7 @@ export default {
mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
],
prdCode: [
prdId: [
{ required: true, message: this.$t('rules.selectMapProductName'), trigger: 'change' }
],
lessonId: [
@ -158,9 +158,9 @@ export default {
}
var validator = {};
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.prdCode; };
validator[PermissionType.LESSON] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdId; };
validator[PermissionType.EXAM] = () => { return this.formModel.lessonId && this.formModel.mapId && this.formModel.prdId; };
validator[PermissionType.SIMULATION] = () => { return this.formModel.mapId && this.formModel.prdId; };
validator[PermissionType.SCREEN] = () => { return true; };
if (endTime && startTime && this.formModel.permissionType && validator[this.formModel.permissionType]()) {
@ -175,10 +175,10 @@ export default {
if (this.formModel.permissionType == PermissionType.LESSON || this.formModel.permissionType == PermissionType.EXAM) {
model['lessonId'] = this.formModel.lessonId;
model['mapId'] = this.formModel.mapId;
model['prdCode'] = this.formModel.prdCode;
model['prdId'] = this.formModel.prdId;
} else if (this.formModel.permissionType == PermissionType.SIMULATION) {
model['mapId'] = this.formModel.mapId;
model['prdCode'] = this.formModel.prdCode;
model['prdId'] = this.formModel.prdId;
}
getTotalRemains(model).then(response => {
@ -200,23 +200,23 @@ export default {
},
permissionTypeChange() {
this.formModel.mapId = '';
this.formModel.prdCode = '';
this.formModel.prdId = '';
this.formModel.lessonId = '';
},
mapChange(mapId) {
this.formModel.prdCode = '';
this.formModel.prdId = '';
this.formModel.lessonId = '';
this.mapProductList = [];
getCommodityMapProduct(mapId).then(rest => {
const list = rest.data || [];
this.mapProductList = list.map(elem => {
return { value: elem.code, label: elem.name };
return { value: elem.id, label: elem.name };
});
});
},
mapProductChange(prdCode) {
mapProductChange(prdId) {
this.formModel.lessonId = '';
this.filterPublisLessonList = this.publisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdCode == this.formModel.prdCode; });
this.filterPublisLessonList = this.publisLessonList.filter(elem => { return elem.mapId == this.formModel.mapId && elem.prdId == this.formModel.prdId; });
},
// input
async querySearchAsync(queryString, cb) {
@ -256,7 +256,7 @@ export default {
permissionType: model.permissionType,
mapId: model.mapId,
lessonId: model.lessonId,
prdCode: model.prdCode,
prdId: model.prdId,
date: [model.startTime, model.endTime],
amount: model.amount,
ownerId: this.formModel.ownerId,
@ -278,7 +278,7 @@ export default {
permissionType: this.formModel.permissionType,
mapId: this.isShowMap ? this.formModel.mapId : '',
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
prdCode: this.isShowMapProduct ? this.formModel.prdCode : '',
prdId: this.isShowMapProduct ? this.formModel.prdId : '',
startTime: this.formModel.date[0],
endTime: this.formModel.date[1],
amount: this.formModel.amount,
@ -291,7 +291,7 @@ export default {
permissionType: this.formModel.permissionType,
mapId: this.isShowMap ? this.formModel.mapId : '',
lessonId: this.isShowLesson ? this.formModel.lessonId : '',
prdCode: this.isShowMapProduct ? this.formModel.prdCode : '',
prdId: this.isShowMapProduct ? this.formModel.prdId : '',
startTime: this.formModel.date[0],
endTime: this.formModel.date[1],
amount: this.formModel.amount,

View File

@ -26,7 +26,7 @@
</el-table-column>
<el-table-column prop="mapProductCode" :label="$t('permission.mapProductName')" width="100">
<template slot-scope="scope">
{{ computedName(mapProductList, scope.row.prdCode) }}
{{ computedName(mapProductList, scope.row.prdId) }}
</template>
</el-table-column>
<el-table-column prop="lessonId" :label="$t('permission.lessonName')">
@ -171,7 +171,7 @@ export default {
getPublishLessonList().then(response => {
const list = response.data || [];
this.PublisLessonList = list.map(elem => {
return { value: elem.id, label: elem.name, mapId: elem.mapId, prdCode: elem.prdCode };
return { value: elem.id, label: elem.name, mapId: elem.mapId, prdId: elem.prdId };
});
});
},
@ -194,7 +194,7 @@ export default {
const index = this.ruleList.findIndex(elem => {
return item.mapId == elem.mapId &&
item.lessonId == elem.lessonId &&
item.prdCode == elem.prdCode &&
item.prdId == elem.prdId &&
item.permissionType == elem.permissionType;
});
getCommodityMapProduct(item.mapId).then(rest => {

View File

@ -1,7 +1,6 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<map-select ref="map" @confirm="handleGenerateEveryDay" />
<copy-plan ref="copyPlan" @confirm="handleCopyRunPlan" />
</div>
</template>
@ -11,13 +10,11 @@ import { superAdmin } from '@/router';
import { listPublishMap } from '@/api/jmap/map';
import { runPlanTemplateList, deleteRunPlanTemplate, generateCommonRunPlanEveryDay, postRunPlanTemplate } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import MapSelect from './mapSelect';
import CopyPlan from './copyPlan.vue';
export default {
name: 'RunPlanTemplate',
components: {
MapSelect,
CopyPlan
},
data() {
@ -132,16 +129,16 @@ export default {
});
}).catch(() => { });
},
//
//
handleMapSelect(index, row) {
this.$refs.map.doShow(row);
this.handleGenerateEveryDay(row.id, row.mapId);
},
//
handleCopyPlan(index, row) {
this.$refs.copyPlan.doShow(row);
},
//
handleGenerateEveryDay({planId, mapId}) {
handleGenerateEveryDay(planId, mapId) {
this.$confirm(this.$t('publish.wellGenerateEveryRunPlan'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
@ -149,7 +146,6 @@ export default {
}).then(() => {
generateCommonRunPlanEveryDay(planId, {mapId}).then(response => {
this.reloadTable();
this.$refs.map.doClose();
this.$message.success(this.$t('publish.createCommonSuccess'));
}).catch(() => {
this.reloadTable();

View File

@ -1,69 +0,0 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="show" width="30%" :before-close="doClose">
<el-form ref="form" :model="formMdoel" :rules="rules" label-width="140px">
<el-form-item :label="$t('publish.selectMap')" prop="mapId">
<el-select v-model="formMdoel.mapId">
<el-option
v-for="item in mapList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" @click="handleCofirm">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPublishMapListByLineCode } from '@/api/jmap/map';
export default {
data() {
return {
show: false,
mapList: [],
formMdoel: {
planId: 0,
mapId: ''
}
};
},
computed: {
title() {
return this.$t('publish.selectMap');
},
rules() {
return {
mapId: [
{ required: true, message: this.$t('rules.mapInput'), trigger: 'blur' }
]
};
}
},
methods: {
doShow(row) {
this.formMdoel.planId = row.id;
this.formMdoel.mapId = '';
this.show = true;
getPublishMapListByLineCode(row.skinCode).then(resp => {
this.mapList = resp.data;
});
},
doClose(done) {
this.show = false;
},
handleCofirm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.$emit('confirm', this.formMdoel);
}
});
}
}
};
</script>

View File

@ -16,13 +16,6 @@
</template>
</el-radio-group>
</el-form-item>
<el-form-item
:label="$t('map.productCode') + ':'"
prop="code"
:rules="node && node.data.type ==='Map' ? baseRules.code:{}"
>
<el-input v-model="addModel.code" :disabled="codeDisabled" />
</el-form-item>
<el-form-item :label="$t('map.productName') + ':'" prop="name" :rules="baseRules.name">
<el-input v-model="addModel.name" />
</el-form-item>
@ -79,7 +72,6 @@ export default {
skinCode: '',
name: '',
remarks: '',
code: '',
prdType: '01',
trainTypes: []
}
@ -111,9 +103,6 @@ export default {
},
baseRules() {
return {
code: [
{ required: true, message: this.$t('rules.productCodeEnter'), trigger: 'change' }
],
name: [
{ required: true, message: this.$t('rules.productNameEnter'), trigger: 'change' }
],
@ -161,7 +150,6 @@ export default {
this.addModel.name = response.data.name;
this.addModel.remarks = response.data.remarks;
this.addModel.prdType = response.data.prdType;
this.addModel.code = response.data.code;
this.addModel.skinCode = response.data.skinCode;
this.addModel.trainTypes = this.initTrainTypes = response.data.trainTypes;
this.addModel.id = response.data.id;
@ -191,23 +179,14 @@ export default {
name: this.addModel.name,
remarks: this.addModel.remarks,
prdType: this.addModel.prdType,
code: this.addModel.code,
trainTypes: this.isShowTrainTypes ? this.addModel.trainTypes : []
};
checkMapProductCodeExist({ code: this.addModel.code }).then(response => {
if (!response.data) {
createTrainingCategory(data).then(response => {
this.initTrainTypes = this.addModel.trainTypes;
this.$emit('refresh');
this.$message.success(this.$t('tip.productCreationSuccessfully'));
}).catch((error) => {
this.$message.error(`${this.$t('tip.productCreationFailed')}, ${error.message}`);
});
} else {
this.$message(this.$t('tip.productCodeExists'));
}
}).catch(() => {
this.$message(this.$t('tip.productCodeExists'));
createTrainingCategory(data).then(response => {
this.initTrainTypes = this.addModel.trainTypes;
this.$emit('refresh');
this.$message.success(this.$t('tip.productCreationSuccessfully'));
}).catch((error) => {
this.$message.error(`${this.$t('tip.productCreationFailed')}, ${error.message}`);
});
}
});

View File

@ -34,7 +34,7 @@ export default {
formModel:{
mapId:'',
name: '',
prdCode: '',
prdId: '',
type: '',
id:null
}
@ -49,7 +49,7 @@ export default {
items: [
{ prop: 'customized', label: this.$t('systemGenerate.customized'), type: 'select', required: true, options: this.projectList},
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList, change:true, onChange:this.changeMap},
{ prop: 'prdCode', label: this.$t('systemGenerate.prdName'), type: 'select', required: true, options:this.productList},
{ prop: 'prdId', label: this.$t('systemGenerate.prdName'), type: 'select', required: true, options:this.productList},
{ prop: 'name', label: this.$t('systemGenerate.name'), type: 'text', required: true},
{ prop: 'type', label: this.$t('systemGenerate.type'), type: 'select', required: true, options: this.typeList}
]
@ -80,7 +80,7 @@ export default {
type:[
{ required: true, message: this.$t('systemGenerate.selectType'), trigger: 'change'}
],
prdCode:[
prdId:[
{ required: true, message: this.$t('systemGenerate.selectPrdName'), trigger: 'change'}
]
};
@ -109,8 +109,8 @@ export default {
changeMap(index) {
this.productList = [];
getCommodityMapProduct(index).then((response) => {
this.productList = response.data.map(elem => { return { value: elem.code, label: elem.name }; });
this.formModel.prdCode = '';
this.productList = response.data.map(elem => { return { value: elem.id, label: elem.name }; });
this.formModel.prdId = '';
});
},
doShow(data) {

View File

@ -4,8 +4,8 @@
<el-form-item :label="this.$t('lesson.trainingName')+':'" prop="name">
<el-input v-model="operateModel.name" />
</el-form-item>
<el-form-item :label="this.$t('lesson.productType')" prop="prdCode">
<el-select v-model="operateModel.prdCode" placeholder="" :disabled="true">
<el-form-item :label="this.$t('lesson.productType')" prop="prdId">
<el-select v-model="operateModel.prdId" placeholder="" :disabled="true">
<el-option
v-for="option in productTypesList"
:key="option.code"
@ -61,248 +61,248 @@ import { addTraining, updateTraining, getTrainingDetail } from '@/api/jmap/train
import localStore from 'storejs';
export default {
name: 'TreeDraft',
props: {
node: {
type: Object,
required: true
}
},
data() {
var minDurations = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rules.enterStandardTime')));
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error(this.$t('rules.enterNumericValue')));
} else {
callback();
}
}, 100);
};
var maxDurations = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rules.enterStandardTime')));
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error(this.$t('rules.enterNumericValue')));
} else {
if (value < this.operateModel.minDuration) {
callback(new Error(this.$t('rules.greaterThanMinTime')));
} else {
callback();
}
}
}, 100);
};
return {
dialogShow: false,
productTypesList: [],
trainTypesList: [],
operationList: [],
trainingOperateTypeMap: {},
operation: {
title: '',
event: ''
},
operateModel: {
id: '',
name: '',
type: '',
prdCode: '',
skinCode: '',
operateType: '',
maxDuration: 0,
minDuration: 0,
remarks: ''
},
rules: {
name: [
{ required: true, message: this.$t('rules.inputTrainingName'), trigger: 'change' }
],
minDuration: [
{ required: true, validator: minDurations, trigger: 'blur' }
],
maxDuration: [
{ required: true, validator: maxDurations, trigger: 'blur' }
],
remarks: [
{ required: true, message: this.$t('rules.inputTrainingRemark'), trigger: 'change' }
]
}
};
},
computed: {
},
watch: {
node: function (val, old) {
this.initLoadData();
}
},
mounted() {
this.$Dictionary.trainingType().then(list => {
this.trainTypesList = list;
});
this.operationList = [];
this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list; //
});
this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list; //
});
this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list; //
});
this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list; //
});
this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list; //
});
this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list; //
});
this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; //
});
},
methods: {
initLoadData() {
const node = this.node;
if (this.$refs && this.$refs.form) {
this.$refs['form'].resetFields();
}
if (node && node.data) {
switch (node.data.type) {
case 'TrainingType':
if (node.parent) {
this.operateModel.type = node.data.id;
this.operateModel.prdCode = node.parent.data.id;
this.operateModel.skinCode = node.parent.parent.data.id;
this.productTypesList = [{
code: node.parent.data.id,
name: node.parent.data.name
}];
name: 'TreeDraft',
props: {
node: {
type: Object,
required: true
}
},
data() {
var minDurations = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rules.enterStandardTime')));
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error(this.$t('rules.enterNumericValue')));
} else {
callback();
}
}, 100);
};
var maxDurations = (rule, value, callback) => {
if (!value) {
return callback(new Error(this.$t('rules.enterStandardTime')));
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error(this.$t('rules.enterNumericValue')));
} else {
if (value < this.operateModel.minDuration) {
callback(new Error(this.$t('rules.greaterThanMinTime')));
} else {
callback();
}
}
}, 100);
};
return {
dialogShow: false,
productTypesList: [],
trainTypesList: [],
operationList: [],
trainingOperateTypeMap: {},
operation: {
title: '',
event: ''
},
operateModel: {
id: '',
name: '',
type: '',
prdId: '',
skinCode: '',
operateType: '',
maxDuration: 0,
minDuration: 0,
remarks: ''
},
rules: {
name: [
{ required: true, message: this.$t('rules.inputTrainingName'), trigger: 'change' }
],
minDuration: [
{ required: true, validator: minDurations, trigger: 'blur' }
],
maxDuration: [
{ required: true, validator: maxDurations, trigger: 'blur' }
],
remarks: [
{ required: true, message: this.$t('rules.inputTrainingRemark'), trigger: 'change' }
]
}
};
},
computed: {
},
watch: {
node: function (val, old) {
this.initLoadData();
}
},
mounted() {
this.$Dictionary.trainingType().then(list => {
this.trainTypesList = list;
});
this.operationList = [];
this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list; //
});
this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list; //
});
this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list; //
});
this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list; //
});
this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list; //
});
this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list; //
});
this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list; //
});
},
methods: {
initLoadData() {
const node = this.node;
if (this.$refs && this.$refs.form) {
this.$refs['form'].resetFields();
}
if (node && node.data) {
switch (node.data.type) {
case 'TrainingType':
if (node.parent) {
this.operateModel.type = node.data.id;
this.operateModel.prdId = node.parent.data.id;
this.operateModel.skinCode = node.parent.parent.data.id;
this.productTypesList = [{
code: node.parent.data.id,
name: node.parent.data.name
}];
}
}
this.operateModel.id = '';
this.operateModel.name = '';
this.operateModel.minDuration = '';
this.operateModel.maxDuration = '';
this.operateModel.remarks = '';
this.operateModel.operateType = '';
this.operationList = this.trainingOperateTypeMap[node.data.id] || [];
break;
case 'Training':
if (node.parent && node.parent.parent) {
this.operateModel.type = node.parent.data.id;
this.operateModel.prdCode = node.parent.parent.data.id;
this.operateModel.skinCode = node.parent.parent.parent.data.id;
this.operationList = this.trainingOperateTypeMap[node.parent.data.id] || [];
this.productTypesList = [{
code: node.parent.parent.data.id,
name: node.parent.parent.data.name
}];
}
this.operateModel.id = '';
this.operateModel.name = '';
this.operateModel.minDuration = '';
this.operateModel.maxDuration = '';
this.operateModel.remarks = '';
this.operateModel.operateType = '';
this.operationList = this.trainingOperateTypeMap[node.data.id] || [];
break;
case 'Training':
if (node.parent && node.parent.parent) {
this.operateModel.type = node.parent.data.id;
this.operateModel.prdId = node.parent.parent.data.id;
this.operateModel.skinCode = node.parent.parent.parent.data.id;
this.operationList = this.trainingOperateTypeMap[node.parent.data.id] || [];
this.productTypesList = [{
code: node.parent.parent.data.id,
name: node.parent.parent.data.name
}];
}
this.operateModel.id = node.data.id;
this.operateModel.name = node.data.name;
getTrainingDetail(node.data.id).then(response => {
this.operateModel.minDuration = response.data.minDuration;
this.operateModel.maxDuration = response.data.maxDuration;
this.operateModel.operateType = response.data.operateType;
this.operateModel.remarks = response.data.remarks;
}).catch(() => {
this.$messageBox(this.$t('error.obtainStepDataFailed'));
});
break;
}
}
},
show(data) {
this.operation = data;
this.initLoadData();
this.dialogShow = true;
},
close() {
this.dialogShow = false;
},
handleDeal() {
const operation = this.operation;
if (operation) {
const event = operation.event;
switch (event) {
case '01': this.addTraining(); break;
case '02': this.edtTraining(); break;
}
}
},
handleClose() {
this.dialogShow = false;
this.operateModel = {
id: '',
name: '',
type: '',
prdCode: '',
skinCode: '',
operateType: '',
maxDuration: 0,
minDuration: 0,
remarks: ''
};
this.$refs['form'].resetFields();
},
addTraining() {
this.$refs.form.validate((valid) => {
if (valid) {
const data = {
name: this.operateModel.name,
type: this.operateModel.type,
prdCode: this.operateModel.prdCode,
skinCode: this.operateModel.skinCode,
operateType: this.operateModel.operateType,
minDuration: this.operateModel.minDuration,
maxDuration: this.operateModel.maxDuration,
remarks: this.operateModel.remarks
};
addTraining(data).then(response => {
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
this.close();
this.$message.success(this.$t('tip.addTrainingSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.addTrainingFailed'));
});
}
});
},
edtTraining() {
this.$refs.form.validate((valid) => {
if (valid) {
const data = {
id: this.operateModel.id,
name: this.operateModel.name,
type: this.operateModel.type,
prdCode: this.operateModel.prdCode,
skinCode: this.operateModel.skinCode,
operateType: this.operateModel.operateType,
minDuration: this.operateModel.minDuration,
maxDuration: this.operateModel.maxDuration,
remarks: this.operateModel.remarks
};
updateTraining(data).then(response => {
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
this.close();
this.$message.success(this.$t('tip.updateTrainingSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.updateTrainingFailed'));
});
}
});
}
}
this.operateModel.id = node.data.id;
this.operateModel.name = node.data.name;
getTrainingDetail(node.data.id).then(response => {
this.operateModel.minDuration = response.data.minDuration;
this.operateModel.maxDuration = response.data.maxDuration;
this.operateModel.operateType = response.data.operateType;
this.operateModel.remarks = response.data.remarks;
}).catch(() => {
this.$messageBox(this.$t('error.obtainStepDataFailed'));
});
break;
}
}
},
show(data) {
this.operation = data;
this.initLoadData();
this.dialogShow = true;
},
close() {
this.dialogShow = false;
},
handleDeal() {
const operation = this.operation;
if (operation) {
const event = operation.event;
switch (event) {
case '01': this.addTraining(); break;
case '02': this.edtTraining(); break;
}
}
},
handleClose() {
this.dialogShow = false;
this.operateModel = {
id: '',
name: '',
type: '',
prdId: '',
skinCode: '',
operateType: '',
maxDuration: 0,
minDuration: 0,
remarks: ''
};
this.$refs['form'].resetFields();
},
addTraining() {
this.$refs.form.validate((valid) => {
if (valid) {
const data = {
name: this.operateModel.name,
type: this.operateModel.type,
prdId: this.operateModel.prdId,
skinCode: this.operateModel.skinCode,
operateType: this.operateModel.operateType,
minDuration: this.operateModel.minDuration,
maxDuration: this.operateModel.maxDuration,
remarks: this.operateModel.remarks
};
addTraining(data).then(response => {
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
this.close();
this.$message.success(this.$t('tip.addTrainingSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.addTrainingFailed'));
});
}
});
},
edtTraining() {
this.$refs.form.validate((valid) => {
if (valid) {
const data = {
id: this.operateModel.id,
name: this.operateModel.name,
type: this.operateModel.type,
prdId: this.operateModel.prdId,
skinCode: this.operateModel.skinCode,
operateType: this.operateModel.operateType,
minDuration: this.operateModel.minDuration,
maxDuration: this.operateModel.maxDuration,
remarks: this.operateModel.remarks
};
updateTraining(data).then(response => {
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
this.close();
this.$message.success(this.$t('tip.updateTrainingSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.updateTrainingFailed'));
});
}
});
}
}
};
</script>

View File

@ -94,7 +94,7 @@ export default {
//
getTrainingDetail(this.trainingId).then(resp => {
const detail = resp.data;
getProductDetail(detail.prdCode).then(rest => {
getProductDetail(detail.prdId).then(rest => {
const data = rest.data;
debugger;
loadMapData(detail.skinCode).then(() => {

View File

@ -27,7 +27,7 @@ export default {
dialogVisible: false,
formModel: {
mapId: '',
mapPrdCode: '',
mapPrdId: '',
userId: '',
userName: '',
duration: ''
@ -44,7 +44,7 @@ export default {
labelWidth: '120px',
items: [
{ prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') },
{ prop: 'mapPrdCode', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') },
{ prop: 'mapPrdId', label: this.$t('system.productName'), type: 'select', required: true, options: this.mapPrdList, placeholder: this.$t('rules.productInput') },
{ prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') },
{ prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' }
]
@ -59,7 +59,7 @@ export default {
userName: [
{ required: true, message: this.$t('rules.chooseUser'), trigger: 'change' }
],
mapPrdCode: [
mapPrdId: [
{ required: true, message: this.$t('rules.productInput'), trigger: 'change' }
],
duration: [
@ -125,13 +125,13 @@ export default {
},
async mapChange(val) {
this.mapPrdList = [];
this.formModel.mapPrdCode = '';
this.formModel.mapPrdId = '';
try {
const res = await getCommodityMapProduct(val);
const data = res.data;
if (data && data.length) {
data.forEach(elem => {
this.mapPrdList.push({ value: elem.code, label: elem.name });
this.mapPrdList.push({ value: elem.id, label: elem.name });
});
}
} catch (error) {
@ -151,7 +151,7 @@ export default {
const self = this;
const params = {
mapId: this.formModel.mapId,
mapPrdCode: this.formModel.mapPrdCode,
mapPrdId: this.formModel.mapPrdId,
userId: this.formModel.userId,
duration: parseInt(this.formModel.duration)
};
@ -170,7 +170,7 @@ export default {
handleClose(done) {
this.formModel = {
mapId: '',
mapPrdCode: '',
mapPrdId: '',
userId: '',
userName: '',
duration: ''

View File

@ -14,145 +14,145 @@ import { getPublishLessonList } from '@/api/jmap/lesson';
import UsersTrainingEdit from './edit';
import UsersTrainingAdd from './add';
export default {
name: 'UserTrainingEdit',
components: {
UsersTrainingEdit,
UsersTrainingAdd
},
data() {
return {
examResultList: [],
LessonList: [],
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
trainingName: {
type: 'text',
label: this.$t('system.trainingName')
},
userName: {
type: 'text',
label: this.$t('system.userName')
}
}
name: 'UserTrainingEdit',
components: {
UsersTrainingEdit,
UsersTrainingAdd
},
data() {
return {
examResultList: [],
LessonList: [],
mapList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
trainingName: {
type: 'text',
label: this.$t('system.trainingName')
},
userName: {
type: 'text',
label: this.$t('system.userName')
}
}
},
queryList: {
query: getSimulationList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.userName'),
prop: 'userName'
},
{
title: this.$t('global.mobile'),
prop: 'userMobile'
},
{
title: this.$t('system.mapName'),
prop: 'mapName'
},
{
title: this.$t('system.trainingUseTime'),
prop: 'duration',
type: 'tag',
columnValue: (row) => { return this.computation(row.duration); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.productName'),
prop: 'mapPrdName'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
hide: (row) => { return !row.fake; },
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.edit,
showControl: (row) => { return row.fake; }
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger',
showControl: (row) => { return row.fake; }
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.createTraining }
]
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
async loadInitData() {
const res = await listPublishMap();
this.mapList = res.data;
const response = await getPublishLessonList();
const data = response.data;
if (data && data.length) {
data.forEach(elem => {
this.LessonList.push({ value: elem.prdCode, name: elem.name });
});
}
},
createTraining() {
this.$refs.add.show();
},
computation(fieldValue) {
if (fieldValue) {
const f = parseInt(fieldValue / 60);
const s = fieldValue % 60;
if (f > 0) {
return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`;
} else {
return `${s} ${this.$t('system.second')}`;
}
}
},
},
queryList: {
query: getSimulationList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('system.userName'),
prop: 'userName'
},
{
title: this.$t('global.mobile'),
prop: 'userMobile'
},
{
title: this.$t('system.mapName'),
prop: 'mapName'
},
{
title: this.$t('system.trainingUseTime'),
prop: 'duration',
type: 'tag',
columnValue: (row) => { return this.computation(row.duration); },
tagType: (row) => { return 'success'; }
},
{
title: this.$t('system.productName'),
prop: 'mapPrdName'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
hide: (row) => { return !row.fake; },
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.edit,
showControl: (row) => { return row.fake; }
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger',
showControl: (row) => { return row.fake; }
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.createTraining }
]
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
async loadInitData() {
const res = await listPublishMap();
this.mapList = res.data;
const response = await getPublishLessonList();
const data = response.data;
if (data && data.length) {
data.forEach(elem => {
this.LessonList.push({ value: elem.prdId, name: elem.name });
});
}
},
createTraining() {
this.$refs.add.show();
},
computation(fieldValue) {
if (fieldValue) {
const f = parseInt(fieldValue / 60);
const s = fieldValue % 60;
if (f > 0) {
return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`;
} else {
return `${s} ${this.$t('system.second')}`;
}
}
},
//
edit(index, row) {
this.$refs.edit.show(row);
},
//
edit(index, row) {
this.$refs.edit.show(row);
},
//
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteSimulationStats(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
//
handleDelete(index, row) {
this.$confirm(this.$t('system.wellDelUserSimulation'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteSimulationStats(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
reloadTable() {
this.queryList.reload();
}
}
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -104,7 +104,7 @@ export default {
name: response.data.tree[0].name,
pmsList: response.data.permissionList || [],
treeList: response.data.tree,
prdCode: this.$route.query.prdCode,
prdId: this.$route.query.prdId,
mapId: this.$route.query.mapId,
PermissionType: PermissionType.LESSON
};
@ -159,7 +159,7 @@ export default {
buy() {
this.$router.push({
path: `${UrlConfig.trainingPlatform.pay}/${this.courseModel.id}`, query:
{ permissionType: PermissionType.LESSON, lessonId: this.courseModel.id, prdCode: this.$route.query.prdCode, mapId: this.$route.query.mapId, subSystem: this.$route.params.subSystem }
{ permissionType: PermissionType.LESSON, lessonId: this.courseModel.id, prdId: this.$route.query.prdId, mapId: this.$route.query.mapId, subSystem: this.$route.params.subSystem }
});
},
nodeExpand(obj, node, ele) {

View File

@ -57,8 +57,8 @@ export default {
}
},
goLesson(row) {
localStore.set('teachDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}?lessonId=${row.id}&mapId=${row.mapId}&prdCode=${row.prdCode}`);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdCode: row.prdCode}});
localStore.set('teachDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}?lessonId=${row.id}&mapId=${row.mapId}&prdId=${row.prdId}`);
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdId: row.prdId}});
}
}
};

View File

@ -622,7 +622,7 @@ export default {
this.starting = res.data.state == '02';
this.mapId = res.data.mapId;
this.prodId = res.data.mapPrdCode;
this.prodId = res.data.mapPrdId;
this.roomInfo = {
creatorId: res.data.creatorId,
totalNum: Number(res.data.permissionNum) + Number(res.data.audiencePermissionNum),