feat:避免保存、导入按钮重复点击提交

This commit is contained in:
zhangyu
2020-12-21 14:16:13 +08:00
parent 3b69a88698
commit 69e339a5fe
13 changed files with 153 additions and 25 deletions

View File

@@ -306,13 +306,13 @@ li{
background: $btn-normal-background-color-hover-new; background: $btn-normal-background-color-hover-new;
color: $btn-normal-txt-color-new; color: $btn-normal-txt-color-new;
//box-shadow: $btn-normal-shadow; //box-shadow: $btn-normal-shadow;
border: 0px; border: 1px solid $btn-normal-background-color-hover-new;
} }
.nz-btn.nz-btn-style-error-new:hover:not(.nz-btn-disabled) { /* 新版红色按钮hover */ .nz-btn.nz-btn-style-error-new:hover:not(.nz-btn-disabled) { /* 新版红色按钮hover */
background: $btn-error-background-color-hover-new; background: $btn-error-background-color-hover-new;
color: $btn-error-txt-color-new; color: $btn-error-txt-color-new;
//box-shadow: $btn-normal-shadow; //box-shadow: $btn-normal-shadow;
border: 0px; border: 1px solid $btn-error-background-color-hover-new;
} }
.nz-btn.nz-btn-style-light-new:hover:not(.nz-btn-disabled) { /* 新版浅色按钮hover */ .nz-btn.nz-btn-style-light-new:hover:not(.nz-btn-disabled) { /* 新版浅色按钮hover */
border: 1px solid $btn-light-border-color-hover-new; border: 1px solid $btn-light-border-color-hover-new;
@@ -324,13 +324,13 @@ li{
background: $btn-normal-background-color-active-new; background: $btn-normal-background-color-active-new;
color: $btn-normal-txt-color-new; color: $btn-normal-txt-color-new;
//box-shadow: $btn-normal-shadow; //box-shadow: $btn-normal-shadow;
border: 0px; border-color: $btn-normal-background-color-active-new;
} }
.nz-btn.nz-btn-style-error-new:active:not(.nz-btn-disabled) { /* 新版红色按钮active' */ .nz-btn.nz-btn-style-error-new:active:not(.nz-btn-disabled) { /* 新版红色按钮active' */
background: $btn-error-background-color-active-new; background: $btn-error-background-color-active-new;
color: $btn-error-txt-color-new; color: $btn-error-txt-color-new;
//box-shadow: $btn-normal-shadow; //box-shadow: $btn-normal-shadow;
border: 0px; border-color: $btn-error-background-color-active-new;
} }
.nz-btn.nz-btn-style-light-new:active:not(.nz-btn-disabled) { /* 新版浅色按钮active*/ .nz-btn.nz-btn-style-light-new:active:not(.nz-btn-disabled) { /* 新版浅色按钮active*/
border: 1px solid $btn-light-border-color-active-new; border: 1px solid $btn-light-border-color-active-new;

View File

@@ -470,7 +470,8 @@
hover.hide(); hover.hide();
} }
}, },
hexagonSvgClearScale(){ hexagonSvgClearScale(e){
window.event? window.event.cancelBubble = true:e.stopPropagation();
if(this.firstInit){return} if(this.firstInit){return}
if(this.group){ if(this.group){
this.group.off('dblclick',this.hexagonSvgClearScale); this.group.off('dblclick',this.hexagonSvgClearScale);

View File

@@ -12,7 +12,7 @@
<!--<span class="edit-topology-remove" @click="lineDel">Remove</span>--> <!--<span class="edit-topology-remove" @click="lineDel">Remove</span>-->
</span> </span>
<span v-show="!selectNodeTitle&&editVisNetwork" class="edit-topologyLine"> <span v-show="!selectNodeTitle&&editVisNetwork" class="edit-topologyLine">
<button @click="saveTopology" class="nz-btn nz-btn-size-small-new nz-btn-style-normal-new" v-has="'project_topo_save'">{{$t('project.topology.save')}}</button> <button @click="saveTopology" class="nz-btn nz-btn-size-small-new nz-btn-style-normal-new" v-has="'project_topo_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('project.topology.save')}}</button>
<button @click="cancelTopology" class="nz-btn nz-btn-size-small-new nz-btn-style-light-new">{{$t('project.topology.cancel')}}</button> <button @click="cancelTopology" class="nz-btn nz-btn-size-small-new nz-btn-style-light-new">{{$t('project.topology.cancel')}}</button>
</span> </span>
<span class="edit-topology-line-cancel" v-show="selectNodeTitle&&editVisNetwork"> {{$t('project.topology.selTwoNode')}} <span class="edit-topologyCancel" @click="closeAddLine">{{$t('project.topology.cancel')}}</span></span> <span class="edit-topology-line-cancel" v-show="selectNodeTitle&&editVisNetwork"> {{$t('project.topology.selTwoNode')}} <span class="edit-topologyCancel" @click="closeAddLine">{{$t('project.topology.cancel')}}</span></span>
@@ -300,10 +300,13 @@
}, },
methods:{// 保存拓扑图数据 methods:{// 保存拓扑图数据
saveTopology(){ saveTopology(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$emit('topologyLoad'); this.$emit('topologyLoad');
let nodes=this.formatNodes([...this.nodesArray]); let nodes=this.formatNodes([...this.nodesArray]);
let edges=this.formatEdges([...this.edgesArray]); let edges=this.formatEdges([...this.edgesArray]);
this.$put('/project/topo',{topo:JSON.stringify({nodes:nodes,lines:edges,viewsCenter:this.viewsCenter,zoom:(this.zoom*1920/this.screenX)}),projectId:this.allModuleInfo.basic.id}).then(res=>{ this.$put('/project/topo',{topo:JSON.stringify({nodes:nodes,lines:edges,viewsCenter:this.viewsCenter,zoom:(this.zoom*1920/this.screenX)}),projectId:this.allModuleInfo.basic.id}).then(res=>{
this.prevent_opt.save=false;
if(res.code===200){ if(res.code===200){
this.$message({ this.$message({
message: this.$t("tip.saveSuccess"), message: this.$t("tip.saveSuccess"),
@@ -312,6 +315,7 @@
this.$emit('reload'); this.$emit('reload');
} }
}).catch(res=>{ }).catch(res=>{
this.prevent_opt.save=false;
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'error' type: 'error'

View File

@@ -75,7 +75,9 @@
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" id="account-save" v-has="'account_save'" <button @click="save" id="account-save" v-has="'account_save'"
class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new"> class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new"
:disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}"
>
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -121,12 +123,12 @@
editUser: {}, editUser: {},
scripts: [], scripts: [],
selectableScripts: [], selectableScripts: [],
roles:[],
} }
}, },
methods: { methods: {
/*关闭弹框*/ /*关闭弹框*/
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
clickOutside() { clickOutside() {
@@ -134,11 +136,14 @@
}, },
/*保存*/ /*保存*/
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.accountForm.validate(valid => { this.$refs.accountForm.validate(valid => {
if (valid) { if (valid) {
let editUser = JSON.parse(JSON.stringify(this.editUser)) let editUser = JSON.parse(JSON.stringify(this.editUser))
editUser.roleIds = [editUser.roleIds] editUser.roleIds = [editUser.roleIds]
if (this.editUser.userId) { if (this.editUser.userId) {
this.prevent_opt.save=false;
this.$put('sys/user/update',editUser).then(response => { this.$put('sys/user/update',editUser).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
@@ -149,6 +154,7 @@
}); });
} else { } else {
this.$post('sys/user/save', editUser).then(response => { this.$post('sys/user/save', editUser).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -158,12 +164,15 @@
}); });
} }
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}) })
}, },
/*删除*/ /*删除*/
del() { del() {
if(this.prevent_opt.save){ return }
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
@@ -177,6 +186,9 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}); });
this.prevent_opt.save=false;
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },

View File

@@ -414,7 +414,7 @@
assetListHalf:false, assetListHalf:false,
typeList: [], typeList: [],
dcList: [], dcList: [],
modelList: [] modelList: [],
} }
}, },
methods: { methods: {
@@ -514,6 +514,7 @@
/*关闭弹框*/ /*关闭弹框*/
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
@@ -848,6 +849,8 @@
//保存endpoint //保存endpoint
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.endpoint.projectId = this.currentProjectCopy.id; this.endpoint.projectId = this.currentProjectCopy.id;
this.endpoint.moduleId = this.currentModuleCopy.id; this.endpoint.moduleId = this.currentModuleCopy.id;
if (this.endpointList.length == 0) { if (this.endpointList.length == 0) {
@@ -864,6 +867,7 @@
this.$refs.addEndpoint.validate((valid) => { this.$refs.addEndpoint.validate((valid) => {
if (valid) { if (valid) {
this.$post('endpoint', endpointList).then(response => { this.$post('endpoint', endpointList).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -872,6 +876,7 @@
} }
}); });
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}) })
@@ -894,12 +899,15 @@
//删除endpoint //删除endpoint
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$delete("endpoint?ids=" + this.endpoint.id).then(response => { this.$delete("endpoint?ids=" + this.endpoint.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true); this.esc(true);
@@ -907,6 +915,8 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}); });
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },
// endpoint弹框的asset子弹框顶部搜索条件选中事件 // endpoint弹框的asset子弹框顶部搜索条件选中事件

