2026-01-04 11:09:06 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="jnpf-wrap personalData">
|
|
|
|
|
<view style="background-color: #fff;" class="u-p-l-20 u-p-r-20">
|
|
|
|
|
<u-form :model="dataForm" :errorType="['toast']" label-position="left" label-width="150" label-align="right"
|
|
|
|
|
ref="dataForm">
|
2026-01-22 11:01:19 +08:00
|
|
|
<u-form-item label="姓名" prop='nickname' required>
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.nickname" :disabled="isDisabled" placeholder="请输入"></u-input>
|
2026-01-04 11:09:06 +08:00
|
|
|
</u-form-item>
|
2026-01-22 11:01:19 +08:00
|
|
|
<!-- <u-form-item label="民族">
|
2026-01-04 11:09:06 +08:00
|
|
|
<JnpfSelect v-model="dataForm.nation" placeholder="请选择" :options='nationOptions' />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="性别">
|
|
|
|
|
<JnpfSelect v-model="dataForm.gender" placeholder="请选择" :options='genderOptions' :props='props' />
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<!-- <u-form-item label="籍贯">
|
2026-01-04 11:09:06 +08:00
|
|
|
<u-input input-align='right' v-model="dataForm.nativePlace" placeholder="请输入"></u-input>
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<!-- <u-form-item label="证件类型">
|
2026-01-04 11:09:06 +08:00
|
|
|
<JnpfSelect v-model="dataForm.certificatesType" placeholder="请选择"
|
|
|
|
|
:options='certificatesTypeOptions' />
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<!-- <u-form-item label="证件号码">
|
2026-01-04 11:09:06 +08:00
|
|
|
<u-input input-align='right' v-model="dataForm.certificatesNumber" placeholder="请输入">
|
|
|
|
|
</u-input>
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<!-- <u-form-item label="文化程度">
|
2026-01-04 11:09:06 +08:00
|
|
|
<JnpfSelect v-model="dataForm.education" placeholder="请选择" :options='educationOptions' />
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<!-- <u-form-item label="出生年月">
|
2026-01-04 11:09:06 +08:00
|
|
|
<JnpfDatePicker v-model="dataForm.birthday" placeholder="请选择" />
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
|
|
|
|
<u-form-item label="性别">
|
|
|
|
|
<JnpfSelect v-model="dataForm.sex" placeholder="请选择" :disabled="isDisabled" :options='genderOptions' :props='props' />
|
2026-01-04 11:09:06 +08:00
|
|
|
</u-form-item>
|
2026-01-22 11:01:19 +08:00
|
|
|
<u-form-item label="手机号">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.mobile" :disabled="isDisabled" placeholder="请输入">
|
2026-01-04 11:09:06 +08:00
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
2026-01-22 11:01:19 +08:00
|
|
|
<u-form-item label="邮箱">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.email" :disabled="isDisabled" placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item v-if="isDisabled" label="所属部门">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.deptInfoList[0].deptName" disabled placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item v-if="isDisabled" label="创建时间">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.loginDate" disabled placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<!-- <u-form-item label="办公座机">
|
2026-01-04 11:09:06 +08:00
|
|
|
<u-input input-align='right' v-model="dataForm.landline" placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="紧急联系">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.urgentContacts" placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="紧急电话">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.urgentTelePhone" placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="通讯地址">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.postalAddress" placeholder="请输入">
|
|
|
|
|
</u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="自我介绍">
|
|
|
|
|
<u-input input-align='right' v-model="dataForm.signature" placeholder="请输入" type="textarea" />
|
2026-01-22 11:01:19 +08:00
|
|
|
</u-form-item> -->
|
2026-01-04 11:09:06 +08:00
|
|
|
</u-form>
|
|
|
|
|
</view>
|
2026-01-22 11:01:19 +08:00
|
|
|
<view v-if="!isDisabled" class="flowBefore-actions">
|
2026-01-04 11:09:06 +08:00
|
|
|
<u-button class="buttom-btn" type="primary" @click='submit'>保存</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
2026-01-22 11:01:19 +08:00
|
|
|
profileUpdate
|
2026-01-04 11:09:06 +08:00
|
|
|
} from '@/api/common'
|
|
|
|
|
import {
|
|
|
|
|
useBaseStore
|
|
|
|
|
} from '@/store/modules/base'
|
|
|
|
|
const baseStore = useBaseStore()
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
personalData: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
const data = {
|
|
|
|
|
show: false,
|
|
|
|
|
props: {
|
|
|
|
|
label: 'fullName',
|
|
|
|
|
value: 'enCode'
|
|
|
|
|
},
|
|
|
|
|
dataForm: {
|
|
|
|
|
birthday: null,
|
|
|
|
|
certificatesNumber: "",
|
|
|
|
|
certificatesType: "",
|
|
|
|
|
education: "",
|
|
|
|
|
email: "",
|
|
|
|
|
gender: "",
|
|
|
|
|
landline: "",
|
|
|
|
|
mobilePhone: "",
|
|
|
|
|
nation: "",
|
|
|
|
|
nativePlace: "",
|
|
|
|
|
postalAddress: "",
|
2026-01-22 11:01:19 +08:00
|
|
|
nickname: "",
|
2026-01-04 11:09:06 +08:00
|
|
|
signature: null,
|
2026-01-22 11:01:19 +08:00
|
|
|
mobile: "",
|
|
|
|
|
email: '',
|
|
|
|
|
sex: null,
|
|
|
|
|
deptInfoList: [],
|
|
|
|
|
loginDate: '',
|
2026-01-04 11:09:06 +08:00
|
|
|
urgentContacts: "",
|
|
|
|
|
urgentTelePhone: "",
|
|
|
|
|
id: null
|
|
|
|
|
},
|
|
|
|
|
nationOptions: [],
|
2026-01-22 11:01:19 +08:00
|
|
|
genderOptions: [
|
|
|
|
|
{
|
|
|
|
|
fullName: '男',
|
|
|
|
|
enCode: 1
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
fullName: '女',
|
|
|
|
|
enCode: 2
|
|
|
|
|
}
|
|
|
|
|
],
|
2026-01-04 11:09:06 +08:00
|
|
|
certificatesTypeOptions: [],
|
|
|
|
|
educationOptions: [],
|
|
|
|
|
rules: {
|
2026-01-22 11:01:19 +08:00
|
|
|
nickname: [{
|
2026-01-04 11:09:06 +08:00
|
|
|
required: true,
|
|
|
|
|
message: '请输入姓名',
|
|
|
|
|
trigger: ['change', 'blur'],
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return data
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
baseURL() {
|
|
|
|
|
return this.define.baseURL
|
2026-01-22 11:01:19 +08:00
|
|
|
},
|
|
|
|
|
isDisabled() {
|
|
|
|
|
const config = JSON.parse(JSON.stringify(this.personalData))
|
|
|
|
|
const {title} = config
|
|
|
|
|
return title == '个人中心'
|
2026-01-04 11:09:06 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
personalData: {
|
|
|
|
|
handler(val) {
|
|
|
|
|
this.init()
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.$refs.dataForm.setRules(this.rules);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
init() {
|
|
|
|
|
let initData = JSON.parse(JSON.stringify(this.personalData))
|
2026-01-22 11:01:19 +08:00
|
|
|
// for (let key in initData) {
|
|
|
|
|
// for (let k in this.dataForm) {
|
|
|
|
|
// if (key === k) {
|
|
|
|
|
// this.dataForm[key] = initData[key]
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
this.dataForm = initData
|
|
|
|
|
this.dataForm.loginDate = this.formatTime(initData.loginDate)
|
2026-01-04 11:09:06 +08:00
|
|
|
},
|
|
|
|
|
getOptions() {
|
|
|
|
|
baseStore.getDictionaryData({
|
|
|
|
|
sort: 'Education'
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.educationOptions = JSON.parse(JSON.stringify(res))
|
|
|
|
|
baseStore.getDictionaryData({
|
|
|
|
|
sort: 'certificateType'
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.certificatesTypeOptions = JSON.parse(JSON.stringify(res))
|
|
|
|
|
})
|
|
|
|
|
baseStore.getDictionaryData({
|
|
|
|
|
sort: 'sex'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.genderOptions = JSON.parse(JSON.stringify(res))
|
|
|
|
|
})
|
|
|
|
|
baseStore.getDictionaryData({
|
|
|
|
|
sort: 'Nation'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.nationOptions = JSON.parse(JSON.stringify(res))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.show = true
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
this.$refs.dataForm.validate(valid => {
|
|
|
|
|
if (valid) {
|
2026-01-22 11:01:19 +08:00
|
|
|
profileUpdate(this.dataForm).then(res => {
|
|
|
|
|
if(res.code == 0) {
|
|
|
|
|
uni.showToast({
|
2026-01-04 11:09:06 +08:00
|
|
|
title: '保存成功',
|
|
|
|
|
duration: 800,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
}, 1000)
|
2026-01-22 11:01:19 +08:00
|
|
|
}
|
2026-01-04 11:09:06 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-01-22 11:01:19 +08:00
|
|
|
},
|
|
|
|
|
formatTime(timestamp) {
|
|
|
|
|
if (!timestamp) return '-';
|
|
|
|
|
const date = new Date(timestamp);
|
|
|
|
|
return `${date.getFullYear()}-${this.padZero(date.getMonth() + 1)}-${this.padZero(date.getDate())} ${this.padZero(date.getHours())}:${this.padZero(date.getMinutes())}:${this.padZero(date.getSeconds())}`;
|
|
|
|
|
},
|
|
|
|
|
padZero(num) {
|
|
|
|
|
return num.toString().padStart(2, '0');
|
|
|
|
|
},
|
2026-01-04 11:09:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
page {
|
|
|
|
|
background-color: #f0f2f6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.slot-btn {
|
|
|
|
|
width: 329rpx;
|
|
|
|
|
height: 140rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background: rgb(244, 245, 246);
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.slot-btn__hover {
|
|
|
|
|
background-color: rgb(235, 236, 238);
|
|
|
|
|
}
|
|
|
|
|
</style>
|