summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwangwenrui <[email protected]>2019-11-07 19:01:02 +0800
committerwangwenrui <[email protected]>2019-11-07 19:01:02 +0800
commit145f8990f0be3b3b89ebf0e5e16eb88446b6ddfe (patch)
tree433540516251ddf619b35d873d557e0d1f08f73f
parent91ae64f873d223502f0968e19e466e0c1d18fcb9 (diff)
1.监测告警添加文件上传
2.优化监测类别添加元数据操作 3.前后端bug修复 4.优化部分显示
-rw-r--r--nezha-admin/src/main/java/com/nis/common/utils/Constant.java5
-rw-r--r--nezha-admin/src/main/java/com/nis/modules/detect/controller/DeteWarnController.java16
-rw-r--r--nezha-admin/src/main/java/com/nis/modules/detect/service/DeteWarnInfoService.java7
-rw-r--r--nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteTypeInfoServiceImpl.java4
-rw-r--r--nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteWarnInfoServiceImpl.java27
-rw-r--r--nezha-admin/src/main/resources/mapper/detect/DeteWarnInfoDao.xml1
-rw-r--r--nezha-admin/src/main/resources/statics/css/addDetectType.css4
-rw-r--r--nezha-admin/src/main/resources/statics/css/main.css6
-rw-r--r--nezha-admin/src/main/resources/templates/js/modules/common/componets.js10
-rw-r--r--nezha-admin/src/main/resources/templates/js/modules/detect/addType.js96
-rw-r--r--nezha-admin/src/main/resources/templates/js/modules/detect/deteWarn.js127
-rw-r--r--nezha-admin/src/main/resources/templates/modules/common/template.html10
-rw-r--r--nezha-admin/src/main/resources/templates/modules/detect/addTypeTemplate.html306
-rw-r--r--nezha-admin/src/main/resources/templates/modules/detect/warnTemplate.html24
14 files changed, 441 insertions, 202 deletions
diff --git a/nezha-admin/src/main/java/com/nis/common/utils/Constant.java b/nezha-admin/src/main/java/com/nis/common/utils/Constant.java
index 087048a1..f866aec8 100644
--- a/nezha-admin/src/main/java/com/nis/common/utils/Constant.java
+++ b/nezha-admin/src/main/java/com/nis/common/utils/Constant.java
@@ -225,6 +225,11 @@ public class Constant {
public static final String DETE_DETEMETHOD_SNMP="2"; //snmp
public static final String DETE_DETEMETHOD_INNER="3"; //内置
+ //监测告警 回调方式
+ public static final String DETE_WARN_CALLBACK_SCRIPT="1";
+ public static final String DETE_WARN_CALLBACK_HTTP="2";
+ public static final String DETE_WARN_CALLBACK_NONE="0";
+
// 顶级节点组PID
public static final Long NODEGROUP_TOP_PID = 0L;
}
diff --git a/nezha-admin/src/main/java/com/nis/modules/detect/controller/DeteWarnController.java b/nezha-admin/src/main/java/com/nis/modules/detect/controller/DeteWarnController.java
index f8e85071..e48337e7 100644
--- a/nezha-admin/src/main/java/com/nis/modules/detect/controller/DeteWarnController.java
+++ b/nezha-admin/src/main/java/com/nis/modules/detect/controller/DeteWarnController.java
@@ -1,5 +1,6 @@
package com.nis.modules.detect.controller;
+import com.alibaba.fastjson.JSON;
import com.nis.common.exception.NZException;
import com.nis.common.smartvalidate.ValidateUtils;
import com.nis.common.utils.PageUtils;
@@ -14,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
@@ -57,7 +59,9 @@ public class DeteWarnController {
@PostMapping("/save")
@ApiOperation("新增告警配置")
@ResponseBody
- public R save(@RequestBody DeteWarnInfoEntity deteWarnInfoEntity) {
+ public R save(@RequestParam(value="deteWarnInfo",required = true) String jsonWarnInfo,@RequestParam(value="file",required = false) MultipartFile file) {
+ DeteWarnInfoEntity deteWarnInfoEntity= JSON.parseObject(jsonWarnInfo,DeteWarnInfoEntity.class);
+
ValidateUtils.is(deteWarnInfoEntity.getName()).notNull(RCode.WARN_NAME_ISNULL);
ValidateUtils.is(deteWarnInfoEntity.getDeteTypeId()).notNull(RCode.WARN_TYPE_ISNULL);
if(deteWarnInfoService.checkNameExists(deteWarnInfoEntity.getName(),null)){
@@ -89,6 +93,9 @@ public class DeteWarnController {
if(!deteWarnInfoService.checkCallbackContentIsValide(deteWarnInfoEntity)){
throw new NZException(RCode.WARN_CALLBACKCONTENT_ISNULL);
}
+ if(!deteWarnInfoService.checkCallbackScirptFileIsValide(deteWarnInfoEntity,file)){
+ throw new NZException(RCode.DETE_UPLOAD_FILE_ISNULL);
+ }
// if(!deteWarnInfoService.checkViewLevelValide(deteWarnInfoEntity.getViewLevel())){
// throw new NZException(RCode.VIEWLEVEL_INVALID);
// }
@@ -102,7 +109,7 @@ public class DeteWarnController {
}
- deteWarnInfoService.saveEntity(deteWarnInfoEntity);
+ deteWarnInfoService.saveEntity(deteWarnInfoEntity,file);
return R.ok();
}
@@ -112,12 +119,13 @@ public class DeteWarnController {
@PutMapping("/update")
@ResponseBody
@ApiOperation("修改告警配置")
- public R update(@RequestBody DeteWarnInfoEntity deteWarnInfoEntity) {
+ public R update(@RequestParam(value="deteWarnInfo",required = true) String jsonWarnInfo,@RequestParam(value="file",required = false) MultipartFile file) {
+ DeteWarnInfoEntity deteWarnInfoEntity=JSON.parseObject(jsonWarnInfo,DeteWarnInfoEntity.class);
ValidateUtils.is(deteWarnInfoEntity.getName()).notNull(RCode.WARN_NAME_ISNULL);
if(deteWarnInfoService.checkNameExists(deteWarnInfoEntity.getName(),deteWarnInfoEntity.getId())){
throw new NZException(RCode.WARN_NAME_EXISTS);
}
- deteWarnInfoService.updateEntity(deteWarnInfoEntity);
+ deteWarnInfoService.updateEntity(deteWarnInfoEntity,file);
return R.ok();
}
diff --git a/nezha-admin/src/main/java/com/nis/modules/detect/service/DeteWarnInfoService.java b/nezha-admin/src/main/java/com/nis/modules/detect/service/DeteWarnInfoService.java
index 298a5ff4..33f0bee3 100644
--- a/nezha-admin/src/main/java/com/nis/modules/detect/service/DeteWarnInfoService.java
+++ b/nezha-admin/src/main/java/com/nis/modules/detect/service/DeteWarnInfoService.java
@@ -3,13 +3,14 @@ package com.nis.modules.detect.service;
import com.nis.common.utils.PageUtils;
import com.nis.modules.detect.entity.DeteWarnInfoEntity;
import org.apache.commons.lang.StringUtils;
+import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
public interface DeteWarnInfoService extends DeteCommonService<DeteWarnInfoEntity> {
- void saveEntity(DeteWarnInfoEntity deteWarnInfoEntity);
+ void saveEntity(DeteWarnInfoEntity deteWarnInfoEntity,MultipartFile file);
- void updateEntity(DeteWarnInfoEntity deteWarnInfoEntity);
+ void updateEntity(DeteWarnInfoEntity deteWarnInfoEntity,MultipartFile file);
void deleteEntity(Long[] ids);
@@ -34,4 +35,6 @@ public interface DeteWarnInfoService extends DeteCommonService<DeteWarnInfoEntit
boolean checkCallbackContentIsValide(DeteWarnInfoEntity deteWarnInfoEntity);
boolean checkThresholdIsValide(DeteWarnInfoEntity deteWarnInfoEntity);
+
+ boolean checkCallbackScirptFileIsValide(DeteWarnInfoEntity deteWarnInfoEntity, MultipartFile file);
}
diff --git a/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteTypeInfoServiceImpl.java b/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteTypeInfoServiceImpl.java
index 38928c17..2b842a5c 100644
--- a/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteTypeInfoServiceImpl.java
+++ b/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteTypeInfoServiceImpl.java
@@ -152,9 +152,7 @@ public class DeteTypeInfoServiceImpl extends DeteCommonServiceImpl<DeteTypeInfoD
deteTypeInfo.setTableName(old.getTableName());
deteTypeInfo.setBuildIn(old.getBuildIn());//buildIn 字段不允许修改
if(Constant.DETE_DETEMETHOD_SCRIPT.equals(deteTypeInfo.getMethod())&&file!=null&&!file.isEmpty()){
- if(StringUtils.isNotBlank(old.getContent())){
- this.delUploadFile(old.getContent());//删除旧文件
- }
+ this.delUploadFile(old.getContent());//删除旧文件
String content=this.getUploadFileJson(file);
this.uploadFile(content,file);
deteTypeInfo.setContent(content);
diff --git a/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteWarnInfoServiceImpl.java b/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteWarnInfoServiceImpl.java
index bfa51fd9..fb53cc16 100644
--- a/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteWarnInfoServiceImpl.java
+++ b/nezha-admin/src/main/java/com/nis/modules/detect/service/impl/DeteWarnInfoServiceImpl.java
@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
@@ -47,11 +48,17 @@ public class DeteWarnInfoServiceImpl extends DeteCommonServiceImpl<DeteWarnInfoD
@Override
@Transactional(rollbackFor = Exception.class)
- public void saveEntity(DeteWarnInfoEntity deteWarnInfoEntity) {
+ public void saveEntity(DeteWarnInfoEntity deteWarnInfoEntity,MultipartFile file) {
Long userId = ShiroUtils.getUserId();
Date date = new Date();
deteWarnInfoEntity.setOperator(userId);
deteWarnInfoEntity.setOpTime(date);
+ if(Constant.DETE_WARN_CALLBACK_SCRIPT.equals(deteWarnInfoEntity.getCallbackType())){
+
+ String content=this.getUploadFileJson(file);
+ this.uploadFile(content,file);
+ deteWarnInfoEntity.setCallbackContent(content);
+ }
this.save(deteWarnInfoEntity);
Long deteTypeId = deteWarnInfoEntity.getDeteTypeId();
Long[] deteSetIds = deteWarnInfoEntity.getDeteSetIds();
@@ -85,11 +92,17 @@ public class DeteWarnInfoServiceImpl extends DeteCommonServiceImpl<DeteWarnInfoD
@Override
@Transactional(rollbackFor = Exception.class)
- public void updateEntity(DeteWarnInfoEntity deteWarnInfoEntity) {
+ public void updateEntity(DeteWarnInfoEntity deteWarnInfoEntity,MultipartFile file) {
Long userId = ShiroUtils.getUserId();
Date date = new Date();
deteWarnInfoEntity.setOperator(userId);
deteWarnInfoEntity.setOpTime(date);
+ if(Constant.DETE_WARN_CALLBACK_SCRIPT.equals(deteWarnInfoEntity.getCallbackType())&&file!=null&&!file.isEmpty()){
+
+ String content=this.getUploadFileJson(file);
+ this.uploadFile(content,file);
+ deteWarnInfoEntity.setCallbackContent(content);
+ }
this.updateById(deteWarnInfoEntity);
}
@@ -235,13 +248,21 @@ public class DeteWarnInfoServiceImpl extends DeteCommonServiceImpl<DeteWarnInfoD
}
public boolean checkCallbackContentIsValide(DeteWarnInfoEntity deteWarnInfoEntity){
- if(deteWarnInfoEntity.getCallbackType()!=null&& !"0".equals(deteWarnInfoEntity.getCallbackType())){
+ if(deteWarnInfoEntity.getCallbackType()!=null&& Constant.DETE_WARN_CALLBACK_HTTP.equals(deteWarnInfoEntity.getCallbackType())){
return StringUtils.isNotBlank(deteWarnInfoEntity.getCallbackContent());
}else{
return true;
}
}
+ public boolean checkCallbackScirptFileIsValide(DeteWarnInfoEntity deteWarnInfoEntity, MultipartFile file){
+ if(deteWarnInfoEntity.getCallbackType()!=null&& Constant.DETE_WARN_CALLBACK_SCRIPT.equals(deteWarnInfoEntity.getCallbackType())){
+ return file!=null&&!file.isEmpty();
+ }else{
+ return true;
+ }
+ }
+
@Override
public boolean checkThresholdIsValide(DeteWarnInfoEntity deteWarnInfoEntity) {
if(deteWarnInfoEntity.getTriggerType()!=null && "1".equals(deteWarnInfoEntity.getTriggerType())){
diff --git a/nezha-admin/src/main/resources/mapper/detect/DeteWarnInfoDao.xml b/nezha-admin/src/main/resources/mapper/detect/DeteWarnInfoDao.xml
index f2e6ad4e..862e2725 100644
--- a/nezha-admin/src/main/resources/mapper/detect/DeteWarnInfoDao.xml
+++ b/nezha-admin/src/main/resources/mapper/detect/DeteWarnInfoDao.xml
@@ -51,6 +51,7 @@
and dwr.rel_type='2' and dwr.rel_id=#{setId}
</if>
)
+ order by dwi.warn_level desc,dwi.op_time desc
</select>
diff --git a/nezha-admin/src/main/resources/statics/css/addDetectType.css b/nezha-admin/src/main/resources/statics/css/addDetectType.css
index 72e7a327..cb173bb9 100644
--- a/nezha-admin/src/main/resources/statics/css/addDetectType.css
+++ b/nezha-admin/src/main/resources/statics/css/addDetectType.css
@@ -72,10 +72,10 @@
top:0%;
width:100%;
height:100%;
- background-color:#eeeeee;;
+ background-color: #fbfbfb;;
z-index:1001;
-moz-opacity:0.7;
- opacity:.70;
+ opacity:.35;
filter:alpha(opacity=70);
}
diff --git a/nezha-admin/src/main/resources/statics/css/main.css b/nezha-admin/src/main/resources/statics/css/main.css
index 75574753..61aab142 100644
--- a/nezha-admin/src/main/resources/statics/css/main.css
+++ b/nezha-admin/src/main/resources/statics/css/main.css
@@ -349,6 +349,9 @@ tbody > tr > th {font-weight: normal; }
padding: 3px 8px 3px 10px;
border-bottom: 1px solid white;
}
+.add-box_row:hover{
+ background-color: #f2f2f2;
+}
.add-box_cell { /*行内单元格*/
padding-top: 2px;
display: inline-block;
@@ -435,4 +438,7 @@ tbody > tr > th {font-weight: normal; }
min-height: 30px;
font-size: 13px;
}
+.btn-cursor-not-allowed{
+ cursor: not-allowed !important;
+}
/* add-box组件end */ \ No newline at end of file
diff --git a/nezha-admin/src/main/resources/templates/js/modules/common/componets.js b/nezha-admin/src/main/resources/templates/js/modules/common/componets.js
index 2886a949..d43c3cd8 100644
--- a/nezha-admin/src/main/resources/templates/js/modules/common/componets.js
+++ b/nezha-admin/src/main/resources/templates/js/modules/common/componets.js
@@ -836,8 +836,8 @@ var fileUpload = Vue.extend({
fileInputSelector:'',
dirty:false,
required:true,
- error:false
-
+ error:false,
+ slot:0,
};
},
validations: function() {
@@ -845,6 +845,9 @@ var fileUpload = Vue.extend({
},
created: function () {
var temp=this;
+ temp.slot=Math.ceil(Math.random()*100000000);;
+ temp.viewInputId=temp.viewInputId+"-"+temp.slot;
+ temp.fileInputId=temp.fileInputId+"-"+temp.slot;
},
methods: {
init:function(){
@@ -954,6 +957,9 @@ var fileUpload = Vue.extend({
mounted: function () {
this.init();
+ },
+ beforeDestroy:function(){
+ this.$emit('uploadComponetDestory');
}
})
diff --git a/nezha-admin/src/main/resources/templates/js/modules/detect/addType.js b/nezha-admin/src/main/resources/templates/js/modules/detect/addType.js
index 01be0dfd..a25844fc 100644
--- a/nezha-admin/src/main/resources/templates/js/modules/detect/addType.js
+++ b/nezha-admin/src/main/resources/templates/js/modules/detect/addType.js
@@ -184,7 +184,7 @@ var meta=Vue.extend({
if(temp.deteMeta.bestNew!=undefined&&temp.deteMeta.bestNew!=null&&temp.deteMeta.bestNew){
temp.metaDomClick();
}
- if(temp.deteMeta.delFlag=='1'){
+ if(temp.deteMeta.delFlag=='1'||temp.deteMethod.code=='3'){
temp.addShadow();
}
},
@@ -344,7 +344,9 @@ var addMeta=Vue.extend({
},
methods: {
addMeta:function(){
-
+ if(this.deteMethod.code=='3'){
+ return ;
+ }
var name='TEMP-'+this.counter;
var meta={
id: null,
@@ -437,6 +439,10 @@ var addParam=Vue.extend({
},
props: {
+ deteMethod:{
+ type:Object,
+ required:true
+ },
deteParam:{
type:Object,
required:true
@@ -487,7 +493,7 @@ var addParam=Vue.extend({
temp.editSelector="#"+temp.editPreKey+"-"+temp.index;
temp.listDom=$(temp.listSelector);
temp.editDom=$(temp.editSelector);
- if(temp.deteParam.new!=undefined&&temp.deteParam.new!=null&&temp.deteParam.new){
+ if(temp.deteParam.new!=undefined&&temp.deteParam.new!=null&&!temp.deteParam.isEdited){
temp.editSwitch=true;
temp.listDom.parent().attr("draggable",'false');
}
@@ -529,18 +535,26 @@ var addParam=Vue.extend({
event.target.style.backgroundColor='';
},
dropFunc:function(event){//将元素释放到当前元素中
+
+
var event = event.originalEvent;
var index = event.dataTransfer.getData("index");
//重置背景色
event.target.style.backgroundColor='';
-
- this.$emit("ask-for-swap",index,this.index);
+ this.submitSelf();
+ console.log('swap')
+ if(!this.$v.deteParam.$error){
+ this.$emit("ask-for-swap",index,this.index);
+ }
event.preventDefault();
event.stopPropagation();
},
editSelf:function(){
var temp=this;
+ if(temp.deteMethod.code=='3'){
+ return ;
+ }
if(temp.deteParam.delFlag=='0'){
temp.editSwitch=true;
temp.listDom.parent().attr("draggable",'false');
@@ -551,6 +565,9 @@ var addParam=Vue.extend({
},
delSelf:function(e){
var temp=this;
+ if(temp.deteMethod.code=='3'){
+ return ;
+ }
var p=temp.deteParam;
if(p.new!=undefined&&p.new!=null&&p.new){
temp.$emit("del-param",this.index);
@@ -573,8 +590,6 @@ var addParam=Vue.extend({
submitSelf:function(){
var temp=this;
-
-
if(temp.validate()){
temp.showNameWarningMsg();
temp.showDefValWarningMsg();
@@ -582,6 +597,7 @@ var addParam=Vue.extend({
}
temp.editSwitch=false;
+ temp.deteParam.isEdited=true;
temp.listDom.parent().attr("draggable",'true');
},
@@ -690,6 +706,7 @@ var addType=Vue.extend({
},
deteMethods:[],
defaultMethod:{},
+ innerMethod:null,
fieldTypes:[],
dataTypes:[],
dicTypes:[],
@@ -708,7 +725,7 @@ var addType=Vue.extend({
oldFile:{
filePath:'',
remark:'No File'
- }
+ },
}
},
validations:{
@@ -783,10 +800,15 @@ var addType=Vue.extend({
temp.deteMethods=[];
$.getJSON(baseURL + "sys/dict/all?type=dtmethond&_" + $.now(), function (r) {
for (let dic of r.data) {
+
var m={
code:dic.code,
value:dic.value,
}
+ if('3'==dic.code){
+ temp.innerMethod=m;
+ continue;
+ }
if("1"==dic.code){
temp.defaultMethod=m;
}
@@ -885,6 +907,7 @@ var addType=Vue.extend({
},
formatDeteTypeToSimple: function () {
var temp=this;
+ temp.deteType.method=temp.deteType.method.code;
$.each(temp.deteType.deteTypeMetas, function (i, v) {
temp.deteType.deteTypeMetas[i].fieldType = v.fieldType.code;
temp.deteType.deteTypeMetas[i].dataType = v.dataType.code;
@@ -895,6 +918,17 @@ var addType=Vue.extend({
},
formatDeteTypeToObject: function () {
var temp=this;
+ if(temp.deteType.method=='3'){
+ temp.defaultMethod=temp.innerMethod;
+ }else{
+ for (let method of temp.deteMethods){
+ if(temp.deteType.method==method.code){
+ temp.defaultMethod=method;
+ break;
+ }
+ }
+ }
+
$.each(temp.deteType.deteTypeMetas, function (index, value) {
for (var i = 0; i < temp.fieldTypes.length; i++) {
if (temp.fieldTypes[i].code == value.fieldType) {
@@ -940,7 +974,11 @@ var addType=Vue.extend({
}
},
delMeta:function(index){
+ if(this.deteType.method=='3'){
+ return ;
+ }
var temp=this;
+ temp.deteType.method=temp.defaultMethod.code;
var meta=temp.deteType.deteTypeMetas[index];
if(meta.new!=undefined&&meta.name!=null&&meta.new){
temp.deteType.deteTypeMetas.splice(index,1);
@@ -958,19 +996,37 @@ var addType=Vue.extend({
},
addParam:function(){
+ if(this.deteType.method=='3'){
+ return ;
+ }
var temp=this;
temp.paramDirty=true;
+
+ var paramLen=temp.deteType.deteTypeParams.length;
+ if(paramLen>0){
+ for (var i=0;i<paramLen;i++){
+ temp.$refs['r-detect-param'][i].submitSelf();
+ if(temp.$refs['r-detect-param'][i].$v.deteParam.$error){
+ return;
+ }
+ }
+ }
+
var param={
id:null,
name:'',
defVal:'',
delFlag:'0',
- new:true
+ new:true,
+ isEdited:false
}
temp.deteType.deteTypeParams.push(param);
},
delParam:function(index){
var temp=this;
+ if(this.deteType.method=='3'){
+ return ;
+ }
temp.deteType.deteTypeParams.splice(index,1);
temp.resetParamDom();
},
@@ -1085,7 +1141,6 @@ var addType=Vue.extend({
}
}
- console.log(typeError+"|"+metaError+"|"+paramError+"|"+uploadError);
return typeError||metaError||paramError||uploadError;
},
touchType:function(){
@@ -1100,6 +1155,15 @@ var addType=Vue.extend({
}
}
+ },
+ destoryUploadComponet:function(){
+ this.file=null;
+ this.acceptFile=".sh";
+ this.hasOldFile=false;
+ this.oldFile={
+ filePath:'',
+ remark:'No File'
+ }
}
},
computed: {
@@ -1109,6 +1173,18 @@ var addType=Vue.extend({
typeId:function(){
this.initDeteType();
},
+ 'deteType.method':{
+ handler:function(){
+ var temp=this;
+ if(temp.deteType.method=='3'){
+ $('.input-control').each(function(i,v){
+ v.disabled='disabled';
+ })
+
+ }
+ },
+ immediate: true
+ },
'deteType.deteTypeMetas':function(){
if(this.deteType.deteTypeMetas.length<1){
this.metaRequired=false;
diff --git a/nezha-admin/src/main/resources/templates/js/modules/detect/deteWarn.js b/nezha-admin/src/main/resources/templates/js/modules/detect/deteWarn.js
index 921ff1c8..228139e0 100644
--- a/nezha-admin/src/main/resources/templates/js/modules/detect/deteWarn.js
+++ b/nezha-admin/src/main/resources/templates/js/modules/detect/deteWarn.js
@@ -27,6 +27,7 @@ var warnComponet = Vue.extend({
template:"#warnWindow",
components:{
'nz-table':rTable,
+ "nz-fileupload":fileUpload
},
props:{
cap:{
@@ -46,6 +47,7 @@ var warnComponet = Vue.extend({
// }
},
data: function(){
+ var temp=this;
return {
single:true,
multi:true,
@@ -55,12 +57,41 @@ var warnComponet = Vue.extend({
counter:0,
colModel:[
{name: "<@spring.message 'common.name'/>", field: "name", width: 120},
- {name: "<@spring.message 'detect.triggerType'/>", field: "triggerType", width: 120},
+ {name: "<@spring.message 'deteWarn.warnLevel'/>", field: "warnLevel", width: 120,formatter:function(rowData){
+ for (let index in temp.warnLevels){
+ var warnLevel=temp.warnLevels[index];
+ if(rowData.warnLevel==warnLevel.code){
+ return warnLevel.value;
+ }
+ }
+ return 'undefinded';
+ }},
+ {name: "<@spring.message 'detect.triggerType'/>", field: "triggerType", width: 120,formatter:function(rowData){
+ for (let index in temp.triggerTypes){
+ var triggerType=temp.triggerTypes[index];
+ if(rowData.triggerType==triggerType.code){
+ return triggerType.value;
+ }
+ }
+ return 'undefinded';
+ }},
{name: "<@spring.message 'detect.warnMode'/>", field: "warnMode", width: 120,formatter:function(rowData){
- return rowData.warnMode;
+ for (let index in temp.warnModes){
+ var warnMode=temp.warnModes[index];
+ if(rowData.warnMode==warnMode.code){
+ return warnMode.value;
+ }
+ }
+ return 'undefinded';
}},
{name: "<@spring.message 'deteWarn.callbackType'/>", field: "callbackType", width: 120,formatter:function(rowData){
- return rowData.callbackType;
+ for (let index in temp.callbackTypes){
+ var callbackType=temp.callbackTypes[index];
+ if(rowData.callbackType==callbackType.code){
+ return callbackType.value;
+ }
+ }
+ return 'undefinded';
}},
{name: "<@spring.message 'common.opTime'/>", field: "opTime", width: 240},
@@ -89,6 +120,7 @@ var warnComponet = Vue.extend({
warnLevel:'',
callbackType:'0',
callbackContent:'',
+ tempCallbackContent:'',//解决更新操作时,回调方式从脚本改为http的回显问题
viewLevel:'',
remark:''
},
@@ -106,8 +138,15 @@ var warnComponet = Vue.extend({
callbackTypes:[],
defaultCallbackType:{},
viewLevels:[],
- defaultViewLevel:{}
-
+ defaultViewLevel:{},
+ uploadReset:true,
+ file:null,
+ acceptFile:".sh",
+ hasOldFile:false,
+ oldFile:{
+ filePath:'',
+ remark:'No File'
+ }
}
},
@@ -135,8 +174,8 @@ var warnComponet = Vue.extend({
if(typeof temp.defaultTrigger!='undefined' && temp.defaultTrigger.code=='1'){
validate.threshold={required}
}
- if(typeof temp.deteWarn!='undefined' && typeof temp.deteWarn.callbackType!='undefined'&&temp.deteWarn.callbackType!='0'){
- validate.callbackContent={required};
+ if(typeof temp.deteWarn!='undefined' && typeof temp.deteWarn.callbackType!='undefined'&&temp.deteWarn.callbackType=='2'){
+ validate.tempCallbackContent={required};
}
return {
deteWarn:validate
@@ -193,6 +232,7 @@ var warnComponet = Vue.extend({
warnLevel:'',
callbackType:'0',
callbackContent:'',
+ tempCallbackContent:'',
viewLevel:'',
remark:''
}
@@ -204,7 +244,7 @@ var warnComponet = Vue.extend({
$.ajax({
url: baseURL + "/deteWarn/list?setId="+temp.setId,
type:'get',
- sync:true,
+ sync:false,
timeout:10000,
beforeSend:function(XMLHttpRequest){
},
@@ -273,7 +313,6 @@ var warnComponet = Vue.extend({
url: baseURL + "deteType/detail?id=" + temp.setDetail.type.id,
type:'get',
sync:false,
- timeout:10000,
success:function(r){
temp.deteMetas = r.data.deteTypeMetas;
}
@@ -293,7 +332,7 @@ var warnComponet = Vue.extend({
// }
temp.triggerTypes.push(m);
}
- });
+ })
},
loadWarnModes:function(){
var temp=this;
@@ -309,7 +348,7 @@ var warnComponet = Vue.extend({
// }
temp.warnModes.push(m);
}
- });
+ })
},
loadStateTypes:function(){
var temp=this;
@@ -434,6 +473,7 @@ var warnComponet = Vue.extend({
var temp=this;
temp.reset();
temp.openEditLayer();
+ temp.resetFileUploadDom();
},
update:function(){
var temp=this;
@@ -442,6 +482,7 @@ var warnComponet = Vue.extend({
temp.getWarnDetail();
temp.openEditLayer();
+ temp.resetFileUploadDom();
},
getWarnDetail:function(){
var temp=this;
@@ -498,12 +539,17 @@ var warnComponet = Vue.extend({
//处理json数据
temp.formatDeteSetToSimple();
- console.log("submit data-->" + JSON.stringify(temp.deteWarn))
+
+ let formData=new FormData();
+ formData.append('deteWarnInfo',JSON.stringify(temp.deteWarn));
+ formData.append('file',temp.file);
+
$.ajax({
type: method,
url: baseURL + url,
- contentType: "application/json",
- data: JSON.stringify(temp.deteWarn),
+ contentType: false,
+ processData:false,
+ data: formData,
success: function (r) {
if (r.code === 200) {
alert('<@spring.message "common.success"/>', function (index) {
@@ -526,7 +572,14 @@ var warnComponet = Vue.extend({
validate:function(){
var temp=this;
temp.$v.deteWarn.$touch();
- return temp.$v.deteWarn.$error;
+ var warnScripError=false;
+ var uploadComponet=temp.$refs.warnScriptUpload;
+ if(typeof uploadComponet != 'undefined'){
+ uploadComponet.touch();
+ warnScripError=uploadComponet.error;
+ }
+ console.log(temp.$v.deteWarn.$error+"|"+uploadComponet)
+ return temp.$v.deteWarn.$error||uploadComponet;
},
formatDeteSetToSimple:function(){
var temp=this;
@@ -543,6 +596,8 @@ var warnComponet = Vue.extend({
}
temp.deteWarn.warnLevel=temp.defaultWarnLevel.code;
+
+ temp.deteWarn.callbackContent=temp.deteWarn.tempCallbackContent;
},
formatDeteSetToObject:function(){
var temp=this;
@@ -587,6 +642,32 @@ var warnComponet = Vue.extend({
temp.defaultViewLevel=m;
}
}
+
+ if(temp.deteWarn.callbackType=='1'){
+ temp.hasOldFile=true;
+ if(typeof temp.deteWarn.callbackContent != 'undefined'&&temp.deteWarn.callbackContent!=null&&temp.deteWarn.callbackContent!=''){
+ try {
+ var file=JSON.parse(temp.deteWarn.callbackContent);
+ temp.oldFile.filePath=file.filePath;
+ temp.oldFile.remark=file.fileName;
+ }catch (e) {
+ temp.oldFile.filePath='';
+ temp.oldFile.remark='No File';
+ }
+
+ }else{
+ temp.oldFile.filePath='';
+ temp.oldFile.remark='No File';
+ }
+ }else{
+ temp.hasOldFile=false;
+ temp.oldFile.filePath='';
+ temp.oldFile.remark='No File';
+ }
+ if(temp.deteWarn.callbackType=='2'){
+ temp.deteWarn.tempCallbackContent=temp.deteWarn.callbackContent;
+ }
+
},
getSelectDatas:function(selected,unselected){
var temp=this;
@@ -618,6 +699,22 @@ var warnComponet = Vue.extend({
$("html").css("overflow-y", "hidden");
}
});
+ },
+ resetFileUploadDom:function(){
+ var temp = this;
+ temp.uploadReset = false;
+ temp.$nextTick(() => {
+ temp.uploadReset = true
+ });
+ },
+ destoryUploadComponet:function(){
+ this.file=null;
+ // this.acceptFile=".sh";
+ // this.hasOldFile=false;
+ // this.oldFile={
+ // filePath:'',
+ // remark:'No File'
+ // }
}
},
watch:{
diff --git a/nezha-admin/src/main/resources/templates/modules/common/template.html b/nezha-admin/src/main/resources/templates/modules/common/template.html
index 8eb3b78d..fbeaf2b3 100644
--- a/nezha-admin/src/main/resources/templates/modules/common/template.html
+++ b/nezha-admin/src/main/resources/templates/modules/common/template.html
@@ -70,13 +70,13 @@
<div >
<div class="col-sm-2 control-label"><@spring.message 'common.scriptFile'/></div>
<div class="col-sm-9">
- <div class="input-group">
- <input :id='viewInputId' class="form-control" @click="viewInputClick" />
+ <div class="input-group" style="width: 98.2%">
+ <input :id='viewInputId' class="form-control input-control" @click="viewInputClick" />
<div class="input-group-btn" style="right: 31px;">
- <button type="button" class="btn btn-default" @click="selectBtnClick"><i class="fa fa-file-text"></i></button>
- <button type="button" class="btn btn-default" @click="historyFileClick" :disabled="!hasOld||oldFile.filePath==''" :title="oldFile.remark"><i class="fa fa-download"></i></button>
+ <button type="button" class="btn btn-default" @click="selectBtnClick" style="border-radius: 0"><i class="fa fa-file-text"></i></button>
+ <button type="button" class="btn btn-default" @click="historyFileClick" :disabled="!hasOld||oldFile.filePath==''" :title="oldFile.remark" style="border-radius: 0px 4px 4px 0px;"><i class="fa fa-download"></i></button>
</div>
- <input type="file" :name="name" :id='fileInputId' @input="$emit('input', $event.target.files[0])" :accept="accept" @change="fileInput($event)" style="display: none">
+ <input type="file" class="input-control" :name="name" :id='fileInputId' @input="$emit('input', $event.target.files[0])" :accept="accept" @change="fileInput($event)" style="display: none">
</div>
<span class="required-symbol">*</span>
<div class="form-control_error-msg" v-if="dirty&&!required"><@spring.message 'validate.common.required'/></div>
diff --git a/nezha-admin/src/main/resources/templates/modules/detect/addTypeTemplate.html b/nezha-admin/src/main/resources/templates/modules/detect/addTypeTemplate.html
index eb4e11fd..83b16517 100644
--- a/nezha-admin/src/main/resources/templates/modules/detect/addTypeTemplate.html
+++ b/nezha-admin/src/main/resources/templates/modules/detect/addTypeTemplate.html
@@ -1,180 +1,184 @@
<script type="text/x-template" id="addTypeTemplate">
- <div :class="{'panel panel-default':typeNotLayer}" style="overflow-x: hidden">
- <div v-show="typeNotLayer" class="panel-heading">{{title}}</div>
- <form class="form-horizontal">
- <div class="form-group">
- <div class="col-sm-2 control-label"><@spring.message 'common.name'/></div>
- <div class="col-sm-9"><!--名称-->
- <input type="text" class="form-control"
- :class="{'form-control--error': $v.deteType.name.$dirty && !$v.deteType.name.required|| !$v.deteType.name.nameRepeat}"
- v-model.trim="$v.deteType.name.$model"/>
- <span class="required-symbol">*</span>
- <div class="form-control_error-msg" v-if="$v.deteType.name.$dirty && !$v.deteType.name.required">
- <@spring.message 'validate.common.required'/>
- </div>
- <div class="form-control_error-msg" v-if="$v.deteType.name.$dirty && !$v.deteType.name.nameRepeat">
- 名称重复
+ <div :class="{'panel panel-default':typeNotLayer}" style="overflow-x: hidden">
+ <div v-show="typeNotLayer" class="panel-heading">{{title}}</div>
+ <form class="form-horizontal">
+ <div class="form-group">
+ <div class="col-sm-2 control-label"><@spring.message 'common.name'/></div>
+ <div class="col-sm-9"><!--名称-->
+ <input type="text" class="form-control input-control"
+ :class="{'form-control--error': $v.deteType.name.$dirty && !$v.deteType.name.required|| !$v.deteType.name.nameRepeat}"
+ v-model.trim="$v.deteType.name.$model"/>
+ <span class="required-symbol">*</span>
+ <div class="form-control_error-msg" v-if="$v.deteType.name.$dirty && !$v.deteType.name.required">
+ <@spring.message 'validate.common.required'/>
+ </div>
+ <div class="form-control_error-msg" v-if="$v.deteType.name.$dirty && !$v.deteType.name.nameRepeat">
+ 名称重复
+ </div>
</div>
</div>
- </div>
- <div class="form-group"> <!--监测方式-->
- <div class="col-sm-2 control-label"><@spring.message 'deteType.method'/></div>
- <div class="col-sm-9" style="z-index:99999;">
- <multiselect v-model="defaultMethod" :options="deteMethods" placeholder="..." track-by="code"
- label="value" :searchable="false" :allow-empty="false" :disabled="isUpdate"
- :show-labels="false"></multiselect>
- </div>
+ <div class="form-group"> <!--监测方式-->
+ <div class="col-sm-2 control-label"><@spring.message 'deteType.method'/></div>
+ <div class="col-sm-9" style="z-index:1000;">
+ <multiselect v-model="defaultMethod" :options="deteMethods" placeholder="..." track-by="code"
+ label="value" :searchable="false" :allow-empty="false" :disabled="isUpdate"
+ :show-labels="false"></multiselect>
+ </div>
- </div>
- <div class="form-group"><!--监测间隔-->
- <div class="col-sm-2 control-label"><@spring.message 'deteType.deteInterval'/></div>
- <div class="col-sm-9">
- <input type="text" class="form-control input-small input-with-unit"
- :class="{'form-control--error': $v.deteType.deteInterval.$dirty && !$v.deteType.deteInterval.integer}"
- v-model.trim="$v.deteType.deteInterval.$model"/>
- <span class="input-unit">s</span>
-<!-- <span class="required-symbol">*</span>-->
-<!-- <div class="form-control_error-msg"-->
-<!-- v-if="$v.deteType.deteInterval.$dirty && !$v.deteType.deteInterval.integer">整数类型-->
-<!-- </div>-->
</div>
- </div>
-
- <div class="form-group"><!--内容-->
- <div v-if="defaultMethod.code=='2'">
- <div class="col-sm-2 control-label">OID</div>
- <div class="col-sm-9" >
- <input v-model.trim="$v.deteType.content.$model" class="form-control"></input>
+ <div class="form-group"><!--监测间隔-->
+ <div class="col-sm-2 control-label"><@spring.message 'deteType.deteInterval'/></div>
+ <div class="col-sm-9">
+ <input type="text" class="form-control input-control input-small input-with-unit "
+ :class="{'form-control--error input-control': $v.deteType.deteInterval.$dirty && !$v.deteType.deteInterval.integer}"
+ v-model.trim="$v.deteType.deteInterval.$model"/>
+ <span class="input-unit">s</span>
+ <!-- <span class="required-symbol">*</span>-->
+ <div class="form-control_error-msg"
+ v-if="$v.deteType.deteInterval.$dirty && !$v.deteType.deteInterval.integer">整数类型
+ </div>
</div>
</div>
- <template v-if="defaultMethod.code=='1'">
- <nz-fileupload
- v-if="uploadReset"
- :hasOld="hasOldFile"
- :oldFile="oldFile"
- :accept="acceptFile"
- v-model="file"
- ref="scriptUpload"
- ></nz-fileupload>
- </template>
- </div>
+ <div class="form-group"><!--内容-->
+ <div v-if="defaultMethod.code=='2'">
+ <div class="col-sm-2 control-label">OID</div>
+ <div class="col-sm-9" >
+ <input v-model.trim="$v.deteType.content.$model" class="form-control input-control"></input>
+ </div>
+ </div>
+
+ <template v-if="defaultMethod.code=='1'">
+ <nz-fileupload
+ v-if="uploadReset"
+ :hasOld="hasOldFile"
+ :oldFile="oldFile"
+ :accept="acceptFile"
+ v-model="file"
+ ref="scriptUpload"
+ @uploadComponetDestory="destoryUploadComponet"
+ ></nz-fileupload>
+ </template>
+ </div>
- <div class="form-group"><!--元数据-->
- <div class="col-sm-2 control-label"><@spring.message 'deteType.meta'/></div>
- <div class="col-sm-9">
- <div class="add-box">
- <div class="add-box_head">
+ <div class="form-group"><!--元数据-->
+ <div class="col-sm-2 control-label"><@spring.message 'deteType.meta'/></div>
+ <div class="col-sm-9">
+ <div class="add-box">
+ <div class="add-box_head">
<span class="add-box_cell add-box_cell_25">Field-Type
<!-- <span class="metatype-question"><i class="fa fa-question-circle"></i></span> -->
</span>
- <span class="add-box_cell add-box_cell_25">Data-Type
- <!-- <span class="metatype-question"><i class="fa fa-question-circle"></i></span> -->
+ <span class="add-box_cell add-box_cell_25">Data-Type
+ <!-- <span class="metatype-question"><i class="fa fa-question-circle"></i></span> -->
</span>
- <span class="add-box_cell">Name</span>
- </div>
- <div class="add-box_body add-box_body_160">
- <div class="add-box_row"
- v-for="(meta,index) in deteType.deteTypeMetas"
- :class="{'danger2':meta.passFlag!=undefined&&!meta.passFlag}"
- v-if="meta.delFlag=='0'" >
- <div class="add-box_cell add-box_cell_25">
- <span class="add-box_tag1">{{meta.fieldType.value}}</span>
- </div>
- <div class="add-box_cell add-box_cell_25">
- <span class="add-box_tag2">{{meta.dataType.value}}</span>
- </div>
- <span class="add-box_cell" :title="meta.name" v-html="meta.name.length>20?spliteName(meta.name):meta.name"></span>
- <span class="add-box_ops" >
+ <span class="add-box_cell">Name</span>
+ </div>
+ <div class="add-box_body add-box_body_160">
+ <div class="add-box_row"
+ v-for="(meta,index) in deteType.deteTypeMetas"
+ :class="{'danger2':meta.passFlag!=undefined&&!meta.passFlag}"
+ v-if="meta.delFlag=='0'" >
+ <div class="add-box_cell add-box_cell_25">
+ <span class="add-box_tag1">{{meta.fieldType.value}}</span>
+ </div>
+ <div class="add-box_cell add-box_cell_25">
+ <span class="add-box_tag2">{{meta.dataType.value}}</span>
+ </div>
+ <span class="add-box_cell" :title="meta.name" v-html="meta.name.length>20?spliteName(meta.name):meta.name"></span>
+ <span class="add-box_ops" >
<i @click="openMetaWindow(index)" class="fa fa-pencil"></i>
- <i @click="delMeta(index)" class="fa fa-trash-o"></i>
+ <i @click="delMeta(index)" :class="{'btn-cursor-not-allowed':deteType.method=='3'}" class="fa fa-trash-o"></i>
</span>
+ </div>
</div>
+ <div class="add-box_foot">
+ <i @click="openMetaWindow()" class="fa fa-plus"></i>
+ </div>
+
</div>
- <div class="add-box_foot">
- <i @click="openMetaWindow()" class="fa fa-plus"></i>
+ <div class="form-control_error-msg" v-if="metaDirty&&!metaRequired">
+ <@spring.message 'validate.common.required'/>
</div>
-
- </div>
- <div class="form-control_error-msg" v-if="metaDirty&&!metaRequired">
- <@spring.message 'validate.common.required'/>
</div>
</div>
- </div>
- <div class="form-group">
- <div class="col-sm-2 control-label"><@spring.message 'param'/></div>
- <div class="col-sm-9">
- <div class="add-box">
- <div class="add-box_head">
- <span class="add-box_cell add-box_cell_45">Name</span>
- <span class="add-box_cell">Default</span>
- </div>
- <div class="add-box_body" id="r-dete-param-container">
- <template v-for="(param,index) in deteType.deteTypeParams">
- <nz-add-param
- v-if="paramReset"
- :dete-param="param"
- ref="r-detect-param"
- :index="index"
- :dete-params="deteType.deteTypeParams"
- @ask-for-swap="swapParam"
- @del-param="delParam"
- ></nz-add-param>
- </template>
- </div>
- <div class="add-box_foot">
- <i @click="addParam" class="fa fa-plus"></i>
+ <div class="form-group">
+ <div class="col-sm-2 control-label"><@spring.message 'param'/></div>
+ <div class="col-sm-9">
+ <div class="add-box">
+ <div class="add-box_head">
+ <span class="add-box_cell add-box_cell_45">Name</span>
+ <span class="add-box_cell">Default</span>
+ </div>
+ <div class="add-box_body" id="r-dete-param-container">
+ <template v-for="(param,index) in deteType.deteTypeParams">
+ <nz-add-param
+ v-if="paramReset"
+ :dete-param="param"
+ ref="r-detect-param"
+ :index="index"
+ :dete-method="defaultMethod"
+ :dete-params="deteType.deteTypeParams"
+ @ask-for-swap="swapParam"
+ @del-param="delParam"
+ ></nz-add-param>
+ </template>
+ </div>
+ <div class="add-box_foot">
+ <i @click="addParam" class="fa fa-plus" :class="{'btn-cursor-not-allowed':deteType.method=='3'}"></i>
+ </div>
</div>
+ <div class="form-control_error-msg" v-if="paramDirty&&!paramRequired"><@spring.message 'validate.common.required'/></div>
</div>
- <div class="form-control_error-msg" v-if="paramDirty&&!paramRequired"><@spring.message 'validate.common.required'/></div>
</div>
- </div>
- <!--<div class="form-group">
- <div class="col-sm-2 control-label">I18n Code</div>
- <div class="col-sm-9">
- <input type="text" class="form-control"
- :class="{'form-control&#45;&#45;error': $v.deteType.i18nCode.$dirty && !$v.deteType.i18nCode.required }"
- v-model.trim="$v.deteType.i18nCode.$model"/>
- <span class="required-symbol">*</span>
- <div class="form-control_error-msg"
- v-if="$v.deteType.i18nCode.$dirty && !$v.deteType.i18nCode.required"><@spring.message
- 'validate.common.required'/>
- </div>
+ <!--<div class="form-group">
+ <div class="col-sm-2 control-label">I18n Code</div>
+ <div class="col-sm-9">
+ <input type="text" class="form-control"
+ :class="{'form-control&#45;&#45;error': $v.deteType.i18nCode.$dirty && !$v.deteType.i18nCode.required }"
+ v-model.trim="$v.deteType.i18nCode.$model"/>
+ <span class="required-symbol">*</span>
+ <div class="form-control_error-msg"
+ v-if="$v.deteType.i18nCode.$dirty && !$v.deteType.i18nCode.required"><@spring.message
+ 'validate.common.required'/>
+ </div>
- </div>
- </div>-->
+ </div>
+ </div>-->
- <div class="form-group"><!--备注-->
- <div class="col-sm-2 control-label"><@spring.message 'common.remark'/> </div>
- <div class="col-sm-9">
- <textarea v-model.trim="$v.deteType.remark.$model" class="form-control"></textarea>
+ <div class="form-group"><!--备注-->
+ <div class="col-sm-2 control-label"><@spring.message 'common.remark'/> </div>
+ <div class="col-sm-9">
+ <textarea v-model.trim="$v.deteType.remark.$model" class="form-control input-control"></textarea>
+ </div>
</div>
- </div>
- <div class="form-group form-group_opbox">
- <div>
- <button title="<@spring.message 'common.submit'/>" type="button" class="btn btn-primary" style="width: 55px" @click="saveOrUpdate">
- <i class="fa fa-check"></i></button>
- <div style="display:inline-block;width:10px;"></div>
- <button title="<@spring.message 'common.back'/>" type="button" class="btn btn-warning" style="width: 55px" @click="reload"><i
- class="fa fa-reply"></i></button>
+ <div class="form-group form-group_opbox">
+ <div>
+ <button title="<@spring.message 'common.submit'/>" type="button" class="btn btn-primary input-control" style="width: 55px" @click="saveOrUpdate">
+ <i class="fa fa-check"></i></button>
+ <div style="display:inline-block;width:10px;"></div>
+ <button title="<@spring.message 'common.back'/>" type="button" class="btn btn-warning" style="width: 55px" @click="reload"><i
+ class="fa fa-reply"></i></button>
+ </div>
</div>
- </div>
- </form>
+ </form>
- <div id="metaWindow" style="height:100%;display:none;">
- <nz-add-meta
- v-if="metaReset"
- ref="addMetaWindow"
- :dete-metas="deteType.deteTypeMetas"
- :dete-method="defaultMethod"
- :field-types="fieldTypes"
- :data-types="dataTypes"
- :dic-types="dicTypes"
- ></nz-add-meta>
+ <div id="metaWindow" style="height:100%;display:none;">
+ <nz-add-meta
+ v-if="metaReset"
+ ref="addMetaWindow"
+ :dete-metas="deteType.deteTypeMetas"
+ :dete-method="defaultMethod"
+ :field-types="fieldTypes"
+ :data-types="dataTypes"
+ :dic-types="dicTypes"
+ ></nz-add-meta>
+ </div>
+<!-- <div class="shadow" style="display: block;" v-show="deteType.method=='3'"></div>-->
</div>
- </div>
+
</script>
<script type="text/x-template" id="addDetectMata">
@@ -198,7 +202,7 @@
</template>
<!-- 新增按钮 -->
<div class="meta-win_list-foot">
- <i @click="addMeta" class="fa fa-plus"></i>
+ <i @click="addMeta" class="fa fa-plus" :class="{'btn-cursor-not-allowed':deteMethod.code=='3'}"></i>
</div>
</div>
<!-- meta详情 -->
@@ -359,8 +363,8 @@
<div class="add-box_cell add-box_cell_45">{{deteParam.name}}</div>
<span class="add-box_name">{{deteParam.defVal}}</span>
<span class="add-box_ops" >
- <i @click="editSelf" class="fa fa-pencil" :id="'add-box_op_edit_'+index"></i>
- <i @click="deteParam.delFlag=='0'?delSelf():recSelf()" :class="{'fa fa-trash-o':deteParam.delFlag=='0','fa fa-undo':deteParam.delFlag=='1'}"></i>
+ <i @click="editSelf" class="fa fa-pencil" :id="'add-box_op_edit_'+index" :class="{'btn-cursor-not-allowed':deteMethod.code=='3'}"></i>
+ <i @click="deteParam.delFlag=='0'?delSelf():recSelf()" :class="{'fa fa-trash-o':deteParam.delFlag=='0','fa fa-undo':deteParam.delFlag=='1','btn-cursor-not-allowed':deteMethod.code=='3'}"></i>
</span>
<!-- <span :class="{'add-box_del':deteParam.delFlag=='0','add-box_rec':deteParam.delFlag=='1'}" ></span>-->
</div>
@@ -376,8 +380,8 @@
<input type="text" :id="'r-param-defval-input-'+index" :class="{'form-control--error':$v.deteParam.defVal.$dirty&&!$v.deteParam.defVal.required}" class="form-control add-box_input" placeholder="请输入默认值" v-model="$v.deteParam.defVal.$model">
</div>
<span class="add-box_ops">
- <i @click="submitSelf" class="fa fa-check"></i>
- <i @click="delSelf" class="fa fa-trash-o"></i>
+ <i @click="submitSelf" class="fa fa-check" ></i>
+ <i @click="delSelf" class="fa fa-trash-o " ></i>
</span>
</form>
</div>
diff --git a/nezha-admin/src/main/resources/templates/modules/detect/warnTemplate.html b/nezha-admin/src/main/resources/templates/modules/detect/warnTemplate.html
index 16e76665..224424bc 100644
--- a/nezha-admin/src/main/resources/templates/modules/detect/warnTemplate.html
+++ b/nezha-admin/src/main/resources/templates/modules/detect/warnTemplate.html
@@ -171,11 +171,25 @@
</div>
</div>
<div class="form-group" v-show="deteWarn.callbackType!='0'">
- <div class="col-sm-2 control-label"><@spring.message 'deteWarn.callbackContent'/></div>
- <div class="col-sm-9">
- <textarea v-model.trim="$v.deteWarn.callbackContent.$model" class="form-control"></textarea>
- <span class="required-symbol">*</span>
- <div class="form-control_error-msg" v-if="deteWarn.callbackType!='0' && $v.deteWarn.callbackContent.$dirty && !$v.deteWarn.callbackContent.required"><@spring.message 'validate.common.required'/></div>
+ <template v-if="deteWarn.callbackType == '1'">
+ <nz-fileupload
+ v-if="uploadReset"
+ :hasOld="hasOldFile"
+ :oldFile="oldFile"
+ :accept="acceptFile"
+ v-model="file"
+ ref="warnScriptUpload"
+ @uploadComponetDestory="destoryUploadComponet"
+ ></nz-fileupload>
+ </template>
+
+ <div v-if="deteWarn.callbackType == '2'">
+ <div class="col-sm-2 control-label"><@spring.message 'deteWarn.callbackContent'/></div>
+ <div class="col-sm-9">
+ <input v-model.trim="$v.deteWarn.tempCallbackContent.$model" class="form-control"></input>
+ <span class="required-symbol">*</span>
+ <div class="form-control_error-msg" v-if="deteWarn.callbackType!='0' && $v.deteWarn.tempCallbackContent.$dirty && !$v.deteWarn.tempCallbackContent.required"><@spring.message 'validate.common.required'/></div>
+ </div>
</div>
</div>
<div class="form-group">