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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,24 +50,24 @@
<up-upload <up-upload
multiple multiple
:maxCount="1" :maxCount="3"
accept="image" accept="image"
@delete="deletePic" @delete="deletePic"
:fileList="fileList" :fileList="fileList"
@afterRead="afterRead" @afterRead="afterRead"
:capture="['album', 'camera']" :capture="['camera']"
/> />
</view> </view>
<view class="confirm-btn"> <view class="confirm-btn">
<up-button type="primary" @tap="openConfirmExitModal" text="确 认 出 场" /> <up-button type="primary" @click="openConfirmExitModal" text="确 认 出 场" />
</view> </view>
<!-- 确认出场提示弹框 --> <!-- 确认出场提示弹框 -->
<up-modal <up-modal
title="出场确认" title="出场确认"
:showCancelButton="true" :showCancelButton="true"
:content="exitContent" content="是否确认将人员出场?"
:show="showModalConfirmExit" :show="showModalConfirmExit"
@confirm="onConfirmExit" @confirm="onConfirmExit"
@cancel="onCancelConfirmExit" @cancel="onCancelConfirmExit"
@ -79,28 +79,64 @@
import { ref } from 'vue' import { ref } from 'vue'
import { useCommonStore } from '@/stores' import { useCommonStore } from '@/stores'
import { onLoad } from '@dcloudio/uni-app' 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 commonStore = useCommonStore()
const exitParams = ref({}) // const exitParams = ref({}) //
const fileList = ref([]) // const fileList = ref([]) //
const exitContent = ref('') // const exitContent = ref('') //
const showModalConfirmExit = ref(false) // const showModalConfirmExit = ref(false) //
const fileIds = ref([]) // ID
// //
const deletePic = (name) => { const deletePic = (e) => {
fileList.value = fileList.value.filter((item) => item.name !== name) fileList.value = fileList.value.filter((item) => item.id !== e.file.id)
} }
// //
const afterRead = (e) => { const afterRead = (e) => {
console.log('选择的文件', e)
const type = e.file[0].type const type = e.file[0].type
if (!type.includes('image')) { if (!type.includes('image')) {
uni.$u.toast('请上传图片格式') uni.$u.toast('请上传图片格式')
return 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) { if (fileList.value.length === 0) {
exitContent.value = `当前没有上传离场工资结算确认单,是否确认将人员 <${exitParams.value.name}> 出场?` exitContent.value = `当前没有上传离场工资结算确认单,是否确认将人员 <${exitParams.value.name}> 出场?`
} else { } else {
exitContent.value = `是否确认将人员 <${exitParams.value.name}> 出场?` exitContent.value = `是否确认将人员 ${exitParams.value.name} 出场?`
} }
showModalConfirmExit.value = true showModalConfirmExit.value = true
} }
// //
const onConfirmExit = () => { const onConfirmExit = async () => {
//
const params = { const params = {
id: exitParams.value.id, id: exitParams.value.id,
proId: exitParams.value.proId, proId: exitParams.value.proId,
workerId: exitParams.value.workerId, workerId: exitParams.value.workerId,
exitWay: 'APP', exitWay: 'APP',
} }
const fileMsg = []
const files = [] if (fileIds.value.length > 0) {
if (fileList.value.length > 0) { params.fileIds = fileIds.value.join(',')
fileList.value.forEach((item) => {
fileMsg.push({
name: '工资结算确认单',
type: 1,
})
12`1`.push({
file: item.file,
name: 'files',
})
})
} }
const { encryptRequest, encryptResponse, checkIntegrity } = commonStore?.requestConfig const res = await editPersonEntryExitApi(params)
uni.uploadFile({ if (res.code === 200) {
url: '/bmw/workerExit/exit', uni.$u.toast('出场成功')
files: files, setTimeout(() => {
name: 'files', uni.navigateBack()
formData: { }, 500)
params: !encryptRequest } else {
? JSON.stringify(params) uni.$u.toast(res.msg)
: 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 // console.log('exitParams', exitParams.value)
if (encryptResponse) { // // //
data = JSON.parse(decryptWithSM4(res.data)) // const params = {
} else { // id: exitParams.value.id,
data = JSON.parse(res.data) // proId: exitParams.value.proId,
} // workerId: exitParams.value.workerId,
// exitWay: 'APP',
// }
if (data.code === 200) { // console.log('params', params)
uni.$u.toast('出场成功') // const fileMsg = []
setTimeout(() => { // const files = []
uni.navigateBack() // if (fileList.value.length > 0) {
}, 500) // fileList.value.forEach((item) => {
} else { // fileMsg.push({
uni.$u.toast(data.msg) // name: '',
} // type: 1,
// })
// files.push({
// file: item.url,
// name: 'files',
// })
// })
// }
showModalConfirmExit.value = false // console.log('fileMsg', fileMsg)
}, // console.log('files', files)
fail: (err) => {}, // 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 { debounce } from 'lodash-es'
import { ref, computed, onMounted, nextTick } from 'vue' import { ref, computed, onMounted, nextTick } from 'vue'
import { getPersonExitListAPI } from '@/services/person-exit.js' import { getPersonExitListAPI } from '@/services/person-exit.js'
import { useCommonStore } from '@/stores'
import Empty from '@/static/image/Empty.png' import Empty from '@/static/image/Empty.png'
@ -112,6 +113,7 @@ const total = ref(0) // 总条数
const searchType = ref(1) // 1: 2: 3: const searchType = ref(1) // 1: 2: 3:
const searchValue = ref('') // const searchValue = ref('') //
const searchPlaceholder = ref('输入姓名') // placeholder const searchPlaceholder = ref('输入姓名') // placeholder
const commonStore = useCommonStore() //
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
@ -231,6 +233,7 @@ const hasMore = computed(() => {
}) })
onMounted(() => { onMounted(() => {
queryParams.value.proName = commonStore?.activeProjectName
onInputLoaded() onInputLoaded()
getPersonExitListFun() getPersonExitListFun()
}) })

View File

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