This commit is contained in:
parent
b8ca5dfed5
commit
b285da3091
|
|
@ -1,4 +1,4 @@
|
|||
# VITE_API_BASE_URL = http://112.29.103.165:1616
|
||||
# VITE_API_BASE_URL = /api
|
||||
VITE_API_BASE_URL = http://192.168.0.14:1999/hd-realname/prod-api
|
||||
# VITE_API_BASE_URL = http://192.168.0.234:38080
|
||||
# VITE_API_BASE_URL = http://192.168.0.14:1999/hd-realname/prod-api
|
||||
VITE_API_BASE_URL = http://192.168.0.234:38080
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
@delete="deletePic($event, index)"
|
||||
:disabled="isEditContractStatus"
|
||||
:deletable="!isEditContractStatus"
|
||||
@afterRead="afterRead($event, index)"
|
||||
@afterRead="afterRead($event, index, item.type)"
|
||||
:capture="['album', 'camera']"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
|
@ -158,6 +158,8 @@ const contractInfoForm = ref({
|
|||
wageCriterion: '', // 工资核定标准
|
||||
}) // 合同表单数据
|
||||
|
||||
const contractImageIdList = ref([]) // 上传文件列表 存储ID
|
||||
|
||||
const contractImageList = ref([
|
||||
{
|
||||
type: 1,
|
||||
|
|
@ -269,16 +271,45 @@ const onCancelContractStartDate = (e) => {
|
|||
// 删除图片
|
||||
const deletePic = (e, index) => {
|
||||
contractImageList.value[index].fileList = []
|
||||
contractImageIdList.value.splice(index, 1)
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
const afterRead = (e, index) => {
|
||||
const afterRead = (e, index, fileType) => {
|
||||
const type = e.file[0].type
|
||||
if (!type.includes('image')) {
|
||||
uni.$u.toast('请上传图片格式')
|
||||
return
|
||||
}
|
||||
contractImageList.value[index].fileList = [e.file[0]]
|
||||
const files = [
|
||||
{
|
||||
name: 'file',
|
||||
file: e.file[0].url,
|
||||
uri: e.file[0].url,
|
||||
},
|
||||
]
|
||||
uni.uploadFile({
|
||||
url: '/bmw/app/uploadFile',
|
||||
files: files,
|
||||
name: 'file',
|
||||
isUploadFile: true,
|
||||
formData: {
|
||||
type: fileType,
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.code === 200) {
|
||||
contractImageList.value[index].fileList.push({ isNew: true, ...e.file[0] })
|
||||
// 走上传逻辑 上传成功后把ID插入到fileList中
|
||||
contractImageIdList.value[index] = { id: data.data, fileType: fileType }
|
||||
} else {
|
||||
uni.$u.toast('上传失败:' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast('上传失败,请重新上传')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const checkFormStatus = () => {
|
||||
|
|
@ -338,10 +369,21 @@ const validateContractForm = async () => {
|
|||
uni.$u.toast('请完善合同见证中的所有信息')
|
||||
return reject(new Error('合同信息未完善'))
|
||||
} else {
|
||||
let data = {}
|
||||
if (contractImageIdList.value.length > 0) {
|
||||
data = {
|
||||
photoIds: contractImageIdList.value
|
||||
.map((item) => item.id)
|
||||
.join(','),
|
||||
...contractInfoForm.value,
|
||||
}
|
||||
} else {
|
||||
data = { ...contractInfoForm.value }
|
||||
}
|
||||
resolve({
|
||||
data,
|
||||
status,
|
||||
isValid: true,
|
||||
data: contractInfoForm.value,
|
||||
imgList: contractImageList.value,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ import {
|
|||
} from '@/services/common'
|
||||
|
||||
const keyInfoFormRef = ref(null) // 关键信息校验表单ref
|
||||
const photoIds = ref('') // 上传文件列表 存储ID
|
||||
const keyInfoForm = ref({
|
||||
proId: '', // 入场工程
|
||||
postId: '', // 工种
|
||||
|
|
@ -330,22 +331,47 @@ const afterRead = (e) => {
|
|||
|
||||
const files = [
|
||||
{
|
||||
file: e.file[0].file,
|
||||
file: e.file[0].url,
|
||||
name: 'file',
|
||||
uri: e.file[0].url,
|
||||
},
|
||||
]
|
||||
uni.uploadFile({
|
||||
url: '/bmw/worker/faceDetection',
|
||||
files: files,
|
||||
name: 'file',
|
||||
isUploadFile: true,
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
// console.log(data, 'res--9996')
|
||||
if (data.code === 200) {
|
||||
keyInfoForm.value.faceImg = [e.file[0]]
|
||||
uni.uploadFile({
|
||||
url: '/bmw/app/uploadFile',
|
||||
files: files,
|
||||
name: 'file',
|
||||
isUploadFile: true,
|
||||
formData: {
|
||||
type: 1,
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.code === 200) {
|
||||
keyInfoForm.value.faceImg.push({
|
||||
...e.file[0],
|
||||
})
|
||||
// 走上传逻辑 上传成功后把ID插入到fileList中
|
||||
// keyInfoForm.value.photoIds = data.data
|
||||
photoIds.value = data.data
|
||||
} else {
|
||||
uni.$u.toast('上传失败:' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast('上传失败,请重新上传')
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败:' + data.msg)
|
||||
keyInfoForm.value.faceImg = [e.file[0]]
|
||||
keyInfoForm.value.faceImg = []
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
|
@ -362,10 +388,18 @@ const validateKeyInfoForm = async () => {
|
|||
.validate()
|
||||
.then((valid) => {
|
||||
if (valid) {
|
||||
const params = {
|
||||
isValid: true,
|
||||
data: keyInfoForm.value,
|
||||
let data = {}
|
||||
if (photoIds.value) {
|
||||
data = { photoIds: photoIds.value, ...keyInfoForm.value }
|
||||
} else {
|
||||
data = { ...keyInfoForm.value }
|
||||
}
|
||||
|
||||
let params = {
|
||||
isValid: true,
|
||||
data,
|
||||
}
|
||||
|
||||
resolve(params)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@
|
|||
<up-datetime-picker
|
||||
mode="date"
|
||||
ref="pikerBirthdayRef"
|
||||
:minDate="0"
|
||||
:show="showPikerBirthday"
|
||||
@cancel="onCancelBirthday"
|
||||
@confirm="onConfirmBirthday"
|
||||
|
|
@ -155,6 +156,7 @@
|
|||
import { ref, watch } from 'vue'
|
||||
import { pathToBase64 } from 'image-tools'
|
||||
import { useMemberStore } from '@/stores'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const memberStore = useMemberStore()
|
||||
const idCardFormRef = ref(null) // 身份证表单ref
|
||||
|
|
@ -344,9 +346,9 @@ const onHandleRecognizeIdCard = (type) => {
|
|||
// 1人像面 2国徽面
|
||||
// console.log('识别身份证(人像面)')
|
||||
|
||||
uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
// uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
|
||||
return
|
||||
// return
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
|
|
@ -354,29 +356,75 @@ const onHandleRecognizeIdCard = (type) => {
|
|||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: async (res) => {
|
||||
const base64 = await imgToBase64Fun(res.tempFilePaths[0])
|
||||
const param = {
|
||||
imageBase64: base64.split(',')[1],
|
||||
let params = {
|
||||
recognitionFrontData: '',
|
||||
recognitionBackData: '',
|
||||
type: 1,
|
||||
}
|
||||
if (type === 1) {
|
||||
params.recognitionFrontData = base64.split(',')[1]
|
||||
} else {
|
||||
params.recognitionBackData = base64.split(',')[1]
|
||||
}
|
||||
|
||||
// 上传后台接口
|
||||
uni.request({
|
||||
url: '/bmw/appRecognition/bankCardRecognition',
|
||||
url: 'http://192.168.0.14:18975/recognition',
|
||||
method: 'POST',
|
||||
data: param,
|
||||
data: params,
|
||||
isUploadFile: true,
|
||||
header: {
|
||||
// 'Content-Type': 'application/Json',
|
||||
Authorization: memberStore?.token, // token
|
||||
},
|
||||
success: (res) => {
|
||||
const { data: result } = res
|
||||
if (result.code === 200) {
|
||||
const data = JSON.parse(res.data)
|
||||
console.log(data, '识别身份证结果')
|
||||
|
||||
if (data.code === 20001) {
|
||||
uni.$u.toast('识别身份证成功')
|
||||
|
||||
if (type === 1) {
|
||||
const { name, gender, ethnicity, dateOfBirth, address, idNumber } =
|
||||
data.data
|
||||
|
||||
const match = dateOfBirth.match(/(\d+)年(\d+)月(\d+)日/)
|
||||
let birthday = ''
|
||||
|
||||
if (match) {
|
||||
const year = match[1]
|
||||
// 月和日补零处理
|
||||
const month = String(match[2]).padStart(2, '0')
|
||||
const day = String(match[3]).padStart(2, '0')
|
||||
birthday = `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
idCardModel.value.name = name
|
||||
idCardModel.value.sex = gender
|
||||
idCardModel.value.nation = ethnicity
|
||||
idCardModel.value.birthday = birthday
|
||||
idCardModel.value.address = address
|
||||
idCardModel.value.idNumber = idNumber
|
||||
} else {
|
||||
const { issuingAuthority, validTime } = data.data
|
||||
const validTimeArr = validTime.split('-')
|
||||
idCardModel.value.issuingAuthority = issuingAuthority
|
||||
idCardModel.value.startTime = validTimeArr[0].replace(/\./g, '-')
|
||||
idCardModel.value.endTime = validTimeArr[1].replace(/\./g, '-')
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast('识别身份证失败,请重新识别')
|
||||
uni.$u.toast('识别失败,请重新识别')
|
||||
}
|
||||
// const { data: result } = res
|
||||
// if (result.code === 200) {
|
||||
// uni.$u.toast('识别身份证成功')
|
||||
// } else {
|
||||
// uni.$u.toast('识别身份证失败,请重新识别')
|
||||
// }
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err, '----识别身份证失败')
|
||||
// console.log(err, '----识别身份证失败')
|
||||
uni.$u.toast('识别失败,请重新识别')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@
|
|||
:name="item.name"
|
||||
:fileList="item.fileList"
|
||||
:capture="['album', 'camera']"
|
||||
@delete="deletePic($event, index)"
|
||||
@afterRead="afterRead($event, index)"
|
||||
@delete="deletePic($event, index, item)"
|
||||
@afterRead="afterRead($event, index, item.type)"
|
||||
/>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
|
|
@ -112,6 +112,8 @@ const wageCardInfoForm = ref({
|
|||
bankBranchName: '', // 银行支行名称
|
||||
}) // 合同表单数据
|
||||
|
||||
const deleteFileList = ref([]) // 删除的文件列表ID
|
||||
|
||||
const wageCardImageList = ref([
|
||||
{
|
||||
type: 1,
|
||||
|
|
@ -138,7 +140,7 @@ const wageCardImageList = ref([
|
|||
title: '其它照片',
|
||||
},
|
||||
]) // 合同见证照片
|
||||
|
||||
const wageCardUploadIdList = ref([]) // 上传文件列表 存储ID
|
||||
const wageCardInfoFormRules = ref({
|
||||
bankName: [
|
||||
{
|
||||
|
|
@ -173,19 +175,71 @@ const wageCardInfoFormRules = ref({
|
|||
],
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
wageCardInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
wageCardImageList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
formType: {
|
||||
type: [Number, String], // 表单类型
|
||||
default: 1,
|
||||
},
|
||||
})
|
||||
|
||||
// 删除图片
|
||||
const deletePic = (e, index) => {
|
||||
const deletePic = (e, index, item) => {
|
||||
if (props.formType == 2 && !item.isNew) {
|
||||
deleteFileList.value.push(item.fileList[0].id)
|
||||
}
|
||||
wageCardImageList.value[index].fileList = []
|
||||
wageCardUploadIdList.value.splice(index, 1)
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
const afterRead = (e, index) => {
|
||||
const afterRead = (e, index, fileType) => {
|
||||
console.log(e, '选择的文件')
|
||||
const type = e.file[0].type
|
||||
if (!type.includes('image')) {
|
||||
uni.$u.toast('请上传图片格式')
|
||||
return
|
||||
}
|
||||
wageCardImageList.value[index].fileList = [e.file[0]]
|
||||
|
||||
const files = [
|
||||
{
|
||||
file: e.file[0].url,
|
||||
name: 'file',
|
||||
uri: e.file[0].url,
|
||||
},
|
||||
]
|
||||
uni.uploadFile({
|
||||
url: '/bmw/app/uploadFile',
|
||||
files: files,
|
||||
name: 'file',
|
||||
isUploadFile: true,
|
||||
formData: {
|
||||
type: fileType,
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data)
|
||||
|
||||
console.log(data, '上传结果')
|
||||
|
||||
if (data.code === 200) {
|
||||
wageCardImageList.value[index].fileList.push({ isNew: true, ...e.file[0] })
|
||||
// 走上传逻辑 上传成功后把ID插入到fileList中
|
||||
wageCardUploadIdList.value[index] = { id: data.data, fileType: fileType }
|
||||
} else {
|
||||
uni.$u.toast('上传失败:' + data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast('上传失败,请重新上传')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 检查表单状态
|
||||
|
|
@ -232,6 +286,8 @@ const checkFormStatus = () => {
|
|||
// 表单校验
|
||||
const validateWageCardForm = async () => {
|
||||
// console.log(wageCardFormRef.value, '9995')
|
||||
|
||||
console.log('提交表单')
|
||||
return new Promise((resolve, reject) => {
|
||||
wageCardFormRef.value
|
||||
.validate()
|
||||
|
|
@ -244,10 +300,26 @@ const validateWageCardForm = async () => {
|
|||
uni.$u.toast('请完善工资卡见证中的所有信息')
|
||||
return reject(new Error('工资卡信息未完善'))
|
||||
} else {
|
||||
let data = {}
|
||||
if (wageCardUploadIdList.value.length > 0) {
|
||||
data = {
|
||||
photoIds: wageCardUploadIdList.value
|
||||
.map((item) => item.id)
|
||||
.join(','),
|
||||
...wageCardInfoForm.value,
|
||||
}
|
||||
} else {
|
||||
data = { ...wageCardInfoForm.value }
|
||||
}
|
||||
|
||||
if (props.formType == 2 && deleteFileList.value.length > 0) {
|
||||
wageCardInfoForm.value.delIds = deleteFileList.value.join(',')
|
||||
}
|
||||
|
||||
resolve({
|
||||
data,
|
||||
status,
|
||||
isValid: true,
|
||||
data: wageCardInfoForm.value,
|
||||
imgList: wageCardImageList.value,
|
||||
})
|
||||
}
|
||||
|
|
@ -291,13 +363,15 @@ const onHandleRecognizeBankCard = () => {
|
|||
}
|
||||
// 上传后台接口
|
||||
uni.request({
|
||||
url: import.meta.env.VITE_API_BASE_URL + '/bmw/appRecognition/bankCardRecognition',
|
||||
url: '/bmw/appRecognition/bankCardRecognition',
|
||||
method: 'POST',
|
||||
data: param,
|
||||
isUploadFile: true,
|
||||
header: {
|
||||
Authorization: memberStore?.token, // token
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res, '银行卡识别结果')
|
||||
showLoading.value = false
|
||||
const { data: result } = res
|
||||
if (result.code === 200) {
|
||||
|
|
@ -329,17 +403,6 @@ defineExpose({
|
|||
updateWageCardInfo,
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
wageCardInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
wageCardImageList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
})
|
||||
|
||||
// 增加监听
|
||||
watch(
|
||||
props.wageCardInfo,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ const onAttendanceHandle = () => {
|
|||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
sourceType: ['camera'], // 选择图片的来源
|
||||
success: (res) => {
|
||||
console.log(res, '选择的文件')
|
||||
showLoading.value = true
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
:isEditContractStatus="isEditContractStatus"
|
||||
/>
|
||||
<WageCardForm
|
||||
:formType="formType"
|
||||
ref="personWageCardFormRef"
|
||||
:wageCardInfo="wageCardInfo"
|
||||
:wageCardImageList="wageCardImageList"
|
||||
|
|
@ -57,21 +58,33 @@
|
|||
:text="currentStep === 3 ? '提交' : '下一步'"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<up-loading-icon
|
||||
:vertical="true"
|
||||
duration="2000"
|
||||
color="#3c9cff"
|
||||
:show="showLoading"
|
||||
textColor="#3c9cff"
|
||||
text="数据正在提交,请稍后..."
|
||||
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%)"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="addAndEditPerson">
|
||||
import { useCommonStore } from '@/stores'
|
||||
import { pathToBase64 } from 'image-tools'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { ref, onMounted, nextTick } from 'vue'
|
||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
|
||||
import { getPersonInfoByIdAPI, updatePersonLightStatusApi } from '@/services/person-entry'
|
||||
import { addPersonEntryApi, editPersonEntryApi } from '@/services/person-entry'
|
||||
|
||||
import PersonIdCardForm from '@/components/PersonIdCardForm/index.vue'
|
||||
import KeyInfoForm from '@/components/KeyInfoForm/index.vue'
|
||||
import ContractForm from '@/components/ContractForm/index.vue'
|
||||
import WageCardForm from '@/components/WageCardForm/index.vue'
|
||||
import NavBarModal from '@/components/NavBarModal/index.vue'
|
||||
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
const { safeAreaInsets } = uni.getSystemInfoSync()
|
||||
const commonStore = useCommonStore()
|
||||
const navBarTitle = ref('新增人员信息')
|
||||
|
|
@ -87,6 +100,7 @@ const editUploadFileList = ref([]) // 编辑时已上传文件列表
|
|||
const formType = ref(1) // 表单类型
|
||||
const personId = ref('') // 人员id
|
||||
const einStatus = ref('') // 人员状态
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
|
|
@ -186,6 +200,19 @@ const wageCardImageList = ref([
|
|||
]) // 工资卡图片
|
||||
const wageCardStatus = ref('') // 工资卡状态
|
||||
|
||||
const imgToBase64Fun = async (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(path)
|
||||
.then((base64) => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 下一步
|
||||
const onHandleNext = async () => {
|
||||
try {
|
||||
|
|
@ -235,6 +262,7 @@ const onHandleNext = async () => {
|
|||
}
|
||||
if (currentStep.value === 3) {
|
||||
const res = await personWageCardFormRef.value.validateWageCardForm()
|
||||
|
||||
if (res.isValid) {
|
||||
stepList.value[currentStep.value].isError = false
|
||||
|
||||
|
|
@ -243,9 +271,6 @@ const onHandleNext = async () => {
|
|||
wageCardImageList.value = imgList
|
||||
wageCardStatus.value = status
|
||||
|
||||
// 提交接口 组装参数
|
||||
const files = []
|
||||
const fileMsg = []
|
||||
const params = {
|
||||
...idCardInfo.value,
|
||||
...keyInfo.value,
|
||||
|
|
@ -256,165 +281,30 @@ const onHandleNext = async () => {
|
|||
params.einStatus = einStatus.value
|
||||
}
|
||||
|
||||
// 处理人脸
|
||||
if (keyInfo.value.faceImg) {
|
||||
keyInfo.value.faceImg.forEach((e) => {
|
||||
if (!e.id) {
|
||||
files.push({
|
||||
file: e.file,
|
||||
name: 'files',
|
||||
})
|
||||
fileMsg.push({
|
||||
type: 1,
|
||||
name: 'faceImg',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 处理合同
|
||||
if (contractStatus.value === 'all_filled') {
|
||||
if (contractStatus.value === 'all_filled' && !isEditContractStatus.value) {
|
||||
params.bmWorkerContract = contractInfo.value
|
||||
contractImageList.value.forEach((item) => {
|
||||
item.fileList.forEach((j) => {
|
||||
if (!j.id) {
|
||||
files.push({
|
||||
file: j.file,
|
||||
name: 'files',
|
||||
})
|
||||
fileMsg.push({
|
||||
type: item.type,
|
||||
name: item.name,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 处理工资卡
|
||||
if (wageCardStatus.value === 'all_filled') {
|
||||
params.bmWorkerWageCard = wageCardInfo.value
|
||||
let reserveFileList = []
|
||||
let deleteFileList = []
|
||||
wageCardImageList.value.forEach((item) => {
|
||||
item.fileList.forEach((j) => {
|
||||
if (!j.id) {
|
||||
files.push({
|
||||
file: j.file,
|
||||
name: 'files',
|
||||
})
|
||||
fileMsg.push({
|
||||
type: item.type,
|
||||
name: item.name,
|
||||
})
|
||||
}
|
||||
|
||||
if (j.id) {
|
||||
reserveFileList.push(j.id)
|
||||
}
|
||||
})
|
||||
|
||||
if (isEditWageCardStatus && reserveFileList.length > 0) {
|
||||
deleteFileList = editUploadFileList.value
|
||||
.filter((item) => !reserveFileList.includes(item.id))
|
||||
.map((j) => j.id)
|
||||
params.bmWorkerWageCard.delIds = deleteFileList.join(',')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
delete params.faceImg // 删除无关数据
|
||||
const requestUrl = formType.value == 2 ? '/bmw/worker/edit' : '/bmw/worker/insert'
|
||||
|
||||
console.log('files---***---', files)
|
||||
showLoading.value = true
|
||||
const API = formType.value == 2 ? editPersonEntryApi : addPersonEntryApi
|
||||
showLoading.value = false
|
||||
|
||||
const { encryptRequest, encryptResponse, checkIntegrity } =
|
||||
commonStore?.requestConfig
|
||||
|
||||
if (files.length > 0) {
|
||||
uni.uploadFile({
|
||||
url: requestUrl,
|
||||
files: files,
|
||||
name: 'files',
|
||||
formData: {
|
||||
params: !encryptRequest
|
||||
? JSON.stringify(params)
|
||||
: encryptWithSM4(JSON.stringify(params)),
|
||||
fileMsg: !encryptRequest
|
||||
? JSON.stringify(fileMsg)
|
||||
: encryptWithSM4(JSON.stringify(fileMsg)),
|
||||
},
|
||||
header: {
|
||||
encryptRequest,
|
||||
encryptResponse,
|
||||
checkIntegrity,
|
||||
},
|
||||
success: async (res) => {
|
||||
console.log('res提交结果', res)
|
||||
|
||||
let data = null
|
||||
if (encryptResponse) {
|
||||
data = JSON.parse(decryptWithSM4(res.data))
|
||||
} else {
|
||||
data = JSON.parse(res.data)
|
||||
}
|
||||
if (data.code === 200) {
|
||||
uni.$u.toast(data.msg)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
|
||||
const id = formType.value == 2 ? personId.value : data.data
|
||||
await updatePersonLightStatusApi(id) // 更新红绿灯状态
|
||||
} else {
|
||||
uni.$u.toast(data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
sendLoading.value = false
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.uploadFile({
|
||||
url: requestUrl,
|
||||
formData: {
|
||||
params: !encryptRequest
|
||||
? JSON.stringify(params)
|
||||
: encryptWithSM4(JSON.stringify(params)),
|
||||
fileMsg: !encryptRequest
|
||||
? JSON.stringify(fileMsg)
|
||||
: encryptWithSM4(JSON.stringify(fileMsg)),
|
||||
},
|
||||
header: {
|
||||
encryptRequest,
|
||||
encryptResponse,
|
||||
checkIntegrity,
|
||||
},
|
||||
success: async (res) => {
|
||||
console.log('res提交结果', res)
|
||||
|
||||
let data = null
|
||||
if (encryptResponse) {
|
||||
data = JSON.parse(decryptWithSM4(res.data))
|
||||
} else {
|
||||
data = JSON.parse(res.data)
|
||||
}
|
||||
if (data.code === 200) {
|
||||
uni.$u.toast(data.msg)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
|
||||
const id = formType.value == 2 ? personId.value : data.data
|
||||
await updatePersonLightStatusApi(id) // 更新红绿灯状态
|
||||
} else {
|
||||
uni.$u.toast(data.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
sendLoading.value = false
|
||||
},
|
||||
})
|
||||
console.log('params--**----请求参数', params)
|
||||
const result = await API(params)
|
||||
console.log('res--**----新增或修改的结果', result)
|
||||
if (result.code === 200) {
|
||||
uni.$u.toast(result.msg)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<up-upload
|
||||
multiple
|
||||
:maxCount="3"
|
||||
:maxCount="1"
|
||||
accept="image"
|
||||
@delete="deletePic"
|
||||
:fileList="fileList"
|
||||
|
|
|
|||
|
|
@ -190,6 +190,10 @@ const onInputLoaded = async () => {
|
|||
|
||||
// 点击打开资料上传页面
|
||||
const onPersonExitItem = (item) => {
|
||||
if (item.einStatus == 2) {
|
||||
uni.$u.toast('人员已出场')
|
||||
return
|
||||
}
|
||||
const { name, id, proId, proName, subName, idNumber, workerId, teamName } = item
|
||||
const params = {
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -28,3 +28,21 @@ export const updatePersonLightStatusApi = (id) => {
|
|||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 新增人员入场接口
|
||||
export const addPersonEntryApi = (data) => {
|
||||
return http({
|
||||
url: `/bmw/app/appWorkerInsert`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 修改人员入场接口
|
||||
export const editPersonEntryApi = (data) => {
|
||||
return http({
|
||||
url: `/bmw/app/appWorkerEdit`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const httpInterceptor = {
|
|||
console.log(options.url, '文件上传')
|
||||
|
||||
// 2. 设置请求超时时间,默认为60s,设置为 10s
|
||||
options.timeout = 10000
|
||||
options.timeout = 60000
|
||||
|
||||
// 3. 增加小程序端请求头标识
|
||||
options.header = {
|
||||
|
|
@ -52,7 +52,7 @@ const httpInterceptor = {
|
|||
}
|
||||
|
||||
// 2. 设置请求超时时间,默认为60s,设置为 10s
|
||||
options.timeout = 10000
|
||||
options.timeout = 60000
|
||||
|
||||
// 3. 增加小程序端请求头标识
|
||||
options.header = {
|
||||
|
|
@ -99,6 +99,8 @@ const httpInterceptor = {
|
|||
options.url = url
|
||||
}
|
||||
}
|
||||
|
||||
console.log(options, 'options--**----')
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue