增加上海工程入场
This commit is contained in:
parent
f8c89b3104
commit
f4d8e88173
|
|
@ -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 = /api
|
||||
VITE_API_BASE_URL = http://192.168.0.14:1999/hd-real-name
|
||||
# VITE_API_BASE_URL = http://192.168.0.234:38080
|
||||
|
|
|
|||
|
|
@ -97,6 +97,13 @@
|
|||
"navigationBarTitleText": "人脸识别查找"
|
||||
}
|
||||
},
|
||||
// 上海人员多工程设置
|
||||
{
|
||||
"path": "pages/person-entry/child-pages/projectSetting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "上海人员多工程设置"
|
||||
}
|
||||
},
|
||||
|
||||
// 人员出场
|
||||
{
|
||||
|
|
@ -183,6 +190,20 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "考勤机设置"
|
||||
}
|
||||
},
|
||||
// 上海多工程设置明细
|
||||
{
|
||||
"path": "pages/shProjectDetails/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "上海多工程设置明细"
|
||||
}
|
||||
},
|
||||
// 新增入场工程
|
||||
{
|
||||
"path": "pages/shProjectDetails/child-pages/addProject",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增入场工程"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ const onMachineSettingItem = (item) => {
|
|||
|
||||
// 刷新机器列表的处理函数
|
||||
const handleRefreshMachineList = (eventData) => {
|
||||
console.log('收到刷新机器列表事件:', eventData)
|
||||
// 重置分页参数
|
||||
queryParams.value.pageNum = 1
|
||||
// 刷新列表数据
|
||||
|
|
|
|||
|
|
@ -1,81 +1,78 @@
|
|||
<template>
|
||||
<!-- 新增和修改人员信息 -->
|
||||
<NavBarModal :navBarTitle="navBarTitle" />
|
||||
<view
|
||||
class="add-person-container"
|
||||
:style="{
|
||||
paddingBottom: nextBtnHeight + 'px',
|
||||
paddingTop: safeAreaInsets?.top + paddingTop + 'px',
|
||||
}"
|
||||
>
|
||||
<!-- 步骤条 -->
|
||||
<view>
|
||||
<up-steps :current="currentStep">
|
||||
<up-steps-item
|
||||
:key="item.title"
|
||||
:title="item.title"
|
||||
:error="item.isError"
|
||||
v-for="item in stepList"
|
||||
/>
|
||||
</up-steps>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<NavBarModal :navBarTitle="navBarTitle" />
|
||||
<view
|
||||
class="add-person-container"
|
||||
:style="{
|
||||
paddingBottom: nextBtnHeight + 'px',
|
||||
paddingTop: safeAreaInsets?.top + paddingTop + 'px',
|
||||
}"
|
||||
>
|
||||
<!-- 步骤条 -->
|
||||
<view>
|
||||
<up-steps :current="currentStep">
|
||||
<up-steps-item
|
||||
:key="item.title"
|
||||
:title="item.title"
|
||||
:error="item.isError"
|
||||
v-for="item in stepList"
|
||||
/>
|
||||
</up-steps>
|
||||
</view>
|
||||
|
||||
<view class="person-info-container">
|
||||
<PersonIdCardForm
|
||||
ref="personIdCardFormRef"
|
||||
:idCardInfo="idCardInfo"
|
||||
:formType="formType"
|
||||
v-if="currentStep === 0"
|
||||
/>
|
||||
<KeyInfoForm
|
||||
:keyInfo="keyInfo"
|
||||
:formType="formType"
|
||||
v-if="currentStep === 1"
|
||||
ref="personKeyInfoFormRef"
|
||||
/>
|
||||
<ContractForm
|
||||
v-if="currentStep === 2"
|
||||
ref="personContractFormRef"
|
||||
:contractInfo="contractInfo"
|
||||
:contractImageList="contractImageList"
|
||||
:isEditContractStatus="isEditContractStatus"
|
||||
/>
|
||||
<WageCardForm
|
||||
:formType="formType"
|
||||
ref="personWageCardFormRef"
|
||||
:wageCardInfo="wageCardInfo"
|
||||
:wageCardImageList="wageCardImageList"
|
||||
v-if="currentStep === 3"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="next-btn" ref="nextBtnRef">
|
||||
<up-button
|
||||
color="#0ab99c"
|
||||
text="上一步"
|
||||
@tap="onHandlePrev"
|
||||
v-if="currentStep > 0"
|
||||
style="margin-right: 10px"
|
||||
/>
|
||||
<up-button
|
||||
type="primary"
|
||||
@tap="onHandleNext"
|
||||
: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 class="person-info-container">
|
||||
<PersonIdCardForm
|
||||
ref="personIdCardFormRef"
|
||||
:idCardInfo="idCardInfo"
|
||||
:formType="formType"
|
||||
v-if="currentStep === 0"
|
||||
/>
|
||||
<KeyInfoForm
|
||||
:keyInfo="keyInfo"
|
||||
:formType="formType"
|
||||
v-if="currentStep === 1"
|
||||
ref="personKeyInfoFormRef"
|
||||
/>
|
||||
<ContractForm
|
||||
v-if="currentStep === 2"
|
||||
ref="personContractFormRef"
|
||||
:contractInfo="contractInfo"
|
||||
:contractImageList="contractImageList"
|
||||
:isEditContractStatus="isEditContractStatus"
|
||||
/>
|
||||
<WageCardForm
|
||||
:formType="formType"
|
||||
ref="personWageCardFormRef"
|
||||
:wageCardInfo="wageCardInfo"
|
||||
:wageCardImageList="wageCardImageList"
|
||||
v-if="currentStep === 3"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="next-btn" ref="nextBtnRef">
|
||||
<up-button
|
||||
color="#0ab99c"
|
||||
text="上一步"
|
||||
@tap="onHandlePrev"
|
||||
v-if="currentStep > 0"
|
||||
style="margin-right: 10px"
|
||||
/>
|
||||
<up-button
|
||||
type="primary"
|
||||
@tap="onHandleNext"
|
||||
: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>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
<template>
|
||||
<!-- 上海人员多工程设置 -->
|
||||
<view>
|
||||
<NavBarModal :navBarTitle="navBarTitle" />
|
||||
<view
|
||||
class="project-setting-container"
|
||||
:style="{
|
||||
paddingTop: safeAreaInsets?.top + paddingTop + 'px',
|
||||
}"
|
||||
>
|
||||
<!-- 身份证号码输入 -->
|
||||
<view class="input-section">
|
||||
<view class="input-label">身份证号码:</view>
|
||||
<up-input
|
||||
v-model="idCardNumber"
|
||||
placeholder="输入身份证号码"
|
||||
:clearable="true"
|
||||
:maxlength="18"
|
||||
class="id-card-input"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 设置说明 -->
|
||||
<view class="instruction-section">
|
||||
<view class="instruction-title">上海人员多工程设置说明:</view>
|
||||
<view class="instruction-list">
|
||||
<view class="instruction-item"> 1.请确保该人员已经入场一个上海工程 </view>
|
||||
<view class="instruction-item">
|
||||
2.每个工程,人员只能存在一条在场数据,即一个工程只能入场一次
|
||||
</view>
|
||||
<view class="instruction-item">
|
||||
3.如需出场,请至
|
||||
<text class="instruction-link" @tap="onHandlePersonExit">【人员出场】</text>
|
||||
模块进行单个工程出场操作
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 下一步按钮 -->
|
||||
<view class="next-btn">
|
||||
<up-button type="primary" text="下一步" @tap="onHandleNext" />
|
||||
</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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="projectSetting">
|
||||
import { ref } from 'vue'
|
||||
import NavBarModal from '@/components/NavBarModal/index.vue'
|
||||
import { getShProjectSettingByIdNumberAPI } from '@/services/shProjectSetting'
|
||||
|
||||
const { safeAreaInsets } = uni.getSystemInfoSync()
|
||||
const navBarTitle = ref('上海人员多工程设置')
|
||||
const paddingTop = ref(46) // 顶部padding
|
||||
const idCardNumber = ref('') // 身份证号码
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
// 身份证号码验证
|
||||
const validateIdCard = (idCard) => {
|
||||
const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
|
||||
return reg.test(idCard)
|
||||
}
|
||||
|
||||
// 下一步处理
|
||||
const onHandleNext = async () => {
|
||||
if (!idCardNumber.value) {
|
||||
uni.$u.toast('请输入身份证号码')
|
||||
return
|
||||
}
|
||||
|
||||
if (!validateIdCard(idCardNumber.value)) {
|
||||
uni.$u.toast('请输入正确的身份证号码')
|
||||
return
|
||||
}
|
||||
|
||||
showLoading.value = true
|
||||
|
||||
try {
|
||||
// TODO: 这里需要调用API验证身份证号码并获取人员信息
|
||||
const { data: res } = await getShProjectSettingByIdNumberAPI({
|
||||
idNumber: idCardNumber.value,
|
||||
})
|
||||
|
||||
showLoading.value = false
|
||||
|
||||
if (!res) {
|
||||
uni.$u.toast('当前人员不存在,请先新增人员!')
|
||||
return
|
||||
}
|
||||
|
||||
if (res?.isShanghai == 0) {
|
||||
uni.$u.toast('该人员当前入场的工程非上海工程!')
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
uni.$u.toast('验证成功')
|
||||
|
||||
// 跳转到下一个页面,传递身份证号码
|
||||
uni.navigateTo({
|
||||
url: `/pages/shProjectDetails/index?idCard=${idCardNumber.value}&workerId=${res.id}&name=${res.name}`,
|
||||
})
|
||||
}, 500)
|
||||
} catch (error) {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('验证失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转到人员出场页面
|
||||
const onHandlePersonExit = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/person-exit/index',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.project-setting-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.input-section {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.input-label {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.id-card-input {
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #e4e7ed;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
font-size: 30rpx;
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field::placeholder {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.instruction-section {
|
||||
flex: 1;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.instruction-title {
|
||||
font-size: 32rpx;
|
||||
color: #fa3534;
|
||||
font-weight: 600;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.instruction-list {
|
||||
.instruction-item {
|
||||
color: #fa3534;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 24rpx;
|
||||
line-height: 1.6;
|
||||
|
||||
.instruction-link {
|
||||
color: #409eff;
|
||||
font-size: 28rpx;
|
||||
text-decoration: underline;
|
||||
// margin: 0 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.next-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
border-top: 1rpx solid #e4e7ed;
|
||||
|
||||
::v-deep .u-button {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
import AddIcon from '@/static/image/person/add.png'
|
||||
import EditIcon from '@/static/image/person/edit.png'
|
||||
import FaceIcon from '@/static/image/person/face.png'
|
||||
import ProSettingIcon from '@/static/image/person/pro_setting.png'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
|
@ -60,6 +61,14 @@ const handleList = [
|
|||
bgc_color_2: '#91cbf0',
|
||||
url: '/pages/person-entry/child-pages/faceRecognition',
|
||||
},
|
||||
{
|
||||
name: 'proSetting',
|
||||
icon: ProSettingIcon,
|
||||
title: '上海人员多工程设置',
|
||||
bgc_color_1: '#ffb152',
|
||||
bgc_color_2: '#ff9130',
|
||||
url: '/pages/person-entry/child-pages/projectSetting',
|
||||
},
|
||||
]
|
||||
|
||||
// 点击跳转
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ const deletePic = (e) => {
|
|||
|
||||
// 上传图片
|
||||
const afterRead = (e) => {
|
||||
console.log('选择的文件', e)
|
||||
const type = e.file[0].type
|
||||
if (!type.includes('image')) {
|
||||
uni.$u.toast('请上传图片格式')
|
||||
|
|
@ -124,8 +123,6 @@ const afterRead = (e) => {
|
|||
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 })
|
||||
|
|
@ -141,7 +138,6 @@ const afterRead = (e) => {
|
|||
|
||||
// 打开确认出场提示弹框
|
||||
const openConfirmExitModal = () => {
|
||||
console.log('fileList', fileList.value)
|
||||
if (fileList.value.length === 0 && exitParams.value.isShanghai == 0) {
|
||||
uni.$u.toast('请上传离场工资结算确认单')
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- 切换工程弹框 -->
|
||||
<up-popup mode="center" :show="switchProjectShow">
|
||||
<view class="app-container-1">
|
||||
<view class="switch-project-content">
|
||||
<view class="my-project-title"> 选择工程 </view>
|
||||
<view>
|
||||
|
|
@ -27,14 +27,13 @@
|
|||
<up-button type="primary" text="跳转首页..." @tap="onJumpHome" />
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="selectProject">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useCommonStore } from '@/stores'
|
||||
import { getProjectSelectListByConditionAPI } from '@/services/common'
|
||||
const switchProjectShow = ref(true)
|
||||
const searchProjectValue = ref('')
|
||||
const projectList = ref([])
|
||||
const projectListAll = ref([])
|
||||
|
|
@ -86,17 +85,30 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container-1 {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
box-sizing: border-box;
|
||||
background-color: #f0f2f5;
|
||||
}
|
||||
.switch-project-content {
|
||||
width: 80vw;
|
||||
width: 86vw;
|
||||
height: 80vh;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 0 10rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||
padding: 20rpx;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
|
||||
.my-project-title {
|
||||
// margin-bottom: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
|
|
@ -107,6 +119,7 @@ onMounted(() => {
|
|||
|
||||
.my-project-list {
|
||||
flex: 1;
|
||||
|
||||
overflow-y: auto;
|
||||
|
||||
.project-item {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,592 @@
|
|||
<template>
|
||||
<!-- 添加入场数据 -->
|
||||
<view>
|
||||
<view
|
||||
class="add-project-container"
|
||||
:style="{
|
||||
paddingBottom: nextBtnHeight + 'px',
|
||||
paddingTop: safeAreaInsets?.top + paddingTop + 'px',
|
||||
}"
|
||||
>
|
||||
<!-- 提示信息 -->
|
||||
<view class="instruction-section">
|
||||
<text class="instruction-text">
|
||||
提交后,系统自动生成一条入场数据,该人员基础信息、合同信息、工资卡信息共用
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<view class="form-container">
|
||||
<up-form
|
||||
labelWidth="120"
|
||||
labelPosition="left"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
ref="formRef"
|
||||
>
|
||||
<!-- 姓名 -->
|
||||
<up-form-item label="姓名" prop="name" :borderBottom="true">
|
||||
<up-input
|
||||
v-model="formData.name"
|
||||
placeholder="请输入姓名"
|
||||
:clearable="false"
|
||||
:disabled="true"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
||||
<!-- 身份证号 -->
|
||||
<up-form-item label="身份证号" prop="idNumber" :borderBottom="true">
|
||||
<up-input
|
||||
v-model="formData.idNumber"
|
||||
placeholder="请输入身份证号"
|
||||
:clearable="false"
|
||||
:disabled="true"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
||||
<!-- 工种 -->
|
||||
<up-form-item label="工种" prop="postName" :borderBottom="true">
|
||||
<up-cell
|
||||
isLink
|
||||
size="large"
|
||||
style="width: 100%"
|
||||
@tap="onOpenPicker(1)"
|
||||
:border="false"
|
||||
>
|
||||
<template #icon>
|
||||
<text
|
||||
:class="{ 'color-text': formData.postName }"
|
||||
class="time-text"
|
||||
>
|
||||
{{ formData.postName || '选择选项' }}
|
||||
</text>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-form-item>
|
||||
|
||||
<!-- 入场工程 -->
|
||||
<up-form-item label="入场工程" prop="proName" :borderBottom="true">
|
||||
<up-cell
|
||||
isLink
|
||||
size="large"
|
||||
style="width: 100%"
|
||||
@tap="onOpenPicker(2)"
|
||||
:border="false"
|
||||
>
|
||||
<template #icon>
|
||||
<text :class="{ 'color-text': formData.proName }" class="time-text">
|
||||
{{ formData.proName || '选择选项' }}
|
||||
</text>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-form-item>
|
||||
|
||||
<!-- 入场分包 -->
|
||||
<up-form-item label="入场分包" prop="subName" :borderBottom="true">
|
||||
<up-cell
|
||||
isLink
|
||||
size="large"
|
||||
style="width: 100%"
|
||||
@tap="onOpenPicker(3)"
|
||||
:border="false"
|
||||
>
|
||||
<template #icon>
|
||||
<text :class="{ 'color-text': formData.subName }" class="time-text">
|
||||
{{ formData.subName || '选择选项' }}
|
||||
</text>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-form-item>
|
||||
|
||||
<!-- 入场班组 -->
|
||||
<up-form-item label="入场班组" prop="teamName" :borderBottom="true">
|
||||
<up-cell
|
||||
isLink
|
||||
size="large"
|
||||
style="width: 100%"
|
||||
@tap="onOpenPicker(4)"
|
||||
:border="false"
|
||||
>
|
||||
<template #icon>
|
||||
<text
|
||||
:class="{ 'color-text': formData.teamName }"
|
||||
class="time-text"
|
||||
>
|
||||
{{ formData.teamName || '选择选项' }}
|
||||
</text>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="next-btn" ref="nextBtnRef">
|
||||
<up-button
|
||||
color="#909399"
|
||||
text="取消"
|
||||
@tap="onHandleCancel"
|
||||
style="margin-right: 10px"
|
||||
/>
|
||||
<up-button
|
||||
type="primary"
|
||||
text="提交"
|
||||
@tap="onHandleSubmit"
|
||||
style="margin-right: 10px"
|
||||
/>
|
||||
<up-button color="#67c23a" text="提交并继续添加" @tap="onHandleSubmitAndContinue" />
|
||||
</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>
|
||||
|
||||
<!-- 工种选择器 -->
|
||||
<up-picker
|
||||
:show="postPickerShow"
|
||||
closeOnClickOverlay
|
||||
@cancel="onCancelPost"
|
||||
@confirm="onConfirmPost"
|
||||
:columns="postPickerColumns"
|
||||
@close="postPickerShow = false"
|
||||
/>
|
||||
|
||||
<!-- 工程选择器 -->
|
||||
<up-picker
|
||||
:show="proPickerShow"
|
||||
@cancel="onCancelPro"
|
||||
closeOnClickOverlay
|
||||
@confirm="onConfirmPro"
|
||||
:columns="proPickerColumns"
|
||||
@close="proPickerShow = false"
|
||||
/>
|
||||
|
||||
<!-- 分包选择器 -->
|
||||
<up-picker
|
||||
:show="subPickerShow"
|
||||
@cancel="onCancelSub"
|
||||
closeOnClickOverlay
|
||||
@confirm="onConfirmSub"
|
||||
:columns="subPickerColumns"
|
||||
@close="subPickerShow = false"
|
||||
/>
|
||||
|
||||
<!-- 班组选择器 -->
|
||||
<up-picker
|
||||
:show="teamPickerShow"
|
||||
@cancel="onCancelTeam"
|
||||
closeOnClickOverlay
|
||||
@confirm="onConfirmTeam"
|
||||
:columns="teamPickerColumns"
|
||||
@close="teamPickerShow = false"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="addProject">
|
||||
import { ref, onMounted, nextTick } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import NavBarModal from '@/components/NavBarModal/index.vue'
|
||||
import {
|
||||
getPostTypeSelectListAPI,
|
||||
getSubSelectListByConditionAPI,
|
||||
getTeamSelectListByConditionAPI,
|
||||
getLotProjectSelectListByConditionAPI,
|
||||
} from '@/services/common'
|
||||
|
||||
const { safeAreaInsets } = uni.getSystemInfoSync()
|
||||
const navBarTitle = ref('添加入场数据')
|
||||
const paddingTop = ref(6) // 顶部padding
|
||||
const nextBtnRef = ref(null) // 下一步按钮ref
|
||||
const nextBtnHeight = ref(0) // 下一步按钮高度
|
||||
const formRef = ref(null) // 表单ref
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
// 表单数据
|
||||
const formData = ref({
|
||||
name: '张小刚', // 姓名
|
||||
idNumber: '430423197410120055', // 身份证号
|
||||
postId: '', // 工种ID
|
||||
postName: '', // 工种名称
|
||||
proId: '', // 入场工程ID
|
||||
proName: '', // 入场工程名称
|
||||
subId: '', // 入场分包ID
|
||||
subName: '', // 入场分包名称
|
||||
teamId: '', // 入场班组ID
|
||||
teamName: '', // 入场班组名称
|
||||
})
|
||||
|
||||
// 表单验证规则
|
||||
const formRules = ref({
|
||||
postName: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择工种',
|
||||
},
|
||||
],
|
||||
proName: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择入场工程',
|
||||
},
|
||||
],
|
||||
subName: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择入场分包',
|
||||
},
|
||||
],
|
||||
teamName: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择入场班组',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// 选择器相关
|
||||
const postPickerShow = ref(false) // 工种选择器
|
||||
const proPickerShow = ref(false) // 工程选择器
|
||||
const subPickerShow = ref(false) // 分包选择器
|
||||
const teamPickerShow = ref(false) // 班组选择器
|
||||
|
||||
const postPickerColumns = ref([[]]) // 工种选择器列
|
||||
const proPickerColumns = ref([[]]) // 工程选择器列
|
||||
const subPickerColumns = ref([[]]) // 分包选择器列
|
||||
const teamPickerColumns = ref([[]]) // 班组选择器列
|
||||
|
||||
// 打开选择器
|
||||
const onOpenPicker = (type) => {
|
||||
switch (type) {
|
||||
case 1:
|
||||
postPickerShow.value = true
|
||||
break
|
||||
case 2:
|
||||
proPickerShow.value = true
|
||||
break
|
||||
case 3:
|
||||
subPickerShow.value = true
|
||||
break
|
||||
case 4:
|
||||
teamPickerShow.value = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 工种确认
|
||||
const onConfirmPost = (e) => {
|
||||
formData.value.postName = e.value[0].text
|
||||
formData.value.postId = e.value[0].value
|
||||
postPickerShow.value = false
|
||||
}
|
||||
|
||||
// 工种取消
|
||||
const onCancelPost = () => {
|
||||
postPickerShow.value = false
|
||||
}
|
||||
|
||||
// 工程确认
|
||||
const onConfirmPro = (e) => {
|
||||
formData.value.proName = e.value[0].text
|
||||
formData.value.proId = e.value[0].value
|
||||
proPickerShow.value = false
|
||||
// 清空分包和班组选择
|
||||
formData.value.subName = ''
|
||||
formData.value.subId = ''
|
||||
formData.value.teamName = ''
|
||||
formData.value.teamId = ''
|
||||
// 重新获取分包列表
|
||||
getSubSelectListByCondition(e.value[0].value)
|
||||
}
|
||||
|
||||
// 工程取消
|
||||
const onCancelPro = () => {
|
||||
proPickerShow.value = false
|
||||
}
|
||||
|
||||
// 分包确认
|
||||
const onConfirmSub = (e) => {
|
||||
formData.value.subName = e.value[0].text
|
||||
formData.value.subId = e.value[0].value
|
||||
subPickerShow.value = false
|
||||
// 清空班组选择
|
||||
formData.value.teamName = ''
|
||||
formData.value.teamId = ''
|
||||
// 重新获取班组列表
|
||||
getTeamSelectListByCondition(e.value[0].value)
|
||||
}
|
||||
|
||||
// 分包取消
|
||||
const onCancelSub = () => {
|
||||
subPickerShow.value = false
|
||||
}
|
||||
|
||||
// 班组确认
|
||||
const onConfirmTeam = (e) => {
|
||||
formData.value.teamName = e.value[0].text
|
||||
formData.value.teamId = e.value[0].value
|
||||
teamPickerShow.value = false
|
||||
}
|
||||
|
||||
// 班组取消
|
||||
const onCancelTeam = () => {
|
||||
teamPickerShow.value = false
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onHandleSubmit = async () => {
|
||||
await submitData(false)
|
||||
}
|
||||
|
||||
// 提交并继续添加
|
||||
const onHandleSubmitAndContinue = async () => {
|
||||
await submitData(true)
|
||||
}
|
||||
|
||||
// 提交数据
|
||||
const submitData = async (isContinue) => {
|
||||
try {
|
||||
// 表单验证
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
|
||||
showLoading.value = true
|
||||
|
||||
// TODO: 这里需要调用实际的API提交数据
|
||||
// const result = await addProjectEntryAPI(formData.value)
|
||||
|
||||
// 模拟API调用
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000))
|
||||
|
||||
showLoading.value = false
|
||||
|
||||
// 模拟成功响应
|
||||
const result = { code: 200, msg: '提交成功' }
|
||||
|
||||
if (result.code === 200) {
|
||||
uni.$u.toast(result.msg)
|
||||
|
||||
if (isContinue) {
|
||||
// 重置表单,保留姓名和身份证号
|
||||
formData.value = {
|
||||
name: formData.value.name,
|
||||
idNumber: formData.value.idNumber,
|
||||
postId: '',
|
||||
postName: '',
|
||||
proId: '',
|
||||
proName: '',
|
||||
subId: '',
|
||||
subName: '',
|
||||
teamId: '',
|
||||
teamName: '',
|
||||
}
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('提交失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取工种列表
|
||||
const getPostTypeSelectList = async () => {
|
||||
try {
|
||||
const { rows: res } = await getPostTypeSelectListAPI()
|
||||
if (res && res.length > 0) {
|
||||
postPickerColumns.value[0] = res.map((item) => {
|
||||
return {
|
||||
text: item.postName,
|
||||
value: item.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工种列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取工程列表
|
||||
const getLotProjectSelectListByCondition = async () => {
|
||||
try {
|
||||
const { data: res } = await getLotProjectSelectListByConditionAPI({})
|
||||
if (res && res.length > 0) {
|
||||
proPickerColumns.value[0] = res.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取工程列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取分包列表
|
||||
const getSubSelectListByCondition = async (proId) => {
|
||||
try {
|
||||
const { data: res } = await getSubSelectListByConditionAPI({ proId })
|
||||
if (res && res.length > 0) {
|
||||
subPickerColumns.value[0] = res.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
subPickerColumns.value[0] = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取分包列表失败:', error)
|
||||
subPickerColumns.value[0] = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班组列表
|
||||
const getTeamSelectListByCondition = async (subId) => {
|
||||
try {
|
||||
const { data: res } = await getTeamSelectListByConditionAPI({ subId })
|
||||
if (res && res.length > 0) {
|
||||
teamPickerColumns.value[0] = res.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
teamPickerColumns.value[0] = []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取班组列表失败:', error)
|
||||
teamPickerColumns.value[0] = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取按钮高度
|
||||
const getButtonHeight = () => {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query
|
||||
.select('.next-btn')
|
||||
.boundingClientRect((data) => {
|
||||
if (data) {
|
||||
nextBtnHeight.value = data.height
|
||||
}
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
getButtonHeight()
|
||||
})
|
||||
// 初始化数据
|
||||
getPostTypeSelectList()
|
||||
getLotProjectSelectListByCondition()
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
// 从页面参数中获取姓名和身份证号
|
||||
if (options?.name) {
|
||||
formData.value.name = options.name
|
||||
}
|
||||
if (options?.idCard) {
|
||||
formData.value.idNumber = options.idCard
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.add-project-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.instruction-section {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #fff2f0;
|
||||
border-left: 6rpx solid #ff4d4f;
|
||||
margin: 0 30rpx 0;
|
||||
|
||||
.instruction-text {
|
||||
color: #ff4d4f;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.form-container {
|
||||
flex: 1;
|
||||
margin-top: 20rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.next-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-top: 1rpx solid #e4e7ed;
|
||||
|
||||
::v-deep .u-button {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.color-text {
|
||||
color: rgb(48, 49, 51) !important;
|
||||
}
|
||||
|
||||
.time-text {
|
||||
color: rgb(192, 196, 204);
|
||||
}
|
||||
|
||||
::v-deep .u-cell__body {
|
||||
padding: 13px 0;
|
||||
}
|
||||
|
||||
::v-deep .u-form-item {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field::placeholder {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<template>
|
||||
<!-- 上海多工程设置明细 -->
|
||||
<view class="person-exit">
|
||||
<view style="margin: 20rpx 0">
|
||||
<up-button type="primary" text="新增入场工程" @tap="onHandleAddProject" />
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y @scrolltolower="onHandleScrollToLower" class="person-exit-content">
|
||||
<view :key="item.id" class="person-exit-item" v-for="(item, index) in shProjectList">
|
||||
<view class="person-exit-item-header">
|
||||
<text class="index-text"> {{ index + 1 }} </text>
|
||||
<text> {{ item.name }}</text>
|
||||
</view>
|
||||
|
||||
<view class="common-info common-info-1">
|
||||
<view>
|
||||
<text class="label-text">工种</text>
|
||||
<text>{{ item.postName }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label-text">联系方式</text>
|
||||
<text>{{ item.phone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="common-info">
|
||||
<text class="label-text">身份证</text>
|
||||
<text class="value-text">{{ item.idNumber }}</text>
|
||||
</view>
|
||||
<view class="common-info">
|
||||
<text class="label-text">所属工程</text>
|
||||
<text class="value-text">{{ item.proName }}</text>
|
||||
</view>
|
||||
<view class="common-info">
|
||||
<text class="label-text">所属分包</text>
|
||||
<text class="value-text">{{ item.subName }}</text>
|
||||
</view>
|
||||
<view class="common-info">
|
||||
<text class="label-text">所属班组</text>
|
||||
<text class="value-text">{{ item.teamName }}</text>
|
||||
</view>
|
||||
<view class="common-info">
|
||||
<text class="label-text">入场时间</text>
|
||||
<text class="value-text">{{ item.einTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="loading-text">
|
||||
{{ !hasMore ? '没有更多数据了~' : '正在加载...' }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="ShProjectDetails">
|
||||
import { debounce } from 'lodash-es'
|
||||
import { ref, computed, onMounted, nextTick } from 'vue'
|
||||
import { getShProjectListByWorkerIdAPI } from '@/services/shProjectSetting'
|
||||
import { useCommonStore } from '@/stores'
|
||||
|
||||
import Empty from '@/static/image/Empty.png'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
const shProjectList = ref([]) // 出场人员列表
|
||||
const total = ref(0) // 总条数
|
||||
const commonStore = useCommonStore() // 工程信息
|
||||
const workerId = ref('') // 人员ID
|
||||
const name = ref('') // 姓名
|
||||
const idCardNumber = ref('') // 身份证号码
|
||||
|
||||
// 获取上海多工程明细
|
||||
const getShProjectDetailsListFun = async () => {
|
||||
const res = await getShProjectListByWorkerIdAPI({
|
||||
workerId: workerId.value,
|
||||
})
|
||||
|
||||
// total.value = res?.total
|
||||
shProjectList.value = [...shProjectList.value, ...res?.rows]
|
||||
}
|
||||
|
||||
// 新增入场工程
|
||||
const onHandleAddProject = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/shProjectDetails/child-pages/addProject?workerId=${workerId.value}&name=${name.value}&idCard=${idCardNumber.value}`,
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getShProjectDetailsListFun()
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
console.log(options, 'options')
|
||||
workerId.value = options?.workerId
|
||||
name.value = options?.name
|
||||
idCardNumber.value = options?.idCard
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.person-exit {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.search-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
.status-select {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #e5e5e5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .u-select__content .u-select__options__wrap {
|
||||
top: 30px !important;
|
||||
right: -30px !important;
|
||||
}
|
||||
|
||||
.person-exit-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
|
||||
.person-exit-item {
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
border: 1px solid #e5e5e5;
|
||||
box-shadow: 0 0 10rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||
font-size: 14px;
|
||||
|
||||
.person-exit-item-header {
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.index-text {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 60rpx;
|
||||
width: 50rpx;
|
||||
margin-right: 60rpx;
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 60rpx;
|
||||
border-top-left-radius: 10rpx;
|
||||
border-bottom-left-radius: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.index-text::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -24rpx; /* 三角形宽度的一半 */
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 30rpx solid transparent; /* 高度的一半 */
|
||||
border-bottom: 30rpx solid transparent; /* 高度的一半 */
|
||||
border-left: 30rpx solid #409eff; /* 三角形宽度 */
|
||||
}
|
||||
|
||||
& text:last-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.common-info {
|
||||
padding: 20rpx 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.common-info-1 view {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.label-text {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.value-text {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
// 根据身份证查询该人员是否已经存在上海内工程
|
||||
export const getShProjectSettingByIdNumberAPI = (data) => {
|
||||
return http({
|
||||
method: 'POSt',
|
||||
url: `/bmw/worker/selectByIdNumber/${data.idNumber}`,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据人员ID获取上海工程列表
|
||||
export const getShProjectListByWorkerIdAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: `/bmw/worker/einListByWorkerId`,
|
||||
data,
|
||||
})
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Loading…
Reference in New Issue