运行图代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-09 15:41:05 +08:00
parent f89d557393
commit cb8e07863e
12 changed files with 8 additions and 615 deletions

View File

@ -53,8 +53,8 @@ import MenuBar from './menuBar';
import StatusBar from './statusBar';
import Schedule from './schedule';
import Parameter from './menus/parameter/index';
import OffLine from './menus/offLine';
import AddPlanningTrain from './menus/addPlanningTrain';
import OffLine from '../components/menus/offLine';
import AddPlanningTrain from '../components/menus/addPlanningTrain';
import EditPlanningTrain from './menus/editPlanningTrain';
import EditPlanName from './menus/editPlanName';
import DuplicateTrain from './menus/duplicateTrain';

View File

@ -23,14 +23,14 @@
</template>
<script>
import ModifyService from './menus/modifyService';
import ModifyService from '../components/menus/modifyService';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getStationList, queryRunPlan } from '@/api/runplan';
import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatform';
import { getPublishMapInfo } from '@/api/jmap/map';
import {getMapDetail} from '@/api/jmap/mapdraft';
import DataTable from './menus/components/dataTable';
import DataTable from '../components/menus/components/dataTable';
import echarts from 'echarts';
export default {

View File

@ -53,8 +53,8 @@ import MenuBar from './menuBar';
import StatusBar from './statusBar';
import Schedule from './schedule';
import Parameter from './menus/parameter/index';
import OffLine from './menus/offLine';
import AddPlanningTrain from './menus/addPlanningTrain';
import OffLine from '../components/menus/offLine';
import AddPlanningTrain from '../components/menus/addPlanningTrain';
import EditPlanningTrain from './menus/editPlanningTrain';
import EditPlanName from './menus/editPlanName';
import DuplicateTrain from './menus/duplicateTrain';

View File

@ -1,162 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool add-planning-train"
:title="title"
:visible.sync="dialogShow"
width="300px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
>
<el-form ref="form" :rules="rules" :model="formModel" label-width="100px" size="medium" @submit.native.prevent>
<el-form-item prop="serviceNumber" :label="$t('planMonitor.serviceNumber2')+$t('global.colon')" :required="true">
<el-input v-model="formModel.serviceNumber" type="text" size="mini" maxlength="3" minlength="2" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { checkServiceNumberExist } from '@/api/runplan';
export default {
name: 'AddPlanningTrain',
props: {
loadRunPlanId: {
type: String,
default() {
return '';
}
}
},
data() {
return {
dialogShow: false,
loading: false,
formModel:{
serviceNumber: ''
},
rules:{
serviceNumber:[
{required: true, validator: this.validateServiceNumber, trigger: 'blur'},
{required: true, validator: this.validateServiceNo, trigger: 'change'}
]
}
};
},
computed: {
title() {
return this.$t('planMonitor.addPlanTrain');
}
},
mounted() {
},
methods: {
doShow() {
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
validateServiceNo(rule, value, callback) {
if (typeof value == 'string' && value.trim().length == 0) {
return callback(new Error('请填写服务号'));
} else {
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
if (serviceNumberList.includes(value)) {
// new Error('')
return callback();
} else {
return callback();
}
}
},
validateServiceNumber(rule, value, callback) {
if (typeof value == 'string' && value.trim().length == 0) {
return callback(new Error('请填写服务号'));
} else {
let newValue = parseInt(value);
if (newValue) {
if (newValue > 0 & newValue < 9) {
newValue = '00' + newValue;
} else if (newValue > 10 & newValue < 99) {
newValue = '0' + newValue;
}
this.formModel.serviceNumber = newValue;
const serviceNumberList = Object.keys(this.$store.state.runPlan.editData);
if (serviceNumberList.includes(value)) {
// new Error('')
return callback();
} else {
return callback();
}
} else {
this.formModel.serviceNumber = '';
}
}
},
handleCommit() {
this.$refs.form.validate(() => {
if (this.$route.query.planId || this.loadRunPlanId) {
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.formModel.serviceNumber }).then(resp => {
if (resp.data) {
this.$emit('dispatchDialog', {
name: 'offLine',
params: {
type: 'warning',
operate: 'AddPlanningTrain',
width: 460,
message: this.$t('tip.serviceNumberExistHint')
}
});
this.doClose();
} else {
this.handleConfirm(true);
}
});
} else {
this.$messageBox(this.$t('tip.chooseToOpenTheRunGraph'));
}
});
// if (this.serviceNumber.length >= 2 && this.serviceNumber.length <= 3) {
// } else {
// this.$messageBox('');
// }
},
handleConfirm(isNew = false) {
this.doClose();
this.$store.dispatch('runPlan/addserviceNumber', this.formModel.serviceNumber);
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.formModel.serviceNumber, isNew:isNew } });
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-input {
width: 120px;
}
}
.add-planning-train{
/deep/ {
.el-dialog__body{
padding: 10px 20px;
}
.dialog-footer{
display: flex;
justify-content: center;
}
}
}
</style>

