This commit is contained in:
zyy 2019-10-31 14:47:20 +08:00
commit dfd148897b
2 changed files with 19 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<el-dialog v-dialogDrag title="复制地图为" :visible.sync="dialogVisible" width="30%" center> <el-dialog v-dialogDrag title="复制地图为" :visible.sync="dialogVisible" width="30%" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button> <el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -19,6 +19,7 @@ export default {
name: '', name: '',
copyOtherData: false copyOtherData: false
}, },
loading: false,
mapId: '', mapId: '',
form:{ form:{
labelWidth: '100px', labelWidth: '100px',
@ -46,10 +47,18 @@ export default {
this.mapId = row.id; this.mapId = row.id;
}, },
doSave() { doSave() {
if (this.loading) {
return;
}
this.loading = true;
copyMapAs(this.mapId, this.formModel).then(resp =>{ copyMapAs(this.mapId, this.formModel).then(resp =>{
this.$message.success('复制地图成功!'); this.$message.success('复制地图成功!');
this.loading = false;
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('refresh'); this.$emit('refresh');
}).catch(() => {
this.loading = false;
this.$messageBox(`复制地图失败!`);
}); });
} }
} }

View File

@ -24,7 +24,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button> <el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -45,6 +45,7 @@ export default {
project: false, project: false,
projectCode: '' projectCode: ''
}, },
loading: false,
projectCodeShow: false, projectCodeShow: false,
booleanValue: { booleanValue: {
t: true, t: true,
@ -63,10 +64,17 @@ export default {
doSave() { doSave() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
if (this.loading) {
return;
}
this.loading = true;
setMapProject(this.formModel).then(resp =>{ setMapProject(this.formModel).then(resp =>{
this.$message.success('设置归属项目成功!'); this.$message.success('设置归属项目成功!');
this.loading = false;
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('refresh'); this.$emit('refresh');
}).catch( ()=>{
this.$messageBox(`设置归属项目失败!`);
}); });
} else { } else {
return false; return false;