parent
50d862dec6
commit
52a5cb8dc6
@ -3,8 +3,8 @@ import { nextTick, reactive, ref } from "vue"
|
|||||||
import { type ElMessageBoxOptions, ElMessageBox, ElMessage } from "element-plus"
|
import { type ElMessageBoxOptions, ElMessageBox, ElMessage } from "element-plus"
|
||||||
import { deleteTableDataApi, getTableDataApi } from "@/api/table"
|
import { deleteTableDataApi, getTableDataApi } from "@/api/table"
|
||||||
import { type TableResponseData } from "@/api/table/types/table"
|
import { type TableResponseData } from "@/api/table/types/table"
|
||||||
import RoleColumnSolts from "./tsx/RoleColumnSolts"
|
import RoleColumnSlots from "./tsx/RoleColumnSlots"
|
||||||
import StatusColumnSolts from "./tsx/StatusColumnSolts"
|
import StatusColumnSlots from "./tsx/StatusColumnSlots"
|
||||||
import {
|
import {
|
||||||
type VxeGridInstance,
|
type VxeGridInstance,
|
||||||
type VxeGridProps,
|
type VxeGridProps,
|
||||||
@ -31,6 +31,7 @@ interface RowMeta {
|
|||||||
/** vxe-table 自动添加上去的属性 */
|
/** vxe-table 自动添加上去的属性 */
|
||||||
_VXE_ID?: string
|
_VXE_ID?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const xGridDom = ref<VxeGridInstance>()
|
const xGridDom = ref<VxeGridInstance>()
|
||||||
const xGridOpt: VxeGridProps = reactive({
|
const xGridOpt: VxeGridProps = reactive({
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -96,7 +97,7 @@ const xGridOpt: VxeGridProps = reactive({
|
|||||||
field: "roles",
|
field: "roles",
|
||||||
title: "角色",
|
title: "角色",
|
||||||
/** 自定义列与 type: "html" 的列一起使用,会产生错误,所以采用 TSX 实现 */
|
/** 自定义列与 type: "html" 的列一起使用,会产生错误,所以采用 TSX 实现 */
|
||||||
slots: RoleColumnSolts
|
slots: RoleColumnSlots
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "phone",
|
field: "phone",
|
||||||
@ -109,7 +110,7 @@ const xGridOpt: VxeGridProps = reactive({
|
|||||||
{
|
{
|
||||||
field: "status",
|
field: "status",
|
||||||
title: "状态",
|
title: "状态",
|
||||||
slots: StatusColumnSolts
|
slots: StatusColumnSlots
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: "createTime",
|
field: "createTime",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { type VxeColumnPropTypes } from "vxe-table/types/column"
|
import { type VxeColumnPropTypes } from "vxe-table/types/column"
|
||||||
|
|
||||||
const solts: VxeColumnPropTypes.Slots = {
|
const slots: VxeColumnPropTypes.Slots = {
|
||||||
default: ({ row, column }) => {
|
default: ({ row, column }) => {
|
||||||
const cellValue = row[column.field]
|
const cellValue = row[column.field]
|
||||||
const type = cellValue === "admin" ? "primary" : "warning"
|
const type = cellValue === "admin" ? "primary" : "warning"
|
||||||
@ -8,4 +8,4 @@ const solts: VxeColumnPropTypes.Slots = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default solts
|
export default slots
|
@ -1,6 +1,6 @@
|
|||||||
import { type VxeColumnPropTypes } from "vxe-table/types/column"
|
import { type VxeColumnPropTypes } from "vxe-table/types/column"
|
||||||
|
|
||||||
const solts: VxeColumnPropTypes.Slots = {
|
const slots: VxeColumnPropTypes.Slots = {
|
||||||
default: ({ row, column }) => {
|
default: ({ row, column }) => {
|
||||||
const cellValue = row[column.field]
|
const cellValue = row[column.field]
|
||||||
const [type, value] = cellValue ? ["success", "启用"] : ["danger", "禁用"]
|
const [type, value] = cellValue ? ["success", "启用"] : ["danger", "禁用"]
|
||||||
@ -8,4 +8,4 @@ const solts: VxeColumnPropTypes.Slots = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default solts
|
export default slots
|
Loading…
x
Reference in New Issue
Block a user