2020-02-07 18:19:56 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
|
|
|
|
<el-form-item label="半径" prop="r">
|
|
|
|
<el-input-number v-model="form.r" controls-position="right" :min="1" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="填充色" prop="fillColor">
|
2020-02-07 18:59:48 +08:00
|
|
|
<el-color-picker v-model="form.fillColor"></el-color-picker>
|
2020-02-07 18:19:56 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="X轴坐标">
|
|
|
|
<el-input-number v-model="form.x" controls-position="right" :min="1" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="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">删除</el-button>
|
|
|
|
<el-button v-show="showDeleteButton" @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: 'Text',
|
|
|
|
components: {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isUpdate: false,
|
|
|
|
buttonText: '立即创建',
|
|
|
|
showDeleteButton: false,
|
|
|
|
form: {
|
|
|
|
code: '',
|
|
|
|
fillColor: '',
|
|
|
|
r: 7,
|
|
|
|
x: 10,
|
|
|
|
y: 10
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
r: [
|
|
|
|
{ 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 === 'ArcStatus' ) {
|
|
|
|
this.buttonText = '修改';
|
|
|
|
this.showDeleteButton = true;
|
|
|
|
this.isUpdate = true;
|
|
|
|
this.form.code = model.code;
|
|
|
|
this.form.fillColor = model.fillColor;
|
|
|
|
this.form.r = model.r;
|
|
|
|
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('ArcStatus', this.iscs.arcStatusList),
|
|
|
|
_type: 'ArcStatus',
|
|
|
|
fillColor: this.form.fillColor,
|
|
|
|
r: this.form.r,
|
|
|
|
};
|
|
|
|
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: 'ArcStatus',
|
|
|
|
fillColor: this.form.fillColor,
|
|
|
|
r: this.form.r,
|
|
|
|
};
|
|
|
|
this.$emit('deleteDataModel', rectModel);
|
|
|
|
},
|
|
|
|
initPage() {
|
|
|
|
this.isUpdate = false;
|
|
|
|
this.buttonText = '立即创建';
|
|
|
|
this.showDeleteButton = false;
|
|
|
|
this.form = {
|
|
|
|
code: '',
|
|
|
|
fillColor: '',
|
|
|
|
r: 7,
|
|
|
|
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>
|