小程序保安录入增加新字段

This commit is contained in:
wangyilin 2024-12-19 14:15:46 +08:00
parent 79b50df5ac
commit bbec0065eb
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

@ -38,6 +38,11 @@
<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>
<nut-form-item label="文化程度" prop="educationLevel">
<view @click="showBottom = true" >
{{educationLevelValue?educationLevelValue:'请选择文化程度'}}
</view>
</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>
@ -71,12 +76,25 @@
<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">
@ -95,6 +113,7 @@ 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,6 +122,8 @@ 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: '请输入姓名'}],
@ -115,11 +136,23 @@ const rules: FormRules = {
}, },
], ],
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
}) })
} }
}) })
@ -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{