文件夹整理
This commit is contained in:
78
ruoyi-ui/src/api/ccdiEmployee.js
Normal file
78
ruoyi-ui/src/api/ccdiEmployee.js
Normal file
@@ -0,0 +1,78 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询员工列表
|
||||
export function listEmployee(query) {
|
||||
return request({
|
||||
url: '/ccdi/employee/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询员工详细
|
||||
export function getEmployee(employeeId) {
|
||||
return request({
|
||||
url: '/ccdi/employee/' + employeeId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增员工
|
||||
export function addEmployee(data) {
|
||||
return request({
|
||||
url: '/ccdi/employee',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改员工
|
||||
export function updateEmployee(data) {
|
||||
return request({
|
||||
url: '/ccdi/employee',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除员工
|
||||
export function delEmployee(employeeIds) {
|
||||
return request({
|
||||
url: '/ccdi/employee/' + employeeIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 下载导入模板
|
||||
export function importTemplate() {
|
||||
return request({
|
||||
url: '/ccdi/employee/importTemplate',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 导入员工
|
||||
export function importData(data, updateSupport) {
|
||||
return request({
|
||||
url: '/ccdi/employee/importData?updateSupport=' + updateSupport,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询导入状态
|
||||
export function getImportStatus(taskId) {
|
||||
return request({
|
||||
url: '/ccdi/employee/importStatus/' + taskId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询导入失败记录
|
||||
export function getImportFailures(taskId, pageNum, pageSize) {
|
||||
return request({
|
||||
url: '/ccdi/employee/importFailures/' + taskId,
|
||||
method: 'get',
|
||||
params: { pageNum, pageSize }
|
||||
})
|
||||
}
|
||||
1007
ruoyi-ui/src/views/ccdiEmployee/index.vue
Normal file
1007
ruoyi-ui/src/views/ccdiEmployee/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
716
ruoyi-ui/src/views/ccdiStaffFmyRelation/index.vue
Normal file
716
ruoyi-ui/src/views/ccdiStaffFmyRelation/index.vue
Normal file
@@ -0,0 +1,716 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="员工身份证号" prop="personId">
|
||||
<el-input
|
||||
v-model="queryParams.personId"
|
||||
placeholder="请输入员工身份证号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关系人姓名" prop="relationName">
|
||||
<el-input
|
||||
v-model="queryParams.relationName"
|
||||
placeholder="请输入关系人姓名"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关系类型" prop="relationType">
|
||||
<el-select v-model="queryParams.relationType" placeholder="请选择关系类型" clearable style="width: 240px">
|
||||
<el-option label="配偶" value="配偶" />
|
||||
<el-option label="父亲" value="父亲" />
|
||||
<el-option label="母亲" value="母亲" />
|
||||
<el-option label="儿子" value="儿子" />
|
||||
<el-option label="女儿" value="女儿" />
|
||||
<el-option label="祖父" value="祖父" />
|
||||
<el-option label="祖母" value="祖母" />
|
||||
<el-option label="外祖父" value="外祖父" />
|
||||
<el-option label="外祖母" value="外祖母" />
|
||||
<el-option label="兄弟姐妹" value="兄弟姐妹" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="证件号码" prop="relationCertNo">
|
||||
<el-input
|
||||
v-model="queryParams.relationCertNo"
|
||||
placeholder="请输入证件号码"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 240px">
|
||||
<el-option label="有效" :value="1" />
|
||||
<el-option label="无效" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['ccdi:staffFmyRelation:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['ccdi:staffFmyRelation:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['ccdi:staffFmyRelation:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" v-if="showFailureButton">
|
||||
<el-tooltip
|
||||
:content="getLastImportTooltip()"
|
||||
placement="top"
|
||||
>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-warning"
|
||||
size="mini"
|
||||
@click="viewImportFailures"
|
||||
>查看导入失败记录</el-button>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="relationList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="员工身份证号" align="center" prop="personId" width="180" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="关系类型" align="center" prop="relationType" width="100"/>
|
||||
<el-table-column label="关系人姓名" align="center" prop="relationName" width="120"/>
|
||||
<el-table-column label="性别" align="center" prop="gender" width="80">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.gender === 'M'">男</span>
|
||||
<span v-else-if="scope.row.gender === 'F'">女</span>
|
||||
<span v-else-if="scope.row.gender === 'O'">其他</span>
|
||||
<span v-else>{{ scope.row.gender }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证件类型" align="center" prop="relationCertType" width="100"/>
|
||||
<el-table-column label="证件号码" align="center" prop="relationCertNo" width="180" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="手机号码1" align="center" prop="mobilePhone1" width="120"/>
|
||||
<el-table-column label="状态" align="center" prop="status" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status === 1" type="success">有效</el-tag>
|
||||
<el-tag v-else type="danger">无效</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ccdi:staffFmyRelation:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ccdi:staffFmyRelation:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||
<el-divider content-position="left">基本信息</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="员工身份证号" prop="personId">
|
||||
<el-input v-model="form.personId" placeholder="请输入员工身份证号" maxlength="18" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关系类型" prop="relationType">
|
||||
<el-select v-model="form.relationType" placeholder="请选择关系类型" style="width: 100%">
|
||||
<el-option label="配偶" value="配偶" />
|
||||
<el-option label="父亲" value="父亲" />
|
||||
<el-option label="母亲" value="母亲" />
|
||||
<el-option label="儿子" value="儿子" />
|
||||
<el-option label="女儿" value="女儿" />
|
||||
<el-option label="祖父" value="祖父" />
|
||||
<el-option label="祖母" value="祖母" />
|
||||
<el-option label="外祖父" value="外祖父" />
|
||||
<el-option label="外祖母" value="外祖母" />
|
||||
<el-option label="兄弟姐妹" value="兄弟姐妹" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关系人姓名" prop="relationName">
|
||||
<el-input v-model="form.relationName" placeholder="请输入关系人姓名" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-select v-model="form.gender" placeholder="请选择性别" style="width: 100%">
|
||||
<el-option label="男" value="M" />
|
||||
<el-option label="女" value="F" />
|
||||
<el-option label="其他" value="O" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="出生日期" prop="birthDate">
|
||||
<el-date-picker
|
||||
v-model="form.birthDate"
|
||||
type="date"
|
||||
placeholder="选择出生日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="证件类型" prop="relationCertType">
|
||||
<el-input v-model="form.relationCertType" placeholder="请输入证件类型" maxlength="50" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="证件号码" prop="relationCertNo">
|
||||
<el-input v-model="form.relationCertNo" placeholder="请输入证件号码" maxlength="50" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="1">有效</el-radio>
|
||||
<el-radio :label="0">无效</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="left">联系方式</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号码1" prop="mobilePhone1">
|
||||
<el-input v-model="form.mobilePhone1" placeholder="请输入手机号码1" maxlength="11" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号码2" prop="mobilePhone2">
|
||||
<el-input v-model="form.mobilePhone2" placeholder="请输入手机号码2" maxlength="11" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="微信名称1" prop="wechatNo1">
|
||||
<el-input v-model="form.wechatNo1" placeholder="请输入微信名称1" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="微信名称2" prop="wechatNo2">
|
||||
<el-input v-model="form.wechatNo2" placeholder="请输入微信名称2" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="微信名称3" prop="wechatNo3">
|
||||
<el-input v-model="form.wechatNo3" placeholder="请输入微信名称3" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="详细联系地址" prop="contactAddress">
|
||||
<el-input v-model="form.contactAddress" placeholder="请输入详细联系地址" maxlength="255" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="left">其他信息</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关系详细描述" prop="relationDesc">
|
||||
<el-input v-model="form.relationDesc" type="textarea" :rows="2" placeholder="请输入关系详细描述" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注信息" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注信息" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关系生效日期" prop="effectiveDate">
|
||||
<el-date-picker
|
||||
v-model="form.effectiveDate"
|
||||
type="datetime"
|
||||
placeholder="选择关系生效日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关系失效日期" prop="invalidDate">
|
||||
<el-date-picker
|
||||
v-model="form.invalidDate"
|
||||
type="datetime"
|
||||
placeholder="选择关系失效日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入对话框 -->
|
||||
<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"
|
||||
: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-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
<span>仅允许导入"xls"或"xlsx"格式文件。</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm" :loading="upload.isUploading">确 定</el-button>
|
||||
<el-button @click="upload.open = false" :disabled="upload.isUploading">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入结果对话框 -->
|
||||
<import-result-dialog
|
||||
:visible.sync="importResultVisible"
|
||||
:content="importResultContent"
|
||||
title="导入结果"
|
||||
@close="handleImportResultClose"
|
||||
/>
|
||||
|
||||
<!-- 导入失败记录对话框 -->
|
||||
<el-dialog
|
||||
title="导入失败记录"
|
||||
:visible.sync="failureDialogVisible"
|
||||
width="1200px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert
|
||||
v-if="lastImportInfo"
|
||||
:title="lastImportInfo"
|
||||
type="info"
|
||||
:closable="false"
|
||||
style="margin-bottom: 15px"
|
||||
/>
|
||||
|
||||
<el-table :data="failureList" v-loading="failureLoading">
|
||||
<el-table-column label="员工身份证号" prop="personId" align="center" width="180" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="关系类型" prop="relationType" align="center" width="100"/>
|
||||
<el-table-column label="关系人姓名" prop="relationName" align="center" width="120"/>
|
||||
<el-table-column label="性别" prop="gender" align="center" width="80"/>
|
||||
<el-table-column label="证件类型" prop="relationCertType" align="center" width="100"/>
|
||||
<el-table-column label="证件号码" prop="relationCertNo" align="center" width="180" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="手机号码1" prop="mobilePhone1" align="center" width="120"/>
|
||||
<el-table-column label="状态" prop="status" align="center" width="80"/>
|
||||
<el-table-column label="失败原因" prop="errorMessage" align="center" min-width="200" :show-overflow-tooltip="true" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="failureTotal > 0"
|
||||
:total="failureTotal"
|
||||
:page.sync="failureQueryParams.pageNum"
|
||||
:limit.sync="failureQueryParams.pageSize"
|
||||
@pagination="getFailureList"
|
||||
/>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="failureDialogVisible = false">关闭</el-button>
|
||||
<el-button type="danger" plain @click="clearImportHistory">清除历史记录</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
addRelation,
|
||||
delRelation,
|
||||
getImportFailures,
|
||||
getImportStatus,
|
||||
getRelation,
|
||||
listRelation,
|
||||
updateRelation
|
||||
} from "@/api/ccdiStaffFmyRelation";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import ImportResultDialog from "@/components/ImportResultDialog.vue";
|
||||
|
||||
export default {
|
||||
name: "StaffFmyRelation",
|
||||
components: { ImportResultDialog },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 员工亲属关系表格数据
|
||||
relationList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否为新增操作
|
||||
isAdd: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
personId: null,
|
||||
relationName: null,
|
||||
relationType: null,
|
||||
relationCertNo: null,
|
||||
status: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
personId: [
|
||||
{ required: true, message: "员工身份证号不能为空", trigger: "blur" },
|
||||
{ pattern: /^\\d{17}[\dXx]$/, message: "员工身份证号格式不正确", trigger: "blur" }
|
||||
],
|
||||
relationType: [
|
||||
{ required: true, message: "关系类型不能为空", trigger: "change" }
|
||||
],
|
||||
relationName: [
|
||||
{ required: true, message: "关系人姓名不能为空", trigger: "blur" },
|
||||
{ max: 100, message: "关系人姓名长度不能超过100个字符", trigger: "blur" }
|
||||
],
|
||||
relationCertType: [
|
||||
{ required: true, message: "证件类型不能为空", trigger: "blur" },
|
||||
{ max: 50, message: "证件类型长度不能超过50个字符", trigger: "blur" }
|
||||
],
|
||||
relationCertNo: [
|
||||
{ required: true, message: "证件号码不能为空", trigger: "blur" },
|
||||
{ max: 50, message: "证件号码长度不能超过50个字符", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||
],
|
||||
mobilePhone1: [
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: "手机号码1格式不正确", trigger: "blur" }
|
||||
],
|
||||
mobilePhone2: [
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: "手机号码2格式不正确", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
// 导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/ccdi/staffFmyRelation/importData"
|
||||
},
|
||||
// 导入结果对话框
|
||||
importResultVisible: false,
|
||||
importResultContent: "",
|
||||
// 导入失败记录
|
||||
failureDialogVisible: false,
|
||||
failureList: [],
|
||||
failureLoading: false,
|
||||
failureTotal: 0,
|
||||
failureQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
lastTaskId: null,
|
||||
lastImportInfo: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showFailureButton() {
|
||||
return this.lastTaskId && this.lastImportInfo && this.lastImportInfo.includes("失败");
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询员工亲属关系列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRelation(this.queryParams).then(response => {
|
||||
this.relationList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
personId: null,
|
||||
relationType: null,
|
||||
relationName: null,
|
||||
gender: null,
|
||||
birthDate: null,
|
||||
relationCertType: null,
|
||||
relationCertNo: null,
|
||||
mobilePhone1: null,
|
||||
mobilePhone2: null,
|
||||
wechatNo1: null,
|
||||
wechatNo2: null,
|
||||
wechatNo3: null,
|
||||
contactAddress: null,
|
||||
relationDesc: null,
|
||||
status: 1,
|
||||
effectiveDate: null,
|
||||
invalidDate: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 多选框选中数据 */
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加员工亲属关系信息";
|
||||
this.isAdd = true;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids[0];
|
||||
getRelation(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改员工亲属关系信息";
|
||||
this.isAdd = false;
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRelation(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRelation(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除员工亲属关系信息编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delRelation(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('ccdi/staffFmyRelation/export', {
|
||||
...this.queryParams
|
||||
}, `员工亲属关系信息_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport() {
|
||||
this.upload.title = "导入员工亲属关系信息";
|
||||
this.upload.open = true;
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate() {
|
||||
this.download('ccdi/staffFmyRelation/importTemplate', {}, `员工亲属关系信息导入模板_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.isUploading = false;
|
||||
if (response.code === 200) {
|
||||
const taskId = response.data.taskId;
|
||||
this.lastTaskId = taskId;
|
||||
this.upload.open = false;
|
||||
this.pollImportStatus(taskId);
|
||||
} else {
|
||||
this.$modal.msgError(response.msg);
|
||||
this.upload.open = false;
|
||||
}
|
||||
this.$refs.upload.clearFiles();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
// 轮询导入状态
|
||||
pollImportStatus(taskId) {
|
||||
const poll = async () => {
|
||||
try {
|
||||
const statusRes = await getImportStatus(taskId);
|
||||
const status = statusRes.data.status;
|
||||
|
||||
if (status === "PROCESSING") {
|
||||
// 继续轮询
|
||||
setTimeout(poll, 1000);
|
||||
} else {
|
||||
// 导入完成
|
||||
this.importResultVisible = true;
|
||||
this.lastImportInfo = `共${statusRes.data.totalCount}条,成功${statusRes.data.successCount}条,失败${statusRes.data.failureCount}条`;
|
||||
this.importResultContent = this.lastImportInfo;
|
||||
this.getList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("轮询导入状态失败:", error);
|
||||
this.$modal.msgError("导入状态查询失败");
|
||||
this.getList();
|
||||
}
|
||||
};
|
||||
poll();
|
||||
},
|
||||
// 查看导入失败记录
|
||||
viewImportFailures() {
|
||||
if (!this.lastTaskId) {
|
||||
this.$modal.msgWarning("没有可查看的导入记录");
|
||||
return;
|
||||
}
|
||||
this.failureDialogVisible = true;
|
||||
this.getFailureList();
|
||||
},
|
||||
// 获取导入失败记录
|
||||
getFailureList() {
|
||||
if (!this.lastTaskId) return;
|
||||
|
||||
this.failureLoading = true;
|
||||
getImportFailures(this.lastTaskId, this.failureQueryParams.pageNum, this.failureQueryParams.pageSize).then(response => {
|
||||
this.failureList = response.rows;
|
||||
this.failureTotal = response.total;
|
||||
this.failureLoading = false;
|
||||
}).catch(() => {
|
||||
this.failureLoading = false;
|
||||
});
|
||||
},
|
||||
// 清除导入历史记录
|
||||
clearImportHistory() {
|
||||
this.lastTaskId = null;
|
||||
this.lastImportInfo = null;
|
||||
this.failureList = [];
|
||||
this.failureTotal = 0;
|
||||
this.failureDialogVisible = false;
|
||||
this.$modal.msgSuccess("已清除导入历史记录");
|
||||
},
|
||||
// 导入结果对话框关闭
|
||||
handleImportResultClose() {
|
||||
this.importResultVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user