import { h, ref } from 'vue' import { ColumnsProps } from '../../../components/table/table-helper' import { MenuManage } from '../../../entity/system/menu-manage' import { Switch } from 'ant-design-vue' import requestMethod from '../../../api/system/menu' const columns = ref[]>([ { title: '菜单名称', width: 120, dataIndex: 'menuName' }, { title: '菜单编号', width: 120, dataIndex: 'menuCode' }, { title: '菜单url', width: 120, dataIndex: 'linkUrl' }, { title: '菜单完整名称', width: 120, dataIndex: 'displayName' }, { title: '排序', align: 'center', width: 70, dataIndex: 'sortCode' }, { title: '站点', align: 'center', width: 120, dataIndex: 'siteCode' }, { title: '是否显示', dataIndex: 'isShow', align: 'center', width: 120, customRender: ({ record }) => h(Switch, { checked: record.isShow, checkedValue: 1, unCheckedValue: 0, checkedChildren: '显示', unCheckedChildren: '隐藏', onChange: value => { const item = { ...record, isShow: value } requestMethod.updateShow(item).then(() => { record.isShow = value as number record.version = (record.version || 0) + 1 }) } }) } ]) export default columns