朱鑫波 4 سال پیش
والد
کامیت
12a98772d1
2فایلهای تغییر یافته به همراه60 افزوده شده و 58 حذف شده
  1. 42 41
      src/components/formComponents/toutiaoTime.vue
  2. 18 17
      src/views/modules/earlyWarningRules/ruleModule.vue

+ 42 - 41
src/components/formComponents/toutiaoTime.vue

@@ -3,10 +3,10 @@
     <table class="time_table table" v-on:mouseleave="mouseleave">
       <thead>
         <tr>
-          <th rowspan="2" style="width:120px">日期/时间</th>
+          <th rowspan="2" style="width: 120px">日期/时间</th>
         </tr>
         <tr>
-          <th class="unselectable" v-for="(num, index) in numData" :key="index" style="width:30px">{{ num }}</th>
+          <th class="unselectable" v-for="(num, index) in numData" :key="index" style="width: 30px">{{ num }}</th>
         </tr>
       </thead>
       <tbody>
@@ -41,8 +41,8 @@ export default {
       type: String,
       default() {
         return '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
-      }
-    }
+      },
+    },
   },
   data() {
     return {
@@ -52,39 +52,39 @@ export default {
       timeData: [
         {
           date: '周一',
-          time: []
+          time: [],
         },
         {
           date: '周二',
-          time: []
+          time: [],
         },
         {
           date: '周三',
-          time: []
+          time: [],
         },
         {
           date: '周四',
-          time: []
+          time: [],
         },
         {
           date: '周五',
-          time: []
+          time: [],
         },
         {
           date: '周六',
-          time: []
+          time: [],
         },
         {
           date: '周日',
-          time: []
-        }
+          time: [],
+        },
       ],
       selectFlag: false,
       max: {
         x: 0,
-        y: 0
+        y: 0,
       },
-      dataString: ''
+      dataString: '',
     }
   },
   methods: {
@@ -102,7 +102,7 @@ export default {
     showOne(index, key) {
       //   this.timeData[index].time[key].isSelected = !this.timeData[index].time[key].isSelected
     },
-    mousedown: function(index, key) {
+    mousedown: function (index, key) {
       this.selectStart = []
       this.selectFlag = true
       if (this.timeData[index].time[key].value == false) {
@@ -114,10 +114,10 @@ export default {
       }
       this.selectStart.push({
         index: index,
-        key: key
+        key: key,
       })
     },
-    mouseover: function(index, key) {
+    mouseover: function (index, key) {
       // x 垂直方向  y 水平方向
       if (this.selectFlag) {
         if (index >= this.max.x) {
@@ -128,11 +128,11 @@ export default {
         }
         var start = {
           x: this.selectStart[0].index,
-          y: this.selectStart[0].key
+          y: this.selectStart[0].key,
         }
         var end = {
           x: index,
-          y: key
+          y: key,
         }
         for (var i = end.x; i <= this.max.x; i++) {
           for (var j = end.y; j <= this.max.y; j++) {
@@ -153,14 +153,14 @@ export default {
         }
       }
     },
-    mouseup: function(index, key) {
+    mouseup: function (index, key) {
       var start = {
         x: this.selectStart[0].index,
-        y: this.selectStart[0].key
+        y: this.selectStart[0].key,
       }
       var end = {
         x: index,
-        y: key
+        y: key,
       }
       /* 渲染选中的区域 */
       var data = []
@@ -179,7 +179,7 @@ export default {
         this.timeData[5].time,
         this.timeData[6].time
       )
-      this.dataString = arr.map(item => {
+      this.dataString = arr.map((item) => {
         if (item.isSelected) {
           return 1
         } else {
@@ -191,10 +191,10 @@ export default {
       this.selectFlag = false
       this.max = {
         x: 0,
-        y: 0
+        y: 0,
       }
     },
-    mouseleave: function() {
+    mouseleave: function () {
       this.selectFlag = false
     },
     setItemDate(sum) {
@@ -221,32 +221,32 @@ export default {
       this.timeData = [
         {
           date: '周一',
-          time: []
+          time: [],
         },
         {
           date: '周二',
-          time: []
+          time: [],
         },
         {
           date: '周三',
-          time: []
+          time: [],
         },
         {
           date: '周四',
-          time: []
+          time: [],
         },
         {
           date: '周五',
-          time: []
+          time: [],
         },
         {
           date: '周六',
-          time: []
+          time: [],
         },
         {
           date: '周日',
-          time: []
-        }
+          time: [],
+        },
       ]
       for (let i = 0; i < arr.length; i++) {
         if (i < 24) {
@@ -265,20 +265,21 @@ export default {
           this.timeData[6].time.push({ isSelected: arr[i] == 1 ? true : false, move: false, value: false })
         }
       }
-    }
+    },
   },
   watch: {
     scheduleTime: {
       immediate: true, // immediate选项可以开启首次赋值监听
       handler(newVal, oldVal) {
-        if(newVal == '' || newVal == null || newVal == undefined){
-            // this.scheduleTime=oldVal
-            this.$emit('update:scheduleTime', oldVal)
+        if (newVal == '' || newVal == null || newVal == undefined) {
+          // this.scheduleTime=oldVal
+          this.$emit('update:scheduleTime', oldVal)
+        } else {
+          this.init()
         }
-        this.init()
-      }
-    }
-  }
+      },
+    },
+  },
 }
 </script>
 

+ 18 - 17
src/views/modules/earlyWarningRules/ruleModule.vue

@@ -34,7 +34,7 @@
         <div class="toolbox-automate-rules-create-content">
           <a-form-model ref="ruleForm" :model="form" layout="horizontal">
             <div class="moduler">
-              <template v-for="(item, index) of form.ruleList" >
+              <template v-for="(item, index) of form.ruleList">
                 <div class="row-item" v-if="item.ruleType == 'base' && item.isCopy == 0" :key="index">
                   <div class="hint-item">
                     <a-tooltip>
@@ -124,21 +124,18 @@
 
                       <!-- <p v-else-if="value.modelType == 'timeRange'">{{value.threshold}}</p> -->
                       <scheduleTime
-                         
-                        style="width:100%"
+                        style="width: 100%"
                         :scheduleTime.sync="value.threshold"
-                        ref="selectCheck"                      
+                        ref="selectCheck"
                         v-else-if="value.modelType == 'scheduleTime'"
                       >
-
                       </scheduleTime>
-                        <!--  v-model="value.threshold" -->
-                       <region
+                      <!--  v-model="value.threshold" -->
+                      <region
                         :disabled="!editShow"
-                        :cascaderValue.sync='value.threshold'
-                        style="width: 100%;height:32px"
-                        :isLazy='true'
-                       
+                        :cascaderValue.sync="value.threshold"
+                        style="width: 100%; height: 32px"
+                        :isLazy="true"
                         v-else-if="value.modelType == 'region'"
                       >
                       </region>
@@ -262,7 +259,6 @@
                                       :maxTagCount="3"
                                     >
                                     </a-select>
-                                    
                                   </a-form-model-item>
                                 </div>
                               </div>
@@ -429,7 +425,6 @@
                                 :key="valueElseIndex"
                               >
                                 {{ valueIndex == 0 ? '复建' : '删除' }}
-                                
                               </div>
                             </template>
                           </div>
@@ -444,7 +439,7 @@
         </div>
       </a-spin>
     </div>
-    <switchConfig :disabled="!editShow" v-if="editShow"/>
+    <switchConfig :disabled="!editShow" v-if="form.mediaType == 1 || form.mediaType == 3" />
     <div class="toolbox-automate-rules-create-body" v-if="editShow">
       <div class="moduler">
         <div class="opt">
@@ -1116,7 +1111,7 @@ export default {
     this.editShow = data.edit
     if (data.edit) {
       this.spinLoading = true
-      
+
       getAction('/ruleTemplate/queryDetailByAccountIdAndTemplateId', {
         templateId: data.id,
         accountId: data.accountId,
@@ -1158,6 +1153,10 @@ export default {
       getAction('/ruleTemplate/previewTemplate', { id: data.id }).then((res) => {
         if (res.success) {
           this.form = res.result
+          var str = ''
+          for (let i = 0; i < 7 * 24; i++) {
+            str += '0'
+          }
           var data = this.form.ruleList.map((item) => {
             return {
               ...item,
@@ -1166,14 +1165,16 @@ export default {
                   var data = end.map((c) => {
                     return {
                       ...c,
-                      threshold: c.modelType == 'tagBox' ? undefined : end.threshold,
+                      threshold:
+                        c.modelType == 'tagBox' ? undefined : c.modelType == 'scheduleTime' ? str : end.threshold,
                     }
                   })
                   return [...data]
                 } else {
                   return {
                     ...end,
-                    threshold: end.modelType == 'tagBox' ? undefined : end.threshold,
+                    threshold:
+                      end.modelType == 'tagBox' ? undefined : end.modelType == 'scheduleTime' ? str : end.threshold,
                   }
                 }
               }),