|
@@ -9,6 +9,7 @@ import React from "react"
|
|
|
interface Props {
|
|
|
appAllList: DefaultOptionType[]
|
|
|
userList: DefaultOptionType[]
|
|
|
+ apptypeEnum: { [x: string]: string }
|
|
|
onChange?: () => void
|
|
|
visible?: boolean
|
|
|
onClose?: () => void
|
|
@@ -19,12 +20,11 @@ interface Props {
|
|
|
* 新增修改应用权限
|
|
|
* @returns
|
|
|
*/
|
|
|
-const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, onClose, initialValues }) => {
|
|
|
+const ModalApp: React.FC<Props> = ({ appAllList, userList, apptypeEnum, onChange, visible, onClose, initialValues }) => {
|
|
|
|
|
|
/*******************************/
|
|
|
const [form] = Form.useForm();
|
|
|
-
|
|
|
- console.log(appAllList)
|
|
|
+ const authMemberAppList = Form.useWatch('authMemberAppList', form)
|
|
|
|
|
|
const addApp = useAjax((params) => addAppApi(params))
|
|
|
const updateApp = useAjax((params) => updateAppApi(params))
|
|
@@ -58,6 +58,7 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
|
|
|
onCancel={onClose}
|
|
|
onOk={handleOk}
|
|
|
confirmLoading={addApp.loading || updateApp.loading}
|
|
|
+ width={600}
|
|
|
>
|
|
|
<Form
|
|
|
name="basicApp"
|
|
@@ -108,6 +109,23 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
|
|
|
return <>
|
|
|
{fields.map(({ key, name, ...restField }) => (
|
|
|
<Space key={key} style={{ display: 'flex', marginBottom: 8, width: '100%' }} align="center">
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ label={<strong>应用类型</strong>}
|
|
|
+ name={[name, 'appType']}
|
|
|
+ rules={[{ required: true, message: '请选选择应用' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ style={{ width: 130 }}
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ placeholder="选择应用类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ }
|
|
|
+ options={Object.keys(apptypeEnum).map(key => ({ label: apptypeEnum[key], value: key }))}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
<Form.Item
|
|
|
{...restField}
|
|
|
label={<strong>应用</strong>}
|
|
@@ -115,14 +133,14 @@ const ModalApp: React.FC<Props> = ({ appAllList, userList, onChange, visible, on
|
|
|
rules={[{ required: true, message: '请选选择应用' }]}
|
|
|
>
|
|
|
<Select
|
|
|
- style={{ width: 300 }}
|
|
|
+ style={{ width: 280 }}
|
|
|
showSearch
|
|
|
allowClear
|
|
|
placeholder="选择应用"
|
|
|
filterOption={(input, option) =>
|
|
|
(option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
}
|
|
|
- options={appAllList}
|
|
|
+ options={appAllList?.filter(item => authMemberAppList?.[key]?.appType ? item.appType === authMemberAppList[key]?.appType : true)}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
<Form.Item
|