This commit is contained in:
joylink_cuiweidong 2020-05-13 18:06:15 +08:00
commit 4631590df0
28 changed files with 1354 additions and 716 deletions

View File

@ -89,7 +89,7 @@ export function updateExamRules(data) {
/** 根据课程ID获取试卷 */ /** 根据课程ID获取试卷 */
export function getExamParperList(lessonId) { export function getExamParperList(lessonId) {
return request({ return request({
url: `/api/exam/${lessonId}/List`, url: `/api/exam/${lessonId}/list`,
method: 'get' method: 'get'
}); });
} }

View File

@ -187,7 +187,7 @@ export function generateOfflineUser(data) {
}); });
} }
// 导入学生成绩 // 导入学生成绩
export function importnStudentResults(projectCode, data) { export function importStudentResults(projectCode, data) {
return request({ return request({
url: `/api/user/project/${projectCode}/import/student`, url: `/api/user/project/${projectCode}/import/student`,
method: 'post', method: 'post',
@ -202,3 +202,20 @@ export function getProjectClassList(projectCode) {
method: 'get' method: 'get'
}); });
} }
// 导出学生成绩
export function exportStudentResults(projectCode, data) {
return request({
url: `/api/user/project/${projectCode}/export/student`,
method: 'put',
data: data
});
}
// 生成绑定微信二维码
export function getWxQrCode(params) {
return request({
url: `/api/user/wmurl`,
method: 'get',
params: params
});
}

View File

@ -5,6 +5,8 @@ import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls';
import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js'; import { ModelManager } from '@/jlmap3d/jl3ddevice/loader.js';
import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js'; import { Signallightload } from '@/jlmap3d/jl3ddevice/component/signallight.js';
import { Moveanimate } from '@/jlmap3d/jl3ddevice/component/moveanimate.js';
import { Textconfig } from '@/jlmap3d/jl3ddevice/component/textconfig.js';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
@ -19,6 +21,21 @@ export function Jl3ddevice(dom,group,token) {
Signallightload(this.signallights); Signallightload(this.signallights);
this.mixers = []; this.mixers = [];
this.showmodel = null; this.showmodel = null;
//新数据交互
let helpbox,textplane;
let daochamodel;
//点击事件状态
this.raycasterstatus = false;
//动画状态
this.animastats = false;
//当前选中模型
this.nowobject = null;
//当前动画播放模型
this.animationmodel = null;
this.devicetext = new Textconfig();
this.windowstatus = '0';
//初始化webgl渲染 //初始化webgl渲染
this.renderer = new THREE.WebGLRenderer({ antialias: true }); this.renderer = new THREE.WebGLRenderer({ antialias: true });
@ -70,6 +87,10 @@ export function Jl3ddevice(dom,group,token) {
this.controls.update(); this.controls.update();
this.selectmodel = null; this.selectmodel = null;
let moveanima = new Moveanimate(scope);
document.addEventListener( "mousedown", onselect, false );
let teststomp = new StompClient(); let teststomp = new StompClient();
let topic = '/user/topic/simulation/assistant/'+group; let topic = '/user/topic/simulation/assistant/'+group;
// let topic = '/user/queue/simulation/jl3d/'+group; // let topic = '/user/queue/simulation/jl3d/'+group;
@ -83,7 +104,6 @@ export function Jl3ddevice(dom,group,token) {
function callback(Response) { function callback(Response) {
let data = JSON.parse(Response.body); let data = JSON.parse(Response.body);
console.log(data);
if(scope.nowcode != data.body.code){ if(scope.nowcode != data.body.code){
scope.nowcode = data.body.code; scope.nowcode = data.body.code;
scope.selectmodel(data); scope.selectmodel(data);
@ -97,11 +117,18 @@ export function Jl3ddevice(dom,group,token) {
scope.camera.updateProjectionMatrix(); scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight); scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
} }
this.domresize = function(){
scope.camera.aspect = scope.dom.offsetWidth / scope.dom.offsetHeight;
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
}
this.anime = null; this.anime = null;
this.modelmanager = new ModelManager(); this.modelmanager = new ModelManager();
this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) { this.modelmanager.loadpromise(Staticmodel, scope.mixers).then(function (data) {
moveanima.initlistnew(scope.modelmanager.switchmodel.mesh);
daochamodel = scope.modelmanager.switchmodel.mesh.getObjectByName("DAOCHA");
animate(); animate();
}) })
@ -113,6 +140,7 @@ export function Jl3ddevice(dom,group,token) {
scope.controls.update(); scope.controls.update();
//scope.camera.lookAt(plane); //scope.camera.lookAt(plane);
// //
moveanima.animateupdate();
let delta = clock.getDelta(); let delta = clock.getDelta();
if (scope.mixers) { if (scope.mixers) {
for (let i = 0; i < scope.mixers.length; i++) { for (let i = 0; i < scope.mixers.length; i++) {
@ -139,7 +167,17 @@ export function Jl3ddevice(dom,group,token) {
scope.showmodel = scope.modelmanager.switchmodel.mesh; scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel); scope.scene.add(scope.showmodel);
scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
scope.nowobject = scope.modelmanager.switchmodel.mesh;
updatemenulist(scope.devicetext.devicelist);
scope.raycasterstatus = true;
}else{
scope.raycasterstatus = false;
scope.nowobject = "";
updatemenulist();
} }
if (data.body._type == "Signal") { if (data.body._type == "Signal") {
scope.modelmanager.signalmodel.code = data.body.code; scope.modelmanager.signalmodel.code = data.body.code;
@ -155,8 +193,13 @@ export function Jl3ddevice(dom,group,token) {
scope.showmodel = scope.modelmanager.standmodel.mesh; scope.showmodel = scope.modelmanager.standmodel.mesh;
scope.scene.add(scope.showmodel); scope.scene.add(scope.showmodel);
} }
scope.showmodel.code = data.body.code;
initstatus(data); if(scope.showmodel){
scope.resetmodel();
scope.showmodel.code = data.code;
initstatus(data);
}
} }
} else { } else {
if (data.body._type == "Switch") { if (data.body._type == "Switch") {
@ -164,6 +207,11 @@ export function Jl3ddevice(dom,group,token) {
scope.modelmanager.switchmodel.code = data.body.code; scope.modelmanager.switchmodel.code = data.body.code;
scope.showmodel = scope.modelmanager.switchmodel.mesh; scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel); scope.scene.add(scope.showmodel);
scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
scope.nowobject = scope.modelmanager.switchmodel.mesh;
updatemenulist(scope.devicetext.devicelist);
scope.raycasterstatus = true;
if (data.body.locateType == "01") { if (data.body.locateType == "01") {
scope.modelmanager.switchmodel.locateType = "01"; scope.modelmanager.switchmodel.locateType = "01";
scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.reset();
@ -180,6 +228,10 @@ export function Jl3ddevice(dom,group,token) {
} }
}else{
scope.raycasterstatus = false;
scope.nowobject = "";
updatemenulist();
} }
if (data.body._type == "Signal") { if (data.body._type == "Signal") {
scope.modelmanager.signalmodel.code = data.body.code; scope.modelmanager.signalmodel.code = data.body.code;
@ -442,4 +494,235 @@ export function Jl3ddevice(dom,group,token) {
} }
} }
//设备分解、归位动画按钮
this.disperdevice1 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"on"],true)
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"off"],true);
}
}
}
};
this.disperdevice2 = function(){
if(scope.nowobject.animacode){
if(moveanima.status == true){
if(scope.animastats == false){
scope.animastats = true;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"chaijie"],true);
} else if(scope.animastats == true){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
}
}
};
this.resetmodel = function(){
if(scope.nowobject.animacode){
scope.animastats = false;
moveanima.setplaylist(moveanima.animatelist[scope.nowobject.animacode+"fuwei"],true);
}
};
this.animationmsgshowon = function(nowobject){
scope.animationmodel = nowobject;
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
settext(scope.animationmodel,scope.animationmodel.position);
// console.log(scope.animationmodel);
helpbox = new THREE.BoxHelper( scope.animationmodel, 0xff0000 );
moveanima.updatehelpbox(helpbox,textplane);
// settext(intersects[0].object,intersects[0].point);
// getdevicemsg(intersects[0].object.name);
scope.scene.add( helpbox );
getdevicemsg(nowobject.name);
}
this.animationmsgshowoff = function(nowobject){
if(helpbox){
scope.animationmodel.helpbox = null;
scope.scene.remove( helpbox );
helpbox = undefined;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
scope.animationmodel = null;
}
this.updateselect = function(updata){
// console.log(updata);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
helpbox = new THREE.BoxHelper( updata.mesh, 0xff0000 );
// console.log(updata.mesh);
let point = {
x:updata.mesh.matrixWorld.elements[12],
y:updata.mesh.matrixWorld.elements[13],
z:updata.mesh.matrixWorld.elements[14]
};
settext(updata.mesh,point)
getdevicemsg(updata.mesh.name);
scope.scene.add( helpbox );
}
function getdevicemsg(selectname){
// console.log(selectname);
for(let i=0,leni=scope.devicetext.devicelist.length;i<leni;i++){
if(selectname == scope.devicetext.devicelist[i].name){
updatemsg(scope.devicetext.devicelist[i].text,scope.devicetext.devicelist[i].msg);
i=leni;
}
}
}
this.updatewindowstatus = function(nowwindowstatus){
scope.windowstatus == nowwindowstatus;
}
function onselect(event){
if(event.button == '0'){
if(scope.raycasterstatus){
//定义光线
let raycaster = new THREE.Raycaster();
//定义平面鼠标点击坐标
let mouse = new THREE.Vector2();
let getBoundingClientRect = scope.dom.getBoundingClientRect()
if(scope.windowstatus == '0'){
mouse.x = ( (event.clientX - getBoundingClientRect .left) /scope.dom.offsetWidth) * 2-1;
mouse.y = -( (event.clientY - getBoundingClientRect .top) / scope.dom.offsetHeight) * 2 + 1;
}else{
mouse.x = (event.clientX / scope.dom.offsetWidth) * 2 - 1;
mouse.y = -(event.clientY / scope.dom.offsetHeight) * 2 + 1;
}
raycaster.setFromCamera( mouse, scope.camera );
let intersects = raycaster.intersectObjects( scope.modelmanager.switchmodel.mesh.children,true);
if(helpbox){
scope.scene.remove( helpbox );
helpbox = null;
}
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
if(intersects[0]){
if(intersects[0].object.raycastoff){
helpbox = new THREE.BoxHelper( intersects[0].object.parent, 0xff0000 );
settext(intersects[0].object.parent,intersects[0].point);
getdevicemsg(intersects[0].object.parent.name);
}else{
helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
settext(intersects[0].object,intersects[0].point);
getdevicemsg(intersects[0].object.name);
}
scope.scene.add( helpbox );
}
}
}
}
function settext(intersects,point){
if(intersects.text){
let textgeometry = new THREE.PlaneBufferGeometry( 18, 12, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(intersects.text));
let textmaterial = new THREE.MeshBasicMaterial( {
side: THREE.DoubleSide,
map:textt ,transparent: true,
alphaTest:0.1
} );
if(textplane){
scope.scene.remove(textplane);
textplane.geometry.dispose();
textplane.material.dispose();
}
textplane= new THREE.Mesh( textgeometry, textmaterial );
// textplane.name = data[i].code;
textplane.position.x = point.x;
textplane.position.y = point.y+6;
textplane.position.z = point.z;
// console.log(textplane.position);
// textplane.tcode = data[i].code;
textplane.rotation.y = -Math.PI/2;
textplane.lookAt(scope.camera.position);
// scope.textlist.push(textplane);
// newmesh.children[0].add(textplane);
scope.scene.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
var beauty = new Image();
beauty.src = "../../static/texture/guide.png";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 256;
canvas.height = 128;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,256,128);
ctx.font = "20px Verdana";
ctx.fillStyle = '#FFFFFF';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,256,128);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,256, 128);
ctx.fillText("设备部件:"+text, 90,30);
// ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,256, 128);
return data;
}
this.hideswitch = function (nowswitchstatus){
if(nowswitchstatus){
scope.modelmanager.switchmodel.mesh.add(daochamodel);
}else{
scope.modelmanager.switchmodel.mesh.remove(daochamodel);
}
}
} }

