|
@@ -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: '确认',
|