|
@@ -196,7 +196,9 @@ export const OperationAction: FC<{
|
|
|
onUpdate: (operationName?: string) => void
|
|
|
scene?: 'list' | 'detail'
|
|
|
className?: string
|
|
|
-}> = ({ embeddingAvailable, datasetId, detail, onUpdate, scene = 'list', className = '' }) => {
|
|
|
+ dataset: any
|
|
|
+}> = ({ embeddingAvailable, datasetId, detail, onUpdate, scene = 'list', className = '', dataset }) => {
|
|
|
+ const { currentWorkspace, userProfile } = useAppContext()
|
|
|
const { id, enabled = false, archived = false, data_source_type } = detail || {}
|
|
|
const [showModal, setShowModal] = useState(false)
|
|
|
const [deleting, setDeleting] = useState(false)
|
|
@@ -283,13 +285,16 @@ export const OperationAction: FC<{
|
|
|
setShowNotDelModal(true)
|
|
|
}
|
|
|
const [showApplyExamine, setShowApplyExamine] = useState<boolean>(false)
|
|
|
- const appContext = useAppContext()
|
|
|
const beforeHandleSwitch = () => {
|
|
|
if (detail.check_status === 1) { // 待审核
|
|
|
setShowNotSwitchModal(true)
|
|
|
return false
|
|
|
}
|
|
|
- if (!['owner', 'admin'].includes(appContext.currentWorkspace.role)) { // 提交审批
|
|
|
+ if (dataset.edit_auth === 1 && dataset.created_by !== userProfile.id) {
|
|
|
+ setShowApplyExamine(true)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (dataset.edit_auth === 2 && !['owner', 'admin', 'leader'].includes(currentWorkspace.role)) {
|
|
|
setShowApplyExamine(true)
|
|
|
return false
|
|
|
}
|
|
@@ -425,7 +430,7 @@ export const OperationAction: FC<{
|
|
|
&& <Confirm
|
|
|
isShow={showApplyExamine}
|
|
|
title={`${enabled ? '下线' : '上线'}审核确认`}
|
|
|
- content="该操作需要提交管理员审核后生效,请确认是否提交?"
|
|
|
+ content="该操作需要提交审核后生效,请确认是否提交?"
|
|
|
onConfirm={onApplyExamine}
|
|
|
onCancel={() => setShowApplyExamine(false)}
|
|
|
/>
|
|
@@ -488,6 +493,7 @@ const DocumentList: FC<IDocumentListProps> = ({
|
|
|
onManageMetadata,
|
|
|
dataset,
|
|
|
}) => {
|
|
|
+ const { currentWorkspace, userProfile } = useAppContext()
|
|
|
const { isCreate, isEdit, isOperation } = GetDatasetAuth(dataset)
|
|
|
const { t } = useTranslation()
|
|
|
const { formatTime } = useTimestamp()
|
|
@@ -589,7 +595,6 @@ const DocumentList: FC<IDocumentListProps> = ({
|
|
|
2: '审核不通过',
|
|
|
3: '无',
|
|
|
}
|
|
|
- const appContext = useAppContext()
|
|
|
const [row, setRow] = useState<any>({})
|
|
|
const [showConfirmExamineResult, setShowConfirmExamineResult] = useState(false)
|
|
|
const [confirmExamineResultContent, setConfirmExamineResultContent] = useState('')
|
|
@@ -750,17 +755,38 @@ const DocumentList: FC<IDocumentListProps> = ({
|
|
|
{
|
|
|
isOperation ? (<>
|
|
|
{
|
|
|
- doc.check_status === 1 && (
|
|
|
- ['owner', 'admin'].includes(appContext.currentWorkspace.role)
|
|
|
- ? <div className="cursor-pointer text-[#155aef]" onClick={(e) => {
|
|
|
- e.stopPropagation()
|
|
|
- setRow(doc)
|
|
|
- setConfirmExamineHandleTitle(`${doc.enabled ? '下线' : '上线'}审核`)
|
|
|
- setConfirmExamineHandleContent(`用户“${doc.enable_application}”申请将该知识${doc.enabled ? '下线' : '上线'},请审核!`)
|
|
|
- setShowConfirmExamineHandle(true)
|
|
|
- }}>{ExamineMap[doc.check_status]}</div>
|
|
|
- : <div>{ExamineMap[doc.check_status]}</div>
|
|
|
- )
|
|
|
+ doc.check_status === 1 && (<>
|
|
|
+ {
|
|
|
+ dataset.edit_auth === 1 && (<>
|
|
|
+ {
|
|
|
+ dataset.created_by === userProfile.id
|
|
|
+ ? <div className="cursor-pointer text-[#155aef]" onClick={(e) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ setRow(doc)
|
|
|
+ setConfirmExamineHandleTitle(`${doc.enabled ? '下线' : '上线'}审核`)
|
|
|
+ setConfirmExamineHandleContent(`用户“${doc.enable_application}”申请将该知识${doc.enabled ? '下线' : '上线'},请审核!`)
|
|
|
+ setShowConfirmExamineHandle(true)
|
|
|
+ }}>{ExamineMap[doc.check_status]}</div>
|
|
|
+ : <div>{ExamineMap[doc.check_status]}</div>
|
|
|
+ }
|
|
|
+ </>)
|
|
|
+ }
|
|
|
+ {
|
|
|
+ dataset.edit_auth === 2 && (<>
|
|
|
+ {
|
|
|
+ ['owner', 'admin', 'leader'].includes(currentWorkspace.role)
|
|
|
+ ? <div className="cursor-pointer text-[#155aef]" onClick={(e) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ setRow(doc)
|
|
|
+ setConfirmExamineHandleTitle(`${doc.enabled ? '下线' : '上线'}审核`)
|
|
|
+ setConfirmExamineHandleContent(`用户“${doc.enable_application}”申请将该知识${doc.enabled ? '下线' : '上线'},请审核!`)
|
|
|
+ setShowConfirmExamineHandle(true)
|
|
|
+ }}>{ExamineMap[doc.check_status]}</div>
|
|
|
+ : <div>{ExamineMap[doc.check_status]}</div>
|
|
|
+ }
|
|
|
+ </>)
|
|
|
+ }
|
|
|
+ </>)
|
|
|
}
|
|
|
{
|
|
|
doc.check_status === 2 && (
|
|
@@ -790,6 +816,7 @@ const DocumentList: FC<IDocumentListProps> = ({
|
|
|
datasetId={datasetId}
|
|
|
detail={pick(doc, ['name', 'enabled', 'archived', 'id', 'data_source_type', 'doc_form', 'check_status'])}
|
|
|
onUpdate={onUpdate}
|
|
|
+ dataset={dataset}
|
|
|
/>)
|
|
|
}
|
|
|
</td>
|