|
@@ -2,8 +2,14 @@ import MemberItem from '../components/MemberItem'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { useState } from 'react'
|
|
|
import { useRequest } from 'ahooks'
|
|
|
-import { addExecutor, delExecutor, queryExecutorList, updateExecutor } from '@/services/api/business'
|
|
|
-import { ApprovalType, ExecutorSetType } from '@/enums/gc'
|
|
|
+import {
|
|
|
+ addExecutor,
|
|
|
+ delExecutor,
|
|
|
+ queryExecutorList,
|
|
|
+ queryMatterList,
|
|
|
+ updateExecutor
|
|
|
+} from '@/services/api/business'
|
|
|
+import { ExecutorSetType } from '@/enums/gc'
|
|
|
import { QuestionCircleFilled } from '@ant-design/icons'
|
|
|
import { Form, message, Tooltip } from 'antd'
|
|
|
import ProForm, { ProFormDependency, ProFormRadio, ProFormSelect, ProFormText } from '@ant-design/pro-form'
|
|
@@ -21,7 +27,7 @@ const setTypeOptions = [
|
|
|
</Tooltip>
|
|
|
</div>
|
|
|
),
|
|
|
- value: ExecutorSetType.PRESET_MEMBER
|
|
|
+ value: ExecutorSetType.PERSET
|
|
|
},
|
|
|
{
|
|
|
label: (
|
|
@@ -32,7 +38,7 @@ const setTypeOptions = [
|
|
|
</Tooltip>
|
|
|
</div>
|
|
|
),
|
|
|
- value: ExecutorSetType.STEP_SETTING
|
|
|
+ value: ExecutorSetType.DYNAMIC
|
|
|
}
|
|
|
]
|
|
|
|
|
@@ -40,7 +46,7 @@ type iState = {
|
|
|
total: number
|
|
|
}
|
|
|
|
|
|
-export default function useScripts(modal: ModalAction) {
|
|
|
+export default function useScripts(modal: ModalAction, subject: string) {
|
|
|
const dispatch = useDispatch()
|
|
|
const [state, seState] = useState<iState>({
|
|
|
total: 0
|
|
@@ -64,6 +70,16 @@ export default function useScripts(modal: ModalAction) {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ const { data: { data: { items: matters = [] } = {} } = {} } = useRequest(
|
|
|
+ () => {
|
|
|
+ if (!subject) return
|
|
|
+ const [subjectID, businessType] = subject.split('_')
|
|
|
+
|
|
|
+ return queryMatterList({ subjectID, businessType, pageSize: 214000, matterType: 'matter' })
|
|
|
+ },
|
|
|
+ { refreshDeps: [subject] }
|
|
|
+ )
|
|
|
+
|
|
|
const addOrEdit = (mode: 'add' | 'edit', initialValues?: API.ExecutorItem) => {
|
|
|
const text = mode === 'add' ? '新增执行者' : '编辑执行者'
|
|
|
modal.open({
|
|
@@ -72,8 +88,7 @@ export default function useScripts(modal: ModalAction) {
|
|
|
cancelText: '取消',
|
|
|
type: 'form',
|
|
|
initialValues: initialValues ?? {
|
|
|
- setType: ExecutorSetType.PRESET_MEMBER,
|
|
|
- approvalType: ApprovalType.TARGET
|
|
|
+ setType: ExecutorSetType.PERSET
|
|
|
},
|
|
|
children: (
|
|
|
<ProForm submitter={false} layout="horizontal" labelCol={{ span: 5 }} isKeyPressSubmit>
|
|
@@ -91,23 +106,35 @@ export default function useScripts(modal: ModalAction) {
|
|
|
rules={[{ required: true, message: '请选择' }]}
|
|
|
/>
|
|
|
<ProFormDependency name={['setType']}>
|
|
|
- {({ name }) => {
|
|
|
- if (name === ExecutorSetType.PRESET_MEMBER)
|
|
|
+ {({ setType }) => {
|
|
|
+ if (setType === ExecutorSetType.PERSET)
|
|
|
return (
|
|
|
<Form.Item label="成员" name="members" rules={[{ required: true, message: '请选择' }]}>
|
|
|
<MemberItem />
|
|
|
</Form.Item>
|
|
|
)
|
|
|
- return <ProFormSelect name="" label="范围选择" />
|
|
|
+ return (
|
|
|
+ <ProFormSelect name="scope" label="范围选择" options={[{ label: '全部', value: 'all' }]} />
|
|
|
+ )
|
|
|
}}
|
|
|
</ProFormDependency>
|
|
|
+ <ProFormSelect
|
|
|
+ name="approvaledPermission"
|
|
|
+ label="事项权限"
|
|
|
+ placeholder="请选择"
|
|
|
+ rules={[{ required: true, message: '请选择' }]}
|
|
|
+ fieldProps={{ mode: 'multiple' }}
|
|
|
+ options={matters.map(item => ({ label: item.name, value: item.ID }))}
|
|
|
+ />
|
|
|
</ProForm>
|
|
|
),
|
|
|
onOk: async (values: API.ExecutorItem) => {
|
|
|
+ const [subjectID, businessType] = subject.split('_')
|
|
|
+ values.subjectID = subjectID
|
|
|
+ values.businessType = businessType
|
|
|
let requestFn: Nullable<() => Promise<viod>> = null
|
|
|
if (mode === 'add') {
|
|
|
requestFn = addExecutor
|
|
|
- values.businessType = business
|
|
|
} else {
|
|
|
requestFn = updateExecutor
|
|
|
}
|