2019-11-29 12:51:58 +08:00
|
|
|
<template>
|
|
|
|
<el-tabs v-model="activeName" class="card">
|
2020-04-30 14:50:27 +08:00
|
|
|
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
2020-07-20 15:10:57 +08:00
|
|
|
<operate-property
|
2020-07-28 10:46:00 +08:00
|
|
|
ref="dataform"
|
2020-07-20 15:10:57 +08:00
|
|
|
:form="form"
|
|
|
|
:edit-model="editModel"
|
2020-07-28 13:03:03 +08:00
|
|
|
:rules="rules"
|
2020-07-20 15:10:57 +08:00
|
|
|
type="DelayUnlock"
|
|
|
|
@updateMapModel="updateMapModel"
|
|
|
|
/>
|
2019-11-29 12:51:58 +08:00
|
|
|
</el-tab-pane>
|
2020-04-30 14:50:27 +08:00
|
|
|
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
2020-07-27 16:11:29 +08:00
|
|
|
<create-operate
|
|
|
|
ref="createForm"
|
|
|
|
:create-form="formMake"
|
|
|
|
:add-model="addModel"
|
2020-07-28 13:03:03 +08:00
|
|
|
:create-rules="rules"
|
2020-07-27 16:11:29 +08:00
|
|
|
@create="create"
|
|
|
|
/>
|
2019-11-29 12:51:58 +08:00
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import { getUID } from '@/jmap/utils/Uid';
|
2020-07-20 15:10:57 +08:00
|
|
|
import OperateProperty from './components/operateProperty';
|
2020-07-27 16:11:29 +08:00
|
|
|
import CreateOperate from './components/createOperate';
|
2019-11-29 12:51:58 +08:00
|
|
|
import { deepAssign } from '@/utils/index';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'DelayUnlockDraft',
|
|
|
|
components: {
|
2020-07-27 16:11:29 +08:00
|
|
|
OperateProperty,
|
|
|
|
CreateOperate
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
selected: {
|
|
|
|
type: Object,
|
|
|
|
default: function () {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
activeName: 'first',
|
2020-04-30 14:50:27 +08:00
|
|
|
lazy: true,
|
2019-11-29 12:51:58 +08:00
|
|
|
skins: [],
|
|
|
|
editModel: {
|
|
|
|
code: '',
|
|
|
|
unlockTime: 0,
|
|
|
|
stationCode: '',
|
|
|
|
fontColor: '#FFFFFF',
|
|
|
|
font: '',
|
|
|
|
position: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
2020-07-20 15:10:57 +08:00
|
|
|
},
|
|
|
|
status:'00'
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
|
|
|
addModel: {
|
|
|
|
stationCode: ''
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('map', [
|
|
|
|
'delayShowList',
|
|
|
|
'stationList',
|
|
|
|
'lineCode'
|
|
|
|
]),
|
2020-07-28 13:03:03 +08:00
|
|
|
rules: function () {
|
2019-11-29 12:51:58 +08:00
|
|
|
return {
|
|
|
|
code: [
|
|
|
|
{ required: true, message: this.$t('map.pleaseSelectDevice'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
stationCode: [
|
|
|
|
{ required: true, message: this.$t('map.selectStation'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
unlockTime: [
|
|
|
|
{ required: true, message: this.$t('map.pleaseEnterDelayTime'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
fontColor: [
|
|
|
|
{ required: true, message: this.$t('map.pleaseEnterFontColor'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
font: [
|
|
|
|
{ required: true, message: this.$t('map.pleaseEnterFontFormat'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
'position.x': [
|
|
|
|
{ required: true, message: this.$t('map.pleaseEnterXCoordinate'), trigger: 'change' }
|
|
|
|
],
|
|
|
|
'position.y': [
|
|
|
|
{ required: true, message: this.$t('map.pleaseEnterYCoordinate'), trigger: 'change' }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
form() {
|
|
|
|
const form = {
|
|
|
|
labelWidth: '120px',
|
|
|
|
items: {
|
|
|
|
code: {
|
|
|
|
name: '',
|
|
|
|
item: []
|
|
|
|
},
|
|
|
|
draw: {
|
|
|
|
name: this.$t('map.drawData'),
|
|
|
|
item: [
|
2020-07-27 16:11:29 +08:00
|
|
|
{ prop: 'code', label: this.$t('map.delayUnlockingCode'), type: 'select', optionLabel: 'code', optionValue: 'code', options: this.delayShowList, deviceChange: this.deviceChange },
|
2019-11-29 12:51:58 +08:00
|
|
|
{ prop: 'unlockTime', label: this.$t('map.delayTime'), type: 'number', min: 0, max: 1000, placeholder: 's' },
|
|
|
|
{ prop: 'font', label: this.$t('map.font'), type: 'font' },
|
|
|
|
{ prop: 'fontColor', label: this.$t('map.color'), type: 'color' },
|
|
|
|
{ prop: 'position', label: this.$t('map.delayUnlockPosition'), type: 'coordinate', width: '110px', children: [
|
|
|
|
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
|
|
|
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
|
|
|
] }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
map: {
|
|
|
|
name: this.$t('map.mapData'),
|
|
|
|
item: [
|
|
|
|
{ prop: 'stationCode', label: this.$t('map.belongsStation'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return form;
|
2020-07-27 16:11:29 +08:00
|
|
|
},
|
|
|
|
formMake() {
|
|
|
|
const form = {
|
|
|
|
labelWidth: '120px',
|
|
|
|
items:{
|
|
|
|
all:{
|
|
|
|
name:'',
|
|
|
|
item: [
|
|
|
|
{ prop: 'stationCode', label: this.$t('map.stationName'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.stationList }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return form;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
deviceChange(code) {
|
|
|
|
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
|
|
|
|
},
|
|
|
|
deviceSelect(selected) {
|
|
|
|
this.$nextTick(() => {
|
2020-05-18 17:08:21 +08:00
|
|
|
this.$refs.form && this.$refs.form.resetFields();
|
|
|
|
this.$refs.make && this.$refs.make.resetFields();
|
2019-11-29 12:51:58 +08:00
|
|
|
if (selected && selected._type.toUpperCase() === 'DelayUnlock'.toUpperCase()) {
|
|
|
|
this.activeName = 'first';
|
|
|
|
this.editModel = deepAssign(this.editModel, selected);
|
|
|
|
} else if (selected && selected._type.toUpperCase() === 'Station'.toUpperCase()) {
|
|
|
|
this.addModel.stationCode = selected.code;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$refs.form.clearValidate();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
create() {
|
2020-07-27 16:11:29 +08:00
|
|
|
const uid = getUID('DelayUnlock');
|
|
|
|
const model = {
|
|
|
|
_type: 'DelayUnlock',
|
|
|
|
font: '12px consolas',
|
|
|
|
fontColor: '#FFFFFF',
|
|
|
|
unlockTime: 10,
|
|
|
|
code: uid,
|
|
|
|
delayName: 'Test',
|
|
|
|
status: '00'
|
|
|
|
};
|
|
|
|
this.stationList.forEach(elem => {
|
|
|
|
if (elem.code === this.addModel.stationCode) {
|
|
|
|
model.position = { x: elem.position.x, y: elem.position.y };
|
|
|
|
model.stationCode = elem.code;
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
});
|
2020-07-27 16:11:29 +08:00
|
|
|
this.$emit('updateMapModel', model);
|
2019-11-29 12:51:58 +08:00
|
|
|
},
|
2020-07-20 15:10:57 +08:00
|
|
|
updateMapModel(data) {
|
|
|
|
this.$emit('updateMapModel', data);
|
2020-07-28 10:34:02 +08:00
|
|
|
},
|
|
|
|
deleteObj() {
|
|
|
|
this.$refs.dataform.deleteObj();
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
.card {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
</style>
|