This commit is contained in:
joylink_cuiweidong 2020-10-09 19:47:12 +08:00
commit 545dbe8e3c
11 changed files with 251 additions and 32 deletions

View File

@ -67,3 +67,19 @@ export function getIbpInfoByStation(mapId, stationCode) {
method: 'get'
});
}
// 获取IBP盘数据
export function getIbpList(params) {
return request({
url: `/api/ibp/list`,
method: 'get',
params: params
});
}
// 复制ibp盘数据
export function copyIbpData(data) {
return request({
url: `/api/draftIbp/copy`,
method: 'post',
data: data
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

View File

@ -130,7 +130,7 @@ class MouseController extends Eventful {
}
mouseup(e) {
if (eventTool.notLeftMouse(e) || !this.eventTarget ) {
if (!this.eventTarget ) {
return;
}
if (this.deviceList.length) {
@ -268,7 +268,7 @@ class MouseController extends Eventful {
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
}
}
if (this.eventTarget && this.eventTarget.grouper) {
if (this.eventTarget && this.eventTarget.grouper && this.boundingRect) {
const x = e.event.x + this.$ibp.$options.offsetX;
const y = e.event.y + this.$ibp.$options.offsetY;
if (!(x <= this.boundingRect.x2 && x >= this.boundingRect.x1 && y <= this.boundingRect.y2 && y >= this.boundingRect.y1)) {

View File

@ -62,12 +62,11 @@ class Options {
}
this.scaleRate = this.scaleList[this.scaleIndex];
}
if (Number.isFinite(payload.scaleRate)) {
const idx = this.scaleList.indexOf(payload.scaleRate);
if (idx < 0) {
return;
}
// if (idx < 0) {
// return;
// }
this.scaleIndex = idx;
this.scaleRate = payload.scaleRate;
}
@ -83,7 +82,6 @@ class Options {
if (payload.zoomOnMouseWheel === true || payload.zoomOnMouseWheel === false) {
this.zoomOnMouseWheel = payload.zoomOnMouseWheel;
}
if (this.trigger instanceof Function) { this.trigger(this); }
}

View File

@ -84,7 +84,7 @@ export default class key extends Group {
x: model.width / 2,
y: model.width / 361 * 336 + 12,
fontWeight: 600,
fontSize: 10,
fontSize: model.textFontSize || 10,
fontFamily: model.fontFamily,
text: model.bottomText,
textStrokeWidth: 0,
@ -102,7 +102,7 @@ export default class key extends Group {
x: model.width + 14,
y: model.width / 361 * 336 / 2 - 4,
fontWeight: 600,
fontSize: 10,
fontSize: model.textFontSize || 10,
fontFamily: model.fontFamily,
text: model.topText,
textStrokeWidth: 0,

View File

@ -9,7 +9,7 @@ class TransformHandle {
this.rect = { x: 0, y: 0, width: 0, height: 0 };
this.transform = createTransform({ scaleRate: 1, offsetX: 0, offsetY: 0 });
this.transform = createTransform({ scaleRate: painter.$ibp.$options.scaleRate, offsetX: 0, offsetY: 0 });
}
checkVisible(view) {
@ -58,13 +58,12 @@ class TransformHandle {
if (canvasSize.y - opts.offsetY > 0) {
opts.offsetY = -elRect.y;
}
if (elRect.x + canvasSize.width < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width);
if (elRect.x + canvasSize.width * this.$painter.$ibp.$options.scaleRate < zrRect.width) {
opts.offsetX -= zrRect.width - (elRect.x + canvasSize.width * this.$painter.$ibp.$options.scaleRate);
}
if (elRect.y + canvasSize.height < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height);
if (elRect.y + canvasSize.height * this.$painter.$ibp.$options.scaleRate < zrRect.height) {
opts.offsetY -= zrRect.height - (elRect.y + canvasSize.height * this.$painter.$ibp.$options.scaleRate);
}
}
this.transform = createTransform(opts);

View File

@ -11,6 +11,7 @@ import Link_Jyd from '@/assets/icon/link_jyd.png';
import FaviconTky from '@/assets/icon/favicon_tky.png';
import FaviconBxkc from '@/assets/icon/favicon_bxkc.png';
import FaviconCrsc from '@/assets/icon/favicon_crsc.png';
import FaviconNty from '@/assets/icon/favicon_nty.png';
import Link_Bxkc from '@/assets/icon/link_bxkc.png';
import Link_Crsc from '@/assets/icon/link_crsc.png';
import Link_Hls from '@/assets/icon/link_hls.png';
@ -28,6 +29,15 @@ export const loginInfo = {
navigationMarginLeft: '60px',
systemType: '013'
},
nty: {
title: '南京铁道职业技术学院城市轨道交通实训平台',
loginPath:'/login?project=nty',
loginParam: 'NTY',
titleDistance: '-150px',
navigationLogoWidth: '40px',
navigationMarginLeft: '60px',
systemType: '011'
},
login: {
title: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台',
loginPath: '/login',
@ -71,6 +81,15 @@ export const loginInfo = {
navigationMarginLeft: '60px',
systemType: '013'
},
designnty: {
title: '南京铁道职业技术学院城市轨道交通设计平台',
loginPath:'/design/login?project=nty',
loginParam: 'NTY',
titleDistance: '-150px',
navigationLogoWidth: '40px',
navigationMarginLeft: '60px',
systemType: '011'
},
gzb: {
title: '贵州装备制造职业学院城市轨道交通实训平台',
loginPath:'/login?project=gzb',
@ -331,7 +350,9 @@ export const ProjectIcon = {
hls: FaviconHls,
designhls: FaviconHls,
drts: Favicon,
designdrts: Favicon
designdrts: Favicon,
nty: FaviconNty,
designnty: FaviconNty
};
export const ProjectCode = {
@ -344,15 +365,17 @@ export const ProjectCode = {
xadt: 'XADT',
designxadt: 'XADT',
drts: 'DRTS',
designdrts: 'DRTS'
designdrts: 'DRTS',
nty: 'NTY',
designnty: 'NTY'
};
export const BottomColumnOnlyConInfo = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'hyd', 'designhyd']; // 底部栏仅展示公司信息不展示备案号
export const GetMapListByProjectList = ['xty', 'designxty', 'gzb', 'designgzb', 'xadt', 'designxadt', 'heb', 'designheb', 'designdrts', 'drts']; // 实训设计平台通过项目code获取地图列表的项目
export const GetMapListByProjectList = ['xty', 'designxty', 'gzb', 'designgzb', 'xadt', 'designxadt', 'heb', 'designheb', 'designdrts', 'drts', 'nty', 'designnty']; // 实训设计平台通过项目code获取地图列表的项目
export const CaseHideProjectList = ['heb', 'designheb']; // 案例展示隐藏的项目
export const VersionBaseNoShow = ['heb', 'designheb', 'hls', 'designhls', 'drts', 'hyd', 'designhyd']; // 登录页右下角版本开发基于不展示
export const MainBodyNoShow = ['heb', 'designheb', 'jyd', 'designjyd', 'tky', 'designtky', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'hyd', 'designhyd']; // 登录页右下角主体不展示
export const GenerateRouteProjectList = ['jsxt', 'refereeJsxt'];// 需要在公共路由中生成登录页面的项目
export const ProjectLoginStyleList = ['jsxt', 'refereeJsxt', 'gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'drts', 'hyd', 'designhyd']; // 登录页样式
export const ProjectLoginStyleList = ['jsxt', 'refereeJsxt', 'gzb', 'designgzb', 'xty', 'designxty', 'xadt', 'designxadt', 'tky', 'designtky', 'jyd', 'designjyd', 'bxkc', 'designbxkc', 'crsc', 'designcrsc', 'hls', 'designhls', 'drts', 'hyd', 'designhyd', 'nty', 'designnty']; // 登录页样式
export const NoQrcodeList = ['heb', 'designheb'];
export const goOtherPlatformMenu = { // 导航栏快速切换平台
login: '/design/login',
@ -376,12 +399,15 @@ export const goOtherPlatformMenu = { // 导航栏快速切换平台
hls: '/design/login?project=hls',
designhls: '/login?project=hls',
hyd: '/design/login?project=hyd',
designhyd: '/login?project=hyd'
designhyd: '/login?project=hyd',
nty: '/design/login?project=nty',
designnty: '/login?project=nty'
};
export const ProjectList = [
{value:'xty', label:'西铁院'},
{value: 'gzb', label: '贵州装备'},
{value: 'xadt', label: '西安地铁'},
{value: 'heb', label: '哈尔滨'},
{value: 'drts', label: '调度大赛'}
{value: 'drts', label: '调度大赛'},
{value: 'nty', label: '南铁院'}
];

153
src/views/ibp/copy.vue Normal file
View File

@ -0,0 +1,153 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getStationList } from '@/api/runplan';
import {getAllMapOnline} from '@/api/jmap/map';
import { getIbpList, copyIbpData } from '@/api/ibp';
export default {
name: 'Copy',
data() {
return {
dialogVisible: false,
stationList: [],
ibpId: '',
title: '',
formModel: {
dataMapId: '',
dataStationCode: '',
stationCode: ''
},
mapList: [],
dataStationList: [],
ibpStationMap: {},
ibpMap: {}
};
},
computed: {
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'dataMapId', label: '发布数据地图:', type: 'select', options: this.mapList, change: true, onChange: this.changeMapId},
{ prop: 'dataStationCode', label: '发布地图车站:', type: 'select', options: this.dataStationList },
{ prop: 'stationCode', label: '关联站台:', type: 'select', options: this.stationList }
]
};
return form;
},
rules() {
const crules = {
stationCode: [
{ required: true, message: '请选择', trigger: 'change' }
]
};
return crules;
}
},
async created () {
this.getIbpList();
this.getStationLIst();
},
methods: {
async getIbpList() {
try {
const res = await getIbpList({pageSize: 9999, pageIndex: 0});
const rest = await getAllMapOnline();
if (rest.data && rest.data.length) {
rest.data.forEach(item => {
const param = {
label: item.name,
value: item.id
};
this.mapList.push(param);
});
}
if (res.data && res.data.list) {
res.data.list.forEach(item => {
if (this.ibpStationMap[item.mapId]) {
this.ibpStationMap[item.mapId].push(item.stationCode);
} else {
this.ibpStationMap[item.mapId] = [item.stationCode];
}
this.ibpMap[item.stationCode] = item.id;
});
}
} catch (e) {
console.log(e);
}
},
async getStationLIst() {
try {
const res = await getStationList(this.$route.params.mapId);
this.stationList = [];
if (res.code == 200) {
res.data.forEach(station => {
const param = {
label: station.name,
value: station.code
};
this.stationList.push(param);
});
}
} catch (error) {
console.log(error);
}
},
doShow() {
this.dialogVisible = true;
},
doCreate() {
this.$refs.dataform.validateForm(() => {
const param = {
mapId: this.$route.params.mapId,
ibpId: this.ibpMap[this.formModel.dataStationCode],
stationCode: this.formModel.stationCode
};
copyIbpData(param).then(resp => {
this.$message.success('创建成功');
this.$emit('reloadTable');
}).catch(error => {
this.$messageBox(`创建失败: ${error.message}`);
});
this.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
},
async changeMapId(val) {
try {
const res = await getStationList(val);
this.dataStationList = [];
this.formModel.dataStationCode = '';
if (res.code == 200 || this.ibpStationMap[val]) {
res.data.forEach(station => {
if (this.ibpStationMap[val].includes(station.code)) {
const param = {
label: station.name,
value: station.code
};
this.dataStationList.push(param);
}
});
}
} catch (error) {
console.log(error);
}
}
}
};
</script>
<style scoped>
</style>

View File

@ -2,11 +2,13 @@
<div class="joylink-card">
<div class="scriptHeader">
<div class="scriptList">IBP盘列表</div>
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
<el-button size="small" type="primary" class="createScript" style="margin-top: 5px" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
<el-button size="small" type="primary" class="createScript" @click="createByPublish">发布数据创建</el-button>
</div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
<create-ibp ref="createScript" :title="'创建数据'" @reloadTable="reloadTable" />
<create-ibp ref="modifyScript" :title="'修改数据'" @reloadTable="reloadTable" />
<copy-ibp ref="copyIbp" @reloadTable="reloadTable" />
</div>
</template>
@ -16,11 +18,13 @@ import { getStationList } from '@/api/runplan';
// import ConstConfig from '@/scripts/ConstConfig';
import { postIbpPublish, getIbpAllList, deleteIbpInfo } from '@/api/ibp';
import CreateIbp from './create';
import CopyIbp from './copy';
export default {
name: 'ScriptDraft',
components: {
CreateIbp
CreateIbp,
CopyIbp
},
data() {
return {
@ -170,6 +174,9 @@ export default {
this.$messageBox('删除失败');
});
}).catch(() => { });
},
createByPublish() {
this.$refs.copyIbp.doShow(null);
}
}
};

View File

@ -27,6 +27,9 @@
<el-form-item :label="this.$t('ibp.lowerText')" prop="bottomText">
<el-input v-model="form.bottomText" />
</el-form-item>
<el-form-item label="文字大小" prop="textFontSize">
<el-input-number v-model="form.textFontSize" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="操作">
<el-select v-model="form.mean" placeholder="请选择">
<el-option
@ -63,7 +66,8 @@ export default {
x: 10,
y: 10,
topText:'',
bottomText:''
bottomText:'',
textFontSize: 10
},
operateMeanList: [
{ label: '上行钥匙', value: 'SXYS' },
@ -106,6 +110,7 @@ export default {
this.form.topText = model.topText;
this.form.bottomText = model.bottomText;
this.form.mean = model.mean;
this.form.textFontSize = model.textFontSize;
}
}
},
@ -127,7 +132,8 @@ export default {
status:this.form.status,
topText:this.form.topText,
bottomText:this.form.bottomText,
mean:this.form.mean
mean:this.form.mean,
textFontSize: this.form.textFontSize
};
this.$emit('createData', keyModel);
this.initPage();
@ -150,7 +156,8 @@ export default {
status:this.form.status,
topText:this.form.topText,
bottomText:this.form.bottomText,
mean:this.form.mean
mean:this.form.mean,
textFontSize: this.form.textFontSize
};
this.$emit('deleteDataModel', keyModel);
this.initPage();
@ -167,7 +174,8 @@ export default {
y: 10,
topText:'',
bottomText:'',
mean:''
mean:'',
textFontSize: 10
};
},
generateCode() {

View File

@ -36,6 +36,7 @@ export default {
return {
width: this.$store.state.config.width,
height: this.$store.state.config.height,
offsetX: 0,
dataZoom: {
offsetX: '0',
offsetY: '0',
@ -74,6 +75,9 @@ export default {
'$store.state.config.canvasSizeCount': function (val) {
this.reSize();
},
'$store.state.app.windowSizeCount': function() {
this.setWindowSize();
},
'$store.state.socket.simulationIbpStatus': function (val) {
if (val && val[this.stationCode]) {
this.statusMessage(val[this.stationCode]);
@ -122,7 +126,7 @@ export default {
height: this.canvasHeight
},
options: {
scaleRate: 1,
scaleRate: this.$route.path.includes('design/ibp/edit') ? 1 : this.canvasWidth / 1920,
offsetX: offsetX,
offsetY: 0
},
@ -159,14 +163,14 @@ export default {
document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false;
};
let offsetX = 0;
this.offsetX = 0;
if (ibpPart === 'left') {
offsetX = 0;
this.offsetX = 0;
} else if (ibpPart === 'right') {
offsetX = 1920;
this.offsetX = 1920;
}
const data = parser(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp
this.initIbp(offsetX);
this.initIbp(this.offsetX);
this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas);
@ -241,6 +245,14 @@ export default {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height : this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
if (!this.size) {
const options = {
scaleRate: this.canvasWidth / 1920,
offsetX: this.offsetX,
offsetY: 0
};
this.$ibp && this.$ibp.setOptions(options);
}
},
back() {
this.group = this.$route.query.group;