朱鑫波 4 rokov pred
rodič
commit
a03c7a89bb

+ 201 - 133
src/views/modules/earlyWarningRules/configRules.vue

@@ -1,7 +1,10 @@
 <template>
     <div class='configRules'>
+    <a-spin :spinning="spinning">
+      
+    
         <div class="toolbox-automate-rules-create-body">
-            <div class="toolbox-automate-rules-create-content_title"><h3> {{edit?'选择配置字段':'规则预览'}}</h3></div>
+            <div class="toolbox-automate-rules-create-content_title"><h3> 新建空白规则模板</h3></div>
             <div class="toolbox-automate-rules-create-content">
                 <a-form-model
                     ref="ruleForm"
@@ -18,11 +21,11 @@
                         </div>
                         <div class="input-item"> 
                              <a-form-model-item ref="eventRuleLevel"  prop="eventRuleLevel">
-                                <a-radio-group v-model="form.mediaType" :disabled="!edit">
-                                    <a-radio-button value="1">头条</a-radio-button>
-                                    <a-radio-button value="2">快手</a-radio-button>
-                                    <a-radio-button value="3">头条内广</a-radio-button>
-                                    <a-radio-button value="4">快手内广</a-radio-button>
+                                <a-radio-group v-model="form.mediaType" >
+                                    <a-radio-button :value="1" >头条</a-radio-button>
+                                    <a-radio-button :value="2">快手</a-radio-button>
+                                    <a-radio-button :value="3">头条内广</a-radio-button>
+                                    <a-radio-button :value="4">快手内广</a-radio-button>
                                    
                                 </a-radio-group>
                             </a-form-model-item>
@@ -31,7 +34,7 @@
                     <div class="row-item" >
                         <div class="hint-item"></div>
                         <div class="label-item">
-                            <div class="text-item">规则集名称</div>
+                            <div class="text-item">模板名称</div>
                             <div class="required-item"></div>
                         </div>
                         <div class="input-item"> 
@@ -39,7 +42,7 @@
                                 <a-input
                                     v-model="form.templateName"
                                     allowClear
-                                    :disabled="!edit"
+                                    :disabled="!!currentRuleId"
                                 />
                             </a-form-model-item>
                         </div>
@@ -60,7 +63,16 @@
                         <div class="input-item" > 
                             <a-collapse accordion>
                                 <a-collapse-panel v-for="(item,index) in form.ruleList" :key="index" :header="item.groupName">
-                                    <a-icon slot="extra" type="delete" @click="deleteRule($event,item,index)" />
+                                    <span slot="extra">
+                                         <a-popconfirm
+                                            :title="`确定删除吗?`"
+                                            @confirm="deleteRule($event,item,index)"                            
+                                        >
+                                            <a-icon  type="delete" @click="deleteIcon($event)"/>
+                                        </a-popconfirm>
+                                    </span>
+                                   
+                                   
                                     <div class="row-item" >
                                         <div class="hint-item"></div>
                                         <div class="label-item">
@@ -76,12 +88,12 @@
                                                     placeholder="请输入规则名称"
                                                     allowClear
                                                     style="width:400px"
-                                                    :disabled="!edit"
+                                                    :disabled="!!item.groupId"
                                                 />
                                             </a-form-model-item>    
                                         </div>
                                     </div>
-                                    <div class="row-item" v-if="item.ruleType=='group'">
+                                    <div class="row-item" >
                                         <div class="hint-item"></div>
                                         <div class="label-item">
                                             <div class="text-item">规则描述</div>
@@ -97,51 +109,53 @@
                                                     style="width:400px"
                                                     placeholder="输入规则描述"
                                                     :auto-size="{ minRows: 2, maxRows: 5 }"
-                                                    :disabled="!edit"
+                                                    :disabled="!!item.groupId"
                                                 />
                                             </a-form-model-item>   
-                                            <!-- <a-form-model-item ref="remark" prop="remark" v-else >
-                                                <a-textarea
-                                                    v-model="item.remark"
-                                                    style="width:400px"
-                                                    placeholder="输入规则描述222"
-
-                                                    :auto-size="{ minRows: 2, maxRows: 5 }"
-                                                />
-                                            </a-form-model-item>    -->
                                         </div>
                                     </div>
-                                    <div class="row-item" v-if="item.ruleType=='base'">
+                                    
+                                    <div class="row-item" >
                                         <div class="hint-item"></div>
                                         <div class="label-item">
-                                            <div class="text-item">规则描述</div>
+                                            <div class="text-item">规则类型</div>
                                             <div class="required-item"></div>
                                         </div>
                                         <div class="input-item"> 
-                                            
-                                            <a-form-model-item ref="remark" prop="remark"  >
-                                                <a-textarea
-                                                    v-model="item.remark"
-                                                    style="width:400px"
-                                                    placeholder="输入规则描述222"
-
-                                                    :auto-size="{ minRows: 2, maxRows: 5 }"
-                                                    :disabled="!edit"
-                                                />
-                                            </a-form-model-item>   
+                                             <a-form-model-item ref="ruleType"  prop="ruleType">
+                                                <a-radio-group v-model="item.ruleType" >
+                                                    <a-radio-button value="group">组合</a-radio-button>
+                                                    <a-radio-button value="base">基础</a-radio-button>
+                                                </a-radio-group>
+                                            </a-form-model-item>  
                                         </div>
                                     </div>
                                     <div class="row-item" >
                                         <div class="hint-item"></div>
                                         <div class="label-item">
-                                            <div class="text-item">规则类型</div>
+                                            <div class="text-item">规则必填</div>
                                             <div class="required-item"></div>
                                         </div>
                                         <div class="input-item"> 
