zhangys36 2 роки тому
батько
коміт
05609f926b

+ 24 - 1
src/api/dashboard-json.js

@@ -140,7 +140,6 @@ export function chartTodoList(url, parameter) {
   })
 }
 
-
 export function chartDlydtsbyDetail(url, parameter) {
   return request({
     url: '/chart/dlydtsby/detail',
@@ -148,6 +147,7 @@ export function chartDlydtsbyDetail(url, parameter) {
     method: 'get'
   })
 }
+
 export function chartDlsdxlbyDetail(url, parameter) {
   return request({
     url: '/chart/dlsdxlby/detail',
@@ -163,6 +163,7 @@ export function chartDlbpdsbyDetail(url, parameter) {
     method: 'get'
   })
 }
+
 export function chartJxdxqkbyDetail(url, parameter) {
   return request({
     url: '/chart/jxdxqkby/detail',
@@ -170,3 +171,25 @@ export function chartJxdxqkbyDetail(url, parameter) {
     method: 'get'
   })
 }
+
+
+export function ChartImport(name, file) {
+  const formData = new FormData()
+  formData.append('file', file)
+  const urlMap = {
+    yctjb: '/show/import/yctjb',
+    bdsjxjhb: '/show/import/bdsjxjhb',
+    jxjhdxb: '/show/import/jxjhdxb',
+    scrwb: '/show/import/scrwb',
+    xjdxb: '/show/import/xjdxb'
+  }
+
+  if (!urlMap[name]) {
+    return
+  }
+  return request({
+    url: urlMap[name],
+    data: formData,
+    method: 'post'
+  })
+}

+ 6 - 6
src/mixin/listMixin.js

@@ -90,14 +90,14 @@ export const listMixin = {
       } else {
         getAction(this.url.list, params).then((res) => {
           if (res.code === 200) {
-          // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+            // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
             this.dataSource = res.rows || res.data
             if (res.total) {
               this.ipagination.total = res.total
             } else {
               this.ipagination.total = 0
             }
-          // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+            // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
           } else {
             this.$message.warning(res.msg)
           }
@@ -290,13 +290,13 @@ export const listMixin = {
         if (info.file.response.success) {
           // this.$message.success(`${info.file.name} 文件上传成功`);
           if (info.file.response.code === 201) {
-            const { message, result: { msg, fileUrl, fileName }} = info.file.response
+            const { message, result: { msg, fileUrl, fileName } } = info.file.response
             const href = fileUrl
             this.$warning({
               title: message,
-              content: (< div >
-                < span > {msg} < /span><br/ >
-                < span > 具体详情请 < a href = {href} target = '_blank' download = {fileName} > 点击下载 < /a> </span >
+              content: (< div>
+                < span> {msg} < /span><br/ >
+                < span> 具体详情请 < a href={href} target='_blank' download={fileName}> 点击下载 < /a> </span>
               < /div>
               )
             })

+ 5 - 0
src/styles/element-variables.scss

@@ -29,3 +29,8 @@ $--font-path: "~element-ui/lib/theme-chalk/fonts";
 :export {
   theme: $--color-primary;
 }
+
+
+.ant-message {
+  z-index: 99999 !important;
+}

+ 11 - 0
src/views/dashboard-screen/index.vue

@@ -442,6 +442,17 @@ export default {
     }
 
   }
+
+  .el-drawer__wrapper {
+    //z-index: 1 !important;
+  }
+
+  ::v-deep {
+    .el-drawer__wrapper {
+      //z-index: 1 !important;
+    }
+  }
 }
 
+
 </style>

+ 27 - 3
src/views/dashboard-screen/screen/sjdr/dlydts/index.vue

@@ -6,10 +6,11 @@
         ghost
         type="primary"
         icon="upload"
-        @click="handleExportXls()"
+        @click="$refs.fileDom.click()"
       >导入
       </a-button>
-      <a-tabs v-model="activeKey" type="card">
+      <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
+      <a-tabs v-model="activeKey" type="card" v-if="readyRender">
         <a-tab-pane
           v-for="item in tabs"
           :key="item.name"
@@ -30,6 +31,7 @@
 import Tab1 from './tab1.vue'
 import Tab2 from './tab2.vue'
 import Tab3 from './tab3.vue'
+import { ChartImport } from '@/api/dashboard-json'
 
 export default {
   name: 'Ycxx',
@@ -40,6 +42,7 @@ export default {
   },
   data() {
     return {
+      readyRender: true,
       activeKey: 'Tab1',
       tabs: [{
         title: '远动调试',
@@ -55,9 +58,30 @@ export default {
       }
       ]
     }
+  },
+  handleExportXls() {
+
   },
   computed: {},
-  methods: {}
+  methods: {
+    handleImport(evt) {
+      window.console.log('evt', evt)
+      const file = evt.target.files[0]
+      evt.target.value = null
+      ChartImport('scrwb', file).then(res => {
+        console.log('res => ', res)
+        if (res.code === 200) {
+          this.$message.success('导入成功')
+          this.readyRender = false
+          setTimeout(() => {
+            this.readyRender = true
+          }, 200)
+        } else {
+          this.$message.success('导入失败')
+        }
+      })
+    }
+  }
 }
 </script>
 <style scoped>

+ 2 - 0
src/views/dashboard-screen/screen/sjdr/index.vue

@@ -85,7 +85,9 @@ export default {
   .right-upload-btn {
     position: absolute;
     right: 10px;
+    z-index: 10;
     top: 0;
   }
 }
+
 </style>

+ 28 - 7
src/views/dashboard-screen/screen/sjdr/syjhdxqk/index.vue

@@ -6,10 +6,11 @@
         ghost
         type="primary"
         icon="upload"
-        @click="handleExportXls()"
+        @click="$refs.fileDom.click()"
       >导入
       </a-button>
-      <a-tabs v-model="activeKey" type="card">
+      <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
+      <a-tabs v-model="activeKey" type="card" v-if="readyRender">
         <a-tab-pane
           v-for="item in tabs"
           :key="item.name"
@@ -29,6 +30,7 @@
 
 import Tab1 from './tab1.vue'
 import Tab2 from './tab2.vue'
+import { ChartImport } from '@/api/dashboard-json'
 
 export default {
   name: 'Syjhdxqk',
@@ -38,20 +40,39 @@ export default {
   },
   data() {
     return {
+      readyRender: true,
       activeKey: 'Tab1',
       tabs: [{
         title: '开关分合',
         name: 'Tab1'
       },
-        {
-          title: '单体',
-          name: 'Tab2'
-        }
+      {
+        title: '单体',
+        name: 'Tab2'
+      }
       ]
     }
   },
   computed: {},
-  methods: {}
+  methods: {
+    handleImport(evt) {
+      window.console.log('evt', evt)
+      const file = evt.target.files[0]
+      evt.target.value = null
+      ChartImport('jxjhdxb', file).then(res => {
+        console.log('res => ', res)
+        if (res.code === 200) {
+          this.$message.success('导入成功')
+          this.readyRender = false
+          setTimeout(() => {
+            this.readyRender = true
+          }, 200)
+        } else {
+          this.$message.success('导入失败')
+        }
+      })
+    }
+  }
 }
 </script>
 <style scoped>

+ 33 - 6
src/views/dashboard-screen/screen/sjdr/tab3.vue

@@ -1,10 +1,18 @@
 <template>
   <div>
     <!-- 查询区域 -->
-    <div class="table-page-search-wrapper">
+    <div class="table-page-search-wrapper" style="position: relative">
       <!-- 操作按钮区域 -->
       <div class="table-operator" style="margin: 5px 0;float: right">
-        <a-button ghost type="primary" icon="upload" @click="handleExportXls()">导入</a-button>
+        <a-button
+          class="right-upload-btn"
+          ghost
+          type="primary"
+          icon="upload"
+          @click="$refs.fileDom.click()"
+        >导入
+        </a-button>
+        <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
         <a-dropdown v-if="selectedRowKeys.length > 0">
           <a-menu slot="overlay">
             <a-menu-item key="1" @click="batchDel">
@@ -43,7 +51,7 @@
       </a-form>
     </div>
     <!-- table区域-begin -->
-    <div>
+    <div v-if="readyRender">
 
       <a-table
         ref="table"
@@ -62,9 +70,10 @@
   </div>
 </template>
 <script>
-import {listMixin} from '@/mixin/listMixin'
+import { listMixin } from '@/mixin/listMixin'
 import columns from './tab3Columns'
-import {getAction} from '@/api/request'
+import { getAction } from '@/api/request'
+import { ChartImport } from '@/api/dashboard-json'
 
 export default {
   name: 'Tab3',
@@ -82,7 +91,8 @@ export default {
         delete: '/business/catenary/bus/jcb/fdfxjyq/',
         tree: '/system/dept/treeSelect',
         exportXlsUrl: '/business/catenary/bus/jcb/fdfxjyq/export'
-      }
+      },
+      readyRender: true
     }
   },
   created() {
@@ -96,6 +106,23 @@ export default {
           this.treeData = res.data
         }
       })
+    },
+    handleImport(evt) {
+      window.console.log('evt', evt)
+      const file = evt.target.files[0]
+      evt.target.value = null
+      ChartImport('bdsjxjhb', file).then(res => {
+        console.log('res => ', res)
+        if (res.code === 200) {
+          this.$message.success('导入成功')
+          this.readyRender = false
+          setTimeout(() => {
+            this.readyRender = true
+          }, 200)
+        } else {
+          this.$message.success('导入失败')
+        }
+      })
     }
   }
 }

+ 30 - 3
src/views/dashboard-screen/screen/sjdr/tab6.vue

@@ -3,8 +3,16 @@
     <!-- 查询区域 -->
     <div class="table-page-search-wrapper">
       <!-- 操作按钮区域 -->
-      <div class="table-operator" style="margin: 5px 0;float: right">
-        <a-button ghost type="primary" icon="upload" @click="handleExportXls()">导入</a-button>
+      <div class="table-operator" style="margin: 5px 0;float: right;position: relative">
+        <a-button
+          class="right-upload-btn"
+          ghost
+          type="primary"
+          icon="upload"
+          @click="$refs.fileDom.click()"
+        >导入
+        </a-button>
+        <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
         <a-dropdown v-if="selectedRowKeys.length > 0">
           <a-menu slot="overlay">
             <a-menu-item key="1" @click="batchDel">
@@ -43,7 +51,7 @@
       </a-form>
     </div>
     <!-- table区域-begin -->
-    <div>
+    <div v-if="readyRender">
 
       <a-table
         :scroll="{ x: 500 | true}"
@@ -66,6 +74,7 @@
 import { listMixin } from '@/mixin/listMixin'
 import columns from './tab6Columns'
 import { getAction } from '@/api/request'
+import { ChartImport } from '@/api/dashboard-json'
 
 export default {
   name: 'Tab6',
@@ -74,6 +83,7 @@ export default {
   data() {
     return {
       // 查询条件
+      readyRender: true,
       queryParam: {},
       treeData: [],
       // 表头
@@ -97,6 +107,23 @@ export default {
           this.treeData = res.data
         }
       })
+    },
+    handleImport(evt) {
+      window.console.log('evt', evt)
+      const file = evt.target.files[0]
+      evt.target.value = null
+      ChartImport('xjdxb', file).then(res => {
+        console.log('res => ', res)
+        if (res.code === 200) {
+          this.$message.success('导入成功')
+          this.readyRender = false
+          setTimeout(() => {
+            this.readyRender = true
+          }, 200)
+        } else {
+          this.$message.success('导入失败')
+        }
+      })
     }
   }
 }

+ 32 - 8
src/views/dashboard-screen/screen/sjdr/ycxn/index.vue

@@ -1,14 +1,15 @@
 <template>
   <div class="common-wrap">
-    <el-card class="content-z" style="position: relative">
+    <el-card v-if="readyRender" class="content-z" style="position: relative">
       <a-button
         class="right-upload-btn"
         ghost
         type="primary"
         icon="upload"
-        @click="handleExportXls()"
+        @click="$refs.fileDom.click()"
       >导入
       </a-button>
+      <input id="fileDom" type="file" ref="fileDom" style="display: none" @change="handleImport($event)">
       <a-tabs v-model="activeKey" type="card">
         <a-tab-pane
           v-for="item in tabs"
@@ -29,6 +30,7 @@
 
 import Tab1 from './tab1.vue'
 import Tab2 from './tab2.vue'
+import { ChartImport } from '@/api/dashboard-json'
 
 export default {
   name: 'Ycxx',
@@ -37,21 +39,43 @@ export default {
     Tab2
   },
   data() {
+    window['is'] = this;
     return {
+      readyRender: true,
       activeKey: 'Tab1',
       tabs: [{
         title: '变电',
         name: 'Tab1'
       },
-        {
-          title: '电力',
-          name: 'Tab2'
-        }
+      {
+        title: '电力',
+        name: 'Tab2'
+      }
       ]
     }
   },
-  computed: {},
-  methods: {}
+  computed: {
+
+  },
+  methods: {
+    handleImport(evt) {
+      window.console.log('evt', evt)
+      const file = evt.target.files[0]
+      evt.target.value = null
+      ChartImport('yctjb', file).then(res => {
+        console.log('res => ', res)
+        if (res.code === 200) {
+          this.$message.success('导入成功')
+          this.readyRender = false
+          setTimeout(() => {
+            this.readyRender = true
+          }, 200)
+        } else {
+          this.$message.success('导入失败')
+        }
+      })
+    }
+  }
 }
 </script>
 <style scoped>