View File

@ -66,9 +66,6 @@ function fbxpromise(asset,mixers,model){
mixers.push(mixer); mixers.push(mixer);
//model.action.play(); //model.action.play();
} }
console.log(object);
resolve(asset.deviceType); resolve(asset.deviceType);
} ); } );

View File

@ -54,7 +54,6 @@ class Jlmap {
this.$options = new Options(deepAssign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放 this.$options = new Options(deepAssign({ scaleRate: 1, offsetX: 0, offsetY: 0 }, opts.options || {}), (dataZoom) => { this.$mouseController.trigger(this.events.DataZoom, dataZoom); }); // 缩放
this.$painter = new Painter(this); this.$painter = new Painter(this);
this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()}); this.$painter.updateZrSize({width: this.$zr.getWidth(), height: this.$zr.getHeight()});
this.$painter.updateTransform(this.$options);
this.optionsHandler = this.setOptions.bind(this); this.optionsHandler = this.setOptions.bind(this);
@ -157,9 +156,12 @@ class Jlmap {
} }
} }
setRecover(opts) {
this.$painter.updateTransform({ scaleRate: opts.scaleRate, offsetX: opts.offsetX, offsetY: opts.offsetY });
}
setUpdateScreen(opts) { setUpdateScreen(opts) {
const num = opts.num; this.setRecover({ scaleRate: 1, offsetX: 0, offsetY: 0 });
const offsetY = (opts.height - 100) / num; // 高度差
const arr = []; const arr = [];
const rectList = []; const rectList = [];
let rect = ''; let rect = '';
@ -173,13 +175,16 @@ class Jlmap {
} }
} }
} }
const screenSplit = opts.list.length ? opts.list : Vue.prototype.$theme.loadPropConvert(store.state.map.map.skinVO.code).screenSplit;
const splitList = JSON.parse(JSON.stringify(screenSplit));
const num = screenSplit.length + 1;
const offsetY = (opts.height - 100) / num; // 高度差
const maxWidth = rect.width;
splitList.push(maxWidth);
const scaleWidth = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100; const scaleWidth = Math.floor((((opts.width - 200) * num) / rect.width) * 100) / 100;
const scaleHeight = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100; const scaleHeight = Math.floor(((opts.height - 100) / (rect.height * num)) * 100) / 100;
const scale = Math.min(scaleWidth, scaleHeight); const scale = Math.min(scaleWidth, scaleHeight);
const splitList = Vue.prototype.$theme.loadPropConvert(store.state.map.map.skinVO.code).screenSplit;
const maxWidth = rect.width;
splitList.push(maxWidth);
for (let i = 0; i < splitList.length; i++) { for (let i = 0; i < splitList.length; i++) {
let offsetX = ''; let offsetX = '';
if (i == 0) { if (i == 0) {
@ -533,6 +538,12 @@ class Jlmap {
case this.events.Keyboard: case this.events.Keyboard:
this.$keyboardController.on(this.events.Keyboard, cb, context); this.$keyboardController.on(this.events.Keyboard, cb, context);
break; break;
case this.events.__Pan:
this.$mouseController.on(this.events.__Pan, this.optionsHandler);
break;
case this.events.__Zoom:
this.$mouseController.on(this.events.__Zoom, this.optionsHandler);
break;
} }
} }
} }

View File

@ -202,10 +202,6 @@ class Painter {
this.screenFlag = true; this.screenFlag = true;
this.$transformHandleScreen.updateTransform(list, opts); this.$transformHandleScreen.updateTransform(list, opts);
} }
// trainScreen() {
// this.$transformHandleScreen.updateTransform(list, opts);
// }
/** /**
* 更新zrender尺寸 * 更新zrender尺寸
* @param {*} opt * @param {*} opt

View File

@ -209,4 +209,7 @@ export default class Automactic extends Group {
this.text.setStyle('textFill', color); this.text.setStyle('textFill', color);
} }
} }
screenShow() {
this.hideMode();
}
} }

View File

@ -71,4 +71,7 @@ export default class OutFrame extends Group {
this.isShowShape = false; this.isShowShape = false;
} }
} }
screenShow() {
this.box && this.box.hide();
}
} }

View File

@ -147,10 +147,8 @@ class EMouse extends Group {
points.unshift(param); points.unshift(param);
} else { } else {
const param = [ele.x + directx * this.triangle.getAbsSin(switchWidth), ele.y - directy * this.triangle.getAbsCos(switchWidth)]; const param = [ele.x + directx * this.triangle.getAbsSin(switchWidth), ele.y - directy * this.triangle.getAbsCos(switchWidth)];
points.unshift(param); points.unshift(param);
} }
}); });
this.lineBorder = new Polygon({ this.lineBorder = new Polygon({
zlevel: this.device.zlevel, zlevel: this.device.zlevel,

View File

@ -42,7 +42,7 @@ class StationStand extends Group {
create() { create() {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
const drict = 1; // const drict = 1;
/** 列车站台*/ /** 列车站台*/
const standX = model.position.x - model.width / 2; const standX = model.position.x - model.width / 2;

View File

@ -77,4 +77,7 @@ export default class Text2 extends Group {
this.isShowShape = false; this.isShowShape = false;
} }
} }
screenShow() {
this.text && this.text.hide();
}
} }

View File

