/*
|
* @Company: hugeInfo
|
* @Author: lwh
|
* @Date: 2025-01-07 14:39:21
|
* @LastEditTime: 2025-01-09 17:32:51
|
* @LastEditors: lwh
|
* @Version: 1.0.0
|
* @Description: 扬言极端事件匹配规则
|
*/
|
import React, { useEffect, useState } from 'react';
|
import { useNavigate, useLocation } from 'react-router-dom';
|
import { Form, Col, Space, Checkbox } from 'antd';
|
import NewPage from '@/components/NewPage';
|
import * as $$ from '@/utils/utility';
|
import TableView from '@/components/TableViewCanSort';
|
import { Button, Alert, Input, Message } from '@arco-design/web-react';
|
import NewTableSearch from '@/components/NewTableSearch';
|
import MyTabsNew from '@/components/MyTabsNew';
|
|
const TextArea = Input.TextArea;
|
|
// 获取当前风险案件关键词
|
function getKeyPromptApi(submitData) {
|
return $$.ax.request({ urlAi: 'case-law/getKeyPrompt', typeAi: 'get', data: submitData, service: 'mediate' });
|
}
|
|
// 更新风险案件关键词
|
function updateKeyPromptApi(data) {
|
return $$.ax.request({ urlAi: `case-law/updateKeyPrompt`, typeAi: 'post', service: 'mediate', data });
|
}
|
|
|
const Threaten = () => {
|
let location = useLocation();
|
let navigate = useNavigate();
|
const [form] = Form.useForm();
|
const [text, setText] = useState('');
|
const [textStatus, setTextStatus] = useState(false);
|
|
const style = { backgroundColor: '#F2F3F5', padding: '12px 16px' }
|
|
async function getKeyPrompt() {
|
global.setSpinning(true);
|
const res = await getKeyPromptApi();
|
global.setSpinning(false);
|
if (res.type) {
|
setText(res.data || '');
|
}
|
}
|
|
|
async function updateKeyPrompt(data) {
|
global.setSpinning(true);
|
const res = await updateKeyPromptApi(data);
|
global.setSpinning(false);
|
if (res.type) {
|
Message.success('提交成功!')
|
setTextStatus(!textStatus)
|
}
|
}
|
|
function submitClick(type) {
|
|
if (type === 'submit') {
|
$$.modalInfo({
|
title: '确定提交该规则设定吗?',
|
content: '',
|
okText: '确定提交',
|
cancelText: '我再想想',
|
onOk: async () => {
|
updateKeyPrompt({ promptText: text }, true)
|
},
|
});
|
} else {
|
setTextStatus(!textStatus)
|
}
|
}
|
|
|
|
// 初始化
|
useEffect(() => {
|
getKeyPrompt();
|
}, [])
|
|
return (
|
<NewPage pageHead={{ breadcrumbData: [{ title: '工作台' }, { title: '扬言极端事件匹配规则' }], title: '规则设定' }}>
|
<div className="comprehensive" style={{ height: 'calc(100% - 100px)', backgroundColor: '#fff', }}>
|
<div style={{ padding: '16px', display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
<Alert
|
type='info'
|
content={<span>系统将使用用户设定的短语或单词,通过语义识别算法检测符合条件的扬言/极端事件,多个单词请用逗号分隔,如自杀,情绪激动,跳楼</span>}
|
/>
|
<div style={!textStatus && text ? { ...style, flex: '1' } : { flex: '1' }}>
|
{
|
!textStatus &&
|
<>
|
{
|
text ?
|
<div>{text}</div> :
|
<div className='handle-content-empty' style={{ marginTop: '20%' }}>
|
{$$.MyNewEmpty()}
|
<div style={{ display: 'flex', marginTop: '12px', justifyContent: 'center' }}>
|
<Button type='primary' onClick={() => { setTextStatus(!textStatus) }}>
|
去设置
|
</Button>
|
</div>
|
</div>
|
}
|
</>
|
}
|
{
|
textStatus &&
|
<TextArea value={text} onChange={(e) => { setText(e) }} style={{ height: '100%' }} placeholder='扬言,自杀,情绪激动,厌世,轻生,活着没意思,威胁,跳楼' />
|
}
|
</div>
|
{
|
textStatus &&
|
<div style={{ display: 'flex', gap: '16px' }}>
|
<Button type='primary' onClick={() => { submitClick('submit') }}>
|
提交
|
</Button>
|
<Button type='secondary' onClick={() => { submitClick('cancel') }}>
|
取消修改
|
</Button>
|
</div>
|
}
|
{
|
!textStatus && text &&
|
<div style={{ display: 'flex', gap: '16px' }}>
|
<Button type='primary' onClick={() => { setTextStatus(!textStatus) }}>
|
修改
|
</Button>
|
</div>
|
}
|
|
</div>
|
</div>
|
</NewPage >
|
);
|
};
|
|
export default Threaten;
|