-                                             <a-form-model-item ref="ruleType"  prop="ruleType">
-                                                <a-radio-group v-model="item.ruleType" :disabled="!edit">
-                                                    <a-radio-button value="group">组合</a-radio-button>
-                                                    <a-radio-button value="base">基础</a-radio-button>
+                                             <a-form-model-item ref="isRequired"  prop="isRequired">
+                                                <a-radio-group v-model="item.isRequired" >
+                                                    <a-radio-button :value="1">是</a-radio-button>
+                                                    <a-radio-button :value="0">否</a-radio-button>
+                                                </a-radio-group>
+                                            </a-form-model-item>  
+                                        </div>
+                                    </div>
+                                    <div class="row-item" >
+                                        <div class="hint-item"></div>
+                                        <div class="label-item">
+                                            <div class="text-item">规则复建</div>
+                                            <div class="required-item"></div>
+                                        </div>
+                                        <div class="input-item"> 
+                                             <a-form-model-item ref="isCopy"  prop="isCopy">
+                                                <a-radio-group v-model="item.isCopy" >
+                                                    <a-radio-button :value="1">是</a-radio-button>
+                                                    <a-radio-button :value="0">否</a-radio-button>
                                                 </a-radio-group>
                                             </a-form-model-item>  
                                         </div>
@@ -150,10 +164,11 @@
                                         <div class="title">                                            
                                             <a-form-model-item ref="ruleRelationship"  prop="ruleRelationship">
                                                 <span class="condition-title">如果</span>
-                                                <a-select  style="width: 300px" v-model="item.ruleRelationship" :disabled="!edit">
+                                                <a-select  style="width: 300px" v-model="item.ruleRelationship">
                                                     <a-select-option  value='and'>满足以下所有条件</a-select-option>
                                                     <a-select-option  value='or'>满足以下任意条件</a-select-option>
                                                 </a-select>
+
                                             </a-form-model-item>                                
      
                                         </div>
@@ -161,15 +176,15 @@
                                             <div class="rules-list" v-for="(ele,ind) in item.ruleDetail" :key='ind'>
                                                 
                                                     <div class="rules-list-item">
-                                                        <div class="rules-list-item-subject" >
+                                                        <div class="rules-list-item-subject" style="width:180px">
                                                             <a-form-model-item ref="baseIndex"  prop="baseIndex">
                                                                 <a-cascader
-                                                                    :disabled="!edit"
                                                                     v-model="ele.baseIndex"
                                                                     :options="rulesFieldList"
                                                                     placeholder="选择指标"
                                                                     @change="baseIndexChange(ele)"
                                                                     expand-trigger="hover"
+                                                                    :disabled="!!ele.ruleId"
                                                                     :fieldNames="{ label:'name', value: 'code',children: 'children'}"
                                                                 />
                                                             </a-form-model-item>  
@@ -179,29 +194,45 @@
                                                         
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="ruleCondition"  prop="ruleCondition">
-                                                                <a-select   v-model="ele.ruleCondition" placeholder="运算符" :disabled="!edit">
+                                                                <a-select   v-model="ele.ruleCondition" placeholder="运算符" :disabled="!!ele.ruleId">
                                                                     <a-select-option  v-for="item in ele.conditionList" :key="item.id" :value='item.ruleCondition'>{{item.conditionName}}</a-select-option>
                                                                 </a-select>
                                                             </a-form-model-item>  
-                                                            
+
                                                         </div>
                                                         
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="variableType"  prop="variableType">
-                                                                <a-select   v-model="ele.variableType" :disabled="!edit">
+                                                                <a-select   v-model="ele.variableType" :disabled="!!ele.ruleId">
                                                                     <a-select-option  :value='0'>常量</a-select-option>
                                                                     <a-select-option  :value='1'>变量</a-select-option>
                                                                 </a-select>
                                                             </a-form-model-item>                                                             
                                                         </div>
+                                                        <div class="rules-list-item-subject" >
+                                                            <a-form-model-item ref="judgeFormat"  prop="judgeFormat">
+                                                                <a-select   v-model="ele.judgeFormat" placeholder="" :disabled="!!ele.ruleId">
+                                                                    <a-select-option  :value='0'>筛选条件</a-select-option>
+                                                                    <a-select-option  :value='1'>判断条件</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>                                                             
+                                                        </div>
                                                         
 
 
-                                                        <div class="rules-list-item-subject" >
-                                                            <a-input-number :min="0" style="width:100%" :max="9999999.99" :step="1" v-model="ele.threshold" placeholder="请输入" />
+                                                        <div class="rules-list-item-subject" v-if="ele.dataType=='number'">
+                                                            <a-input-number :min="0" style="width:100%" :max="9999999.99" :step="1" v-model="ele.threshold" placeholder="请输入" :disabled="!!ele.ruleId" />
                                                             <span style="margin-left:8px;line-height:32px">{{ele.dataUnit }}</span>
                                                         </div>
-                                                        
+                                                        <div class="rules-list-item-subject" >
+                                                            <a-form-model-item ref="isUnlimited"  prop="isUnlimited">
+                                                                <a-select   v-model="ele.isUnlimited" placeholder="是否必填" :disabled="!!ele.ruleId">
+                                                                    <a-select-option  :value='1'>必填</a-select-option>
+                                                                    <a-select-option  :value='0'>不必填</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>                                                             
+                                                        </div>
+                                                       
                                                         </template>
                                                         <div class="rules-list-item-delete" @click="deleteRulesListItem(index,ind)" v-if="ind!=0">
                                                             <a-icon type="delete" style="font-size:16px;position: relative;top: 4px;" />
@@ -209,8 +240,8 @@
                                                     </div>
                                                     
                                             </div>
-                                                
-                                            <div class="add-rule" @click="addCondition(item,index)"> 添加条件</div>
+                                               
+                                            <div class="add-rule" @click="addCondition(item,index)" > 添加条件</div>
                                         </div>
                                     </div>
                                     <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
