|  | @@ -3,9 +3,12 @@ import { PageContainer } from '@ant-design/pro-layout'
 | 
	
		
			
				|  |  |  import ProTable from '@ant-design/pro-table'
 | 
	
		
			
				|  |  |  import { Button } from 'antd'
 | 
	
		
			
				|  |  |  import { ColumnsType } from 'antd/lib/table'
 | 
	
		
			
				|  |  | -import { useState } from 'react'
 | 
	
		
			
				|  |  | +import { useRef, useState } from 'react'
 | 
	
		
			
				|  |  | +import useDrawer from '@/components/Drawer'
 | 
	
		
			
				|  |  |  import LeftMenu from '../RuleCode/components/LeftMenu'
 | 
	
		
			
				|  |  | +import AssemblyDetail from './components/AssemblyDetail'
 | 
	
		
			
				|  |  |  import { MatterType, useRowScript } from './hooks/useRowScript'
 | 
	
		
			
				|  |  | +import AddAssemblyModal from './components/AddAssemblyModal'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  interface IState {
 | 
	
		
			
				|  |  |    subjectParams: {
 | 
	
	
		
			
				|  | @@ -16,6 +19,8 @@ interface IState {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const Matter: React.FC = () => {
 | 
	
		
			
				|  |  | +  const tRef = useRef<ActionType>(null)
 | 
	
		
			
				|  |  | +  const [drawer, DrawerDom] = useDrawer()
 | 
	
		
			
				|  |  |    const [state, setState] = useState<IState>({
 | 
	
		
			
				|  |  |      subjectParams: {
 | 
	
		
			
				|  |  |        subjectID: '',
 | 
	
	
		
			
				|  | @@ -27,7 +32,27 @@ const Matter: React.FC = () => {
 | 
	
		
			
				|  |  |    const [modal, ModalDOM] = useModal()
 | 
	
		
			
				|  |  |    const { query, loading, add, edit, deleteMatter, treeList = [], expandTreeIds = [] } = useRowScript(modal)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const columns: ColumnsType<API.MatterParams> = [
 | 
	
		
			
				|  |  | +  const openDrawer = () => {
 | 
	
		
			
				|  |  | +    drawer.open({
 | 
	
		
			
				|  |  | +      title: '组件配置',
 | 
	
		
			
				|  |  | +      closeIcon: (
 | 
	
		
			
				|  |  | +        <Button
 | 
	
		
			
				|  |  | +          onClick={() => {
 | 
	
		
			
				|  |  | +            modal.open({
 | 
	
		
			
				|  |  | +              title: '添加组件',
 | 
	
		
			
				|  |  | +              okText: '确认',
 | 
	
		
			
				|  |  | +              cancelText: '取消',
 | 
	
		
			
				|  |  | +              children: <AddAssemblyModal />
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +          }}>
 | 
	
		
			
				|  |  | +          添加组件
 | 
	
		
			
				|  |  | +        </Button>
 | 
	
		
			
				|  |  | +      ),
 | 
	
		
			
				|  |  | +      children: <AssemblyDetail reload={() => tRef.current?.reload()} />
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  const columns: ColumnsType<API.MatterTreeItem> = [
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |        title: '分类',
 | 
	
		
			
				|  |  |        dataIndex: 'name',
 | 
	
	
		
			
				|  | @@ -61,6 +86,11 @@ const Matter: React.FC = () => {
 | 
	
		
			
				|  |  |              onClick={() => edit(record, state.subjectParams)}>
 | 
	
		
			
				|  |  |              编辑
 | 
	
		
			
				|  |  |            </span>
 | 
	
		
			
				|  |  | +          {record.matterType === MatterType.MATTER ? (
 | 
	
		
			
				|  |  | +            <span className="px-2 text-primary cursor-pointer hover:text-hex-967bbd" onClick={openDrawer}>
 | 
	
		
			
				|  |  | +              组件配置
 | 
	
		
			
				|  |  | +            </span>
 | 
	
		
			
				|  |  | +          ) : null}
 | 
	
		
			
				|  |  |            <span
 | 
	
		
			
				|  |  |              className={'pl-2 text-red-500 cursor-pointer hover:text-red-600'}
 | 
	
		
			
				|  |  |              onClick={() => deleteMatter(record.ID, record.children)}>
 | 
	
	
		
			
				|  | @@ -76,6 +106,7 @@ const Matter: React.FC = () => {
 | 
	
		
			
				|  |  |      setState({ ...state, subjectParams: { ...state.subjectParams, subjectID, businessType } })
 | 
	
		
			
				|  |  |      query({ subjectID, businessType })
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    return (
 | 
	
		
			
				|  |  |      <PageContainer title={false}>
 | 
	
		
			
				|  |  |        <div className="h-full w-full flex flex-row">
 | 
	
	
		
			
				|  | @@ -84,6 +115,7 @@ const Matter: React.FC = () => {
 | 
	
		
			
				|  |  |            <ProTable
 | 
	
		
			
				|  |  |              search={false}
 | 
	
		
			
				|  |  |              rowKey="ID"
 | 
	
		
			
				|  |  | +            actionRef={tRef}
 | 
	
		
			
				|  |  |              headerTitle={
 | 
	
		
			
				|  |  |                <div className="flex flex-nowrap justify-start items-center">
 | 
	
		
			
				|  |  |                  <div className="children:mx-1 px-1 py-2 ">
 | 
	
	
		
			
				|  | @@ -129,6 +161,7 @@ const Matter: React.FC = () => {
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |        {ModalDOM}
 | 
	
		
			
				|  |  | +      {DrawerDom}
 | 
	
		
			
				|  |  |      </PageContainer>
 | 
	
		
			
				|  |  |    )
 | 
	
		
			
				|  |  |  }
 |