rt-sim-training-client/src/views/publish/publishMap/copy.vue

58 lines
1.7 KiB
Vue
Raw Normal View History

<template>
<el-dialog v-dialogDrag title="复制地图为" :visible.sync="dialogVisible" width="30%" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { copyMapAs } from '@/api/jmap/map';
export default {
name: 'CopyMap',
data() {
return {
dialogVisible: false,
formModel: {
name: '',
copyOtherData: false
},
mapId: '',
form:{
labelWidth: '100px',
items: [
{ prop: 'name', label: '地图名称', type: 'text', required: true},
{ prop: 'copyOtherData', label: '是否复制数据', type: 'switch', required: true}
]
},
rules: {
name: [
{ required: true, message: '请输入地图名称', trigger: 'blur' }
],
copyOtherData: [
{ required: true, message: '请选择', trigger: 'change' }
]
}
};
},
computed: {
},
methods: {
doShow(row) {
this.dialogVisible = true;
this.mapId = row.id;
},
doSave() {
copyMapAs(this.mapId, this.formModel).then(resp =>{
this.$message.success('复制地图成功!');
this.dialogVisible = false;
this.$emit('refresh');
});
}
}
};
</script>