|
@@ -1,5 +1,5 @@
|
|
|
'use client'
|
|
|
-import React, { useState } from 'react'
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
import { RiCloseLine } from '@remixicon/react'
|
|
|
import AppIconPicker from '../../base/app-icon-picker'
|
|
@@ -13,6 +13,9 @@ import AppIcon from '@/app/components/base/app-icon'
|
|
|
import { useProviderContext } from '@/context/provider-context'
|
|
|
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
|
|
|
import type { AppIconType } from '@/types/app'
|
|
|
+import { SimpleSelect } from '@/app/components/base/select'
|
|
|
+import { TreeSelect as AntdTreeSelect } from 'antd'
|
|
|
+import { fetchDeptUsers } from '@/service/common'
|
|
|
|
|
|
export type CreateAppModalProps = {
|
|
|
show: boolean
|
|
@@ -80,7 +83,24 @@ const CreateAppModal = ({
|
|
|
})
|
|
|
onHide()
|
|
|
}
|
|
|
-
|
|
|
+ const optionsEditAuth = [
|
|
|
+ { name: '本账号', value: 1 },
|
|
|
+ { name: '本部门', value: 2 },
|
|
|
+ ]
|
|
|
+ const [editAuth, setEditAuth] = useState()
|
|
|
+ const [lookUserIds, setLookUserIds] = useState([])
|
|
|
+ const [optionsDeptUser, setOptionsDeptUser] = useState<any>([])
|
|
|
+ useEffect(() => {
|
|
|
+ fetchDeptUsers({
|
|
|
+ url: '/xxx',
|
|
|
+ params: {
|
|
|
+ page: 1,
|
|
|
+ limit: 1000,
|
|
|
+ },
|
|
|
+ }).then((res: any) => {
|
|
|
+ setOptionsDeptUser(res.data || [])
|
|
|
+ })
|
|
|
+ }, [])
|
|
|
return (
|
|
|
<>
|
|
|
<Modal
|
|
@@ -143,6 +163,38 @@ const CreateAppModal = ({
|
|
|
</div>
|
|
|
)}
|
|
|
{!isEditModal && isAppsFull && <AppsFull loc='app-explore-create' />}
|
|
|
+ <div className='pt-2'>
|
|
|
+ <div className='py-2 text-sm font-medium leading-[20px] text-text-primary'>编辑授权</div>
|
|
|
+ <div className="h-[32px]">
|
|
|
+ <SimpleSelect
|
|
|
+ className="h-[32px]"
|
|
|
+ defaultValue={editAuth}
|
|
|
+ onSelect={(i) => {
|
|
|
+ setEditAuth(i.value)
|
|
|
+ }}
|
|
|
+ items={optionsEditAuth}
|
|
|
+ allowSearch={false}
|
|
|
+ placeholder="请选择编辑授权"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className='pt-2'>
|
|
|
+ <div className='py-2 text-sm font-medium leading-[20px] text-text-primary'>可见授权</div>
|
|
|
+ <AntdTreeSelect
|
|
|
+ showSearch
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ value={lookUserIds}
|
|
|
+ dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
+ placeholder="请选择可见授权"
|
|
|
+ allowClear
|
|
|
+ treeDefaultExpandAll
|
|
|
+ onChange={v => setLookUserIds(v)}
|
|
|
+ treeData={optionsDeptUser}
|
|
|
+ fieldNames={{ label: 'name', value: 'id' }}
|
|
|
+ multiple={true}
|
|
|
+ treeCheckable={true}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div className='flex flex-row-reverse'>
|
|
|
<Button disabled={!isEditModal && isAppsFull} className='ml-2 w-24' variant='primary' onClick={submit}>{!isEditModal ? t('common.operation.create') : t('common.operation.save')}</Button>
|