NEZ-884 fix: 修复 system reset 功能报错

This commit is contained in:
@changcode
2021-07-30 09:54:02 +08:00
parent 614a9c183f
commit 036c45bfb3
4 changed files with 33 additions and 3 deletions

View File

@@ -556,6 +556,7 @@ const cn = {
confirmExpired: '确认失效吗?',
confirmOvertime: '确定关闭吗?', // Are you sure you want to delete?
killTerm: '确认关闭 terminal 吗?',
resetPrompt: '确认重置吗?',
confirmBatchDelete: '确定删除这{0}条数据吗?',
assetConfirmDelete: '关联的Endpoint和告警将会被删除确认删除吗',
yes: '是',

View File

@@ -563,6 +563,7 @@ const en = {
confirmExpired: 'Are you sure you want to expired?',
confirmOvertime: "Are you sure it's off?",
killTerm: 'Are you sure you want to kill terminal?',
resetPrompt: 'Are you sure to reset?',
confirmBatchDelete: 'Are you sure to delete these {0} pieces of data',
assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?', // Related endpoints and alerts will be removed, are you sure you want to delete this asset?
yes: 'Yes', // "是"

View File

@@ -152,7 +152,7 @@
</template>
</template>
<template v-else-if="label.type.toUpperCase() === assetConstants.labelTypeData.EMAIL">
<input v-model="label.value[0]" size="small"></input>
<input v-model="label.value[0]" size="small" />
</template>
</template>
</el-form-item>

View File

@@ -225,7 +225,7 @@
<!-- </div>-->
<el-select v-model="reset.type" multiple>
<template v-for="item in resetOptions" >
<el-option :label="item.label" :value="item.value"></el-option>
<el-option :label="item.label" :value="item.value" :key="item.label"></el-option>
</template>
</el-select>
</el-form-item>
@@ -233,7 +233,7 @@
<el-input id="system-reset-pin" v-model="reset.pin" type="password"></el-input>
</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'" :disabled="prevent_opt.save" :class="{'nz-btn-disabled':prevent_opt.save}">{{$t('overall.reset')}}</button>
<el-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')}}</el-button>
</el-form-item>
</el-form>
</div>
@@ -801,6 +801,34 @@ export default {
const minute = offsetHour == 0 && offsetMinute == 0 ? '' : (offsetMinute == 0 ? ':00' : (Math.abs(offsetMinute) > 9 ? ':' + Math.abs(offsetMinute) : ':0' + Math.abs(offsetMinute)))
return 'UTC' + hour + minute
},
resetSys () {
if (this.prevent_opt.save) { return } ;
this.prevent_opt.save = true
const resetParmas = {
type: this.reset.type,
pin: this.reset.pin
}
if (resetParmas.type && resetParmas.pin) {
this.$confirm(this.$t('tip.resetPrompt'), {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$put('/sys/config/reset', resetParmas).then(response => {
if (response.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.resetSuccess') })
this.reset.type = ''
this.reset.pin = ''
} else {
this.$message.error(response.msg)
}
})
})
} else {
this.prevent_opt.save = false
return false
}
}
},
mounted () {