| | |
| | | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| | | import { BasicColumn, FormSchema } from '@/components/Table'; |
| | | import { h } from 'vue'; |
| | | import { Switch } from 'ant-design-vue'; |
| | | import { setRoleStatus } from '/@/api/demo/system'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { setRoleStatus } from '@/api/demo/system'; |
| | | import { useMessage } from '@/hooks/web/useMessage'; |
| | | |
| | | type CheckedType = boolean | string | number; |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: '角色名称', |
| | |
| | | } |
| | | return h(Switch, { |
| | | checked: record.status === '1', |
| | | checkedChildren: '已启用', |
| | | unCheckedChildren: '已禁用', |
| | | checkedChildren: '停用', |
| | | unCheckedChildren: '启用', |
| | | loading: record.pendingStatus, |
| | | onChange(checked: boolean) { |
| | | onChange(checked: CheckedType) { |
| | | record.pendingStatus = true; |
| | | const newStatus = checked ? '1' : '0'; |
| | | const { createMessage } = useMessage(); |
| | |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: [ |
| | | { label: '启用', value: '0' }, |
| | | { label: '停用', value: '1' }, |
| | | { label: '启用', value: '1' }, |
| | | { label: '停用', value: '0' }, |
| | | ], |
| | | }, |
| | | colProps: { span: 8 }, |
| | |
| | | defaultValue: '0', |
| | | componentProps: { |
| | | options: [ |
| | | { label: '启用', value: '0' }, |
| | | { label: '停用', value: '1' }, |
| | | { label: '启用', value: '1' }, |
| | | { label: '停用', value: '0' }, |
| | | ], |
| | | }, |
| | | }, |
| | |
| | | label: ' ', |
| | | field: 'menu', |
| | | slot: 'menu', |
| | | component: 'Input', |
| | | }, |
| | | ]; |