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;
color: $btn-normal-txt-color-new;
//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 */
background: $btn-error-background-color-hover-new;
color: $btn-error-txt-color-new;
//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 */
border: 1px solid $btn-light-border-color-hover-new;
@@ -324,13 +324,13 @@ li{
background: $btn-normal-background-color-active-new;
color: $btn-normal-txt-color-new;
//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' */
background: $btn-error-background-color-active-new;
color: $btn-error-txt-color-new;
//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*/
border: 1px solid $btn-light-border-color-active-new;

View File

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

View File

@@ -12,7 +12,7 @@
<!--<span class="edit-topology-remove" @click="lineDel">Remove</span>-->
</span>
<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>
</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:{// 保存拓扑图数据
saveTopology(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$emit('topologyLoad');
let nodes=this.formatNodes([...this.nodesArray]);
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.prevent_opt.save=false;
if(res.code===200){
this.$message({
message: this.$t("tip.saveSuccess"),
@@ -312,6 +315,7 @@
this.$emit('reload');
}
}).catch(res=>{
this.prevent_opt.save=false;
this.$message({
message: res.msg,
type: 'error'

View File

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

View File

@@ -414,7 +414,7 @@
assetListHalf:false,
typeList: [],
dcList: [],
modelList: []
modelList: [],
}
},
methods: {
@@ -514,6 +514,7 @@
/*关闭弹框*/
esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh);
},
@@ -848,6 +849,8 @@
//保存endpoint
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.endpoint.projectId = this.currentProjectCopy.id;
this.endpoint.moduleId = this.currentModuleCopy.id;
if (this.endpointList.length == 0) {
@@ -864,6 +867,7 @@
this.$refs.addEndpoint.validate((valid) => {
if (valid) {
this.$post('endpoint', endpointList).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -872,6 +876,7 @@
}
});
} else {
this.prevent_opt.save=false;
return false;
}
})
@@ -894,12 +899,15 @@
//删除endpoint
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete("endpoint?ids=" + this.endpoint.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true);
@@ -907,6 +915,8 @@
this.$message.error(response.msg);
}
});
}).catch(()=>{
this.prevent_opt.save=false;
});
},
// 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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -202,15 +202,19 @@
this.esc(false);
},
esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh);
},
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.editAlertRule.expr = this.expressions[0];
this.$refs.alertRuleForm.validate((valid) => {
if (valid) {
this.editAlertRule.receiver = this.editAlertRule.receiverShow.join(",");
if (this.editAlertRule.id) {
this.$put('alert/rule', this.editAlertRule).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -219,6 +223,7 @@
}
});
} else {
this.prevent_opt.save=false;
this.$post('alert/rule', this.editAlertRule).then(response => {
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
@@ -229,17 +234,21 @@
});
}
} else {
this.prevent_opt.save=false;
return false;
}
})
},
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete("alert/rule?ids=" + this.editAlertRule.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true);
@@ -247,6 +256,8 @@
this.$message.error(response.msg);
}
})
}).catch(()=>{
this.prevent_opt.save=false;
});
},
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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -304,6 +304,7 @@
},
/*关闭弹框*/
esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh);
},
modelReload() {
@@ -527,6 +528,7 @@
},
setAccountValidResult(result, protocol) {
this.accountValidResult = result;
this.prevent_opt.save=false;
let index = this.errorProtocol.indexOf(protocol);
if (result) {
index != -1 ? this.errorProtocol.splice(index, 1) : "";
@@ -535,11 +537,14 @@
}
},
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.prevent_opt.save=false;
this.$delete("asset?ids=" + this.editAsset.id).then(response => {
if (response.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")});
@@ -548,12 +553,16 @@
this.$message.error(response.msg);
}
})
}).catch(()=>{
this.prevent_opt.save=false;
});
},
changeProtocolType(type) {
this.accountType = type;
},
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
if(this.locationInfo) {
if(this.locationInfo.idc){
this.editAsset.idcId = this.locationInfo.idc.id;
@@ -581,6 +590,7 @@
if (valid && this.accountValidResult) {
if (this.editAsset.id) {
this.$put('asset', this.editAsset).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -593,6 +603,7 @@
this.$refs.accountConfigBox[0].validateAccount();
}
this.$post('asset', this.editAsset).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -602,6 +613,7 @@
});
}
} else {
this.prevent_opt.save=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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -410,6 +410,7 @@
},
/*关闭弹框*/
esc(refresh){
this.prevent_opt.save=false;
this.$emit("close",refresh);
},
modelReload(){
@@ -630,6 +631,8 @@
});
},
save(){
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
if(this.locationInfo){
if(this.locationInfo.idc){
this.editAsset.idcId=this.locationInfo.idc.id;
@@ -662,6 +665,7 @@
this.editAsset.assetIds.push(item.id);
});
this.$put('/asset/batch',this.editAsset).then(res=>{
this.prevent_opt.save=false;
if(res.code===200){
this.$message({duration:2000,type:'success',message:this.$t("tip.saveSuccess")});
this.esc(true);
@@ -670,6 +674,7 @@
}
});
}else{
this.prevent_opt.save=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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -69,14 +69,18 @@
this.esc(false);
},
esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh);
},
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.cabinetForm.validate((valid => {
if(valid){
this.editCabinet.idcId = this.currentDc.id;
if (this.editCabinet.id) {
this.$put('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -86,6 +90,7 @@
})
} else {
this.$post('cabinet', this.editCabinet).then(res => {
this.prevent_opt.save=false;
if (res.code === 200) {
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -95,17 +100,21 @@
})
}
}else{
this.prevent_opt.save=false;
return false;
}
}))
},
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete('/cabinet?ids=' + this.editCabinet.id).then(response=>{
this.prevent_opt.save=false;
if(response.code == 200){
this.$message({duration: 2000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -113,6 +122,8 @@
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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -120,6 +120,7 @@
methods: {
/*关闭弹框*/
esc(refresh) {
this.prevent_opt.save=false;
this.$emit("close", refresh);
},
clickOutside() {
@@ -132,6 +133,8 @@
/*保存*/
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.dcForm.validate((valid) => {
if (valid) {
if (this.editDc.id) {
@@ -147,6 +150,7 @@
}
this.$put('idc', param).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -166,6 +170,7 @@
param.latitude=null;
}
this.$post('idc', param).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -175,18 +180,22 @@
});
}
} else {
this.prevent_opt.save=false;
return false;
}
});
},
/*删除*/
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete("idc?ids=" + this.editDc.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true);
@@ -194,6 +203,8 @@
this.$message.error(response.msg);
}
});
}).catch(()=>{
this.prevent_opt.save=false;
});
},
// 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">
<span>{{$t('overall.cancel')}}</span>
</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>
</button>
</div>
@@ -344,6 +344,8 @@
},
//保存endpoint
save() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$refs.endpointForm.validate((valide=>{
if(valide){
this.editEndpoint.param = this.paramToJson(this.editEndpoint.paramObj);
@@ -351,6 +353,7 @@
let requestData = [];
requestData.push(this.editEndpoint);
this.$put('endpoint', requestData).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.esc(true);
@@ -359,6 +362,7 @@
}
});
}else{
this.prevent_opt.save=false;
return false;
}
}))
@@ -366,12 +370,15 @@
//删除endpoint
del() {
if(this.prevent_opt.save){ return } ;
this.prevent_opt.save=true;
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
cancelButtonText: this.$t("tip.no"),
type: 'warning'
}).then(() => {
this.$delete("endpoint?ids=" + this.editEndpoint.id).then(response => {
this.prevent_opt.save=false;
if (response.code === 200) {
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true);
@@ -379,6 +386,8 @@
this.$message.error(response.msg);
}
});
}).catch(()=>{
this.prevent_opt.save=false;
});
},
// endpoint弹框的asset子弹框顶部搜索条件选中事件

View File

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