2024-09-12 17:39:02 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<!-- 工程管理页面 -->
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<!-- 表格 -->
|
|
|
|
|
|
<TableModel
|
|
|
|
|
|
:formLabel="formLabel"
|
|
|
|
|
|
:columnsList="columnsList"
|
|
|
|
|
|
:request-api="queryPersonListApi"
|
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
|
@transIdList="getIdList"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot="btn" slot-scope="{ queryParams }">
|
|
|
|
|
|
<el-button type="primary" @click="handleAddData()" icon="el-icon-plus" size="mini"
|
|
|
|
|
|
>新增人员</el-button
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
@click="handleDownload(
|
|
|
|
|
|
'base/tbPeople/downLoad',
|
|
|
|
|
|
'人员模板',
|
|
|
|
|
|
queryParams
|
|
|
|
|
|
)"
|
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>数据模板下载</el-button
|
|
|
|
|
|
>
|
2024-09-18 15:57:17 +08:00
|
|
|
|
|
2024-09-12 17:39:02 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
@click="handleExportData(
|
|
|
|
|
|
exportList,
|
|
|
|
|
|
'base/tbPeople/export',
|
|
|
|
|
|
'人员清单',
|
|
|
|
|
|
queryParams
|
|
|
|
|
|
)"
|
|
|
|
|
|
icon="el-icon-upload2"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>导出数据</el-button
|
|
|
|
|
|
>
|
2024-09-18 15:57:17 +08:00
|
|
|
|
<el-upload
|
|
|
|
|
|
:http-request="(obj) => uploadData(obj)"
|
|
|
|
|
|
action="#"
|
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
|
:on-exceed="fileExceed"
|
|
|
|
|
|
accept=".xls, .xlsx"
|
|
|
|
|
|
:limit="1"
|
2024-09-24 16:37:50 +08:00
|
|
|
|
style="display: flex"
|
2024-09-18 15:57:17 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-button
|
2024-09-24 16:37:50 +08:00
|
|
|
|
style="height: 100%; margin-left: 6px"
|
2024-09-18 15:57:17 +08:00
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
>导入数据</el-button
|
|
|
|
|
|
>
|
|
|
|
|
|
</el-upload>
|
2024-09-12 17:39:02 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="handle" slot-scope="{ data }">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
@click="handleEditData(data)"
|
|
|
|
|
|
>编辑</el-button
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
@click="handleDeleteData(data.id, deletePersonApi)"
|
|
|
|
|
|
>删除</el-button
|
|
|
|
|
|
>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="sex" slot-scope="{ data }">
|
|
|
|
|
|
{{ data.sex === 1 ? '男' : '女' }}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="postCode" slot-scope="{ data }">
|
2024-09-24 16:37:50 +08:00
|
|
|
|
{{ queryPostcode(data.postCode) || '-' }}
|
2024-09-12 17:39:02 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="idCard" slot-scope="{ data }">
|
2024-09-24 16:37:50 +08:00
|
|
|
|
{{ idCardCrypto(data.idCard) || '-' }}
|
2024-09-12 17:39:02 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<template slot="relPhone" slot-scope="{ data }">
|
2024-09-24 16:37:50 +08:00
|
|
|
|
{{ phoneCrypto(data.relPhone) || '-' }}
|
2024-09-12 17:39:02 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</TableModel>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 新增以及修改时的弹框 -->
|
|
|
|
|
|
<DialogModel
|
|
|
|
|
|
:dialogConfig="dialogConfig"
|
|
|
|
|
|
@closeDialogOuter="closeDialogOuter"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot="outerContent">
|
|
|
|
|
|
<!-- 新增以及修改数据的表单组件 -->
|
|
|
|
|
|
<FormPerson
|
|
|
|
|
|
:editParams="editParams"
|
|
|
|
|
|
@closeDialog="closeDialog"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</DialogModel>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { formLabel, columnsList, dialogConfig } from './config'
|
|
|
|
|
|
import { commonMixin } from '../mixins/common'
|
|
|
|
|
|
import {
|
|
|
|
|
|
queryPersonListApi,
|
2024-09-18 15:57:17 +08:00
|
|
|
|
deletePersonApi,
|
|
|
|
|
|
personFileUpLoad
|
2024-09-12 17:39:02 +08:00
|
|
|
|
} from '@/api/base/person'
|
|
|
|
|
|
import FormPerson from './components/form-person.vue'
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'person',
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
queryPersonListApi,
|
|
|
|
|
|
deletePersonApi,
|
|
|
|
|
|
getIdList(idList) {
|
|
|
|
|
|
this.exportList = []
|
|
|
|
|
|
idList.forEach(item => {
|
|
|
|
|
|
this.exportList.push(item.id)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
handleDownload(url, fileName, queryParams) {
|
|
|
|
|
|
this.download(
|
|
|
|
|
|
url,
|
|
|
|
|
|
{
|
|
|
|
|
|
...queryParams
|
|
|
|
|
|
},
|
|
|
|
|
|
`${fileName}_${new Date().getTime()}.xlsx`,
|
|
|
|
|
|
)
|
|
|
|
|
|
},
|
|
|
|
|
|
queryPostcode(val) {
|
|
|
|
|
|
switch (val) {
|
|
|
|
|
|
case '0900101':
|
|
|
|
|
|
return '班组负责人'
|
|
|
|
|
|
case '0900102':
|
|
|
|
|
|
return '班组安全员'
|
|
|
|
|
|
case '0900103':
|
|
|
|
|
|
return '班组技术员'
|
2024-09-29 13:21:32 +08:00
|
|
|
|
case '0900104':
|
|
|
|
|
|
return '一般作业人员'
|
2024-09-12 17:39:02 +08:00
|
|
|
|
case '0900106':
|
|
|
|
|
|
return '特种作业人员'
|
|
|
|
|
|
}
|
2024-09-18 15:57:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
/** 上传图片/文件 */
|
|
|
|
|
|
uploadData(param) {
|
|
|
|
|
|
console.log(param)
|
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
|
formData.append('file', param.file)
|
|
|
|
|
|
personFileUpLoad(formData).then(res => {
|
|
|
|
|
|
if(res.code === 200) {
|
|
|
|
|
|
this.$modal.msgSuccess('上传成功')
|
|
|
|
|
|
this.$refs.tableRef.getTableList()
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(err => {})
|
|
|
|
|
|
},
|
|
|
|
|
|
fileExceed() {
|
|
|
|
|
|
this.$modal.msgError('最多上传1个文件!')
|
|
|
|
|
|
},
|
2024-09-12 17:39:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
mixins: [commonMixin],
|
|
|
|
|
|
components: {
|
|
|
|
|
|
FormPerson
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
// 搜索区表单配置项
|
|
|
|
|
|
formLabel,
|
|
|
|
|
|
// 表格导出id列表
|
|
|
|
|
|
exportList: [],
|
|
|
|
|
|
// 列表区配置项
|
|
|
|
|
|
columnsList,
|
|
|
|
|
|
// 弹框区配置项
|
|
|
|
|
|
dialogConfig,
|
|
|
|
|
|
// 新建时弹框标题
|
|
|
|
|
|
addDialogTitle: '新增人员',
|
|
|
|
|
|
// 修改时弹框标题
|
|
|
|
|
|
editDialogTitle: '修改人员',
|
2024-09-18 15:57:17 +08:00
|
|
|
|
fileList: []
|
2024-09-12 17:39:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|