@@ -222,7 +253,7 @@
                                                     <div class="rules-list-item">
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="processMethod"  prop="processMethod">
-                                                                <a-select   v-model="item.processMethod" :disabled="!edit">
+                                                                <a-select   v-model="item.processMethod" :disabled="!!item.groupId">
                                                                     <a-select-option  value='SEND'>仅发送通知</a-select-option>
                                                                     <a-select-option  value='PAUSE' >关停组</a-select-option>
                                                                     
@@ -231,7 +262,7 @@
                                                         </div>
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="processMethod"  prop="processMethod">
-                                                                <a-select   v-model="item.sendType" :disabled="!edit">
+                                                                <a-select   v-model="item.sendType" :disabled="!!item.groupId">
                                                                     <a-select-option  value='message' >短信</a-select-option>
                                                                     <a-select-option  value='enterpriseWechat'>企业微信</a-select-option>
                                                                     <a-select-option  value='email'>邮箱</a-select-option>
@@ -253,7 +284,7 @@
                   
                 </div>
                
-                <div class="moduler" v-if="edit">
+                <div class="moduler">
                     <!-- <div class="moduler-title">计划名称</div> -->
                     <div class="opt">
                         <a-button type="default" style="margin-right:15px" @click="goBack">取消</a-button>
@@ -263,12 +294,13 @@
                 </a-form-model>
             </div>
         </div>
+    </a-spin>
     </div>
 </template>
 
 <script>
 import moment from 'moment';
-import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
+import { getAction, postAction, downFile, downFilePost,deleteAction } from '@/api/manage';
 import { Switch } from 'ant-design-vue';
 import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
 
@@ -278,7 +310,6 @@ export default {
     },
     data() {
         return {
-            edit:true,
             conditionList:[],
             url:{
                 fieldList:'/ruleIndicator/list',
@@ -300,7 +331,7 @@ export default {
             // 用到的参数数组
            
             form: {
-                mediaType:'1',
+                mediaType:1,
                 templateName: `空白规则模板_${moment().format('YYYY_MM_DD_hh:mm:ss')}`,
                 ruleList:[
                     {
@@ -308,11 +339,13 @@ export default {
                         ruleRelationship:"and",
                         ruleType:'base',
                         remark:'',
+                        isRequired:1,
+                        isCopy:0,
                         ruleDetail:[
                             {
                                 ruleName:'',
                                 baseIndex:[],
-                                indicatorCode:'',
+                                indicatorCode:undefined,
                                 ruleDimension:'',
                                 dataRange:'CURRENT_DAY_DATA',
                                 ruleCondition:undefined,                                
@@ -320,6 +353,9 @@ export default {
                                 variableType:1,  
                                 dataUnit:'',
                                 conditionList:[],
+                                dataType:'',
+                                judgeFormat:0,
+                                isUnlimited:1,
                             },
                         ],
                         processMethod:'SEND',//预警方式
@@ -368,18 +404,23 @@ export default {
             console.log(ele,'========================执行了');         
             ele.indicatorCode=ele.baseIndex[1];
             ele.ruleDimension=ele.baseIndex[0];
+
             this.rulesFieldList.forEach(element => {
                 if(element.code==ele.baseIndex[0]){
                     element.children.forEach(item=>{
                         if(item.code==ele.baseIndex[1]){
                             ele.ruleName=item.name
                             ele.dataUnit=item.dataUnit
-                            
+                            ele.dataType=item.dataType;
+
+                            if(item.dataType!='number'){
+                                ele.threshold=''
+                            }
                             getAction(this.url.ruleCondition,{
                                 dataType:item.dataType
                             }).then(res=>{
                                 // console.log(res);
-                                this.conditionList=[];
+                                ele.conditionList=[];
                                 if(res.success){
                                     ele.conditionList=res.result
                                 }
@@ -412,18 +453,26 @@ export default {
             this.$refs.ruleForm.resetFields();
         },
         addCondition(item,index){
-            this.form.ruleList[index].ruleDetail.push({
-                ruleName:'',
-                baseIndex:[],
-                indicatorCode:'',
-                ruleDimension:'',
-                dataRange:'CURRENT_DAY_DATA',
-                ruleCondition:undefined,                                
-                threshold:0,
-                variableType:1,    
-                dataUnit:'',     
-                conditionList:[],                      
-            },)
+            if(item.groupId){
+                this.$message.warning('不可编辑当前规则组')
+            }else{
+                this.form.ruleList[index].ruleDetail.push({
+                    ruleName:'',
+                    baseIndex:[],
+                    indicatorCode:undefined,
+                    ruleDimension:'',
+                    dataRange:'CURRENT_DAY_DATA',
+                    ruleCondition:undefined,                                
+                    threshold:0,
+                    variableType:1,    
+                    dataUnit:'',     
+                    conditionList:[],     
+                    dataType:'',  
+                    judgeFormat:0,
+                    isUnlimited:true,               
+                })
+            }
+            
         },
         addRule(){
             this.form.ruleList.push(
@@ -432,20 +481,25 @@ export default {
                     ruleRelationship:"and",
                     ruleType:'base',
                     remark:'',
-                    processMethod:'',//预警方式
-                    sendType:'',//通知方式
+                    processMethod:'SEND',//预警方式
+                    sendType:'enterpriseWechat',//通知方式
+                    isRequired:1,
+                    isCopy:0,
                     ruleDetail:[
                         {
                             ruleName:'',
                             baseIndex:[],
-                            indicatorCode:'',
+                            indicatorCode:undefined,
                             ruleDimension:'',
                             dataRange:'CURRENT_DAY_DATA',
                             ruleCondition:undefined,                                
                             threshold:0,
                             variableType:1,   
                             dataUnit:'',   
-                            conditionList:[],                         
+                            conditionList:[],   
+                            dataType:'', 
+                            judgeFormat:0,
+                            isUnlimited:1,                     
                         },
                     ]
                 },
@@ -457,16 +511,19 @@ export default {
                 return i!=ind
             })
         },
+        deleteIcon(event){
+            event.stopPropagation();
+        },
         deleteRule(event,item,index){
             event.stopPropagation();
             console.log(item,index)
-            if(item.id){
-                postAction(this.url.ruleGroupDelete,{
-                    id:item.id
+            if(item.groupId){
+                deleteAction(this.url.ruleGroupDelete,{
+                    id:item.groupId
                 }).then(res=>{
                     console.log(res);
                     if(res.success){
-                        this.$message.success(res.messge);
+                        this.$message.success(res.message);
                         this.form.ruleList=this.form.ruleList.filter((ele,ind)=>{
                             return ind!=index
                         })
@@ -508,18 +565,22 @@ export default {
                     console.log(valid,this.form);
                     
                     this.saveLoading=true;
-                    
-                   
-                  
-                    
+
                         if(this.currentRuleId){
-                            postAction('/alarm/alarmEventRule/edit',this.form).then(res=>{
+                            let ruleList=this.form.ruleList.filter(item=>{
+                                return !item.groupId
+                            })
+                            console.log(ruleList)
+                            postAction(this.url.createRuleGroup,{
+                                templateId:this.currentRuleId,
+                                ruleList
+                            }).then(res=>{
                                 console.log(res);
                                 this.saveLoading=false;
                                 if(res.success){
                                     
-                                    this.$router.push('/autoRules')
-                                    this.$bus.$emit('remove', '/newBlankRule')
+                                    this.$router.push('/earlyWarningRules/index')
+                                    this.$bus.$emit('remove', '/earlyWarningRules/configRules')
                                 }else{
                                     this.$message.error(res.message)
                                 }
@@ -530,8 +591,8 @@ export default {
                                 console.log(res);
                                 this.saveLoading=false;
                                 if(res.success){
-                                    
-                                    
+                                    this.$router.push('/earlyWarningRules/index')
+                                    this.$bus.$emit('remove', '/earlyWarningRules/configRules')
                                 }else{
                                     this.$message.error(res.message)
                                 }
@@ -551,8 +612,8 @@ export default {
         },
 
         goBack() {
-            this.$router.replace('/autoRules')
-            this.$bus.$emit('remove', '/newBlankRule')
+             this.$router.push('/earlyWarningRules/index')
+            this.$bus.$emit('remove', '/earlyWarningRules/configRules')
            
         },
 
@@ -562,6 +623,45 @@ export default {
            
         },
 
+
+        // huixianzhi
+        getTempletDetail(){           
+            if(this.$route.query.id){
+                this.spinning=true;
+                getAction(this.url.queryDetailById,{
+                    id:this.$route.query.id
+                }).then(res=>{
+                    console.log(res);
+                    if(res.success){
+                        this.spinning=false;
+                        
+                        res.result.ruleList.map((item,index)=>{
+                            item.ruleDetail.forEach((ele,ind)=>{
+
+                                ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
+                                 getAction(this.url.ruleCondition,{
+                                    dataType:ele.dataType
+                                }).then(result=>{
+                                    console.log(result)
+                                    if(result.success){
+                                        ele.conditionList=result.result
+                                        console.log(this.form);
+                                        this.form={};
+                                        this.form=res.result
+                                    }
+                                })
+                            })
+                        })
+
+                        
+                        this.form=res.result;
+                    }
+                })
+            }else{
+                this.spinning=false;
+            }
+
+        },
     },
 
     filters:{
@@ -600,6 +700,8 @@ export default {
     },
 
     mounted(){
+        this.spinning=true;
+        this.currentRuleId=this.$route.query.id
         getAction(this.url.fieldList,{   
             mediaType:1,
             pageNo:1,
@@ -613,48 +715,14 @@ export default {
                         code:item.dimension,
                         children:item.dimensionList
                     }
-                })    
+                }) 
+                this.getTempletDetail()   
             }            
         })
 
-        console.log(this.$route.query);
-        this.currentRuleId=this.$route.query.id
-        this.edit=this.$route.query.edit=='false'?false:true
-        if(this.$route.query.id){
-            getAction(this.url.queryDetailById,{
-                id:this.$route.query.id
-            }).then(res=>{
-                console.log(res);
-                if(res.success){
-                    this.form=res.result;
-                    this.form.ruleList
-                    res.result.ruleList.map((item,index)=>{
-                        item.ruleDetail.forEach((ele,ind)=>{
-                            this.form.ruleList[index].ruleDetail[ind].baseIndex=[ele.ruleDimension,ele.indicatorCode];
-                            this.rulesFieldList.forEach(element => {
-                                if(element.code==ele.ruleDimension){
-                                    element.children.forEach(it=>{
-                                        if(it.code==ele.indicatorCode){
-                                            getAction(this.url.ruleCondition,{
-                                                dataType:it.dataType
-                                            }).then(res=>{
-                                                console.log(res)
-                                                if(res.success){
-                                                    ele.conditionList=res.result
-                                                }
-                                            })
-                                        }                        
-                                    })
-                                }               
-                            });
-                        })
-                    })
-
-                    console.log(this.form)
-                }
-            })
-        }
-
+        // console.log(this.$route.query);
+        
+        
     },
 }
 </script>
@@ -729,7 +797,7 @@ export default {
         display: flex;
         justify-content: flex-start;
         align-items: center;
-        margin-bottom: 32px;
+        margin-bottom: 20px;
         }
         .row-item:last-of-type {
         margin-bottom: 0;
@@ -806,7 +874,7 @@ export default {
             
             border-bottom: 1px solid #E4E9ED;
             padding-left: 24px;
-            padding: 20px;
+            padding: 12px;
             // display: flex;
             // justify-content: flex-start;
             align-items: center;
@@ -829,7 +897,7 @@ export default {
             }
         }
         .content{
-            padding: 24px;
+            padding: 15px;
 
             .add-rule {
                 cursor: pointer;
@@ -857,7 +925,7 @@ export default {
             .rules-list-item {
                 box-sizing: border-box;
                 width: 100%;
-                padding: 24px;
+                padding: 15px;
                 background: #f8f9fa;
                 border-radius: 4px;
                 margin-bottom: 16px;

+ 63 - 73
src/views/modules/earlyWarningRules/index.vue

@@ -1,19 +1,34 @@
 <template>
     <div class="ruleSetList">
+        <p class="title">模板列表</p>
         <div class="tabBody">
-            <a-tabs v-model="tabKey" @change="tabChange">
+            
+            <!-- <a-tabs v-model="tabKey" @change="tabChange">
                 <a-tab-pane key="1" tab="规则管理"></a-tab-pane>
                 <a-tab-pane key="2" tab="运行记录" ></a-tab-pane>
-            </a-tabs>
+            </a-tabs> -->
+            <div>
+                <span>模板名称:</span>
+                <a-input v-model="templateName" placeholder="模板名字" style="width:250px;margin-right:40px"/>
+            </div>
+            <div>
+                <span>模板id:</span>
+                <a-input v-model="templateId" placeholder="模板id" style="width:250px"/>
+            </div>
+            
+
+            <div class="opt">
+                <a-button type='primary' @click="search">查询</a-button>
+            </div>
         </div>
         <div class="tableBody">
-            <div class="opt" v-if="tabKey=='1'">
+            <div class="opt" >
                 <a-button type='primary' @click='createNewRule'>新建空白规则模板</a-button>
                 <p class="title">已创建的规则模板</p>
             </div>
-            <div class="opts" v-else>
+            <!-- <div class="opts">
                  <a-input-search placeholder="请输入规则id" style="width:350px" v-model="rulesId" enter-button @search="onSearch" />
-            </div>
+            </div> -->
             <div class="table">
                 <a-table
                     size="middle"
@@ -61,7 +76,7 @@
 
 <script>
 import moment from 'moment';
-import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
+import { getAction, postAction, downFile, downFilePost ,deleteAction} from '@/api/manage';
 let existColumns=[
     // {
     //     title: '运行/暂停',
@@ -93,13 +108,13 @@ let existColumns=[
         key: 'processMethod',
         scopedSlots: { customRender: 'processMethod' }
     },
-    {
-        title: '创建者',
-        dataIndex: 'createrName',
-        align: 'center',      
-        key: 'createrName',
-        scopedSlots: { customRender: 'createrName' }
-    },
+    // {
+    //     title: '创建者',
+    //     dataIndex: 'createrName',
+    //     align: 'center',      
+    //     key: 'createrName',
+    //     scopedSlots: { customRender: 'createrName' }
+    // },
     {
         title: '操作',
         dataIndex: 'options',
@@ -156,6 +171,8 @@ let recordsColumns=[
 export default {
     data() {
         return {
+            templateId:'',
+            templateName:"",
             relationCount:2,
 
             tabKey:"1",
@@ -187,7 +204,7 @@ export default {
                 list:'/ruleTemplate/list',
                 delete:'/ruleTemplate/delete',
                 getRelationAccountById:'/ruleAccountTemplate/getRelationAccountById',
-                edit:'',
+                
             },
         }
     },
@@ -216,9 +233,8 @@ export default {
             this.ipagination.current=pagination.current;
 
             this.ipagination.pageSize=pagination.pageSize;
-            let url=this.tabKey=='1'?this.url.existUrl:this.url.resultRecordUrl
-            
-            this.getTableListHttp(url)
+                      
+            this.getTableListHttp(this.url.list)
         },
         editRule(record){
             console.log(record);
@@ -235,78 +251,37 @@ export default {
                 console.log(res)
                 if(res.success){
                     this.relationCount=res.result.relationCount
-                    // getAction(this.url.delete,{
-                    //     id:record.id
-                    // }).then(res=>{
-                    //     console.log(res);
-                    //     if(res.success){
-                    //         this.getTableListHttp(this.url.list)
-                    //     }else{
-                    //         this.$message.error('删除失败')
-                    //     }
-                    // })
                 }
             })
         },
         deleteRule(record){
             console.log(record);
-            getAction(this.url.getRelationAccountById,{
-                id:record.id
-            }).then(res=>{
-                console.log(res)
-                if(res.success){
-                    // getAction(this.url.delete,{
-                    //     id:record.id
-                    // }).then(res=>{
-                    //     console.log(res);
-                    //     if(res.success){
-                    //         this.getTableListHttp(this.url.list)
-                    //     }else{
-                    //         this.$message.error('删除失败')
-                    //     }
-                    // })
-                }
-            })
-            
-        },
-        switchChange(text,record){
-            console.log(text,record);
-            record.spin=true;
-            let eventRuleStatus='1'
-            if(text){
-                eventRuleStatus='0'
-                
-            }else{
-                eventRuleStatus='1';
-            }
            
-            postAction('/alarm/alarmEventRule/edit',{
-                eventRuleId:record.eventRuleId,
-                eventRuleStatus,
+            deleteAction(this.url.delete,{
+                id:record.id
             }).then(res=>{
                 console.log(res);
-                record.spin=false;
                 if(res.success){
-                    // this.getTableListHttp()                    
-                    if(text){
-                        record.status=false
-                        eventRuleStatus='0'                       
-                    }else{
-                        record.status=true
-                        eventRuleStatus='1';
-                    }
+                    this.getTableListHttp(this.url.list)
                 }else{
-                    this.$message.error('修改失败')
-                    // this.getTableListHttp()
+                    this.$message.error('删除失败')
                 }
             })
+                
+            
+            
+        },
+        
+        search(){
+            this.getTableListHttp(this.url.list)
+            this.ipagination.current=1;
         },
-
         getTableListHttp(url){
             this.data=[];
             this.loading=true;
-            // let url='/alarm/alarmEventRule/list'
             getAction(url,{
+                id:this.templateId,
+                templateName:this.templateName,
                 pageNo:this.ipagination.current,
                 pageSize:this.ipagination.pageSize
             }).then(res=>{
@@ -365,8 +340,23 @@ export default {
 .ruleSetList{
     background: white;
     padding: 20px;
+    .title{         
+        height: 28px;
+        font-size: 22px;
+        font-family: PingFangSC-Medium, PingFang SC;
+        font-weight: 500;
+        color: rgba(0, 0, 0, 0.85);
+        line-height: 28px;
+    }
     .tabBody{
-        margin-bottom: 5px;
+        margin-bottom: 20px;
+        display: flex;
+        position: relative;
+        font-size: 16px;
+        .opt{
+           position: absolute; 
+           right: 0;
+        }
     }
     .tableBody{
         .opt{

+ 624 - 0
src/views/modules/earlyWarningRules/switchConfig.vue

@@ -0,0 +1,624 @@
+<template>
+    <div class='configRules'>
+    <a-spin :spinning="spinning">
+      
+    
+        <div class="toolbox-automate-rules-create-body">
+            <div class="toolbox-automate-rules-create-content_title"><h3> 开关配置</h3></div>
+            <div class="toolbox-automate-rules-create-content">
+                <a-form-model
+                    ref="ruleForm"
+                    :model="form"
+                    :rules="rules"
+                >
+                <div class="moduler">
+                    <!-- 应用对象 -->
+                    <div class="row-item" >
+                        <div class="hint-item"></div>
+                        <div class="label-item">
+                            <div class="text-item">落地页链接预警</div>
+                            <div class="required-item"></div>
+                        </div>
+                        <div class="input-item"> 
+                             <a-form-model-item ref="landingSwitch"  prop="landingSwitch">
+                                <a-radio-group v-model="form.landingSwitch" @change="landingSwitchChange">
+                                    <a-radio-button value="on">开启</a-radio-button>
+                                    <a-radio-button value="off">关闭</a-radio-button>
+                                </a-radio-group>
+                            </a-form-model-item>
+                        </div>
+                    </div>
+                    <div class="row-item" >
+                        <div class="hint-item"></div>
+                        <div class="label-item">
+                            <div class="text-item">监测链接预警</div>
+                            <div class="required-item"></div>
+                        </div>
+                        <div class="input-item"> 
+                             <a-form-model-item ref="monitoringLinkSwitch"  prop="monitoringLinkSwitch">
+                                <a-radio-group v-model="form.monitoringLinkSwitch" @change="monitoringLinkSwitchChange">
+                                    <a-radio-button value="on">开启</a-radio-button>
+                                    <a-radio-button value="off">关闭</a-radio-button>
+                                </a-radio-group>
+                            </a-form-model-item>
+                        </div>
+                    </div>
+                    
+                  
+                  
+                </div>
+               
+                <div class="moduler">
+                    <!-- <div class="moduler-title">计划名称</div> -->
+                    <div class="opt">
+                        <!-- <a-button type="default" style="margin-right:15px" @click="goBack">取消</a-button> -->
+                        <a-button type="primary"  style="margin-right:15px" @click="saveHandler" >完成</a-button>
+                    </div>
+                </div>   
+                </a-form-model>
+            </div>
+        </div>
+    </a-spin>
+    </div>
+</template>
+
+<script>
+import moment from 'moment';
+import { getAction, postAction, downFile, downFilePost,deleteAction } from '@/api/manage';
+import { Switch } from 'ant-design-vue';
+import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
+import qs from 'qs'
+export default {
+    components:{
+        Treeselect,
+    },
+    data() {
+        return {
+            
+            url:{
+                onOrOffMonitoringLink:'/rule/switch/onOrOffMonitoringLink',
+                onOrOffLandingPage:'/rule/switch/onOrOffLandingPage',
+                
+            },
+                       
+            currentRuleId:'',
+            
+            spinning:false,
+           
+           
+            form: {
+                landingSwitch:'off',
+                monitoringLinkSwitch:'off'
+            },
+            rules: {
+                templateName: [
+                    { required: true, message: '请填写规则的具体名称', trigger: 'blur' },
+                    { min: 2, message: '长度不得小于2', trigger: 'blur' },
+                ],
+                
+            },
+        }
+    },
+    watch: {
+        
+    },
+    methods: {
+              
+        landingSwitchChange(e){
+            console.log(e.target.value)
+            postAction(this.url.onOrOffLandingPage,qs.stringify({
+                accountId:'1681047013755918',
+                switchType:e.target.value
+            })).then(res=>{
+                console.log(res);
+                
+                this.$message(res.message)
+                
+            })
+        },
+        monitoringLinkSwitchChange(e){
+            console.log(e.target.value)
+            postAction(this.url.onOrOffMonitoringLink,qs.stringify({
+                accountId:'1681047013755918',
+                switchType:e.target.value
+            })).then(res=>{
+                console.log(res);
+                
+                this.$message(res.message)
+                
+            })
+        },
+        
+       
+        // form-modal 自带方法
+        onSubmit() {
+            this.$refs.ruleForm.validate(valid => {
+                if (valid) {
+                    console.log('submit!',valid);
+                } else {s
+                    console.log('error submit!!');
+                    return false;
+                }
+            });
+        },
+        resetForm() {
+            this.$refs.ruleForm.resetFields();
+        },
+       
+        displayRender({ labels }) {
+            return labels[labels.length - 1];
+        },
+       
+        saveHandler(){
+            this.$router.push('/earlyWarningRules/index')
+            this.$bus.$emit('remove', '/earlyWarningRules/switchConfig')
+           
+        },
+
+        // goBack() {
+        //     this.$router.push('/earlyWarningRules/index')
+        //     this.$bus.$emit('remove', '/earlyWarningRules/configRules')
+           
+        // },
+
+
+       
+
+        // huixianzhi
+        getTempletDetail(){           
+            if(this.$route.query.id){
+                this.spinning=true;
+                getAction(this.url.queryDetailById,{
+                    id:this.$route.query.id
+                }).then(res=>{
+                    console.log(res);
+                    if(res.success){
+                        this.spinning=false;
+                        
+                        res.result.ruleList.map((item,index)=>{
+                            item.ruleDetail.forEach((ele,ind)=>{
+
+                                ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
+                                 getAction(this.url.ruleCondition,{
+                                    dataType:ele.dataType
+                                }).then(result=>{
+                                    console.log(result)
+                                    if(result.success){
+                                        ele.conditionList=result.result
+                                        console.log(this.form);
+                                        this.form={};
+                                        this.form=res.result
+                                    }
+                                })
+                            })
+                        })
+
+                        
+                        this.form=res.result;
+                    }
+                })
+            }else{
+                this.spinning=false;
+            }
+
+        },
+    },
+
+    filters:{
+       
+        
+    },
+
+    mounted(){
+        
+        this.currentRuleId=this.$route.query.id
+        getAction(this.url.fieldList,{   
+            mediaType:1,
+            pageNo:1,
+            pageSize:500,
+        }).then(res=>{
+            console.log(res);
+            if(res.success){ 
+                this.rulesFieldList=res.result.map(item=>{
+                    return {
+                        name:item.dimensionName,
+                        code:item.dimension,
+                        children:item.dimensionList
+                    }
+                }) 
+                this.getTempletDetail()   
+            }            
+        })
+
+        // console.log(this.$route.query);
+        
+        
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.configRules{
+    .add-rule:hover {
+        color: #2F88FF;
+        border-color: #2F88FF;
+    }
+     .add-rule {
+                cursor: pointer;
+               
+                height: 40px;
+                border-radius: 2px;
+                border: 1px dashed #dadfe3;
+                font-size: 12px;
+                display: flex;
+                flex-flow: row column;
+                justify-content: center;
+                align-items: center;
+                color: #666;
+                margin-top: 16px;
+                -moz-user-select: none;
+                -webkit-user-select: none;
+                -ms-user-select: none;
+                -khtml-user-select: none;
+                user-select: none;
+            }
+    .toolbox-automate-rules-create-body {
+        margin: 16px 12px 12px;
+        padding: 32px 32px 16px;
+        background-color: #fff;
+        border-radius: 4px;
+    }
+    .toolbox-automate-rules-create-content_title {
+        background-color: #fff;
+        display: flex;
+        flex-flow: row nowrap;
+        justify-content: flex-start;
+        align-items: center;
+        margin-bottom: 28px;
+        h3 {
+            font-size: 22px;
+            margin: 0;
+            font-weight: 400;
+            height: 30px;
+            line-height: 30px;
+        }
+    }
+    .toolbox-automate-rules-create-content {
+        padding-left: 28px;
+    }
+    .moduler {
+         .opt {
+            text-align: right;
+        }
+        width: 100%;
+        background: #fff;
+        margin-bottom: 16px;
+        position: relative;
+        padding: 32px 24px 48px 32px;
+        // border-radius: 4px;
+        // box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
+        .moduler-title {
+        display: flex;
+        align-items: center;
+        font-size: 22px;
+        margin-bottom: 20px;
+        }
+        .row-item {
+        display: flex;
+        justify-content: flex-start;
+        align-items: center;
+        margin-bottom: 32px;
+        }
+        .row-item:last-of-type {
+        margin-bottom: 0;
+        }
+        .row-item .hint-item {
+        width: 24px;
+        min-width: 24px;
+        align-self: flex-start;
+        line-height: 20px;
+        height: 20px;
+        margin-top: 9px;
+        }
+        .row-item .label-item {
+        position: relative;
+        align-items: flex-start;
+        align-self: flex-start;
+        line-height: 20px;
+        height: 20px;
+        margin-top: 10px;
+        width: 120px;
+        
+        .text-item {
+            font-size: 14px;
+            width: 100px;
+        }
+        }
+        .row-item .required-item {
+        width: 4px;
+        height: 4px;
+        border-radius: 2px;
+        background: #f45858;
+        position: absolute;
+        right: 10px;
+        top: 50%;
+        transform: translateY(-50%);
+        }
+        .row-item .input-item {
+        min-width: 480px;
+        position: relative;
+        // height: 35px;
+        .tip {
+            font-size: 12px;
+            color: tomato;
+        }
+        }
+        .adName{
+        display: flex;
+        .nameList{
+            width: 90%;
+        }
+        .item{
+            display: inline-block;
+            width: 30%;
+            margin-left: 15px;
+            margin-bottom: 10px;
+        }
+        }
+    }
+
+    .toolbox-automate-rules-create-content_rules-and-condition_rules {
+        margin-bottom: 24px;  
+    }
+    .toolbox-automate-rules-create-content_rules-and-condition_rules, .toolbox-automate-rules-create-content_rules-and-condition_condition {
+        width: 1138px;
+        background: #fff;
+        border-radius: 4px;
+        border: 1px solid #dadfe3;
+    }
+    .toolbox-automate-rules-create-content_rules-and-condition_rules, .toolbox-automate-rules-create-content_rules-and-condition_condition{
+         .title{
+            font-size: 14px;
+            font-weight: 600;
+            color: #333;
+            
+            border-bottom: 1px solid #E4E9ED;
+            padding-left: 24px;
+            padding: 12px;
+            // display: flex;
+            // justify-content: flex-start;
+            align-items: center;
+            .condition-title{
+                padding-right: 17px;
+            }
+        }
+         .title2{
+            font-size: 14px;
+            font-weight: 600;
+            color: #333;
+            height: 56px;
+            border-bottom: 1px solid #E4E9ED;
+            padding-left: 24px;
+            display: flex;
+            justify-content: flex-start;
+            align-items: center;
+            .condition-title{
+                padding-right: 17px;
+            }
+        }
+        .content{
+            padding: 15px;
+
+            .add-rule {
+                cursor: pointer;
+               
+                height: 40px;
+                border-radius: 2px;
+                border: 1px dashed #dadfe3;
+                font-size: 12px;
+                display: flex;
+                flex-flow: row column;
+                justify-content: center;
+                align-items: center;
+                color: #666;
+                margin-top: 16px;
+                -moz-user-select: none;
+                -webkit-user-select: none;
+                -ms-user-select: none;
+                -khtml-user-select: none;
+                user-select: none;
+            }
+            .add-rule:hover {
+                color: #2F88FF;
+                border-color: #2F88FF;
+            }
+            .rules-list-item {
+                box-sizing: border-box;
+                width: 100%;
+                padding: 15px;
+                background: #f8f9fa;
+                border-radius: 4px;
+                margin-bottom: 16px;
+                display: flex;
+                align-items: center;
+                position: relative;
+                .rules-list-item-delete {
+                    position: absolute;
+                    right: 24px;
+                    height: 30px;
+                    padding-left: 24px;
+                    border-left: 1px solid #DADFE3;
+                    cursor: pointer;
+                }
+                .rules-list-item-subject {
+                    width: 120px;
+                    margin-right: 16px;
+                    display: flex;
+                    .ruleName{
+                        display: block;
+                        width: 100%;
+                        height: 32px;
+                        line-height: 32px;
+                        text-align: center;
+                        background-color: #fff;
+                        border: 1px solid #d9d9d9;
+                        border-radius: 4px;
+                    }
+                }
+            }
+            .rules—list_item:last-of-type {
+                margin-bottom: 0;
+            }
+        }
+    }
+
+    .selectedExist{
+         width: 500px;
+         padding-top: 5px;
+         .inventory-tags-lists-header {
+          background-color: #F8F9FA;
+          border: 1px solid #E4E9ED;
+          height: 36px;
+          line-height: 33px;
+          border-radius: 4px 4px 0 0;
+          font-weight: bold;
+          display: flex;
+        }
+
+        .inventory-tags-lists-container {
+          border: 1px solid #E4E9ED;
+          margin-top: -1px;
+          height: 100%;
+          padding: 4px 0px;
+          border-radius: 0 0 4px 4px;
+          height: 300px;
+          overflow: auto;
+          
+        }
+
+        .inventory-tags-lists-item {
+          width: 100%;
+          height: 37px;
+          line-height: 37px;
+          padding-left: 12px;
+          padding-right: 12px;
+          display: flex;
+          font-size: 14px;
+          color: #333;
+        }
+               
+                .input{
+                    margin-bottom:16px ;
+                }
+                .campaign-have-list{
+                    font-family: PingFangSC-Regular;
+                    font-size: 14px;
+                    color: #333;
+                    border: 1px solid #DADFE3;
+                    border-radius: 4px;
+                    margin-bottom: 16px;
+                    height: 388px;
+                    .campaign-have-header {
+                        height: 38px;
+                        width: 100%;
+                        padding-left: 13px;
+                        line-height: 38px;
+                        background: #f8f9fa;
+                        border-radius: 4px 4px 0px 0px;
+                        border-bottom: 1px solid #DADFE3;
+                    }
+                    .campaign-have-list ul {
+                        width: 100%;
+                        height: 350px;
+                        padding-top: 6px;
+                        
+                    }
+                    li{
+                        padding: 6px 10px;
+                        cursor: pointer;
+                    }
+                    li:hover{
+                        background: #EDF1F5;
+                    }
+                    .ad-d-flex-between {
+                        justify-content: space-between !important;
+                    }
+
+                    .ad-d-flex, .ad-btn {
+                        display: flex;
+                        align-items: center;
+                    }
+                    .byted-loading-v {
+                        position: absolute;
+                        top: 0;
+                        right: 0;
+                        bottom: 0;
+                        left: 0;
+                        z-index: 996;
+                        background-color: hsla(0,0%,96%,.9);
+                    }
+                    .info{
+                        width: 60%;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                    }
+                    .landing-type {
+                        color: #999;
+                        font-size: 12px;
+                        white-space: nowrap;
+                    }
+                }
+                .noAccountID{
+                    font-size: 14px;
+                    text-align: center;
+                    color: #999;
+                    line-height: 388px;
+                }
+                .fenye{
+                    height: 60px;
+                    padding-top: 12px;
+                    text-align: right;
+                }
+            }
+}
+</style>
+<style lang="scss">
+.configRules{
+    .ant-collapse > .ant-collapse-item > .ant-collapse-header {
+        position: relative;
+        padding: 12px 16px;
+        padding-left: 40px;
+        color: rgba(0, 0, 0, 0.85);
+        line-height: 22px;
+        cursor: pointer;
+        -webkit-transition: all 0.3s;
+        height: 46px;
+        transition: all 0.3s;
+    }
+    .ant-form-item {
+        margin-bottom: 0;
+        
+    }
+    .content{
+        .ant-form-item {
+            margin-bottom: 0;
+            width: 100%;
+        } 
+    }
+    .ant-radio-button-wrapper {
+        
+        min-width: 70px;
+        text-align: center;
+    }
+    .ant-checkbox-wrapper,
+    .ant-checkbox-group-item {
+      display: block;
+      padding: 5px 15px;
+    }
+
+    .ant-checkbox-wrapper:first-child {
+      padding: 0 15px 5px;
+    }
+}
+</style>

+ 1 - 0
vue.config.js

@@ -74,6 +74,7 @@ module.exports = {
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
         // target: 'http://192.168.1.43:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        // target: 'http://192.168.1.43:8888', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.1.219:8080', //请求本地 需要jeecg-boot后台项目  赵西安
         //  target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目