iscs bas 组件 添加

This commit is contained in:
joylink_cuiweidong 2020-01-17 13:37:08 +08:00
parent 589e7202fa
commit 219e24cbcd
9 changed files with 323 additions and 7 deletions

View File

@ -0,0 +1,128 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="编号" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="40" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name:'AirConditioner',
data() {
return {
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建',
form:{
code:'',
width: 40,
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message:'请生成设备图形的编码', trigger: 'blur' }
],
width:[
{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }
],
x: [
{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }
],
y: [
{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }
]
}
};
},
computed:{
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'AirConditioner' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.width = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods:{
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const airConditionerModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'AirConditioner',
code: this.isUpdate ? this.form.code : this.generateCode(),
width: this.form.width,
color:'#00ff00'
};
this.$emit('createAirConditioner', airConditionerModel);
this.initPage();
} else {
return false;
}
});
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code:'',
width: 40,
x: 10,
y: 10
};
this.$refs.form.resetFields();
},
deleteDevice() {
const airConditionerModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'AirConditioner',
code: this.form.code,
width: this.form.width,
color:'#00ff00'
};
this.$emit('deleteDataModel', airConditionerModel );
this.initPage();
},
generateCode() {
const mydate = new Date();
return 'airConditioner_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
}
}
};
</script>

View File

@ -31,7 +31,7 @@ export default {
buttonText: '立即创建',
form:{
code:'',
width: 60,
width: 40,
x: 10,
y: 10
},
@ -99,7 +99,7 @@ export default {
this.showDeleteButton = false;
this.form = {
code:'',
width: 60,
width: 40,
x: 10,
y: 10
};

View File

@ -43,7 +43,54 @@
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="空调机" name="airConditioner">
<air-conditioner
ref="airConditioner"
style="width:90%"
@createAirConditioner="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="轨道排风机" name="orbitalVentilator">
<orbital-ventilator
ref="orbitalVentilator"
style="width:90%"
@createOrbitalVentilator="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="射流风机" name="jetFan">
<jet-fan
ref="jetFan"
style="width:90%"
@createJetFan="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="隧道风机" name="tunnelFan">
<tunnel-fan
ref="tunnelFan"
style="width:90%"
@createTunnelFan="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="防火阀" name="fireDamper">
<fire-damper
ref="fireDamper"
style="width:90%"
@createFireDamper="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
<el-tab-pane label="防烟防火阀" name="smookProofFd">
<smook-proof-fd
ref="smookProofFd"
style="width:90%"
@createSmookProofFd="createDataModel"
@deleteDataModel="deleteDataModel"
/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
@ -55,13 +102,26 @@ import FrozenPump from './frozenPump';
import Chiller from './chiller';
import CoolTower from './coolTower';
import Ventilator from './ventilator';
import AirConditioner from './airConditioner';
import OrbitalVentilator from './orbitalVentilator';
import JetFan from './jetFan';
import TunnelFan from './tunnelFan';
import FireDamper from './fireDamper';
import SmookProofFd from './smookProofFd';
export default {
name: 'IscsOperate',
components: {
FrozenPump,
Chiller,
CoolTower,
Ventilator
Ventilator,
AirConditioner,
OrbitalVentilator,
JetFan,
TunnelFan,
FireDamper,
SmookProofFd
},
mixins: [
],

View File

@ -0,0 +1,128 @@
<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-width="100px">
<el-form-item v-if="isUpdate" label="编号" prop="code">
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="40" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="Y轴坐标" prop="y">
<el-input-number v-model="form.y" controls-position="right" :min="1" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" type="danger" @click="deleteDevice">{{ $t('global.delete') }}</el-button>
<el-button v-show="showDeleteButton" @click="initPage">{{ $t('global.cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name:'OrbitalVentilator',
data() {
return {
isUpdate:false,
showDeleteButton: false,
buttonText: '立即创建',
form:{
code:'',
width: 40,
x: 10,
y: 10
},
rules: {
code: [
{ required: true, message:'请生成设备图形的编码', trigger: 'blur' }
],
width:[
{ required: true, message:'请输入设备图形宽度', trigger: 'blur' }
],
x: [
{ required: true, message: '请输入设备图形的X轴坐标', trigger: 'blur' }
],
y: [
{ required: true, message: '请输入设备图形的Y轴坐标', trigger: 'blur' }
]
}
};
},
computed:{
},
watch:{
'$store.state.ibp.rightClickCount': function (val) {
const model = this.$store.getters['ibp/updateDeviceData'];
if (model._type === 'OrbitalVentilator' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.width = model.width;
this.form.x = model.point.x;
this.form.y = model.point.y;
}
}
},
mounted() {
},
methods:{
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const orbitalVentilatorModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'OrbitalVentilator',
code: this.isUpdate ? this.form.code : this.generateCode(),
width: this.form.width,
color:'#00ff00'
};
this.$emit('createOrbitalVentilator', orbitalVentilatorModel);
this.initPage();
} else {
return false;
}
});
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code:'',
width: 40,
x: 10,
y: 10
};
this.$refs.form.resetFields();
},
deleteDevice() {
const orbitalVentilatorModel = {
point: {
x: this.form.x,
y: this.form.y
},
_type: 'OrbitalVentilator',
code: this.form.code,
width: this.form.width,
color:'#00ff00'
};
this.$emit('deleteDataModel', orbitalVentilatorModel );
this.initPage();
},
generateCode() {
const mydate = new Date();
return 'orbitalVentilator_' + mydate.getDay() + mydate.getHours() + mydate.getMinutes() + mydate.getSeconds() + mydate.getMilliseconds() + Math.round(Math.random() * 10000);
}
}
};
</script>

View File

@ -5,7 +5,7 @@
<el-input v-model="form.code" :disabled="true" />
</el-form-item>
<el-form-item label="图形宽度" prop="width">
<el-input-number v-model="form.width" :min="60" />
<el-input-number v-model="form.width" :min="40" />
</el-form-item>
<el-form-item label="X轴坐标" prop="x">
<el-input-number v-model="form.x" controls-position="right" :min="1" />
@ -31,7 +31,7 @@ export default {
buttonText: '立即创建',
form:{
code:'',
width: 60,
width: 40,
x: 10,
y: 10
},
@ -99,7 +99,7 @@ export default {
this.showDeleteButton = false;
this.form = {
code:'',
width: 60,
width: 40,
x: 10,
y: 10
};