View File

@ -1,233 +0,0 @@
<template>
<div v-if="show">
<template v-if="maxmini">
<div class="nav">
<div class="title">{{ config.title }}</div>
<el-tooltip class="item" effect="dark" placement="bottom">
<div slot="content" v-html="config.handleTips" />
<div class="el-icon-info handleTips" />
</el-tooltip>
<!-- <div v-show="config.showClose" class="cls-status" @click="touch('Close')"><span /></div>
<div class="min-status" @click="touch('Minim')"><span /></div> -->
</div>
<el-table
ref="table"
:data="config.data"
:highlight-current-row="config.highlightCurrentRow"
class="table_box"
:show-header="config.showHeader"
border
@current-change="handleChange"
@cell-dblclick="handleModify"
>
<template v-for="(item,index) in config.columns">
<el-table-column :key="index" :prop="item.prop" :label="item.label" :width="item.width" />
</template>
</el-table>
</template>
<template v-else>
<div class="nav">
<!-- <div class="title">{{ config.title }}</div> -->
<!-- <div class="max-status" @click="touch('Maxim')"><span /></div> -->
</div>
</template>
</div>
</template>
<script>
export default {
name: 'DataTable',
props: {
config: {
type: Object,
required: true
}
},
data() {
return {
show: true,
maxmini: true,
touchStrategy: {
'Close': [false, true],
'Minim': [true, false],
'Maxim': [true, true]
}
};
},
methods: {
handleChange(row) {
if (this.config.handleChange) {
this.config.handleChange(row);
}
},
handleModify(row) {
if (this.config.handleModify) {
this.config.handleModify(row);
}
},
setCurrentRow(row) {
this.$refs.table.setCurrentRow(row);
},
touch(operate) {
this.$nextTick(() => {
[this.show, this.maxmini] = this.touchStrategy[operate];
this.$emit('touch', this.maxmini);
});
}
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">
@import "src/styles/mixin.scss";
$height: 20px;
$width: 20px;
.nav {
display: table;
float: right;
width: 100%;
color: #0000;
background: -webkit-linear-gradient(#FDFDFE, #B1CBF3);
background: -o-linear-gradient(#FDFDFE, #B1CBF3);
background: -moz-linear-gradient(#FDFDFE, #B1CBF3);
background: linear-gradient(#FDFDFE, #B1CBF3);
border: 1px solid #B6BCCC !important;
border-bottom: 2px solid #B6BCCC !important;
list-style: none;
height: 20px;
line-height: 20px;
.title{
float: left;
color: #000;
font-size: 13px;
line-height: 21px;
padding-left: 10px;
}
}
.table_box{
height: calc(100% - 20px);
overflow: auto;
}
.handleTips{
font-size: 16px;
color: #316AC5;
margin-left: 0px;
margin-top: 2px;
display: table;
cursor: pointer;
}
/deep/ {
.el-table--border th.gutter {
background: #EBEADB !important;
}
.el-table {
width: 100%;
th.is-leaf {
padding: 0px 0;
background: #EBEADB;
border-right: none !important;
border-left: 1px solid #D1CDBD !important;
border-top: 1px solid #D1CDBD !important;
border-bottom: 1px inset #D1CDBD !important;
color: #000;
.cell {
height: $height;
line-height: $height;
}
}
td {
padding: 0px 0;
.cell {
height: $height;
line-height: $height;
font-size: smaller !important;
}
}
.current-row>td {
background: #316AC5 !important;
color: #fff !important;
}
}
.cls-status {
float: right;
width: 12px;
height: 100%;
line-height: 100%;
margin-left: 5px;
cursor: pointer;
span {
display: inline-block;
content: '/';
background: black;
width: 2px;
height: 12px;
vertical-align: middle;
transform: rotate(45deg);
}
span::after {
display: block;
content: '/';
background: black;
width: 2px;
height: 12px;
transform: rotate(-90deg);
}
}
.min-status {
float: right;
width: 20px;
height: 100%;
line-height: 100%;
cursor: pointer;
span {
display: inline-block;
content: '-';
background: black;
width: 2px;
height: 12px;
vertical-align: middle;
transform: rotate(-90deg);
}
}
.max-status {
float: right;
width: 20px;
height: 100%;
line-height: 100%;
cursor: pointer;
span {
display: inline-block;
content: '';
background: black;
width: 2px;
height: 12px;
transform: rotate(0deg);
}
span::after {
display: block;
content: '';
background: black;
width: 2px;
height: 12px;
transform: rotate(90deg);
}
}
}
</style>

View File

@ -1,120 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool modify-service"
:title="title"
:visible.sync="dialogShow"
width="400px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<div v-if="isModifyServiceNumber">
<div class="ModifyServiceName">计划号:</div>
<div class="ModifyServiceInput">
<el-input v-model="serviceNumber" type="text" :style="{width: '80%'}" :minlength="2" :maxlength="3" />
</div>
</div>
<div v-else>
<div class="ModifyServiceName">车次号:</div>
<div class="ModifyServiceInput">
<el-input v-model="tripNumber" type="text" :style="{width: '80%'}" :maxlength="10" />
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { updateTripNumber, updateServiceNumber } from '@/api/runplan';
export default {
name:'ModifyService',
data() {
return {
dialogShow:false,
isModifyServiceNumber:false,
serviceNumber:'',
tripNumber:'',
title:'',
oldServiceNumber:'',
oldTripNumber:''
};
},
methods:{
doShow(data) {
if (data.tripNumber) {
this.oldServiceNumber = data.serviceNumber;
this.oldTripNumber = data.tripNumber;
this.isModifyServiceNumber = false;
this.title = '修改车次号';
// this.tripNumber = data.tripNumber;
} else {
this.oldServiceNumber = data.serviceNumber;
this.isModifyServiceNumber = true;
this.title = '修改计划号';
this.serviceNumber = data.serviceNumber;
}
this.dialogShow = true;
},
doClose() {
this.dialogShow = false;
},
handleCommit() {
if (this.isModifyServiceNumber) {
const result = /^\d{2,}$/.test(this.serviceNumber);
if (this.serviceNumber && result) {
updateServiceNumber(this.$route.query.planId, this.oldServiceNumber, this.serviceNumber).then(res=>{
this.$message.success('修改计划号成功');
// this.$emit('refresh');
this.dialogShow = false;
this.$store.dispatch('runPlan/refresh');
}).catch(()=>{
this.$message.error('修改计划号失败');
});
} else {
this.$message.error('请输入正确的计划号(两位以上数字)');
}
} else {
const result = /^\d{2,}$/.test(this.tripNumber);
if (this.tripNumber && result) {
const SDTNumber = this.oldServiceNumber + this.oldTripNumber;
updateTripNumber(this.$route.query.planId, SDTNumber, this.tripNumber).then(res=>{
this.$message.success('修改车次号成功');
// this.$emit('refresh');
this.dialogShow = false;
this.$store.dispatch('runPlan/refresh');
}).catch(()=>{
this.$message.error('修改车次号失败');
});
} else {
this.$message.error('请输入正确的车次号(两位以上数字)');
}
}
}
}
};
</script>
<style lang="scss" scoped>
.ModifyServiceName{
width: 100px;
display: inline-block;
float: left;
text-align: right;
padding-right: 15px;
vertical-align: top;
margin-top: 11px;
font-size: 15px;
margin-left: 20px;
}
.ModifyServiceInput{
width: 180px;
display: inline-block;
vertical-align: middle;
}
</style>

View File

@ -1,92 +0,0 @@
<template>
<el-dialog
v-dialogDrag
class="planEdit__tool add-planning-train"
:title="title"
:visible.sync="dialogShow"
:width="width + 'px'"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<el-row>
<el-col :span="24" :offset="1">
<i class="el-icon-warning" />
{{ params.message }}
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'OffLine',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
params: {},
title:this.$t('planMonitor.updateStation.deletePlanCar')
};
},
computed: {
width() {
if (this.params.width) {
return this.params.width;
} else {
return 400;
}
}
},
mounted() {
},
methods: {
doShow(params) {
if (params.operate == 'AddPlanningTrain') {
this.title = this.$t('planMonitor.addPlanTrain');
} else {
this.title = this.$t('planMonitor.updateStation.deletePlanCar');
}
this.params = params || {};
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleCommit() {
this.$emit('handleConfirm', this.params);
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
/deep/ {
.el-input {
width: 40px;
}
}
.add-planning-train{
/deep/ {
.el-dialog__body{
padding: 10px 20px;
}
.dialog-footer{
display: flex;
justify-content: center;
}
}
}
</style>

View File

@ -23,14 +23,14 @@
</template>
<script>
import ModifyService from './menus/modifyService';
import ModifyService from '../components/menus/modifyService';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { getStationList, queryRunPlan } from '@/api/runplan';
import {getRpDetailByUserMapId, getUserMapDetailByMapId} from '@/api/designPlatform';
import { getPublishMapInfo } from '@/api/jmap/map';
import {getMapDetail} from '@/api/jmap/mapdraft';
import DataTable from './menus/components/dataTable';
import DataTable from '../components/menus/components/dataTable';
import echarts from 'echarts';
export default {