This commit is contained in:
BianLzhaoMin 2025-09-06 18:15:58 +08:00
parent b285da3091
commit a7f9997a36
12 changed files with 176 additions and 77 deletions

View File

@ -120,7 +120,7 @@
:disabled="isEditContractStatus"
:deletable="!isEditContractStatus"
@afterRead="afterRead($event, index, item.type)"
:capture="['album', 'camera']"
:capture="['camera']"
/>
</up-form-item>
</up-form>

View File

@ -20,6 +20,7 @@
style="width: 100%"
@tap="onOpenPiker(1)"
:border="false"
:disabled="props.formType == 2"
>
<template #icon>
<text :class="{ 'color-text': keyInfoForm.postName }" class="time-text">
@ -34,6 +35,7 @@
border="none"
placeholder="请输入手机号"
v-model="keyInfoForm.phone"
:disabled="props.formType == 2"
/>
</up-form-item>
<up-form-item label="入场工程" prop="proName" :borderBottom="true">
@ -43,6 +45,7 @@
style="width: 100%"
@tap="onOpenPiker(2)"
:border="false"
:disabled="props.formType == 2"
>
<template #icon>
<text :class="{ 'color-text': keyInfoForm.proName }" class="time-text">
@ -58,6 +61,7 @@
style="width: 100%"
@tap="onOpenPiker(3)"
:border="false"
:disabled="props.formType == 2"
>
<template #icon>
<text :class="{ 'color-text': keyInfoForm.subName }" class="time-text">
@ -73,6 +77,7 @@
style="width: 100%"
@tap="onOpenPiker(4)"
:border="false"
:disabled="props.formType == 2"
>
<template #icon>
<text :class="{ 'color-text': keyInfoForm.teamName }" class="time-text">
@ -95,7 +100,7 @@
accept="image"
@delete="deletePic"
@afterRead="afterRead"
:capture="['album', 'camera']"
:capture="['camera']"
:fileList="keyInfoForm.faceImg"
/>
</up-form-item>
@ -323,6 +328,7 @@ const deletePic = (e) => {
//
const afterRead = (e) => {
console.log(e, '选择的文件')
const type = e.file[0].type
if (!type.includes('image')) {
uni.$u.toast('请上传图片格式')
@ -370,7 +376,7 @@ const afterRead = (e) => {
},
})
} else {
uni.$u.toast('人脸识别失败:' + data.msg)
uni.$u.toast('人脸识别失败:' + data?.msg)
keyInfoForm.value.faceImg = []
}
},
@ -480,6 +486,10 @@ const props = defineProps({
type: Object,
default: () => {},
},
formType: {
type: [Number, String], //
default: 1,
},
})
const updateKeyInfoInfo = () => {

View File

@ -353,7 +353,7 @@ const onHandleRecognizeIdCard = (type) => {
uni.chooseImage({
count: 1, // 1
sizeType: ['original', 'compressed'],
sourceType: ['camera', 'album'], //
sourceType: ['camera'], //
success: async (res) => {
const base64 = await imgToBase64Fun(res.tempFilePaths[0])
let params = {

View File

@ -72,7 +72,7 @@
accept="image"
:name="item.name"
:fileList="item.fileList"
:capture="['album', 'camera']"
:capture="['camera']"
@delete="deletePic($event, index, item)"
@afterRead="afterRead($event, index, item.type)"
/>
@ -192,8 +192,12 @@ const props = defineProps({
//
const deletePic = (e, index, item) => {
if (props.formType == 2 && !item.isNew) {
deleteFileList.value.push(item.fileList[0].id)
if (props.formType == 2) {
item.fileList.forEach((item) => {
if (item.id) {
deleteFileList.value.push(item.id)
}
})
}
wageCardImageList.value[index].fileList = []
wageCardUploadIdList.value.splice(index, 1)
@ -201,7 +205,7 @@ const deletePic = (e, index, item) => {
//
const afterRead = (e, index, fileType) => {
console.log(e, '选择的文件')
console.log('选择的文件', e)
const type = e.file[0].type
if (!type.includes('image')) {
uni.$u.toast('请上传图片格式')
@ -313,7 +317,7 @@ const validateWageCardForm = async () => {
}
if (props.formType == 2 && deleteFileList.value.length > 0) {
wageCardInfoForm.value.delIds = deleteFileList.value.join(',')
data.delIds = deleteFileList.value.join(',')
}
resolve({
@ -354,7 +358,7 @@ const onHandleRecognizeBankCard = () => {
uni.chooseImage({
count: 1, // 1
sizeType: ['original', 'compressed'],
sourceType: ['camera', 'album'], //
sourceType: ['camera'], //
success: async (res) => {
showLoading.value = true
const base64 = await imgToBase64Fun(res.tempFilePaths[0])

View File

@ -151,12 +151,12 @@ const onAttendanceHandle = () => {
},
})
} else {
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
uni.$u.toast('人脸识别失败,请重新识别' + data?.msg)
}
},
fail: (err) => {
showLoading.value = false
uni.$u.toast('人脸识别失败' + err.msg)
uni.$u.toast('人脸识别失败')
},
})
},

View File

@ -35,7 +35,7 @@ const onFaceRecognition = () => {
uni.chooseImage({
count: 1, // 1
sizeType: ['original', 'compressed'],
sourceType: ['camera', 'album'], //
sourceType: ['camera'], //
success: (res) => {
showLoading.value = true
const files = [
@ -61,7 +61,7 @@ const onFaceRecognition = () => {
})
}, 500)
} else {
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
uni.$u.toast('人脸识别失败,请重新识别' + data?.msg)
}
},
fail: (err) => {

View File

@ -300,6 +300,13 @@ const onHandleNext = async () => {
console.log('params--**----请求参数', params)
const result = await API(params)
console.log('res--**----新增或修改的结果', result)
if (result.code === 200) {
// 绿
const workerId = formType.value == 2 ? params.id : result.data
updatePersonLightStatusApi(workerId)
}
if (result.code === 200) {
uni.$u.toast(result.msg)
setTimeout(() => {

View File

@ -62,9 +62,11 @@
import { debounce } from 'lodash-es'
import { ref, onMounted, computed } from 'vue'
import { getPersonListAPI } from '@/services/person-entry'
import { useCommonStore } from '@/stores'
import Empty from '@/static/image/Empty.png'
const commonStore = useCommonStore() //
const personList = ref([]) //
const total = ref(0) //
@ -73,6 +75,7 @@ const queryParams = ref({
pageNum: 1,
pageSize: 10,
name: '',
proId: commonStore?.activeProjectId,
})
//

View File

@ -68,7 +68,7 @@ const handleTapPersonEntry = (item) => {
uni.chooseImage({
count: 1, // 1
sizeType: ['original', 'compressed'],
sourceType: ['camera', 'album'], //
sourceType: ['camera'], //
isUploadFile: true,
success: (res) => {
showLoading.value = true
@ -96,7 +96,7 @@ const handleTapPersonEntry = (item) => {
})
}, 500)
} else {
uni.$u.toast('人脸识别失败,请重新识别' + data.msg)
uni.$u.toast('人脸识别失败,请重新识别' + data?.msg)
}
},
fail: (err) => {

View File

@ -50,24 +50,24 @@
<up-upload
multiple
:maxCount="1"
:maxCount="3"
accept="image"
@delete="deletePic"
:fileList="fileList"
@afterRead="afterRead"
:capture="['album', 'camera']"
:capture="['camera']"
/>
</view>
<view class="confirm-btn">
<up-button type="primary" @tap="openConfirmExitModal" text="确 认 出 场" />
<up-button type="primary" @click="openConfirmExitModal" text="确 认 出 场" />
</view>
<!-- 确认出场提示弹框 -->
<up-modal
title="出场确认"
:showCancelButton="true"
:content="exitContent"
content="是否确认将人员出场?"
:show="showModalConfirmExit"
@confirm="onConfirmExit"
@cancel="onCancelConfirmExit"
@ -79,28 +79,64 @@
import { ref } from 'vue'
import { useCommonStore } from '@/stores'
import { onLoad } from '@dcloudio/uni-app'
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
import { editPersonEntryExitApi } from '@/services/person-entry.js'
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm.js'
const commonStore = useCommonStore()
const exitParams = ref({}) //
const fileList = ref([]) //
const exitContent = ref('') //
const showModalConfirmExit = ref(false) //
const fileIds = ref([]) // ID
//
const deletePic = (name) => {
fileList.value = fileList.value.filter((item) => item.name !== name)
const deletePic = (e) => {
fileList.value = fileList.value.filter((item) => item.id !== e.file.id)
}
//
const afterRead = (e) => {
console.log('选择的文件', e)
const type = e.file[0].type
if (!type.includes('image')) {
uni.$u.toast('请上传图片格式')
return
}
fileList.value.push(e.file[0])
// fileList.value.push(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: 1,
},
success: (res) => {
const data = JSON.parse(res.data)
console.log(data, '上传结果')
if (data.code === 200) {
fileIds.value.push(data.data)
fileList.value.push({ ...e.file[0], id: data.data })
} else {
uni.$u.toast('上传失败:' + data.msg)
}
},
fail: (err) => {
uni.$u.toast('上传失败,请重新上传')
},
})
}
//
@ -108,76 +144,103 @@ const openConfirmExitModal = () => {
if (fileList.value.length === 0) {
exitContent.value = `当前没有上传离场工资结算确认单,是否确认将人员 <${exitParams.value.name}> 出场?`
} else {
exitContent.value = `是否确认将人员 <${exitParams.value.name}> 出场?`
exitContent.value = `是否确认将人员 ${exitParams.value.name} 出场?`
}
showModalConfirmExit.value = true
}
//
const onConfirmExit = () => {
//
const onConfirmExit = async () => {
const params = {
id: exitParams.value.id,
proId: exitParams.value.proId,
workerId: exitParams.value.workerId,
exitWay: 'APP',
}
const fileMsg = []
const files = []
if (fileList.value.length > 0) {
fileList.value.forEach((item) => {
fileMsg.push({
name: '工资结算确认单',
type: 1,
})
12`1`.push({
file: item.file,
name: 'files',
})
})
if (fileIds.value.length > 0) {
params.fileIds = fileIds.value.join(',')
}
const { encryptRequest, encryptResponse, checkIntegrity } = commonStore?.requestConfig
const res = await editPersonEntryExitApi(params)
uni.uploadFile({
url: '/bmw/workerExit/exit',
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) => {
let data = null
if (encryptResponse) {
data = JSON.parse(decryptWithSM4(res.data))
} else {
data = JSON.parse(res.data)
}
if (data.code === 200) {
if (res.code === 200) {
uni.$u.toast('出场成功')
setTimeout(() => {
uni.navigateBack()
}, 500)
} else {
uni.$u.toast(data.msg)
uni.$u.toast(res.msg)
}
showModalConfirmExit.value = false
},
fail: (err) => {},
})
// console.log('res', res)
// console.log('exitParams', exitParams.value)
// // //
// const params = {
// id: exitParams.value.id,
// proId: exitParams.value.proId,
// workerId: exitParams.value.workerId,
// exitWay: 'APP',
// }
// console.log('params', params)
// const fileMsg = []
// const files = []
// if (fileList.value.length > 0) {
// fileList.value.forEach((item) => {
// fileMsg.push({
// name: '',
// type: 1,
// })
// files.push({
// file: item.url,
// name: 'files',
// })
// })
// }
// console.log('fileMsg', fileMsg)
// console.log('files', files)
// const { encryptRequest, encryptResponse, checkIntegrity } = commonStore?.requestConfig
// console.log('encryptRequest', encryptRequest)
// console.log('encryptResponse', encryptResponse)
// console.log('checkIntegrity', checkIntegrity)
// uni.uploadFile({
// url: '/bmw/workerExit/exit',
// files: files,
// name: 'file',
// formData: {
// params: JSON.stringify(params),
// fileMsg: 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('')
// // setTimeout(() => {
// // uni.navigateBack()
// // }, 500)
// // } else {
// // uni.$u.toast(data.msg)
// // }
// // showModalConfirmExit.value = false
// },
// fail: (err) => {},
// })
}
//

View File

@ -102,6 +102,7 @@
import { debounce } from 'lodash-es'
import { ref, computed, onMounted, nextTick } from 'vue'
import { getPersonExitListAPI } from '@/services/person-exit.js'
import { useCommonStore } from '@/stores'
import Empty from '@/static/image/Empty.png'
@ -112,6 +113,7 @@ const total = ref(0) // 总条数
const searchType = ref(1) // 1: 2: 3:
const searchValue = ref('') //
const searchPlaceholder = ref('输入姓名') // placeholder
const commonStore = useCommonStore() //
const queryParams = ref({
pageNum: 1,
pageSize: 10,
@ -231,6 +233,7 @@ const hasMore = computed(() => {
})
onMounted(() => {
queryParams.value.proName = commonStore?.activeProjectName
onInputLoaded()
getPersonExitListFun()
})

View File

@ -46,3 +46,12 @@ export const editPersonEntryApi = (data) => {
data,
})
}
// 出场
export const editPersonEntryExitApi = (data) => {
return http({
url: `/bmw/app/appWorkerExit`,
method: 'POST',
data,
})
}