员工入驻审核、信息变更审核 合并为一个功能

This commit is contained in:
1378012178@qq.com 2026-01-29 09:13:10 +08:00
parent 1b24be130c
commit dc016b48d0
11 changed files with 2406 additions and 17 deletions

View File

@ -8,23 +8,24 @@
<a-col :lg="6">
<a-form-item name="name">
<template #label><span title="姓名">姓名</span></template>
<JInput v-model:value="queryParam.name" placeholder="请输入姓名"/>
<JInput v-model:value="queryParam.name" placeholder="请输入姓名" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="paramsTime">
<template #label><span title="申请日期">申请日期</span></template>
<a-date-picker v-model:value="queryParam.paramsTime" placeholder="请选择申请日期" value-format="YYYY-MM-DD" allow-clear/>
<a-date-picker v-model:value="queryParam.paramsTime" placeholder="请选择申请日期" value-format="YYYY-MM-DD"
allow-clear />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="status">
<template #label><span title="审核状态">审核状态</span></template>
<a-select v-model:value="queryParam.status" placeholder="请选择审核状态" style="width: 200px" :disabled="false">
<a-select-option value="1">待确认</a-select-option>
<a-select-option value="2">申请通过</a-select-option>
<a-select-option value="3">申请驳回</a-select-option>
</a-select>
<a-select v-model:value="queryParam.status" placeholder="请选择审核状态" style="width: 200px" :disabled="false">
<a-select-option value="1">待确认</a-select-option>
<a-select-option value="2">申请通过</a-select-option>
<a-select-option value="3">申请驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
@ -54,7 +55,7 @@
<span>{{ handleComputedAge(text) }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<span v-if="record.status == '1'">确认</span>
<span v-if="record.status == '1'">审核</span>
<span v-else-if="record.status == '2'">申请通过</span>
<span v-else-if="record.status == '3'">申请驳回</span>
<span v-else></span>
@ -91,7 +92,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
canResize: false,
useSearchForm: false,
actionColumn: {
width: 120,
width: 140,
fixed: 'right',
},
scroll: { y: '58vh' },
@ -101,7 +102,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
pageSizeOptions: ['15', '50', '70', '100'],
},
beforeFetch: async (params) => {
queryParam.applyType = '1'
queryParam.applyType = '1,2'
return Object.assign(params, queryParam);
},
},
@ -136,13 +137,21 @@ function handleAdd() {
}
/**
* 编辑事件
* 入住审核
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 变更审核
*/
function handleUpEdit(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.upInfoEdit(record);
}
/**
* 详情
*/
@ -168,10 +177,14 @@ function getTableAction(record) {
onClick: handleDetail.bind(null, record),
},
{
label: '审核',
label: '入驻审核',
onClick: handleEdit.bind(null, record),
auth: 'employeesapply:nu_biz_employees_apply:edit',
ifShow: record.status == '1'
ifShow: record.status == 1 && (record.modifyStatus == null || record.modifyStatus == undefined) && record.izHistory == 'N'
},
{
label: '变更审核',
onClick: handleUpEdit.bind(null, record),
ifShow: record.status == 1 && record.modifyStatus == 1 && record.izHistory == 'N'
},
];
}

View File

@ -272,13 +272,14 @@
id="EmployeesApplyForm-status" name="status">
<div v-if="disabled">
<!-- 被邀请 -->
<div v-if="formData.applyType == 0">
<!-- <div v-if="formData.applyType == 0">
<span v-if="formData.status == 1"><a-input :value="'待确认'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 2"><a-input :value="'已接受'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 3"><a-input :value="'已拒绝'" disabled allow-clear></a-input></span>
</div>
</div> -->
<!-- 主动申请 -->
<div v-if="formData.applyType == 1">
<!-- <div v-if="formData.applyType == 1"> -->
<div>
<span v-if="formData.status == 1"><a-input :value="'待审核'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 2"><a-input :value="'申请通过'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 3"><a-input :value="'申请驳回'" disabled allow-clear></a-input></span>
@ -414,6 +415,9 @@ const disabled = computed(() => {
}
return props.formDisabled;
});
setInterval(() => {
console.log("🌊 ~ disabled:", disabled)
}, 2000)
/**
@ -427,6 +431,7 @@ function add() {
* 编辑
*/
function edit(record) {
console.log("🌊 ~ edit ~ record:", record)
ageVal.value = handleComputedAge(record.dateOfBirth)
nextTick(() => {
resetFields();

View File

@ -0,0 +1,101 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/admin/employeesapply/list',
getModifyInfo = '/admin/employeesapply/getModifyInfo',
save = '/admin/employeesapply/add',
edit = '/admin/employeesapply/edit',
deleteOne = '/admin/employeesapply/delete',
deleteBatch = '/admin/employeesapply/deleteBatch',
importExcel = '/admin/employeesapply/importExcel',
exportXls = '/admin/employeesapply/exportXls',
invide = '/admin/employeesapply/invide',
audit = '/admin/employeesapply/audit',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
};
/**
*
* @param params
*/
export const invide = (params) => {
return defHttp.post({ url: Api.invide, params });
};
/**
*
* @param params
*/
export const getModifyInfo = (params) => {
return defHttp.post({ url: Api.getModifyInfo, params });
}
/**
*
* @param params
*/
export const auditSubmit = (params) => {
return defHttp.post({ url: Api.audit, params });
};

View File

@ -0,0 +1,138 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '姓名',
align: 'center',
dataIndex: 'name',
},
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
{
title: '年龄',
align: 'center',
dataIndex: 'dateOfBirth',
},
{
title: '联系电话',
align: 'center',
dataIndex: 'tel',
},
{
title: '申请日期',
align: 'center',
dataIndex: 'createTime',
},
{
title: '审核状态',
align: 'center',
dataIndex: 'status',
},
// {
// title: '审核备注',
// align: "center",
// dataIndex: 'auditContent'
// },
];
//列表数据
export const columns1: BasicColumn[] = [
{
title: '姓名',
align: 'center',
dataIndex: 'name',
},
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
{
title: '年龄',
align: 'center',
dataIndex: 'dateOfBirth',
},
{
title: '联系电话',
align: 'center',
dataIndex: 'tel',
},
{
title: '申请日期',
align: 'center',
dataIndex: 'createTime',
},
{
title: '邀请状态',
align: 'center',
dataIndex: 'status',
},
// {
// title: '审核备注',
// align: "center",
// dataIndex: 'auditContent'
// },
];
// 高级查询数据
export const superQuerySchema = {
name: { title: '姓名', order: 0, view: 'text', type: 'string' },
sex: { title: '性别', order: 1, view: 'radio', type: 'string', dictCode: '' },
tel: { title: '联系电话', order: 4, view: 'text', type: 'string' },
createTime: { title: '申请日期', order: 27, view: 'datetime', type: 'string' },
status: { title: '申请状态 0历史 1申请中 2通过 3驳回', order: 28, view: 'text', type: 'string' },
auditContent: { title: '审核备注', order: 29, view: 'text', type: 'string' },
};
export const applyObj = {
id: '员工申请ID',
openId: '微信OpenID',
employeeId: '员工ID',
name: '姓名',
sex: '性别',
national: '民族',
idCard: '身份证号',
tel: '联系电话',
dateOfBirth: '出生日期',
marriedOrNot: '婚否',
height: '身高',
weight: '体重',
address: '家庭住址',
isSmoking: '是否吸烟',
healthStatus: '健康状况',
houseAddress: '住址',
politicalAppearance: '政治面貌',
emergencyContact: '紧急联系人',
emergencyTel: '紧急联系人电话',
emergencyRelationship: '与本人关系',
hukouNature: '户口性质',
idCardPositive: '身份证正面',
idCardNegative: '身份证反面',
healthCertificatePositive: '健康证正面',
healthCertificateNegative: '健康证反面',
bankPositive: '银行卡正面',
bankNegative: '银行卡反面',
openingBank: '开户行',
bankCard: '银行卡号',
qualification: '资质证',
noCrimeCertificate: '无犯罪证明',
regional: '区域',
delFlag: '是否删除 0未删除 1删除',
createTime: '申请日期',
updateBy: '更新人',
updateTime: '更新日期',
status: '申请状态 1申请中 2通过 3驳回',
auditContent: '审核备注',
izHistory: '是否历史数据',
applyType: '申请类型 0被邀请 1主动申请 2信息变更',
startTime: '有效开始日期',
endTime: '有效结束日期',
currentAddress: '现住址',
};

