67 lines
2.1 KiB
Vue
67 lines
2.1 KiB
Vue
<template>
|
|
<el-dialog v-dialogDrag :title="this.$t('publish.copyMapAs')" :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 v-loading="loading" 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
|
|
},
|
|
loading: false,
|
|
mapId: '',
|
|
form:{
|
|
labelWidth: '100px',
|
|
items: [
|
|
{ prop: 'name', label: this.$t('publish.mapName'), type: 'text', required: true},
|
|
{ prop: 'copyOtherData', label: this.$t('publish.whetherToCopyData'), type: 'switch', required: true}
|
|
]
|
|
},
|
|
rules: {
|
|
name: [
|
|
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'blur' }
|
|
],
|
|
copyOtherData: [
|
|
{ required: true, message: this.$t('global.choose'), trigger: 'change' }
|
|
]
|
|
}
|
|
};
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
methods: {
|
|
doShow(row) {
|
|
this.dialogVisible = true;
|
|
this.mapId = row.id;
|
|
},
|
|
doSave() {
|
|
if (this.loading) {
|
|
return;
|
|
}
|
|
this.loading = true;
|
|
copyMapAs(this.mapId, this.formModel).then(resp =>{
|
|
this.$message.success(this.$t('tip.copyMapSuccess'));
|
|
this.loading = false;
|
|
this.dialogVisible = false;
|
|
this.$emit('refresh');
|
|
}).catch(() => {
|
|
this.loading = false;
|
|
this.$messageBox(this.$t('tip.copyMapFail'));
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|