2024年9月3日 新增自动读取身份证
This commit is contained in:
parent
1b971aa023
commit
f11092e4e0
|
@ -5,7 +5,7 @@ VITE_USE_MOCK = true
|
|||
VITE_PUBLIC_PATH = /
|
||||
|
||||
# 跨域代理,您可以配置多个 ,请注意,没有换行符
|
||||
VITE_PROXY = [["/jeecgboot","http://localhost:8090/jeecg-boot"],["/ZKIDROnline","http://localhost:24010/ZKIDROnline"],["/upload","http://localhost:3300/upload"]]
|
||||
VITE_PROXY = [["/jeecgboot","http://localhost:8101/jeecg-boot"],["/ZKIDROnline","http://localhost:24010/ZKIDROnline"],["/upload","http://localhost:3300/upload"]]
|
||||
|
||||
# 控制台不输出
|
||||
VITE_DROP_CONSOLE = false
|
||||
|
@ -14,7 +14,7 @@ VITE_DROP_CONSOLE = false
|
|||
VITE_GLOB_API_URL=/jeecgboot
|
||||
|
||||
#后台接口全路径地址(必填)
|
||||
VITE_GLOB_DOMAIN_URL=http://localhost:8090/jeecg-boot
|
||||
VITE_GLOB_DOMAIN_URL=http://localhost:8101/jeecg-boot
|
||||
|
||||
# 接口前缀
|
||||
VITE_GLOB_API_URL_PREFIX=
|
||||
|
|
|
@ -32,3 +32,5 @@ pnpm-debug.log*
|
|||
/.vscode/
|
||||
/.history/
|
||||
/svn clear.bat
|
||||
|
||||
nodePath.txt
|
|
@ -0,0 +1,25 @@
|
|||
@echo off & chcp 65001
|
||||
echo 原node版本
|
||||
node -v
|
||||
echo 如果运行错误请设置node版本
|
||||
if not exist nodePath.txt (
|
||||
echo 请在项目根目录创建【nodePath.txt】文件并填写jdk路径,文件内容大致为【D:\ProgramGreeFile\nodejs\node-21.2.0】
|
||||
pause
|
||||
exit
|
||||
)
|
||||
set /P nodePath=<nodePath.txt
|
||||
if not defined nodePath (
|
||||
echo 请在项目根目录创建【nodePath.txt】文件并填写jdk路径,文件内容大致为【D:\ProgramGreeFile\nodejs\node-21.2.0】
|
||||
pause
|
||||
exit
|
||||
)
|
||||
::还原
|
||||
::if pathBak == '' ( ) else ( set path=%pathBak% )
|
||||
if "%pathBak%"=="" (echo '跳过重置环境变量') else set path=%pathBak%
|
||||
|
||||
set pathBak=%path%
|
||||
set path2=%nodePath%;%path%
|
||||
set path=%path2%
|
||||
echo 现node版本
|
||||
node -v
|
||||
echo 开始执行
|
4
init.bat
4
init.bat
|
@ -1 +1,3 @@
|
|||
yarn bootstrap
|
||||
:: @echo off & chcp 65001
|
||||
call ./changePath.bat
|
||||
npm run pinstall
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"bootstrap": "pnpm install",
|
||||
"pinstall": "pnpm install",
|
||||
"serve": "npm run dev",
|
||||
"dev": "vite",
|
||||
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
|
||||
|
|
17189
pnpm-lock.yaml
17189
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
4
run.bat
4
run.bat
|
@ -1 +1,3 @@
|
|||
yarn dev --mode development
|
||||
::@echo off & chcp 65001
|
||||
call ./changePath.bat
|
||||
npm run dev
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
<j-input placeholder="请输入身份证号" v-model:value="queryParam.sfzh"></j-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :lg="8">
|
||||
<a-form-item label="年级" name="nj">
|
||||
<j-input placeholder="请输入年级" v-model:value="queryParam.nj"></j-input>
|
||||
</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">
|
||||
|
@ -40,6 +45,7 @@
|
|||
<!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> -->
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
|
||||
<a-button type="primary" @click="handleAllAdd" preIcon="ant-design:plus-outlined">批量新增</a-button>
|
||||
<a-button type="primary" @click="handleAllBatchAdd" preIcon="ant-design:plus-outlined">自动批量新增</a-button>
|
||||
<a-button type="primary" @click="handleGATAdd" preIcon="ant-design:plus-outlined">港澳台新增</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="downloadDrive">下载驱动</a-button>
|
||||
|
@ -89,6 +95,7 @@
|
|||
<TSfzPicinfoModal ref="registerModal" @success="handleSuccess"></TSfzPicinfoModal>
|
||||
<TSfzPicinfoAllModal ref="registerAllModal" @success="handleSuccess"></TSfzPicinfoAllModal>
|
||||
<TSfzPicinfoGATModal ref="registerGATModal" @success="handleSuccess"></TSfzPicinfoGATModal>
|
||||
<TSfzPicinfoAllBatchModal ref="registerAllBatchModal" @success="handleSuccess"></TSfzPicinfoAllBatchModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -104,6 +111,7 @@
|
|||
import TSfzPicinfoModal from './components/TSfzPicinfoModal.vue'
|
||||
import TSfzPicinfoAllModal from './components/TSfzPicinfoAllModal.vue'
|
||||
import TSfzPicinfoGATModal from './components/TSfzPicinfoGATModal.vue'
|
||||
import TSfzPicinfoAllBatchModal from './components/TSfzPicinfoAllBatchModal.vue'
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
|
@ -118,6 +126,7 @@
|
|||
const registerModal = ref();
|
||||
const registerAllModal = ref();
|
||||
const registerGATModal = ref();
|
||||
const registerAllBatchModal = ref();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
|
@ -174,7 +183,6 @@
|
|||
registerModal.value.add();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
|
@ -191,6 +199,14 @@
|
|||
registerGATModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAllBatchAdd() {
|
||||
registerAllBatchModal.value.disableSubmit = false;
|
||||
registerAllBatchModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,428 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row style="padding-bottom: 1rem;" v-show="!disabled">
|
||||
<a-col :span="24">
|
||||
<a-row style="padding-bottom: 1rem;">
|
||||
<a-col v-bind="labelCol"></a-col>
|
||||
<a-col v-bind="wrapperCol">
|
||||
<a-button :loading="sfzBtnLoading" type="primary" @click="getIdCard">手动读取身份证(仅一次读取)</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row style="padding-bottom: 1rem;">
|
||||
<a-col v-bind="labelCol"></a-col>
|
||||
<a-col v-bind="wrapperCol">
|
||||
<a-button :disabled="autoReadCardFlag" type="primary" @click="startAutoReadCard">开始自动读取(循环)</a-button>
|
||||
<a-button :disabled="!autoReadCardFlag" type="primary" style="margin-left: 1rem;" @click="stopAutoReadCard">关闭自动读取(循环)</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row style="padding-bottom: 1rem;">
|
||||
<a-col v-bind="labelCol"></a-col>
|
||||
<a-col v-bind="wrapperCol">
|
||||
<a-switch v-model:checked="autoReadCardIsSave" checkedChildren="读取后保存" unCheckedChildren="仅展示,不保存"/>
|
||||
<a-switch style="margin-left: 1rem;" v-model:checked="autoReadCardForceSave" checkedChildren="强制保存" unCheckedChildren="自动决定保存"/>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row style="padding-bottom: 1rem;">
|
||||
<a-col v-bind="labelCol"></a-col>
|
||||
<a-col v-bind="wrapperCol">
|
||||
读取成功数{{ autoReadCardSuccessNum }},读取失败数{{ autoReadCardFailNum }}
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="姓名" v-bind="validateInfos.xm">
|
||||
<a-input v-model:value="formData.xm" placeholder="请输入姓名" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="性别" v-bind="validateInfos.xb">
|
||||
<a-input v-model:value="formData.xb" placeholder="请输入性别" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="民族" v-bind="validateInfos.mz">
|
||||
<a-input v-model:value="formData.mz" placeholder="请输入民族" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="出生日期" v-bind="validateInfos.csrq">
|
||||
<a-input v-model:value="formData.csrq" placeholder="请输入出生日期" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="住址" v-bind="validateInfos.zz">
|
||||
<a-input v-model:value="formData.zz" placeholder="请输入住址" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="身份证号" v-bind="validateInfos.sfzh">
|
||||
<a-input v-model:value="formData.sfzh" placeholder="请输入身份证号" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="签发机关" v-bind="validateInfos.qfjg">
|
||||
<a-input v-model:value="formData.qfjg" placeholder="请输入签发机关" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="开始有效期" v-bind="validateInfos.startYxq">
|
||||
<a-input v-model:value="formData.startYxq" placeholder="开始有效期" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="结束有效期" v-bind="validateInfos.endYxq">
|
||||
<a-input v-model:value="formData.endYxq" placeholder="结束有效期" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="身份证照片" v-bind="validateInfos.sfzurl">
|
||||
<!-- <j-image-upload v-model:value="formData.sfzurl" disabled></j-image-upload> -->
|
||||
<tempalte v-if="formData.base64Photo">
|
||||
<img width="102" height="126" :src="'data:image/png;base64,'+formData.base64Photo"/>
|
||||
</tempalte>
|
||||
<tempalte v-else-if="formData.sfzurl">
|
||||
<img :src="getFileAccessHttpUrl(formData.sfzurl)"/>
|
||||
</tempalte>
|
||||
<tempalte v-else>
|
||||
<div style="width:102px;height: 123px;"> </div>
|
||||
</tempalte>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<!-- <a-col :span="12">
|
||||
<a-form-item label="是否有效:0-有效 1-无效 无效:照片不存在 有效:照片存在并且以身份证命名或者通过学号已经清洗成以身份证命名" v-bind="validateInfos.sfzflag">
|
||||
<a-input v-model:value="formData.sfzflag" placeholder="请输入是否有效:0-有效 1-无效 无效:照片不存在 有效:照片存在并且以身份证命名或者通过学号已经清洗成以身份证命名" disabled></a-input>
|
||||
</a-form-item>
|
||||
</a-col> -->
|
||||
</a-row>
|
||||
</a-form>
|
||||
<a-modal v-model:visible="errorFormVisible" width="800" title="提示">
|
||||
<template #footer>
|
||||
<a-button key="back" @click="handleCancel">关闭</a-button>
|
||||
</template>
|
||||
<a-card>
|
||||
<p>读取身份证失败,请尝试以下方法</p>
|
||||
<p>1.请下载并安装<a href="/downloads/ZKIDROnline.exe">驱动</a>!</p>
|
||||
<p>2.请重新连接读卡器</p>
|
||||
<div>
|
||||
3.请更改浏览器设置
|
||||
<p> chrome浏览器/edge浏览器, 在地址栏输入【chrome://flags】</p>
|
||||
<p> 搜索【Block insecure private network requests】 将值改成【disabled】</p>
|
||||
|
||||
<p> 火狐浏览器, 【about:config】</p>
|
||||
<p> 搜索【security.fileuri.strict_origin_policy】 将值改为【false】</p>
|
||||
</div>
|
||||
<div>
|
||||
4.如还无法读取并弹出无法识别的提示,请【重启电脑】或打开【服务】,找到【Security ZKIDROnline Service】服务打开或是重启
|
||||
</div>
|
||||
</a-card>
|
||||
</a-modal>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed } from 'vue';
|
||||
//import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
//import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../TSfzPicinfo.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import { getIdCardAllInfo, idCardConvert } from '/@/utils/idCardUtil';
|
||||
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
import { getCurrentSchoolYear } from '/@/views/student/common/commonConfig';
|
||||
|
||||
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: '',
|
||||
xm: '',
|
||||
xb: '',
|
||||
mz: '',
|
||||
csrq: '',
|
||||
zz: '',
|
||||
sfzh: '',
|
||||
sfzurl: '',
|
||||
qfjg: '',
|
||||
startYxq: '',
|
||||
endYxq: '',
|
||||
sfzflag: '',
|
||||
base64Photo: '',
|
||||
});
|
||||
|
||||
const formDataCache = ref<any>(formData);
|
||||
|
||||
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 sfzBtnLoading = ref<boolean>(false);
|
||||
|
||||
//是否自动保存
|
||||
const autoReadCardIsSave = ref<boolean>(false);
|
||||
//是否强制保存(忽略一切因素,直接保存)
|
||||
const autoReadCardForceSave = ref<boolean>(false);
|
||||
//自动读取卡片
|
||||
const autoReadCardFlag = ref<boolean>(false);
|
||||
//自动读取成功次数
|
||||
const autoReadCardSuccessNum = ref<Number>(0);
|
||||
//自动读取未找到卡片次数
|
||||
const autoReadCardFailNum = ref<Number>(0);
|
||||
|
||||
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
const errorFormVisible = ref(false);
|
||||
|
||||
function handleCancel(){
|
||||
errorFormVisible.value = false;
|
||||
}
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
|
||||
const currentSchoolYear = ref<string>('');
|
||||
//获取当前学期学年
|
||||
getCurrentSchoolYear().then(res => {
|
||||
let paramDate = res;
|
||||
currentSchoolYear.value = paramDate?.paramValue;;
|
||||
})
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
// formData.base64Photo = null;
|
||||
//赋值
|
||||
Object.assign(formData, record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
if(!formData.base64Photo){
|
||||
createMessage.warning('请读取身份证!');
|
||||
return;
|
||||
}
|
||||
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(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitFormNoClose() {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
if(!formData.base64Photo){
|
||||
createMessage.warning('请读取身份证!');
|
||||
return;
|
||||
}
|
||||
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(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdate(model, isUpdate.value).then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
//清空数据
|
||||
resetFields();
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getIdCard() {
|
||||
sfzBtnLoading.value = true;
|
||||
getIdCardAllInfo().then(res => {
|
||||
let data = idCardConvert(res);
|
||||
console.log(`🚀 -------------------------------------------------------------------🚀`);
|
||||
console.log(`🚀 ~ file: TSfzPicinfoForm.vue:187 ~ getIdCardAllInfo ~ data:`, data);
|
||||
console.log(`🚀 -------------------------------------------------------------------🚀`);
|
||||
if(data.ret == 0){
|
||||
formDataCache.value = Object.assign({}, formData);
|
||||
//成功加载身份证信息
|
||||
formData.xm = data.Name;//名称
|
||||
formData.xb = data.Sex;//性别
|
||||
formData.mz = data.Nation;//民族
|
||||
|
||||
formData.csrq = data.Birthday;//出生日期
|
||||
formData.zz = data.Address;//住址
|
||||
formData.sfzh = data.IDNumber;//身份证号
|
||||
//formData.sfzurl = data.Base64Photo;//身份证照片
|
||||
formData.base64Photo = data.Base64Photo;//身份证照片(base64)
|
||||
formData.qfjg = data.IDIssued;//签发机关
|
||||
formData.startYxq = data.IssuedData;//有效期限(开始日期)
|
||||
formData.endYxq = data.ValidDate;//有效期限(结束日期)
|
||||
//formData.sfzflag = data.Nation;//是否有效:0-有效 1-无效 无效:照片不存在 有效:照片存在并且以身份证命名或者通过学号已经清洗成以身份证命名
|
||||
formData.nj = currentSchoolYear.value;
|
||||
}else{
|
||||
createMessage[data.type](data.message)
|
||||
resetFields();
|
||||
// formData.base64Photo = null;
|
||||
}
|
||||
sfzBtnLoading.value = false;
|
||||
}).catch(e => {
|
||||
console.error('错误!',e)
|
||||
errorFormVisible.value = true;
|
||||
sfzBtnLoading.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
async function autoReadCard() {
|
||||
getIdCardAllInfo().then(async res => {
|
||||
let data = idCardConvert(res);
|
||||
if(data.ret == 0){
|
||||
formDataCache.value = Object.assign({}, formData);
|
||||
//成功加载身份证信息
|
||||
formData.xm = data.Name;//名称
|
||||
formData.xb = data.Sex;//性别
|
||||
formData.mz = data.Nation;//民族
|
||||
|
||||
formData.csrq = data.Birthday;//出生日期
|
||||
formData.zz = data.Address;//住址
|
||||
formData.sfzh = data.IDNumber;//身份证号
|
||||
//formData.sfzurl = data.Base64Photo;//身份证照片
|
||||
formData.base64Photo = data.Base64Photo;//身份证照片(base64)
|
||||
formData.qfjg = data.IDIssued;//签发机关
|
||||
formData.startYxq = data.IssuedData;//有效期限(开始日期)
|
||||
formData.endYxq = data.ValidDate;//有效期限(结束日期)
|
||||
//formData.sfzflag = data.Nation;//是否有效:0-有效 1-无效 无效:照片不存在 有效:照片存在并且以身份证命名或者通过学号已经清洗成以身份证命名
|
||||
formData.nj = currentSchoolYear.value;
|
||||
//自动保存(过滤身份证号一致的)
|
||||
if((autoReadCardIsSave.value && formDataCache.value.sfzh != formData.sfzh) || autoReadCardForceSave.value){
|
||||
autoReadCardSuccessNum.value++;
|
||||
await submitFormNoClose();
|
||||
}
|
||||
//如果身份证缓存相等,就延迟3秒在读,避免重复读取
|
||||
// if(formDataCache.value.sfzh == formData.sfzh){
|
||||
// await new Promise(resolve => setTimeout(resolve, 3000));
|
||||
// }
|
||||
formDataCache.value = Object.assign({}, formData);
|
||||
//继续读
|
||||
if(autoReadCardFlag.value) {
|
||||
await autoReadCard();
|
||||
}
|
||||
} else {
|
||||
createMessage[data.type](data.message)
|
||||
resetFields();
|
||||
//未找到卡片
|
||||
autoReadCardFailNum.value++;
|
||||
//继续读
|
||||
if(autoReadCardFlag.value) {
|
||||
await autoReadCard();
|
||||
}
|
||||
}
|
||||
}).catch(e => {
|
||||
console.error('错误!',e);
|
||||
errorFormVisible.value = true;
|
||||
sfzBtnLoading.value = false;
|
||||
stopAutoReadCard();
|
||||
});
|
||||
}
|
||||
|
||||
//开始自动读取
|
||||
function startAutoReadCard() {
|
||||
autoReadCardFlag.value = true;
|
||||
autoReadCard()
|
||||
}
|
||||
|
||||
//关闭自动读取
|
||||
function stopAutoReadCard() {
|
||||
autoReadCardFlag.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
min-height: 500px !important;
|
||||
overflow-y: auto;
|
||||
padding: 24px 24px 24px 24px;
|
||||
}
|
||||
.ant-form-item{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<TSfzPicinfoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></TSfzPicinfoForm>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import TSfzPicinfoForm from './TSfzPicinfoAllBatchForm.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = 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);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue