Browse Source

fix: 步骤配置事项配置扁平化数据

lanjianrong 2 năm trước cách đây
mục cha
commit
13d9489608

+ 3 - 1
src/pages/Business/Step/components/Flow/components/Drawer/Auditor/MatterPermission.tsx

@@ -1,4 +1,5 @@
 import { Card, Checkbox } from 'antd'
+import { flatMapDeep } from 'lodash'
 
 export enum MatterPerm {
   FORM = 'formPermission',
@@ -24,12 +25,13 @@ type MatterPermissionProps = {
 }
 
 const MatterPermission: React.FC<MatterPermissionProps> = ({ defaultValue, toggleMatter, matterList }) => {
+  const matterFlattenList = flatMapDeep(matterList, item => [item, ...item.children])
   return defaultValue.map(matter => (
     <Card
       key={matter.matterID}
       size="small"
       className="mb-2"
-      title={matterList.find(item => item.ID === matter.matterID)?.name}>
+      title={matterFlattenList.find(item => item.ID === matter.matterID)?.name}>
       {[MatterPerm.COST, MatterPerm.FORM, MatterPerm.PROFILE].map(item => (
         <div key={item} className="flex justify-between items-center my-1">
           <div className="flex-1">{matterPermMap[item]}</div>

+ 3 - 2
src/pages/Business/Step/components/Flow/components/Drawer/Auditor/RelatedMatter.tsx

@@ -7,10 +7,10 @@ type RelatedMatterpProps = {
   defaultValue: string[]
 }
 const RelatedMatter: React.FC<RelatedMatterpProps> = ({ defaultValue, matterList, toggleMatter }) => {
-  const columns: ColumnType<API.MatterItem>[] = [
+  const columns: ColumnType<API.MatterTreeItem>[] = [
     {
       dataIndex: 'name',
-      title: '事项名称',
+      title: '事项分类/名称',
       width: '80%',
       onHeaderCell: () => ({ style: { textAlign: 'center' } })
     },
@@ -19,6 +19,7 @@ const RelatedMatter: React.FC<RelatedMatterpProps> = ({ defaultValue, matterList
       title: '执行中',
       align: 'center',
       render: (_, record) => {
+        if (record?.children) return null
         return (
           <Checkbox
             defaultChecked={defaultValue.includes(record.ID)}