Browse Source

0921 修改如果设备数据为空,抽取异常问题

allen 2 years ago
parent
commit
75cbe9243e

+ 61 - 53
src/views/modules/visi/create1.vue

@@ -315,7 +315,7 @@ export default {
       showInfo: false, // 属性数据预览
       showRiZhi: false, // 控制日志的显隐
 
-      soutRiZhiSucess: '-------------------------------success--------------------------' + '\n\n',
+      soutRiZhiSucess: '-------------------------------info--------------------------' + '\n\n',
       soutRizhi: '运行过程,将会显示在这儿 。再次点击日志图标,将关闭窗口', // 输出日志内容‘
       showPreview: false, // 控制预览窗口的显隐
       showTable: false,
@@ -472,73 +472,81 @@ export default {
     },
     async yunXingClick () {
       this.showRiZhi = true
-      this.soutRizhi = '检测设备状态完毕,开始抽取数据....' + '\n\n' + '....' // 输出日志内容
+      var onlyStatic = true
       this.yunXingUid = new Date().getTime()
-      for (let i = 0; i < this.imsql.length; i++) {
-        if (i === 0) {
-          this.imsql[i].oldFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
-          this.imsql[i].newFileName = this.imsql[i].oldFileName
-          if (this.imsql.length === 1) {
-            this.imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+      if (this.imsql.length === 0) {
+        this.soutRizhi = '请先选择抽取的字段....'
+      } else {
+        this.soutRizhi = '检测设备状态完毕,开始抽取数据....' + '\n\n' + '....' // 输出日志内容
+
+        for (let i = 0; i < this.imsql.length; i++) {
+          if (i === 0) {
+            this.imsql[i].oldFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
+            this.imsql[i].newFileName = this.imsql[i].oldFileName
+            if (this.imsql.length === 1) {
+              this.imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+              this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+            }
+          } else if (i === this.imsql.length - 1) {
+            this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
             this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+          } else {
+            this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
+            this.imsql[i].newFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
           }
-        } else if (i === this.imsql.length - 1) {
-          this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
-          this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
-        } else {
-          this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
-          this.imsql[i].newFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
         }
-      }
-      var onlyStatic = true
-      for (let j = 0; j < this.imsql.length; j++) {
-        this.imsql[j]['start'] = this.selectTime[0]
-        this.imsql[j]['end'] = this.selectTime[1]
-        await this.$http({
-          url: this.$http.adornUrl('/dataset/dynamic/makeDyDataSet'),
-          method: 'post',
-          data: this.$http.adornData(this.imsql[j], false)
-        }).then(subresult => {
-          var context = subresult.data
 
-          this.soutRizhi = context.info + '\n\n' + this.soutRizhi
-        })
-        onlyStatic = false
+        for (let j = 0; j < this.imsql.length; j++) {
+          this.imsql[j]['start'] = this.selectTime[0]
+          this.imsql[j]['end'] = this.selectTime[1]
+          await this.$http({
+            url: this.$http.adornUrl('/dataset/dynamic/makeDyDataSet'),
+            method: 'post',
+            data: this.$http.adornData(this.imsql[j], false)
+          }).then(subresult => {
+            var context = subresult.data
+
+            this.soutRizhi = context.info + '\n\n' + this.soutRizhi
+          })
+          onlyStatic = false
+        }
       }
 
       if (this.st_imsql.length > 0) {
         this.soutRizhi = '\n' + '开始组合本地数据' + '\n\n' + this.soutRizhi
-      }
-      for (let i = 0; i < this.st_imsql.length; i++) {
-        if (i === 0) {
-          this.st_imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
-          this.st_imsql[i].newFileName = this.st_imsql[i].oldFileName
-          if (this.st_imsql.length === 1) {
+        for (let i = 0; i < this.st_imsql.length; i++) {
+          if (i === 0) {
             this.st_imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+            this.st_imsql[i].newFileName = this.st_imsql[i].oldFileName
+            if (this.st_imsql.length === 1) {
+              this.st_imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+              this.st_imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+            }
+          } else if (i === this.st_imsql.length - 1) {
+            this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
             this.st_imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+          } else {
+            this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
+            this.st_imsql[i].newFileName = this.userID + '_' + this.st_imsql[i].subEquipmentID + '_' + this.st_imsql[i].id
           }
-        } else if (i === this.st_imsql.length - 1) {
-          this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
-          this.st_imsql[i].newFileName = this.userID + '_' + this.yunXingUid
-        } else {
-          this.st_imsql[i].oldFileName = this.st_imsql[i - 1].newFileName
-          this.st_imsql[i].newFileName = this.userID + '_' + this.st_imsql[i].subEquipmentID + '_' + this.st_imsql[i].id
         }
-      }
-      for (let sti = 0; sti < this.st_imsql.length; sti++) {
-        var massage = {
-          'st_imsql': this.st_imsql[sti],
-          'onlyStatic': onlyStatic
+        for (let sti = 0; sti < this.st_imsql.length; sti++) {
+          var massage = {
+            'st_imsql': this.st_imsql[sti],
+            'onlyStatic': onlyStatic
+          }
+          await this.$http({
+            url: this.$http.adornUrl('/dataset/static/makeStaticDataSet'),
+            method: 'post',
+            data: this.$http.adornData(massage, false)
+          }).then(subresult => {
+            this.soutRizhi = subresult.data.info + '\n\n' + this.soutRizhi
+          })
         }
-        await this.$http({
-          url: this.$http.adornUrl('/dataset/static/makeStaticDataSet'),
-          method: 'post',
-          data: this.$http.adornData(massage, false)
-        }).then(subresult => {
-          this.soutRizhi = subresult.data.info + '\n\n' + this.soutRizhi
-        })
+        this.soutRizhi = this.soutRiZhiSucess + '静态数据测试抽取完成,点击确定制作数据集' + '\n\n' + this.soutRizhi
+      } else {
+        this.soutRizhi = this.soutRiZhiSucess + '结束'
       }
-      this.soutRizhi = this.soutRiZhiSucess + '静态数据测试抽取完成,点击确定制作数据集' + '\n\n' + this.soutRizhi
     },
     yuLanMouseOver () {
       document.getElementById('yuLan').className = 'iconfont icon-preview1'

+ 37 - 36
src/views/modules/visi/create2.vue

@@ -251,7 +251,7 @@
 import mycron from './quartz/mycron'
 import PythonKafkaTmp from '../alg/python-kafka-tmp.vue'
 import { MessageBox } from 'element-ui'
-import { Message } from "element-ui"
+import { Message } from 'element-ui'
 export default {
   // import引入的组件需要注入到对象中才能使用
   components: {
@@ -286,7 +286,7 @@ export default {
       showInfo: false, // 属性数据预览
       showRiZhi: false, // 控制日志的显隐
       soutRizhi: '运行过程,将会显示在这儿 。再次点击日志图标,将关闭窗口', // 输出日志内容
-      soutRiZhiSucess: '-------------------------------success--------------------------' + '\n\n',
+      soutRiZhiSucess: '-------------------------------info--------------------------' + '\n\n',
       showPreview: false, // 控制预览窗口的显隐
       showTable: false,
       // userID: '666', // 用户编号
@@ -415,36 +415,40 @@ export default {
     },
     async yunXingClick () {
       this.showRiZhi = true
-      this.soutRizhi = '检测设备状态完毕,开始抽取数据....' + '\n\n' + '....' // 输出日志内容
-      this.yunXingUid = new Date().getTime()
-      for (let i = 0; i < this.imsql.length; i++) {
-        if (i === 0) {
-          this.imsql[i].oldFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
-          this.imsql[i].newFileName = this.imsql[i].oldFileName
-          if (this.imsql.length === 1) {
-            this.imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+      if (this.imsql.length === 0) {
+        this.soutRizhi = '请先选择抽取的字段....'
+      } else {
+        this.soutRizhi = '\n 检测设备状态完毕,开始抽取数据....'  // 输出日志内容
+        this.yunXingUid = new Date().getTime()
+        for (let i = 0; i < this.imsql.length; i++) {
+          if (i === 0) {
+            this.imsql[i].oldFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
+            this.imsql[i].newFileName = this.imsql[i].oldFileName
+            if (this.imsql.length === 1) {
+              this.imsql[i].oldFileName = this.userID + '_' + this.yunXingUid
+              this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+            }
+          } else if (i === this.imsql.length - 1) {
+            this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
             this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
+          } else {
+            this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
+            this.imsql[i].newFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
           }
-        } else if (i === this.imsql.length - 1) {
-          this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
-          this.imsql[i].newFileName = this.userID + '_' + this.yunXingUid
-        } else {
-          this.imsql[i].oldFileName = this.imsql[i - 1].newFileName
-          this.imsql[i].newFileName = this.userID + '_' + this.imsql[i].subEquipmentID + '_' + this.imsql[i].id
         }
-      }
-      for (let j = 0; j < this.imsql.length; j++) {
-        await this.$http({
-          url: this.$http.adornUrl('/dataset/dynamic/makeDyDataSet'),
-          method: 'post',
-          data: this.$http.adornData(this.imsql[j], false)
-        }).then(subresult => {
-          var context = subresult.data
+        for (let j = 0; j < this.imsql.length; j++) {
+          await this.$http({
+            url: this.$http.adornUrl('/dataset/dynamic/makeDyDataSet'),
+            method: 'post',
+            data: this.$http.adornData(this.imsql[j], false)
+          }).then(subresult => {
+            var context = subresult.data
 
-          this.soutRizhi = context.info + '\n\n' + this.soutRizhi
-        })
+            this.soutRizhi = context.info + '\n\n' + this.soutRizhi
+          })
+        }
+        this.soutRizhi = this.soutRiZhiSucess + '结束' + '\n\n' + this.soutRizhi
       }
-      this.soutRizhi = this.soutRiZhiSucess + '动态数据测试抽取完成,点击确定制作数据集' + '\n\n' + this.soutRizhi
     },
     yuLanMouseOver () {
       document.getElementById('yuLan').className = 'iconfont icon-preview1'
@@ -472,13 +476,14 @@ export default {
         data: this.$http.adornData(this.imsql, false)
       }).then(preDatas => {
         const Content = preDatas.data.preContent
-
         this.preTableDate = [] // 清空之前是数据
-        for (var c = 0; c < Content.length; c++) {
-          this.preTableDate.push(Content[c])
-          this.prewListLoading = false
+        if (Content.length !== 0) {
+          for (var c = 0; c < Content.length; c++) {
+            this.preTableDate.push(Content[c])
+          }
         }
       })
+      this.prewListLoading = false
       this.showPreview = true
     },
     riZhiMouseOver () {
@@ -488,7 +493,6 @@ export default {
       document.getElementById('riZhi').className = 'iconfont icon-tishi'
     },
     shourizhi () {
-
       this.showRiZhi = !this.showRiZhi
     },
     quXiaoMouseOver (id) {
@@ -782,7 +786,7 @@ export default {
             cancelButtonText: '取消',
             type: 'warning'
           }).then(() => {
-              this.$http({
+            this.$http({
               url: this.$http.adornUrl('/dataset/dynamic/dySubmit'),
               method: 'post',
               data: this.$http.adornData(info, false)
@@ -804,9 +808,6 @@ export default {
               }
             })
           }).catch(() => {})
-
-
-
         }
       })
     },

+ 0 - 9
src/views/modules/visi/dataset.vue

@@ -12,12 +12,6 @@
         <el-button v-if="isAuth('dataset:save')" type="primary" @click="addHandle()">新建数据集</el-button>
         <el-button v-if="isAuth('dataset:delete')" type="danger" @click="status==='1'?deleteHandle(dataListSelections):dy_deleteHandle(dy_dataListSelections)"
                    :disabled="dataListSelections.length <= 0 && dy_dataListSelections.length <= 0">批量删除</el-button>
-        <!--        <el-button v-if="isAuth('sys:schedule:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>-->
-        <!--        <el-button v-if="isAuth('sys:schedule:pause')" type="danger" @click="" :disabled="dataListSelections.length <= 0">批量暂停</el-button>-->
-        <!--        <el-button v-if="isAuth('sys:schedule:resume')" type="danger" @click="" :disabled="dataListSelections.length <= 0">批量恢复</el-button>-->
-        <!--        <el-button v-if="isAuth('sys:schedule:run')" type="danger" @click="" :disabled="dataListSelections.length <= 0">批量立即执行</el-button>-->
-        <!--        <el-button v-if="isAuth('sys:schedule:log')" type="success" @click="">日志列表</el-button>-->
-
       </el-form-item>
       <el-form-item>
         <el-input v-model="dataForm.datasetName" placeholder="请输入数据集名称" clearable
@@ -41,8 +35,6 @@
           </el-option>
         </el-select>
       </el-form-item>
-
-
     </el-form>
 
     <el-table v-show="(status ==='1') " :data="st_dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
@@ -118,7 +110,6 @@
           <el-button v-if="isAuth('sys:schedule:resume')" type="text" size="small" @click="dy_resumeHandle(scope.row)">恢复</el-button>
           <el-button v-if="isAuth('sys:schedule:run')" type="text" size="small" @click="dy_runHandle(scope.row)">执行</el-button>
           <el-button v-if="isAuth('sys:schedule:log')" type="text" size="small" @click="dy_logHandle(scope.row)">日志</el-button>
-
           <el-button type="text" size="small" @click="downloadDataset(scope.row.datasetName)">下载</el-button>
 <!--           <el-button type="text" size="small" @click="openDataPreProcessDialog(scope.row.datasetName)">预处理</el-button>-->
         </template>