View File

@@ -111,7 +111,7 @@
<button @click="esc(false)" id="alert-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new"> <button @click="esc(false)" id="alert-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="alert-box-save" v-has="'rule_save'"> <button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="alert-box-save" v-has="'rule_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -202,15 +202,19 @@
this.esc(false); this.esc(false);
}, },
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.editAlertRule.expr = this.expressions[0]; this.editAlertRule.expr = this.expressions[0];
this.$refs.alertRuleForm.validate((valid) => { this.$refs.alertRuleForm.validate((valid) => {
if (valid) { if (valid) {
this.editAlertRule.receiver = this.editAlertRule.receiverShow.join(","); this.editAlertRule.receiver = this.editAlertRule.receiverShow.join(",");
if (this.editAlertRule.id) { if (this.editAlertRule.id) {
this.$put('alert/rule', this.editAlertRule).then(response => { this.$put('alert/rule', this.editAlertRule).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -219,6 +223,7 @@
} }
}); });
} else { } else {
this.prevent_opt.save=false;
this.$post('alert/rule', this.editAlertRule).then(response => { this.$post('alert/rule', this.editAlertRule).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
@@ -229,17 +234,21 @@
}); });
} }
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}) })
}, },
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$delete("alert/rule?ids=" + this.editAlertRule.id).then(response => { this.$delete("alert/rule?ids=" + this.editAlertRule.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true); this.esc(true);
@@ -247,6 +256,8 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}) })
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },
getUserList() { getUserList() {

View File

@@ -154,7 +154,7 @@
<button @click="esc(false)" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" id="asset-edit-cancel"> <button @click="esc(false)" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" id="asset-edit-cancel">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="asset-edit-save" v-has="'asset_save'"> <button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="asset-edit-save" v-has="'asset_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -304,6 +304,7 @@
}, },
/*关闭弹框*/ /*关闭弹框*/
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
modelReload() { modelReload() {
@@ -527,6 +528,7 @@
}, },
setAccountValidResult(result, protocol) { setAccountValidResult(result, protocol) {
this.accountValidResult = result; this.accountValidResult = result;
this.prevent_opt.save=false;
let index = this.errorProtocol.indexOf(protocol); let index = this.errorProtocol.indexOf(protocol);
if (result) { if (result) {
index != -1 ? this.errorProtocol.splice(index, 1) : ""; index != -1 ? this.errorProtocol.splice(index, 1) : "";
@@ -535,11 +537,14 @@
} }
}, },
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.prevent_opt.save=false;
this.$delete("asset?ids=" + this.editAsset.id).then(response => { this.$delete("asset?ids=" + this.editAsset.id).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")});
@@ -548,12 +553,16 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}) })
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },
changeProtocolType(type) { changeProtocolType(type) {
this.accountType = type; this.accountType = type;
}, },
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
if(this.locationInfo) { if(this.locationInfo) {
if(this.locationInfo.idc){ if(this.locationInfo.idc){
this.editAsset.idcId = this.locationInfo.idc.id; this.editAsset.idcId = this.locationInfo.idc.id;
@@ -581,6 +590,7 @@
if (valid && this.accountValidResult) { if (valid && this.accountValidResult) {
if (this.editAsset.id) { if (this.editAsset.id) {
this.$put('asset', this.editAsset).then(res => { this.$put('asset', this.editAsset).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) { if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -593,6 +603,7 @@
this.$refs.accountConfigBox[0].validateAccount(); this.$refs.accountConfigBox[0].validateAccount();
} }
this.$post('asset', this.editAsset).then(res => { this.$post('asset', this.editAsset).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) { if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -602,6 +613,7 @@
}); });
} }
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });

View File

@@ -250,7 +250,7 @@
<button @click="esc(false)" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" id="asset-edit-cancel"> <button @click="esc(false)" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" id="asset-edit-cancel">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="asset-edit-save" v-has="'asset_save'"> <button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="asset-edit-save" v-has="'asset_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -410,6 +410,7 @@
}, },
/*关闭弹框*/ /*关闭弹框*/
esc(refresh){ esc(refresh){
this.prevent_opt.save=false;
this.$emit("close",refresh); this.$emit("close",refresh);
}, },
modelReload(){ modelReload(){
@@ -630,6 +631,8 @@
}); });
}, },
save(){ save(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
if(this.locationInfo){ if(this.locationInfo){
if(this.locationInfo.idc){ if(this.locationInfo.idc){
this.editAsset.idcId=this.locationInfo.idc.id; this.editAsset.idcId=this.locationInfo.idc.id;
@@ -662,6 +665,7 @@
this.editAsset.assetIds.push(item.id); this.editAsset.assetIds.push(item.id);
}); });
this.$put('/asset/batch',this.editAsset).then(res=>{ this.$put('/asset/batch',this.editAsset).then(res=>{
this.prevent_opt.save=false;
if(res.code===200){ if(res.code===200){
this.$message({duration:2000,type:'success',message:this.$t("tip.saveSuccess")}); this.$message({duration:2000,type:'success',message:this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -670,6 +674,7 @@
} }
}); });
}else{ }else{
this.prevent_opt.save=false;
return false; return false;
} }
}); });

