Commit d83cebef authored by 赵啸非's avatar 赵啸非

修改人员导出

parent 13eb2d69
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" :config="tableConfig"> <LayoutTable :data="tableData" :config="tableConfig">
<el-button
slot="table-head-left2"
style="margin-left: 10px"
icon="el-icon-tickets"
size="mini"
@click="handleImport"
>导入</el-button>
<el-button
slot="table-head-left2"
style="margin-left: 10px"
icon="el-icon-tickets"
size="mini"
@click="doExport"
:disabled="isExport"
>导出</el-button>
</LayoutTable> </LayoutTable>
<!-- 注册人员导入对话框 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
<el-checkbox
v-model="upload.updateSupport"
/>是否更新已经存在的数据
<el-link type="primary" style="font-size: 14px" @click="downloadTemplate"
>下载模板</el-link
>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<dialog-show ref="dialogform" @ok="getData" /> <dialog-show ref="dialogform" @ok="getData" />
</div> </div>
...@@ -21,6 +77,47 @@ export default { ...@@ -21,6 +77,47 @@ export default {
created() { created() {
}, },
methods: { methods: {
/** 导入 */
handleImport() {
this.upload.title = "注册人员导入";
this.upload.open = true;
},
/** 下载模板操作 */
downloadTemplate() {
this.isExport = true;
this.$download("/person/downloadTemplate", {}, { type: "excel" })
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 文件上传中处理 */
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
/** 文件上传成功处理 */
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getData();
},
/** 提交上传文件 */
submitFileForm() {
this.$refs.upload.submit();
},
/** 导出Excel */
doExport() {
this.isExport = true;
this.$download("/person/exportExcel", {
"idList": this.selection,
}, { type: "excel" }).then(() => this.isExport = false).catch(error => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
this.$refs.dialogform.add(row); this.$refs.dialogform.add(row);
...@@ -37,6 +134,20 @@ export default { ...@@ -37,6 +134,20 @@ export default {
}, },
data() { data() {
return { return {
// 用户导入参数
upload: {
// 是否显示弹出层(注册人员导入)
open: false,
// 弹出层标题(注册人员导入)
title: "导入注册人员数据",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: 0,
// 上传的地址
url: "/m/person/importData",
},
isExport: false,
config: { config: {
search: [ search: [
], ],
...@@ -44,6 +155,10 @@ export default { ...@@ -44,6 +155,10 @@ export default {
{type: "selection", width: 60}, {type: "selection", width: 60},
{type: "index",label: "序号",width: 50}, {type: "index",label: "序号",width: 50},
{label: "站点Id", prop: "siteId", formatter: this.formatter},
{label: "站点名称", prop: "siteName"},
{label: "身份证号码", prop: "idCard"}, {label: "身份证号码", prop: "idCard"},
{label: "性别", prop: "gender",formatter: this.formatter}, {label: "性别", prop: "gender",formatter: this.formatter},
...@@ -52,12 +167,6 @@ export default { ...@@ -52,12 +167,6 @@ export default {
{label: "家庭住址", prop: "address"}, {label: "家庭住址", prop: "address"},
{label: "照片路径", prop: "photo"},
{label: "注册人员来源", prop: "source",formatter: this.formatter},
{label: "是否添加到海康人脸库", prop: "inFaceHk",formatter: this.formatter},
{label: "创建用户", prop: "createUserId", formatter: this.formatter}, {label: "创建用户", prop: "createUserId", formatter: this.formatter},
{ {
label: "操作", label: "操作",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment