diff --git a/nezha-fronted/src/assets/css/main.css b/nezha-fronted/src/assets/css/main.css index da97c5906..46b9e57e6 100644 --- a/nezha-fronted/src/assets/css/main.css +++ b/nezha-fronted/src/assets/css/main.css @@ -55,6 +55,19 @@ html { .right-child-box .line-100 { background: #DCDFE6; } +.width-50 { + width: 50% !important; +} +.width-100 { + width: 100% !important; +} +.height-50 { + height: 50% !important; +} +.height-100 { + height: 100% !important; +} + /* begin--按钮组件*/ .nz-btn { border-radius: 4px; @@ -72,6 +85,7 @@ html { font-size: 12px; line-height: 18px; padding: 2px 12px; + font-weight: 500; } .nz-btn.nz-btn-style-normal { /* 蓝色按钮 */ background-color: #16b; @@ -89,10 +103,10 @@ html { color: #444; text-shadow: 0 1px 1px rgba(255,255,255,.75); } -.nz-btn.nz-btn-size-small.nz-btn-style-square { /* 单图标无文字的情况下使用*/ +.nz-btn.nz-btn-size-small.nz-btn-style-square { /* 单图标时是个正方形*/ padding: 2px 5px; } -.nz-btn.nz-btn-size-normal.nz-btn-style-square { /* 单图标无文字的情况下使用*/ +.nz-btn.nz-btn-size-normal.nz-btn-style-square { /* 单图标时是个正方形*/ padding: 4px 6px; } .nz-btn.nz-btn-style-light:hover:not(.nz-btn-disabled) { @@ -120,6 +134,25 @@ html { border-top-left-radius: 0; } /* end--按钮组件*/ + +/* begin--el-input扩展 */ +.input-x-mini .el-input__inner { + height: 24px; + line-height: 24px; + padding: 0 5px; + font-size: 12px; +} + +.nz-input-group-prepend { + border-radius: 4px 0 0 4px; +} +.nz-input-group-middle, .nz-input-group-middle .el-input__inner { + border-radius: 0; +} +.nz-input-group-append { + border-radius: 0 4px 4px 0; +} +/* end--el-input扩展 */ /* end--通用*/ /* begin--左侧列表*/ @@ -270,15 +303,15 @@ html { height: calc(100% - 100px); } .right-box-add-endpoint { - width: 820px; + width: 840px; height: calc(100% - 100px); } /* begin--右侧弹框--顶部按钮*/ .right-box-top-btns { text-align: center; float: right; - padding-right: 20px; - padding-top: 5px; + padding-right: 10px; + padding-top: 8px; } /* end--右侧弹框--顶部按钮*/ @@ -300,6 +333,9 @@ html { .right-box-form { width: calc(100% - 20px); } +.right-box-add-endpoint .right-box-form { + height: 100%; +} .right-box-form .el-form-item { margin-bottom: 15px; } @@ -314,8 +350,11 @@ html { .right-box-form .el-form-item__content { line-height: 32px; } +.right-box-form-box .el-scrollbar__view { + height: 100%; +} .right-box-form-row { - margin-top: 16px; + margin-top: 22px; } .right-box-form-content { line-height: 32px; @@ -448,16 +487,9 @@ html { } /* end--右侧弹框--底部按钮*/ /* end--右侧弹框*/ + /* begin--endpoint->子弹框asset搜索框前缀和后缀*/ .right-sub-box .el-input-group__append, .right-sub-box .el-input-group__prepend, .assets-box .el-input-group__append, .assets-box .el-input-group__prepend { - background-color: #656565; - color: white; - vertical-align: middle; - display: table-cell; - position: relative; - padding: 0 8px; - border: none; - font-size: 13px; } /* end--endpoint->子弹框asset搜索框前缀和后缀*/ diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index abcfde494..f5c40012c 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -205,7 +205,7 @@ --> - + @@ -428,9 +428,6 @@ this.$refs.projectBox.show(true); this.editProject = Object.assign({}, p); }, - projectReload() { - this.getProjectList(); - }, logout() { this.$get('logout'); this.jumpTo('login'); @@ -449,7 +446,7 @@ }, computed: { projectListReloadWatch() { - return this.$store.state.projectListReload; + return this.$store.state.projectListChange; }, getIdcData() { return this.$store.state.assetData.idcData @@ -463,10 +460,7 @@ deep: true, }, projectListReloadWatch(n, o) { - if (n) { - this.getProjectList(); - this.$store.commit('projectListChange', false); - } + this.getProjectList(); } } } diff --git a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue index 5d5a7eacf..5b2f62064 100644 --- a/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue +++ b/nezha-fronted/src/components/common/rightBox/addEndpointBox.vue @@ -3,18 +3,12 @@
-
-
- -
- {{$t('overall.esc')}} -
-
-
- -
- {{$t('overall.save')}} -
+ +
@@ -23,126 +17,122 @@ -
- -
-
{{$t("project.project.project")}}
-
+ + + + -
-
- -
-
{{$t("project.module.module")}}
-
+ + + -
-
- -
-
- -
{{$t('asset.asset')}}
- - - - - - - - -
-
-
IP
-
SN
-
-
-
-
-
-
{{item.host}}
-
{{item.sn}}
+ + +
+
+ +
{{$t('asset.asset')}}
+ + + -
- -
- -
- -
-
{{$t('project.endpoint.moduleParameter')}}:
- - -
-
{{item.key}}={{item.value}}
+ + + +
+
+
IP
+
SN
- - - - {{$t('overall.cover')}} +
+
+
+
+
{{item.host}}
+
{{item.sn}}
+
+
+
+
- -
- - - - +
+ +
+
{{$t('project.endpoint.moduleParameter')}}:
+ + - + + + + + +
+ + All: {{this.endpointList.length}} +
-
-
- + - -
-
{{$t('overall.cancel')}}
{{$t('overall.create')}}
-
- +
- + = - - + +
@@ -221,6 +206,15 @@ }, data() { return { + rules: { + projectId: [ + {required: true, message: this.$t('validate.required'), trigger: 'change'} + ], + moduleId: [ + {required: true, message: this.$t('validate.required'), trigger: 'change'} + ], + }, + endpointForm: {projectId: '', moduleId: '', endpointList:[]}, currentModuleCopy: {}, tempParamObj: [], tempEndpoint: {}, @@ -268,6 +262,7 @@ show(show) { this.rightBox.show = show; this.currentModuleCopy = JSON.parse(JSON.stringify(this.currentModule)); //打开弹框时将currentModule还原 + this.endpointForm = {projectId: '', moduleId: '', endpointList:[]} }, //子弹框控制 obj: module或endpoint对象 type:1module2endpoint @@ -330,9 +325,11 @@ //编辑endpoint toEditEndpoint(endpoint) { + console.info(1) endpoint.isEdit = true; }, editEndpoint(endpoint) { + console.info(2) endpoint.isEdit = false; }, @@ -396,6 +393,8 @@ changeProject(project) { this.currentModuleCopy = {}; + this.endpointForm.moduleId = ''; + this.endpointForm.projectId = project.id; this.editParamBox.show = false; this.tempParamObj = []; this.endpointList = []; @@ -403,6 +402,7 @@ }, changeModule(module) { + this.endpointForm.moduleId = module.id; this.editParamBox.show = false; this.tempParamObj = []; }, @@ -469,15 +469,23 @@ //保存endpoint save() { - this.$post('endpoint', this.endpointList).then(response => { - if (response.code === 200) { - this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); - this.esc(); - this.$emit("reload"); + this.endpointForm.projectId = this.currentProject.id; + this.endpointForm.moduleId = this.currentModuleCopy.id; + this.$refs.addEndpointForm.validate((valid) => { + if (valid) { + this.$post('endpoint', this.endpointList).then(response => { + if (response.code === 200) { + this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); + this.esc(); + this.$emit("reload"); + } else { + this.$message.error(response.msg); + } + }); } else { - this.$message.error(response.msg); + return false; } - }); + }) }, //覆盖endpoint的port/path/param @@ -522,6 +530,14 @@ this.endpointList = []; } }, + computed: { + projectListReloadWatch() { + return this.$store.state.projectListChange; + }, + moduleListReloadWatch() { + return this.$store.state.moduleListChange; + }, + }, created() { this.getProjectList(); this.getAssetList(); @@ -530,8 +546,17 @@ currentProject(n, o) { this.getModuleList(n.id); }, - currentModule(n, o) { - this.currentModuleCopy = JSON.parse(JSON.stringify(n)); + currentModule: { + immediate: true, + handler(n, o) { + this.currentModuleCopy = JSON.parse(JSON.stringify(n)); + } + }, + projectListReloadWatch(n, o) { + this.getProjectList(); + }, + moduleListReloadWatch(n, o) { + this.getModuleList(this.currentProject.id); } } } @@ -566,6 +591,7 @@ .param-box { height: 200px; overflow: auto; + border: none; } .param-box-row { padding: 7px 0 0 0; @@ -580,45 +606,17 @@ } .param-box-row-eq { display: inline-block; - width: 18px; + width: 14px; text-align: center; height: 22px; line-height: 22px; color: #c4c7cF; } - .param-box-row-symbol:first-of-type { - font-size: 18px; - color: #bbbbbb; - text-align: center; - display: inline-block; - position: absolute; - top: 7px; - right: 34px; - cursor: pointer; - } - .param-box-row-symbol:last-of-type { - font-size: 12px; - color: #bbbbbb; - border: 1px solid #bbbbbb; - text-align: center; - height: 12px; - width: 14px; - display: inline-block; - position: absolute; - top: 12px; - left: 135px; - cursor: pointer; - } - .param-box-row-symbol>i { - position: absolute; - top: 1px; - right: 1px; - } /* end--param*/ /* begin--小盒子*/ .right-child-boxes { - height: calc(100% - 279px); + height: calc(100% - 196px); position: relative; } .endpoint-to-right-symbol { @@ -674,12 +672,12 @@ display: inline-block; } .module-info-port { - width: 55px; - right: 210px; + width: 53px; + right: 209px; } .module-info-param { - width: 88px; - right: 118px; + width: 89px; + right: 116px; } .module-info-path { width: 60px; @@ -690,11 +688,7 @@ } .right-child-box .module-info-cover { right: 4px; - height: 24px; - padding: 5px 5px; - background: #656565; - color: white; - border-radius: 4px; + padding: 2px 4px; } .endpoints-box-endpoints { border-radius: 4px; @@ -714,49 +708,57 @@ height: 225px; position: fixed; z-index: 2; - padding: 0 0 0 10px; + padding: 0; } /* begin--搜索框*/ - .endpoint-asset-prepend { - border-radius: 4px 0 0 4px; + .endpoint-asset-search { + display: inline-block; + float: right; + padding: 7px 8px 0 0; + position: relative; } - .endpoint-asset-label { - line-height: 26px; - height: 26px; - } - .endpoint-asset-dropdown { + .endpoint-asset-search-dropdown { position: absolute; - top: 27px; - background-color: #656565; + top: 34px; + background-color: #444; border-radius: 4px; - width: 52px; + width: 44px; left: 0; } - .endpoint-asset-dropdown-item { + .endpoint-asset-search-dropdown-item { text-align: center; line-height: 22px; height: 22px; cursor: default; + color: white; + font-size: 12px; } .endpoint-asset-label-txt { display: inline-block; width: 19px; text-align: center; } - .endpoint-asset-dropdown-item:first-of-type { + .endpoint-asset-search-dropdown-item:first-of-type { border-radius: 4px 4px 0 0; } - .endpoint-asset-dropdown-item:last-of-type { + .endpoint-asset-search-dropdown-item:last-of-type { border-radius: 0 0 4px 4px; } - .endpoint-asset-dropdown-item:hover { - background-color: #3a8ee6; + .endpoint-asset-search-dropdown-item:hover { + background-color: #222; + color: #ff9900; + } + .endpoint-asset-search-input { + display: inline-block; + width: 100px; + vertical-align: middle; } /* end--搜索框*/ + /* begin--table*/ .endpoint-sub-table { padding-top: 15px; - height: 100%; + height: calc(100% - 45px); } .line-100 { margin-bottom: 3px; @@ -796,7 +798,7 @@ font-size: 15px; position: relative; overflow: auto; - height: calc(100% - 95px); + height: calc(100% - 34px); } .endpoint-sub-table-body-dialog { width: 100%; @@ -806,20 +808,13 @@ opacity: 0.2; } .endpoints-clear-btn { - margin: 6px 0 0 10px; + margin: 6px 0 0 7px; } /* end--table*/ /* end--子弹框*/