Эх сурвалжийг харах

解决搜索显示问题和周期

FinalYu 2 жил өмнө
parent
commit
b0a038ef61

+ 48 - 4
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -143,10 +143,19 @@
                   ></el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item :label="modeValueTips" prop="modeValue" v-if="groupRateForm.readMode != '1'">
+              <el-form-item :label="modeValueTips" prop="modeValue" v-if="groupRateForm.readMode != '1'" class="cy-mv">
                 <el-input v-model="groupRateForm.modeValue" :placeholder="'请输入' + modeValueTips"
                           oninput="value=value.replace(/[^0-9.]/g,'')">
-                  <template slot="append" v-if="groupRateForm.readMode == '0'">秒</template>
+                  <template slot="append" v-if="groupRateForm.readMode == '0'">
+                    <el-select v-model="groupRateForm.modeValueUnit" @change="readModeValueUnitChange" placeholder="">
+                      <el-option
+                          v-for="dict in modeValueUnitList"
+                          :key="dict.value"
+                          :label="dict.key"
+                          :value="dict.value"
+                      ></el-option>
+                    </el-select>
+                  </template>
                 </el-input>
               </el-form-item>
               <el-form-item label='报表取值模式' prop="valueMode">
@@ -208,7 +217,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label='数据项:' style="margin-bottom: 0px; width: 300px;">
+        <el-form-item v-if="itemDataStep == 2" label='数据项:' style="margin-bottom: 0px; width: 300px;">
           <el-input placeholder="请输入数据项名称进行过滤" style=""
                     @input="chooseItemChangeEvent" v-model="filterChooseItemText"></el-input>
         </el-form-item>
@@ -417,6 +426,16 @@ export default {
       },
       delFlag: true,
       modeValueTips: '模式值',
+      modeValueUnitList: [{
+        'key': '秒',
+        'value': '1'
+      }, {
+        'key': '分',
+        'value': '2'
+      }, {
+        'key': '时',
+        'value': '3'
+      }],
       // 读取模式
       readModeList: [{
         'key': '按周期读取数据',
@@ -471,6 +490,7 @@ export default {
       groupRateForm: {
         readMode: null,
         modeValue: '',
+        modeValueUnit: '1',
         valueMode: '',
         valuePeriod: ['00:00:00', '23:59:59']
       },
@@ -729,6 +749,7 @@ export default {
       this.groupRateForm = {
         readMode: null,
         modeValue: '',
+        modeValueUnit: '1',
         valueMode: '',
         valuePeriod: ['00:00:00', '23:59:59']
       }
@@ -744,7 +765,13 @@ export default {
           // 参数封装
           let params = JSON.parse(JSON.stringify(this.groupBasicForm))
           params.readMode = this.groupRateForm.readMode
-          params.modeValue = this.groupRateForm.modeValue
+          if (this.groupRateForm.modeValueUnit === '2') { // 分
+            params.modeValue = parseInt(this.groupRateForm.modeValue) * 60
+          } else if (this.groupRateForm.modeValueUnit === '3') { // 时
+            params.modeValue = parseInt(this.groupRateForm.modeValue) * 60 * 60
+          } else {
+            params.modeValue = this.groupRateForm.modeValue
+          }
           params.valueCondition = this.groupRateForm.valueMode
           params.startReadTime = this.groupRateForm.valuePeriod[0]
           params.endReadTime = this.groupRateForm.valuePeriod[1]
@@ -813,6 +840,13 @@ export default {
         this.groupDialogTitle = '修改数据组'
         this.groupRateForm.readMode = item.readMode + ''
         this.groupRateForm.modeValue = item.modeValue
+        if (parseInt(item.modeValue) % 3600 == 0) { // 时
+          this.groupRateForm.modeValueUnit = '3'
+        } else if (parseInt(item.modeValue) % 60 == 0) { // 分
+          this.groupRateForm.modeValueUnit = '2'
+        } else { // 秒
+          this.groupRateForm.modeValueUnit = '1'
+        }
         this.groupRateForm.valueMode = item.valueCondition + ''
         this.groupRateForm.valuePeriod = [item.startReadTime, item.endReadTime]
         switch (this.groupRateForm.readMode) {
@@ -928,6 +962,10 @@ export default {
         this.updateGroupItem()
       }
     },
+    /** 读取模式值单位改变事件 */
+    readModeValueUnitChange(val) {
+      console.log(val + ', ' + this.groupRateForm.modeValueUnit)
+    },
     /** 读取模式值改变事件 */
     readModeChange(val) {
       this.groupRateForm.readMode = val
@@ -1597,4 +1635,10 @@ export default {
     }
   }
 }
+
+.cy-mv {
+  .el-input-group__append, .el-input-group__prepend {
+    width: 70px;
+  }
+}
 </style>

+ 15 - 5
chuanyi_client2/src/views/group_item/index.vue

@@ -117,6 +117,7 @@ export default {
       clearInterval(this.timeInterval)
       this.timeInterval = null
     }
+    sessionStorage.removeItem('GROUP_ID')
   },
   methods: {
     itemChangeEvent(value) {
@@ -149,6 +150,7 @@ export default {
     /** 获取数据项值信息 */
     getItemValueById() {
       if (!this.groupRunStatus || !this.chooseGroup) {
+        this.filterItemText = ''
         if (this.timeInterval) {
           clearInterval(this.timeInterval)
           this.timeInterval = null
@@ -169,13 +171,21 @@ export default {
       })
       let temp = setInterval(() => {
         getItemValueById(this.chooseGroup.id).then(res => {
-          this.filterItemText = ''
-          this.itemDataList = res.data
+          // this.filterItemText = ''
+          let list = res.data
           // 避免布尔类型时页面无法显示数据
-          for (let i = 0; i < this.itemDataList.length; i ++) {
-            this.itemDataList[i].dataValue += ''
+          for (let i = 0; i < list.length; i ++) {
+            list[i].dataValue += ''
+          }
+          if (this.filterItemText) {
+            let filterList = list.filter(v => {
+              return v.itemName.indexOf(this.filterItemText) !== -1
+            })
+            this.itemDataList = filterList
+          } else {
+            this.itemDataList = list
           }
-          this.itemDataListF = JSON.parse(JSON.stringify(this.itemDataList))
+          this.itemDataListF = JSON.parse(JSON.stringify(list))
         }).catch((e) => {
           showAlertWin(this, e)
         })

+ 1 - 1
chuanyi_client2/src/views/index.vue

@@ -40,7 +40,7 @@ export default {
   data() {
     return {
       defaultPercent: 14,
-      minPercent: 5,
+      minPercent: 14,
       mainViewType: 0,
       refreshReportTemplateDataFlag: false
     }