Browse Source

Merge branch 'master' of gitee.com:wy786299803/aiplat-vue

wangyi 3 years ago
parent
commit
d114ed30e5

File diff suppressed because it is too large
+ 25276 - 1
package-lock.json


+ 115 - 0
src/views/modules/visi/com/static_upLoad_csv.vue

@@ -0,0 +1,115 @@
+<template>
+  <el-dialog title="数据上传"
+             :visible.sync="st_upShow"
+             v-if="st_upShow"
+             width="60%"
+             @close="closeHandle"
+  >
+    <div style="text-align: center">
+      <el-upload
+        class="upload-demo"
+        drag
+        :action="url"
+        :data = "dataInfo"
+        :limit= 1
+        accept=".csv"
+        :before-upload="beforeUploadHandle"
+        :on-success="successHandle"
+        :on-exceed = "upLoadNumberWrong">
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        <div class="el-upload__tip" slot="tip">注意:目前仅支持 csv 文件,并且表头在第一行</div>
+      </el-upload>
+    </div>
+    <span slot="footer" class="dialog-footer">
+    <el-button @click="st_upShow = false">取 消</el-button>
+    <el-button type="primary" @click="st_upShow = false">确 定</el-button>
+  </span>
+  </el-dialog>
+</template>
+
+<script>
+import {info} from '../../../../mock/modules/sys-menu'
+import { Message } from "element-ui"
+
+export default {
+  name: 'staticupLoadCsv',
+  data () {
+    return {
+      st_upShow: false,
+      info: '',
+      url: this.$http.adornUrl(`/dataset/staticup/uploadcsv?token=${this.$cookie.get('Algtoken')}`),
+      dataInfo: {
+        id: this.$store.state.user.id
+      }
+    }
+  },
+  methods: {
+    init (info) {
+      this.st_upShow = true
+      this.info = info
+      console.log(info)
+    },
+    upLoadNumberWrong (files, fileList) {
+      Message({
+        message: '单次只允许上传一个文件',
+        type: 'error'
+      })
+    },
+    // 上传之前
+    beforeUploadHandle (file) {
+      console.log(file)
+      if (file.type !== 'text/csv' && file.type !== 'xlsm' && file.type !== 'application/vnd.ms-excel') {
+        Message.error('xls、xlsx、xlsm格式的excel数据!')
+        return false
+      }
+    },
+    // 上传成功
+    successHandle (response, file, fileList) {
+      this.fileList = fileList
+      if (response && response.code === 0) {
+        Message.success('文件上传成功')
+        // console.log(response)
+        this.info.isUp = true  // 标记已经上传过文件
+        this.info.icon = this.info.icons[1] //  更换彩色图标
+        this.info.upUrl = response.data.upUrl
+        this.info.excelData = response.data.excelData  //  excel 数据
+        this.info.fileName = response.data.fileName  //  文件名
+        this.info.indexContent = response.data.fileName
+        // for (var li = 0; li < excelDatalist.length; li++) {
+        //   this.info.excelData.push(excelDatalist[li])
+        // }
+
+        for (var i = 0; i < response.data.columns.length; i++) {
+          var list = {
+            key: i,
+            prop: response.data.columns[i],
+            label: response.data.columns[i]
+          }
+          this.info.filedList.push(list)  //  存储表头数据
+        }
+
+        // console.log(response)
+        this.time = setTimeout(() => {
+          this.st_upShow = false
+        }, 3000)
+      } else {
+        Message.error(response.msg)
+      }
+    },
+    // 弹窗关闭时
+    closeHandle () {
+      // console.log(555)
+
+      this.st_upShow = false
+      this.fileList = []
+      // this.$emit('refreshLocalUps', this.info)
+      clearTimeout(this.time)
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/modules/visi/com/static_upLoad.vue → src/views/modules/visi/com/static_upLoad_excel.vue

@@ -33,7 +33,7 @@ import {info} from '../../../../mock/modules/sys-menu'
 import { Message } from "element-ui"
 
 export default {
-  name: 'static_upLoad',
+  name: 'staticUpLoadExcel',
   data () {
     return {
       st_upShow: false,

+ 48 - 33
src/views/modules/visi/create1.vue

@@ -146,7 +146,7 @@
                      @mouseleave="quXiaoMouseLeave(localUp.id)"
                      @click="st_quXiao(localUp)"
                      class="iconfont icon-quxiao"></i>
-                  <span class="demonstration"  style="vertical-align: middle;display: block;font-size: 1px; margin-top: 5px;">{{ localUp.indexContent }}</span>
+                  <span class="demonstration"  style="    text-align: center;display: block;font-size: 1px; margin-top: 5px;">{{ localUp.indexContent }}</span>
 
                 </div>
               </div>
@@ -240,7 +240,8 @@
           <mycron v-bind:extractionPeriod.sync="dataInfo.extractionPeriod"></mycron>
         </el-dialog>
 <!--        本地数据上传-->
-      <static-up-load v-if="st_upShow.excel" ref="staticUpload" > </static-up-load>
+      <static-up-load-excel v-if="st_upShow.excel" ref="staticUploadExcel" > </static-up-load-excel>
+        <staticup-load-csv v-if="st_upShow.word" ref="staticUploadCsv"></staticup-load-csv>
         <empty v-if="st_upShow.other" ref="othersUpload"></empty>
       </div>
     </div>
@@ -256,14 +257,15 @@
 // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 // 例如:import 《组件名称》 from '《组件路径》';
 import mycron from './quartz/mycron'
-import staticUpLoad from './com/static_upLoad'
+import staticUpLoadExcel from './com/static_upLoad_excel'
+import staticupLoadCsv from './com/static_upLoad_csv'
 import empty from './com/empty'
 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: {mycron, staticUpLoad, empty, PythonKafkaTmp},
+  components: {mycron, staticUpLoadExcel, empty, PythonKafkaTmp, staticupLoadCsv},
   data () {
     var checkExtractionPeriod = (rule, value, callback) => {
       if (!value) {
@@ -522,9 +524,6 @@ export default {
           this.preTalbelists.push({
             prop: this.imsql[i].subEquipmentID + '_' + this.imsql[i].chosedata[j],
             label: this.imsql[i].subEquipmentID + '_' + this.imsql[i].chosedataZh[j]
-            // label: this.imsql[i].subEquipment + '.' + this.imsql[i].chosedata[j]
-            // label: this.imsql[i].chosedata[j]
-            // label: this.imsql[i].chosedata[j]
           })
         }
       }
@@ -791,6 +790,7 @@ export default {
       }
     },
     handleClick (id) {
+      this.equimentClick(id)
       clearTimeout(this.clicktime) // 首先清除计时器
       this.clicktime = setTimeout(() => {
         // 这里执行你自己的方法或者业务逻辑
@@ -835,6 +835,9 @@ export default {
           break
         }
       }
+      if (this.tableData.length > 0) {
+        this.dataListLoading = false
+      }
     },
     equimentDoubleClick (id) {
       this.showEqumField = true
@@ -920,6 +923,7 @@ export default {
               userID: this.userID,
               sql: this.localUps[j].sql,
               upUrl: this.localUps[j].upUrl,
+              type: this.localUps[j].type,
               fileName: this.localUps[j].fileName
             }
             var stmsign = true
@@ -963,34 +967,33 @@ export default {
             classification: this.dataInfo.classificationtag,
             userId: this.userID
           }
-          
+
           MessageBox.confirm(`确定新建数据集?`, '提示', {
             confirmButtonText: '确定',
             cancelButtonText: '取消',
             type: 'warning'
           }).then(() => {
             this.$http({
-            url: this.$http.adornUrl('/dataset/static/stSubmit'),
-            method: 'post',
-            data: this.$http.adornData(info, false)
-          }).then(res => {
-            var resContent = res.data
-            if (resContent && resContent.code === 0) {
-              Message({
-                message: '数据集' + this.dataInfo.datasetName + '创建成功',
-                type: 'success'
-              })
-              this.$router.replace({path: '/visi-dataset', query: {'status': '1'}})
-              this.$destroy()
-            } else {
-              Message({
-                message: '数据集' + this.dataInfo.datasetName + '创建失败',
-                type: 'error'
-              })
-            }
-          })
+              url: this.$http.adornUrl('/dataset/static/stSubmit'),
+              method: 'post',
+              data: this.$http.adornData(info, false)
+            }).then(res => {
+              var resContent = res.data
+              if (resContent && resContent.code === 0) {
+                Message({
+                  message: '数据集' + this.dataInfo.datasetName + '创建成功',
+                  type: 'success'
+                })
+                this.$router.replace({path: '/visi-dataset', query: {'status': '1'}})
+                this.$destroy()
+              } else {
+                Message({
+                  message: '数据集' + this.dataInfo.datasetName + '创建失败',
+                  type: 'error'
+                })
+              }
+            })
           }).catch(() => {})
-          
         }
       })
     },
@@ -1012,7 +1015,12 @@ export default {
         if (info.type === 'excel') {
           this.st_upShow.excel = true
           this.$nextTick(() => {
-            this.$refs.staticUpload.init(info)
+            this.$refs.staticUploadExcel.init(info)
+          })
+        } else if (info.type === 'word') {
+          this.st_upShow.word = true
+          this.$nextTick(() => {
+            this.$refs.staticUploadCsv.init(info)
           })
         } else {
           this.st_upShow.other = true
@@ -1021,11 +1029,13 @@ export default {
           })
         }
       } else {
+        this.dataListLoading = true
         this.tableData = []
         this.tablelists = []
         this.detailTitle.worldName = info.fileName
         this.tablelists = info.filedList
         this.tableData = info.excelData
+        this.dataListLoading = false
       }
     },
     st_equimentDoubleClick (info) {
@@ -1033,7 +1043,12 @@ export default {
         if (info.type === 'excel') {
           this.st_upShow.excel = true
           this.$nextTick(() => {
-            this.$refs.staticUpload.init(info)
+            this.$refs.staticUploadExcel.init(info)
+          })
+        } else if (info.type === 'word') {
+          this.st_upShow.word = true
+          this.$nextTick(() => {
+            this.$refs.staticUploadCsv.init(info)
           })
         } else {
           this.st_upShow.other = true
@@ -1157,7 +1172,7 @@ export default {
     // 左侧树的懒加载
     loadTreeNode (node, resolve) {
       if (node.level === 0) {
-        this.getSubSystem( resolve)
+        this.getSubSystem(resolve)
       } else if (node.level === 1) {
         this.getEquipment(node.data.subSustemid, resolve)
       } else {
@@ -1253,7 +1268,7 @@ export default {
   width: 100%;
 }
 .midDivTopImg{
-  padding-top: 5px;
+  /*padding-top: 5px;*/
   /*height: 31px;*/
 }
 

+ 8 - 3
src/views/modules/visi/create2.vue

@@ -487,6 +487,7 @@ export default {
       document.getElementById('riZhi').className = 'iconfont icon-tishi'
     },
     shourizhi () {
+
       this.showRiZhi = !this.showRiZhi
     },
     quXiaoMouseOver (id) {
@@ -661,13 +662,17 @@ export default {
 
                 this.tableData = subeqpmContent
               }
+              this.dataListLoading = false
             })
           }
-          this.dataListLoading = false
+
           this.showInfo = true
           break
         }
       }
+      if (this.tableData.length > 0) {
+        this.dataListLoading = false
+      }
     },
     equimentDoubleClick (id) {
       this.showEqumField = true
@@ -794,7 +799,7 @@ export default {
               }
             })
           }).catch(() => {})
