|
@@ -35,22 +35,24 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="7">
|
|
<el-col :span="7">
|
|
<el-form-item label="学历" prop="education">
|
|
<el-form-item label="学历" prop="education">
|
|
- <el-select v-model="ruleForm.education" placeholder="请选择学历">
|
|
|
|
- <el-option label="Zone one" value="shanghai" />
|
|
|
|
- <el-option label="Zone two" value="beijing" />
|
|
|
|
- </el-select>
|
|
|
|
|
|
+ <!-- <el-select v-model="ruleForm.education" placeholder="请选择学历">-->
|
|
|
|
+ <!-- <el-option label="Zone one" value="shanghai" />-->
|
|
|
|
+ <!-- <el-option label="Zone two" value="beijing" />-->
|
|
|
|
+ <el-input v-model="ruleForm.education" clearable />
|
|
|
|
+ <!-- </el-select>-->
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="职业" prop="career">
|
|
<el-form-item label="职业" prop="career">
|
|
- <el-select-v2 v-model="ruleForm.career" placeholder="请选择职业" :options="options" />
|
|
|
|
|
|
+ <el-input v-model="ruleForm.career" clearable />
|
|
|
|
+ <!-- <el-select-v2 v-model="ruleForm.career" placeholder="请选择职业" :options="options" />-->
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="爱好" prop="hobby">
|
|
<el-form-item label="爱好" prop="hobby">
|
|
<el-input v-model="ruleForm.hobby" clearable />
|
|
<el-input v-model="ruleForm.hobby" clearable />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="利手" prop="handedness">
|
|
<el-form-item label="利手" prop="handedness">
|
|
<el-radio-group v-model="ruleForm.handedness">
|
|
<el-radio-group v-model="ruleForm.handedness">
|
|
- <el-radio value="0">左手</el-radio>
|
|
|
|
- <el-radio value="1">右手</el-radio>
|
|
|
|
- <el-radio value="2">左右手</el-radio>
|
|
|
|
|
|
+ <el-radio :value="0">左手</el-radio>
|
|
|
|
+ <el-radio :value="1">右手</el-radio>
|
|
|
|
+ <el-radio :value="2">左右手</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="常住地址" prop="address">
|
|
<el-form-item label="常住地址" prop="address">
|
|
@@ -76,9 +78,9 @@
|
|
:on-exceed="handleExceed"
|
|
:on-exceed="handleExceed"
|
|
:show-file-list="false"
|
|
:show-file-list="false"
|
|
>
|
|
>
|
|
- <el-button type="primary" size="large">更换头像</el-button>
|
|
|
|
|
|
+ <!-- <el-button type="primary" size="large">更换头像</el-button>-->
|
|
<template #tip>
|
|
<template #tip>
|
|
- <div class="el-upload__tip">500KB 以内的 jpg/png 文件</div>
|
|
|
|
|
|
+ <!-- <div class="el-upload__tip">500KB 以内的 jpg/png 文件</div>-->
|
|
</template>
|
|
</template>
|
|
</el-upload>
|
|
</el-upload>
|
|
</div>
|
|
</div>
|
|
@@ -101,6 +103,8 @@
|
|
*/
|
|
*/
|
|
import { reactive, ref } from 'vue'
|
|
import { reactive, ref } from 'vue'
|
|
import type { FormInstance, FormRules, UploadProps, UploadUserFile } from 'element-plus'
|
|
import type { FormInstance, FormRules, UploadProps, UploadUserFile } from 'element-plus'
|
|
|
|
+import UserAPI from '@/api/user'
|
|
|
|
+import { useUserStore } from '@/store'
|
|
|
|
|
|
interface RuleForm {
|
|
interface RuleForm {
|
|
id: string
|
|
id: string
|
|
@@ -116,8 +120,8 @@ interface RuleForm {
|
|
address: string
|
|
address: string
|
|
}
|
|
}
|
|
|
|
|
|
-const imgUrl = ref('https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg')
|
|
|
|
-
|
|
|
|
|
|
+const imgUrl = ref('static/image/user/default-avatar.png')
|
|
|
|
+const userStore = useUserStore()
|
|
const ruleFormRef = ref<FormInstance>()
|
|
const ruleFormRef = ref<FormInstance>()
|
|
const ruleForm = reactive<RuleForm>({
|
|
const ruleForm = reactive<RuleForm>({
|
|
id: 'DKIN823KDE8234232323',
|
|
id: 'DKIN823KDE8234232323',
|
|
@@ -151,11 +155,31 @@ const rules = reactive<FormRules<RuleForm>>({
|
|
address: [{ required: true, message: '请输入常住地址', trigger: 'blur' }]
|
|
address: [{ required: true, message: '请输入常住地址', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
-const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
+const submitForm = async (formEl: any) => {
|
|
if (!formEl) return
|
|
if (!formEl) return
|
|
await formEl.validate((valid, fields) => {
|
|
await formEl.validate((valid, fields) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
console.log('submit!')
|
|
console.log('submit!')
|
|
|
|
+ console.log(ruleForm, '提交表单的数据')
|
|
|
|
+ let params = {
|
|
|
|
+ id: userStore.user.id,
|
|
|
|
+ code: ruleForm.id,
|
|
|
|
+ name: ruleForm.name,
|
|
|
|
+ note: ruleForm.nickName,
|
|
|
|
+ sex: ruleForm.sex,
|
|
|
|
+ age: ruleForm.age,
|
|
|
|
+ cardNo: ruleForm.idCard,
|
|
|
|
+ duration: ruleForm.education,
|
|
|
|
+ type: ruleForm.career,
|
|
|
|
+ title: ruleForm.hobby,
|
|
|
|
+ seniority: ruleForm.handedness,
|
|
|
|
+ department: ruleForm.address
|
|
|
|
+ }
|
|
|
|
+ UserAPI.update(params).then((response) => {
|
|
|
|
+ console.log(response, '更新')
|
|
|
|
+ ElMessage.success('更新成功')
|
|
|
|
+ getUserInfo()
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
console.log('error submit!', fields)
|
|
console.log('error submit!', fields)
|
|
}
|
|
}
|
|
@@ -173,6 +197,39 @@ const options = Array.from({ length: 10000 }).map((_, idx) => ({
|
|
}))
|
|
}))
|
|
|
|
|
|
const fileList = ref<UploadUserFile[]>([])
|
|
const fileList = ref<UploadUserFile[]>([])
|
|
|
|
+// 查询
|
|
|
|
+const getUserInfo = async () => {
|
|
|
|
+ console.log(userStore.user, 'userStore.user')
|
|
|
|
+ UserAPI.findById(userStore.user.id)
|
|
|
|
+ .then((data) => {
|
|
|
|
+ console.log(data, '124')
|
|
|
|
+ // const { sex, name } = toRefs(data)
|
|
|
|
+ // ruleForm.name = data.name
|
|
|
|
+ // ruleForm.sex = data.sex
|
|
|
|
+ // ruleForm.education = data.duration || '本科'
|
|
|
|
+ // ruleForm.type = data.depart || '医师'
|
|
|
|
+ // ruleForm.age = data.age || 18
|
|
|
|
+ // ruleForm.phone = data.phone
|
|
|
|
+ // ruleForm.nickName = data.note
|
|
|
|
+ // ruleForm.birthday = data.birthday || '2020-01-01'
|
|
|
|
+ // ruleForm.seniority = data.seniority || '0'
|
|
|
|
+ // ruleForm.title = data.title || '初级'
|
|
|
|
+ // ruleForm.seniority = data.seniority || '0'
|
|
|
|
+ // ruleForm.department = data.department || '儿科'
|
|
|
|
+ ruleForm.id = data.code
|
|
|
|
+ ruleForm.name = data.name
|
|
|
|
+ ruleForm.nickName = data.note
|
|
|
|
+ ruleForm.sex = data.sex
|
|
|
|
+ ruleForm.age = data.age
|
|
|
|
+ ruleForm.idCard = data.cardNo
|
|
|
|
+ ruleForm.education = data.duration
|
|
|
|
+ ruleForm.career = data.type || '程序员'
|
|
|
|
+ ruleForm.hobby = data.title
|
|
|
|
+ ruleForm.handedness = data.seniority || 0
|
|
|
|
+ ruleForm.address = data.department || '暂无'
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {})
|
|
|
|
+}
|
|
|
|
|
|
const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => {
|
|
const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => {
|
|
console.log(file, uploadFiles)
|
|
console.log(file, uploadFiles)
|
|
@@ -196,6 +253,16 @@ const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => {
|
|
() => false
|
|
() => false
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+onMounted(() => {
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ getUserInfo()
|
|
|
|
+ // ChatUtils.imageLoad('message-box')
|
|
|
|
+ // doctorInfo.value = $props.userInfos
|
|
|
|
+ // user_myDoctor()
|
|
|
|
+ // gQuerys()
|
|
|
|
+ })
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|