View File

@ -0,0 +1,258 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="name">
<template #label><span title="姓名">姓名</span></template>
<JInput v-model:value="queryParam.name" placeholder="请输入姓名"/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="paramsTime">
<template #label><span title="申请日期">申请日期</span></template>
<a-date-picker v-model:value="queryParam.paramsTime" placeholder="请选择申请日期" value-format="YYYY-MM-DD" allow-clear/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="status">
<template #label><span title="审核状态">审核状态</span></template>
<a-select v-model:value="queryParam.status" placeholder="请选择审核状态" style="width: 200px" :disabled="false">
<a-select-option value="1">待确认</a-select-option>
<a-select-option value="2">申请通过</a-select-option>
<a-select-option value="3">申请驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<!-- <a-button type="primary" v-auth="'employeesapply:nu_biz_employees_apply:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
<template v-if="column.dataIndex === 'dateOfBirth'">
<span>{{ handleComputedAge(text) }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<span v-if="record.status == '1'">待确认</span>
<span v-else-if="record.status == '2'">申请通过</span>
<span v-else-if="record.status == '3'">申请驳回</span>
<span v-else></span>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<EmployeesApplyModal ref="registerModal" @success="handleSuccess"></EmployeesApplyModal>
</div>
</template>
<script lang="ts" name="employeesapply-employeesApply" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './EmployeesApply.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './EmployeesApply.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import EmployeesApplyModal from './components/EmployeesApplyModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '员工申请',
api: list,
columns,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
scroll: { y: '58vh' },
pagination: {
current: 1,
pageSize: 15,
pageSizeOptions: ['15', '50', '70', '100'],
},
beforeFetch: async (params) => {
queryParam.applyType = '1'
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "员工申请",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '审核',
onClick: handleEdit.bind(null, record),
auth: 'employeesapply:nu_biz_employees_apply:edit',
ifShow: record.status == '1'
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
function handleComputedAge(ageText) {
//
if (!ageText || typeof ageText !== 'string') {
return NaN;
}
//
const birthDate = new Date(ageText);
// '2025-99-99'
if (isNaN(birthDate.getTime())) {
return NaN;
}
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
// 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age >= 0 ? age : 0; //
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
margin-bottom: 14px;
.table-page-search-submitButtons {
display: block;
margin-bottom: 14px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 14px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,259 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="name">
<template #label><span title="姓名">姓名</span></template>
<JInput v-model:value="queryParam.name" placeholder="请输入姓名" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="paramsTime">
<template #label><span title="申请日期">申请日期</span></template>
<a-date-picker v-model:value="queryParam.paramsTime" placeholder="请选择申请日期" value-format="YYYY-MM-DD"
allow-clear />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="status">
<template #label><span title="审核状态">审核状态</span></template>
<a-select v-model:value="queryParam.status" placeholder="请选择审核状态" style="width: 200px" :disabled="false">
<a-select-option value="1">待确认</a-select-option>
<a-select-option value="2">申请通过</a-select-option>
<a-select-option value="3">申请驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<!-- <a-button type="primary" v-auth="'employeesapply:nu_biz_employees_apply:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
<template v-if="column.dataIndex === 'dateOfBirth'">
<span>{{ handleComputedAge(text) }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<span v-if="record.status == '1'">待确认</span>
<span v-else-if="record.status == '2'">申请通过</span>
<span v-else-if="record.status == '3'">申请驳回</span>
<span v-else></span>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<EmployeesApplyModal ref="registerModal" @success="handleSuccess"></EmployeesApplyModal>
</div>
</template>
<script lang="ts" name="employeesinfoup-employeesInfoUp" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './EmployeesApply.data';
import { list, getModifyInfo, getImportUrl, getExportUrl } from './EmployeesApply.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import EmployeesApplyModal from './components/EmployeesApplyModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '员工申请',
api: list,
columns,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
scroll: { y: '58vh' },
pagination: {
current: 1,
pageSize: 15,
pageSizeOptions: ['15', '50', '70', '100'],
},
beforeFetch: async (params) => {
queryParam.applyType = '2'//
queryParam.modifyStatus = '1'//
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "员工申请",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 审核
*/
function handleUpEdit(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.upInfoEdit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// },
{
label: '审核',
onClick: handleUpEdit.bind(null, record),
ifShow: record.modifyStatus == '1'
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
function handleComputedAge(ageText) {
//
if (!ageText || typeof ageText !== 'string') {
return NaN;
}
//
const birthDate = new Date(ageText);
// '2025-99-99'
if (isNaN(birthDate.getTime())) {
return NaN;
}
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
// 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age >= 0 ? age : 0; //
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
margin-bottom: 14px;
.table-page-search-submitButtons {
display: block;
margin-bottom: 14px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 14px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,256 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="name">
<template #label><span title="姓名">姓名</span></template>
<JInput v-model:value="queryParam.name" placeholder="请输入姓名"/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="paramsTime">
<template #label><span title="申请日期">申请日期</span></template>
<a-date-picker v-model:value="queryParam.paramsTime" placeholder="请选择申请日期" value-format="YYYY-MM-DD" allow-clear/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="status">
<template #label><span title="邀请状态">邀请状态</span></template>
<a-select v-model:value="queryParam.status" placeholder="请选择邀请状态" style="width: 200px" :disabled="false">
<a-select-option value="1">待确认</a-select-option>
<a-select-option value="2">已接受</a-select-option>
<a-select-option value="3">已拒绝</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleInvidedList" preIcon="ant-design:user-add-outlined">邀请</a-button>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
<template v-if="column.dataIndex === 'dateOfBirth'">
<span>{{ handleComputedAge(text) }}</span>
</template>
<template v-if="column.dataIndex === 'status'">
<span v-if="record.status == '1'">待确认</span>
<span v-else-if="record.status == '2'">已接受</span>
<span v-else-if="record.status == '3'">已拒绝</span>
<span v-else></span>
</template>
</template>
</BasicTable>
<!-- 表单区域 -->
<EmployeesApplyModal ref="registerModal" @success="handleSuccess"></EmployeesApplyModal>
</div>
</template>
<script lang="ts" name="employeesapply-employeesApply" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns1, superQuerySchema } from './EmployeesApply.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './EmployeesApply.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import EmployeesApplyModal from './components/EmployeesApplyModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '员工申请',
api: list,
columns:columns1,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
scroll: { y: '58vh' },
pagination: {
current: 1,
pageSize: 15,
pageSizeOptions: ['15', '50', '70', '100'],
},
beforeFetch: async (params) => {
queryParam.applyType = '0'
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "员工申请",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
function handleComputedAge(ageText) {
//
if (!ageText || typeof ageText !== 'string') {
return NaN;
}
//
const birthDate = new Date(ageText);
// '2025-99-99'
if (isNaN(birthDate.getTime())) {
return NaN;
}
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
// 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age >= 0 ? age : 0; //
}
function handleInvidedList() {
registerModal.value.openInvidedList();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
margin-bottom: 14px;
.table-page-search-submitButtons {
display: block;
margin-bottom: 14px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 14px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,554 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="true">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="EmployeesApplyForm">
<a-row class="card-class">
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<SectionDivider :title="'基本信息'" />
<!-- <span>基本信息</span> -->
</a-col>
<a-col :span="12">
<a-form-item label="姓名" v-bind="validateInfos.name" id="EmployeesApplyForm-name" name="name">
<a-input v-model:value="formData.name" placeholder="请输入姓名" disabled allow-clear></a-input>
<!-- <span>{{ formData.name }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="联系电话" v-bind="validateInfos.tel" id="EmployeesApplyForm-tel" name="tel">
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" disabled allow-clear></a-input>
<!-- <span>{{ formData.tel }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="性别" v-bind="validateInfos.sex" id="EmployeesApplyForm-sex" name="sex">
<a-input v-model:value="formData.sex" placeholder="请输入性别" disabled allow-clear></a-input>
<!-- <j-dict-select-tag type='radio' v-model:value="formData.sex" dictCode="sex" placeholder="请选择性别" disabled
allow-clear /> -->
<!-- <span>{{ formData.sex }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="年龄" v-bind="validateInfos.sex" id="EmployeesApplyForm-sex" name="sex">
<a-input v-model:value="ageVal" placeholder="请输入年龄" disabled allow-clear></a-input>
<!-- <span> {{ handleComputedAge(formData.dateOfBirth) }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="出生日期" v-bind="validateInfos.dateOfBirth" id="EmployeesApplyForm-dateOfBirth"
name="dateOfBirth">
<a-date-picker placeholder="请选择出生日期" v-model:value="formData.dateOfBirth" value-format="YYYY-MM-DD"
style="width: 100%" disabled allow-clear />
<!-- <span>{{ formData.dateOfBirth }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="民族" v-bind="validateInfos.national" id="EmployeesApplyForm-national" name="national">
<a-input v-model:value="formData.national" placeholder="请输入民族" disabled allow-clear></a-input>
<!-- <span>{{ formData.national }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身份证号">
<a-input v-model:value="formData.idCard" placeholder="请输入身份证号" disabled allow-clear></a-input>
<!-- <span>{{ formData.idCard }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="婚否" v-bind="validateInfos.marriedOrNot" id="EmployeesApplyForm-marriedOrNot"
name="marriedOrNot">
<!-- <j-dict-select-tag type='radio' v-model:value="formData.marriedOrNot" dictCode="married_or_not"
placeholder="请选择婚否" disabled allow-clear /> -->
<a-input v-model:value="formData.marriedOrNot" placeholder="请输入婚否" disabled allow-clear></a-input>
<!-- <span>{{ formData.marriedOrNot }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身高(cm)" v-bind="validateInfos.height" id="EmployeesApplyForm-height" name="height">
<a-input-number v-model:value="formData.height" placeholder="请输入身高" style="width: 100%" disabled />
<!-- <span>{{ formData.height }}cm</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="体重(kg)" v-bind="validateInfos.weight" id="EmployeesApplyForm-weight" name="weight">
<a-input-number v-model:value="formData.weight" placeholder="请输入体重" style="width: 100%" disabled />
<!-- <span>{{ formData.weight }}kg</span> -->
</a-form-item>
</a-col>
<!-- <a-col :span="12">
<a-form-item label="是否吸烟" v-bind="validateInfos.isSmoking" id="EmployeesApplyForm-isSmoking"
name="isSmoking">
<j-dict-select-tag type='radio' v-model:value="formData.isSmoking" dictCode="is_smoking"
placeholder="请选择是否吸烟" disabled allow-clear />
<span>{{ formData.isSmoking }}</span>
</a-form-item>
</a-col> -->
<a-col :span="12">
<a-form-item label="健康状况" v-bind="validateInfos.healthStatus" id="EmployeesApplyForm-healthStatus"
name="healthStatus">
<!-- <j-dict-select-tag type='radio' v-model:value="formData.healthStatus" dictCode="health_status" disabled
placeholder="请选择健康状况" allow-clear /> -->
<a-input v-model:value="formData.healthStatus" placeholder="请输入健康状况" style="width: 100%" disabled />
<!-- <span>{{ formData.healthStatus }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="政治面貌" v-bind="validateInfos.politicalAppearance"
id="EmployeesApplyForm-politicalAppearance" name="politicalAppearance">
<!-- <j-dict-select-tag v-model:value="formData.politicalAppearance" dictCode="political_appearance" disabled
placeholder="请选择政治面貌" allow-clear /> -->
<a-input v-model:value="formData.politicalAppearance" placeholder="请输入政治面貌" style="width: 100%"
disabled />
<!-- <span>{{ formData.politicalAppearance }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="户籍所在地" v-bind="validateInfos.houseAddress" id="EmployeesApplyForm-houseAddress"
name="houseAddress">
<a-input v-model:value="formData.houseAddress" placeholder="请输入户籍所在地" disabled allow-clear></a-input>
<!-- <span>{{ formData.houseAddress }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急联系人" v-bind="validateInfos.emergencyContact"
id="EmployeesApplyForm-emergencyContact" name="emergencyContact">
<a-input v-model:value="formData.emergencyContact" placeholder="请输入紧急联系人" disabled
allow-clear></a-input>
<!-- <span>{{ formData.emergencyContact }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急联系人电话" v-bind="validateInfos.emergencyTel" id="EmployeesApplyForm-emergencyTel"
name="emergencyTel">
<a-input v-model:value="formData.emergencyTel" placeholder="请输入紧急联系人电话" disabled allow-clear></a-input>
<!-- <span>{{ formData.emergencyTel }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="与本人关系" v-bind="validateInfos.emergencyRelationship"
id="EmployeesApplyForm-emergencyRelationship" name="emergencyRelationship">
<a-input v-model:value="formData.emergencyRelationship" placeholder="请输入紧急联系人与本人关系" disabled
allow-clear></a-input>
<!-- <span>{{ formData.emergencyRelationship }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="户口性质" v-bind="validateInfos.hukouNature" id="EmployeesApplyForm-hukouNature"
name="hukouNature">
<!-- <j-dict-select-tag type='radio' v-model:value="formData.hukouNature" dictCode="hukou_nature" disabled
placeholder="请选择户口性质" allow-clear /> -->
<a-input v-model:value="formData.hukouNature" placeholder="请输入户口性质" disabled allow-clear></a-input>
<!-- <span>{{ formData.hukouNature }}</span> -->
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="现住址" v-bind="validateInfos.currentAddress" id="EmployeesApplyForm-currentAddress"
name="currentAddress">
<a-input v-model:value="formData.currentAddress" placeholder="请输入现住址" disabled allow-clear></a-input>
<!-- <span>{{ formData.currentAddress }}</span> -->
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<JFormContainer>
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol2" :wrapperCol="wrapperCol2"
name="EmployeesApplyForm">
<a-row class="card-class">
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<SectionDivider :title="'证件信息'" />
</a-col>
<a-col :span="23" :push="1">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="身份证">
<a-row>
<a-col :span="12">
<a-form-item label="身份证正面" v-bind="validateInfos.idCardPositive"
id="BizEmployeesInfoForm-idCardPositive" name="idCardPositive">
<j-image-upload v-if="!!formData.idCardPositive" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.idCardPositive" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身份证反面" v-bind="validateInfos.idCardNegative"
id="BizEmployeesInfoForm-idCardNegative" name="idCardNegative">
<j-image-upload v-if="!!formData.idCardNegative" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.idCardNegative" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="3" tab="健康证">
<a-row>
<a-col :span="12">
<a-form-item label="健康证正面" v-bind="validateInfos.healthCertificatePositive"
id="BizEmployeesInfoForm-healthCertificatePositive" name="healthCertificatePositive">
<j-image-upload v-if="!!formData.healthCertificatePositive" :fileMax="1"
:bizPath="`employeesZzxx`" :value="opeMediaAddress + formData.healthCertificatePositive"
disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
<!-- <a-col :span="12">
<a-form-item label="健康证反面" v-bind="validateInfos.healthCertificateNegative"
id="BizEmployeesInfoForm-healthCertificateNegative" name="healthCertificateNegative">
<j-image-upload :fileMax="1" :bizPath="`employeesZzxx`"
v-model:value="formData.healthCertificateNegative" disabled></j-image-upload>
</a-form-item>
</a-col> -->
</a-row>
</a-tab-pane>
<a-tab-pane key="4" tab="银行卡">
<a-row>
<a-col :span="12">
<a-form-item label="银行卡正面" v-bind="validateInfos.bankPositive"
id="BizEmployeesInfoForm-bankPositive" name="bankPositive">
<j-image-upload v-if="!!formData.bankPositive" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.bankPositive" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="银行卡反面" v-bind="validateInfos.bankNegative"
id="BizEmployeesInfoForm-bankNegative" name="bankNegative">
<j-image-upload v-if="!!formData.bankNegative" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.bankNegative" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="5" tab="资质证件">
<a-row>
<a-col :span="24">
<a-form-item label="资质证" v-bind="validateInfos.qualification"
id="BizEmployeesInfoForm-qualification" name="qualification" :labelCol="labelCol3">
<j-image-upload v-if="!!formData.qualification" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.qualification" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
<a-tab-pane key="6" tab="无犯罪证明">
<a-row>
<a-col :span="24">
<a-form-item label="无犯罪证明" v-bind="validateInfos.noCrimeCertificate"
id="BizEmployeesInfoForm-noCrimeCertificate" name="noCrimeCertificate" :labelCol="labelCol3">
<j-image-upload v-if="!!formData.noCrimeCertificate" :fileMax="1" :bizPath="`employeesZzxx`"
:value="opeMediaAddress + formData.noCrimeCertificate" disabled></j-image-upload>
<span v-else>未上传</span>
</a-form-item>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="EmployeesApplyForm">
<a-row class="card-class">
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
<div v-if="formData.applyType == 0">
<SectionDivider :title="'邀请结果'" />
</div>
<div v-if="formData.applyType == 1">
<SectionDivider :title="'申请审核'" />
</div>
</a-col>
<a-col :span="12">
<a-form-item :label="formData.applyType == 0 ? '邀请意见' : '审核意见'" v-bind="validateInfos.status"
id="EmployeesApplyForm-status" name="status">
<div v-if="disabled">
<!-- 被邀请 -->
<div v-if="formData.applyType == 0">
<span v-if="formData.status == 1"><a-input :value="'待确认'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 2"><a-input :value="'已接受'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 3"><a-input :value="'已拒绝'" disabled allow-clear></a-input></span>
</div>
<!-- 主动申请 -->
<div v-if="formData.applyType == 1">
<span v-if="formData.status == 1"><a-input :value="'待审核'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 2"><a-input :value="'申请通过'" disabled allow-clear></a-input></span>
<span v-if="formData.status == 3"><a-input :value="'申请驳回'" disabled allow-clear></a-input></span>
</div>
</div>
<a-select v-else v-model:value="statusVal" placeholder="请选择审核意见" style="width: 200px" :disabled="false">
<a-select-option value="auditPass">申请通过</a-select-option>
<a-select-option value="auditFaild">申请驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" v-show="formData.auditContent || statusVal == 'auditFaild'">
<!-- 被邀请 -->
<div v-if="formData.applyType == 0">
<!-- <a-form-item label="拒绝原因" v-bind="validateInfos.auditContent" id="EmployeesApplyForm-auditContent"
name="auditContent">
<a-textarea v-if="!disabled" :autosize="{ minRows: 3 }" maxlength="50" show-count
v-model:value="formData.auditContent" allow-clear></a-textarea>
<span v-else>{{ formData.auditContent }} </span>
</a-form-item> -->
</div>
<!-- 主动申请 -->
<div v-if="formData.applyType == 1 && formData.status != 2">
<a-form-item label="驳回原因" v-bind="validateInfos.auditContent" id="EmployeesApplyForm-auditContent"
name="auditContent">
<a-textarea v-if="!disabled" :autosize="{ minRows: 3 }" maxlength="50" show-count
v-model:value="formData.auditContent" allow-clear placeholder="请输入驳回原因"></a-textarea>
<!-- <span v-else>{{ formData.auditContent }}</span> -->
<span v-else><a-textarea v-model:value="formData.auditContent" :autosize="{ minRows: 3 }"
placeholder="请输入紧急联系人电话" disabled allow-clear></a-textarea></span>
</a-form-item>
</div>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../EmployeesApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }
});
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const activeKey = ref('1')
const ageVal = ref()
const formData = reactive<Record<string, any>>({
id: '',
openId: '',
employeeId: '',
name: '',
sex: '',
national: '',
idCard: '',
tel: '',
dateOfBirth: '',
marriedOrNot: '',
height: undefined,
weight: undefined,
address: '',
isSmoking: '',
healthStatus: '',
houseAddress: '',
politicalAppearance: '',
emergencyContact: '',
emergencyTel: '',
emergencyRelationship: '',
hukouNature: '',
idCardPositive: '',
idCardNegative: '',
healthCertificatePositive: '',
healthCertificateNegative: '',
bankPositive: '',
bankNegative: '',
qualification: '',
noCrimeCertificate: '',
regional: '',
createTime: '',
status: '',
auditContent: '',
applyType: '',
startTime: '',
endTime: '',
currentAddress: '',
});
const statusVal = ref('')
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 8 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 4 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const labelCol3 = ref<any>({ xs: { span: 24 }, sm: { span: 2 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
auditContent: [
{
validator: async (_rule, value) => {
if (statusVal.value === 'auditFaild' && !value) {
return Promise.reject('请输入驳回原因!');
}
return Promise.resolve();
},
},
],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
ageVal.value = handleComputedAge(record.dateOfBirth)
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
if (formData.status == '2') {
statusVal.value = 'auditPass'
}
if (formData.status == '3') {
statusVal.value = 'auditFaild'
}
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
model.statusVal = statusVal.value
if (!disabled.value) {
if (!statusVal.value) {
createMessage.warning('请选择审批意见');
return;
}
}
confirmLoading.value = true;
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
function handleComputedAge(ageText) {
//
if (!ageText || typeof ageText !== 'string') {
return NaN;
}
//
const birthDate = new Date(ageText);
// '2025-99-99'
if (isNaN(birthDate.getTime())) {
return NaN;
}
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
// 1
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
return age >= 0 ? age : 0; //
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {}
.card-class {
padding-top: 24px;
padding-bottom: 24px;
padding-left: 14px;
padding-right: 14px;
// background-color: rgba(255, 255, 255, 0.9);
background-color: #fcfdff;
border-radius: 10px;
// box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px;
margin-bottom: 14px;
}
</style>

View File

@ -0,0 +1,373 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer>
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="EmployeesApplyForm">
<a-row>
<a-col :span="24">
<SectionDivider :title="'基本信息'" />
</a-col>
<a-col :span="12">
<a-form-item label="姓名" v-bind="validateInfos.name" id="EmployeesApplyForm-name" name="name">
<a-input v-model:value="formData.name" placeholder="请输入姓名" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="联系电话" v-bind="validateInfos.tel" id="EmployeesApplyForm-tel" name="tel">
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="性别" v-bind="validateInfos.sex" id="EmployeesApplyForm-sex" name="sex">
<j-dict-select-tag type='radio' v-model:value="formData.sex" dictCode="sex" placeholder="请选择性别"
allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="民族" v-bind="validateInfos.national" id="EmployeesApplyForm-national" name="national">
<a-input v-model:value="formData.national" placeholder="请输入民族" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="出生日期" v-bind="validateInfos.dateOfBirth" id="EmployeesApplyForm-dateOfBirth"
name="dateOfBirth">
<a-date-picker placeholder="请选择出生日期" v-model:value="formData.dateOfBirth" value-format="YYYY-MM-DD"
style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="家庭住址" v-bind="validateInfos.address" id="EmployeesApplyForm-address" name="address">
<a-textarea v-model:value="formData.address" :rows="4" placeholder="请输入家庭住址" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="婚否" v-bind="validateInfos.marriedOrNot" id="EmployeesApplyForm-marriedOrNot"
name="marriedOrNot">
<j-dict-select-tag type='radio' v-model:value="formData.marriedOrNot" dictCode="married_or_not"
placeholder="请选择婚否" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身高" v-bind="validateInfos.height" id="EmployeesApplyForm-height" name="height">
<a-input-number v-model:value="formData.height" placeholder="请输入身高" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="体重" v-bind="validateInfos.weight" id="EmployeesApplyForm-weight" name="weight">
<a-input-number v-model:value="formData.weight" placeholder="请输入体重" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否吸烟" v-bind="validateInfos.isSmoking" id="EmployeesApplyForm-isSmoking"
name="isSmoking">
<j-dict-select-tag type='radio' v-model:value="formData.isSmoking" dictCode="is_smoking"
placeholder="请选择是否吸烟" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="健康状况" v-bind="validateInfos.healthStatus" id="EmployeesApplyForm-healthStatus"
name="healthStatus">
<j-dict-select-tag type='radio' v-model:value="formData.healthStatus" dictCode="health_status"
placeholder="请选择健康状况" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="政治面貌" v-bind="validateInfos.politicalAppearance"
id="EmployeesApplyForm-politicalAppearance" name="politicalAppearance">
<j-dict-select-tag v-model:value="formData.politicalAppearance" dictCode="political_appearance"
placeholder="请选择政治面貌" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="户籍所在地" v-bind="validateInfos.houseAddress" id="EmployeesApplyForm-houseAddress"
name="houseAddress">
<a-input v-model:value="formData.houseAddress" placeholder="请输入户籍所在地" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急联系人" v-bind="validateInfos.emergencyContact"
id="EmployeesApplyForm-emergencyContact" name="emergencyContact">
<a-input v-model:value="formData.emergencyContact" placeholder="请输入紧急联系人" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急联系人电话" v-bind="validateInfos.emergencyTel" id="EmployeesApplyForm-emergencyTel"
name="emergencyTel">
<a-input v-model:value="formData.emergencyTel" placeholder="请输入紧急联系人电话" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急联系人与本人关系" v-bind="validateInfos.emergencyRelationship"
id="EmployeesApplyForm-emergencyRelationship" name="emergencyRelationship">
<a-input v-model:value="formData.emergencyRelationship" placeholder="请输入紧急联系人与本人关系"
allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="户口性质" v-bind="validateInfos.hukouNature" id="EmployeesApplyForm-hukouNature"
name="hukouNature">
<j-dict-select-tag type='radio' v-model:value="formData.hukouNature" dictCode="hukou_nature"
placeholder="请选择户口性质" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<SectionDivider :title="'申请人身份证'" />
</a-col>
<a-col :span="12">
<a-form-item label="身份证正面" v-bind="validateInfos.idCardPositive" id="EmployeesApplyForm-idCardPositive"
name="idCardPositive">
<j-image-upload :fileMax="0" v-model:value="formData.idCardPositive"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身份证反面" v-bind="validateInfos.idCardNegative" id="EmployeesApplyForm-idCardNegative"
name="idCardNegative">
<j-image-upload :fileMax="0" v-model:value="formData.idCardNegative"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="身份证号" v-bind="validateInfos.idCard" id="EmployeesApplyForm-idCard" name="idCard">
<a-input v-model:value="formData.idCard" placeholder="请输入身份证号" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<SectionDivider :title="'银行卡'" />
</a-col>
<a-col :span="12">
<a-form-item label="银行卡正面" v-bind="validateInfos.bankPositive" id="EmployeesApplyForm-bankPositive"
name="bankPositive">
<j-image-upload :fileMax="0" v-model:value="formData.bankPositive"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="银行卡反面" v-bind="validateInfos.bankNegative" id="EmployeesApplyForm-bankNegative"
name="bankNegative">
<j-image-upload :fileMax="0" v-model:value="formData.bankNegative"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="24">
<SectionDivider :title="'健康证'" />
</a-col>
<a-col :span="12">
<a-form-item label="健康证正面" v-bind="validateInfos.healthCertificatePositive"
id="EmployeesApplyForm-healthCertificatePositive" name="healthCertificatePositive">
<j-image-upload :fileMax="0" v-model:value="formData.healthCertificatePositive"></j-image-upload>
</a-form-item>
</a-col>
<!-- <a-col :span="12">
<a-form-item label="健康证反面" v-bind="validateInfos.healthCertificateNegative"
id="EmployeesApplyForm-healthCertificateNegative" name="healthCertificateNegative">
<j-image-upload :fileMax="0" v-model:value="formData.healthCertificateNegative"></j-image-upload>
</a-form-item>
</a-col> -->
<a-col :span="24">
<SectionDivider :title="'资质证'" />
</a-col>
<a-col :span="12">
<a-form-item label="资质证" v-bind="validateInfos.qualification" id="EmployeesApplyForm-qualification"
name="qualification">
<j-image-upload :fileMax="0" v-model:value="formData.qualification"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="24">
<SectionDivider :title="'其它'" />
</a-col>
<a-col :span="12">
<a-form-item label="无犯罪证明" v-bind="validateInfos.noCrimeCertificate"
id="EmployeesApplyForm-noCrimeCertificate" name="noCrimeCertificate">
<j-image-upload :fileMax="0" v-model:value="formData.noCrimeCertificate"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="24">
<SectionDivider :title="'申请审核'" />
</a-col>
<a-col :span="12">
<a-form-item label="审核意见" v-bind="validateInfos.status" id="EmployeesApplyForm-status" name="status">
<j-dict-select-tag v-if="disabled" type="list" v-model:value="formData.status"
dictCode="employees_audit_status_form" placeholder="请选择审核意见" allow-clear />
<a-select v-else v-model:value="statusVal" placeholder="请选择审核意见" style="width: 200px">
<a-select-option value="auditPass">审核通过</a-select-option>
<a-select-option value="auditFaild">审核不通过</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" v-show="statusVal == 'auditFaild'">
<a-form-item label="审核备注" v-bind="validateInfos.auditContent" id="EmployeesApplyForm-auditContent"
name="auditContent">
<a-input v-model:value="formData.auditContent" placeholder="请输入审核备注" allow-clear></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../EmployeesApply.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
name: '',
sex: '',
national: '',
idCard: '',
tel: '',
dateOfBirth: '',
marriedOrNot: '',
height: undefined,
weight: undefined,
address: '',
isSmoking: '',
healthStatus: '',
houseAddress: '',
politicalAppearance: '',
emergencyContact: '',
emergencyTel: '',
emergencyRelationship: '',
hukouNature: '',
idCardPositive: '',
idCardNegative: '',
healthCertificatePositive: '',
healthCertificateNegative: '',
bankPositive: '',
bankNegative: '',
qualification: '',
noCrimeCertificate: '',
regional: '',
createTime: '',
status: '',
auditContent: '',
});
const statusVal = ref('')
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
if (formData.status == '2') {
statusVal.value = 'auditPass'
}
if (formData.status == '3') {
statusVal.value = 'auditFaild'
}
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
model.statusVal = statusVal.value
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,146 @@
<template>
<a-drawer :title="title" width="70vw" :visible="visible" :closable="true" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ padding: '14px' }" @close="handleCancel">
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
</template>
<EmployeesApplyForm v-if="visible" ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit"
:formBpm="false">
</EmployeesApplyForm>
</a-drawer>
<!-- 可邀请邀请列表 -->
<a-drawer :title="'邀请'" width="70vw" :visible="invidedVisible" :closable="true" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ padding: '14px' }" @close="handleInvidedCancel">
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleInvidedCancel">关闭</a-button>
</template>
<NuEmployeesAdvisoryInfoList v-if="invidedVisible" ref="invidedRef" @reload="submitCallback" />
</a-drawer>
<!-- 员工信息变更审核 -->
<a-drawer :title="'审核'" width="70vw" :visible="upInfoVisible" :closable="true" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ padding: '14px' }" @close="handleUpInfoCancel">
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleUpInfoCancel">关闭</a-button>
<a-button type="primary" @click="handleUpInfoOk">确认</a-button>
</template>
<EmployeesUpInfoForm v-if="upInfoVisible" ref="upInfoForm" @ok="handleUpInfoCancel" :formBpm="false">
</EmployeesUpInfoForm>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import EmployeesApplyForm from './EmployeesApplyForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import NuEmployeesAdvisoryInfoList from '/@/views/admin/employeesadvisoryinfo/NuEmployeesAdvisoryInfoList.vue'
import EmployeesUpInfoForm from '/@/views/admin/employeesapply/components/EmployeesUpInfoForm.vue'
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const upInfoForm = ref();
const invidedVisible = ref<boolean>(false);
const upInfoVisible = ref<boolean>(false);
const invidedRef = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '审核';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 编辑
* @param record
*/
function upInfoEdit(record) {
title.value = disableSubmit.value ? '详情' : '审核';
upInfoVisible.value = true;
nextTick(() => {
upInfoForm.value.show(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
function handleInvidedCancel() {
invidedVisible.value = false
}
function openInvidedList() {
invidedVisible.value = true
}
/**
* 员工信息变更-关闭
*/
function handleUpInfoCancel() {
console.log(123123)
upInfoVisible.value = false
emit('success');
}
/**
* 员工信息变更确认
*/
function handleUpInfoOk() {
upInfoForm.value.submitForm();
}
defineExpose({
add,
edit,
upInfoEdit,
disableSubmit,
openInvidedList,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,286 @@
<template>
<div class="container2">
<a-row>
<a-col :span="24" >
<a-table :dataSource="filteredTableData" :columns="columns" :pagination="false" bordered size="small"
:rowClassName="setRowClassName">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'd1'">
<span>{{ applyObj[record.d1] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && isImg(record.d1)">
<JImageUpload v-if="!!record.d2" :fileMax="1" :value="opeMediaAddress + record.d2" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template v-if="column.dataIndex === 'd3' && isImg(record.d1)">
<JImageUpload v-if="!!record.d3" :fileMax="1" :value="opeMediaAddress + record.d3" disabled>
</JImageUpload>
<span v-else>未上传</span>
</template>
<template
v-if="column.dataIndex === 'd2' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d2] }}</span>
</template>
<template
v-if="column.dataIndex === 'd3' && (record.d1 == 'orgProvince' || record.d1 == 'orgCity' || record.d1 == 'orgDistrict')">
<span>{{ provinceOptions[record.d3] }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'orgBuildingArea'">
<span>{{ record.d3 }}</span>
</template>
<template v-if="column.dataIndex === 'd2' && record.d1 == 'endTime'">
<span>{{ record.d2 == '9999-12-31' ? '长期' : record.d2 }}</span>
</template>
<template v-if="column.dataIndex === 'd3' && record.d1 == 'endTime'">
<span>{{ record.d3 == '9999-12-31' ? '长期' : record.d3 }}</span>
</template>
</template>
</a-table>
</a-col>
</a-row>
<a-form style="margin-top: 14px;height: 100px;" ref="formRef" layout="horizontal" :model="formData"
:label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="审核结果" name="status" v-bind="validateInfos.status">
<a-select v-model:value="formData.status" style="width: 200px" placeholder="请选择审核结果">
<a-select-option value="modifyPass">审核通过</a-select-option>
<a-select-option value="modifyFail">审核驳回</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12" v-if="formData.status == 'modifyFail'">
<a-form-item label="驳回原因" name="auditContent" v-bind="validateInfos.auditContent">
<a-textarea :maxlength="50" show-count v-model:value="formData.auditContent" placeholder="请输入驳回原因(如驳回)"
style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, computed, onMounted } from 'vue';
import { Table as ATable, Input, Row, Col, Form } from 'ant-design-vue';
import { applyObj } from '../EmployeesApply.data'
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { getModifyInfo, auditSubmit } from '../EmployeesApply.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { initDictOptions } from '/@/utils/dict';
const opeMediaAddress = import.meta.env.VITE_OPE_MEDIA_ADDRESS
const formRef = ref();
const AForm = Form;
const AFormItem = Form.Item;
const useForm = Form.useForm;
const { createMessage } = useMessage();
//
const labelCol = { span: 4 }; //
const wrapperCol = { span: 18 }; //
const isImg = (v_) => {
return v_ == 'idCardPositive' || v_ == 'idCardNegative' || v_ == 'healthCertificatePositive' || v_ == 'bankPositive' || v_ == 'bankNegative' || v_ == 'qualification' || v_ == 'noCrimeCertificate'
}
const provinceOptions = ref({})
const formData = reactive<Record<string, any>>({
status: undefined,
auditContent: '',
id: '',
pkId: ''
});
const validatorRules = reactive({
status: [{ required: true, message: '请选择审核结果!' },],
auditContent: [
{
validator: async (_rule, value) => {
if (formData.status === 'modifyFail' && !value) {
return Promise.reject('请输入驳回原因!');
}
return Promise.resolve();
},
},
],
})
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const tableData = ref([]);
const emit = defineEmits(['ok']);
//
const filteredTableData = computed(() => {
return tableData.value.filter(item =>
item.d1 !== 'id'
&& item.d1 !== 'openId'
&& item.d1 !== 'address'
&& item.d1 !== 'isSmoking'
&& item.d1 !== 'healthCertificateNegative'
&& item.d1 !== 'regional'
&& item.d1 !== 'createTime'
&& item.d1 !== 'updateBy'
&& item.d1 !== 'updateTime'
&& item.d1 !== 'modifyStatus'
&& item.d1 !== 'openingBank'
&& item.d1 !== 'bankCard'
&& item.d1 !== 'startTime'
&& item.d1 !== 'endTime'
);
});
const columns = [
{
title: '名称',
dataIndex: 'd1',
key: 'd1',
width: 150,
},
{
title: '变更前',
dataIndex: 'd2',
key: 'd2',
},
{
title: '变更后',
dataIndex: 'd3',
key: 'd3',
}
];
//
const setRowClassName = (record) => {
return record.d2 !== record.d3 && record.d1 !== 'createTime' ? 'highlight-row' : '';
};
const fieldMap = {
id: 'id',
openId: 'openId',
employeeId: 'employeeId',
name: 'name',
sex: 'sex',
national: 'national',
idCard: 'idCard',
tel: 'tel',
dateOfBirth: 'dateOfBirth',
marriedOrNot: 'marriedOrNot',
height: 'height',
weight: 'weight',
address: 'address',
isSmoking: 'isSmoking',
healthStatus: 'healthStatus',
houseAddress: 'houseAddress',
politicalAppearance: 'politicalAppearance',
emergencyContact: 'emergencyContact',
emergencyTel: 'emergencyTel',
emergencyRelationship: 'emergencyRelationship',
hukouNature: 'hukouNature',
idCardPositive: 'idCardPositive',
idCardNegative: 'idCardNegative',
healthCertificatePositive: 'healthCertificatePositive',
healthCertificateNegative: 'healthCertificateNegative',
bankPositive: 'bankPositive',
bankNegative: 'bankNegative',
openingBank: 'openingBank',
bankCard: 'bankCard',
qualification: 'qualification',
noCrimeCertificate: 'noCrimeCertificate',
regional: 'regional',
startTime: 'startTime',
endTime: 'endTime',
currentAddress: 'currentAddress',
};
async function show(record) {
console.log("🌊 ~ show ~ record:", record)
let data = await getModifyInfo({ employeeId: record.employeeId })
console.log("🌊 ~ show ~ data:", data)
formData.employeeId = record.employeeId
// idpkIdformData
Object.keys(fieldMap).forEach(fieldName => {
const record = data.find(item => item.d1 === fieldName);
if (record) {
formData[fieldName] = record.d3;
}
});
tableData.value = data.map(item => ({
...item,
// null/undefined
d2: item.d2 ?? '',
d3: item.d3 ?? ''
}));
}
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
console.log("🌊 ~ submitForm ~ formData:", formData)
if (formData.startTime) {
formData.startTime = formData.startTime.replace(/-/g, '.');
}
if (formData.endTime) {
formData.endTime = formData.endTime.replace(/-/g, '.');
}
auditSubmit(formData)
.then((res) => {
emit('ok');
})
}
// numberValues
onMounted(async () => {
const dictData = await initDictOptions('sys_category,name,id,first_letter is not null order by code asc', '');
dictData.reduce((prev, next) => {
if (next) {
provinceOptions.value[next['value']] = next['text'] || next['label']
}
return prev;
}, []);
});
defineExpose({
show,
submitForm
});
</script>
<style lang="less" scoped>
.container2 {
// padding: 16px;
}
.antd-modal-form {
// padding: 14px;
}
:deep(.ant-table-cell) {
padding: 8px 12px !important;
}
//
:deep(.highlight-row) {
background-color: #fff1f0 !important; //
}
//
:deep(.ant-form-item) {
// margin-bottom: 16px;
}
:deep(.ant-table-cell-row-hover) {
// border: 1px solid red;
}
</style>