瀏覽代碼

feat: 项目管理员->项目创建人,管理员选择器替换树选择

lanjianrong 3 年之前
父節點
當前提交
d991e4a6a5

+ 0 - 3
package.json

@@ -116,8 +116,5 @@
   },
   },
   "engines": {
   "engines": {
     "node": ">=10.0.0"
     "node": ">=10.0.0"
-  },
-  "gitHooks": {
-    "commit-msg": "fabric verify-commit"
   }
   }
 }
 }

+ 1 - 1
src/locales/zh-CN/menu.ts

@@ -17,7 +17,7 @@ export default {
   'menu.account.logout': '退出登录',
   'menu.account.logout': '退出登录',
   'menu.project': '项目',
   'menu.project': '项目',
   'menu.project.management': '项目管理',
   'menu.project.management': '项目管理',
-  'menu.project.created': '项目管理员',
+  'menu.project.created': '项目创建人',
   'menu.project.verification': '审批流程',
   'menu.project.verification': '审批流程',
   'menu.institutions': '企事业单位',
   'menu.institutions': '企事业单位',
   'menu.institutions.company': '单位管理',
   'menu.institutions.company': '单位管理',

+ 17 - 8
src/pages/Project/Created/index.tsx

@@ -2,15 +2,16 @@ import { PageContainer } from '@ant-design/pro-layout'
 import { useState, useEffect, useRef } from 'react'
 import { useState, useEffect, useRef } from 'react'
 import ProTable from '@ant-design/pro-table'
 import ProTable from '@ant-design/pro-table'
 import type { ActionType } from '@ant-design/pro-table'
 import type { ActionType } from '@ant-design/pro-table'
-import { ModalForm, ProFormSelect } from '@ant-design/pro-form'
+import { ModalForm } from '@ant-design/pro-form'
 import type { ProFormColumnsType } from '@ant-design/pro-form'
 import type { ProFormColumnsType } from '@ant-design/pro-form'
 import { DeleteOutlined } from '@ant-design/icons'
 import { DeleteOutlined } from '@ant-design/icons'
 import { queryAcountList } from '@/services/api/institution'
 import { queryAcountList } from '@/services/api/institution'
 import consts from '@/utils/consts'
 import consts from '@/utils/consts'
-import { Button, message } from 'antd'
+import { Button, Form, message } from 'antd'
 import { saveCreator } from '@/services/api/user'
 import { saveCreator } from '@/services/api/user'
 import { useRequest } from 'umi'
 import { useRequest } from 'umi'
 import { getProjectList } from '@/services/api/project'
 import { getProjectList } from '@/services/api/project'
+import TreeNodeSelect from '../Management/components/TreeNodeSelect'
 
 
 enum CreatedModalType {
 enum CreatedModalType {
   ADD = '1',
   ADD = '1',
@@ -95,8 +96,6 @@ const Created = () => {
       setState({ ...state, modalVisible: false })
       setState({ ...state, modalVisible: false })
       return true
       return true
     } catch (error) {
     } catch (error) {
-      console.log(error)
-
       return false
       return false
     }
     }
   }
   }
