articleMenu extraFile 修改

This commit is contained in:
qsc 2023-10-24 10:38:18 +08:00
parent 960681a2e8
commit 2053b5e78c
3 changed files with 90 additions and 44 deletions

View File

@ -1,11 +1,12 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useState, useRef, useEffect } from 'react';
import { Input, Button, Dropdown, Divider, Modal, Form, Image } from 'antd';
import { Input, Button, Dropdown, Divider, Modal, Form, Image, Space } from 'antd';
import { EditOutlined, DownOutlined, UpOutlined, MinusOutlined, PlusOutlined, EyeOutlined } from '@ant-design/icons';
import ArticleMenuTreeList from '../treeList';
import ArticleTreeList from '../../article/treeList';
import Styles from './web.pc.module.less';
import OakGallery from "../../../components/extraFile/gallery";
import ExtraFileUpload from '../../extraFile/upload';
import ExtraFileCommit from '../../extraFile/commit';
export default function Render(props) {
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticle, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle } = props.data;
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
@ -120,24 +121,35 @@ export default function Render(props) {
// </div> :
_jsxs(_Fragment, { children: [_jsx(Button, { type: "text", icon: _jsx(EditOutlined, {}), size: "small", onClick: () => {
setNameEditing(true);
modal.confirm({
const modalInstance = modal.confirm({
title: '编辑分类',
cancelText: '取消',
okText: '提交',
content: (_jsxs("div", { children: [_jsx(Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: _jsx(Input, { ref: menuNameRef, defaultValue: row.name }) }), _jsx(Form.Item, { label: "LOGO", help: _jsxs("div", { children: [_jsx("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), _jsx("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: _jsx(_Fragment, { children: _jsx(OakGallery, { oakPath: oakFullpath
content: (_jsxs("div", { children: [_jsx(Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: _jsx(Input, { ref: menuNameRef, defaultValue: row.name, onChange: (val) => update({ name: val.target.value }) }) }), _jsx(Form.Item, { label: "LOGO", help: _jsxs("div", { children: [_jsx("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), _jsx("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: _jsx(_Fragment, { children: _jsx(ExtraFileUpload, { oakPath: oakFullpath
? `${oakFullpath}.extraFile$entity$1`
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) })] })),
onOk: async () => {
if (menuNameRef.current.input.value) {
await onUpdateName(menuNameRef.current.input.value);
}
else {
setMessage({
type: 'warning',
content: '请输入分类标题',
});
}
}
// onOk: async () => {
// if (menuNameRef.current!.input!.value) {
// await onUpdateName(menuNameRef.current!.input!.value);
// } else {
// setMessage({
// type: 'warning',
// content: '请输入分类标题',
// });
// }
// }
footer: () => _jsxs(Space, { children: [_jsx(ExtraFileCommit, { oakPath: oakFullpath, efPaths: [
'extraFile$entity$1',
], afterCommit: () => {
modalInstance.destroy();
}, beforeCommit: () => {
if (menuNameRef.current.input.value) {
return true;
}
else {
return false;
}
} }), _jsx(Button, { onClick: () => modalInstance.destroy(), children: "\u53D6\u6D88" })] })
});
}, style: { marginRight: 4 } }), _jsxs("div", { className: Styles.name, children: [logo ? (_jsx(Image, { height: 26, width: 26, src: logo, preview: false })) : null, _jsx("div", { style: { marginLeft: 4, overflow: 'hidden', width: '100px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: row?.name })] })] }) }), _jsx(Divider, { type: "vertical", style: { height: '100%', marginTop: 4, marginBottom: 4 } }), _jsxs("div", { className: Styles.control, children: [!row.parentId && _jsx(Button, { type: "text", onClick: () => {
gotoDoc(row?.id);

View File

@ -8,7 +8,8 @@ const icons_1 = require("@ant-design/icons");
const treeList_1 = tslib_1.__importDefault(require("../treeList"));
const treeList_2 = tslib_1.__importDefault(require("../../article/treeList"));
const web_pc_module_less_1 = tslib_1.__importDefault(require("./web.pc.module.less"));
const gallery_1 = tslib_1.__importDefault(require("../../../components/extraFile/gallery"));
const upload_1 = tslib_1.__importDefault(require("../../extraFile/upload"));
const commit_1 = tslib_1.__importDefault(require("../../extraFile/commit"));
function Render(props) {
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticle, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle } = props.data;
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
@ -123,24 +124,35 @@ function Render(props) {
// </div> :
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EditOutlined, {}), size: "small", onClick: () => {
setNameEditing(true);
modal.confirm({
const modalInstance = modal.confirm({
title: '编辑分类',
cancelText: '取消',
okText: '提交',
content: ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: (0, jsx_runtime_1.jsx)(antd_1.Input, { ref: menuNameRef, defaultValue: row.name }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "LOGO", help: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { oakPath: oakFullpath
content: ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: (0, jsx_runtime_1.jsx)(antd_1.Input, { ref: menuNameRef, defaultValue: row.name, onChange: (val) => update({ name: val.target.value }) }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "LOGO", help: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(upload_1.default, { oakPath: oakFullpath
? `${oakFullpath}.extraFile$entity$1`
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) })] })),
onOk: async () => {
if (menuNameRef.current.input.value) {
await onUpdateName(menuNameRef.current.input.value);
}
else {
setMessage({
type: 'warning',
content: '请输入分类标题',
});
}
}
// onOk: async () => {
// if (menuNameRef.current!.input!.value) {
// await onUpdateName(menuNameRef.current!.input!.value);
// } else {
// setMessage({
// type: 'warning',
// content: '请输入分类标题',
// });
// }
// }
footer: () => (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(commit_1.default, { oakPath: oakFullpath, efPaths: [
'extraFile$entity$1',
], afterCommit: () => {
modalInstance.destroy();
}, beforeCommit: () => {
if (menuNameRef.current.input.value) {
return true;
}
else {
return false;
}
} }), (0, jsx_runtime_1.jsx)(antd_1.Button, { onClick: () => modalInstance.destroy(), children: "\u53D6\u6D88" })] })
});
}, style: { marginRight: 4 } }), (0, jsx_runtime_1.jsxs)("div", { className: web_pc_module_less_1.default.name, children: [logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { height: 26, width: 26, src: logo, preview: false })) : null, (0, jsx_runtime_1.jsx)("div", { style: { marginLeft: 4, overflow: 'hidden', width: '100px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: row?.name })] })] }) }), (0, jsx_runtime_1.jsx)(antd_1.Divider, { type: "vertical", style: { height: '100%', marginTop: 4, marginBottom: 4 } }), (0, jsx_runtime_1.jsxs)("div", { className: web_pc_module_less_1.default.control, children: [!row.parentId && (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", onClick: () => {
gotoDoc(row?.id);

View File

@ -1,12 +1,13 @@
import React, { useState, useRef, useEffect } from 'react';
import { Input, Button, MenuProps, Dropdown, Divider, Modal, InputRef, Form, Image } from 'antd';
import { Input, Button, MenuProps, Dropdown, Divider, Modal, InputRef, Form, Image, Space } from 'antd';
import { EditOutlined, DownOutlined, UpOutlined, RightOutlined, LeftOutlined, MinusOutlined, PlusOutlined, EyeOutlined } from '@ant-design/icons';
import { WebComponentProps } from "oak-frontend-base";
import ArticleMenuTreeList from '../treeList';
import ArticleTreeList from '../../article/treeList';
import { EntityDict } from "../../../oak-app-domain";
import Styles from './web.pc.module.less';
import OakGallery from "../../../components/extraFile/gallery";
import ExtraFileUpload from '../../extraFile/upload';
import ExtraFileCommit from '../../extraFile/commit';
export default function Render(props: WebComponentProps<EntityDict, 'articleMenu', false, {
row: EntityDict['articleMenu']['OpSchema'];
@ -219,7 +220,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
size="small"
onClick={() => {
setNameEditing(true);
modal.confirm({
const modalInstance = modal.confirm({
title: '编辑分类',
cancelText: '取消',
okText: '提交',
@ -231,6 +232,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
<Input
ref={menuNameRef}
defaultValue={row.name}
onChange={(val) => update({ name: val.target.value })}
/>
</Form.Item>
<Form.Item
@ -245,7 +247,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
}
>
<>
<OakGallery
<ExtraFileUpload
oakPath={
oakFullpath
? `${oakFullpath}.extraFile$entity$1`
@ -262,17 +264,37 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
</Form.Item>
</div>
),
onOk: async () => {
if (menuNameRef.current!.input!.value) {
await onUpdateName(menuNameRef.current!.input!.value);
} else {
setMessage({
type: 'warning',
content: '请输入分类标题',
});
}
}
// onOk: async () => {
// if (menuNameRef.current!.input!.value) {
// await onUpdateName(menuNameRef.current!.input!.value);
// } else {
// setMessage({
// type: 'warning',
// content: '请输入分类标题',
// });
// }
// }
footer: () => <Space>
<ExtraFileCommit
oakPath={oakFullpath}
efPaths={[
'extraFile$entity$1',
]}
afterCommit={() => {
modalInstance!.destroy()
}}
beforeCommit={() => {
if (menuNameRef.current!.input!.value) {
return true
} else {
return false
}
}}
/>
<Button onClick={() => modalInstance!.destroy()}>
</Button>
</Space>
});
}}
style={{ marginRight: 4 }}