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