| | |
| | | <template> |
| | | <div> |
| | | <div class="search-background"> |
| | | <span class="search-group"> |
| | | <span style="width: 160px">日期:</span> |
| | | <el-date-picker v-model="searchForm.registerDate" |
| | | clearable |
| | | format="yyyy-MM-dd" |
| | | placeholder="选择日期" |
| | | size="small" |
| | | style="width: 100%" |
| | | type="date" |
| | | value-format="yyyy-MM-dd"> |
| | | <div class="search"> |
| | | <div> |
| | | <el-form :model="searchForm" ref="searchForm" size="small" :inline="true"> |
| | | <el-form-item label="日期" prop="registerDate"> |
| | | <el-date-picker v-model="searchForm.registerDate" clearable format="yyyy-MM-dd" placeholder="选择日期" |
| | | @change="searchList" size="small" style="width: 100%" type="date" value-format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | <el-button size="medium" style="margin-left: 10px" @click="resetSearchForm">重 置</el-button> |
| | | <el-button size="medium" type="primary" @click="searchList">查 询</el-button> |
| | | </span> |
| | | <span class="search-group"> |
| | | <el-button size="medium" @click="handleDown">导 出</el-button> |
| | | <el-button size="medium" type="primary" @click="openFormDia('add')">新 增</el-button> |
| | | </span> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" size="mini" @click="searchList">查询</el-button> |
| | | <el-button size="mini" @click="resetSearchForm">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div> |
| | | <el-button size="small" @click="handleDown">导 出</el-button> |
| | | <el-button size="small" type="primary" @click="openFormDia('add')">新 增</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <ZTTable |
| | | :column="tableColumn" |
| | | :height="'calc(100vh - 20em)'" |
| | | :table-data="tableData" |
| | | :table-loading="tableLoading" |
| | | style="padding: 0 10px;margin-bottom: 16px"> |
| | | </ZTTable> |
| | | <el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]" |
| | | :total="total" layout="->,total, sizes, prev, pager, next, jumper" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange"> |
| | | </el-pagination> |
| | | <lims-table :tableData="tableData" :column="tableColumn" :height="'calc(100vh - 250px)'" @pagination="pagination" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | </div> |
| | | <personnel-management-dia v-if="threeWastesDia" ref="threeWastesDia" @closeThreeWastesDia="closeThreeWastesDia"></personnel-management-dia> |
| | | <personnel-management-dia v-if="threeWastesDia" ref="threeWastesDia" |
| | | @closeThreeWastesDia="closeThreeWastesDia"></personnel-management-dia> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import ZTTable from '../../caorui/ZTTable/index.vue'; |
| | | // import PersonnelManagementDia from './Personnel-management-dia.vue'; |
| | | import PersonnelManagementDia from '../component/Personnel-management-dia.vue'; |
| | | import limsTable from '@/components/Table/lims-table.vue' |
| | | |
| | | import { |
| | | pageForeignRegister, |
| | | delForeignRegister, |
| | | exportForeignRegister |
| | | } from '@/api/cnas/resourceDemand/foreignRegister/foreignRegister' |
| | | |
| | | export default { |
| | | name: 'Personnel-management', |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: { PersonnelManagementDia}, |
| | | components: { limsTable, PersonnelManagementDia }, |
| | | data() { |
| | | // 这里存放数据 |
| | | return { |
| | |
| | | tableData: [], |
| | | tableLoading: false, |
| | | page: { |
| | | size: 20, |
| | | current: 1, |
| | | total: 0, |
| | | size: 10, |
| | | current: 1 |
| | | }, |
| | | total: 0, |
| | | threeWastesDia: false |
| | |
| | | // 方法集合 |
| | | methods: { |
| | | // 查询列表 |
| | | searchList () { |
| | | const entity = this.searchForm |
| | | const page = this.page |
| | | searchList() { |
| | | this.tableLoading = true |
| | | this.$axios.post(this.$api.foreignRegister.pageForeignRegister, {entity, page}, { |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | }, |
| | | noQs: true |
| | | pageForeignRegister({ |
| | | ...this.page, |
| | | ...this.searchForm |
| | | }).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 201) return |
| | | this.tableData = res.data.records |
| | | this.total = res.data.total |
| | | if (res.code === 200) { |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | } |
| | | |
| | | }).catch(err => { |
| | | console.log('err---', err); |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | // 删除 |
| | | delPlan (row) { |
| | | delPlan(row) { |
| | | this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.tableLoading = true |
| | | this.$axios.get(this.$api.foreignRegister.delForeignRegister + '?registerId=' + row.registerId).then(res => { |
| | | delForeignRegister({ registerId: row.registerId }).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 201) return |
| | | this.$message.success('删除成功') |
| | | this.searchList() |
| | | if (res.code === 200) { |
| | | this.$message.success('删除成功') |
| | | this.searchList() |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | console.log('err---', err); |
| | |
| | | }); |
| | | }, |
| | | // 新增,编辑,批准弹框 |
| | | openFormDia (type, row) { |
| | | openFormDia(type, row) { |
| | | this.threeWastesDia = true |
| | | this.$nextTick(() => { |
| | | this.$refs.threeWastesDia.openDia(type, row) |
| | | }) |
| | | }, |
| | | // 导出 |
| | | handleDown (row) { |
| | | const entity = this.searchForm |
| | | this.$axios.post(this.$api.foreignRegister.exportForeignRegister,{entity},{ |
| | | responseType: "blob", |
| | | headers: { |
| | | "Content-Type": "application/json" |
| | | }, |
| | | noQs: true}).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res],{ type: 'application/msword' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '外来人员登记' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '外来人员登记' + '.docx'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | handleDown() { |
| | | exportForeignRegister(this.searchForm).then(res => { |
| | | const blob = new Blob([res], { type: 'application/msword' }); |
| | | this.$download.saveAs(blob, '外来人员登记.docx') |
| | | }) |
| | | }, |
| | | closeThreeWastesDia () { |
| | | closeThreeWastesDia() { |
| | | this.threeWastesDia = false |
| | | this.searchList() |
| | | }, |
| | | // 重置查询条件 |
| | | resetSearchForm () { |
| | | resetSearchForm() { |
| | | this.searchForm.registerDate = ''; |
| | | this.searchList() |
| | | }, |
| | | // 分页 |
| | | handleSizeChange(val) { |
| | | this.page.size = val; |
| | | this.searchList(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.page.current = val; |
| | | // 分页切换 |
| | | pagination(page) { |
| | | this.page.size = page.limit |
| | | this.searchList(); |
| | | }, |
| | | } |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search-background { |
| | | width: 100%; |
| | | height: 60px; |
| | | line-height: 60px; |
| | | .search { |
| | | height: 46px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | .search-group { |
| | | display: flex; |
| | | align-items: center; |
| | | margin: 0 20px; |
| | | } |
| | | </style> |