View File

@@ -36,7 +36,7 @@
<button @click="esc" id="cab-box-esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-100"> <button @click="esc" id="cab-box-esc" class="nz-btn nz-btn-size-normal nz-btn-style-light nz-btn-min-width-100">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal nz-btn-style-normal nz-btn-min-width-100" id="cab-box-save" v-has="'dc_cabinet_save'"> <button @click="save" class="nz-btn nz-btn-size-normal nz-btn-style-normal nz-btn-min-width-100" id="cab-box-save" v-has="'dc_cabinet_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -69,14 +69,18 @@
this.esc(false); this.esc(false);
}, },
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.cabinetForm.validate((valid => { this.$refs.cabinetForm.validate((valid => {
if(valid){ if(valid){
this.editCabinet.idcId = this.currentDc.id; this.editCabinet.idcId = this.currentDc.id;
if (this.editCabinet.id) { if (this.editCabinet.id) {
this.$put('cabinet', this.editCabinet).then(res => { this.$put('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) { if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -86,6 +90,7 @@
}) })
} else { } else {
this.$post('cabinet', this.editCabinet).then(res => { this.$post('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) { if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -95,17 +100,21 @@
}) })
} }
}else{ }else{
this.prevent_opt.save=false;
return false; return false;
} }
})) }))
}, },
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$delete('/cabinet?ids=' + this.editCabinet.id).then(response=>{ this.$delete('/cabinet?ids=' + this.editCabinet.id).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -113,6 +122,8 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}) })
}).catch(()=>{
this.prevent_opt.save=false;
}) })
} }
}, },

