|
|
@ -2,7 +2,7 @@
|
|
|
|
* @Author: donghao donghao@supervision.ltd
|
|
|
|
* @Author: donghao donghao@supervision.ltd
|
|
|
|
* @Date: 2024-04-07 14:02:00
|
|
|
|
* @Date: 2024-04-07 14:02:00
|
|
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
|
|
* @LastEditTime: 2024-05-28 10:51:37
|
|
|
|
* @LastEditTime: 2024-07-25 11:46:29
|
|
|
|
* @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx
|
|
|
|
* @FilePath: \general-ai-manage\src\components\CategorizeUpdate\index.tsx
|
|
|
|
* @Description: 分类更新弹窗
|
|
|
|
* @Description: 分类更新弹窗
|
|
|
|
* @交互说明
|
|
|
|
* @交互说明
|
|
|
@ -23,6 +23,7 @@ type CategorizeUpdateProps = {
|
|
|
|
values: Record<string, any>;
|
|
|
|
values: Record<string, any>;
|
|
|
|
beforeCloseRequest: (arg1: any, arg2: () => void) => void;
|
|
|
|
beforeCloseRequest: (arg1: any, arg2: () => void) => void;
|
|
|
|
beforeAddRequest: (arg1: any, arg2: () => void) => void;
|
|
|
|
beforeAddRequest: (arg1: any, arg2: () => void) => void;
|
|
|
|
|
|
|
|
beforeEditRequest: (arg1: any, arg2: () => void) => void;
|
|
|
|
apiRequest: () => any;
|
|
|
|
apiRequest: () => any;
|
|
|
|
handleModal: (arg1: any) => void;
|
|
|
|
handleModal: (arg1: any) => void;
|
|
|
|
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
|
|
|
|
modalFormProps: Record<string, any>; // {categorizeFormProps , categorizeModelProps}
|
|
|
@ -93,6 +94,7 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
|
|
|
|
|
|
|
|
|
|
|
|
const handleInputConfirm = () => {
|
|
|
|
const handleInputConfirm = () => {
|
|
|
|
if (inputValue && inputValue.trim() && !tags.includes(inputValue)) {
|
|
|
|
if (inputValue && inputValue.trim() && !tags.includes(inputValue)) {
|
|
|
|
|
|
|
|
// 有值填充
|
|
|
|
props.beforeAddRequest(inputValue, (resp) => {
|
|
|
|
props.beforeAddRequest(inputValue, (resp) => {
|
|
|
|
console.log(resp, 'beforeAddRequest_resp');
|
|
|
|
console.log(resp, 'beforeAddRequest_resp');
|
|
|
|
// 接口调用成功,同步添加
|
|
|
|
// 接口调用成功,同步添加
|
|
|
@ -118,10 +120,15 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
|
|
|
|
|
|
|
|
|
|
|
|
const handleEditInputConfirm = () => {
|
|
|
|
const handleEditInputConfirm = () => {
|
|
|
|
const newTags = [...tags];
|
|
|
|
const newTags = [...tags];
|
|
|
|
|
|
|
|
console.log(editInputIndex, 'handleEditInputConfirm_resp');
|
|
|
|
|
|
|
|
props.beforeEditRequest({ ...fullData[editInputIndex], editInputValue }, (resp) => {
|
|
|
|
|
|
|
|
console.log(resp, 'beforeEditRequest_resp');
|
|
|
|
|
|
|
|
// 接口调用成功,同步删除
|
|
|
|
newTags[editInputIndex] = editInputValue;
|
|
|
|
newTags[editInputIndex] = editInputValue;
|
|
|
|
setTags(newTags);
|
|
|
|
setTags(newTags);
|
|
|
|
setEditInputIndex(-1);
|
|
|
|
setEditInputIndex(-1);
|
|
|
|
setEditInputValue('');
|
|
|
|
setEditInputValue('');
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const tagPlusStyle: React.CSSProperties = {
|
|
|
|
const tagPlusStyle: React.CSSProperties = {
|
|
|
@ -172,13 +179,14 @@ const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
|
|
|
|
const tagElem = (
|
|
|
|
const tagElem = (
|
|
|
|
<Tag
|
|
|
|
<Tag
|
|
|
|
key={tag}
|
|
|
|
key={tag}
|
|
|
|
closable={true}
|
|
|
|
closable={fullData[index]?.used !== '1'}
|
|
|
|
style={{ userSelect: 'none' }}
|
|
|
|
style={{ userSelect: 'none' }}
|
|
|
|
onClose={() => handleClose(tag, index)}
|
|
|
|
onClose={() => handleClose(tag, index)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<span
|
|
|
|
<span
|
|
|
|
onDoubleClick={(e) => {
|
|
|
|
onDoubleClick={(e) => {
|
|
|
|
if (index !== 0) {
|
|
|
|
if (fullData[index]?.used !== '1') {
|
|
|
|
|
|
|
|
// 不可操作项,需要禁用
|
|
|
|
setEditInputIndex(index);
|
|
|
|
setEditInputIndex(index);
|
|
|
|
setEditInputValue(tag);
|
|
|
|
setEditInputValue(tag);
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|