新增-全界面弹出框组件
This commit is contained in:
@@ -95,6 +95,39 @@ const data = [
|
|||||||
'status': 1,
|
'status': 1,
|
||||||
'rolename': '操作员',
|
'rolename': '操作员',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'id': '448686878612127245',
|
||||||
|
'username': 'operator_J',
|
||||||
|
'password': '12345678',
|
||||||
|
'realname': '孙芳2',
|
||||||
|
'status': 1,
|
||||||
|
'rolename': '操作员',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': '448686878612127245',
|
||||||
|
'username': 'operator_J',
|
||||||
|
'password': '12345678',
|
||||||
|
'realname': '孙芳2',
|
||||||
|
'status': 1,
|
||||||
|
'rolename': '操作员',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': '448686878612127245',
|
||||||
|
'username': 'operator_J',
|
||||||
|
'password': '12345678',
|
||||||
|
'realname': '孙芳2',
|
||||||
|
'status': 1,
|
||||||
|
'rolename': '操作员',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': '448686878612127245',
|
||||||
|
'username': 'operator_J',
|
||||||
|
'password': '12345678',
|
||||||
|
'realname': '孙芳2',
|
||||||
|
'status': 1,
|
||||||
|
'rolename': '操作员',
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取本地时间
|
* @description 获取本地时间
|
||||||
*/
|
*/
|
||||||
export const useTime = () => {
|
export const useTime = () => {
|
||||||
const year = ref(0); // 年份
|
const year = ref(0) // 年份
|
||||||
const month = ref(0); // 月份
|
const month = ref(0) // 月份
|
||||||
const week = ref(""); // 星期几
|
const week = ref('') // 星期几
|
||||||
const day = ref(0); // 天数
|
const day = ref(0) // 天数
|
||||||
const hour = ref<number | string>(0); // 小时
|
const hour = ref<number | string>(0) // 小时
|
||||||
const minute = ref<number | string>(0); // 分钟
|
const minute = ref<number | string>(0) // 分钟
|
||||||
const second = ref<number | string>(0); // 秒
|
const second = ref<number | string>(0) // 秒
|
||||||
const nowTime = ref<string>(""); // 当前时间
|
const nowTime = ref<string>('') // 当前时间
|
||||||
|
|
||||||
// 更新时间
|
// 更新时间
|
||||||
const updateTime = () => {
|
const updateTime = () => {
|
||||||
const date = new Date();
|
const date = new Date()
|
||||||
year.value = date.getFullYear();
|
year.value = date.getFullYear()
|
||||||
month.value = date.getMonth() + 1;
|
month.value = date.getMonth() + 1
|
||||||
week.value = "日一二三四五六".charAt(date.getDay());
|
week.value = '日一二三四五六'.charAt(date.getDay())
|
||||||
day.value = date.getDate();
|
day.value = date.getDate()
|
||||||
hour.value =
|
hour.value =
|
||||||
(date.getHours() + "")?.padStart(2, "0") ||
|
(date.getHours() + '')?.padStart(2, '0') ||
|
||||||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getHours());
|
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getHours())
|
||||||
minute.value =
|
minute.value =
|
||||||
(date.getMinutes() + "")?.padStart(2, "0") ||
|
(date.getMinutes() + '')?.padStart(2, '0') ||
|
||||||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getMinutes());
|
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getMinutes())
|
||||||
second.value =
|
second.value =
|
||||||
(date.getSeconds() + "")?.padStart(2, "0") ||
|
(date.getSeconds() + '')?.padStart(2, '0') ||
|
||||||
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getSeconds());
|
new Intl.NumberFormat(undefined, { minimumIntegerDigits: 2 }).format(date.getSeconds())
|
||||||
nowTime.value = `${year.value}年${month.value}月${day.value} ${hour.value}:${minute.value}:${second.value}`;
|
nowTime.value = `${year.value}年${month.value}月${day.value} ${hour.value}:${minute.value}:${second.value}`
|
||||||
};
|
}
|
||||||
|
|
||||||
updateTime();
|
updateTime()
|
||||||
|
|
||||||
return { year, month, day, hour, minute, second, week, nowTime };
|
return { year, month, day, hour, minute, second, week, nowTime }
|
||||||
};
|
}
|
||||||
|
|||||||
37
frontend/src/hooks/useViewSize.ts
Normal file
37
frontend/src/hooks/useViewSize.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export const useViewSize = () => {
|
||||||
|
|
||||||
|
const popupBaseView = ref(null)
|
||||||
|
const viewWidth = ref("0")
|
||||||
|
const viewHeight = ref("0")
|
||||||
|
const unit = 'px'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新宽和高的数据
|
||||||
|
*/
|
||||||
|
const updateDimensions = () => {
|
||||||
|
if (popupBaseView.value) {
|
||||||
|
viewWidth.value = popupBaseView.value.offsetWidth + unit
|
||||||
|
viewHeight.value = popupBaseView.value.offsetHeight + unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件挂载完毕,计算宽高,并且给浏览器添加监听器,监听窗口大小改变
|
||||||
|
*/
|
||||||
|
onMounted(() => {
|
||||||
|
updateDimensions()
|
||||||
|
window.addEventListener('resize', updateDimensions)
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件视图更新完毕,计算宽高
|
||||||
|
*/
|
||||||
|
onUpdated(() => {
|
||||||
|
updateDimensions()
|
||||||
|
})
|
||||||
|
|
||||||
|
return { popupBaseView, viewWidth, viewHeight }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
.mask-image {
|
.mask-image {
|
||||||
padding-right: 50px;
|
padding-right: 50px;
|
||||||
mask-image: linear-gradient(90deg,
|
mask-image: linear-gradient(90deg,
|
||||||
#000000 0%,
|
#000000 0%,
|
||||||
#000000 calc(100% - 50px),
|
#000000 calc(100% - 50px),
|
||||||
transparent);
|
transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* custom card */
|
/* custom card */
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
.el-form {
|
.el-form {
|
||||||
.el-form-item__content>* {
|
.el-form-item__content > * {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置 el-table 中 header 文字不换行,并省略
|
// 设置 el-table 中 header 文字不换行,并省略
|
||||||
.el-table__header .el-table__cell>.cell {
|
.el-table__header .el-table__cell > .cell {
|
||||||
// white-space: nowrap;
|
// white-space: nowrap;
|
||||||
white-space: wrap;
|
white-space: wrap;
|
||||||
}
|
}
|
||||||
@@ -328,6 +328,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-overlay {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.el-dialog__body {
|
.el-dialog__body {
|
||||||
// height: 200px;
|
// height: 200px;
|
||||||
// max-height: 60vh;
|
// max-height: 60vh;
|
||||||
@@ -356,19 +361,20 @@
|
|||||||
border-top: 1px solid #cccccc;
|
border-top: 1px solid #cccccc;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
font-size: 12px ;
|
font-size: 12px;
|
||||||
|
|
||||||
padding: 5px 11px;
|
padding: 5px 11px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
|
||||||
}
|
|
||||||
.el-button + .el-button {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-button + .el-button {
|
||||||
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//全局el-form-item间距
|
//全局el-form-item间距
|
||||||
@@ -434,37 +440,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-small{
|
|
||||||
.el-dialog__body{
|
.dialog-small {
|
||||||
|
.el-dialog__body {
|
||||||
max-height: 260px;
|
max-height: 260px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dialog-middle{
|
|
||||||
.el-dialog__body{
|
.dialog-middle {
|
||||||
|
.el-dialog__body {
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.dialog-big{
|
|
||||||
.el-dialog__body{
|
.dialog-big {
|
||||||
|
.el-dialog__body {
|
||||||
max-height: 620px;
|
max-height: 620px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-two {
|
.form-two {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
width: 48%;
|
||||||
justify-content: space-between;
|
|
||||||
.el-form-item {
|
.el-form-item__content {
|
||||||
display: flex;
|
flex: 1;
|
||||||
width: 48%;
|
|
||||||
.el-form-item__content {
|
.el-select,
|
||||||
flex: 1;
|
.el-cascader,
|
||||||
.el-select,
|
.el-input__inner,
|
||||||
.el-cascader,
|
.el-date-editor {
|
||||||
.el-input__inner,
|
width: 100%;
|
||||||
.el-date-editor {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box'>
|
<div class='table-box' ref='popupBaseView'>
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='userData'
|
:data='userData'
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
@@ -22,12 +22,13 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
<el-button type='primary' link :icon='CirclePlus' @click='deleteAccount()'>下钻</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
<single-column ref='singleColumn' />
|
<single-column ref='singleColumn' />
|
||||||
<double-column ref='doubleColumn' />
|
<double-column ref='doubleColumn' />
|
||||||
|
<open :width='viewWidth' :height='viewHeight' ref='openView' />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
@@ -42,24 +43,26 @@ import { CirclePlus, Delete, EditPen, Download, Upload, View, Refresh } from '@e
|
|||||||
import userDataList from '@/api/user/userData'
|
import userDataList from '@/api/user/userData'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import SingleColumn from '@/views/demo/proTable/singleColumn.vue'
|
import SingleColumn from '@/views/demo/proTable/singleColumn.vue'
|
||||||
|
import Open from '@/views/demo/proTable/Open.vue'
|
||||||
import DoubleColumn from '@/views/demo/proTable/doubleColumn.vue'
|
import DoubleColumn from '@/views/demo/proTable/doubleColumn.vue'
|
||||||
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
|
|
||||||
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
import {
|
import {
|
||||||
getUserList,
|
getUserList,
|
||||||
deleteUser,
|
deleteUser,
|
||||||
changeUserStatus,
|
changeUserStatus,
|
||||||
resetUserPassWord,
|
|
||||||
exportUserInfo,
|
exportUserInfo,
|
||||||
BatchAddUser,
|
BatchAddUser,
|
||||||
getUserStatus,
|
|
||||||
} from '@/api/user/user'
|
} from '@/api/user/user'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
import router from '@/routers'
|
|
||||||
|
|
||||||
const userData = userDataList
|
const userData = userDataList
|
||||||
const singleColumn = ref()
|
const singleColumn = ref()
|
||||||
const doubleColumn = ref()
|
const doubleColumn = ref()
|
||||||
|
const openView = ref()
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
@@ -108,16 +111,16 @@ const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|||||||
// 自定义 search 显示内容
|
// 自定义 search 显示内容
|
||||||
render: ({ searchParam }) => {
|
render: ({ searchParam }) => {
|
||||||
return (
|
return (
|
||||||
<div class='flx-center'>
|
<div class='flx-center'>
|
||||||
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
||||||
<span class='mr10 ml10'>-</span>
|
<span class='mr10 ml10'>-</span>
|
||||||
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'idCard', label: '身份证号', search: { el: 'input' } },
|
{ prop: 'idCard', label: '身份证号' },
|
||||||
{ prop: 'email', label: '邮箱' },
|
{ prop: 'email', label: '邮箱' },
|
||||||
{ prop: 'address', label: '居住地址', width: 120 },
|
{ prop: 'address', label: '居住地址', width: 120 },
|
||||||
{
|
{
|
||||||
@@ -128,19 +131,19 @@ const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|||||||
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{BUTTONS.value.status ? (
|
{BUTTONS.value.status ? (
|
||||||
<el-switch
|
<el-switch
|
||||||
model-value={scope.row.status}
|
model-value={scope.row.status}
|
||||||
active-text={scope.row.status ? '启用' : '禁用'}
|
active-text={scope.row.status ? '启用' : '禁用'}
|
||||||
active-value={1}
|
active-value={1}
|
||||||
inactive-value={0}
|
inactive-value={0}
|
||||||
onClick={() => changeStatus(scope.row)}
|
onClick={() => changeStatus(scope.row)}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -157,11 +160,11 @@ const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
|||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
])
|
])
|
||||||
// 删除用户信息
|
|
||||||
const deleteAccount = async (params: User.ResUserList) => {
|
|
||||||
// await useHandleData(deleteUser, { id: [params.id] }, `删除【${params.username}】用户`)
|
// 下钻
|
||||||
// proTable.value?.getTableList()
|
const deleteAccount = async () => {
|
||||||
router.push('/plan/autoTest')
|
openView.value.open('测试弹出框')
|
||||||
}
|
}
|
||||||
// 批量删除用户信息
|
// 批量删除用户信息
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
@@ -186,7 +189,7 @@ const changeStatus = async (row: User.ResUserList) => {
|
|||||||
// 导出用户列表
|
// 导出用户列表
|
||||||
const downloadFile = async () => {
|
const downloadFile = async () => {
|
||||||
ElMessageBox.confirm('确认导出用户数据?', '温馨提示', { type: 'warning' }).then(() =>
|
ElMessageBox.confirm('确认导出用户数据?', '温馨提示', { type: 'warning' }).then(() =>
|
||||||
useDownload(exportUserInfo, '用户列表', proTable.value?.searchParam),
|
useDownload(exportUserInfo, '用户列表', proTable.value?.searchParam),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// 批量添加用户
|
// 批量添加用户
|
||||||
|
|||||||
177
frontend/src/views/demo/proTable/open.vue
Normal file
177
frontend/src/views/demo/proTable/open.vue
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<!--单列-->
|
||||||
|
<template>
|
||||||
|
<el-dialog class='table-box'
|
||||||
|
v-model='dialogVisible'
|
||||||
|
top='114px'
|
||||||
|
:style="{height:height,maxHeight:height,overflow:'hidden'}"
|
||||||
|
:title='title'
|
||||||
|
:width='width'
|
||||||
|
:modal='false'>
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='userData'
|
||||||
|
>
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='CirclePlus' @click="openDrawer('新增')">新增用户</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View'
|
||||||
|
@click="openDrawer('查看', scope.row)">查看
|
||||||
|
</el-button>
|
||||||
|
<el-button type='primary' link :icon='EditPen' @click="openDrawer('编辑', scope.row)">编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Refresh' @click='resetPass(scope.row)'>重置密码</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' @click='deleteAccount(scope.row)'>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang='tsx'>
|
||||||
|
import { CirclePlus, Delete, EditPen, Refresh, View } from '@element-plus/icons-vue'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import { reactive } from 'vue'
|
||||||
|
import { ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import { User } from '@/api/user/interface'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
import {
|
||||||
|
changeUserStatus,
|
||||||
|
} from '@/api/user/user'
|
||||||
|
import userDataList from '@/api/user/userData'
|
||||||
|
|
||||||
|
const userData = userDataList
|
||||||
|
const proTable = ref()
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('单列弹出框')
|
||||||
|
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'username',
|
||||||
|
label: '姓名',
|
||||||
|
width: 120,
|
||||||
|
search: { el: 'input' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'gender',
|
||||||
|
label: '性别',
|
||||||
|
// 字典数据(本地数据)
|
||||||
|
enum: dictStore.getDictData('sex'),
|
||||||
|
search: { el: 'select', props: { filterable: true } },
|
||||||
|
fieldNames: { label: 'label', value: 'code' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'age',
|
||||||
|
label: '年龄',
|
||||||
|
search: {
|
||||||
|
// 自定义 search 显示内容
|
||||||
|
render: ({ searchParam }) => {
|
||||||
|
return (
|
||||||
|
<div class='flx-center'>
|
||||||
|
<el-input vModel_trim={searchParam.minAge} placeholder='最小年龄' />
|
||||||
|
<span class='mr10 ml10'>-</span>
|
||||||
|
<el-input vModel_trim={searchParam.maxAge} placeholder='最大年龄' />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'idCard', label: '身份证号', search: { el: 'input' } },
|
||||||
|
{ prop: 'email', label: '邮箱' },
|
||||||
|
{ prop: 'address', label: '居住地址', width: 120 },
|
||||||
|
{
|
||||||
|
prop: 'status',
|
||||||
|
label: '状态',
|
||||||
|
enum: dictStore.getDictData('status'),
|
||||||
|
search: { el: 'tree-select', props: { filterable: true } },
|
||||||
|
fieldNames: { label: 'userLabel', value: 'userStatus' },
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{BUTTONS.value.status ? (
|
||||||
|
<el-switch
|
||||||
|
model-value={scope.row.status}
|
||||||
|
active-text={scope.row.status ? '启用' : '禁用'}
|
||||||
|
active-value={1}
|
||||||
|
inactive-value={0}
|
||||||
|
onClick={() => changeStatus(scope.row)}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<el-tag type={scope.row.status ? 'success' : 'danger'}>{scope.row.status ? '启用' : '禁用'}</el-tag>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'createTime',
|
||||||
|
label: '创建时间',
|
||||||
|
width: 180,
|
||||||
|
search: {
|
||||||
|
el: 'date-picker',
|
||||||
|
span: 1,
|
||||||
|
props: { type: 'daterange', valueFormat: 'YYYY-MM-DD' },
|
||||||
|
defaultValue: ['2024-11-12', '2024-12-12'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
const open = (textTitle: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
title.value = textTitle
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '744px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// 切换用户状态
|
||||||
|
const changeStatus = async (row: User.ResUserList) => {
|
||||||
|
await useHandleData(changeUserStatus, {
|
||||||
|
id: row.id,
|
||||||
|
status: row.status == 1 ? 0 : 1,
|
||||||
|
}, `切换【${row.username}】用户状态`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除用户信息
|
||||||
|
const deleteAccount = async (params: User.ResUserList) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 重置用户密码
|
||||||
|
const resetPass = async (params: User.ResUserList) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开 drawer(新增、查看、编辑)
|
||||||
|
const openDrawer = (title: string, row: Partial<User.ResUserList> = {}) => {
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user