/* * @Author: your name * @Date: 2021-09-14 10:22:09 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /MedicalWisdomCheckSys/src/pages/GradeHospitalAccreditation/articleManagement/index.tsx */ import React, { useRef, useEffect, useState } from 'react' import MccsPageContainer from '@/components/MccsPageContainer/index' // import MccsProCard from '@/components/MccsProCard/index'; import { useModel } from 'umi'; import MccsFileTree from '@/components/MccsFileTree/index'; import MccsTable from '@/components/MccsTable/index'; import MccsClickableTabs from '@/components/MccsClickableTabs/index'; import MccsUpload from '@/components/MccsUpload/index'; import { MccsModal } from '@/components/MccsModal'; import { getDepartmentList } from './server'; import { getScoreLevelData } from '@/pages/PlatformMana/generalSetting/serve'; import { Form, Table, Space, Button, Switch, Select } from 'antd' import { ProFormText, ProFormSelect, ProFormDependency, } from '@ant-design/pro-form'; import './index.less'; import ArticleDetail from './components/articleDetailModule'; import MccsDrawerForm from '@/components/MccsDrawerForm/index'; const { Option } = Select; type ArticleManagementProps = { //组件配置信息 columnsFromProps?: {}[], headerConcig?: { [key: string]: any }, //配置参考ProPageContainer isModeTwo?: boolean } type SelectedRowsType = { [propsName: string]: any } export enum ActType { 'NOACT', //不操作 'ADD', 'EDIT', 'DEL' }; //条文管理 const ArticleManagement: React.FC = (props) => { const { columnsFromProps = [], headerConcig, isModeTwo } = props; const { articleManagement } = useModel('allModels'); const { isLeaf, treeData, getTableData, currentActivedTree, setCurrentActivedTree, scoreList, getDepartmentRequest, departmentManagers, getDepartment,//获取责任单位 currentSelectedActObj, setdetailDrawerVisible, detailDrawerVisible, ...restModelData } = articleManagement; const tableRef = useRef(); const [defaultOpened, setDefaultOpened] = useState(); const [departments, setdepartments] = useState<{ label: string; value: string }[]>([]); const columns = [ { key: 'keyword', hideInTable: true, renderFormItem: (item: any, { type }: any, form: any) => { if (type === 'form') { return null; } return ( ) }, }, { key: 'department', hideInTable: true, renderFormItem: (item: any, { type }: any, form: any) => { if (type === 'form') { return null; } return ( ) }, }, { key: 'name', hideInTable: true, renderFormItem: (item: any, { type }: any, form: any) => { if (type === 'form') { return null; } return ( ) }, }, { key: 'selfEvaluation', hideInTable: true, renderFormItem: (item: any, { type }: any, form: any) => { if (type === 'form') { return null; } return ( { const data = await getScoreLevelData(); if (!data) return []; return data.map(item => ({ label: item.levelNumber, value: item.levelNumber })) }} placeholder="选择自评" rules={[{ required: false }]} /> ) }, }, { key: 'targetEvaluation', hideInTable: true, renderFormItem: (item: any, { type }: any, form: any) => { if (type === 'form') { return null; } return ( { const data = await getScoreLevelData(); if (!data) return []; return data.map(item => ({ label: item.levelNumber, value: item.levelNumber })) }} placeholder="选择目标" rules={[{ required: false }]} /> ) }, }, { title: '条款', key: 'numStr', dataIndex: 'numStr', hideInSearch: true, }, { title: '条文', dataIndex: 'name', hideInSearch: true, width: '35%', ellipsis: true }, { title: '负责单位', dataIndex: 'responsibilityDepartmentName', hideInSearch: true, }, { title: '负责人', dataIndex: 'responsibilityUserName', hideInSearch: true, }, { title: '自评', hideInSearch: true, dataIndex: 'selfEvaluation', }, // { // title: '现场查核', // hideInSearch: true, // dataIndex: 'siteEvaluation', // }, { title: '目标', dataIndex: 'targetEvaluation', hideInSearch: true, }, { title: '系统评分', dataIndex: 'systemEvaluation', hideInSearch: true, }, { title: '操作', width: 100, valueType: 'option', render: (_: any, record: any) => { return [ openDetailInDrawer(record)}>详情] }, }, ] //左侧树搜索回调 const searchHandle = (val: any) => { restModelData.getArticleTreeData(val); } const onSelectHandle = (data: MccsFileTree.childTree) => { //左侧树节点点击回调 setCurrentActivedTree(data); restModelData.setCurrentSelectedActObj(data); articleManagement.setArticleSettingFormInit({});//清空默认值 //重新获取数据 tableRef?.current?.getTableRef().current?.reload(); } const batchSelfAssessment = (rowkeys: number[] | string[]) => { //批量设置 restModelData.setDrawerFormType('BATCHSETTING'); restModelData.setSelectedRowKeys(rowkeys); restModelData.setDrawerVisible(true); } const onModalVisibleChange = (visible: boolean) => { //表单弹窗 // console.log('uploadFormInitValue',restModelData.uploadFormInitValue); !visible && restModelData.setUploadFormInitValue(undefined); restModelData.setModalVisible(visible); } const uploadLedgerChangeHandle = (tabData: any) => { //台账上传类型选择回调 } const openDetailInDrawer = (record: any) => { // restModelData.setRecords(record) setdetailDrawerVisible(true); restModelData.setCurrentSelectedActObj(record); getTableData({ id: record.id}); } const taizhangImplementationCommit = () => { //台账执行情况编辑结果提交 restModelData.commitTaizhangImplementationHandle(); } const getDepartments = async () => { const resp = await getDepartmentList(); if (resp) { const { list = [] } = resp; setdepartments(list.map(t => ({ label: t.name, value: t.name }))); } } useEffect(() => { if (restModelData.reloadRightContent) { //重新获取数据 tableRef?.current?.getTableRef().current?.reload(); tableRef?.current?.getTableRef().current?.clearSelected(); } }, [restModelData]); useEffect(() => { //点击叶子结点时回调 if (restModelData.leafData) { const { responsibilityDepartmentId, responsibilityDepartmentName, responsibilityUserId, targetEvaluation, responsibilityUserName, accountType } = restModelData.leafData.reviewArticle; if (responsibilityDepartmentName && responsibilityDepartmentId) { articleManagement.setArticleSettingFormInit({ responsibilityDepartment: { label: responsibilityDepartmentName, value: responsibilityDepartmentId }, responsibilityUser: { label: responsibilityUserName, value: responsibilityUserId }, targetScores: { label: targetEvaluation, value: targetEvaluation }, articleType: { label: accountType, value: accountType }, }); } restModelData.getGradeOptions(); //获取可选档次 restModelData.getAccoutTypeOptions(); //可选类型 } }, [restModelData.leafData]); useEffect(() => { if (isModeTwo) { //设置当前模块模式,台账上传共用时 restModelData.setModuleMode(isModeTwo); } else { //设置当前模块模式 restModelData.setModuleMode(false); } }, [props]); useEffect(() => { if (treeData.length > 0) { //默认展开书结构第一个结点 //树结构组件会默认执行一遍onSelectHandle,将选中结点信息传出来 const { id } = treeData[0]; setDefaultOpened(`${id}`); } }, [treeData]); useEffect(() => { //页面加载完 //获取左侧输结构 restModelData.getArticleTreeData(); //获取当前评分 restModelData.getCurrentHospScore(); getDepartments(); }, []) return (
setdetailDrawerVisible(bool)} submitter={false} > {restModelData.currentHospSelfScoreAndOthers}
, footer: restModelData.editMode ? [ , , ] : null }} > { restModelData.modalVisible && ( //台账上传弹窗 restModelData.uploadFile(values)} initialValues={!restModelData.uploadFormInitValue ? {} : restModelData.uploadFormInitValue} onVisibleChange={onModalVisibleChange} params={restModelData.uploadFormInitValue} request={(params: any) => { return Promise.resolve(params) }} >
选择类型
{ ({ tab }) => { //制度特殊处理 return tab && tab.value.label == '制度' && ( await restModelData.getSelectableRuleChilds(tab.value.value)} placeholder="请选择" rules={[{ required: true, message: '请选择!' }]} /> ) } }
) }
{ defaultOpened && ( { //只在台账上传时展示 return isModeTwo ? (
只看我的 restModelData.setIsShowMineOnly(checked)} />
) : null }} editable={false} /> ) }
0 ? columnsFromProps : columns} request={getTableData} search={{ span: 6 }} rowSelection={isModeTwo ? false : { // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom // 注释该行则默认不显示下拉选项 selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], }} rowKey="id" tableAlertOptionRender={({ selectedRowKeys, selectedRows, onCleanSelected }: { selectedRowKeys: number[] | string[], selectedRows: SelectedRowsType[], onCleanSelected: () => void }) => { return ( ); }} // searchNode={searchNode()} />
) } export default ArticleManagement