View File

@@ -82,7 +82,7 @@
<button @click="esc" id="dc-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new"> <button @click="esc" id="dc-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="dc-box-save" v-has="'dc_save'"> <button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="dc-box-save" v-has="'dc_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -120,6 +120,7 @@
methods: { methods: {
/*关闭弹框*/ /*关闭弹框*/
esc(refresh) { esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh); this.$emit("close", refresh);
}, },
clickOutside() { clickOutside() {
@@ -132,6 +133,8 @@
/*保存*/ /*保存*/
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.dcForm.validate((valid) => { this.$refs.dcForm.validate((valid) => {
if (valid) { if (valid) {
if (this.editDc.id) { if (this.editDc.id) {
@@ -147,6 +150,7 @@
} }
this.$put('idc', param).then(response => { this.$put('idc', param).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -166,6 +170,7 @@
param.latitude=null; param.latitude=null;
} }
this.$post('idc', param).then(response => { this.$post('idc', param).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -175,18 +180,22 @@
}); });
} }
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });
}, },
/*删除*/ /*删除*/
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$delete("idc?ids=" + this.editDc.id).then(response => { this.$delete("idc?ids=" + this.editDc.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true); this.esc(true);
@@ -194,6 +203,8 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}); });
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },
// getAreaData() { // getAreaData() {

