增加批量调整区段名称位置

This commit is contained in:
zyy 2020-03-12 13:13:00 +08:00
parent 6045f6dba6
commit b7ee3e5f6e
4 changed files with 94 additions and 7 deletions

View File

@ -251,7 +251,7 @@ export default class Section extends Group {
/** 区段名称 (逻辑区段名称 或 物理区段名称 是否显示)*/
let tempx = x;
let tempy = y;
if (model.type == '01') {
if (model.type == '01') { // 物理区段名称
if (style.Section.text.show) {
const opposite = style.Section.text.opposite ? -1 : 1;
tempx += traingle.getSin(style.Section.text.distance);
@ -274,7 +274,7 @@ export default class Section extends Group {
});
this.add(this.name);
}
} else if (model.type == '02') {
} else if (model.type == '02') { // 逻辑区段
if (style.Section.logicText.show) {
const opposite = style.Section.logicText.opposite ? -1 : 1;
tempx += traingle.getSin(style.Section.logicText.distance);
@ -297,7 +297,7 @@ export default class Section extends Group {
});
this.add(this.name);
}
} else if (model.type == '03') {
} else if (model.type == '03') { // 道岔区段
if (style.Section.switchText.show) {
this.name = new ETextName({
zlevel: this.zlevel,
@ -317,7 +317,7 @@ export default class Section extends Group {
});
this.add(this.name);
}
} else if (model.type == '04') {
} else if (model.type == '04') { // 道岔计轴区段名称
if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft')) {
this.name = new ETextName({
zlevel: this.zlevel,

View File

@ -39,7 +39,7 @@ class TrainWindow extends Group {
zlevel: this.zlevel,
z: this.z - 1,
shape: {
smooth: this.style.TrainWindow.trainWindowSmooth,
smooth: this.style.TrainWindow.trainWindowSmooth, // 圆滑程度
points: [
[point.x - model.width / 2, point.y],
[point.x + model.width / 2, point.y],

View File

@ -14,12 +14,50 @@
</el-button-group>
</el-form-item>
</el-form>
<el-form ref="formModel" :model="formModel" label-width="200px" size="mini" :rules="formRules">
<el-form-item label="区段编码:" prop="modelList">
<el-select v-model="formModel.modelList" filterable multiple>
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'sectionTypeCode' ? 'danger' : 'primary'"
size="small"
@click="hover('sectionTypeCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="区段名称位置:" prop="trainPosType">
<el-select
v-model="formModel.trainPosType"
placeholder="请选择"
:clearable="true"
>
<el-option
v-for="option in positionTypes"
:key="option.type"
:label="option.name"
:value="option.type"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" size="big" @click="setPositionType">{{ $t('global.set') }}</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
</template>
<script>
import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex';
export default {
name: 'BatchSettings',
props: {
@ -28,6 +66,12 @@ export default {
default: function() {
return [];
}
},
field: {
type: Object,
default: function () {
return '';
}
}
},
data() {
@ -36,10 +80,34 @@ export default {
leftDistance: 0,
rightDistance: 0
},
tipInfoList: []
formModel: {
modelList: [],
trainPosType: ''
},
positionTypes: [
{ name: '上方', type: '01' },
{ name: '下方', type: '02' }
],
tipInfoList: [],
formRules: {
trainPosType: [
{ required: true, message: '请选择', trigger: 'change' }
],
modelList: [
{ required: true, message: '请选择', trigger: 'change' }
]
}
};
},
computed: {
...mapGetters('map', [
'sectionList'
])
},
methods:{
hover(filed) {
this.$emit('hover', filed);
},
batchSettings() {
this.tipInfoList = [];
const models = [];
@ -63,6 +131,20 @@ export default {
this.$message.success(this.$t('tip.stopPointOffsetTip'));
}
}
},
setPositionType() {
const models = [];
this.$refs['formModel'].validate((valid) => {
if (valid) {
this.formModel.modelList.forEach(sectionCode => {
const model = deepAssign({}, this.$store.getters['map/getDeviceByCode'](sectionCode) || {});
model.trainPosType = this.formModel.trainPosType;
models.push(model);
});
this.$emit('updateMapModel', models, 'five');
this.$refs.formModel.resetFields(); //
}
});
}
}
};

View File

@ -24,7 +24,7 @@
<logic-block ref="logicBlock" :edit-model="editModel" @updateMapModel="updateMapModel" />
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchSettings')" name="five">
<batch-settings ref="batchSettings" :section-list="sectionList" @updateMapModel="updateMapModel" @tipInfoHandle="tipInfoHandle" />
<batch-settings ref="batchSettings" :field="field" :section-list="sectionList" @hover="hover" @updateMapModel="updateMapModel" @tipInfoHandle="tipInfoHandle" />
</el-tab-pane>
<tip-info ref="tipInfo" :tip-info-list="tipInfoList" />
</el-tabs>
@ -453,6 +453,11 @@ export default {
this.activeName = 'second';
this.field = '';
this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'sectionTypeCode'.toUpperCase()) {
this.$refs.batchSettings.formModel.modelList.push(selected.code);
this.activeName = 'five';
// this.field = '';
// this.$emit('fieldSelect', '');
}
}
},