清行 преди 2 години
родител
ревизия
550215117d
променени са 2 файла, в които са добавени 55 реда и са изтрити 6 реда
  1. 51 2
      src/views/console/emp/index.vue
  2. 4 4
      src/views/dashboard/editor/index.vue

+ 51 - 2
src/views/console/emp/index.vue

@@ -20,6 +20,8 @@
 
         <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">搜索</el-button>
         <el-button v-if="isEmpAdd" class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">新增</el-button>
+        <el-button class="filter-item" type="success" icon="el-icon-download" style="" @click="handleDownload">导出</el-button>
+           
       </div>
       <el-table
         v-loading="listLoading"
@@ -172,11 +174,11 @@ import waves from '@/directive/waves' // waves directive
 import { isIntegerZero } from '@/utils/validate'
 import { validatePhoneTwo } from '@/utils/validate'
 import enterToNext from '@/directive/enterToNext' // enterToNext directive
-import { PostDataByName, GetDataByName, getRecuData, GetDataByNames, checkButtons, failproccess } from '@/api/common'
+import { PostDataByName, GetDataByName, getRecuData, GetDataByNames, checkButtons, failproccess,GetAccount } from '@/api/common'
 import Pagination from '@/components/Pagination' // secondary package based on el-pagination
 import { MessageBox } from 'element-ui'
 import Cookies from 'js-cookie'
-import { sortChange } from '@/utils/index.js'
+import { sortChange, json2excel } from '@/utils/index.js'
 export default {
   name: 'Emp',
   components: { Pagination, TreeSelect },
@@ -227,6 +229,19 @@ export default {
           pastureName: Cookies.get('pasturename')
         }
       },
+      getdataListParmSH: {
+        name: 'getEmpAllL',
+        page: 0,
+        offset: 0,
+        pagecount: 0,
+        returntype: 'Map',
+        parammaps: {
+          empname: '',
+          empCode: '',
+          pastureId: Cookies.get('pastureid'),
+          pastureName: Cookies.get('pasturename')
+        }
+      },
       rules: {
         empname: [{ type: 'string', required: true, message: '必填', trigger: 'change' }],
         empCode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
@@ -476,7 +491,41 @@ export default {
         }
       })
     },
+    handleDownload() {
+      this.$alert('员工信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
+      this.isPercentage = true
+      this.percentage = 1
+      var timer = setInterval(() => {
+        this.percentage += 5
+        if (this.percentage > 95) {
+          this.percentage = 99
+          clearInterval(timer)
+        }
+        this.percentage = this.percentage
+      }, 1000)
 
+      this.getdataListParmSH.parammaps = this.getdataListParm.parammaps
+      // GetDataByName(this.getdataListParm)
+      GetAccount(this.getdataListParmSH).then(response => {
+        this.downLoadList = response.data.list
+        if (response.data.list !== '') {
+          this.percentage = 99
+          setTimeout(() => {
+            this.isPercentage = false
+          }, 2000)
+        }
+        console.log(this.downLoadList)
+        const elecExcelDatas = [
+          {
+            tHeader: ['牧场', '姓名', '部门', '职位', '工号'],
+            filterVal: ['pastureName', 'empname', 'deptname', 'position', 'empCode'],
+            tableDatas: this.downLoadList,
+            sheetName: '员工信息'
+          }
+        ]
+        json2excel(elecExcelDatas, '员工信息', true, 'xlsx')
+      })
+    },
     handleDelete(row) {
       MessageBox.confirm('名称:' + row.empname, '确认删除?', {
         confirmButtonText: '确认',

+ 4 - 4
src/views/dashboard/editor/index.vue

@@ -426,8 +426,8 @@ export default {
         var geoCoordMap = chart_data1.data1[0]
         var data = chart_data1.data2
 
-        console.log("geoCoordMap",JSON.stringify(geoCoordMap) )
-        console.log("data",JSON.stringify(data))
+        console.log('geoCoordMap', JSON.stringify(geoCoordMap) )
+        console.log('data', JSON.stringify(data))
         var max = 480; var min = 9
         var maxSize4Pin = 100; var minSize4Pin = 20
         var convertData = function(data) {
@@ -441,9 +441,9 @@ export default {
           return res
         }
 
-        console.log("convertData",JSON.stringify(convertData))
+        console.log('convertData', JSON.stringify(convertData))
         var conDatatest1 = convertData(data)
-        console.log("convertData Data",JSON.stringify(conDatatest1))
+        console.log('convertData Data', JSON.stringify(conDatatest1))
         var symbolImg = 'image://' + require('@/assets/images/1.png') // 或者import引入在拼接也行
 
         var option = {