This commit is contained in:
zyy 2021-05-17 18:16:38 +08:00
commit 6ba7b730a5
17 changed files with 549 additions and 280 deletions

View File

@ -1,13 +1,22 @@
import request from '@/utils/request';
/** 创建分组 */
/** 创建 */
export function postUploadFile(data) {
return request({
url: `/api/file`,
url: `/api/file/basic`,
method: 'post',
data
});
}
// /** 复制一条文件基础信息 */
// export function copyUploadFile(id) {
// return request({
// url: `/api/file/basic/copy/${id}`,
// method: 'post'
// });
// }
// 查询
export function getUploadFile(params) {
return request({
@ -19,15 +28,27 @@ export function getUploadFile(params) {
// 修改
export function putUploadFile(data) {
return request({
url: `/api/file`,
url: `/api/file/basic`,
method: 'put',
data
});
}
// 删除
export function deleteUploadFile(data) {
export function deleteUploadFile(id) {
return request({
url: `/api/file`,
url: `/api/file/${id}`,
method: 'delete'
});
}
// 查询文件绑定信息
export function getFileBindInfo(fileId, mapId) {
return request({
url: `/api/file/binding/${fileId}/${mapId}`,
method: 'get'
});
}
/** */
// @GetMapping("")

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,148 @@
<template>
<el-dialog
v-dialogDrag
class="chengdou-03__systerm stand-stop-time"
:title="title"
:visible.sync="show"
width="600px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<div>
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item label="设备类型:">
<el-select v-model="form.deviceType" :disabled="true" style="width: 150px;">
<el-option
v-for="item in deviceTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备名称:">
<el-input v-model="form.deviceName" :disabled="true" style="width: 150px;" />
</el-form-item>
</el-form>
<el-card>
<el-table
v-loading="loading"
:data="tableData"
style="width: 100%"
>
<el-table-column
prop="fileName"
label="文件"
width="400"
/>
<el-table-column
prop="name"
label="操作"
>
<template slot-scope="scope">
<div class="text-button" @click="openPdf(scope.row)">打开</div>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import CancelMouseState from '@/mixin/CancelMouseState';
import { getUploadFile } from '@/api/pdf';
export default {
name: 'TrainMove',
mixins: [
CancelMouseState
],
data() {
return {
selected: null,
dialogShow: false,
loading: false,
tableData: [],
deviceTypeList: [
{ label: '区段', value: 'Section' },
{ label: '信号机', value: 'Signal' },
{ label: '道岔', value: 'Switch' },
{ label: '车站', value: 'Station' }
],
deviceIdList: [],
form: {
mapId: '',
deviceId: '',
deviceCode: '',
deviceName: ''
}
};
},
computed: {
...mapGetters('map', [
'stationStandList'
]),
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
return '图纸检索';
}
},
methods: {
doShow(selected) {
this.selected = selected;
this.form.deviceName = selected.name;
this.form.deviceType = selected._type;
const params = { mapId: this.$route.query.mapId, deviceType: selected._type.toUpperCase(), deviceId: selected.code };
this.loading = true;
getUploadFile(params).then(resp => {
this.tableData = resp.data;
this.loading = false;
}).catch(error => {
this.loading = false;
this.$message.error('图纸检索失败!');
});
this.dialogShow = true;
this.$nextTick(function () {
this.$store.dispatch('training/emitTipFresh');
});
},
openPdf(row) {
const url = `https://joylink.club/oss/joylink/${row.filePath}`;
window.open(url, '_blank');
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.$store.dispatch('training/emitTipFresh');
}
}
};
</script>
<style scoped>
.chengdou-03__systerm .el-dialog .base-label {
background: rgba(0, 0, 0, x);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
}
.text-button{
color: #148ad0;
cursor:pointer;
}
.text-button:active{
color: #b938e1;
text-decoration: underline;
}
.text-button:hover{
color: #b938e1;
text-decoration: underline;
}
</style>

View File

@ -7,6 +7,7 @@
<train-add-plan ref="trainAddPlan" pop-class="chengdou-03__systerm" />
<set-fault ref="setFault" pop-class="chengdou-03__systerm" />
<load-spare-train ref="loadSpareTrain" pop-class="chengdou-03__systerm" />
<draw-select ref="drawSelect" />
</div>
</template>
@ -21,9 +22,9 @@ import { mapGetters } from 'vuex';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import { menuOperate, commitOperate } from '@/jmapNew/theme/components/utils/menuOperate';
import LoadSpareTrain from '@/jmapNew/theme/components/menus/dialog/loadSpareTrain';
import DrawSelect from './dialog/drawSelect';
export default {
name: 'SectionMenu',
@ -34,7 +35,8 @@ export default {
NoticeInfo,
TrainAddPlan,
SetFault,
LoadSpareTrain
LoadSpareTrain,
DrawSelect
},
props: {
selected: {
@ -49,6 +51,10 @@ export default {
menu: [],
menuNormal: {
Local: [
{
label: '图纸调用',
handler: this.drawingCall
}
],
Center: [
// {
@ -119,7 +125,8 @@ export default {
initMenu() {
//
if (this.selected.type != '04') {
this.menu = MenuContextHandler.covert(this.menuNormal);
// this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = this.menuNormal.Local;
} else {
this.menu = [];
}
@ -128,6 +135,9 @@ export default {
this.menu = this.menuForce;
}
},
drawingCall() {
this.$refs.drawSelect.doShow(this.selected);
},
doShow(point) {
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {

View File

@ -8,6 +8,7 @@
<route-hand-control ref="routeHandControl" />
<notice-info ref="noticeInfo" pop-class="chengdou-03__systerm" />
<password-box ref="passwordBox" pop-class="chengdou-03__systerm" @checkOver="passWordCommit" />
<draw-select ref="drawSelect" />
<set-fault ref="setFault" pop-class="chengdou-03__systerm" />
</div>
</template>
@ -28,6 +29,7 @@ import CMD from '@/scripts/cmdPlugin/CommandEnum';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import PasswordBox from '@/jmapNew/theme/components/menus/childDialog/passwordInputBox';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import DrawSelect from './dialog/drawSelect';
export default {
name: 'SignalMenu',
@ -40,7 +42,8 @@ export default {
RouteGuide,
NoticeInfo,
PasswordBox,
SetFault
SetFault,
DrawSelect
},
props: {
selected: {
@ -55,6 +58,10 @@ export default {
menu: [],
menuNormal: {
Local: [
{
label: '图纸调用',
handler: this.drawingCall
}
// {
// label: '',
// handler: this.arrangementRoute,
@ -190,13 +197,16 @@ export default {
methods: {
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
// this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = this.menuNormal.Local;
//
if (this.operatemode === OperateMode.FAULT) {
this.menu = this.menuForce;
}
},
drawingCall() {
this.$refs.drawSelect.doShow(this.selected);
},
doShow(point) {
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {

View File

@ -1,6 +1,7 @@
<template>
<div>
<pop-menu ref="popMenu" :menu="menu" />
<draw-select ref="drawSelect" />
<set-fault ref="setFault" pop-class="chengdou-03__systerm" />
<notice-info ref="noticeInfo" pop-class="chengdou-03__systerm" />
</div>
@ -8,7 +9,7 @@
<script>
import PopMenu from '@/components/PopMenu';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import DrawSelect from './dialog/drawSelect';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import CancelMouseState from '@/mixin/CancelMouseState';
import { mapGetters } from 'vuex';
@ -22,7 +23,8 @@ export default {
components: {
PopMenu,
SetFault,
NoticeInfo
NoticeInfo,
DrawSelect
},
mixins: [
CancelMouseState
@ -41,24 +43,8 @@ export default {
menuNormal: {
Local: [
{
label: '系统结构图一前置图',
file: '01-系统结构图一前视图.pdf',
handler: this.handlerOpenPdf
},
{
label: '系统结构图二后视图',
file: '02-系统结构图二后视图.pdf',
handler: this.handlerOpenPdf
},
{
label: '系统供电示意图',
file: '03-系统供电示意图.pdf',
handler: this.handlerOpenPdf
},
{
label: '车站布线图',
file: '04-车站布线图.pdf',
handler: this.handlerOpenPdf
label: '图纸调用',
handler: this.drawingCall
}
],
Center: [
@ -114,6 +100,9 @@ export default {
this.menu = this.menuForce;
}
},
drawingCall() {
this.$refs.drawSelect.doShow(this.selected);
},
doShow(point) {
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {

View File

@ -6,11 +6,13 @@
<notice-info ref="noticeInfo" pop-class="chengdou-03__systerm" />
<switch-hook-lock ref="switchHookLock" pop-class="chengdou-03__systerm" />
<set-fault ref="setFault" pop-class="chengdou-03__systerm" />
<draw-select ref="drawSelect" />
</div>
</template>
<script>
import PopMenu from '@/components/PopMenu';
import DrawSelect from './dialog/drawSelect';
import SectionControl from '@/jmapNew/theme/components/menus/dialog/sectionControl';
import SwitchControl from '@/jmapNew/theme/components/menus/dialog/switchControl';
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFaultNew';
@ -31,7 +33,8 @@ export default {
SwitchControl,
NoticeInfo,
SetFault,
SwitchHookLock
SwitchHookLock,
DrawSelect
},
mixins: [
CancelMouseState
@ -48,7 +51,12 @@ export default {
return {
menu: [],
menuNormal: {
Local: [],
Local: [
{
label: '图纸调用',
handler: this.drawingCall
}
],
Center: [
// {
// label: '',
@ -131,8 +139,8 @@ export default {
methods: {
initMenu() {
//
this.menu = MenuContextHandler.covert(this.menuNormal);
// this.menu = MenuContextHandler.covert(this.menuNormal);
this.menu = this.menuNormal.Local;
//
if (this.operatemode === OperateMode.FAULT) {
if (!this.$store.state.scriptRecord.bgSet) {
@ -147,6 +155,9 @@ export default {
}
},
drawingCall() {
this.$refs.drawSelect.doShow(this.selected);
},
doShow(point) {
this.initMenu();
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {

View File

@ -101,8 +101,8 @@
<el-row style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">车次号</el-col>
<el-col :span="17">
<el-input v-if="trainOperateType!=='create'" v-model="formModelTripNum" size="mini" style="height: 20px;" :disabled="true" />
<el-input v-if="trainOperateType==='create'" v-model="formModelNewTrip" size="mini" style="height: 20px;" />
<el-input v-if="trainOperateType!=='create'" v-model="formModelTripNum" :maxlength="7" size="mini" style="height: 20px;" :disabled="true" />
<el-input v-if="trainOperateType==='create'" v-model="formModelNewTrip" :maxlength="7" size="mini" style="height: 20px;" />
</el-col>
</el-row>
<el-row style="display: flex;align-items: center;">
@ -115,7 +115,7 @@
</el-row>
<el-row v-if="trainOperateType ==='create'" style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">新车组号</el-col>
<el-col :span="17"><el-input v-model="formModelNewGroup" size="mini" style="height: 20px;" /></el-col>
<el-col :span="17"><el-input v-model="formModelNewGroup" :maxlength="6" size="mini" style="height: 20px;" /></el-col>
</el-row>
<el-row v-if="trainOperateType === 'move'" style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">新轨道号</el-col>

View File

@ -30,9 +30,7 @@ export default {
mapDevice: {},
routeData: [],
mapData: null,
autoReentryData: [],
width: 1920,
height: 960
autoReentryData: []
};
},
computed: {
@ -41,7 +39,13 @@ export default {
},
...mapGetters('map', [
'bigScreenConfig'
])
]),
width() {
return this.$store.state.app.width - 40;
},
height() {
return this.$store.state.app.height - 60;
}
},
watch: {
'$store.state.config.canvasSizeCount': function (val) {

View File

@ -1,14 +1,14 @@
<template>
<el-dialog
v-dialogDrag
class="haerbin-01__systerm stand-stop-time"
class="haerbin-01__systerm"
:title="title"
:visible.sync="show"
:fullscreen="true"
:before-close="doClose"
:z-index="2000"
>
<map-visual ref="map" style="width: 100%;height: 100%;" />
<map-visual ref="map" />
</el-dialog>
</template>
@ -81,12 +81,12 @@ export default {
};
</script>
<style scoped>
.haerbin-01__systerm .el-dialog .base-label {
background: rgba(0, 0, 0, x);
/deep/ .el-dialog {
background: rgba(100, 100, 100, 1);
position: relative;
left: -5px;
top: -18px;
padding: 0 5px;
background-color: #F0F0F0;
border: 2px solid rgb(144, 144, 144, 0.8);
border-radius: 6px;
color: #000;
font-size: 14px;
}
</style>

View File

@ -84,8 +84,8 @@
<el-row style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">车次号</el-col>
<el-col :span="17">
<el-input v-if="trainOperateType!=='create'" v-model="formModelTripNum" size="mini" style="height: 20px;" :disabled="true" />
<el-input v-if="trainOperateType==='create'" v-model="formModelNewTrip" size="mini" style="height: 20px;" />
<el-input v-if="trainOperateType!=='create'" v-model="formModelTripNum" :maxlength="7" size="mini" style="height: 20px;" :disabled="true" />
<el-input v-if="trainOperateType==='create'" v-model="formModelNewTrip" :maxlength="7" size="mini" style="height: 20px;" />
</el-col>
</el-row>
<el-row style="display: flex;align-items: center;">
@ -98,7 +98,7 @@
</el-row>
<el-row v-if="trainOperateType ==='create'" style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">新车组号</el-col>
<el-col :span="17"><el-input v-model="formModelNewGroup" size="mini" style="height: 20px;" /></el-col>
<el-col :span="17"><el-input v-model="formModelNewGroup" :maxlength="6" size="mini" style="height: 20px;" /></el-col>
</el-row>
<el-row v-if="trainOperateType === 'move'" style="display: flex;align-items: center;">
<el-col :span="7" style="height: 25px;line-height: 25px;">新轨道号</el-col>

View File

@ -15,6 +15,7 @@ import FaviconNty from '@/assets/icon/favicon_nty.png';
import FaviconBjd from '@/assets/icon/favicon_bjd.png';
import FaviconSdy from '@/assets/icon/favicon_jdy.png';
import FaviconCgy from '@/assets/icon/favicon_cgy.png';
import FaviconZzww from '@/assets/icon/favicon_zzww.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';
@ -37,9 +38,10 @@ export const loginInfo = {
title: '共赢列车仿真驾驶系统',
loginPath: '/login?project=zzww',
loginParam: 'ZZWW',
titleDistance: '-150px',
navigationLogoWidth: '40px',
navigationMarginLeft: '60px',
loginTitle: '空串',
logoWidth: '140px',
navigationLogoWidth: '120px',
navigationMarginLeft: '140px',
systemType: '011'
},
bjd: {
@ -428,7 +430,7 @@ export const loginInfo = {
export const ProjectIcon = {
xty: FaviconXty,
zzww: FaviconXty,
zzww: FaviconZzww,
login: Favicon,
design: Favicon,
designxty: FaviconXty,

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -210,7 +210,7 @@ export default {
});
this.$jlmap.updateShowStation(list, deviceId);
}
// 'Station83189';
this.$jlmap.setCenter(deviceId);
if (this.try != '0') {
this.loadInitData();
}

View File

@ -0,0 +1,87 @@
<template>
<el-dialog v-dialogDrag title="绑定地图数据" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center class="uploadDialog">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPublishMapList } from '@/api/jmap/map';
import { getFileBindInfo } from '@/api/pdf';
export default {
name:'BindMap',
data() {
return {
mapList:[],
fileId:'',
dialogVisible: false,
formModel: {
mapId:''
}
};
},
computed:{
form() {
const form = {
labelWidth: '120px',
items: [
{ prop: 'mapId', label: '选择线路:', type:'select', options: this.mapList, optionValue:'id', optionLabel:'name' }
// change: true, onChange: this.handleMap
]
};
return form;
},
rules() {
const crules = {
mapId: [
{ required: true, message: ' 地图不能为空', trigger: 'blur'},
{ required: true, message: ' 地图不能为空', trigger: 'change'}
]
};
return crules;
}
},
created() {
const params = {
pageSize: 9999,
pageNum: 1
};
getPublishMapList(params).then(res => {
this.mapList = res.data.list || [];
});
},
methods:{
doShow(data) {
this.fileId = data.id;
this.dialogVisible = true;
},
handleClose() {
this.formModel = {
mapId: ''
};
this.$refs.dataform.resetForm();
this.dialogVisible = false;
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.fileId) {
getFileBindInfo(self.fileId, self.formModel.mapId).then((res) => {
let data = null;
if (res.data) {
data = res.data;
}
this.$refs.bindMapInfo.doShow(data);
}).catch(error => {
console.log(error);
// self.$message.error(`PDF:${error.message}`);
});
}
});
}
}
};
</script>

View File

@ -1,6 +1,7 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center class="uploadDialog">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<div class="fileError">{{ message }}</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
@ -10,8 +11,8 @@
<script>
import { postUploadFile, putUploadFile } from '@/api/pdf';
import { getPublishMapDetailById, getPublishMapVersionById } from '@/api/jmap/map';
import { dbReadData, dbAddData, dbUpdateData } from '@/utils/indexedDb';
// import { getPublishMapDetailById, getPublishMapVersionById } from '@/api/jmap/map';
// import { dbReadData, dbAddData, dbUpdateData } from '@/utils/indexedDb';
// uploadFile
import { meansUrl } from '@/api/upload';
@ -21,39 +22,30 @@ export default {
type: {
type: String,
required: true
},
mapList:{
type: Array,
required: true
}
},
data() {
return {
dialogVisible: false,
formModel: {
// cityCode: '',
mapId: '',
deviceTypes: '',
deviceIds: [],
upload: '',
filePath: '',
fileType: 'DRAWING'
fileType: 'DRAWING',
fileName:''
},
rowData: null,
graphDataNew: null,
fileList: [],
formData: '',
id: '',
deviceTypeList: [
{ label: '区段', value: 'sectionList', code: 'SECTION' },
{ label: '道岔', value: 'switchList', code: 'SWITCH' },
{ label: '信号机', value: 'signalList', code: 'SIGNAL' },
{ label: '车站', value: 'stationList', code: 'STATION' },
{ label: '站台', value: 'stationStandList', code: 'STAND' },
{ label: '屏蔽门', value: 'psdList', code: 'PSD' },
{ label: '列车', value: 'trainList', code: 'TRAIN' }
],
deviceCodesList: []
message:''
// deviceTypeList: [
// { label: '', value: 'sectionList', code: 'SECTION' },
// { label: '', value: 'switchList', code: 'SWITCH' },
// { label: '', value: 'signalList', code: 'SIGNAL' },
// { label: '', value: 'stationList', code: 'STATION' },
// { label: '', value: 'stationStandList', code: 'STAND' },
// { label: '', value: 'psdList', code: 'PSD' },
// { label: '', value: 'trainList', code: 'TRAIN' }
// ],
};
},
computed: {
@ -64,25 +56,23 @@ export default {
const form = {
labelWidth: '120px',
items: [
{ prop: 'mapId', label: '选择线路:', type:'select', options: this.mapList, optionValue:'id', optionLabel:'name', change: true, onChange: this.handleMap },
{ prop: 'deviceTypes', label: '选择设备类型:', type:'select', options: this.deviceTypeList, optionValue:'value', optionLabel:'label', change: true, onChange: this.handleDevice },
{ prop: 'deviceIds', label: '选择设备:', type:'select', multiple: true, options: this.deviceCodesList, optionValue:'code', optionLabel:'name' },
{ prop: 'upload', label: '上传:', type:'uploadPicture', show: this.type == 'ADD', action: this.action, fileList: this.fileList, onChange: this.onChange, onSuccess: this.onSuccess }
// { prop: 'mapId', label: '线:', type:'select', options: this.mapList, optionValue:'id', optionLabel:'name', change: true, onChange: this.handleMap },
// { prop: 'deviceTypes', label: ':', type:'select', options: this.deviceTypeList, optionValue:'value', optionLabel:'label', change: true, onChange: this.handleDevice },
// { prop: 'deviceIds', label: ':', type:'select', multiple: true, options: this.deviceCodesList, optionValue:'code', optionLabel:'name' },
{ prop: 'fileName', label: '文件名:', type:'text', show:true, rightWidth:true, required:true },
{ prop: 'upload', label: '上传:', type:'uploadPicture', fileList: this.fileList, show: this.type == 'ADD', action: this.action, onChange: this.onChange, onSuccess: this.onSuccess }
]
};
return form;
},
rules() {
const crules = {
mapId: [
{ required: true, message: '请选择线路', trigger: 'change' }
],
deviceTypes: [
{ required: true, message: '请选择设备类型', trigger: 'change' }
],
deviceIds: [
{ required: true, message: '请选择设备', trigger: 'change' }
fileName: [
{ required: true, message: '文件名不能为空', trigger: 'blur'}
]
// upload: [
// { required: true, message: '', trigger: 'onChange' }
// ]
};
return crules;
},
@ -90,7 +80,7 @@ export default {
if (this.type === 'ADD') {
return '上传PDF';
} else {
return '更新文章';
return '更新PDF';
}
}
},
@ -98,88 +88,84 @@ export default {
async show(data) {
this.dialogVisible = true;
if (this.type != 'ADD') {
const obj = this.deviceTypeList.find(el => el.code == data.deviceTypes[0]);
this.id = data.id;
this.rowData = data;
this.rowData.deviceTypes = obj ? obj.value : '';
this.formModel = {
mapId: data.mapId,
deviceTypes: obj ? obj.value : '',
deviceIds: data.deviceIds,
upload: '',
fileName:data.fileName,
filePath: data.filePath
};
await this.handleMap(data.mapId);
obj && await this.handleDevice(obj.value);
} else {
this.rowData = {};
this.formModel = {
mapId: '',
deviceTypes: '',
deviceIds: [],
upload: '',
filePath: ''
filePath: '',
fileName:''
};
}
},
async handleMap(mapId) {
if (mapId) {
if (mapId != this.rowData.mapId) {
this.formModel.deviceIds = [];
this.formModel.deviceTypes = '';
}
return new Promise(async (resolve, reject) => {
const resp = await getPublishMapVersionById(mapId);
const version = resp.data;
dbReadData('mapData', mapId, version, async (mapData, version) =>{
if (mapData && mapData.version == version) {
this.graphDataNew = mapData.graphDataNew;
resolve();
} else if (mapData) {
const res = await getPublishMapDetailById(mapId);
this.graphDataNew = res.data.graphDataNew;
dbUpdateData('mapData', res.data);
resolve();
} else {
const res = await getPublishMapDetailById(mapId);
this.graphDataNew = res.data.graphDataNew;
dbAddData('mapData', res.data);
resolve();
}
});
});
} else {
this.formModel.deviceIds = [];
this.formModel.mapId = '';
this.formModel.deviceTypes = '';
}
},
handleDevice(type) {
if (type) {
if (type != this.rowData.deviceTypes) {
this.formModel.deviceIds = [];
}
this.deviceCodesList = this.graphDataNew[type].map(el => {
return {
code: el.code,
name: `${el.name}(${el.code})`
};
});
} else {
this.formModel.deviceIds = [];
}
},
// async handleMap(mapId) {
// if (mapId) {
// if (mapId != this.rowData.mapId) {
// this.formModel.deviceIds = [];
// this.formModel.deviceTypes = '';
// }
// return new Promise(async (resolve, reject) => {
// const resp = await getPublishMapVersionById(mapId);
// const version = resp.data;
// dbReadData('mapData', mapId, version, async (mapData, version) =>{
// if (mapData && mapData.version == version) {
// this.graphDataNew = mapData.graphDataNew;
// resolve();
// } else if (mapData) {
// const res = await getPublishMapDetailById(mapId);
// this.graphDataNew = res.data.graphDataNew;
// dbUpdateData('mapData', res.data);
// resolve();
// } else {
// const res = await getPublishMapDetailById(mapId);
// this.graphDataNew = res.data.graphDataNew;
// dbAddData('mapData', res.data);
// resolve();
// }
// });
// });
// } else {
// this.formModel.deviceIds = [];
// this.formModel.mapId = '';
// this.formModel.deviceTypes = '';
// }
// },
// handleDevice(type) {
// if (type) {
// if (type != this.rowData.deviceTypes) {
// this.formModel.deviceIds = [];
// }
// this.deviceCodesList = this.graphDataNew[type].map(el => {
// return {
// code: el.code,
// name: `${el.name}(${el.code})`
// };
// });
// } else {
// this.formModel.deviceIds = [];
// }
// },
// uploadFile(file) {
// this.formData.append('file', file.file);
// },
onSuccess(res, file) {
this.formModel.filePath = res.data;
this.message = '';
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type == 'ADD') {
self.create();
if (this.formModel.filePath) {
self.create();
} else {
this.message = '请上传文件';
return false;
}
} else {
self.update();
}
@ -187,16 +173,10 @@ export default {
},
create() {
const self = this;
const obj = this.deviceTypeList.find(el => el.value == this.formModel.deviceTypes);
if (obj) {
this.formModel.deviceTypes = [obj.code];
}
const data = {
fileType: 'DRAWING',
mapId: this.formModel.mapId,
deviceTypes: this.formModel.deviceTypes,
deviceIds: this.formModel.deviceIds,
filePath: this.formModel.filePath
filePath: this.formModel.filePath,
fileName:this.formModel.fileName
};
postUploadFile(data).then((res) => {
self.$message.success('上传PDF成功!');
@ -204,34 +184,31 @@ export default {
self.$emit('reloadTable');
}).catch(error => {
console.log(error);
self.$message.error(`创建文章失败:${error.message}`);
self.$message.error(`上传PDF失败:${error.message}`);
});
},
update() {
const self = this;
const obj = this.deviceTypeList.find(el => el.value == this.formModel.deviceTypes);
if (obj) {
this.formModel.deviceTypes = [obj.code];
}
const data = {
id: this.id,
fileType: 'DRAWING',
mapId: this.formModel.mapId,
deviceTypes: this.formModel.deviceTypes,
deviceIds: this.formModel.deviceIds,
fileName:this.formModel.fileName,
filePath: this.formModel.filePath
};
putUploadFile(data).then(() => {
self.$message.success('更新文章成功!');
self.$message.success('更新PDF成功!');
self.handleClose();
self.$emit('reloadTable');
}).catch(error => {
self.$message.error(`更新文章失败:${error.message}`);
self.$message.error(`更新PDF失败:${error.message}`);
});
},
handleClose() {
this.message = '';
this.formModel = {
title: ''
upload: '',
filePath: '',
fileName:''
};
this.$refs.dataform.resetForm();
this.dialogVisible = false;
@ -248,4 +225,12 @@ export default {
}
}
}
.fileError{
color: red;
font-size: 13px;
margin-left: 122px;
vertical-align: top;
display: inline-block;
margin-top: -10px;
}
</style>

View File

@ -4,12 +4,11 @@
<el-card>
<el-form
ref="queryForm"
:model="formModel"
size="small"
style="padding: 6px 20px 6px 20px;overflow: hidden;"
>
<el-form-item label="地图" style="margin-bottom: 0;float: left; width: 300px;">
<el-select v-model="formModel.mapId" placeholder="请选择" filterable style="width: 240px;" @change="handleMap">
<!-- <el-form-item label="地图" style="margin-bottom: 0;float: left; width: 300px;">
<el-select v-model="formModel.mapId" placeholder="请选择" clearable filterable style="width: 240px;" @change="handleMap">
<el-option
v-for="item in mapList"
:key="item.id"
@ -17,8 +16,8 @@
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="设备类型" style="margin-bottom: 0;float: left; width:350px;">
</el-form-item> -->
<!-- <el-form-item label="设备类型" style="margin-bottom: 0;float: left; width:350px;">
<el-select v-model="formModel.deviceType" placeholder="请选择" filterable clearable style="width: 240px;" @change="handleDevice">
<el-option
v-for="item in deviceTypeList"
@ -27,8 +26,8 @@
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备id" style="margin-bottom: 0;float: left; width: 300px;">
</el-form-item> -->
<!-- <el-form-item label="设备id" style="margin-bottom: 0;float: left; width: 300px;">
<el-select v-model="formModel.deviceId" placeholder="请选择" filterable clearable style="width: 200px;">
<el-option
v-for="item in deviceIdList"
@ -37,18 +36,18 @@
:value="item.code"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-button style="margin-right: 10px; float: right;" type="primary" size="small" @click="createTitle">创建</el-button>
<el-button style="margin-right: 10px; float: right;" type="primary" size="small" @click="query">查询</el-button>
</el-form>
</el-card>
<el-table :data="tableData" border style="width: 100%">
<el-table-column label="线路">
<!-- <el-table-column label="线路">
<template slot-scope="scope">
<span>{{ getMapName(scope.row.mapId) }}</span>
</template>
</el-table-column>
<el-table-column label="类型">
</el-table-column> -->
<!-- <el-table-column label="类型">
<template slot-scope="scope">
<span>{{ scope.row.deviceTypes }}</span>
</template>
@ -57,80 +56,80 @@
<template slot-scope="scope">
<el-tag v-for="(item, index) in scope.row.deviceIds" :key="index" class="deviceIdTag">{{ item }}</el-tag>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="pdf名称" prop="fileName" />
<el-table-column label="路径" prop="filePath" />
<el-table-column label="时间" prop="createTime" />
<el-table-column label="操作" width="450">
<template slot-scope="scope">
<!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> -->
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">更新</el-button>
<el-button size="mini" type="primary" @click="handleBind(scope.$index, scope.row)">绑定</el-button>
<el-button size="mini" type="success" @click="handleUpdate(scope.$index, scope.row)">更新</el-button>
<!-- <el-button size="mini" @click="handlePublish(scope.$index, scope.row)">发布</el-button> -->
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Edit ref="edits" type="ADD" :map-list="mapList" @reloadTable="reloadTable" />
<Edit ref="edit" type="EDIT" :map-list="mapList" @reloadTable="reloadTable" />
<Edit ref="edits" type="ADD" @reloadTable="reloadTable" />
<Edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
<Bind-Map ref="bindMap" />
</div>
</template>
<script>
import { getPublishMapDetailById, getPublishMapVersionById } from '@/api/jmap/map';
// import { getPublishMapDetailById, getPublishMapVersionById } from '@/api/jmap/map';
import { getUploadFile, deleteUploadFile } from '@/api/pdf';
import { getPublishMapList } from '@/api/jmap/map';
import { dbReadData, dbAddData, dbUpdateData } from '@/utils/indexedDb';
// import { dbReadData, dbAddData, dbUpdateData } from '@/utils/indexedDb';
import Edit from './edit';
import BindMap from './bindMap';
export default {
name: 'CacheControl',
components: {
Edit
Edit,
BindMap
},
data() {
return {
tableData: [],
formModel: {
mapId: '',
deviceType:'',
deviceId:''
},
mapList: [],
graphDataNew:null,
deviceIdList:[],
deviceTypeList: [
{ label: '区段', value: 'sectionList', code: 'SECTION' },
{ label: '道岔', value: 'switchList', code: 'SWITCH' },
{ label: '信号机', value: 'signalList', code: 'SIGNAL' },
{ label: '车站', value: 'stationList', code: 'STATION' },
{ label: '站台', value: 'stationStandList', code: 'STAND' },
{ label: '屏蔽门', value: 'psdList', code: 'PSD' },
{ label: '列车', value: 'trainList', code: 'TRAIN' }
]
// formModel: {
// mapId: '',
// deviceType:'',
// deviceId:''
// },
// mapList: [],
// graphDataNew:null,
deviceIdList:[]
// deviceTypeList: [
// { label: '', value: 'sectionList', code: 'SECTION' },
// { label: '', value: 'switchList', code: 'SWITCH' },
// { label: '', value: 'signalList', code: 'SIGNAL' },
// { label: '', value: 'stationList', code: 'STATION' },
// { label: '', value: 'stationStandList', code: 'STAND' },
// { label: '', value: 'psdList', code: 'PSD' },
// { label: '', value: 'trainList', code: 'TRAIN' }
// ]
};
},
created() {
const params = {
pageSize: 9999,
pageNum: 1
};
getPublishMapList(params).then(res => {
// this.mapList = res.data.list.filter(el => !el.project );
this.mapList = res.data.list || [];
if (this.mapList.length > 0) { this.formModel.mapId = this.mapList[0].id; this.handleMap(this.formModel.mapId); }
this.query();
});
this.query();
// getPublishMapList(params).then(res => {
// // this.mapList = res.data.list.filter(el => !el.project );
// this.mapList = res.data.list || [];
// // if (this.mapList.length > 0) { this.formModel.mapId = this.mapList[0].id; this.handleMap(this.formModel.mapId); }
// });
},
methods: {
query() {
this.reloadTable();
},
getMapName(val) {
if (this && this.mapList.length) {
const data = this.mapList.find(el => el.id == val);
return data.name;
}
return val;
},
// getMapName(val) {
// if (this && this.mapList.length) {
// const data = this.mapList.find(el => el.id == val);
// return data.name;
// }
// return val;
// },
createTitle() {
this.$refs.edits.show();
},
@ -139,7 +138,7 @@ export default {
// this.$router.push({path : '/editor', query: {docId: data.id, draft: 1}});
// },
//
handleUpdate(row, data) {
handleUpdate(index, data) {
this.$refs.edit.show(data);
},
// // 稿
@ -152,14 +151,17 @@ export default {
// this.$message.error(`: ${error.data}`);
// });
// },
handleDelete(row, data) {
handleBind(index, data) {
this.$refs.bindMap.doShow(data);
},
handleDelete(index, data) {
this.$confirm('是否确认删除?', this.$t('tip.hint'), {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteUploadFile(data.id).then(res => {
this.$message.success('删除文章成功!');
this.$message.success('删除pdf成功!');
this.reloadTable();
}).catch(error => {
this.$message.error(`删除失败: ${error.data}`);
@ -168,59 +170,59 @@ export default {
},
reloadTable() {
this.tableData = [];
getUploadFile(this.formModel).then(res => {
getUploadFile({}).then(res => {
this.tableData = res.data;
this.tableData.forEach(each=>{
const deviceTypeName = this.deviceTypeList.find(type=>{ return type.code == each.deviceTypes[0]; }) || {label:''};
each.deviceTypes = deviceTypeName.label;
});
// this.tableData.forEach(each=>{
// const deviceTypeName = this.deviceTypeList.find(type=>{ return type.code == each.deviceTypes[0]; }) || {label:''};
// each.deviceTypes = deviceTypeName.label;
// });
}).catch(error => {
console.log(error);
});
},
handleMap(mapId) {
this.deviceIdList = [];
this.formModel.deviceId = '';
this.formModel.deviceType = '';
return new Promise(async (resolve, reject) => {
const resp = await getPublishMapVersionById(mapId);
const version = resp.data;
dbReadData('mapData', mapId, version, async (mapData, version) =>{
if (mapData && mapData.version == version) {
this.graphDataNew = mapData.graphDataNew;
resolve();
} else if (mapData) {
const res = await getPublishMapDetailById(mapId);
this.graphDataNew = res.data.graphDataNew;
dbUpdateData('mapData', res.data);
resolve();
} else {
const res = await getPublishMapDetailById(mapId);
this.graphDataNew = res.data.graphDataNew;
dbAddData('mapData', res.data);
resolve();
}
});
});
},
handleDevice(type) {
if (type) {
const data = this.graphDataNew[type];
if (data && data.length > 0) {
this.deviceIdList = this.graphDataNew[type].map(el => {
return {
code: el.code,
name: `${el.name}(${el.code})`
};
});
} else {
this.deviceIdList = [];
}
} else {
this.formModel.deviceId = '';
this.deviceIdList = [];
}
}
// handleMap(mapId) {
// this.deviceIdList = [];
// this.formModel.deviceId = '';
// this.formModel.deviceType = '';
// return new Promise(async (resolve, reject) => {
// const resp = await getPublishMapVersionById(mapId);
// const version = resp.data;
// dbReadData('mapData', mapId, version, async (mapData, version) =>{
// if (mapData && mapData.version == version) {
// this.graphDataNew = mapData.graphDataNew;
// resolve();
// } else if (mapData) {
// const res = await getPublishMapDetailById(mapId);
// this.graphDataNew = res.data.graphDataNew;
// dbUpdateData('mapData', res.data);
// resolve();
// } else {
// const res = await getPublishMapDetailById(mapId);
// this.graphDataNew = res.data.graphDataNew;
// dbAddData('mapData', res.data);
// resolve();
// }
// });
// });
// },
// handleDevice(type) {
// if (type) {
// const data = this.graphDataNew[type];
// if (data && data.length > 0) {
// this.deviceIdList = this.graphDataNew[type].map(el => {
// return {
// code: el.code,
// name: `${el.name}(${el.code})`
// };
// });
// } else {
// this.deviceIdList = [];
// }
// } else {
// this.formModel.deviceId = '';
// this.deviceIdList = [];
// }
// }
}
};
</script>