大屏项目初始化
This commit is contained in:
@@ -16,57 +16,46 @@
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="姓名"
|
||||
width="120"
|
||||
prop="createTime"
|
||||
label="记录日期"
|
||||
width="180"
|
||||
fixed="left"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="age"
|
||||
label="年龄"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="gender"
|
||||
label="性别"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="phone"
|
||||
label="手机号"
|
||||
width="150"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="email"
|
||||
label="邮箱"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
label="地址"
|
||||
width="250"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="company"
|
||||
label="公司"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="position"
|
||||
label="职位"
|
||||
width="150"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="salary"
|
||||
label="薪资"
|
||||
prop="title"
|
||||
label="主题"
|
||||
width="120"
|
||||
show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="entryDate"
|
||||
label="入职日期"
|
||||
width="150"
|
||||
fixed="right"
|
||||
prop="content"
|
||||
label="内容"
|
||||
show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="级别"
|
||||
width="80"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ priorityDict[scope.row.priority] || '未知' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="类型"
|
||||
width="100"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ typeDict[scope.row.type] || '未知' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="状态"
|
||||
width="100"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ stausDict[scope.row.ustatus] || '未知' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,43 +65,45 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElTable, ElTableColumn, ElLoading } from 'element-plus'
|
||||
|
||||
// 生成模拟数据
|
||||
const generateTableData = () => {
|
||||
const data = []
|
||||
const names = ['张三', '李四', '王五', '赵六', '钱七', '孙八', '周九', '吴十']
|
||||
const genders = ['男', '女']
|
||||
const positions = ['前端开发', '后端开发', '产品经理', 'UI设计', '测试工程师', '运维工程师']
|
||||
const companies = ['科技有限公司', '网络科技公司', '信息技术公司', '数据服务公司']
|
||||
|
||||
for (let i = 1; i <= 50; i++) {
|
||||
data.push({
|
||||
id: i,
|
||||
name: names[Math.floor(Math.random() * names.length)] + i,
|
||||
age: Math.floor(Math.random() * 30) + 20,
|
||||
gender: genders[Math.floor(Math.random() * genders.length)],
|
||||
phone: `13${Math.floor(Math.random() * 900000000) + 100000000}`,
|
||||
email: `user${i}@example.com`,
|
||||
address: `北京市朝阳区某某街道${Math.floor(Math.random() * 100)}号`,
|
||||
company: Math.floor(Math.random() * 10) + '号' + companies[Math.floor(Math.random() * companies.length)],
|
||||
position: positions[Math.floor(Math.random() * positions.length)],
|
||||
salary: `${Math.floor(Math.random() * 30) + 10}k`,
|
||||
entryDate: `202${Math.floor(Math.random() * 5) + 1}-${Math.floor(Math.random() * 12) + 1}-${Math.floor(Math.random() * 28) + 1}`
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
import { ElTable, ElTableColumn } from 'element-plus'
|
||||
import { getNoteList } from '@/api/bizHome'
|
||||
|
||||
const tableData = ref([])
|
||||
const loading = ref(true)
|
||||
|
||||
onMounted(() => {
|
||||
// 模拟接口请求延迟
|
||||
setTimeout(() => {
|
||||
tableData.value = generateTableData()
|
||||
const priorityDict = {
|
||||
low: '低',
|
||||
medium: '中',
|
||||
high: '高'
|
||||
}
|
||||
|
||||
const typeDict = {
|
||||
work: '工作',
|
||||
life: '生活',
|
||||
study: '学习',
|
||||
other: '其他'
|
||||
}
|
||||
|
||||
const stausDict = {
|
||||
todo: '待开始',
|
||||
doing: '进行中',
|
||||
done: '已完成'
|
||||
}
|
||||
|
||||
async function getDataList() {
|
||||
try {
|
||||
const res = await getNoteList()
|
||||
tableData.value = res || []
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error)
|
||||
tableData.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
getDataList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -183,7 +174,23 @@ onMounted(() => {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 表格滚动条样式优化 */
|
||||
:deep(.el-table td),
|
||||
:deep(.el-table th.is-leaf) {
|
||||
border-right: none !important;
|
||||
}
|
||||
:deep(.el-table__fixed-left) {
|
||||
border-right: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
:deep(.el-table__fixed-right) {
|
||||
border-left: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
:deep(.el-table__fixed td),
|
||||
:deep(.el-table__fixed th) {
|
||||
border-right: none !important;
|
||||
}
|
||||
|
||||
:deep(.el-table__body-wrapper) {
|
||||
overflow: auto;
|
||||
}
|
||||
@@ -208,15 +215,6 @@ onMounted(() => {
|
||||
background: #c0c4cc;
|
||||
}
|
||||
|
||||
/* 固定表头样式优化 */
|
||||
:deep(.el-table__fixed-left) {
|
||||
box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
:deep(.el-table__fixed-right) {
|
||||
box-shadow: -2px 0 6px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
:deep(.el-table th) {
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
|
||||
Reference in New Issue
Block a user