This commit is contained in:
joylink_cuiweidong 2022-07-19 14:04:08 +08:00
commit 226f0fd71b
3 changed files with 329 additions and 337 deletions

View File

@ -35,85 +35,85 @@ export default class SignalButton extends Group {
return item.includes('ctc');
});
const ctcArcList = ['OCCLUSION', 'RECOVERY', 'CHANGE_DIRECTION', 'ACCIDENT', 'DEPART_ASSIST', 'PICK_ASSIST', 'ASSIST'];
const typeList = []
if (queryCtc && ctcArcList.includes(model.type)){
this.arcShape = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 7,
r: 7
},
style: {
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
}
});
this.add(this.arcShape);
} else if (this.style.SignalButton
&& this.style.SignalButton.shape === 'roundWithDock'
&& typeList.includes(model.type)) {
const typeList = [];
if (queryCtc && ctcArcList.includes(model.type)) {
this.arcShape = new Arc({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 7,
r: 7
},
style: {
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
}
});
this.add(this.arcShape);
} else if (this.style.SignalButton &&
this.style.SignalButton.shape === 'roundWithDock' &&
typeList.includes(model.type)) {
const circle1 = new Circle({
zlevel: this.zlevel,
z: this.z + 2,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 7,
r: 7
cx: computedPosition.x + 7,
cy: computedPosition.y + 7,
r: 7
},
style: {
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
stroke: '#69666E',
lineWidth: 1,
fill: fillColor
}
})
});
const circle2 = new Circle({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 9,
r: 8
cx: computedPosition.x + 7,
cy: computedPosition.y + 9,
r: 8
},
style: {
fill: '#000'
fill: '#000'
}
})
});
const circle3 = new Circle({
zlevel: this.zlevel,
z: this.z,
shape: {
cx: computedPosition.x + 7,
cy: computedPosition.y + 9,
r: 9
cx: computedPosition.x + 7,
cy: computedPosition.y + 9,
r: 9
},
style: {
fill: '#eee'
fill: '#eee'
}
})
this.arcShape = circle1
this.add(circle1).add(circle2).add(circle3)
});
this.arcShape = circle1;
this.add(circle1).add(circle2).add(circle3);
} else {
this.rectButton = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: model.position.x,
y: model.position.y,
width: 14,
height: 14
},
style: {
lineDash: null,
stroke: '#69666E',
lineWidth:1,
fill: fillColor
}
});
this.add(this.rectButton);
}
this.rectButton = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: computedPosition.x,
y: computedPosition.y,
width: 14,
height: 14
},
style: {
lineDash: null,
stroke: '#69666E',
lineWidth:1,
fill: fillColor
}
});
this.add(this.rectButton);
}
this.leftLine = new Line({
zlevel: this.zlevel,
z: this.z + 1,

View File

@ -42,7 +42,6 @@ export default {
this.initStationListMode();
},
'$store.state.training.simulationUserList': function(val) {
console.log('----------11');
this.initData();
},
'$store.state.socket.simulationRoleList':function(list) {

View File

@ -1,285 +1,278 @@
<template>
<div class="BigRouteInfo">
<el-form ref="form" :model="addModel" :rules="rules" label-width="140px" size="mini" class="bigDefinition">
<el-form-item v-if="isModify" label="编号:" prop="code">
<el-input v-model="addModel.code" style="width: 220px;" disabled />
</el-form-item>
<el-form-item label="名称:" prop="name">
<el-input v-model="addModel.name" style="width: 220px;" />
</el-form-item>
<el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="addModel.stationCode" clearable filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'stationCode' ? 'danger' : 'primary'"
@click="hover('stationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="运行方向" prop="labelEnum">
<el-select v-model="addModel.labelEnum">
<el-option
v-for="item in directionLabelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="关联区段:" prop="sectionList">
<el-select v-model="addModel.sectionList" multiple :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'sectionList' ? 'danger' : 'primary'"
@click="hover('sectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="关联信号机:" prop="signalCode">
<el-select v-model="addModel.signalCode" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in signalList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button :type="field === 'signalCode'? 'danger':'primary'" @click="hover('signalCode')">{{$t('map.activate')}}</el-button>
</el-form-item>
<el-form-item label="闭塞类型:" prop="runModel">
<el-select v-model="addModel.runModel" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in runModelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="默认状态:" prop="runStatus">
<el-select v-model="addModel.runStatus" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in runStatusList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="相对运行车站:" prop="relativeStationCode">
<el-select v-model="addModel.relativeStationCode" clearable filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'relativeStationCode' ? 'danger' : 'primary'"
@click="hover('relativeStationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="相对运行方向:" prop="relativeLabelEnum">
<el-select v-model="addModel.relativeLabelEnum">
<el-option
v-for="item in directionLabelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div class="bigDraft">
<el-button-group class="bigDraftBtn">
<el-button v-if="isModify" type="warning" size="small" :loading="loading" @click="update ">更新</el-button>
<el-button v-else type="primary" size="small" :loading="loading" @click="save">保存</el-button>
</el-button-group>
</div>
</div>
<div class="BigRouteInfo">
<el-form ref="form" :model="addModel" :rules="rules" label-width="140px" size="mini" class="bigDefinition">
<el-form-item v-if="isModify" label="编号:" prop="code">
<el-input v-model="addModel.code" style="width: 220px;" disabled />
</el-form-item>
<el-form-item label="名称:" prop="name">
<el-input v-model="addModel.name" style="width: 220px;" />
</el-form-item>
<el-form-item label="关联车站:" prop="stationCode">
<el-select v-model="addModel.stationCode" clearable filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'stationCode' ? 'danger' : 'primary'"
@click="hover('stationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="运行方向" prop="labelEnum">
<el-select v-model="addModel.labelEnum">
<el-option
v-for="item in directionLabelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="关联区段:" prop="sectionList">
<el-select v-model="addModel.sectionList" multiple :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in sectionList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'sectionList' ? 'danger' : 'primary'"
@click="hover('sectionList')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="关联信号机:" prop="signalCode">
<el-select v-model="addModel.signalCode" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in signalList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button :type="field === 'signalCode'? 'danger':'primary'" @click="hover('signalCode')">{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="闭塞类型:" prop="runModel">
<el-select v-model="addModel.runModel" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in runModelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="默认状态:" prop="runStatus">
<el-select v-model="addModel.runStatus" :placeholder="$t('map.pleaseSelect')">
<el-option
v-for="item in runStatusList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="相对运行车站:" prop="relativeStationCode">
<el-select v-model="addModel.relativeStationCode" clearable filterable>
<el-option
v-for="item in stationList"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
:type=" field === 'relativeStationCode' ? 'danger' : 'primary'"
@click="hover('relativeStationCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="相对运行方向:" prop="relativeLabelEnum">
<el-select v-model="addModel.relativeLabelEnum">
<el-option
v-for="item in directionLabelList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div class="bigDraft">
<el-button-group class="bigDraftBtn">
<el-button v-if="isModify" type="warning" size="small" :loading="loading" @click="update ">更新</el-button>
<el-button v-else type="primary" size="small" :loading="loading" @click="save">保存</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { setUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
import { saveAssist } from '@/api/assist';
import { mapGetters } from 'vuex';
import ConstConfig from '@/scripts/ConstConfig';
import { queryAssistListPaged } from '@/api/assist';
export default {
name:'BigRouteInfo',
props: {
selected: {
type: Object,
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
var checkSectionList = (rule, value, callback) => {
if (!value || value.length === 0){
callback(new Error('请选择关联区段!'));
} else {
callback();
}
};
return {
field: '',
loading: false,
isModify:false,
mainDeviceList: [],
directionLabelList: ConstConfig.ConstSelect.directionLabelList,
addModel:{
id: '',
name:'',
stationCode: '',
labelEnum:'',
sectionList: [],
signalCode: '',
runModel: '',
runStatus: '',
relativeStationCode: '',
relativeLabelEnum: ''
},
rules: {
'name':[
{ required: true, message: '请输入名称', trigger: 'blur' },
],
'stationCode':[
{ required: true, message: '请选择关联车站', trigger: 'blur' },
{ required: true, message: '请选择关联车站', trigger: 'change' },
],
'labelEnum': [
{ required: true, message: '请选择运行方向', trigger: 'change' }
],
'signalCode': [
{ required: true, message: '请选择关联信号机', trigger: 'change' }
],
'sectionList': [
{ validator: checkSectionList, trigger: 'change' },
{ required: true, message: '请选择关联区段', trigger: 'blur' }
],
'runModel': [
{ required: true, message: '请选择闭塞类型', trigger: 'change' }
],
'runStatus': [
{ required: true, message: '请选择默认状态', trigger: 'change' }
],
'relativeStationCode': [
{ required: true, message: '请选择相对运行车站', trigger: 'blur' },
{ required: true, message: '请选择相对运行车站', trigger: 'change' }
],
'relativeLabelEnum': [
{ required: true, message: '请选择相对运行方向', trigger: 'change' }
]
},
runModelList: [
{ label: '自动闭塞', value: 'A' },
{ label: '半自动闭塞', value: 'S' }
],
runStatusList: [
{ label: '接车口', value: 'R' },
{ label: '发车口', value: 'D' },
{ label: '无状态', value: 'NO' }
],
relativeList: []
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalButtonList',
'signalList'
])
},
mounted() {
this.initPage();
},
methods:{
initPage() {
if (this.mapInfo) {
queryAssistListPaged({pageNum: 1, pageSize: 999},this.mapInfo.id).then(resp => {
this.relativeList = resp.data.list;
});
}
},
hover(field) {
this.field = field === this.field ? '' : field;
},
changeRadio() {
this.$refs.form.clearValidate();
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionList'.toUpperCase()) {
this.addModel.sectionList.push(selected.code);
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'stationCode'.toUpperCase()) {
this.addModel.stationCode = selected.code;
this.field = '';
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'signalCode'.toUpperCase()){
this.addModel.signalCode = selected.code;
this.field = '';
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'relativeStationCode'.toUpperCase()) {
this.addModel.relativeStationCode = selected.code;
this.field = '';
}
}
},
save() {
const that = this;
that.$refs.form.validate((valid) => {
if (valid) {
const newModel = deepAssign({}, that.addModel);
// newModel.code = setUID('Route');
that.loading = true;
saveAssist(newModel, that.mapInfo.id).then(res=>{
that.$message.success(that.$t('tip.creatingSuccessful'));
that.loading = false;
this.initPage();
that.clear();
}).catch(() => {
that.$messageBox(that.$t('tip.operationAbnormal'));
that.loading = false;
});
}
});
},
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
this.$refs.form.resetFields();
this.addModel = {
id: '',
name:'',
stationCode: '',
labelEnum:'',
sectionList: [],
signalCode: '',
runModel: '',
runStatus: '',
relativeCode: ''
};
}
}
}
};
// import { setUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index';
import { saveAssist } from '@/api/assist';
import { mapGetters } from 'vuex';
import ConstConfig from '@/scripts/ConstConfig';
import { queryAssistListPaged } from '@/api/assist';
export default {
name:'BigRouteInfo',
props: {
selected: {
type: Object,
default() {
return null;
}
},
mapInfo: {
type: Object,
default() {
return null;
}
}
},
data() {
var checkSectionList = (rule, value, callback) => {
if (!value || value.length === 0) {
callback(new Error('请选择关联区段!'));
} else {
callback();
}
};
return {
field: '',
loading: false,
isModify:false,
mainDeviceList: [],
directionLabelList: ConstConfig.ConstSelect.directionLabelList,
addModel:{
id: '',
name:'',
stationCode: '',
labelEnum:'',
sectionList: [],
signalCode: '',
runModel: '',
runStatus: '',
relativeStationCode: '',
relativeLabelEnum: ''
},
rules: {
'name':[
{ required: true, message: '请输入名称', trigger: 'blur' }
],
'stationCode':[
{ required: true, message: '请选择关联车站', trigger: 'blur' },
{ required: true, message: '请选择关联车站', trigger: 'change' }
],
'labelEnum': [
{ required: true, message: '请选择运行方向', trigger: 'change' }
],
'signalCode': [
{ required: true, message: '请选择关联信号机', trigger: 'change' }
],
'sectionList': [
{ validator: checkSectionList, trigger: 'change' },
{ required: true, message: '请选择关联区段', trigger: 'blur' }
],
'runModel': [
{ required: true, message: '请选择闭塞类型', trigger: 'change' }
],
'runStatus': [
{ required: true, message: '请选择默认状态', trigger: 'change' }
]
},
runModelList: [
{ label: '自动闭塞', value: 'A' },
{ label: '半自动闭塞', value: 'S' }
],
runStatusList: [
{ label: '接车口', value: 'R' },
{ label: '发车口', value: 'D' },
{ label: '无状态', value: 'NO' }
],
relativeList: []
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
'signalButtonList',
'signalList'
])
},
mounted() {
this.initPage();
},
methods:{
initPage() {
if (this.mapInfo) {
queryAssistListPaged({pageNum: 1, pageSize: 999}, this.mapInfo.id).then(resp => {
this.relativeList = resp.data.list;
});
}
},
hover(field) {
this.field = field === this.field ? '' : field;
},
changeRadio() {
this.$refs.form.clearValidate();
},
setSelected(selected) {
if (selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'sectionList'.toUpperCase()) {
this.addModel.sectionList.push(selected.code);
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'stationCode'.toUpperCase()) {
this.addModel.stationCode = selected.code;
this.field = '';
} else if (selected._type.toUpperCase() === 'Signal'.toUpperCase() && this.field.toUpperCase() === 'signalCode'.toUpperCase()) {
this.addModel.signalCode = selected.code;
this.field = '';
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'relativeStationCode'.toUpperCase()) {
this.addModel.relativeStationCode = selected.code;
this.field = '';
}
}
},
save() {
const that = this;
that.$refs.form.validate((valid) => {
if (valid) {
const newModel = deepAssign({}, that.addModel);
// newModel.code = setUID('Route');
that.loading = true;
saveAssist(newModel, that.mapInfo.id).then(res=>{
that.$message.success(that.$t('tip.creatingSuccessful'));
that.loading = false;
this.initPage();
that.clear();
}).catch(() => {
that.$messageBox(that.$t('tip.operationAbnormal'));
that.loading = false;
});
}
});
},
clear() {
if (this.$refs && this.$refs.form && this.mapInfo) {
this.$refs.form.resetFields();
this.addModel = {
id: '',
name:'',
stationCode: '',
labelEnum:'',
sectionList: [],
signalCode: '',
runModel: '',
runStatus: '',
relativeCode: ''
};
}
}
}
};
</script>
<style lang="scss" scoped>
.BigRouteInfo{