Merge remote-tracking branch 'origin/main'

This commit is contained in:
luozhun 2024-09-14 14:16:35 +08:00
commit b421a1f4c3
4 changed files with 57 additions and 67 deletions

View File

@ -4,7 +4,7 @@
<nut-form-item label="姓名" prop="name">
<nut-input v-model="formData.name" placeholder="请输入姓名" type="text" />
</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 v-for="item in SEX" :key="item.value" :label="item.value"
>{{ item.label }}
@ -15,7 +15,8 @@
<nut-input v-model="formData.idCard" placeholder="请填写身份证" type="text" @blur="idCardBlur"/>
</nut-form-item>
<nut-form-item label="出生日期" prop="dateOfBirth" >
<nut-input @click="openDate" :disabled="true" v-model="formData.dateOfBirth" placeholder="请填写身份证" type="text" />
{{formData.dateOfBirth || "请填写出生年月"}}
<!-- <nut-input @click="openDate" :disabled="true" placeholder="请填写出生年月" type="text">{{formData.dateOfBirth}}</nut-input>-->
</nut-form-item>
<nut-form-item label="工作岗位" prop="workPost">
<nut-input v-model="formData.workPost" placeholder="请输入工作岗位" type="text" />
@ -50,38 +51,22 @@
</view>
</template>
<script setup lang="ts">
import {onMounted, ref, watch} from "vue";
import {ref} from "vue";
import {SEX} from "@/enums";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import api from "@/request";
import './form.scss'
import Taro, {useLoad} from "@tarojs/taro";
import {formDate} from "../../../../types/pages/form";
const showPicker = ref(false)
const formData = ref<formDate>({
snowFlakeId:'',
name: '',
workPost:'',
sex:0,
nativePlace:'',
idCard:'',
dateOfBirth:'',
securityNumber:'',
remark:'',
homeAddress: ''
})
const serviceProjectId = ref('') //id
const formData = ref<formDate>(null!)
const pickerValue = ref(new Date())
const formRef = ref(null)
const rules: FormRules = {
name: [
{ required: true, message: "请输入姓名" },
{
validator: (value) => {
return !(value.length < 2 || value.length >= 20);
},
message: "名字在2~20字符之间",
},
],
sex: [{ required: true, message: "请选择性别" }],
idCard:[
@ -95,19 +80,14 @@ const rules: FormRules = {
useLoad((options)=>{
formData.value = JSON.parse(options.item)
serviceProjectId.value = JSON.parse(options.item).snowFlakeId
console.log(serviceProjectId.value)
})
watch(()=>formData.value,(res)=>{
console.log(res)
console.log(formData.value,'888')
})
const openDate = ()=>{
showPicker.value = true
}
const confirm = ({selectedValue })=>{
showPicker.value = false
formData.value.dateOfBirth =selectedValue[0] + '年' + selectedValue[1] +'月' + selectedValue[2] + ' 日'
formData.value.dateOfBirth = selectedValue[0] + '年' + selectedValue[1] +'月' + selectedValue[2] + ' 日'
}
const reset = () => {
formRef.value?.reset()
@ -119,26 +99,20 @@ const idCardBlur = (e:string)=>{
const month = birthDate.substring(4, 6);
const day = birthDate.substring(6, 8);
//
formData.value.dateOfBirth = `${year}${month}${day}`
pickerValue.value = new Date(parseInt(year),parseInt(month) - 1,parseInt(day))
formData.value.dateOfBirth = new Date(parseInt(year),parseInt(month) - 1,parseInt(day))
}
const snowFlakeId = ref<string>('')
const submit = () => {
formRef.value?.validate().then(({valid, errors}) => {
if (valid) {
const saveOrUpdateSecurityUserParams = {
serviceProjectId:serviceProjectId.value,
name: formData.value.name,
workPost:formData.value.workPost,
sex:formData.value.sex,
nativePlace: formData.value.nativePlace,
idCard: formData.value.idCard,
dateOfBirth: pickerValue.value,
securityNumber: formData.value.securityNumber,
homeAddress: formData.value.homeAddress,
remark: formData.value.remark
if(formData.value.snowFlakeId === ''){
snowFlakeId.value = ''
}else{
snowFlakeId.value = formData.value.snowFlakeId as any
}
const resp = api.post('/projectManageIndex/saveOrUpdateSecurityUser',saveOrUpdateSecurityUserParams)
const resp = api.post('/projectManageIndex/saveOrUpdateSecurityUser',formData.value)
Taro.showToast({
title: '项目人员录入成功',
icon: 'success',
@ -147,8 +121,10 @@ const submit = () => {
}).then()
formData.value = {
snowFlakeId:'',
serviceProjectId:formData.value.serviceProjectId,
name: '',
workPost:'',
telephone:'',
sex:0,
nativePlace:'',
idCard:'',

View File

@ -9,7 +9,7 @@
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
</view>
<view style="display: flex;justify-content: space-between">
<text>项目负责{{ item?.contactPersonInfo.name }}</text>
<text>联系{{ item?.contactPersonInfo.name }}</text>
<text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view>
<view class="project">

View File

@ -3,12 +3,12 @@
<view class="projectDetailsItem" style="line-height: 50rpx">
<view>
<view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + serviceProjectDetails?.name }}项目</text>
<text>进行中</text>
</view>
<view>
<view style="float: left;width: 50%;" class="content">经理名称:{{ detailsList?.projectManagerMiniProgramUserInfo.name }}</view>
<view class="content">手机号:{{ detailsList?.projectManagerMiniProgramUserInfo.telephone }}</view>
<view style="float: left;width: 50%;" class="content">经理名称:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.name }}</view>
<view class="content">手机号:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view>
</view>
</view>
@ -16,28 +16,28 @@
<view class="projectDetailsIndex">
<nut-row>
<nut-col :span="24">
<view class="content">保安证件号{{ detailsList?.idNumber }}</view>
<view class="content">保安证件号{{ serviceProjectDetails?.idNumber }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
<view class="content">工作人员数量:{{ serviceProjectDetails?.staffTotal }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">保安人员数量:{{ detailsList?.securityUserTotal }}</view>
<view class="content">保安人员数量:{{ serviceProjectDetails?.securityUserTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="12">
<view class="content">服务区域面积:{{ detailsList?.serviceArea }}</view>
<view class="content">服务区域面积:{{ serviceProjectDetails?.serviceArea }}</view>
</nut-col>
<nut-col :span="12">
<view class="content">楼栋数量:{{ detailsList?.buildingTotal }}</view>
<view class="content">楼栋数量:{{ serviceProjectDetails?.buildingTotal }}</view>
</nut-col>
</nut-row>
<nut-row>
<nut-col :span="4">
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
<view class="content">户数:{{ serviceProjectDetails?.houseTotal }}</view>
</nut-col>
</nut-row>
</view>
@ -110,19 +110,18 @@ import './projectDetails.scss'
import {ref} from "vue";
import api from "@/request/index";
import * as dayjs from 'dayjs'
import {type} from "os";
const detailsList = ref()
const serviceProjectDetails = ref()
const nameValue = ref('')
const projectData = ref<Records[]>([])
const content = ref<Records>({} as any)
//
const confirmVisible = ref(false);
const detailVisible = ref(false)
useLoad(async (options: MyProjectList) => {
console.log(JSON.parse(options.item),'111111111111',options.name)
nameValue.value = options.name
detailsList.value = await JSON.parse(options.item)
serviceProjectDetails.value = await JSON.parse(options.item)
})
useDidShow(async () => {
initServiceProjectSecurityUserList()
@ -133,7 +132,7 @@ const projectDetailsTable = async () => {
})
const queryParams = {
params: {
serviceProjectId: detailsList.value?.snowFlakeId,
serviceProjectId: serviceProjectDetails.value?.snowFlakeId,
},
page: {
size: 4,
@ -147,7 +146,20 @@ const projectDetailsTable = async () => {
Taro.hideLoading()
}
const formAdd = () => {
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(detailsList.value)}`})
const params = {
serviceProjectId:serviceProjectDetails.value.snowFlakeId,
snowFlakeId:'',
name: '',
workPost:'',
sex:0,
nativePlace:'',
idCard:'',
dateOfBirth:'',
securityNumber:'',
remark:'',
homeAddress: ''
}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
}
const total = ref<any>(null)
const current = ref(1)
@ -182,7 +194,6 @@ const deleteUssrID = (snowFlakeId:string)=>{
confirmVisible.value = true
securityUserId.value = snowFlakeId
}
//
const dialogOk = async ()=>{
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`,{securityUserId:securityUserId.value},{
@ -193,15 +204,14 @@ const dialogOk = async ()=>{
initServiceProjectSecurityUserList()
}
//
const detail = (item)=>{
detailVisible.value = true
content.value = item
}
const projectEdit = (item)=>{
console.log(111)
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(item)}`})
const params = {...item,sex:item.sex.value}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`})
}
</script>

View File

@ -1,11 +1,15 @@
interface formDate {
snowFlakeId?:string;
name: string;
import {Dayjs} from "dayjs";
export interface formDate {
snowFlakeId?: string;
serviceProjectId: string;
name?: string;
workPost?:string;
telephone?: string;
sex:number;
nativePlace?:string;
idCard:string;
dateOfBirth?:string;
dateOfBirth?:Dayjs;
securityNumber?:string;
remark?:string;
homeAddress?: string