This commit is contained in:
parent
b285da3091
commit
a7f9997a36
|
|
@ -120,7 +120,7 @@
|
|||
:disabled="isEditContractStatus"
|
||||
:deletable="!isEditContractStatus"
|
||||
@afterRead="afterRead($event, index, item.type)"
|
||||
:capture="['album', 'camera']"
|
||||
:capture="['camera']"
|
||||
/>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
|
|
|
|||
|
|
@ -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 = () => {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -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('人脸识别失败')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
|
||||
// 修改人员信息
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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) => {},
|
||||
// })
|
||||
}
|
||||
|
||||
// 取消确认出场
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -46,3 +46,12 @@ export const editPersonEntryApi = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 出场
|
||||
export const editPersonEntryExitApi = (data) => {
|
||||
return http({
|
||||
url: `/bmw/app/appWorkerExit`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue