Merge remote-tracking branch 'origin/main'

This commit is contained in:
luozhun 2024-12-19 14:29:35 +08:00
commit c5f5f1df97
5 changed files with 105 additions and 59 deletions

View File

@ -9,6 +9,7 @@ type EnumType =
| 'Sex' | 'Sex'
| 'ServiceProjectType' | 'ServiceProjectType'
| 'MiniProgramUserIdentity' | 'MiniProgramUserIdentity'
| 'EducationLevel'
export const initEnum = () => { export const initEnum = () => {
api.get<Record<EnumType, SelectNodeVo<any>[]>>('/common/enums').then(resp => { api.get<Record<EnumType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {

View File

@ -96,10 +96,11 @@
<nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible"> <nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible">
<slot> <slot>
<view style="margin-bottom: 5px"> <view style="margin-bottom: 5px">
<view>籍贯{{ securityUserDetail.nativePlace }}</view> <view>籍贯{{ securityUserDetail?.nativePlace }}</view>
<view>公司{{ securityUserDetail.securityUnitName }}</view> <view>公司{{ securityUserDetail?.securityUnitName }}</view>
<view>家庭地址{{ securityUserDetail.homeAddress }}</view> <view>家庭地址{{ securityUserDetail?.homeAddress }}</view>
<view>备注{{ securityUserDetail.remark }}</view> <view>文化程度{{ securityUserDetail.educationLevel?.label }}</view>
<view>备注{{ securityUserDetail?.remark }}</view>
</view> </view>
</slot> </slot>
</nut-dialog> </nut-dialog>
@ -240,7 +241,7 @@ const detail = (item: ServiceProjectSecurityUserPagerVo) => {
} }
const securityUserEdit = (item: ServiceProjectSecurityUserPagerVo) => { const securityUserEdit = (item: ServiceProjectSecurityUserPagerVo) => {
console.log(item) console.log(item)
const params = {...item, sex: item.sex.value} const params = {...item, sex: item.sex.value,educationLevel:item.educationLevel}
Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&type=formInput`}) Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&type=formInput`})
} }

View File

@ -1,13 +1,13 @@
<template> <template>
<view class="form"> <view class="form">
<nut-form ref="formRef" :model-value="formData" :rules="rules"> <nut-form ref="formRef" :model-value="formData" :rules="rules">
<nut-form-item label="头像" prop="avatar"> <nut-form-item label="头像" prop="avatar">
<!-- <view class="uploadPictures" @click="chooseImage">--> <!-- <view class="uploadPictures" @click="chooseImage">-->
<!-- <view v-if="!formData.photo">--> <!-- <view v-if="!formData.photo">-->
<!-- <IconFont name="uploader" size="25" color="#98a7b0"></IconFont>--> <!-- <IconFont name="uploader" size="25" color="#98a7b0"></IconFont>-->
<!-- </view>--> <!-- </view>-->
<!-- <image v-else :src="minioBaseUrl +formData.photo" style="width: 100%; height: 100%"></image>--> <!-- <image v-else :src="minioBaseUrl +formData.photo" style="width: 100%; height: 100%"></image>-->
<!-- </view>--> <!-- </view>-->
<view @click="chooseImage" size> <view @click="chooseImage" size>
<image v-if="!formData.photo" src="@/assets/logo/avatar1.png" style="width: 50px; height: 50px"></image> <image v-if="!formData.photo" src="@/assets/logo/avatar1.png" style="width: 50px; height: 50px"></image>
<image v-else :src="minioBaseUrl +formData.photo" style="width: 160px; height: 128px"></image> <image v-else :src="minioBaseUrl +formData.photo" style="width: 160px; height: 128px"></image>
@ -15,16 +15,16 @@
</nut-form-item> </nut-form-item>
<nut-form-item label="身份证" prop="idCard"> <nut-form-item label="身份证" prop="idCard">
<view style="display: flex; justify-content: space-between; align-items: center"> <view style="display: flex; justify-content: space-between; align-items: center">
<nut-input v-model="formData.idCard" placeholder="请填写身份证" type="text" @blur="cardBlur" /> <nut-input v-model="formData.idCard" placeholder="请填写身份证" type="text" @blur="cardBlur"/>
<view style="color: #3a6bbe; width: 70px; text-align: center" @click="idCardBlur(formData, 0)">查询</view> <view style="color: #3a6bbe; width: 70px; text-align: center" @click="idCardBlur(formData, 0)">查询</view>
</view> </view>
</nut-form-item> </nut-form-item>
<nut-form-item label="姓名" prop="name"> <nut-form-item label="姓名" prop="name">
<nut-input v-model="formData.name" placeholder="请输入姓名" type="text" /> <nut-input v-model="formData.name" placeholder="请输入姓名" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="性别" prop="sex"> <nut-form-item label="性别" prop="sex">
<nut-radio-group v-model="formData.sex" direction="horizontal"> <nut-radio-group v-model="formData.sex" direction="horizontal">
<nut-radio v-for="item in SEX" :key="item.value" :label="item.value">{{ item.label }} </nut-radio> <nut-radio v-for="item in SEX" :key="item.value" :label="item.value">{{ item.label }}</nut-radio>
</nut-radio-group> </nut-radio-group>
</nut-form-item> </nut-form-item>
<nut-form-item label="出生日期" prop="dateOfBirth"> <nut-form-item label="出生日期" prop="dateOfBirth">
@ -33,25 +33,30 @@
</view> </view>
</nut-form-item> </nut-form-item>
<nut-form-item label="工作岗位" prop="workPost"> <nut-form-item label="工作岗位" prop="workPost">
<nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text" /> <nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="手机号" prop="telephone"> <nut-form-item label="手机号" prop="telephone">
<nut-input v-model="formData.telephone" placeholder="请输入手机号" type="text" /> <nut-input v-model="formData.telephone" placeholder="请输入手机号" type="text"/>
</nut-form-item>
<nut-form-item label="文化程度" prop="educationLevel">
<view @click="showBottom = true" >
{{educationLevelValue?educationLevelValue:'请选择文化程度'}}
</view>
</nut-form-item> </nut-form-item>
<nut-form-item label="籍贯" prop="nativePlace"> <nut-form-item label="籍贯" prop="nativePlace">
<nut-input v-model="formData.nativePlace" placeholder="请输入籍贯" type="text" /> <nut-input v-model="formData.nativePlace" placeholder="请输入籍贯" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="地址" prop="homeAddress"> <nut-form-item label="地址" prop="homeAddress">
<nut-input v-model="formData.homeAddress" placeholder="请输入地址" type="text" /> <nut-input v-model="formData.homeAddress" placeholder="请输入地址" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="保安证件号" prop="securityNumber"> <nut-form-item label="保安证件号" prop="securityNumber">
<nut-input v-model="formData.securityNumber" placeholder="请输入保安证号" type="text" /> <nut-input v-model="formData.securityNumber" placeholder="请输入保安证号" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="无证说明" v-if="!formData.securityNumber"> <nut-form-item label="无证说明" v-if="!formData.securityNumber">
<nut-input v-model="formData.noSecurityNumberDesc" placeholder="无证说明" type="text" /> <nut-input v-model="formData.noSecurityNumberDesc" placeholder="无证说明" type="text"/>
</nut-form-item> </nut-form-item>
<nut-form-item label="备注" prop="remark"> <nut-form-item label="备注" prop="remark">
<nut-input v-model="formData.remark" placeholder="请填写备注" type="text" /> <nut-input v-model="formData.remark" placeholder="请填写备注" type="text"/>
</nut-form-item> </nut-form-item>
</nut-form> </nut-form>
<view class="formButton"> <view class="formButton">
@ -71,30 +76,44 @@
<nut-dialog content="详情" v-model:visible="visible" @ok="onOk" @cancel="cancel"> <nut-dialog content="详情" v-model:visible="visible" @ok="onOk" @cancel="cancel">
<slot> <slot>
<view style="margin-bottom: 5px"> <view style="margin-bottom: 5px">
<view>姓名{{ securityNumberByIdCard.name ? securityNumberByIdCard.name : '无' }}</view> <view>姓名{{ securityNumberByIdCard?.name ? securityNumberByIdCard.name : '无' }}</view>
<view>保安证件号{{ securityNumberByIdCard?.bayzh ? securityNumberByIdCard?.bayzh : '无' }}</view> <view>保安证件号{{ securityNumberByIdCard?.bayzh ? securityNumberByIdCard?.bayzh : '无' }}</view>
<view>身份证{{ securityNumberByIdCard?.sfzhm ? securityNumberByIdCard?.sfzhm : '无' }}</view> <view>身份证{{ securityNumberByIdCard?.sfzhm ? securityNumberByIdCard?.sfzhm : '无' }}</view>
</view> </view>
</slot> </slot>
</nut-dialog> </nut-dialog>
<nut-popup v-model:visible="showBottom" position="bottom" :style="{ height: '40%' }">
<nut-picker
:columns="columns"
:field-names="{
text: 'label',
value: 'value',
children: 'extData'
}"
title="学历选择"
@confirm="confirm"
@cancel="showBottom = false"
/>
</nut-popup>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import {ref} from 'vue'
import { enumSelectNodes } from '@/enums' import {enumSelectNodes} from '@/enums'
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types' import {FormRules} from '@nutui/nutui-taro/dist/types/__VUE/form/types'
import api from '@/request' import api from '@/request'
import './securityUserForm.scss' import './securityUserForm.scss'
import Taro, { useLoad } from '@tarojs/taro' import Taro, {useLoad} from '@tarojs/taro'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { SecurityUserFormParams, securityNumberByIdCard } from '@/types/subPages/projectManager/securityUserForm' import {SecurityUserFormParams, securityNumberByIdCard} from '@/types/subPages/projectManager/securityUserForm'
import { FormInstance } from '@nutui/nutui-taro' import {FormInstance} from '@nutui/nutui-taro'
import { generateSimpleObjectName, getResignedObjectUrl } from '@/utils' import {generateSimpleObjectName, getResignedObjectUrl} from '@/utils'
const SEX:any = enumSelectNodes('Sex') const SEX: any = enumSelectNodes('Sex')
const minioBaseUrl = process.env.TARO_APP_MINIO_URL const minioBaseUrl = process.env.TARO_APP_MINIO_URL
const BUCKET = process.env.TARO_APP_MINIO_BUCKET const BUCKET = process.env.TARO_APP_MINIO_BUCKET
const showPicker = ref(false) const showPicker = ref(false)
const showBottom = ref(false)
const Url = ref('') const Url = ref('')
const type = ref<'formInput' | 'QcCodeInput'>(null!) const type = ref<'formInput' | 'QcCodeInput'>(null!)
const formData = ref<SecurityUserFormParams>({} as any) const formData = ref<SecurityUserFormParams>({} as any)
@ -103,23 +122,37 @@ const visible = ref<boolean>(false)
const securityNumberByIdCard = ref<securityNumberByIdCard | any>() const securityNumberByIdCard = ref<securityNumberByIdCard | any>()
const uploadRef = ref<any>(null) const uploadRef = ref<any>(null)
const modelValue = ref('') const modelValue = ref('')
const columns: any = enumSelectNodes('EducationLevel')
const rules: FormRules = { const rules: FormRules = {
name: [{ required: true, message: '请输入姓名' }], name: [{required: true, message: '请输入姓名'}],
sex: [{ required: true, message: '请选择性别' }], sex: [{required: true, message: '请选择性别'}],
idCard: [ idCard: [
{ required: true, message: '请输入身份证号' }, {required: true, message: '请输入身份证号'},
{ {
regex: /^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))((0[1-9])|([12][0-9])|(30|31))\d{3}(\d|X)$)/, regex: /^(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))((0[1-9])|([12][0-9])|(30|31))\d{3}(\d|X)$)/,
message: '身份证格式错误', message: '身份证格式错误',
}, },
], ],
telephone: [{ required: true, message: '请输入手机号' }], telephone: [{required: true, message: '请输入手机号'}],
educationLevel:[{required: true, message: '请选择文化程度'}]
} }
const educationLevelValue = ref('')
//
const confirm = ({selectedOptions}) => {
Object.keys(selectedOptions).forEach((item:any,index:number)=>{
console.log(item)
educationLevelValue.value = selectedOptions[index].label
formData.value.educationLevel = selectedOptions[index].value
})
showBottom.value = false
}
useLoad((options) => { useLoad((options) => {
type.value = options.type type.value = options.type
if (type.value === 'QcCodeInput') { if (type.value === 'QcCodeInput') {
console.log(1111)
formData.value = { formData.value = {
name: '', name: '',
serviceProjectId: options.pid, serviceProjectId: options.pid,
@ -130,13 +163,16 @@ useLoad((options) => {
dateOfBirth: null, dateOfBirth: null,
noSecurityNumberDesc: options.noSecurityNumberDesc, noSecurityNumberDesc: options.noSecurityNumberDesc,
photo: '', photo: '',
educationLevel: ''
} }
} else { } else {
const form = JSON.parse(options.securityUser) const form = JSON.parse(options.securityUser)
educationLevelValue.value = form.educationLevel.label
formData.value = Object.assign({}, form, { formData.value = Object.assign({}, form, {
idCard: form.idCard.originalValue, idCard: form.idCard.originalValue,
telephone: form.telephone.originalValue, telephone: form.telephone.originalValue,
photo: form.photo photo: form.photo,
educationLevel: form.educationLevel.value
}) })
} }
}) })
@ -144,31 +180,31 @@ useLoad((options) => {
const idCardBlur = async (e: any, num: number) => { const idCardBlur = async (e: any, num: number) => {
const value = e.idCard const value = e.idCard
if (value) { if (value) {
if(BUCKET === 'police-security-dev'){ if (BUCKET === 'police-security-dev') {
Taro.request({ Taro.request({
url: 'https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard', url: 'https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard',
data: { data: {
idCard: value, idCard: value,
}, },
method: 'GET', method: 'GET',
success: ({ data }) => { success: ({data}) => {
console.log(data.data) console.log(data.data)
visible.value = true visible.value = true
securityNumberByIdCard.value = data.data securityNumberByIdCard.value = data.data
}, },
}) })
}else{ } else {
const resp = await api.get('/common/querySecurityNumberByIdCard',{ idCard: value}) const resp = await api.get('/common/querySecurityNumberByIdCard', {idCard: value})
visible.value = true visible.value = true
securityNumberByIdCard.value = resp?.data securityNumberByIdCard.value = resp?.data
} }
} else { } else {
visible.value = false visible.value = false
} }
cardBlur(value, num) cardBlur(value, num)
} }
const cardBlur = (e:any, num:number) => { const cardBlur = (e: any, num: number) => {
let value: string let value: string
if (num === 0) { if (num === 0) {
value = e value = e
@ -201,10 +237,10 @@ const chooseImage = () => {
count: 1, // count: 1, //
mediaType: ['image', 'video'], mediaType: ['image', 'video'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
sizeType:['original', 'compressed'], sizeType: ['original', 'compressed'],
camera: 'front', camera: 'front',
success: async (res) => { success: async (res) => {
Url.value = res.tempFiles[0].tempFilePath Url.value = res.tempFiles[0].tempFilePath
const objectName = generateSimpleObjectName(Url.value, '/securityUser') const objectName = generateSimpleObjectName(Url.value, '/securityUser')
const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName) const uploadUrl = await getResignedObjectUrl(process.env.TARO_APP_MINIO_BUCKET, objectName)
@ -236,7 +272,7 @@ const chooseImage = () => {
} }
const submit = () => { const submit = () => {
formData.value.photo = modelValue.value formData.value.photo = modelValue.value
formRef.value?.validate().then(async ({ valid }) => { formRef.value?.validate().then(async ({valid}) => {
if (valid) { if (valid) {
let url: string let url: string
if (type.value === 'formInput') { if (type.value === 'formInput') {
@ -244,6 +280,7 @@ const submit = () => {
} else { } else {
url = '/mp/user/qrCodeFormInputSecurityUser' url = '/mp/user/qrCodeFormInputSecurityUser'
} }
console.log(formData.value)
const resp = await api.post(url, formData.value) const resp = await api.post(url, formData.value)
Taro.showToast({ Taro.showToast({
title: resp.message, title: resp.message,
@ -267,7 +304,9 @@ const submit = () => {
homeAddress: '', homeAddress: '',
noSecurityNumberDesc: '', noSecurityNumberDesc: '',
photo: '', photo: '',
educationLevel: ''
} }
educationLevelValue.value = ''
uploadRef.value?.clearUploadQueue() uploadRef.value?.clearUploadQueue()
} }
}) })

View File

@ -62,5 +62,9 @@ export interface ServiceProjectSecurityUserPagerVo {
snowFlakeId: string; snowFlakeId: string;
workPost?: string; workPost?: string;
sex: BaseEnum<number> sex: BaseEnum<number>
educationLevel:{
label:string,
value:string
}
} }

View File

@ -13,7 +13,8 @@ export interface SecurityUserFormParams {
photo?:string; photo?:string;
remark?: string; remark?: string;
noSecurityNumberDesc:string; noSecurityNumberDesc:string;
homeAddress?: string homeAddress?: string;
educationLevel:string
} }
export interface value{ export interface value{