View File

@@ -127,7 +127,7 @@
<button @click="esc" id="ep-edit-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new"> <button @click="esc" id="ep-edit-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
<span>{{$t('overall.cancel')}}</span> <span>{{$t('overall.cancel')}}</span>
</button> </button>
<button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="ep-edit-save" v-has="['asset_endpoint_save', 'project_endpoint_save']"> <button @click="save" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" id="ep-edit-save" v-has="['asset_endpoint_save', 'project_endpoint_save']" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
@@ -344,6 +344,8 @@
}, },
//保存endpoint //保存endpoint
save() { save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.endpointForm.validate((valide=>{ this.$refs.endpointForm.validate((valide=>{
if(valide){ if(valide){
this.editEndpoint.param = this.paramToJson(this.editEndpoint.paramObj); this.editEndpoint.param = this.paramToJson(this.editEndpoint.paramObj);
@@ -351,6 +353,7 @@
let requestData = []; let requestData = [];
requestData.push(this.editEndpoint); requestData.push(this.editEndpoint);
this.$put('endpoint', requestData).then(response => { this.$put('endpoint', requestData).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true); this.esc(true);
@@ -359,6 +362,7 @@
} }
}); });
}else{ }else{
this.prevent_opt.save=false;
return false; return false;
} }
})) }))
@@ -366,12 +370,15 @@
//删除endpoint //删除endpoint
del() { del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), { this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"), confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"), cancelButtonText: this.$t("tip.no"),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$delete("endpoint?ids=" + this.editEndpoint.id).then(response => { this.$delete("endpoint?ids=" + this.editEndpoint.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) { if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true); this.esc(true);
@@ -379,6 +386,8 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}); });
}).catch(()=>{
this.prevent_opt.save=false;
}); });
}, },
// endpoint弹框的asset子弹框顶部搜索条件选中事件 // endpoint弹框的asset子弹框顶部搜索条件选中事件

View File