@ -227,7 +227,7 @@ export default {
}; };
if (this.operation == OperationEvent.Switch.unlock.menu.operation) { if (this.operation == OperationEvent.Switch.unlock.menu.operation) {
operate.operation = OperationEvent.Switch.unlock.confirm2.operation; operate.operation = OperationEvent.Switch.unlock.confirm2.operation;
operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK; operate.cmdType = CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN;
} else if (this.operation == OperationEvent.Switch.unblock.menu.operation) { } else if (this.operation == OperationEvent.Switch.unblock.menu.operation) {
operate.operation = OperationEvent.Switch.unblock.confirm2.operation; operate.operation = OperationEvent.Switch.unblock.confirm2.operation;
operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK; operate.cmdType = CMD.Switch.CMD_SWITCH_UNBLOCK;

View File

@ -60,12 +60,12 @@ export default {
{ {
label: '道岔单锁', label: '道岔单锁',
handler: this.lock, handler: this.lock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN
}, },
{ {
label: '道岔单解', label: '道岔单解',
handler: this.unlock, handler: this.unlock,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN
}, },
{ {
label: '道岔封锁', label: '道岔封锁',
@ -252,7 +252,7 @@ export default {
} }
}); });
}, },
// //
unlock() { unlock() {
commitOperate(menuOperate.Switch.unlock, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{ commitOperate(menuOperate.Switch.unlock, {switchCode:this.selected.code}, 0).then(({valid, operate})=>{
if (valid) { if (valid) {

View File

@ -125,14 +125,16 @@ export const menuOperate = {
}, },
Switch:{ Switch:{
lock:{ lock:{
// 道岔单锁 // 道岔单锁(联锁)
operation: OperationEvent.Switch.lock.menu.operation, operation: OperationEvent.Switch.lock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK // cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_LOCK_CHAIN
}, },
unlock:{ unlock:{
// 道岔解锁 // 道岔解锁(联锁)
operation: OperationEvent.Switch.unlock.menu.operation, operation: OperationEvent.Switch.unlock.menu.operation,
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK // cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK
cmdType: CMD.Switch.CMD_SWITCH_SINGLE_UNLOCK_CHAIN
}, },
block:{ block:{
// 道岔封锁 // 道岔封锁

View File

@ -1,7 +1,5 @@
import {createTransform, createBoundingRect} from './utils/parser'; import {createTransform, createBoundingRect} from './utils/parser';
import Vue from 'vue';
import store from '@/store/index_APP_TARGET';
class TransformHandle { class TransformHandle {
constructor(painter) { constructor(painter) {
@ -34,12 +32,12 @@ class TransformHandle {
if (this.checkVisible(view, rect)) { if (this.checkVisible(view, rect)) {
view.transform = this.transform[i]; view.transform = this.transform[i];
view.decomposeTransform(); // 修改 transform 后同步位置 view.decomposeTransform(); // 修改 transform 后同步位置
const propConvert = Vue.prototype.$theme.loadPropConvert(store.state.map.map.skinVO.code); if (view.screenShow) {
if (propConvert.handleScreenProps && propConvert.handleScreenProps(view)) { view.screenShow();
view.hide(); } else {
return; view.show();
} }
view.show(); return; return;
} }
} }
view.dirty(); // 更新 view.dirty(); // 更新
@ -53,12 +51,11 @@ class TransformHandle {
// 重新计算显示图形 // 重新计算显示图形
revisibleAll() { revisibleAll() {
this.traverse(this.revisibleView, this); this.traverse(this.transformView, this);
} }
// 更新偏移量 // 更新偏移量
updateTransform(list, rectList) { updateTransform(list, rectList) {
// this.rect = { x: opts.x, y: opts.y, width: opts.width, height: opts.height };
this.rectList = rectList; this.rectList = rectList;
this.transform = []; this.transform = [];
list.forEach(item => { list.forEach(item => {

View File

@ -1,250 +1,268 @@
<template> <template>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
:title="$t('global.personalDetails')" :title="$t('global.personalDetails')"
:visible.sync="visible" :visible.sync="visible"
width="470px" width="470px"
:before-close="doClose" :before-close="doClose"
class="userInfo_box" class="userInfo_box"
> >
<div> <div>
<div class="form_box"> <div class="form_box">
<div class="title">{{ $t('global.compellation') }}:</div> <div class="title">{{ $t('global.compellation') }}:</div>
<div class="content"> <div class="content">
<div v-show="nameShow" class="show_box"> <div v-show="nameShow" class="show_box">
<span>{{ userInfo.name }}</span> <span>{{ userInfo.name }}</span>
<i class="el-icon-edit" @click="switcherName" /> <i class="el-icon-edit" @click="switcherName" />
</div> </div>
<div v-show="!nameShow" class="flex_box"> <div v-show="!nameShow" class="flex_box">
<el-input <el-input
v-model="editInfo.name" v-model="editInfo.name"
:placeholder="$t('global.enterName')" :placeholder="$t('global.enterName')"
maxlength="20" maxlength="20"
size="mini" size="mini"
class="input_box" class="input_box"
/> />
<div class="button_box"> <div class="button_box">
<el-button <el-button
size="mini" size="mini"
class="button_box" class="button_box"
:disabled="!editInfo.name" :disabled="!editInfo.name"
@click="saveName" @click="saveName"
>{{ $t('global.save') }}</el-button> >{{ $t('global.save') }}</el-button>
<el-button <el-button
size="mini" size="mini"
class="button_box" class="button_box"
type="text" type="text"
@click="switcherName" @click="switcherName"
>{{ $t('global.cancel') }}</el-button> >{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.nickName') }}:</div>
<div class="content">
<div v-show="nickNameShow" class="show_box">
<span>{{ userInfo.nickname }}</span>
<i class="el-icon-edit" @click="switcherNickname" />
</div>
<div v-show="!nickNameShow" class="flex_box">
<el-input
v-model="editInfo.nickname"
:placeholder="$t('global.enterNickname')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.nickname"
@click="saveNickName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherNickname"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content">
<div v-show="mobileShow" class="show_box">
<span>{{ geTel(userInfo.mobile) }}</span>
<i class="el-icon-edit" @click="switcherMobile" />
</div>
<div v-show="!mobileShow" class="flex_box">
<el-input
v-model="editInfo.mobile"
:placeholder="$t('global.enterMobile')"
maxlength="11"
size="mini"
class="input_box"
/>
<el-select v-model="nationCode" size="mini" class="selectCountry">
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
v-model="mobileCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="mobileCodeTime != 0"
@click="sendMobileCode"
>
{{ $t('global.sendCode') }}
<span
v-if="mobileCodeTime"
>{{ mobileCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!mobileCode"
@click="saveMobile"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherMobile"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.email') }}:</div>
<div class="content">
<div v-show="emailShow" class="show_box">
<span>{{ userInfo.email }}</span>
<i class="el-icon-edit" @click="switcherEmail" />
</div>
<div v-show="!emailShow" class="flex_box">
<el-input
v-model="editInfo.email"
:placeholder="$t('global.enterEmail')"
size="mini"
class="input_box"
/>
<el-input
v-model="emailCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="emailCodeTime != 0"
@click="sendEmailCode"
>
{{ $t('global.sendCode') }}
<span
v-if="emailCodeTime"
>{{ emailCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!emailCode"
@click="saveEmail"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherEmail"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.passWord') }}:</div>
<div class="content">
<div v-show="passwordShow" class="show_box">
<span>******</span>
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<div v-show="!passwordShow" class="flex_box">
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input
v-model="newPassWord1"
:placeholder="$t('global.enterPassWord')"
maxlength="20"
show-password
size="mini"
class="input_box"
/>
</div>
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;">
<el-input
v-model="passWordCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
/>
<el-button
size="mini"
style="margin-right: 10px;"
:disabled="passWordCodeTime != 0"
@click="sendPassWordCode"
>
{{ $t('global.sendMobileCode') }}
<span
v-if="passWordCodeTime"
>{{ passWordCodeTime }}</span>
</el-button>
</div>
<div class="button_box" style="width: 150px;">
<el-button
size="mini"
class="button_box"
:disabled="!passWordCode"
@click="savePassWord"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherPassWord"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div> </div>
</div>
</div> </div>
<span slot="footer" class="dialog-footer"> </div>
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button> <div class="form_box">
</span> <div class="title">{{ $t('global.nickName') }}:</div>
</el-dialog> <div class="content">
<div v-show="nickNameShow" class="show_box">
<span>{{ userInfo.nickname }}</span>
<i class="el-icon-edit" @click="switcherNickname" />
</div>
<div v-show="!nickNameShow" class="flex_box">
<el-input
v-model="editInfo.nickname"
:placeholder="$t('global.enterNickname')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.nickname"
@click="saveNickName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherNickname"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content">
<div v-show="mobileShow" class="show_box">
<span>{{ geTel(userInfo.mobile) }}</span>
<i class="el-icon-edit" @click="switcherMobile" />
</div>
<div v-show="!mobileShow" class="flex_box">
<el-input
v-model="editInfo.mobile"
:placeholder="$t('global.enterMobile')"
maxlength="11"
size="mini"
class="input_box"
/>
<el-select v-model="nationCode" size="mini" class="selectCountry">
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
v-model="mobileCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="mobileCodeTime != 0"
@click="sendMobileCode"
>
{{ $t('global.sendCode') }}
<span
v-if="mobileCodeTime"
>{{ mobileCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!mobileCode"
@click="saveMobile"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherMobile"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.email') }}:</div>
<div class="content">
<div v-show="emailShow" class="show_box">
<span>{{ userInfo.email }}</span>
<i class="el-icon-edit" @click="switcherEmail" />
</div>
<div v-show="!emailShow" class="flex_box">
<el-input
v-model="editInfo.email"
:placeholder="$t('global.enterEmail')"
size="mini"
class="input_box"
/>
<el-input
v-model="emailCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="emailCodeTime != 0"
@click="sendEmailCode"
>
{{ $t('global.sendCode') }}
<span
v-if="emailCodeTime"
>{{ emailCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!emailCode"
@click="saveEmail"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherEmail"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.passWord') }}:</div>
<div class="content">
<div v-show="passwordShow" class="show_box">
<span>******</span>
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<div v-show="!passwordShow" class="flex_box">
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input
v-model="newPassWord1"
:placeholder="$t('global.enterPassWord')"
maxlength="20"
show-password
size="mini"
class="input_box"
/>
</div>
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;">
<el-input
v-model="passWordCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
/>
<el-button
size="mini"
style="margin-right: 10px;"
:disabled="passWordCodeTime != 0"
@click="sendPassWordCode"
>
{{ $t('global.sendMobileCode') }}
<span
v-if="passWordCodeTime"
>{{ passWordCodeTime }}</span>
</el-button>
</div>
<div class="button_box" style="width: 150px;">
<el-button
size="mini"
class="button_box"
:disabled="!passWordCode"
@click="savePassWord"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherPassWord"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
</div>
<div v-if="project.endsWith('gzb')" class="form_box">
<div class="title">绑定微信:</div>
<div class="content">
<el-button v-if="!binding&&!bindSuccess" type="primary" size="small" @click="generateQrCode">生成微信二位码</el-button>
<div v-if="binding && !bindSuccess" class="login-code-box" @click="generateQrCode">
<qrcode-vue
v-loading="loadingCode"
:value="loginUrl"
:class-name="qrcodeClassName"
:size="150"
:element-loading-text="this.$t('login.clickRefresh')"
element-loading-spinner="el-icon-refresh"
element-loading-background="rgba(255, 255, 255, 0.9)"
/>
</div>
<div v-if="bindSuccess"><span>绑定成功</span></div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
import md5 from "js-md5"; import md5 from 'js-md5';
import { getInfo } from "@/api/login"; import { getInfo } from '@/api/login';
import { getToken } from "@/utils/auth"; // getDesignToken import { getToken } from '@/utils/auth'; // getDesignToken
import { import {
getUserinfoName, getUserinfoName,
getUserinfoNickname, getUserinfoNickname,
@ -252,29 +270,42 @@ import {
getUserinfoMobileCode, getUserinfoMobileCode,
getUserinfoEmailCode, getUserinfoEmailCode,
getUserinfoEmail, getUserinfoEmail,
getUserinfoPassword getUserinfoPassword,
} from "@/api/management/user"; getWxQrCode
import { setInterval, clearInterval } from "timers"; } from '@/api/management/user';
import QrcodeVue from 'qrcode.vue';
import { LoginParams } from '@/utils/login';
import { setInterval, clearInterval } from 'timers';
import { checkLoginStatus } from '@/api/login';
import { getessionStorage } from '@/utils/auth';
export default { export default {
components: { QrcodeVue },
data() { data() {
return { return {
visible: false, visible: false,
loginUrl: '',
loadingCode: false,
sessionId: '',
binding: false,
bindSuccess: false,
qrcodeClassName: 'login-qrcode',
checkTimeout: null,
userInfo: { userInfo: {
name: "", name: '',
nickname: "", nickname: '',
mobile: "", mobile: '',
email: "", email: '',
passWord: "" passWord: ''
}, },
editInfo: { editInfo: {
name: "", name: '',
nickname: "", nickname: '',
mobile: "", mobile: '',
email: "", email: '',
passWord: "" passWord: ''
}, },
nationCode: "86", nationCode: '86',
nameShow: true, nameShow: true,
nickNameShow: true, nickNameShow: true,
mobileShow: true, mobileShow: true,
@ -283,6 +314,7 @@ export default {
mobileCode: null, mobileCode: null,
emailCode: null, emailCode: null,
passWordCode: null, passWordCode: null,
checkLogin: null,
oldPassWord: null, oldPassWord: null,
newPassWord1: null, newPassWord1: null,
@ -295,17 +327,19 @@ export default {
mobileTime: null, mobileTime: null,
passWordTime: null, passWordTime: null,
countryList: [ countryList: [
{ name: this.$t("global.china"), value: "86" }, { name: this.$t('global.china'), value: '86' },
{ name: this.$t("global.australia"), value: "61" }, { name: this.$t('global.australia'), value: '61' },
{ name: this.$t("global.england"), value: "44" }, { name: this.$t('global.england'), value: '44' },
{ name: this.$t("global.hongKong"), value: "852" }, { name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t("global.Japanese"), value: "81" }, { name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t("global.macao"), value: "853" }, { name: this.$t('global.macao'), value: '853' },
{ name: this.$t("global.singapore"), value: "65" }, { name: this.$t('global.singapore'), value: '65' },
{ name: this.$t("global.taiwan"), value: "886" }, { name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t("global.america"), value: "1" } { name: this.$t('global.america'), value: '1' }
], ],
nationCodeInit: "86" // nationCodeInit: '86', //
loginClient: 'LianKeTang',
project:''
}; };
}, },
computed: { computed: {
@ -317,13 +351,16 @@ export default {
geTel(tel) { geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/; const reg = /^(\d{3})\d{4}(\d{4})$/;
if (tel) { if (tel) {
return tel.replace(reg, "$1****$2"); return tel.replace(reg, '$1****$2');
} else { } else {
return ""; return '';
} }
}, },
doShow() { doShow() {
this.visible = true; this.visible = true;
this.binding = false;
this.bindSuccess = false;
this.project = getessionStorage('project');
// const token = getToken() || getDesignToken(); // const token = getToken() || getDesignToken();
const token = getToken(); const token = getToken();
getInfo(token) getInfo(token)
@ -334,20 +371,22 @@ export default {
nickname: user.nickname, nickname: user.nickname,
mobile: user.mobile, mobile: user.mobile,
email: user.email, email: user.email,
passWord: "" passWord: ''
}; };
this.oldPassWord = user.password; this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : "86"; this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode this.nationCodeInit = user.nationCode
? user.nationCode ? user.nationCode
: "86"; : '86';
}) })
.catch(error => { .catch(error => {
console.log(error, "请求个人信息失败"); console.log(error, '请求个人信息失败');
}); });
}, },
doClose() { doClose() {
this.visible = false; this.visible = false;
this.binding = false;
this.bindSuccess = false;
}, },
switcherName() { switcherName() {
this.editInfo.name = this.userInfo.name; this.editInfo.name = this.userInfo.name;
@ -359,9 +398,9 @@ export default {
await getUserinfoName(this.info.id, this.editInfo.name); await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name; this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow; this.nameShow = !this.nameShow;
this.$store.commit("SET_NAME", this.editInfo.name); this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) { } catch (error) {
console.log(error, "错误"); console.log(error, '错误');
} }
} }
}, },
@ -379,9 +418,9 @@ export default {
); );
this.userInfo.nickname = this.editInfo.nickname; this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow; this.nickNameShow = !this.nickNameShow;
this.$store.commit("SET_NICKNAME", this.editInfo.nickname); this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) { } catch (error) {
console.log(error, "错误"); console.log(error, '错误');
} }
} }
}, },
@ -404,7 +443,7 @@ export default {
this.mobileShow = !this.mobileShow; this.mobileShow = !this.mobileShow;
this.mobileCode = null; this.mobileCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t("global.codeError")); this.$message.info(this.$t('global.codeError'));
} }
} }
}, },
@ -431,7 +470,7 @@ export default {
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t("global.codeFaile")); this.$message.info(this.$t('global.codeFaile'));
} }
}, },
@ -451,7 +490,7 @@ export default {
this.emailShow = !this.emailShow; this.emailShow = !this.emailShow;
this.emailCode = null; this.emailCode = null;
} catch (error) { } catch (error) {
this.$message.info(this.$t("global.codeError")); this.$message.info(this.$t('global.codeError'));
} }
} }
}, },
@ -468,7 +507,7 @@ export default {
}, 1000); }, 1000);
await getUserinfoEmailCode(this.editInfo.email); await getUserinfoEmailCode(this.editInfo.email);
} catch (error) { } catch (error) {
this.$message.info(this.$t("global.codeFaile")); this.$message.info(this.$t('global.codeFaile'));
} }
}, },
@ -477,7 +516,7 @@ export default {
}, },
async savePassWord() { async savePassWord() {
if (this.newPassWord1.length <= 5) { if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t("global.passWordLength")); this.$message.info(this.$t('global.passWordLength'));
} else { } else {
this.uploadPassword(); this.uploadPassword();
} }
@ -492,13 +531,59 @@ export default {
try { try {
await getUserinfoPassword(this.info.id, param); await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.newPassWord1 = ""; this.newPassWord1 = '';
this.passWordCode = null; this.passWordCode = null;
} catch (error) { } catch (error) {
console.log(error, 11); console.log(error, 11);
} }
} else { } else {
this.$message.info(this.$t("global.passWordSome")); this.$message.info(this.$t('global.passWordSome'));
}
},
generateQrCode() {
getWxQrCode(LoginParams[this.loginClient]).then(response => {
this.sessionId = response.data.sessionId;
this.loginUrl = response.data.url;
this.binding = true;
this.clearTimer(this.checkTimeout);
this.checkTimeout = setTimeout(() => {
this.loadingCode = true;
this.loginUrl = '';
}, 3 * 60 * 1000);
this.checkLoginStatus();
});
},
checkLoginStatus() {
const self = this;
//
if (!this.binding) {
return;
}
//
//
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => {
//
if (response.data.status == '2') {
self.clearTimer(self.checkLogin);
self.bindSuccess = true;
} else {
self.checkLoginStatus();
}
}).catch(error => {
if (error.data && error.data.status === '1') {
self.scanSuccess = true;
}
self.checkLoginStatus();
});
}, 3000);
},
clearTimer(timer) {
if (timer) {
clearTimeout(timer);
timer = null;
} }
}, },
async sendPassWordCode() { async sendPassWordCode() {
@ -525,11 +610,11 @@ export default {
}, 1000); }, 1000);
await getUserinfoMobileCode(param); await getUserinfoMobileCode(param);
} catch (error) { } catch (error) {
this.$message.info(this.$t("global.codeFaile")); this.$message.info(this.$t('global.codeFaile'));
} }
} else { } else {
this.passwordShow = !this.passwordShow; this.passwordShow = !this.passwordShow;
this.$message.info(this.$t("global.enterMobileNumber")); this.$message.info(this.$t('global.enterMobileNumber'));
} }
} }
} }

