Compare commits
5 Commits
0b7db324da
...
c85e9ee528
Author | SHA1 | Date |
---|---|---|
ww | c85e9ee528 | 4 months ago |
ww | 00d96736d9 | 4 months ago |
ww | 7a0c49ec0f | 4 months ago |
ww | f77b4afe40 | 4 months ago |
ww | db33196725 | 4 months ago |
30 changed files with 2161 additions and 1467 deletions
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 189 KiB |
@ -1,9 +1,9 @@ |
||||
// 引入仓库
|
||||
import { createPinia } from 'pinia' |
||||
import persist from 'pinia-plugin-persistedstate' |
||||
// import persist from 'pinia-plugin-persistedstate'
|
||||
// 创建仓库
|
||||
const pinia = createPinia() |
||||
// 暴露仓库
|
||||
pinia.use(persist) |
||||
// pinia.use(persist)
|
||||
export default pinia |
||||
export * from './modules/user' |
||||
// export * from './modules/user'
|
||||
|
@ -1,287 +0,0 @@ |
||||
<script setup> |
||||
import conheader from '@/views/home/components/ConHeader.vue' |
||||
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, |
||||
}, |
||||
}) |
||||
const formModel = ref() |
||||
const newFormModel = ref() |
||||
const loading = ref() |
||||
//抽屉true |
||||
const editDialogVisible = ref(false) |
||||
const editForm = ref({ |
||||
name: '', |
||||
content: '', |
||||
}) |
||||
const readonlyField = computed(() => editForm.value.name) |
||||
const editRowIndex = ref() |
||||
const openEditDialog = (row) => { |
||||
editForm.value = { ...row } |
||||
editRowIndex.value = formModel.value.indexOf(row) |
||||
editDialogVisible.value = true |
||||
} |
||||
//确认时将表单数据回显 |
||||
const saveEdit = () => { |
||||
const index = editRowIndex.value |
||||
if (index !== -1) { |
||||
formModel.value[index] = { ...editForm.value } |
||||
} |
||||
// console.log(editRowIndex.value, 'edit') |
||||
editDialogVisible.value = false |
||||
} |
||||
//取消 |
||||
const cancelEdit = () => { |
||||
editDialogVisible.value = false |
||||
//重置表单 |
||||
editForm.value = { |
||||
name: '', |
||||
content: '', |
||||
} |
||||
} |
||||
const formValue = [] |
||||
onMounted(() => { |
||||
if (props.data.roleId[0] === '1') { |
||||
formModel.value = [ |
||||
{ par: 'name', name: '姓名', content: props.data.name }, |
||||
{ par: 'sex', name: '性别', content: props.data.sex }, |
||||
{ par: 'nationality', name: '民族', content: props.data.nationality }, |
||||
{ par: 'profession', name: '专业', content: props.data.profession }, |
||||
{ par: 'education', name: '学历', content: props.data.education }, |
||||
{ |
||||
par: 'academicDegree', |
||||
name: '学位', |
||||
content: props.data.academicDegree, |
||||
}, |
||||
{ |
||||
par: 'professionalTitle', |
||||
name: '职称', |
||||
content: props.data.professionalTitle, |
||||
}, |
||||
{ |
||||
par: 'emergencyContact', |
||||
name: '手机号', |
||||
content: props.data.emergencyContact, |
||||
}, |
||||
{ |
||||
par: 'joinWorkTime', |
||||
name: '参加工作时间', |
||||
content: props.data.joinWorkTime, |
||||
}, |
||||
{ |
||||
par: 'politicalStatus', |
||||
name: '政治面貌', |
||||
content: props.data.politicalStatus, |
||||
}, |
||||
] |
||||
newFormModel.value = { ...formModel.value } |
||||
formValue.value = formModel.value |
||||
} else if (props.data.roleId[0] === '2') { |
||||
formModel.value = [ |
||||
{ par: 'name', name: '姓名', content: props.data.name }, |
||||
{ par: 'sex', name: '性别', content: props.data.sex }, |
||||
{ par: 'nationality', name: '民族', content: props.data.nationality }, |
||||
{ par: 'number', name: '学号', content: props.data.number }, |
||||
{ par: 'birthday', name: '生日', content: props.data.birthday }, |
||||
{ par: 'phone', name: '手机号', content: props.data.phone }, |
||||
{ par: 'faculty', name: '院系', content: props.data.faculty }, |
||||
{ par: 'major', name: '专业', content: props.data.major }, |
||||
{ par: 'yearAge', name: '入学年份', content: props.data.yearAge }, |
||||
{ par: 'className', name: '班级', content: props.data.className }, |
||||
] |
||||
newFormModel.value = { ...formModel.value } |
||||
formValue.value = formModel.value |
||||
} |
||||
// else { |
||||
// formModel.value = [ |
||||
// { name: '姓名', content: res.data.name }, |
||||
// { name: '性别', content: res.data.id }, |
||||
// { name: '学号', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// { name: '小米电脑', content: 9.9 }, |
||||
// ] |
||||
// } |
||||
}) |
||||
// 编辑1 |
||||
const drawer2 = ref(false) |
||||
const direction = ref('rtl') |
||||
const data1 = ref([]) |
||||
|
||||
const confirmClick = () => { |
||||
drawer2.value = false |
||||
data1.value = formModel.value |
||||
const values = {} |
||||
data1.value.map((item) => (values[item.par] = item.content)) |
||||
const dataToSend = { |
||||
...values, |
||||
roleId: props.data.roleId, |
||||
id: props.data.id, |
||||
userId: props.data.userId, |
||||
} |
||||
userIdenChangeService(dataToSend) |
||||
.then(() => { |
||||
ElMessage.success('修改成功') |
||||
}) |
||||
.catch((error) => { |
||||
console.log(error) |
||||
}) |
||||
} |
||||
function cancelClick() { |
||||
drawer2.value = false |
||||
} |
||||
</script> |
||||
<template> |
||||
<div class="info_container" style="width: 95%; height: 306px"> |
||||
<conheader title="个人信息" v-model="drawer2"> |
||||
<template #drawer> |
||||
<el-drawer v-model="drawer2" :direction="direction" class="table"> |
||||
<template #header> |
||||
<h4>个人信息</h4> |
||||
</template> |
||||
<template #default> |
||||
<div> |
||||
<el-table :data="formModel" style="width: 100%"> |
||||
<el-table-column prop="name" label="标题"></el-table-column> |
||||
<el-table-column prop="content" label="内容"></el-table-column> |
||||
<el-table-column label="操作"> |
||||
<template #default="{ row }"> |
||||
<el-button |
||||
type="primary" |
||||
class="el-icon-edit" |
||||
:icon="Edit" |
||||
plain |
||||
circle |
||||
@click="openEditDialog(row)" |
||||
></el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</template> |
||||
<template #footer> |
||||
<div style="flex: auto"> |
||||
<el-button @click="cancelClick" size="medium">取消</el-button> |
||||
<el-button type="primary" @click="confirmClick">确认</el-button> |
||||
</div> |
||||
</template> |
||||
</el-drawer> |
||||
<el-dialog |
||||
v-model="editDialogVisible" |
||||
title="详细信息" |
||||
style="width: 800px; text-align: center" |
||||
:readonly-field="readonlyField" |
||||
> |
||||
<el-form :model="editForm" label-width="80px"> |
||||
<el-form-item label="名称" prop="name"> |
||||
<el-input v-model="editForm.name"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="内容" prop="content"> |
||||
<template v-if="editForm.name !== '性别'"> |
||||
<el-input v-model="editForm.content"></el-input> |
||||
</template> |
||||
<template v-else> |
||||
<el-select |
||||
v-model="editForm.content" |
||||
filterable |
||||
placeholder="Select" |
||||
> |
||||
<el-option |
||||
v-for="item in [ |
||||
{ |
||||
value: '男', |
||||
label: '男', |
||||
}, |
||||
{ |
||||
value: '女', |
||||
label: '女', |
||||
}, |
||||
]" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
/> |
||||
</el-select> |
||||
</template> |
||||
</el-form-item> |
||||
</el-form> |
||||
<template #footer> |
||||
<div> |
||||
<el-button @click="cancelEdit">取消</el-button> |
||||
<el-button type="primary" @click="saveEdit">保存</el-button> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
</conheader> |
||||
<div |
||||
class="info_content" |
||||
style="width: 60%; height: 244px" |
||||
v-loading="loading" |
||||
> |
||||
<div class="item" :key="item.name" v-for="item in newFormModel"> |
||||
<div class="name">{{ item.name }}</div> |
||||
<div class="content">{{ item.content }}</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<style scoped> |
||||
.info_container { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.info_content { |
||||
display: grid; |
||||
display: wrap; |
||||
grid-template-columns: repeat(4, 1fr); |
||||
gap: 10px; /* 设置元素之间的间隔 */ |
||||
} |
||||
.item { |
||||
width: 100%; |
||||
height: 60px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.name { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.4); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
.content { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.9); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
.table { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.custom-input { |
||||
margin-bottom: 20px; |
||||
height: 40px; /* 自定义输入框高度 */ |
||||
padding: 0 10px; /* 自定义输入框内边距 */ |
||||
font-size: 16px; /* 自定义输入框字体大小 */ |
||||
/* 其他样式自定义 */ |
||||
} |
||||
</style> |
@ -1,156 +0,0 @@ |
||||
<script setup> |
||||
import ellipsis from '@/assets/images/ellipsis.png' |
||||
import conheader from '@/views/home/components/ConHeader.vue' |
||||
import { ref, computed } from 'vue' |
||||
import { userIdenChangeService } from '@/api/user/user.js' |
||||
import { ElMessage } from 'element-plus' |
||||
import InfoContainer from './infoContainer/index.vue' |
||||
import myDrawer from './myDrawer/index.vue' |
||||
const props = defineProps({ |
||||
data: { |
||||
type: Object, |
||||
}, |
||||
}) |
||||
// ============== formModel |
||||
const formModel = ref() |
||||
switch (+props.data.roleId[0]) { |
||||
case 1: |
||||
formModel.value = [ |
||||
{ par: 'name', name: '姓名', content: props.data.name }, |
||||
{ par: 'sex', name: '性别', content: props.data.sex }, |
||||
{ par: 'nationality', name: '民族', content: props.data.nationality }, |
||||
{ par: 'profession', name: '专业', content: props.data.profession }, |
||||
{ par: 'education', name: '学历', content: props.data.education }, |
||||
{ |
||||
par: 'academicDegree', |
||||
name: '学位', |
||||
content: props.data.academicDegree, |
||||
}, |
||||
{ |
||||
par: 'professionalTitle', |
||||
name: '职称', |
||||
content: props.data.professionalTitle, |
||||
}, |
||||
{ |
||||
par: 'emergencyContact', |
||||
name: '手机号', |
||||
content: props.data.emergencyContact, |
||||
}, |
||||
{ |
||||
par: 'joinWorkTime', |
||||
name: '参加工作时间', |
||||
content: props.data.joinWorkTime, |
||||
}, |
||||
{ |
||||
par: 'politicalStatus', |
||||
name: '政治面貌', |
||||
content: props.data.politicalStatus, |
||||
}, |
||||
] |
||||
break |
||||
case 2: |
||||
formModel.value = [ |
||||
{ par: 'name', name: '姓名', content: props.data.name }, |
||||
{ par: 'sex', name: '性别', content: props.data.sex }, |
||||
{ par: 'nationality', name: '民族', content: props.data.nationality }, |
||||
{ par: 'number', name: '学号', content: props.data.number }, |
||||
{ par: 'birthday', name: '生日', content: props.data.birthday }, |
||||
{ par: 'phone', name: '手机号', content: props.data.phone }, |
||||
{ par: 'faculty', name: '院系', content: props.data.faculty }, |
||||
{ par: 'major', name: '专业', content: props.data.major }, |
||||
{ par: 'yearAge', name: '入学年份', content: props.data.yearAge }, |
||||
{ par: 'className', name: '班级', content: props.data.className }, |
||||
] |
||||
break |
||||
} |
||||
// ============== |
||||
|
||||
// 编辑1 |
||||
const drawer2 = ref(false) |
||||
</script> |
||||
<template> |
||||
<div class="info_container" style="width: 95%; height: 306px"> |
||||
<div class="info_title"> |
||||
<div class="title_name">个人信息</div> |
||||
<div class="icon"> |
||||
<img :src="ellipsis" @click="drawer2 = true" /> |
||||
</div> |
||||
</div> |
||||
<InfoContainer :data="formModel"></InfoContainer> |
||||
<myDrawer v-model:drawer="drawer2" :data="formModel"></myDrawer> |
||||
</div> |
||||
</template> |
||||
<style scoped> |
||||
.info_container { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.info_content { |
||||
display: grid; |
||||
display: wrap; |
||||
grid-template-columns: repeat(4, 1fr); |
||||
gap: 10px; /* 设置元素之间的间隔 */ |
||||
} |
||||
.item { |
||||
width: 100%; |
||||
height: 60px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.name { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.4); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
.content { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.9); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
|
||||
.custom-input { |
||||
margin-bottom: 20px; |
||||
height: 40px; /* 自定义输入框高度 */ |
||||
padding: 0 10px; /* 自定义输入框内边距 */ |
||||
font-size: 16px; /* 自定义输入框字体大小 */ |
||||
/* 其他样式自定义 */ |
||||
} |
||||
|
||||
/* ======= */ |
||||
.info_title { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
.title_name { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 20px; |
||||
color: rgba(0, 0, 0, 0.9); |
||||
line-height: 30px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
} |
||||
|
||||
.icon { |
||||
width: 32px; |
||||
height: 32px; |
||||
border-radius: 3px 3px 3px 3px; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
</style> |
@ -0,0 +1,102 @@ |
||||
<script setup> |
||||
import conheader from '@/views/home/components/ConHeader.vue' |
||||
import fe from '@/assets/images/fe.jpg' |
||||
// import { userLessonListService } from '@/api/user/user.js' |
||||
// const getLesList = async () => { |
||||
// const res = await userLessonListService() |
||||
// console.log(res) |
||||
// } |
||||
// getLesList() |
||||
</script> |
||||
<template> |
||||
<div class="lesson_container" style="width: 95%; height: 90%"> |
||||
<conheader |
||||
:title="`课程列表`" |
||||
:urouter="'/curriculumCenter/basicCourseInformation'" |
||||
></conheader> |
||||
<div class="lessonlist-content"> |
||||
<div class="lessonlist-item" v-for="item in 4" :key="item"> |
||||
<div class="lessonlist-item-img"> |
||||
<img |
||||
src="" |
||||
alt="" |
||||
style="width: 100%; height: 125px; border-radius: 10px 10px 0px 0px" |
||||
/> |
||||
</div> |
||||
<div class="lessonlist-item-info"> |
||||
<h3>软件构造</h3> |
||||
<div class="p"><p>编辑</p></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<style scoped> |
||||
.lesson_container { |
||||
/* background-color: purple; */ |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
margin: 0 auto; |
||||
padding: 5px 0; |
||||
} |
||||
|
||||
.lessonlist-content { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
justify-content: space-between; |
||||
margin: 10px 0px; |
||||
} |
||||
|
||||
.lessonlist-item { |
||||
width: 23%; |
||||
height: 175px; |
||||
border-radius: 10px 10px 0px 0px; |
||||
background-color: #fff; |
||||
/* background-color: #aeb1b5; */ |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
border: 1px solid #e8e8f2; |
||||
/* border-radius: 6px 6px 6px 6px; */ |
||||
/* box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); */ |
||||
} |
||||
.lessonlist-item-info { |
||||
box-sizing: border-box; |
||||
padding: 6px 5px; |
||||
/* background-color: pink; */ |
||||
/* padding: 10px; */ |
||||
/* display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
border: 1px solid #e8e8f2; */ |
||||
/* border: 1px solid #e8e8f2; */ |
||||
} |
||||
.lessonlist-item-info h3 { |
||||
font-size: 16px; |
||||
font-weight: bold; |
||||
margin-bottom: 5px; |
||||
} |
||||
.lessonlist-item-info .p { |
||||
/* font-size: 14px; |
||||
color: #858689; */ |
||||
|
||||
/* width: 100%; */ |
||||
display: flex; |
||||
justify-content: end; |
||||
} |
||||
.lessonlist-item-info p { |
||||
font-size: 12px; |
||||
color: #a7c4f7; |
||||
/* line-height: 1.5; */ |
||||
box-sizing: border-box; |
||||
border: 2px solid #a7c4f7; |
||||
border-radius: 10px; |
||||
/* margin-bottom: 5px; */ |
||||
width: 50px; |
||||
/* margin: 5px; */ |
||||
text-align: center; |
||||
/* cursor: pointer; */ |
||||
} |
||||
</style> |
@ -1,97 +0,0 @@ |
||||
<script setup> |
||||
import conheader from '@/views/home/components/ConHeader.vue' |
||||
import { ref } from 'vue' |
||||
const name = ['Aa', 'Bb', 'Cc', 'Dd'] |
||||
const getRandomColor = () => { |
||||
// 生成随机的颜色值 |
||||
return '#' + Math.floor(Math.random() * 16777215).toString(16) |
||||
} |
||||
const drawer2 = ref(false) |
||||
const direction = ref('rtl') |
||||
function cancelClick() { |
||||
drawer2.value = false |
||||
} |
||||
function confirmClick() { |
||||
drawer2.value = false |
||||
} |
||||
</script> |
||||
<template> |
||||
<div class="info_container" style="width: 90%; height: 174px"> |
||||
<conheader title="已分组别" v-model="drawer2"> |
||||
<div>编辑</div> |
||||
<template #drawer> |
||||
<el-drawer v-model="drawer2" :direction="direction"> |
||||
<template #header> |
||||
<h4>78</h4> |
||||
</template> |
||||
<template #default> |
||||
<div></div> |
||||
</template> |
||||
<template #footer> |
||||
<div style="flex: auto"> |
||||
<el-button @click="cancelClick">cancel</el-button> |
||||
<el-button type="primary" @click="confirmClick"> |
||||
confirm |
||||
</el-button> |
||||
</div> |
||||
</template> |
||||
</el-drawer> |
||||
</template> |
||||
</conheader> |
||||
<div class="info_content" style="width: 194px; height: 112px"> |
||||
<div |
||||
v-for="(item, index) in name" |
||||
:key="index" |
||||
class="stu_color" |
||||
:style="{ backgroundColor: getRandomColor() }" |
||||
> |
||||
{{ item }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<style scoped> |
||||
.stu { |
||||
background: #ffffff; |
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1); |
||||
border-radius: 6px 6px 6px 6px; |
||||
display: flex; |
||||
|
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
.info_container { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
} |
||||
.info_content { |
||||
width: 194px; |
||||
height: 112px; |
||||
flex-wrap: wrap; |
||||
display: grid; |
||||
grid-template-columns: repeat(3, 1fr); |
||||
gap: 24px; /* 设置元素之间的间隔 */ |
||||
grid-row-gap: 16px; |
||||
} |
||||
.stu_color { |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
width: 49px; |
||||
height: 48px; |
||||
border-radius: 40px 40px 40px 40px; |
||||
font-family: Inter, Inter; |
||||
font-weight: normal; |
||||
font-size: 14px; |
||||
color: rgba(255, 255, 255, 0.9); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
transition: background-color 0.3s; |
||||
} |
||||
.stu_color:hover { |
||||
background-color: #f2f2f2; /* 鼠标移入时的背景色变化 */ |
||||
filter: brightness(1.1); |
||||
} |
||||
</style> |
@ -1,47 +0,0 @@ |
||||
<template> |
||||
<div class="info_content" style="width: 60%; height: 244px"> |
||||
<div class="item" :key="item.name" v-for="item in data"> |
||||
<div class="name">{{ item.name }}</div> |
||||
<div class="content">{{ item.content }}</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script setup lang="ts"> |
||||
defineProps(['data']) |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.info_content { |
||||
display: grid; |
||||
display: wrap; |
||||
grid-template-columns: repeat(4, 1fr); |
||||
gap: 10px; /* 设置元素之间的间隔 */ |
||||
} |
||||
.item { |
||||
width: 100%; |
||||
height: 60px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
.name { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.4); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
.content { |
||||
font-family: Inter, Inter; |
||||
font-weight: 400; |
||||
font-size: 14px; |
||||
color: rgba(0, 0, 0, 0.9); |
||||
line-height: 22px; |
||||
text-align: left; |
||||
font-style: normal; |
||||
text-transform: none; |
||||
} |
||||
</style> |
@ -1,120 +0,0 @@ |
||||
<template> |
||||
<el-drawer v-model="drawer2" class="table"> |
||||
<template #header> |
||||
<h4>个人信息</h4> |
||||
</template> |
||||
<template #default> |
||||
<div> |
||||
<el-table :data="parData" style="width: 100%"> |
||||
<el-table-column prop="name" label="标题"></el-table-column> |
||||
<el-table-column prop="content" label="内容"></el-table-column> |
||||
<el-table-column label="操作"> |
||||
<template #default="{ row }"> |
||||
<el-button |
||||
type="primary" |
||||
class="el-icon-edit" |
||||
:icon="Edit" |
||||
plain |
||||
circle |
||||
@click="hanEdit(row)" |
||||
></el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
</template> |
||||
<template #footer> |
||||
<div style="flex: auto"> |
||||
<el-button @click="() => {}" size="medium">取消</el-button> |
||||
<el-button type="primary" @click="() => {}">确认</el-button> |
||||
</div> |
||||
</template> |
||||
</el-drawer> |
||||
<el-dialog |
||||
v-model="isDialog" |
||||
title="详细信息" |
||||
style="width: 800px; text-align: center" |
||||
> |
||||
<el-form :model="activeItem" label-width="80px"> |
||||
<el-form-item label="名称" prop="name"> |
||||
<el-input v-model="activeItem.name"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="内容" prop="content"> |
||||
<template v-if="activeItem.name !== '性别'"> |
||||
<el-input v-model="activeItem.content"></el-input> |
||||
</template> |
||||
<template v-else> |
||||
<el-select |
||||
v-model="activeItem.content" |
||||
filterable |
||||
placeholder="Select" |
||||
> |
||||
<el-option |
||||
v-for="item in arr" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
/> |
||||
</el-select> |
||||
</template> |
||||
</el-form-item> |
||||
</el-form> |
||||
<template #footer> |
||||
<div> |
||||
<el-button @click="isDialog = false">取消</el-button> |
||||
<el-button type="primary" @click="saveEdit">保存</el-button> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
<script setup lang="ts"> |
||||
import { Edit } from '@element-plus/icons-vue' |
||||
import { ref, reactive, watch } from 'vue' |
||||
const props = defineProps(['drawer', 'data']) |
||||
const emits = defineEmits(['update:drawer']) |
||||
const arr = ref([ |
||||
{ |
||||
value: '男', |
||||
label: '男', |
||||
}, |
||||
{ |
||||
value: '女', |
||||
label: '女', |
||||
}, |
||||
]) |
||||
// ================同步 |
||||
const drawer2 = ref(props.drawer) |
||||
watch( |
||||
() => drawer2.value, |
||||
(newVal) => emits('update:drawer', newVal), |
||||
) |
||||
watch( |
||||
() => props.drawer, |
||||
(newVal) => (drawer2.value = newVal), |
||||
) |
||||
const parData = ref(props.data.map((item: any) => ({ ...item }))) |
||||
// ========== |
||||
|
||||
const isDialog = ref(false) |
||||
const activeItem = reactive({}) |
||||
const activeRow = ref() |
||||
// 打开弹窗开始编辑 |
||||
function hanEdit(row: any) { |
||||
Object.assign(activeItem, row) |
||||
activeRow.value = row |
||||
isDialog.value = true |
||||
} |
||||
// 保存编辑 |
||||
function saveEdit() { |
||||
Object.assign(activeRow.value, activeItem) |
||||
console.log(parData.value, 'value') |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.table { |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
} |
||||
</style> |
@ -1,30 +1,241 @@ |
||||
<script setup> |
||||
import { Search, Edit, Delete } from '@element-plus/icons-vue' |
||||
import { ref } from 'vue' |
||||
const tableData = [ |
||||
{ |
||||
date: '2016-05-03', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Home', |
||||
}, |
||||
{ |
||||
date: '2016-05-02', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Office', |
||||
}, |
||||
{ |
||||
date: '2016-05-04', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Home', |
||||
}, |
||||
{ |
||||
date: '2016-05-01', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Office', |
||||
}, |
||||
{ |
||||
date: '2016-05-01', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Office', |
||||
}, |
||||
{ |
||||
date: '2016-05-01', |
||||
name: 'Tom', |
||||
state: 'California', |
||||
city: 'Los Angeles', |
||||
address: 'No. 189, Grove St, Los Angeles', |
||||
zip: 'CA 90036', |
||||
tag: 'Office', |
||||
}, |
||||
] |
||||
const loading = ref(false) |
||||
</script> |
||||
<template> |
||||
<div> |
||||
<!-- Dialog组件 --> |
||||
<Dialog |
||||
v-model="dialogVisible" |
||||
@confirm="collectData" |
||||
:name="readonlyName" |
||||
:age="readonlyAge" |
||||
<page-container title="文章分类"> |
||||
<el-card class="page-container"> |
||||
<template #header> |
||||
<div class="card-header"> |
||||
<span>学生信息</span> |
||||
<el-button type="primary">重置密码</el-button> |
||||
</div> |
||||
</template> |
||||
<div class="content"> |
||||
<el-form style="display: flex"> |
||||
<el-form-item style="width: 250px"> |
||||
<el-input class="input_search"></el-input> |
||||
<el-icon><Search /></el-icon> |
||||
</el-form-item> |
||||
<el-button class="btn_search">搜索</el-button> |
||||
</el-form> |
||||
<el-table |
||||
class="tableBox" |
||||
:data="tableData" |
||||
v-loading="loading" |
||||
:header-cell-style="{ |
||||
background: '#FAFAFA', |
||||
color: '#666', |
||||
fontSize: '14px', |
||||
fontWeight: 'bold', |
||||
height: '45px', |
||||
lineHeight: '45px', |
||||
borderTop: '1px solid #ebeef5', |
||||
textAlign: 'center', |
||||
}" |
||||
:cell-style="{ |
||||
color: '#666', |
||||
fontSize: '14px', |
||||
height: '40px', |
||||
lineHeight: '40px', |
||||
textAlign: 'center', |
||||
}" |
||||
:row-style="{ |
||||
height: '40px', |
||||
}" |
||||
style="width: 100%" |
||||
> |
||||
<el-table-column type="selection" width="55" height="100" /> |
||||
<el-table-column prop="date" label="日期" /> |
||||
<el-table-column prop="name" label="姓名" /> |
||||
<el-table-column prop="state" label="状态" /> |
||||
<el-table-column prop="city" label="City" width="300" /> |
||||
<el-table-column prop="address" label="Address" /> |
||||
<el-table-column prop="zip" label="Zip" /> |
||||
<el-table-column fixed="right" label="操作" min-width="125"> |
||||
<template #default> |
||||
<el-button |
||||
type="primary" |
||||
size="small" |
||||
:icon="Edit" |
||||
circle |
||||
plain |
||||
@click="handleClick" |
||||
></el-button> |
||||
<el-button |
||||
:icon="Delete" |
||||
type="danger" |
||||
size="small" |
||||
circle |
||||
plain |
||||
></el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<template #empty> |
||||
<el-empty description="没有数据" /> |
||||
</template> |
||||
</el-table> |
||||
|
||||
<!-- <el-table :data="tableData" style="width: 100%"> |
||||
<el-table-column type="selection" width="65" /> |
||||
<el-table-column prop="cate_name" label="分类名称" /> |
||||
<el-table-column prop="cate_alias" label="分类别名" /> |
||||
<el-table-column prop="address" label="操作"> |
||||
<template #default="{ row, $index }"> |
||||
<el-button |
||||
@click="onEditChannel(row, $index)" |
||||
:icon="Edit" |
||||
type="primary" |
||||
circle |
||||
plain |
||||
></el-button> |
||||
<el-button |
||||
@click="onDelChannel(row)" |
||||
:icon="Delete" |
||||
type="danger" |
||||
circle |
||||
plain |
||||
></el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<template #empty> |
||||
<el-empty description="没有数据" /> |
||||
</template> |
||||
</el-table> --> |
||||
<el-pagination |
||||
v-model:current-page="currentPage4" |
||||
v-model:page-size="pageSize4" |
||||
:page-sizes="[10, 20, 30, 40]" |
||||
:size="small" |
||||
:disabled="disabled" |
||||
:background="background" |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="40" |
||||
@size-change="handleSizeChange" |
||||
@current-change="handleCurrentChange" |
||||
/> |
||||
</div> |
||||
</el-card> |
||||
</page-container> |
||||
</template> |
||||
|
||||
<script setup> |
||||
import { ref, readonly } from 'vue' |
||||
|
||||
const dialogVisible = ref(false) // 控制Dialog的显示与隐藏 |
||||
const name = ref('John') // 可修改字段 |
||||
const age = ref(25) // 可修改字段 |
||||
|
||||
const readonlyName = readonly(name) // 将name字段设置为只读 |
||||
const readonlyAge = readonly(age) // 将age字段设置为只读 |
||||
|
||||
const collectData = () => { |
||||
// 在这里可以收集Dialog中的其他可修改字段的数据 |
||||
// ... |
||||
<style lang="scss" scoped> |
||||
.page-container { |
||||
min-height: 100%; |
||||
box-sizing: border-box; |
||||
background: #ffffff; |
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1); |
||||
flex: 1; |
||||
} |
||||
.card-header { |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: space-between; |
||||
} |
||||
.content { |
||||
min-height: 440px; |
||||
} |
||||
|
||||
console.log(readonlyName.value) // 可以访问只读字段的值 |
||||
console.log(readonlyAge.value) // 可以访问只读字段的值 |
||||
.input_search { |
||||
position: relative; |
||||
// border-radius: 8px; |
||||
} |
||||
</script> |
||||
.el-icon { |
||||
position: absolute; |
||||
right: 10px; |
||||
top: 50%; |
||||
transform: translateY(-50%); |
||||
} |
||||
.btn_search { |
||||
margin-left: 15px; |
||||
border-radius: 8px; |
||||
font-size: 13px; |
||||
background-color: #377be5; |
||||
color: #fff; |
||||
} |
||||
.el-table { |
||||
font-family: Arial, sans-serif; |
||||
font-size: 14px; |
||||
font-weight: normal; |
||||
color: #666; |
||||
// height: 10px; |
||||
} |
||||
.el-table .el-table-column { |
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; |
||||
font-size: 16px; |
||||
font-weight: bold; |
||||
color: #af4141; |
||||
} |
||||
::v-deep.el-table td.el-table__cell div { |
||||
// margin-left: -6px; |
||||
// width: 170px; |
||||
height: 40px; |
||||
line-height: 40px; |
||||
} |
||||
::v-deep .el-scrollbar__wrap { |
||||
padding: 0px 0px; |
||||
} |
||||
.el-pagination { |
||||
margin-top: 30px; |
||||
text-align: center; |
||||
justify-content: end; |
||||
font-size: 12px; |
||||
} |
||||
</style> |
||||
|
@ -1,68 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-button type="primary" @click="openDrawer">Open Drawer</el-button> |
||||
<el-drawer |
||||
title="Drawer Title" |
||||
v-model:visible="drawerVisible" |
||||
:direction="drawerDirection" |
||||
> |
||||
<el-table :data="formModel" style="width: 100%"> |
||||
<el-table-column prop="name" label="Name"></el-table-column> |
||||
<el-table-column prop="content" label="Content"> |
||||
<template v-slot="scope"> |
||||
<el-input |
||||
v-model="scope.row.content" |
||||
@input="handleInput(scope.row)" |
||||
></el-input> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<template v-slot:footer> |
||||
<div> |
||||
<el-button @click="cancelEdit">Cancel</el-button> |
||||
<el-button type="primary" @click="saveEdit">Save</el-button> |
||||
</div> |
||||
</template> |
||||
</el-drawer> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
formModel: [ |
||||
{ name: 'Macbook', content: 9.9 }, |
||||
{ name: 'iPhone', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
{ name: '小米电脑', content: 9.9 }, |
||||
], |
||||
drawerVisible: false, |
||||
drawerDirection: 'ltr', |
||||
} |
||||
}, |
||||
methods: { |
||||
openDrawer() { |
||||
this.drawerVisible = true |
||||
}, |
||||
cancelEdit() { |
||||
this.drawerVisible = false |
||||
}, |
||||
saveEdit() { |
||||
// 执行保存修改的逻辑,可以将数据发送给后端进行保存 |
||||
console.log('Save Edit:', this.formModel) |
||||
this.drawerVisible = false |
||||
}, |
||||
handleInput(row) { |
||||
// 处理输入框的输入事件,可以在此处更新数据 |
||||
console.log('Handle Input:', row) |
||||
}, |
||||
}, |
||||
} |
||||
</script> |
Loading…
Reference in new issue