diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 24d6e842e..dbbc17ab5 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -1,6 +1,7 @@ import PerfectScrollbar from "perfect-scrollbar"; import {getChart} from "./common"; import MessageBox from "element-ui/packages/message-box/src/main"; +import vuex from 'vuex' import i18n from "../i18n"; /*弹窗点击外部后关闭*/ const exceptClassName = ["config-dropdown", "nz-pop", "el-picker", "chart-box-dropdown", 'metric-dropdown', 'el-cascader__dropdown', "asset-dropdown", "no-style-class", 'el-message-box','nz-dashboard-dropdown', "el-autocomplete-suggestion"]; //clickoutside排除的class(白名单) no-style-class:没有任何样式的class @@ -8,6 +9,7 @@ export const clickoutside = { // 初始化指令 bind(el, binding, vnode) { if(!binding.expression) return; + let unsavedChange = localStorage.getItem('nz-unnsaved-change'); let oldValue; try{ oldValue= JSON.parse(JSON.stringify(binding.value.obj)); @@ -33,7 +35,7 @@ export const clickoutside = { } if(oldValue){ let newValue = JSON.parse(JSON.stringify(binding.value.obj)); - if(!isEqual(oldValue,newValue)){ + if(unsavedChange=='on'&&!isEqual(oldValue,newValue)){ MessageBox.confirm(i18n.t("tip.confirmCancel"), { confirmButtonText: i18n.t("tip.yes"), cancelButtonText: i18n.t("tip.no"), @@ -69,7 +71,6 @@ export const clickoutside = { }, }; function isEqual (o1, o2) { - console.log(o1,o2) var isEqualForInner = function (obj1, obj2) { var o1 = obj1 instanceof Object; var o2 = obj2 instanceof Object; @@ -99,10 +100,11 @@ function isEqual (o1, o2) { export const cancelWithChange={ bind:function(el,binding){ if(!binding.value||!binding.value.obj) return; + let unsavedChange = localStorage.getItem('nz-unnsaved-change'); let oldValue = JSON.parse(JSON.stringify(binding.value.obj)); function domClick(e){ let newValue = JSON.parse(JSON.stringify(binding.value.obj)); - if(!isEqual(oldValue,newValue)){ + if(unsavedChange=='on'&&!isEqual(oldValue,newValue)){ MessageBox.confirm(i18n.t("tip.confirmCancel"), { confirmButtonText: i18n.t("tip.yes"), cancelButtonText: i18n.t("tip.no"), diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index e95a9c99d..73bdf4bff 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -586,7 +586,7 @@ const cn = { roles:{ roles:"角色", name:"名称", - remark:"备注", + description:"描述", option: '操作',//"操作" permission:"权限", menu:"菜单", @@ -743,6 +743,7 @@ const cn = { second:'秒', day:'天', maxSeries:'Query max series', + unsaved:'未保存提示' }, email: { email: "邮件", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 2007c740a..1a789e57c 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -589,7 +589,7 @@ const en = { roles:{ roles:"Roles", name:"Name", - remark:"Remark", + description:"Description", option: 'Operation',//"操作" permission:"Permission", menu:"Menu", @@ -747,6 +747,7 @@ const en = { second:'second', day:'day', maxSeries:'Query max series', + unsaved:'Unsaved tip' }, email:{ email:'Email', diff --git a/nezha-fronted/src/components/common/project/visNetwork.vue b/nezha-fronted/src/components/common/project/visNetwork.vue index a3342b406..9777a6d52 100644 --- a/nezha-fronted/src/components/common/project/visNetwork.vue +++ b/nezha-fronted/src/components/common/project/visNetwork.vue @@ -24,7 +24,7 @@
- diff --git a/nezha-fronted/src/components/common/rightBox/accountBox.vue b/nezha-fronted/src/components/common/rightBox/accountBox.vue index 3a946dc94..9dc3f798a 100644 --- a/nezha-fronted/src/components/common/rightBox/accountBox.vue +++ b/nezha-fronted/src/components/common/rightBox/accountBox.vue @@ -79,7 +79,7 @@ class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new"> {{$t('overall.cancel')}} - -
diff --git a/nezha-fronted/src/components/common/rightBox/alertConfigBox.vue b/nezha-fronted/src/components/common/rightBox/alertConfigBox.vue index b20304119..38d730210 100644 --- a/nezha-fronted/src/components/common/rightBox/alertConfigBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertConfigBox.vue @@ -111,7 +111,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/assetBox.vue b/nezha-fronted/src/components/common/rightBox/assetBox.vue index f963241b0..0b04ab97c 100644 --- a/nezha-fronted/src/components/common/rightBox/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/assetBox.vue @@ -154,7 +154,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/batchEditAsset.vue b/nezha-fronted/src/components/common/rightBox/batchEditAsset.vue index ae750e008..84f40d400 100644 --- a/nezha-fronted/src/components/common/rightBox/batchEditAsset.vue +++ b/nezha-fronted/src/components/common/rightBox/batchEditAsset.vue @@ -250,7 +250,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue index 017ebc4d9..21d9d623f 100644 --- a/nezha-fronted/src/components/common/rightBox/cabinetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/cabinetBox.vue @@ -36,7 +36,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/dcBox.vue b/nezha-fronted/src/components/common/rightBox/dcBox.vue index 3a1496eff..8c38bbe71 100644 --- a/nezha-fronted/src/components/common/rightBox/dcBox.vue +++ b/nezha-fronted/src/components/common/rightBox/dcBox.vue @@ -82,7 +82,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue b/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue index 83262f694..74b263a0b 100644 --- a/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue +++ b/nezha-fronted/src/components/common/rightBox/editEndpointBox.vue @@ -127,7 +127,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/mibBox.vue b/nezha-fronted/src/components/common/rightBox/mibBox.vue index 68fcd7d6e..5d8f192fb 100644 --- a/nezha-fronted/src/components/common/rightBox/mibBox.vue +++ b/nezha-fronted/src/components/common/rightBox/mibBox.vue @@ -51,7 +51,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/modelBox.vue b/nezha-fronted/src/components/common/rightBox/modelBox.vue index ee8cdd8d7..c3d8cef58 100644 --- a/nezha-fronted/src/components/common/rightBox/modelBox.vue +++ b/nezha-fronted/src/components/common/rightBox/modelBox.vue @@ -76,7 +76,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 7adf24ff6..7922d51b6 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -308,7 +308,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/panelBox.vue b/nezha-fronted/src/components/common/rightBox/panelBox.vue index 8a5433bc2..c34f47345 100644 --- a/nezha-fronted/src/components/common/rightBox/panelBox.vue +++ b/nezha-fronted/src/components/common/rightBox/panelBox.vue @@ -29,7 +29,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/projectBox.vue b/nezha-fronted/src/components/common/rightBox/projectBox.vue index 138ccd618..7fdc2d419 100644 --- a/nezha-fronted/src/components/common/rightBox/projectBox.vue +++ b/nezha-fronted/src/components/common/rightBox/projectBox.vue @@ -28,7 +28,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/promServerBox.vue b/nezha-fronted/src/components/common/rightBox/promServerBox.vue index f624630fc..45627f976 100644 --- a/nezha-fronted/src/components/common/rightBox/promServerBox.vue +++ b/nezha-fronted/src/components/common/rightBox/promServerBox.vue @@ -57,7 +57,7 @@ class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new"> {{$t('overall.cancel')}} - diff --git a/nezha-fronted/src/components/common/rightBox/roleBox.vue b/nezha-fronted/src/components/common/rightBox/roleBox.vue index 613c5449f..26a7858f1 100644 --- a/nezha-fronted/src/components/common/rightBox/roleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/roleBox.vue @@ -51,7 +51,7 @@ id="roles-esc"> {{$t('overall.cancel')}} - @@ -180,7 +180,9 @@ this.getMenus(); }, mounted() { - + if(this.$refs.menuTree&&this.editRole.menuIds&&this.editRole.menuIds.length>0){ + this.$refs.menuTree.setCheckedKeys(this.editRole.menuIds,true); + } }, watch: { //将prop里的user转为组件内部对象 diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index 2f8f4739c..c58c3219b 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -108,7 +108,7 @@ active-value="1" inactive-value="0" active-color="#ee9d3f" - :disabled="isCurrentUser(scope.row.username) || !hasButton('account_toEdit') || !hasButton('account_save') || (scope.row.username==='admin' && scope.row.userId==1)" + :disabled="isCurrentUser(scope.row.username) || !hasButton('account_toEdit') || !hasButton('account_toAdd') || (scope.row.username==='admin' && scope.row.userId==1)" @change="(val)=>{statusChange(scope.row)}"> diff --git a/nezha-fronted/src/components/page/config/dc.vue b/nezha-fronted/src/components/page/config/dc.vue index 50d65c3ed..75032412f 100644 --- a/nezha-fronted/src/components/page/config/dc.vue +++ b/nezha-fronted/src/components/page/config/dc.vue @@ -82,7 +82,7 @@ v-model="scope.row.state" active-value="ON" inactive-value="OFF" - :disabled="!hasButton('dc_toEdit') || !hasButton('dc_save')" + :disabled="!hasButton('dc_toEdit') || !hasButton('dc_toEdit')" active-color="#ee9d3f" @change="(val)=>{statusChange(scope.row)}" /> diff --git a/nezha-fronted/src/components/page/config/roles.vue b/nezha-fronted/src/components/page/config/roles.vue index f9ada3953..cabb43a46 100644 --- a/nezha-fronted/src/components/page/config/roles.vue +++ b/nezha-fronted/src/components/page/config/roles.vue @@ -158,7 +158,7 @@ prop: 'name', show: true, }, { - label: this.$t("config.roles.remark"), + label: this.$t("config.roles.description"), prop: 'remark', show: true, }, { diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index 2126c8166..ecc99fd93 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -38,6 +38,10 @@ + + + +