ソースを参照

Merge branch 'dev'

lanjianrong 3 年 前
コミット
e247a92281

+ 7 - 0
src/components/IconFont/index.tsx

@@ -0,0 +1,7 @@
+import { createFromIconfontCN } from '@ant-design/icons'
+
+const IconFont = createFromIconfontCN({
+  scriptUrl: ['//at.alicdn.com/t/font_2906856_yi15stgym3.js']
+})
+
+export default IconFont

+ 10 - 1
src/pages/Institutions/Company/Detail/components/Staff.tsx

@@ -14,6 +14,8 @@ import { generateColumns } from '@/utils/util'
 import { genderEum } from '@/pages/Institutions/Staff'
 import AnimateContent from '@/components/AnimateContent'
 import { ModalType } from '@/utils/enum'
+import { UserOutlined } from '@ant-design/icons'
+import IconFont from '@/components/IconFont'
 
 type ListProps = ConnectProps & {
   accountType: API.AccountType[]
@@ -69,7 +71,14 @@ const Staff: React.FC<ListProps> = ({
     {
       dataIndex: 'name',
       title: '姓名',
-      renderText: (text, record) => `${text}${record.ID === managerID ? ' (管理员) ' : ''}`,
+      renderText: (text, record) => (
+        <div className="flex flex-row items-center">
+          <div>{text}</div>
+          <div className="ml-1 text-16px">
+            {record.ID === managerID ? <IconFont type="icon-admin" /> : null}
+          </div>
+        </div>
+      ),
       width: 86,
       aligen: 'center',
       onHeaderCell: () => ({ style: { textAlign: 'center' } })

+ 8 - 9
src/pages/Institutions/Company/List/index.tsx

@@ -44,7 +44,8 @@ const CompanyList = () => {
   // }, [])
   const [state, setState] = useState({
     params: {
-      search: null
+      search: null,
+      accountType: '1'
     },
     visible: false,
     currentModalType: ModalType.ADD,
@@ -80,8 +81,7 @@ const CompanyList = () => {
               // managerID: record.manager.ID
             })
           }
-          className="text-primary cursor-pointer"
-        >
+          className="text-primary cursor-pointer">
           {name}
         </span>
       )
@@ -146,8 +146,7 @@ const CompanyList = () => {
                 currentModalType: ModalType.UPDATE,
                 defaultFormData: record
               })
-            }}
-          >
+            }}>
             编辑
           </div>
           {/* <Popconfirm
@@ -193,8 +192,9 @@ const CompanyList = () => {
             <Button
               key="add"
               type="primary"
-              onClick={() => setState({ ...state, visible: true, currentModalType: ModalType.ADD })}
-            >
+              onClick={() =>
+                setState({ ...state, visible: true, currentModalType: ModalType.ADD })
+              }>
               新建企事业单位
             </Button>
           ]
@@ -204,8 +204,7 @@ const CompanyList = () => {
       <AnimateContent
         title={state.currentModalType === ModalType.ADD ? '新增企事业单位' : '编辑企事业单位'}
         visible={state.visible}
-        onVisibleChange={visible => setState({ ...state, visible })}
-      >
+        onVisibleChange={visible => setState({ ...state, visible })}>
         <CompanyDrawer
           type={state.currentModalType}
           defaultFormData={state.defaultFormData}

+ 4 - 1
src/pages/Project/Verification/Detail/Flow/components/Drawer/index.less

@@ -10,7 +10,7 @@
       > .ant-collapse-item
       > .ant-collapse-content
       > .ant-collapse-content-box) {
-    padding: 4px 16px;
+    padding: 4px 0;
   }
   :global(.ant-collapse-icon-position-right
       > .ant-collapse-item
@@ -21,4 +21,7 @@
   :global(.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow) {
     font-size: 14px;
   }
+  :global(.ant-switch-checked) {
+    background-color: #4dd865;
+  }
 }

+ 29 - 6
src/pages/Project/Verification/Detail/Flow/components/Drawer/index.tsx

@@ -4,7 +4,13 @@ import { Actions, FlowContext } from '../../context'
 import type { RadioChangeEvent } from 'antd'
 import { ApprovalWay, ConfigureType, ParticipantMode } from '../../enum'
 import { QuestionCircleFilled } from '@ant-design/icons'
-import { createForm, onFieldMount, onFieldReact, onFieldValueChange } from '@formily/core'
+import {
+  createForm,
+  onFieldMount,
+  onFieldReact,
+  onFieldValueChange,
+  onFormValuesChange
+} from '@formily/core'
 import { createSchemaField, FormProvider } from '@formily/react'
 import { FormItem, Select } from '@formily/antd'
 import { participantSchema } from '../../utils'
@@ -13,6 +19,7 @@ import consts from '@/utils/consts'
 import { action } from '@formily/reactive'
 import { buildUUID } from '@/utils/uuid'
 import styles from './index.less'
+import { useDebounceFn } from 'ahooks'
 const configureItemTitle = {
   [ConfigureType.ADDSIGN]: {
     name: '允许加签',
@@ -99,14 +106,30 @@ const FlowDrawer = () => {
     })
   }
 
+  const { run: trySaveCardData } = useDebounceFn((targetID, formData) => {
+    console.log(1)
+
+    setState({
+      ...state,
+      accounts: { ...state.accounts, [targetID]: { ...state.accounts[targetID], ...formData } }
+    })
+  })
   const renderCard = () => {
     const keys = Object.keys(state.accounts)
     return keys.map(key => {
       const participant = state.accounts?.[key]
       if (!participant) return null
-      const form = createForm({
-        initialValues: { participant },
+      const formInstance = createForm({
+        initialValues: {
+          ID: participant.ID,
+          participantMode: participant.participantMode,
+          institutionID: participant.institutionID,
+          name: participant.name
+        },
         effects() {
+          onFormValuesChange(form => {
+            trySaveCardData(key, form.getValuesIn())
+          })
           onFieldMount('ID', (field, form) => {
             field.setComponentProps({
               onSelect: (_, option: { label: string; value: string }) => {
@@ -171,7 +194,7 @@ const FlowDrawer = () => {
       return (
         <div
           className={[
-            'shadow-card border rounded-md flex flex-col justify-between px-4 py-2 mt-6',
+            'shadow-base border rounded-md flex flex-col justify-between px-4 py-2 mt-6',
             styles.participantCard
           ].join(' ')}
           key={key}>
@@ -182,7 +205,7 @@ const FlowDrawer = () => {
             </div>
           </div>
           <div className="mt-3">
-            <FormProvider form={form}>
+            <FormProvider form={formInstance}>
               <SchemaField
                 schema={participantSchema}
                 scope={{
@@ -222,7 +245,7 @@ const FlowDrawer = () => {
               <Row>
                 {configureArr.map(item => (
                   <Col span={8} key={item}>
-                    <div className="p-2 flex flex-row items-center ">
+                    <div className="py-2 flex flex-row items-center ">
                       <div className="mr-2">{configureItemTitle[item]?.name}</div>
                       <Switch
                         checked={participant.configure.includes(item)}

+ 1 - 1
windi.config.ts

@@ -22,7 +22,7 @@ export default defineConfig({
       },
       boxShadow: {
         card: '0 0 13px 0 rgba(74, 53, 107, 0.08)',
-        base: '1px 1px 1px 1px rgba(0,0,0, 0.15)'
+        base: '0 1px 1px 1px rgb(0 0 0 / 15%)'
       }
     }
   },