@@ -39,8 +39,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<button @click="resetForm('basicForm','basic')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('overall.reset')}}</button> <button
<button @click="saveSetInfo('basic','basicForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_basic_save'">{{$t('overall.submit')}}</button> @click="resetForm('basicForm','basic')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button"
:disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}"
>{{$t('overall.reset')}}</button>
<button @click="saveSetInfo('basic','basicForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_basic_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -86,8 +89,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<button @click="resetForm('emailForm','email')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('overall.reset')}}</button> <button @click="resetForm('emailForm','email')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('overall.reset')}}</button>
<button :class="{'nz-btn-disabled':email.email_enable == 'off'}" :disabled="email.email_enable == 'off'" @click="testSetInfo('email','emailForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('config.system.email.testConnection')}}</button> <button :class="{'nz-btn-disabled':email.email_enable == 'off','nz-btn-disabled':prevent_opt.save}" :disabled="email.email_enable == 'off' || prevent_opt.save" @click="testSetInfo('email','emailForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('config.system.email.testConnection')}}</button>
<button @click="saveSetInfo('email','emailForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_email_save'">{{$t('overall.submit')}}</button> <button @click="saveSetInfo('email','emailForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_email_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -99,7 +102,7 @@
<el-input-number v-model="terminal.max_terminal_num" controls-position="right" :min="1" :max="50"></el-input-number> <el-input-number v-model="terminal.max_terminal_num" controls-position="right" :min="1" :max="50"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<button @click="saveSetInfo('terminal','terminalForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_terminal_save'">{{$t('overall.submit')}}</button> <button @click="saveSetInfo('terminal','terminalForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_terminal_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -130,8 +133,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<button @click="resetForm('ldapForm','ldap')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('overall.reset')}}</button> <button @click="resetForm('ldapForm','ldap')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('overall.reset')}}</button>
<button @click="testSetInfo('ldap','ldapForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button">{{$t('config.system.email.testConnection')}}</button> <button @click="testSetInfo('ldap','ldapForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new" type="button" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('config.system.email.testConnection')}}</button>
<button @click="saveSetInfo('ldap','ldapForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_ldap_save'">{{$t('overall.submit')}}</button> <button @click="saveSetInfo('ldap','ldapForm')" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_ldap_save'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.submit')}}</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -325,7 +328,7 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<button @click="resetSys()" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_reset_reset'">{{$t('overall.reset')}}</button> <button @click="resetSys()" class="nz-btn nz-btn-size-normal-new nz-btn-style-normal-new" type="button" v-has="'system_reset_reset'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.reset')}}</button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -561,6 +564,8 @@
}) })
}, },
saveSetInfo:function(type,formName){ saveSetInfo:function(type,formName){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
let param={}; let param={};
@@ -571,6 +576,7 @@
postParam[type][key]=postParam[type][key]+''; postParam[type][key]=postParam[type][key]+'';
} }
this.$put('/sysConfig',postParam).then(response=>{ this.$put('/sysConfig',postParam).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
// this.resetForm(formName); // this.resetForm(formName);
@@ -581,10 +587,15 @@
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}) })
}else{
this.prevent_opt.save=true;
return false
} }
}); });
}, },
testSetInfo:function(type,formName){ testSetInfo:function(type,formName){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
let param={}; let param={};
@@ -595,16 +606,22 @@
postParam[type][key]=postParam[type][key]+''; postParam[type][key]=postParam[type][key]+'';
} }
this.$put('/sysConfig',postParam).then(response=>{ this.$put('/sysConfig',postParam).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.testSuccess")}); this.$message({duration: 2000, type: 'success', message: this.$t("tip.testSuccess")});
}else{ }else{
this.$message.error(response.msg); this.$message.error(response.msg);
} }
}) })
}else{
this.prevent_opt.save=false;
return false
} }
}); });
}, },
resetSys:function(){ resetSys:function(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
let $temp=this; let $temp=this;
this.$prompt(this.$t('config.system.reset.pwdTip'), this.$t('config.system.reset.promptTitle'), { this.$prompt(this.$t('config.system.reset.pwdTip'), this.$t('config.system.reset.promptTitle'), {
confirmButtonText: this.$t('config.system.reset.yes'), confirmButtonText: this.$t('config.system.reset.yes'),
@@ -615,12 +632,15 @@
$temp.$refs['resetForm'].validate(valid=>{ $temp.$refs['resetForm'].validate(valid=>{
if(valid){ if(valid){
$temp.$put('/sysConfig/reset',$temp.reset).then(response=>{ $temp.$put('/sysConfig/reset',$temp.reset).then(response=>{
$temp.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
$temp.$message({duration: 2000, type: 'success', message: this.$t("tip.resetSuccess")}); $temp.$message({duration: 2000, type: 'success', message: this.$t("tip.resetSuccess")});
}else{ }else{
$temp.$message.error(response.msg); $temp.$message.error(response.msg);
} }
}) })
}else{
$temp.prevent_opt.save=false;
} }
}) })
}).catch(() => { }).catch(() => {
@@ -721,9 +741,12 @@
}, },
// link add // link add
linkAdd(){ linkAdd(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs['linkTempForm'].validate((valid) => { this.$refs['linkTempForm'].validate((valid) => {
if (valid) { if (valid) {
this.$post('/link',this.linkTemp).then(response=>{//新增link this.$post('/link',this.linkTemp).then(response=>{//新增link
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
this.linkTemp={name:'',url:''}; this.linkTemp={name:'',url:''};
this.linkAddCallBack(); this.linkAddCallBack();
@@ -733,6 +756,7 @@
} }
}) })
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });
@@ -751,6 +775,8 @@
}, },
// link update // link update
linkUpdate(item){ linkUpdate(item){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs['linkForm'+item.id][0].validate((valid) => { this.$refs['linkForm'+item.id][0].validate((valid) => {
if (valid) { if (valid) {
let params={ let params={
@@ -759,6 +785,7 @@
url:item.url, url:item.url,
}; };
this.$put('/link',params).then(response=>{ this.$put('/link',params).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
let index=this.link.findIndex((item1)=>item.id==item1.id); let index=this.link.findIndex((item1)=>item.id==item1.id);
this.$set(this.link,index,{...this.link[index],isEdit:false}); this.$set(this.link,index,{...this.link[index],isEdit:false});
@@ -770,6 +797,7 @@
} }
}) })
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });
@@ -782,7 +810,10 @@
}, },
// link del // link del
linkDel(item){ linkDel(item){
if(this.prevent_opt.query){ return } ;
this.prevent_opt.query=true;
this.$delete('/link?ids='+item.id).then((response)=>{ this.$delete('/link?ids='+item.id).then((response)=>{
this.prevent_opt.query=false;
if(response.code == 200){ if(response.code == 200){
this.link=this.link.filter((item1)=>item.id!==item1.id); this.link=this.link.filter((item1)=>item.id!==item1.id);
this.linkReserved=this.linkReserved.filter((item1)=>item.id!==item1.id); this.linkReserved=this.linkReserved.filter((item1)=>item.id!==item1.id);
@@ -804,9 +835,12 @@
}, },
// link add // link add
notificationAdd(){ notificationAdd(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs['notificationTempForm'].validate((valid) => { this.$refs['notificationTempForm'].validate((valid) => {
if (valid) { if (valid) {
this.$post('/alert/script',this.notificationTemp).then(response=>{//新增link this.$post('/alert/script',this.notificationTemp).then(response=>{//新增notification
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
this.notificationTemp={name:'',filePath:''}; this.notificationTemp={name:'',filePath:''};
this.notificationAddCallBack(); this.notificationAddCallBack();
@@ -816,6 +850,7 @@
} }
}) })
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });
@@ -834,6 +869,8 @@
}, },
// link update // link update
notificationUpdate(item){ notificationUpdate(item){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs['notificationForm'+item.id][0].validate((valid) => { this.$refs['notificationForm'+item.id][0].validate((valid) => {
if (valid) { if (valid) {
let params={ let params={
@@ -842,6 +879,7 @@
filePath:item.filePath, filePath:item.filePath,
}; };
this.$put('/alert/script',params).then(response=>{ this.$put('/alert/script',params).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){ if(response.code == 200){
let index=this.notification.findIndex((item1)=>item.id==item1.id); let index=this.notification.findIndex((item1)=>item.id==item1.id);
this.$set(this.notification,index,{...this.notification[index],isEdit:false}); this.$set(this.notification,index,{...this.notification[index],isEdit:false});
@@ -853,6 +891,7 @@
} }
}) })
} else { } else {
this.prevent_opt.save=false;
return false; return false;
} }
}); });
@@ -865,7 +904,10 @@
}, },
// link del // link del
notificationDel(item){ notificationDel(item){
if(this.prevent_opt.query){ return } ;
this.prevent_opt.query=true;
this.$delete('/alert/script?ids='+item.id).then((response)=>{ this.$delete('/alert/script?ids='+item.id).then((response)=>{
this.prevent_opt.query=false;
if(response.code == 200){ if(response.code == 200){
this.notification=this.notification.filter((item1)=>item.id!==item1.id); this.notification=this.notification.filter((item1)=>item.id!==item1.id);
this.notificationReserved=this.notificationReserved.filter((item1)=>item.id!==item1.id); this.notificationReserved=this.notificationReserved.filter((item1)=>item.id!==item1.id);