|
|
@ -4,12 +4,13 @@ import { onMounted, ref, computed } from 'vue' |
|
|
|
import { userIdenChangeService } from '@/api/user/user.js' |
|
|
|
import { userIdenChangeService } from '@/api/user/user.js' |
|
|
|
import { Edit } from '@element-plus/icons-vue' |
|
|
|
import { Edit } from '@element-plus/icons-vue' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
const props = defineProps({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
type: Object, |
|
|
|
type: Object, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log(props.data, 'info') |
|
|
|
console.log(props.data, 'djegd ') |
|
|
|
const formModel = ref() |
|
|
|
const formModel = ref() |
|
|
|
const loading = ref() |
|
|
|
const loading = ref() |
|
|
|
//抽屉true |
|
|
|
//抽屉true |
|
|
@ -27,7 +28,6 @@ const openEditDialog = (row) => { |
|
|
|
} |
|
|
|
} |
|
|
|
//确认时将表单数据回显 |
|
|
|
//确认时将表单数据回显 |
|
|
|
const saveEdit = () => { |
|
|
|
const saveEdit = () => { |
|
|
|
console.log(editRowIndex.value, 'rowww') |
|
|
|
|
|
|
|
const index = editRowIndex.value |
|
|
|
const index = editRowIndex.value |
|
|
|
if (index !== -1) { |
|
|
|
if (index !== -1) { |
|
|
|
formModel.value[index] = { ...editForm.value } |
|
|
|
formModel.value[index] = { ...editForm.value } |
|
|
@ -44,9 +44,8 @@ const cancelEdit = () => { |
|
|
|
content: '', |
|
|
|
content: '', |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const identInfo = ref() |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
// console.log(props.data, 'res') |
|
|
|
|
|
|
|
if (props.data.roleId === 1) { |
|
|
|
if (props.data.roleId === 1) { |
|
|
|
formModel.value = [ |
|
|
|
formModel.value = [ |
|
|
|
{ par: 'name', name: '姓名', content: props.data.name }, |
|
|
|
{ par: 'name', name: '姓名', content: props.data.name }, |
|
|
@ -86,8 +85,8 @@ onMounted(() => { |
|
|
|
{ par: 'phone', name: '手机号', content: props.data.phone }, |
|
|
|
{ par: 'phone', name: '手机号', content: props.data.phone }, |
|
|
|
{ par: 'faculty', name: '院系', content: props.data.faculty }, |
|
|
|
{ par: 'faculty', name: '院系', content: props.data.faculty }, |
|
|
|
{ par: 'major', name: '专业', content: props.data.major }, |
|
|
|
{ par: 'major', name: '专业', content: props.data.major }, |
|
|
|
{ par: 'year_age', name: '入学年份', content: props.data.year_age }, |
|
|
|
{ par: 'yearAge', name: '入学年份', content: props.data.yearAge }, |
|
|
|
{ par: 'class_name', name: '班级', content: props.data.class_name }, |
|
|
|
{ par: 'className', name: '班级', content: props.data.className }, |
|
|
|
] |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
// else { |
|
|
|
// else { |
|
|
@ -103,7 +102,6 @@ onMounted(() => { |
|
|
|
// { name: '小米电脑', content: 9.9 }, |
|
|
|
// { name: '小米电脑', content: 9.9 }, |
|
|
|
// ] |
|
|
|
// ] |
|
|
|
// } |
|
|
|
// } |
|
|
|
console.log(formModel.value) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
// 编辑1 |
|
|
|
// 编辑1 |
|
|
|
const drawer2 = ref(false) |
|
|
|
const drawer2 = ref(false) |
|
|
@ -111,7 +109,7 @@ const direction = ref('rtl') |
|
|
|
function cancelClick() { |
|
|
|
function cancelClick() { |
|
|
|
drawer2.value = false |
|
|
|
drawer2.value = false |
|
|
|
} |
|
|
|
} |
|
|
|
const data1 = ref() |
|
|
|
const data1 = ref([]) |
|
|
|
const confirmClick = () => { |
|
|
|
const confirmClick = () => { |
|
|
|
drawer2.value = false |
|
|
|
drawer2.value = false |
|
|
|
data1.value = formModel.value |
|
|
|
data1.value = formModel.value |
|
|
@ -119,12 +117,17 @@ const confirmClick = () => { |
|
|
|
data1.value.map((item) => (values[item.par] = item.content)) |
|
|
|
data1.value.map((item) => (values[item.par] = item.content)) |
|
|
|
const dataToSend = { |
|
|
|
const dataToSend = { |
|
|
|
...values, |
|
|
|
...values, |
|
|
|
roleId: identInfo.value.roleId, |
|
|
|
roleId: props.data.roleId, |
|
|
|
id: identInfo.value.id, |
|
|
|
id: props.data.id, |
|
|
|
} |
|
|
|
} |
|
|
|
userIdenChangeService(dataToSend).then(() => { |
|
|
|
console.log(dataToSend, 'datato111') |
|
|
|
|
|
|
|
userIdenChangeService(dataToSend) |
|
|
|
|
|
|
|
.then(() => { |
|
|
|
ElMessage.success('修改成功') |
|
|
|
ElMessage.success('修改成功') |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
|
|
console.log(error) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<template> |
|
|
|