-          
+
 
 
         }
@@ -1001,7 +1006,7 @@ export default {
   width: 100%;
 }
 .midDivTopImg{
-  padding-top: 5px;
+  /*padding-top: 5px;*/
 }
 
 .midDivData{

+ 28 - 32
src/views/modules/visi/stdataset-updata.vue

@@ -30,7 +30,7 @@
 </template>
 
 <script>
-import { Message } from "element-ui"
+import { Message } from 'element-ui'
 import { MessageBox } from 'element-ui'
 export default {
   data () {
@@ -98,38 +98,34 @@ export default {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
             MessageBox.confirm(`确定保存修改?`, '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            this.$http({
-              url: this.$http.adornUrl(`/dataset/update`),
-              method: 'post',
-              data: this.$http.adornData({
-                'datasetId': this.dataForm.id,
-                'datasetName': this.dataForm.datasetName,
-                'categoryId': this.dataForm.params, // 分类对应的ID
-                'remark': this.dataForm.remark
-              })
-            }).then(({data}) => {
-              if (data && data.code === 0) {
-                Message({
-                  message: '操作成功',
-                  type: 'success',
-                  duration: 1500,
-                  onClose: () => {
-                    this.$emit('refreshDataList')
-                  }
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+            }).then(() => {
+              this.$http({
+                url: this.$http.adornUrl(`/dataset/update`),
+                method: 'post',
+                data: this.$http.adornData({
+                  'datasetId': this.dataForm.id,
+                  'datasetName': this.dataForm.datasetName,
+                  'categoryId': this.dataForm.params, // 分类对应的ID
+                  'remark': this.dataForm.remark
                 })
-              } else {
-                Message.error(data.msg)
-              }
-            })
-          }).catch(() => {})
-
-            
-
-
+              }).then(({data}) => {
+                if (data && data.code === 0) {
+                  Message({
+                    message: '操作成功',
+                    type: 'success',
+                    duration: 1500,
+                    onClose: () => {
+                      this.$emit('refreshDataList')
+                    }
+                  })
+                } else {
+                  Message.error(data.msg)
+                }
+              })
+            }).catch(() => {})
           }
         })
       }

Some files were not shown because too many files changed in this diff