浏览代码

知识库配置

CzRger 2 月之前
父节点
当前提交
78fa008a1b

+ 83 - 2
web/app/components/datasets/rename-modal/index.tsx

@@ -1,6 +1,7 @@
 'use client'
 
 import type { MouseEventHandler } from 'react'
+import React from 'react'
 import { useEffect } from 'react'
 import { useState } from 'react'
 import { RiCloseLine } from '@remixicon/react'
@@ -16,7 +17,8 @@ import { ToastContext } from '@/app/components/base/toast'
 import type { DataSet } from '@/models/datasets'
 import { tagBindingsCreate, tagBindingsRemove, updateDatasetSetting } from '@/service/datasets'
 import { useModalContext } from '@/context/modal-context'
-import { fetchTypes } from '@/service/common'
+import { fetchDeptUsers, fetchTypes } from '@/service/common'
+import { TreeSelect as AntdTreeSelect } from 'antd'
 
 type RenameDatasetModalProps = {
   show: boolean
@@ -98,7 +100,37 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
     }
   }
   const { setShowAccountSettingModal } = useModalContext()
-
+  const optionsEditAuth = [
+    { name: '本账号', value: 1 },
+    { name: '本部门', value: 2 },
+  ]
+  const [editAuth, setEditAuth] = useState()
+  const [editUserIds, setEditUserIds] = useState([])
+  const [lookUserIds, setLookUserIds] = useState([])
+  const [optionsDeptUser, setOptionsDeptUser] = useState<any>([])
+  const [optionsDeptUserEdit, setOptionsDeptUserEdit] = useState<any>([])
+  useEffect(() => {
+    fetchDeptUsers({
+      url: '/xxx',
+      params: {
+        page: 1,
+        limit: 1000,
+      },
+    }).then((res: any) => {
+      setOptionsDeptUser(res.data || [])
+    })
+  }, [])
+  useEffect(() => {
+    fetchDeptUsers({
+      url: '/xxx',
+      params: {
+        page: 1,
+        limit: 1000,
+      },
+    }).then((res: any) => {
+      setOptionsDeptUserEdit(res.data || [])
+    })
+  }, [])
   return (
     <Modal
       className='w-[520px] max-w-[520px] rounded-xl px-8 py-6'
@@ -151,6 +183,55 @@ const RenameDatasetModal = ({ show, dataset, onSuccess, onClose }: RenameDataset
             />
           </div>
         </div>
+        <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={editUserIds}
+            dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
+            placeholder="请选择编辑授权"
+            allowClear
+            treeDefaultExpandAll
+            onChange={v => setEditUserIds(v)}
+            treeData={optionsDeptUserEdit}
+            fieldNames={{ label: 'name', value: 'id' }}
+            multiple={true}
+            treeCheckable={true}
+          />
+        </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 justify-end pt-6'>
         <Button className='mr-2' onClick={onClose}>{t('common.operation.cancel')}</Button>

+ 2 - 2
web/app/components/explore/create-app-modal/index.tsx

@@ -164,7 +164,7 @@ const CreateAppModal = ({
           )}
           {!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='py-2 text-sm font-medium leading-[20px] text-text-primary'>编辑权</div>
             <div className="h-[32px]">
               <SimpleSelect
                 className="h-[32px]"
@@ -174,7 +174,7 @@ const CreateAppModal = ({
                 }}
                 items={optionsEditAuth}
                 allowSearch={false}
-                placeholder="请选择编辑权"
+                placeholder="请选择编辑权"
               />
             </div>
           </div>