@@ -141,18 +140,28 @@ const Created = () => {
         {state.modalType === CreatedModalType.ADD ? (
         {state.modalType === CreatedModalType.ADD ? (
           <>
           <>
             <p className="mb-4">创建人可在前台创建项目、上传项目数据、编制项目等</p>
             <p className="mb-4">创建人可在前台创建项目、上传项目数据、编制项目等</p>
-            <ProFormSelect
+            <Form.Item name="ID">
+              <TreeNodeSelect params={{ isCreated: '0' }} />
+            </Form.Item>
+            {/* <ProFormSelect
               name="ID"
               name="ID"
               request={async () => {
               request={async () => {
                 const {
                 const {
                   code = -1,
                   code = -1,
                   data: { items }
                   data: { items }
-                } = await queryAcountList({ current: 1, pageSize: 21400, isCreated: '0' })
+                } = await queryAcountInstitutionList({
+                  current: 1,
+                  pageSize: 21400,
+                  isCreated: '0'
+                })
                 return code === consts.RET_CODE.SUCCESS
                 return code === consts.RET_CODE.SUCCESS
-                  ? items.map(item => ({ label: item.name, value: item.ID }))
+                  ? items.map(item => ({
+                      label: `${item.name} - ${item?.institution?.name}`,
+                      value: item.ID
+                    }))
                   : []
                   : []
               }}
               }}
-            />
+            /> */}
           </>
           </>
         ) : (
         ) : (
           <>
           <>

+ 13 - 33
src/pages/Project/Management/components/Detail.tsx

@@ -1,6 +1,6 @@
 import { connect, useRequest } from 'umi'
 import { connect, useRequest } from 'umi'
 import { useEffect, useRef, useState } from 'react'
 import { useEffect, useRef, useState } from 'react'
-import { message, Tabs } from 'antd'
+import { Form, message, Tabs } from 'antd'
 import {
 import {
   getApprovalList,
   getApprovalList,
   getProject,
   getProject,
@@ -13,11 +13,11 @@ import { BaseMenuEnum } from '@/pages/Schema/Base'
 import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
 import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
 import type { ConnectProps } from 'umi'
 import type { ConnectProps } from 'umi'
 import type { ProjectModelState } from '../../model'
 import type { ProjectModelState } from '../../model'
-import ProForm, { ProFormDependency, ProFormSelect } from '@ant-design/pro-form'
+import ProForm from '@ant-design/pro-form'
 // import TreeNodeSelect from './TreeNodeSelect'
 // import TreeNodeSelect from './TreeNodeSelect'
 import { ModalType } from './ProjectModal'
 import { ModalType } from './ProjectModal'
 import consts from '@/utils/consts'
 import consts from '@/utils/consts'
-import { queryAcountList } from '@/services/api/institution'
+import TreeNodeSelect from './TreeNodeSelect'
 
 
 enum FormType {
 enum FormType {
   UPLOAD_PERM = '1',
   UPLOAD_PERM = '1',
@@ -79,20 +79,6 @@ const DetailModal: React.FC<ProjectModalProps> = ({
   })
   })
 
 
   useEffect(() => {
   useEffect(() => {
-    async function querySelectOptions() {
-      const {
-        code = -1,
-        data: { items }
-      } = await queryAcountList({ current: 1, pageSize: 21400 })
-
-      setState({
-        ...state,
-        accountList:
-          code === consts.RET_CODE.SUCCESS
-            ? items.map(item => ({ label: item.name, value: item.ID }))
-            : []
-      })
-    }
     if (visible && !schema) {
     if (visible && !schema) {
       dispatch({
       dispatch({
         type: 'schemaBase/querySchema',
         type: 'schemaBase/querySchema',
@@ -110,7 +96,6 @@ const DetailModal: React.FC<ProjectModalProps> = ({
     }
     }
 
 
     if (state.activeKey === '3') {
     if (state.activeKey === '3') {
-      querySelectOptions()
       ref2?.current?.setFieldsValue({ ...state.perm })
       ref2?.current?.setFieldsValue({ ...state.perm })
     }
     }
   }, [visible, state.activeKey])
   }, [visible, state.activeKey])
@@ -218,21 +203,16 @@ const DetailModal: React.FC<ProjectModalProps> = ({
       </TabPane> */}
       </TabPane> */}
       <TabPane tab="角色权限" key="3">
       <TabPane tab="角色权限" key="3">
         <ProForm formRef={ref2} onFinish={formData => onFinish(FormType.ROLE_PERM, formData)}>
         <ProForm formRef={ref2} onFinish={formData => onFinish(FormType.ROLE_PERM, formData)}>
-          <ProFormSelect
-            name="createdID"
+          <Form.Item
             label="创建人:创建项目、管理编辑者、上传项目数据、编制项目、添加批注"
             label="创建人:创建项目、管理编辑者、上传项目数据、编制项目、添加批注"
-            request={async () => {
-              const { code = -1, data: { items } = { items: [] } } = await queryAcountList({
-                current: 1,
-                pageSize: 21400,
-                isCreated: '1'
-              })
-              return code === consts.RET_CODE.SUCCESS
-                ? items.map(item => ({ label: item.name, value: item.ID }))
-                : []
-            }}
-          />
-          <ProFormDependency name={['createdID']}>
+            name="createdID"
+          >
+            <TreeNodeSelect params={{ isCreated: '1' }} />
+          </Form.Item>
+          <Form.Item label="编辑者:编制项目、上传项目数据、添加批注" name="reportAccount">
+            <TreeNodeSelect multiple />
+          </Form.Item>
+          {/* <ProFormDependency name={['createdID']}>
             {({ createdID }) => {
             {({ createdID }) => {
               return (
               return (
                 <ProFormSelect
                 <ProFormSelect
@@ -245,7 +225,7 @@ const DetailModal: React.FC<ProjectModalProps> = ({
                 />
                 />
               )
               )
             }}
             }}
-          </ProFormDependency>
+          </ProFormDependency> */}
         </ProForm>
         </ProForm>
       </TabPane>
       </TabPane>
     </Tabs>
     </Tabs>

+ 3 - 3
src/pages/Project/Management/components/TreeNodeSelect.tsx

@@ -3,10 +3,10 @@ import { TreeSelect } from 'antd'
 import { useRequest } from 'umi'
 import { useRequest } from 'umi'
 import { queryAcountInstitutionList } from '@/services/api/institution'
 import { queryAcountInstitutionList } from '@/services/api/institution'
 
 
-const TreeNodeSelect = ({ onChange, placeholder = '请选择', ...otherProps }) => {
+const TreeNodeSelect = ({ params, onChange, placeholder = '请选择', ...otherProps }) => {
   const [list, setList] = useState([])
   const [list, setList] = useState([])
   const { run: tryAcountInstitutionList } = useRequest(
   const { run: tryAcountInstitutionList } = useRequest(
-    () => queryAcountInstitutionList({ pageSize: 125000 }),
+    () => queryAcountInstitutionList({ ...params, pageSize: 125000 }),
     {
     {
       manual: true,
       manual: true,
       onSuccess: result => {
       onSuccess: result => {
@@ -19,7 +19,7 @@ const TreeNodeSelect = ({ onChange, placeholder = '请选择', ...otherProps })
     tryAcountInstitutionList()
     tryAcountInstitutionList()
   }, [])
   }, [])
   const onNodeChange = (value, labelList) => {
   const onNodeChange = (value, labelList) => {
-    onChange(value, { value, label: labelList[0] })
+    onChange?.(value, { value, label: labelList[0] })
   }
   }
   const renderTreeNodes = data =>
   const renderTreeNodes = data =>
     data.map(item => {
     data.map(item => {