rt-sim-training-client/src/views/newMap/mapDraftPicture/changePicture.vue

64 lines
1.7 KiB
Vue
Raw Normal View History

2022-07-07 16:08:04 +08:00
<template>
<el-dialog
title="画面切换"
:visible.sync="centerDialogVisible"
width="350px"
center
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
<el-form-item label="画面名称:" prop="picture">
<el-select v-model="ruleForm.picture" placeholder="请选择">
<el-option
v-for="item in pictureList"
2022-07-08 16:31:42 +08:00
:key="item.name"
2022-07-07 16:08:04 +08:00
:label="item.name"
2022-07-08 16:31:42 +08:00
:value="item.name"
2022-07-07 16:08:04 +08:00
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="changeForm()">切换</el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
name: 'CreatePicture',
data() {
return {
centerDialogVisible: false,
2022-07-13 14:19:02 +08:00
pictureList: [],
2022-07-07 16:08:04 +08:00
ruleForm: { picture: '' },
rules: {
picture: [{ required: true, message: '请选择画面', trigger: 'change' }]
}
};
},
2022-07-13 14:19:02 +08:00
computed: {},
2022-07-07 16:08:04 +08:00
methods: {
changeForm() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.$emit('pictureChanged', this.ruleForm.picture);
2022-07-08 16:31:42 +08:00
this.doClose();
2022-07-07 16:08:04 +08:00
}
});
},
doClose() {
this.$refs.ruleForm.resetFields();
this.centerDialogVisible = false;
},
doShow() {
2022-07-13 14:19:02 +08:00
this.pictureList = this.$store.state.map.map ? this.$store.state.map.map.pictureList : [];
2022-07-07 16:08:04 +08:00
this.centerDialogVisible = true;
}
}
};
</script>
<style scoped>
</style>