rt-sim-training-client/src/views/iscs/iscsDraw/icscComponents/picture.vue

213 lines
8.7 KiB
Vue
Raw Normal View History

2020-09-22 18:03:46 +08:00
<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;">
2020-10-12 16:45:24 +08:00
<el-form-item label="图层:" prop="z2">
<el-input-number v-model="form.z2" controls-position="right" size="small" />
</el-form-item>
2020-09-22 18:03:46 +08:00
<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>
2020-10-12 13:04:13 +08:00
<el-form-item label="旋转角度:" prop="rotation">
<el-input-number v-model="form.rotation" controls-position="right" size="small" />
</el-form-item>
2020-09-22 18:03:46 +08:00
<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: '',
2020-10-12 16:45:24 +08:00
type: '',
z2: 0,
2020-09-22 18:03:46 +08:00
width: 50,
2020-10-12 13:04:13 +08:00
height: 50,
rotation: 0,
2020-09-22 18:03:46 +08:00
x: 10,
y: 10
},
typeList: [
2020-09-23 10:22:52 +08:00
{ name: '车头', value: 'psdLeft' },
2020-09-23 18:44:00 +08:00
{ name: '车尾', value: 'psdRight' },
2020-10-12 16:45:24 +08:00
{ name: '车厢', value: 'psdSystem' },
{ name: '人防门', value: 'envPersonDoor'},
{ name: '蓝色FIRE', value: 's'},
{ name: '红色FIRE', value: 'a'},
{ 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' },
2021-03-22 18:40:29 +08:00
{ 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' }
2020-10-12 16:45:24 +08:00
],
2020-09-27 16:12:25 +08:00
2020-09-22 18:03:46 +08:00
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;
2020-10-12 16:45:24 +08:00
this.form.z2 = model.z2;
this.form.rotation = model.rotation;
2020-09-22 18:03:46 +08:00
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
},
2020-09-23 10:22:52 +08:00
code: this.isUpdate ? this.form.code : getUID('IscsPicture', this.iscs.iscsPictureList),
2020-09-22 18:03:46 +08:00
_type: 'IscsPicture',
type: this.form.type,
2020-10-12 16:45:24 +08:00
z2: this.form.z2,
rotation: this.form.rotation,
2020-09-22 18:03:46 +08:00
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,
2020-10-12 16:45:24 +08:00
z2: this.form.z2,
rotation: this.form.rotation
2020-09-22 18:03:46 +08:00
};
this.$emit('deleteDataModel', rectModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
type: '',
2020-10-12 16:45:24 +08:00
z2: 0,
rotation: 0,
2020-09-22 18:03:46 +08:00
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>