import { jsx as _jsx } from "react/jsx-runtime"; import { ProTable } from '@ant-design/pro-components'; import { getExperList, onDisable } from './action'; import { useMemo } from 'react'; import { useRoutes, themeMessage } from '@component/utils'; import { Button, message, Modal } from 'antd'; import { ExclamationCircleOutlined } from '@ant-design/icons'; import { useRequest } from 'ahooks'; const { confirm } = Modal; export default function ({ params }) { const { historyPush } = useRoutes(); const { loading, runAsync } = useRequest(onDisable, { manual: true, onSuccess(result, params) { themeMessage(result); }, onError(result) { message.error(result.message); }, }); const showConfirm = (record, action) => { const { userId, status } = record; confirm({ title: '禁用提醒', icon: _jsx(ExclamationCircleOutlined, {}), content: status == '2' ? '确定启用吗?' : '禁用后,服务人员将不能登录专家App端进行事故预防服务,确定禁用?', onOk() { runAsync({ userId, status: status == '1' ? '2' : '1' }).then((result) => { if (result.type === 'success') { action === null || action === void 0 ? void 0 : action.reload(); } }); }, }); }; const columns = useMemo(() => [ { title: '用户工号', dataIndex: 'userNo', ellipsis: true, search: false, }, { title: '专家姓名', dataIndex: 'userName', ellipsis: true, fieldProps: { placeholder: '工号/姓名', }, formItemProps: { name: 'keyword', label: '关键字', }, render: (_, record) => [ _jsx("a", Object.assign({ onClick: () => historyPush('expertDetail', { userId: record.userId }) }, { children: record.userName })), ], }, { title: '性别', dataIndex: 'sex', search: false, ellipsis: true, render: (_, record) => record.sex == '1' ? '男' : record.sex == '2' ? '女' : null, }, { title: '年龄', dataIndex: 'age', ellipsis: true, search: false, }, { title: '手机号', dataIndex: 'desensitizationPhone', ellipsis: true, search: false, }, { title: '账号状态', dataIndex: 'status', ellipsis: true, search: false, render: (_, record) => record.status == '1' ? (_jsx("span", Object.assign({ style: { color: '#0067D3' } }, { children: "\u542F\u7528" }))) : record.status == '2' ? (_jsx("span", Object.assign({ style: { color: '#BF341F' } }, { children: "\u7981\u7528" }))) : null, }, { title: '服务区域', dataIndex: 'scopeGridName', ellipsis: true, search: false, }, { title: '主要服务项目', dataIndex: 'skilledWorkName', ellipsis: true, search: false, }, { title: '操作', width: 70, valueType: 'option', align: 'center', key: 'option', fixed: 'right', render: (text, record, _, action) => { if (record.status == '2') { return (_jsx(Button, Object.assign({ type: "link", onClick: () => showConfirm(record, action) }, { children: "\u542F\u7528" }))); } else { return (_jsx(Button, Object.assign({ type: "link", danger: true, onClick: () => showConfirm(record, action) }, { children: "\u7981\u7528" }))); } }, }, ]); return (_jsx("div", Object.assign({ className: "page-content-detail-tabs" }, { children: _jsx(ProTable, { columns: columns, request: getExperList, rowKey: "userId", params: { serviceOrganId: params.organId, }, options: false, pagination: { pageSize: 15, } }) }))); }