rt-sim-training-client/src/views/iscs/iscsDraw/icscComponents/picture.vue
2021-09-03 14:46:22 +08:00

239 lines
10 KiB
Vue

<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="图层:" prop="z2">
<el-input-number v-model="form.z2" controls-position="right" size="small" />
</el-form-item>
<el-form-item label="图片类型:" prop="type">
<el-select v-model="form.type" placeholder="请选择类型" size="small">
<el-option v-for="(item, index) in typeList" :key="index" :label="item.name" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="旋转角度:" prop="rotation">
<el-input-number v-model="form.rotation" controls-position="right" size="small" />
</el-form-item>
<el-form-item label="宽度:" prop="width">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="高度:" prop="height">
<el-input-number v-model="form.height" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import {getUID} from '@/iscs/utils/Uid';
export default {
name: 'IscsPicture',
components: {
},
data() {
return {
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false,
form: {
code: '',
type: '',
z2: 0,
width: 50,
height: 50,
rotation: 0,
x: 10,
y: 10
},
typeList: [
{ name: '车头', value: 'psdLeft' },
{ name: '车尾', value: 'psdRight' },
{ name: '车厢', value: 'psdSystem' },
{ name: '人防门', value: 'envPersonDoor'},
{ name: '报警按钮蓝', value: 'alarmButtonBlue'},
{ name: '报警按钮红', value: 'alarmButtonRed'},
{ name: 'APF', value: 'APF'},
{ name: '手动阀', value: 'hand'},
{ name: '蓝色-阀门', value: 'fmBlue'},
{ name: '灰色-阀门', value: 'fmGray'},
{ name: '绿色-阀门', value: 'fmGreen'},
{ name: '空调', value: 'airCond'},
{ name: '多联空调', value: 'airCondMul'},
{ name: '管件', value: 'setting'},
{ name: '汽包', value: 'drum' },
{ name: '红色-左侧-鼓风机', value: 'blowerRedLeft'},
{ name: '灰色-左侧-鼓风机', value: 'blowerGrayLeft'},
{ name: '红色-右侧-鼓风机', value: 'blowerRedRight'},
{ name: '灰色-右侧-鼓风机', value: 'blowerGrayRight'},
{ name: '灰色-排风机', value: 'exhaustFanGray' },
{ name: '绿色-排风机', value: 'exhaustFanGreen' },
{ name: '排风机左侧', value: 'exhaustFanLeft' },
{ name: '排风机右侧', value: 'exhaustFanRight' },
{ name: '冷水机', value: 'waterCooler'},
{ name: '顶部排风机', value: 'ventilationFan'},
{ name: '文字蓝色背景', value: 'textBgBluePoint'},
{ name: '扶梯', value: 'escalator'},
{ name: '扶梯-朝上指示', value: 'toUp'},
{ name: '扶梯-朝下执行', value: 'toDown'},
{ name: '电梯', value: 'lift' },
{ name: '蓝色-排水', value: 'dewateringBlue' },
{ name: '灰色-电梯', value: 'dewateringGray' },
{ name: '紫色-电梯', value: 'dewateringPurple' },
{ name: '活塞风井', value: 'kongzhixiang'},
{ name: 'MD风阀', value: 'iscsMD' },
{ name: '排烟风阀', value: 'iscsMDRect' },
{ name: '排烟风机(箭头)-灰色', value: 'iscsRAFEAFGray' },
{ name: '排烟风机(箭头)-绿色', value: 'iscsRAFEAFGreen' },
{ name: '排烟风机', value: 'iscsSEF' },
{ name: '阀门', value: 'iscsValue' },
{ name: '风扇机', value: 'fanCoil'},
{ name: '烟杆传感器', value: 'iscsSensor' },
{ name: '抵挡图', value: 'iscsDangwei' },
{ name: '地变图', value: 'iscsDibian' },
{ name: 'PT1', value: 'iscsPt1' },
{ name: '售检左侧箭头', value: 'checkArrowLeft' },
{ name: '售检右侧箭头', value: 'checkArrowRight' },
{ name: '售检两侧箭头', value: 'checkArrowDouble' },
{ name: '售检流量累计', value: 'checkFlowCumulative' },
{ name: '售检正常', value: 'checkNormal' },
{ name: '售检售票', value: 'checkSell' },
{ name: '售检售票2', value: 'checkSell2' },
{ name: '站厅背景', value: 'bgShowRoom' },
{ name: '站台背景', value: 'bgStand' },
{ name: '站台A端背景', value: 'bgFasPlatformA' },
{ name: '站台B端背景', value: 'bgFasPlatformB' },
{ name: '环空电控', value: 'basAnnulus' },
{ name: '环控机控', value: 'basEnvironmental' },
{ name: '智能低压', value: 'basLowPressure' },
{ name: '接口机', value: 'basInterface' },
{ name: '实体机', value: 'basEntity' },
{ name: '烟感探测器红', value: 'smokeDetectorRed' },
{ name: '烟感探测器绿', value: 'smokeDetectorGreen' },
{ name: '烟感探测器蓝', value: 'smokeDetectorBlue' },
{ name: '防火阀红', value: 'fireDamperRed' },
{ name: '防火阀绿', value: 'fireDamperGreen' },
{ name: '防火阀蓝', value: 'fireDamperBlue' },
{ name: '温感器红', value: 'alarmLampRed' },
{ name: '温感器绿', value: 'alarmLampGreen' },
{ name: '温感器蓝', value: 'alarmLampBlue' },
{ name: '站厅A', value: 'bgStationA' },
{ name: '站厅B', value: 'bgStationB' },
{ name: '站厅C', value: 'bgStationC' },
{ name: '站厅D', value: 'bgStationD' },
{ name: '站厅E', value: 'bgStationE' },
{ name: '站厅F', value: 'bgStationF' },
{ name: '门禁站厅A', value: 'bgDoorStationA' },
{ name: '门禁站台A', value: 'bgDoorStandA' },
{ name: '小站台', value: 'littleStand' },
{ name: '小站厅', value: 'littleStation' }
],
rules: {
strokeColor: [
{ required: true, message: '请选择边框颜色', trigger: 'change' }
],
fillColor: [
{ required: true, message: '请选择矩形填充颜色', trigger: 'change'}
]
}
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'IscsPicture' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.type = model.type;
this.form.z2 = model.z2;
this.form.rotation = model.rotation;
this.form.width = model.width;
this.form.height = model.height;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('IscsPicture', this.iscs.iscsPictureList),
_type: 'IscsPicture',
type: this.form.type,
z2: this.form.z2,
rotation: this.form.rotation,
width: this.form.width,
height: this.form.height
};
this.$emit('createDataModel', rectModel);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const rectModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'IscsPicture',
type: this.form.type,
z2: this.form.z2,
rotation: this.form.rotation
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
type: '',
z2: 0,
rotation: 0,
width: 50,
height: 50,
x: 10,
y: 10
};
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.button_box{
width: 100%;
background: #f0f0f0;
overflow: hidden;
}
</style>