Переглянути джерело

feat: 流程永华设置相关

outaozhen 3 роки тому
батько
коміт
91352f5f23

+ 8 - 3
config/routes.ts

@@ -111,12 +111,17 @@
         path: 'inventory',
         name: 'inventory',
         component: './Business/Inventory'
+      },
+      {
+        path: 'processuser',
+        name: 'processuser',
+        component: './Business/ProcessUser'
       }
     ]
   },
   {
-    path: '/work-setting',
-    name: 'work-setting',
+    path: '/workSetting',
+    name: 'workSetting',
     icon: 'ControlOutlined',
     routes: [
       {
@@ -126,7 +131,7 @@
         component: './Schema/Base/index.tsx'
       },
       {
-        path: '/work-setting/schema/detail',
+        path: '/workSetting/schema/detail',
         name: 'schema-detail',
         hideInMenu: true,
         component: './Schema/Base/detail.tsx'

+ 7 - 6
src/locales/zh-CN/menu.ts

@@ -26,14 +26,15 @@ export default {
   'menu.institutions.staff': '人员管理',
   'menu.business': '业务审批设置',
   'menu.business.inventory': '资料签收清单模板',
+  'menu.business.processuser': '流程用户设置',
   'menu.institutions.company.list': '单位列表',
   'menu.institutions.company.detail': '单位详情',
-  'menu.work-setting': '表单设置',
-  'menu.work-setting.schema': '基础数据设置',
-  'menu.work-setting.option': '数据源设置',
-  'menu.work-setting.budget': '预算业务表单',
-  'menu.work-setting.test': '测试',
-  'menu.work-setting.schema-detail': '编辑数据模型',
+  'menu.workSetting': '表单设置',
+  'menu.workSetting.schema': '基础数据设置',
+  'menu.workSetting.option': '数据源设置',
+  'menu.workSetting.budget': '预算业务表单',
+  'menu.workSetting.test': '测试',
+  'menu.workSetting.schema-detail': '编辑数据模型',
   'menu.system': '系统管理',
   'menu.system.setting': '系统设置',
   'menu.system.admin-update': '管理员',

+ 33 - 0
src/pages/Business/ProcessUser/components/LeftMenu/index.tsx

@@ -0,0 +1,33 @@
+import { Menu } from 'antd'
+import React from 'react'
+import '@/pages/Schema/Base/components/LeftMenu/index.less'
+
+type LeftMenuProps = {
+  title?: string
+  options: { label: string; value: string }[]
+  onChange: (key: string) => void
+  value: string
+}
+
+const LeftMenu: React.FC<LeftMenuProps> = ({
+  title = '流程用户设置',
+  options,
+  onChange,
+  value
+}) => {
+  return (
+    <div
+      className="w-216px rounded-20px"
+      style={{ height: 'calc(100vh - 122px)', background: '#ffffff' }}>
+      <div className="p-5 text-16px text-opacity-85 menu-title">{title}</div>
+      <Menu
+        defaultSelectedKeys={[value]}
+        onSelect={({ key }) => onChange(key)}
+        mode="inline"
+        items={options.map(item => ({ label: item.label, key: item.value }))}
+      />
+    </div>
+  )
+}
+
+export default LeftMenu

+ 130 - 0
src/pages/Business/ProcessUser/index.tsx

@@ -0,0 +1,130 @@
+import { PageContainer } from '@ant-design/pro-layout'
+import { useDispatch, connect } from 'umi'
+import { Form, Select } from 'antd'
+import React, { useState, useEffect } from 'react'
+import LeftMenu from './components/LeftMenu'
+
+export enum LeftMenuEnum {
+  BUDGET = '1'
+}
+
+export const menuOptions = [{ label: '预算业务审批', value: LeftMenuEnum.BUDGET }]
+
+const ProcessUser = props => {
+  const { institutionList, organizationList } = props
+  console.log(organizationList)
+
+  const [form] = Form.useForm()
+  const dispatch = useDispatch()
+  const [state, setState] = useState({
+    activeKey: LeftMenuEnum.BUDGET,
+    institutionID: null
+  })
+
+  const handleInstitutionSelect = ID => {
+    setState({ ...state, institutionID: ID })
+  }
+
+  const handleOrganizationList = () => {
+    dispatch({
+      type: 'business/queryOrganizationalMembers',
+      payload: { institutionID: state.institutionID }
+    })
+  }
+
+  useEffect(() => {
+    if (!institutionList.length) {
+      dispatch({
+        type: 'business/queryInstitution'
+      })
+    }
+  }, [])
+  return (
+    <PageContainer title={false}>
+      <div className="h-full w-full flex flex-row">
+        <LeftMenu
+          title="流程用户设置"
+          options={menuOptions}
+          value={state.activeKey}
+          onChange={key => setState({ ...state, activeKey: key })}
+        />
+        <div className="w-6/7 ml-8 bg-white p-4 rounded-20px">
+          {/* <div className="flex flex-row-reverse mb-4 w-full">
+            <Button type="primary">编辑</Button>
+          </div> */}
+          <div className="max-w-800px">
+            <Form
+              labelCol={{ span: 4 }}
+              wrapperCol={{ span: 20 }}
+              layout="horizontal"
+              form={form}
+              onFinish={async values => {
+                console.log(values)
+              }}>
+              <Form.Item label="收件员:">
+                <Select
+                  style={{ width: 250 }}
+                  placeholder="请选择单位"
+                  onChange={handleInstitutionSelect}
+                  options={institutionList?.items?.map(item => ({ value: item.ID, label: item.name }))}
+                />
+                <Select
+                  style={{ width: 250 }}
+                  placeholder="请选择用户"
+                  onChange={handleOrganizationList}
+                  options={organizationList?.items?.map(item => ({ value: item.name }))}
+                />
+              </Form.Item>
+              {/* <Form.Item label="分管领导:" name="fgLeader">
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo">Demo</Select.Option>
+                </Select>
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo1">dasdasd</Select.Option>
+                </Select>
+              </Form.Item>
+              <Form.Item label="分管领导:" name="fgLeader">
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo">Demo</Select.Option>
+                </Select>
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo1">dasdasd</Select.Option>
+                </Select>
+              </Form.Item>
+              <Form.Item label="中心领导:" name="zxLeader">
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo">Demo</Select.Option>
+                </Select>
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo1">dasdasd</Select.Option>
+                </Select>
+              </Form.Item>
+              <Form.Item label="发文:" name="post">
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo">Demo</Select.Option>
+                </Select>
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo1">dasdasd</Select.Option>
+                </Select>
+              </Form.Item>
+              <Form.Item label="归档:" name="archive">
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo">Demo</Select.Option>
+                </Select>
+                <Select style={{ width: 250 }}>
+                  <Select.Option value="demo1">dasdasd</Select.Option>
+                </Select>
+              </Form.Item> */}
+            </Form>
+          </div>
+        </div>
+      </div>
+    </PageContainer>
+  )
+}
+
+export default connect(({ business }) => ({
+  institutionList: business.institutionList,
+  organizationList: business.organizationalMembersList
+}))(ProcessUser)
+// export default ProcessUser

+ 71 - 0
src/pages/Business/model.ts

@@ -0,0 +1,71 @@
+// import { getProjectTypeList } from '@/services/api/project'
+// import consts from '@/utils/consts'
+import { queryInstitutionList, queryOrganizationalMembersList } from '@/services/api/institution'
+import consts from '@/utils/consts'
+import type { Effect, Reducer } from '@umijs/max'
+
+export interface BusinessModelState {
+  dataID: string
+  institutionList: API.InstitutionList[]
+  organizationalMembersList: API.OrganizationalStructureListItem[]
+}
+
+export interface BusinessModelType {
+  namespace: 'business'
+  state: BusinessModelState
+  effects: {
+    queryInstitution: Effect
+    queryOrganizationalMembers: Effect
+  }
+  reducers: {
+    save: Reducer<BusinessModelState>
+    // 启用 immer 之后
+    // save: ImmerReducer<ProjectModelState>;
+  }
+}
+
+const BusinessModel: BusinessModelType = {
+  namespace: 'business',
+  state: {
+    institutionList: [],
+    organizationalMembersList: []
+  },
+  effects: {
+    *queryInstitution({ payload }, { call, put }) {
+      const response = yield call(queryInstitutionList, payload)
+      if (response?.code === consts.RET_CODE.SUCCESS) {
+        yield put({
+          type: 'save',
+          payload: {
+            institutionList: response.data
+          }
+        })
+      }
+    },
+    *queryOrganizationalMembers({ payload }, { call, put }) {
+      const response = yield call(queryOrganizationalMembersList, payload)
+      if (response?.code === consts.RET_CODE.SUCCESS) {
+        yield put({
+          type: 'save',
+          payload: {
+            organizationalMembersList: response.data
+          }
+        })
+      }
+    }
+  },
+  reducers: {
+    save(state, action) {
+      return {
+        ...state,
+        ...action.payload
+      }
+    }
+    // 启用 immer 之后
+    // save(state, action) {
+    //   state.name = action.payload;
+    // },
+  }
+}
+
+export default BusinessModel

+ 20 - 2
src/pages/Institutions/model.ts

@@ -1,6 +1,10 @@
 // import { getProjectTypeList } from '@/services/api/project'
 // import consts from '@/utils/consts'
-import { getAccountTypeList, queryOrganizationalStructureList } from '@/services/api/institution'
+import {
+  getAccountTypeList,
+  queryInstitutionList,
+  queryOrganizationalStructureList
+} from '@/services/api/institution'
 import consts from '@/utils/consts'
 import type { Effect, Reducer } from '@umijs/max'
 
@@ -9,6 +13,7 @@ export interface InstitutionsModelState {
   accountType: API.AccountType[]
   organizationType: API.OrganizationalStructureListItem[]
   dataID: string
+  institutionList: API.InstitutionList[]
 }
 
 export interface InstitutionsModelType {
@@ -18,6 +23,7 @@ export interface InstitutionsModelType {
     query: Effect
     queryAccountTypeList: Effect
     queryOrganizationList: Effect
+    queryInstitution: Effect
   }
   reducers: {
     save: Reducer<InstitutionsModelState>
@@ -31,7 +37,8 @@ const InstitutionsModel: InstitutionsModelType = {
   state: {
     list: [],
     accountType: [],
-    organizationType: []
+    organizationType: [],
+    institutionList: []
   },
   effects: {
     *queryInstitutionTypeList({ payload }, { call, put }) {
@@ -68,6 +75,17 @@ const InstitutionsModel: InstitutionsModelType = {
           }
         })
       }
+    },
+    *queryInstitution({ payload }, { call, put }) {
+      const response = yield call(queryInstitutionList, payload)
+      if (response?.code === consts.RET_CODE.SUCCESS) {
+        yield put({
+          type: 'save',
+          payload: {
+            institutionList: response.data
+          }
+        })
+      }
     }
   },
   reducers: {

+ 1 - 1
src/pages/Schema/Option/index.less

@@ -11,7 +11,7 @@
   visibility: visible;
 }
 
-.copyWrap {
+.copy-wrap {
   :global(.ant-pro-core-label-tip-title) {
     max-width: 400px;
     overflow: hidden;

+ 1 - 1
src/pages/Schema/Option/index.tsx

@@ -201,7 +201,7 @@ const Option = () => {
         <div
           className={classNames(
             'w-6/7 ml-8 bg-white p-4 rounded-20px shadow-hex-3e2c5a relative',
-            styles.copyWrap
+            styles['copy-wrap']
           )}>
           <ProTable<API.DataSourceItem>
             columns={columns}

+ 8 - 0
src/services/api/institution.ts

@@ -87,6 +87,14 @@ export async function queryOrganizationalStructureList(params: API.Organizationa
   })
 }
 
+/** 组织架构列表+成员 */
+export async function queryOrganizationalMembersList(params: API.OrganizationalListParams) {
+  return request('/OrganizationalStructure/members', {
+    method: 'POST',
+    data: params
+  })
+}
+
 /** 新增组织结构 */
 export async function addOrganizationalStructure(params: API.OrganizationalStructureAddParams) {
   return request('/OrganizationalStructure/add', {

+ 4 - 0
src/services/api/typings.d.ts

@@ -173,6 +173,10 @@ declare namespace API {
     dataID: string
   }
 
+  type OrganizationalListParams = {
+    institutionID: string
+  }
+
   type OrganizationalStructureListItem = {
     structureType: number
     dataID: string