View File

@ -8,6 +8,10 @@ export default {
CMD_SWITCH_SINGLE_LOCK: {value:'Switch_Single_Lock', label: '单锁'}, CMD_SWITCH_SINGLE_LOCK: {value:'Switch_Single_Lock', label: '单锁'},
/** 单解 */ /** 单解 */
CMD_SWITCH_SINGLE_UNLOCK: {value:'Switch_Single_Unlock', label: '单解'}, CMD_SWITCH_SINGLE_UNLOCK: {value:'Switch_Single_Unlock', label: '单解'},
/** 单锁(联动) */
CMD_SWITCH_SINGLE_LOCK_CHAIN: {value:'Switch_Single_Lock_Chain', label: '单锁(联动)'},
/** 单解(联动) */
CMD_SWITCH_SINGLE_UNLOCK_CHAIN: {value:'Switch_Single_Unlock_Chain', label: '单解(联动)'},
/** 封锁 */ /** 封锁 */
CMD_SWITCH_BLOCK: {value:'Switch_Block', label: '封锁'}, CMD_SWITCH_BLOCK: {value:'Switch_Block', label: '封锁'},
/** 解封 */ /** 解封 */

View File

@ -367,6 +367,13 @@ const map = {
return []; return [];
} }
}, },
bigScreenSplitConfig: (state) => {
if (state.map) {
return state.map.bigScreenSplitConfig || [];
} else {
return [];
}
},
indicatorLightList: (state) => { indicatorLightList: (state) => {
if (state.map) { if (state.map) {
return state.map.indicatorLightList || []; return state.map.indicatorLightList || [];

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="map-view"> <div class="map-view">
<div v-show="maskOpen" class="mask" :style="{'width': maskWidth}" />
<jlmap-visual ref="jlmapVisual" /> <jlmap-visual ref="jlmapVisual" />
<div class="display-draft"> <div v-show="disPlay" class="display-draft">
<el-button-group> <el-button-group>
<el-button type="primary" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button> <el-button type="primary" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
</el-button-group> </el-button-group>
@ -11,6 +12,7 @@
<script> <script>
import JlmapVisual from '@/views/newMap/jlmapNew/index'; import JlmapVisual from '@/views/newMap/jlmapNew/index';
import { loadNewMapDataByGroup, loadMapDataById } from '@/utils/loaddata'; import { loadNewMapDataByGroup, loadMapDataById } from '@/utils/loaddata';
import { clearSimulation } from '@/api/simulation';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp'; import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
@ -32,7 +34,10 @@ export default {
size: { size: {
width: document.documentElement.clientWidth - 400, width: document.documentElement.clientWidth - 400,
height: document.documentElement.clientHeight - 80 height: document.documentElement.clientHeight - 80
} },
maskOpen: false,
maskWidth: '100%',
disPlay: false
}; };
}, },
computed: { computed: {
@ -42,6 +47,9 @@ export default {
height() { height() {
return this.$store.state.app.height - 50 - 30; return this.$store.state.app.height - 50 - 30;
}, },
...mapGetters('map', [
'bigScreenSplitConfig'
]),
...mapGetters('config', [ ...mapGetters('config', [
'canvasId' 'canvasId'
]) ])
@ -63,7 +71,9 @@ export default {
this.$jlmap.off('zoom'); this.$jlmap.off('zoom');
this.$jlmap.off('pan'); this.$jlmap.off('pan');
this.handleUpdateScreen(); this.handleUpdateScreen();
this.subscribe(); if (this.$route.query.group) {
this.subscribe();
}
}, },
'$store.state.socket.equipmentStatus': function (val) { '$store.state.socket.equipmentStatus': function (val) {
if (val.length && this.$route.query.group) { if (val.length && this.$route.query.group) {
@ -77,47 +87,42 @@ export default {
async mounted() { async mounted() {
await this.setWindowSize(); await this.setWindowSize();
await this.initLoadData(); await this.initLoadData();
this.disPlay = true;
if (this.$route.path.includes('design/bigScreen')) {
this.disPlay = false;
}
}, },
methods: { methods: {
async initLoadData() { // async initLoadData() { //
if (this.$route.query.group) { if (this.$route.query.group) {
await loadNewMapDataByGroup(this.$route.query.group); await loadNewMapDataByGroup(this.$route.query.group);
} else { } else {
await loadMapDataById(this.$route.params.mapId); this.loadMapDataById(this.$route.params.mapId);
}
},
// id
async loadMapDataById(mapId) {
try {
await this.$store.dispatch('training/changeMode', { mode: null });
loadMapDataById(mapId).then(()=>{
this.$store.dispatch('training/over');
this.$store.dispatch('training/setMapDefaultState');
this.$store.dispatch('map/clearJlmapTrainView');
});
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
} }
}, },
async statusMessage(list) { async statusMessage(list) {
await this.$store.dispatch('training/updateMapState', list); await this.$store.dispatch('training/updateMapState', list);
await this.$store.dispatch('socket/setEquipmentStatus'); await this.$store.dispatch('socket/setEquipmentStatus');
}, },
// id
async loadMapDataById(mapId) {
// try {
// await this.$store.dispatch('training/changeMode', { mode: null });
// loadMapDataById(mapId).then(()=>{
// this.$store.dispatch('training/over');
// this.$store.dispatch('training/setMapDefaultState');
// this.$store.dispatch('map/clearJlmapTrainView');
// });
// } catch (error) {
// this.$messageBox(`: ${error.message}`);
// this.endViewLoading();
// }
},
//
endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
setWindowSize() { setWindowSize() {
this.$nextTick(() => { this.$nextTick(() => {
if (this.widthLeft) { if (this.widthLeft) {
const width = this.$store.state.app.width - (this.widthLeft || 450) - 2; const width = this.$store.state.app.width - (this.widthLeft || 450) - 2;
this.maskWidth = `calc(100% - ${this.widthLeft || 450}px)`;
const height = this.height; const height = this.height;
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
} else { } else {
@ -125,27 +130,38 @@ export default {
const height = this.$store.state.app.height; const height = this.$store.state.app.height;
this.$store.dispatch('config/resize', { width, height }); this.$store.dispatch('config/resize', { width, height });
} }
this.handleUpdateScreen();
}); });
}, },
handleUpdateScreen() { handleUpdateScreen() {
if (this.widthLeft) { this.maskOpen = false;
const size = { if (this.bigScreenSplitConfig.length) {
width: this.$store.state.app.width - (this.widthLeft || 450) - 2, if (this.widthLeft) {
height: this.height, const size = {
num: this.$theme.loadPropConvert(this.$store.state.map.map.skinVO.code).screenLine width: this.$store.state.app.width - (this.widthLeft || 450) - 2,
}; height: this.height,
this.$jlmap.setUpdateScreen(size); list: this.bigScreenSplitConfig.map(ele => ele.position)
};
this.$jlmap.setUpdateScreen(size);
} else {
const size = {
width: this.$store.state.app.width - 2,
height: this.$store.state.app.height,
list: this.bigScreenSplitConfig.map(ele => ele.position)
};
this.$jlmap.setUpdateScreen(size);
}
this.$refs.jlmapVisual.handleStateLoaded();
} else { } else {
const size = { this.maskOpen = true;
width: this.$store.state.app.width - 2, // this.$messageBox('线, ');
height: this.$store.state.app.height,
num: this.$theme.loadPropConvert(this.$store.state.map.map.skinVO.code).screenLine
};
this.$jlmap.setUpdateScreen(size);
} }
this.$refs.jlmapVisual.handleStateLoaded();
}, },
back() { async back() {
if (this.$route.query.group) {
await clearSimulation(this.$route.query.group);
this.clearSubscribe();
}
this.$store.dispatch('training/over').then(() => { this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop'); EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop'); EventBus.$emit('chatSubscribeStop');
@ -169,11 +185,22 @@ export default {
.map-view { .map-view {
float: left; float: left;
width: auto; width: auto;
}
.mask{
opacity: 1;
background: #000;
position: absolute;
right: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9;
} }
.display-draft { .display-draft {
position: absolute; position: absolute;
float: right; float: right;
right: 15px; right: 15px;
bottom: 15px; bottom: 15px;
z-index: 19;
} }
</style> </style>

View File

@ -43,7 +43,7 @@
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> --> <!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<Jl3d-Device v-if="deviceShow" ref="Jl3dDevice" :panel-show="deviceShow" @showdevice="showdevice" /> <Jl3d-Device v-if="deviceShow" ref="Jl3dDevice" :panel-show="deviceShow" @closedevice3dview="devicemodel" />
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" /> <scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />

View File

@ -33,6 +33,7 @@
}, },
data() { data() {
return { return {
datastatus:"",
jl3d: null, jl3d: null,
psdlist:this.$store.state.map.map.psdList, psdlist:this.$store.state.map.map.psdList,
windowstatus:false, windowstatus:false,
@ -63,24 +64,24 @@
}, },
'$store.state.menuOperation.selectedCount': { '$store.state.menuOperation.selectedCount': {
handler: function (newVal, oldVal) { handler: function (newVal, oldVal) {
if (newVal != oldVal) { if(this.datastatus == "new"){
if(this.$store.state.menuOperation.selected._type){ if (newVal != oldVal) {
if(this.$store.state.menuOperation.selected._type == "StationStand"){ if(this.$store.state.menuOperation.selected._type){
let standcode = this.$store.state.menuOperation.selected.code; if(this.$store.state.menuOperation.selected._type == "StationStand"){
for(let i=0,leni=this.psdlist.length;i<leni;i++){ let standcode = this.$store.state.menuOperation.selected.code;
if(standcode == this.psdlist[i].standCode){ for(let i=0,leni=this.psdlist.length;i<leni;i++){
this.jl3d.selectmodel(Vue.prototype.$jlmap.mapDevice[this.psdlist[i].code]); if(standcode == this.psdlist[i].standCode){
break; this.jl3d.selectmodel(Vue.prototype.$jlmap.mapDevice[this.psdlist[i].code]);
break;
}
} }
}else{
this.jl3d.selectmodel(this.$store.state.menuOperation.selected);
} }
}else{
this.jl3d.selectmodel(this.$store.state.menuOperation.selected);
} }
} }
// this.jl3d.selectmodel(this.$store.state.socket.device);
} }
} }
}, },
// '$store.state.socket.device': { // '$store.state.socket.device': {
@ -111,10 +112,14 @@
let header = this.$route.query.token; let header = this.$route.query.token;
// console.log(this.$store.state.menuOperation); // console.log(this.$store.state.menuOperation);
// console.log(this.$store.state.map.map.linkList); // console.log(this.$store.state.map.map.linkList);
// console.log(this.$store.state.map.map.linkList);
if(this.$store.state.map.map.linkList){ if(this.$store.state.map.map.linkList){
this.datastatus = "old";
this.initolddata(group,header); this.initolddata(group,header);
}else{ }else{
this.datastatus = "new";
this.initnewdata(group,header); this.initnewdata(group,header);
} }
// if (group) { // if (group) {
// this.init(group,header); // this.init(group,header);

View File

@ -161,6 +161,12 @@ export default {
await this.loadInitData(json); await this.loadInitData(json);
this.typeChoose(json); this.typeChoose(json);
}, },
mounted() {
this.interCheckGenerateStatus();
},
beforeDestroy() {
this.isLeaving = true;
},
methods: { methods: {
async loadInitData(queryData) { async loadInitData(queryData) {
this.mapIdList = []; this.mapIdList = [];
@ -196,6 +202,28 @@ export default {
this.reloadTable(); this.reloadTable();
}, },
interCheckGenerateStatus() {
createAllTrainingList(this.$route.query.mapId, false).then((data)=>{
if (data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
} else {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 15000);
}).catch(()=>{
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 15000);
});
},
async prdChoose(queryData) { async prdChoose(queryData) {
this.trainingTypeMap = {}; this.trainingTypeMap = {};
const mapId = this.$route.query.mapId; const mapId = this.$route.query.mapId;
@ -252,15 +280,26 @@ export default {
beforeClose: async (action, instance, done) => { beforeClose: async (action, instance, done) => {
if (action === 'confirm') { if (action === 'confirm') {
instance.confirmButtonLoading = true; instance.confirmButtonLoading = true;
instance.confirmButtonText = '生成中...'; // instance.confirmButtonText = '...';
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
try { try {
await createAllTrainingList(this.$route.query.mapId); const data = await createAllTrainingList(this.$route.query.mapId, true);
this.$message.success('生成实训成功'); this.$message.success('实训生成中...');
instance.confirmButtonLoading = false;
if (!data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
done(); done();
} catch (error) { } catch (error) {
instance.confirmButtonLoading = false;
this.$message.error(`生成实训失败: ${error.message}`); this.$message.error(`生成实训失败: ${error.message}`);
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
} }
} else { } else {
instance.confirmButtonLoading = false;
done(); done();
} }
} }

View File

@ -116,7 +116,7 @@ export default {
components: { QrcodeVue, FloatPart }, components: { QrcodeVue, FloatPart },
data() { data() {
const validateUsername = (rule, value, callback) => { const validateUsername = (rule, value, callback) => {
if (value.length < 5) { if (value.length < 5 && !this.project.endsWith('gzb')) {
callback(new Error(this.$t('login.enterTheCorrectUserName'))); callback(new Error(this.$t('login.enterTheCorrectUserName')));
} else { } else {
callback(); callback();

View File

@ -1,24 +1,19 @@
<template> <template>
<div class="jlmap-canvas" :style="{ width: width+'px', height: height+'px' }"> <div>
<div v-show="maskOpen" class="mask" /> <jlmap-canvas @onOffset="onDataZoom" @onSelect="onSelected" @onMenu="onContextMenu" @mapViewLoaded="mapViewLoaded" />
<div :id="canvasId" style="background: #000;" class="display_canvas" />
<progress-bar ref="progressBar" />
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import JlmapCanvas from './cnavas';
import Jlmap from '@/jmapNew/map';
import ProgressBar from '@/views/components/progressBar/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
// import Theme from '@/jmapNew/theme/factory';
export default { export default {
name: 'JlmapVisual', name: 'JlmapVisual',
components: { components: {
ProgressBar JlmapCanvas
}, },
data() { data() {
return { return {
@ -36,11 +31,9 @@ export default {
'mode', 'mode',
'offsetStationCode' 'offsetStationCode'
]), ]),
canvasId() { ...mapGetters('config', [
const canvasId = ['map', (Math.random().toFixed(5)) * 100000].join('_'); 'canvasId'
this.$store.dispatch('config/setCurrentCancasId', { id: canvasId }); ]),
return canvasId;
},
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
}, },
@ -61,51 +54,17 @@ export default {
} }
}, },
watch: { watch: {
'$store.state.map.map': function (val, old) {
try {
if (val) {
this.setMap(val);
}
} catch (error) {
console.log('[ERROR] ', error);
this.mapViewLoaded(false);
}
},
'$store.state.training.rezoomCount': function (val, old) {
//
let code = this.$store.state.training.offsetStationCode;
if (code && code.includes('TurnedAround')) {
const buttonList = this.$store.state.map.map.cycleButtonList;
if (buttonList && buttonList.length > 0) {
buttonList.forEach(element => {
if (code == element.cycleCode) {
code = element.code;
}
});
}
}
},
$route() {
this.mapViewLoaded(true);
}
}, },
created() { created() {
EventBus.$on('viewLoading', (loading) => {
this.mapViewLoaded(loading);
});
EventBus.$on('viewProgressAt', (percentage) => { EventBus.$on('viewProgressAt', (percentage) => {
this.mapViewProgressAt(percentage); this.mapViewProgressAt(percentage);
}); });
EventBus.$on('refresh', () => {
this.refresh(this.$store.state.map.map);
});
}, },
mounted() { mounted() {
this.initLoadPage(); // this.initLoadPage();
}, },
beforeDestroy() { beforeDestroy() {
EventBus.$off('refresh');
EventBus.$off('viewLoading');
EventBus.$off('viewProgressAt'); EventBus.$off('viewProgressAt');
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
if (this.$jlmap) { if (this.$jlmap) {
@ -113,42 +72,17 @@ export default {
} }
}, },
methods: { methods: {
// jlmap onDataZoom() {
initLoadPage() {
document.getElementById(this.canvasId).oncontextmenu = function (e) { },
return false; onSelected() {
};
const mouseWheelFlag = true; },
const prdType = this.$store.state.training.prdType; onContextMenu() {
// Vue.prototype.$theme = new Theme();
Vue.prototype.$jlmap = new Jlmap({ },
dom: document.getElementById(this.canvasId), mapViewLoaded() {
config: {
renderer: 'canvas',
width: this.width,
height: this.height
},
options: {
scaleRate: 1,
offsetX: 0,
offsetY: 0,
zoomOnMouseWheel: mouseWheelFlag
},
showConfig: {
prdType: prdType,
previewOrMapDraw: false,
showMode: '03'
},
methods: {
dataLoaded: this.handleDataLoaded,
viewLoaded: this.handleViewLoaded,
stateLoaded: this.handleStateLoaded
}
});
window.document.oncontextmenu = function () {
return false;
};
}, },
// jlmap // jlmap
resetWidth(opt) { resetWidth(opt) {
@ -165,42 +99,11 @@ export default {
// }, 100); // }, 100);
// }); // });
}, },
//
handleDataLoaded() {
this.$store.dispatch('map/mapDataLoaded');
},
//
handleViewLoaded() {
this.$store.dispatch('map/mapViewScreenLoaded');
if (!this.$store.state.training.prdType) {
this.mapViewLoaded(false);
}
},
//
handleStateLoaded() {
this.mapViewLoaded(false);
},
//
mapViewLoaded(loading) {
this.loading = loading;
if (loading) {
this.$refs.progressBar && this.$refs.progressBar.start();
} else {
this.$refs.progressBar && this.$refs.progressBar.end(true);
}
},
// //
mapViewProgressAt(percentage) { mapViewProgressAt(percentage) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.progressBar.progressAt(percentage); this.$refs.progressBar.progressAt(percentage);
}); });
},
//
setMap(map) {
this.$jlmap.setMap(map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData});
},
//
refresh(map) {
} }
} }
}; };

View File

@ -1,151 +0,0 @@
<template>
<el-dialog
title="大屏预览"
:visible.sync="dialogShow"
width="100%"
:before-close="doClose"
:close-on-click-modal="false"
:modal="false"
fullscreen
>
<div class="map-view">
<jlmap-visual ref="jlmapVisual" />
<div class="display-draft">
<el-button-group>
<el-button type="primary" @click="doClose">{{ $t('scriptRecord.scriptBack') }}</el-button>
</el-button-group>
</div>
</div>
</el-dialog>
</template>
<script>
import JlmapVisual from '@/views/newMap/jlmapNew/screen';
import { loadMapDataById } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import { mapGetters } from 'vuex';
//
export default {
name: 'RunPlanView',
components: {
JlmapVisual
},
props: {
},
data() {
return {
dialogShow: false,
size: {
width: this.$store.state.app.width,
height: this.$store.state.app.height - 90
}
};
},
computed: {
mapId() {
return this.$route.params.mapId;
},
height() {
return this.$store.state.app.height - 50 - 30;
},
...mapGetters('config', [
'canvasId'
])
},
watch: {
'$store.state.map.mapDataLoadedScreenCount':function() {
this.$store.dispatch('map/setTrainWindowShow', false);
this.$jlmap.off('zoom');
this.$jlmap.off('pan');
this.handleUpdateScreen();
}
},
async beforeDestroy() {
await this.$store.dispatch('map/mapClear');
},
async mounted() {
// await this.setWindowSize();
},
methods: {
async doShow() {
try {
this.dialogShow = true;
const size = {
width: this.$store.state.app.width - 2,
height: this.$store.state.app.height
};
console.log(size, '------');
this.$refs.jlmapVisual && this.$refs.jlmapVisual.resetWidth(size);
await this.initLoadData();
} catch (e) {
console.error(e);
}
},
async doClose() {
this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop');
});
this.dialogShow = false;
},
async initLoadData() { //
if (this.$route.params.mapId) {
await loadMapDataById('34');
} else {
this.endViewLoading();
}
},
// id
async loadMapDataById(mapId) {
try {
await this.$store.dispatch('training/changeMode', { mode: null });
loadMapDataById(mapId).then(()=>{
this.$store.dispatch('training/over');
this.$store.dispatch('training/setMapDefaultState');
this.$store.dispatch('map/clearJlmapTrainView');
});
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
//
endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
handleUpdateScreen() {
const size = {
width: this.$store.state.app.width - 2,
height: this.$store.state.app.height,
num: this.$theme.loadPropConvert(this.$store.state.map.map.skinVO.code).screenLine
};
this.$jlmap.setUpdateScreen(size);
this.$refs.jlmapVisual.handleStateLoaded(); //
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">
/deep/ {
.el-dialog__body {
padding: 0px !important;
background-color: floralwhite !important;
}
}
.map-view {
float: left;
width: 100%;
}
.display-draft {
position: absolute;
float: right;
right: 15px;
bottom: 15px;
}
</style>

View File

@ -9,7 +9,7 @@
</el-table-column> </el-table-column>
<el-table-column label="换行位置"> <el-table-column label="换行位置">
<template slot-scope="scope"> <template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.width }}</span> <span style="margin-left: 10px">{{ scope.row.position }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
@ -34,8 +34,8 @@
</div> </div>
<div> <div>
<el-form ref="hostileForm" :model="addModel" label-width="135px" size="mini" style="margin-top: 15px"> <el-form ref="hostileForm" :model="addModel" label-width="135px" size="mini" style="margin-top: 15px">
<el-form-item label="区段:" prop="section"> <el-form-item label="区段:" prop="sectionCode">
<el-select v-model="addModel.section" clearable :filterable="true"> <el-select v-model="addModel.sectionCode" clearable :filterable="true">
<el-option <el-option
v-for="item in sectionList" v-for="item in sectionList"
:key="item.code" :key="item.code"
@ -51,22 +51,21 @@
</el-form> </el-form>
</div> </div>
</el-card> </el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 10px;"> <div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" @click="save">保存</el-button> <el-button type="primary" @click="save">保存</el-button>
<!-- <el-button type="primary" @click="preview">预览</el-button> --> <el-button v-if="isPreview" type="primary" @click="preview">预览</el-button>
<el-button v-if="!isPreview" type="primary" @click="recover">重置</el-button>
</div> </div>
</el-scrollbar> </el-scrollbar>
<preview-screen ref="previewScreen" />
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import PreviewScreen from './config/previewScreen'; import { saveMap } from '@/api/jmap/mapdraft';
export default { export default {
components: { components: {
PreviewScreen
}, },
props: { props: {
selected: { selected: {
@ -80,16 +79,18 @@ export default {
return { return {
tableData: [], tableData: [],
addModel: { addModel: {
section: '' sectionCode: ''
}, },
field: '', field: '',
cardMode: 'generate', cardMode: 'generate',
index: '' index: '',
isPreview: true
}; };
}, },
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'sectionList' 'sectionList',
'bigScreenSplitConfig'
]), ]),
cardTitle() { cardTitle() {
if (this.cardMode === 'generate') { if (this.cardMode === 'generate') {
@ -104,6 +105,11 @@ export default {
watch: { watch: {
selected: function (val, oldVal) { selected: function (val, oldVal) {
this.deviceSelect(val); this.deviceSelect(val);
},
bigScreenSplitConfig: function(val) {
if (val.length) {
this.handleList(val);
}
} }
}, },
mounted() { mounted() {
@ -115,11 +121,23 @@ export default {
this.$refs.make && this.$refs.make.resetFields(); this.$refs.make && this.$refs.make.resetFields();
if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'selectSection'.toUpperCase()) {
if (selected.type === '01' || selected.type === '03') { if (selected.type === '01' || selected.type === '03') {
this.addModel.section = selected.code; this.addModel.sectionCode = selected.code;
this.field = ''; this.field = '';
} }
} }
}, },
handleList(list) {
this.tableData = [];
list.forEach(item => {
const section = this.$store.getters['map/getDeviceByCode'](item.sectionCode);
const param = {
position: String(section.points[section.points.length - 1].x),
name: `${section.name}(${section.code})`,
sectionCode: section.code
};
this.tableData.push(param);
});
},
hover(field) { hover(field) {
this.field = field == this.field ? '' : field; this.field = field == this.field ? '' : field;
}, },
@ -129,7 +147,7 @@ export default {
this.cardMode = 'generate'; this.cardMode = 'generate';
}, },
editModel(list, index) { editModel(list, index) {
this.addModel.section = list[index].code; this.addModel.sectionCode = list[index].sectionCode;
this.index = index; this.index = index;
this.cardMode = 'edit'; this.cardMode = 'edit';
}, },
@ -139,14 +157,14 @@ export default {
}, },
updateOverlab() { updateOverlab() {
if (this.index || this.index == 0) { if (this.index || this.index == 0) {
if (!this.addModel.section) { if (!this.addModel.sectionCode) {
this.$messageBox('请选择区段!'); this.$messageBox('请选择区段!');
} else { } else {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.section); const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
const param = { const param = {
width: section.points[section.points.length - 1].x, position: String(section.points[section.points.length - 1].x),
name: `${section.name}(${section.code})`, name: `${section.name}(${section.code})`,
code: section.code sectionCode: section.code
}; };
this.tableData.splice(this.index, 1, param); this.tableData.splice(this.index, 1, param);
} }
@ -155,25 +173,59 @@ export default {
} }
}, },
save() { save() {
console.log(this.tableData); // if (this.tableData.length) {
const map = this.$store.state.map.map;
const param = {
bigScreenSplitConfig: this.tableData,
mapId: this.$route.params.mapId
};
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存大屏分割位置成功');
}).catch(() => {
this.$messageBox('保存大屏分割位置失败');
});
}
}, },
preview() { // preview() { //
this.$refs.previewScreen.doShow(); if (this.tableData.length) {
this.isPreview = false;
this.$jlmap && this.$jlmap.off('zoom');
this.$jlmap && this.$jlmap.off('pan');
const size = {
width: this.$jlmap.$zr.getWidth(),
height: this.$jlmap.$zr.getHeight(),
list: this.tableData.map(ele => ele.position)
};
this.$jlmap && this.$jlmap.setUpdateScreen(size);
} else {
this.$messageBox('请输入换行位置信息');
}
},
recover() { //
this.isPreview = true;
this.$jlmap && this.$jlmap.on('zoom');
this.$jlmap && this.$jlmap.on('pan');
const param = {
scaleRate: this.$store.state.map.dataZoom.scaleRate,
offsetX: this.$store.state.map.dataZoom.offsetX,
offsetY: this.$store.state.map.dataZoom.offsetY
};
this.$jlmap && this.$jlmap.setRecover(param);
}, },
clear() { clear() {
this.$refs.hostileForm.resetFields(); this.$refs.hostileForm.resetFields();
this.addModel.section = ''; this.addModel.sectionCode = '';
this.index = ''; this.index = '';
}, },
generateOverlab() { generateOverlab() {
if (!this.addModel.section) { if (!this.addModel.sectionCode) {
this.$messageBox('请选择区段!'); this.$messageBox('请选择区段!');
} else { } else {
const section = this.$store.getters['map/getDeviceByCode'](this.addModel.section); const section = this.$store.getters['map/getDeviceByCode'](this.addModel.sectionCode);
this.tableData.push({ this.tableData.push({
width: section.points[section.points.length - 1].x, position: String(section.points[section.points.length - 1].x),
name: `${section.name}(${section.code})`, name: `${section.name}(${section.code})`,
code: section.code sectionCode: section.code
}); });
this.clear(); this.clear();
} }

View File

@ -1,15 +1,15 @@
<template> <template>
<div class="joylink-card"> <div class="joylink-card">
<div style="margin-top: 20px;"> <div style="margin-top: 20px;width: 90%; position: absolute; left: 5%;">
<el-row> <el-row>
<el-col :span="20"> <el-col :span="20">
<el-form ref="form" :model="form" label-width="80px" size="mini" style="width: 100%;margin-top: 10px;"> <el-form ref="form" :model="form" :rules="rules" label-width="100px" size="mini" style="width: 100%;margin-top: 10px;">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="班级:"> <el-form-item label="班级:" prop="classId">
<el-select v-model="form.classId" placeholder="请选择" @change="getLessonByClassId"> <el-select v-model="form.classId" placeholder="请选择" @change="getLessonByClassId">
<el-option <el-option
v-for="item in calssList" v-for="item in classList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
@ -18,24 +18,26 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="考勤天数:"> <el-form-item label="考勤天数:" prop="attendanceDays">
<el-input-number v-model="form.attendanceDays" :min="1" /> <el-input-number v-model="form.attendanceDays" :min="1" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="开始日期:"> <el-form-item label="开始日期:" prop="termBeginDate">
<el-date-picker <el-date-picker
v-model="form.termBeginDate" v-model="form.termBeginDate"
type="date" type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="结束日期:"> <el-form-item label="结束日期:" prop="termEndDate">
<el-date-picker <el-date-picker
v-model="form.termEndDate" v-model="form.termEndDate"
type="date" type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期" placeholder="选择日期"
/> />
</el-form-item> </el-form-item>
@ -43,10 +45,13 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="产品类型:"> <el-form-item label="产品类型:"><span>行调</span></el-form-item>
<el-select v-model="form.prdType" placeholder="请选择"> </el-col>
<el-col :span="6">
<el-form-item label="课程:" prop="centerLessonId">
<el-select v-model="form.centerLessonId" placeholder="请选择" @change="centerLessonChange">
<el-option <el-option
v-for="item in calssList" v-for="item in centerLessonList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
@ -55,10 +60,27 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="课程:"> <el-form-item label="试卷:" prop="centerExamPaperId">
<el-select v-model="form.lessonId" placeholder="请选择"> <el-select v-model="form.centerExamPaperId" placeholder="请选择">
<el-option <el-option
v-for="item in calssList" v-for="item in centerExamPaperList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="产品类型:"><span>现地</span></el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="课程:" prop="localLessonId">
<el-select v-model="form.localLessonId" placeholder="请选择" @change="localLessonChange">
<el-option
v-for="item in localLessonList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
@ -67,10 +89,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="试:"> <el-form-item label=":" prop="localExamPaperId">
<el-select v-model="form.examPaperId" placeholder="请选择"> <el-select v-model="form.localExamPaperId" placeholder="请选择">
<el-option <el-option
v-for="item in calssList" v-for="item in localExamPaperList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
@ -92,10 +114,34 @@
accept=".json, application/json, .csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" accept=".json, application/json, .csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="importResults" @change="importResults"
> >
成绩导入 导入学生信息
</el-button> </el-button>
<el-button type="primary" size="mini" style="margin-top: 10px;" @click="exportResults">成绩导出</el-button></el-col> <el-button type="primary" size="mini" style="margin-top: 10px;" @click="exportResults">成绩导出</el-button></el-col>
</el-row> </el-row>
<el-table
:data="tableData"
border
>
<el-table-column prop="index" label="序号" />
<el-table-column
prop="studentID"
label="学号"
/>
<el-table-column
prop="name"
label="姓名"
/>
<el-table-column label="考勤(10分)" prop="attendance" width="180" />
<el-table-column label="技能操作(30分)">
<el-table-column v-if="showLocal" :label="'ATS现地('+ lessonSocre +'分)'" prop="localLessonPassRate" />
<el-table-column v-if="showCenter" :label="'ATS行调('+ lessonSocre+'分)'" prop="centerLessonPassRate" />
</el-table-column>
<el-table-column label="考试成绩(60分)">
<el-table-column v-if="showLocal" :label="'ATS现地('+ examSocre+'分)'" prop="localExamSocreRadio" />
<el-table-column v-if="showCenter" :label="'ATS行调('+ examSocre+'分)'" prop="centerExamSocreRadio" />
</el-table-column>
<el-table-column label="期末成绩(100分)" prop="totolScore" />
</el-table>
</div> </div>
</div> </div>
</template> </template>
@ -104,11 +150,12 @@
import { getLessonDrftList } from '@/api/jmap/lessondraft'; import { getLessonDrftList } from '@/api/jmap/lessondraft';
import XLSX from 'xlsx'; import XLSX from 'xlsx';
import { convertSheetToList } from '@/utils/runPlan'; import { convertSheetToList } from '@/utils/runPlan';
import { importnStudentResults } from '@/api/management/user'; import { importStudentResults, exportStudentResults } from '@/api/management/user';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig'; import { ProjectCode } from '@/scripts/ProjectConfig';
import { getProjectClassList } from '@/api/management/user'; import { getProjectClassList } from '@/api/management/user';
import { getLessonByClassId } from '@/api/jmap/lesson'; import { getLessonByClassId } from '@/api/jmap/lesson';
import { getExamList } from '@/api/management/exam';
export default { export default {
name: 'StudentManage', name: 'StudentManage',
@ -117,15 +164,41 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
calssList: [], classList: [],
localLessonList: [],
centerLessonList: [],
localExamPaperList: [],
centerExamPaperList: [],
showLocal: false,
showCenter: false,
tableData: [],
props: { multiple: true, value: 'id', label: 'name' },
form: { form: {
attendanceDays: 1, attendanceDays: 1,
classId: '', classId: '',
termBeginDate: '', termBeginDate: '',
termEndDate: '', termEndDate: '',
prdType: '', localLessonId: '',
lessonId: '', centerLessonId: '',
examPaperId: '' localExamPaperId: '',
centerExamPaperId: ''
},
examDataList: [
{
id: '01',
name: '现地',
children: []
}, {
id: '02',
name: '行调',
children: []
}
],
rules: {
classId: [{ required: true, message: '请选择班级', trigger: 'change' }],
attendanceDays: [{required: true, message: '请输入考勤天数', trigger: 'blur'}],
termBeginDate: [{required: true, message: '请选择开始日期', trigger: 'change'}],
termEndDate: [{required: true, message: '请选择结束日期', trigger: 'change'}]
}, },
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
@ -141,17 +214,25 @@ export default {
columns: [ columns: [
] ]
},
exportData: {
classId: '',
localLessonId: ''
} }
}; };
}, },
computed: { computed: {
mapId() { mapId() {
return this.$route.params.mapId; return this.$route.params.mapId;
}, },
hasRelease() { project() {
return this.$store.state.user.roles.includes('04') || return getSessionStorage('project');
this.$store.state.user.roles.includes('05'); },
lessonSocre() {
return this.showLocal && this.showCenter ? 15 : 30;
},
examSocre() {
return this.showLocal && this.showCenter ? 30 : 60;
} }
}, },
watch: { watch: {
@ -160,9 +241,8 @@ export default {
} }
}, },
mounted() { mounted() {
const project = getSessionStorage('project'); getProjectClassList(ProjectCode[this.project]).then(resp => {
getProjectClassList(ProjectCode[project]).then(resp => { this.classList = resp.data;
this.calssList = resp.data;
}).catch(() =>{ }).catch(() =>{
this.$message.error('获取班级数据失败!'); this.$message.error('获取班级数据失败!');
}); });
@ -180,18 +260,118 @@ export default {
} }
}, },
query() { query() {
this.$refs.form.validate((valid) => {
if (valid) {
if ((this.form.localLessonId && this.form.localExamPaperId) || (this.form.centerLessonId && this.form.centerExamPaperId)) {
const prdParams = [];
if (this.form.localLessonId && this.form.localExamPaperId) {
prdParams.push({prdType: '01', lessonId: this.form.localLessonId, examPaperId: this.form.localExamPaperId});
}
if (this.form.centerLessonId && this.form.centerExamPaperId) {
prdParams.push({prdType: '02', lessonId: this.form.centerLessonId, examPaperId: this.form.centerExamPaperId});
}
const params = {
attendanceDays: this.form.attendanceDays,
classId:this.form.classId,
termBeginDate: this.form.termBeginDate,
termEndDate: this.form.termEndDate,
prdParams: prdParams
};
this.exportData = {
classId: '',
localLessonId: ''
};
exportStudentResults(ProjectCode[this.project], params).then(resp => {
this.tableData = [];
this.showLocal = false;
this.showCenter = false;
this.exportData = {
classId: params.classId
};
resp.data.forEach((item, index) => {
let localExamSocreRadio = -1;
let localLessonPassRate = -1;
let centerExamSocreRadio = -1;
let centerLessonPassRate = -1;
let totolScore = 0;
item.scores.forEach(elem => {
if (elem.prdType === '01') {
this.showLocal = true;
localExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
localLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
totolScore += localExamSocreRadio;
totolScore += localLessonPassRate;
} else if (elem.prdType === '02') {
this.showCenter = true;
centerExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
centerLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
totolScore += centerExamSocreRadio;
totolScore += centerLessonPassRate;
}
});
totolScore += item.attendance * 100 * 10 / 100;
this.tableData.push(
{
index: index + 1,
name: item.name,
studentID: item.studentID,
attendance: item.attendance * 100 * 10 / 100,
localExamSocreRadio:localExamSocreRadio,
localLessonPassRate: localLessonPassRate,
centerExamSocreRadio: centerExamSocreRadio,
centerLessonPassRate: centerLessonPassRate,
totolScore: totolScore
});
});
}).catch(() =>{
this.$message.error('获取学生考试成绩失败!');
});
} else {
this.$messageBox('您至少需选择一种产品类型下的课程与考试!');
}
}
});
}, },
localLessonChange(lessonId) {
this.localExamPaperList = [];
if (lessonId) {
getExamList({lessonId:lessonId, pageSize:999, pageNum:1}).then(resp => {
this.localExamPaperList = resp.data.list;
}).catch(()=> {
this.$message.error('获取试卷列表失败!');
});
}
},
centerLessonChange(lessonId) {
this.centerExamPaperList = [];
if (lessonId) {
getExamList({lessonId:lessonId, pageSize:999, pageNum:1}).then(resp => {
this.centerExamPaperList = resp.data.list;
}).catch(()=> {
this.$message.error('获取试卷列表失败!');
});
}
},
getLessonByClassId(classId) { getLessonByClassId(classId) {
getLessonByClassId(classId).then(resp => { this.lessonList = [];
if (classId) {
}).catch(()=> { getLessonByClassId(classId).then(resp => {
this.lessonList = resp.data;
}); this.lessonList.forEach(item => {
if (item.prdType === '01') {
this.localExamPaperList.push(item);
} else if (item.prdType === '02') {
this.centerLessonList.push(item);
}
});
}).catch(()=> {
this.$message.error('获取课程列表失败!');
});
}
}, },
handleImportResults(file) { handleImportResults(file) {
const studentData = { className: '', students:[] }; const studentData = { className: '', students:[] };
const project = getSessionStorage('project');
if (file) { if (file) {
setTimeout(() => { setTimeout(() => {
const that = this; const that = this;
@ -217,13 +397,13 @@ export default {
const className = dataList[0][2].split(' ')[0].replace(/\s*/g, '').split('')[1]; const className = dataList[0][2].split(' ')[0].replace(/\s*/g, '').split('')[1];
studentData.className = className; studentData.className = className;
for ( let i = 5; i <= dataList[0].length; i++) { for ( let i = 5; i <= dataList[0].length; i++) {
if (dataList[0][i] && dataList[1][i]) { if (dataList[2][i] && dataList[1][i]) {
students.push({studentID:dataList[0][i], name: dataList[1][i]}); students.push({studentID:dataList[2][i], name: dataList[1][i]});
} }
} }
studentData.students = students; studentData.students = students;
} }
importnStudentResults(ProjectCode[project], studentData).then(resp => { importStudentResults(ProjectCode[that.project], studentData).then(resp => {
that.$message.success('学生成绩导入成功!'); that.$message.success('学生成绩导入成功!');
}).catch(error => { }).catch(error => {
that.$message.error('学生成绩导入失败!'); that.$message.error('学生成绩导入失败!');
@ -246,7 +426,184 @@ export default {
}, },
exportResults() { exportResults() {
if (!this.tableData || !this.tableData.length) {
this.$message.error('暂无导出数据!');
return;
}
let className = '';
this.classList.forEach(item => {
if (item.id === this.exportData.classId) {
className = item.name;
}
});
const wb = XLSX.utils.book_new();
let cellNum = 0;
let data = [{A:'贵 州 装 备 制 造 职 业 学 院'}, {A:'实 训 成 绩 登 记 表'}, {A:`班级:${className} 实训课程名称: 20XX 学年 第 学期 `}];
const data1 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '', G: '考试成绩(60分)', H: '', I: '期末成绩', J: '备注'}, {E: 'ATS现地(15分)', F: 'ATS行调(15分)', G: 'ATS现地(30分)', H: 'ATS行调(30分)'}];
const data2 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '考试成绩(60分)', G: '期末成绩', H: '备注'}, { E: 'ATS现地(30分)', F: 'ATS现地(60分)'}];
const data3 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '考试成绩(60分)', G: '期末成绩', H: '备注'}, {E: 'ATS行调(30分)', F: 'ATS行调(60分)'}];
if (this.showCenter && this.showLocal) {
data = [...data, ...data1];
cellNum = 9;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.localLessonPassRate,
F: item.centerLessonPassRate,
G: item.localExamSocreRadio,
H: item.centerExamSocreRadio,
I: item.totolScore,
J: ''
});
});
} else if (this.showCenter) {
data = [...data, ...data3];
cellNum = 7;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.centerLessonPassRate,
F: item.centerExamSocreRadio,
G: item.totolScore,
H: ''
});
});
} else if (this.showLocal) {
data = [...data, ...data2];
cellNum = 7;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.localLessonPassRate,
F: item.localExamSocreRadio,
G: item.totolScore,
H: ''
});
});
}
const ws = XLSX.utils.json_to_sheet(data, {skipHeader:true});
ws['A1'].s = { //
font: {
name: '宋体',
sz: 20,
color: {rgb: '#000000'},
bold: true,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['A2'].s = { //
font: {
name: '宋体',
sz: 16,
color: {rgb: '#000000'},
bold: true,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['A3'].s = { //
font: {
name: '宋体',
sz: 12,
color: {rgb: '#000000'},
bold: false,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['!merges'] = [
{
s: {c: 0, r: 0},
e: {c: cellNum, r: 0}
},
{
s: {c: 0, r: 1},
e: {c: cellNum, r: 1}
},
{
s: {c: 0, r: 2},
e: {c: cellNum, r: 2}
},
{
s: {c: 0, r: 3},
e: {c: 0, r: 4}
},
{
s: {c: 1, r: 3},
e: {c: 1, r: 4}
},
{
s: {c: 2, r: 3},
e: {c: 2, r: 4}
},
{
s: {c: 3, r: 3},
e: {c: 3, r: 4}
}
];
if (this.showCenter && this.showLocal) {
ws['!merges'].push({
s: {c: 4, r: 3},
e: {c: 5, r: 3}
});
ws['!merges'].push({
s: {c: 6, r: 3},
e: {c: 7, r: 3}
});
ws['!merges'].push({
s: {c: 8, r: 3},
e: {c: 8, r: 4}
});
ws['!merges'].push({
s: {c: 9, r: 3},
e: {c: 9, r: 4}
});
} else {
ws['!merges'].push({
s: {c: 6, r: 3},
e: {c: 6, r: 4}
});
ws['!merges'].push({
s: {c: 7, r: 3},
e: {c: 7, r: 4}
});
}
ws['!cols'] = [
{width: 10},
{width: 10},
{width: 10},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15}
];
XLSX.utils.book_append_sheet(wb, ws, 'file');
XLSX.writeFile(wb, '成绩单' + '.xlsx');
}, },
refresh() { refresh() {
this.$refs.queryListPage.refresh(true); this.$refs.queryListPage.refresh(true);