From 2053b5e78c43478e513fffc7f5b167099d576a96 Mon Sep 17 00:00:00 2001 From: qsc <3153284618@qq.com> Date: Tue, 24 Oct 2023 10:38:18 +0800 Subject: [PATCH] =?UTF-8?q?articleMenu=20extraFile=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/articleMenu/treeCell/web.pc.js | 42 +++++++++------ lib/components/articleMenu/treeCell/web.pc.js | 40 +++++++++----- .../articleMenu/treeCell/web.pc.tsx | 52 +++++++++++++------ 3 files changed, 90 insertions(+), 44 deletions(-) diff --git a/es/components/articleMenu/treeCell/web.pc.js b/es/components/articleMenu/treeCell/web.pc.js index c1d601940..91ff86b7d 100644 --- a/es/components/articleMenu/treeCell/web.pc.js +++ b/es/components/articleMenu/treeCell/web.pc.js @@ -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) { // : _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); diff --git a/lib/components/articleMenu/treeCell/web.pc.js b/lib/components/articleMenu/treeCell/web.pc.js index 663494e28..6235beb31 100644 --- a/lib/components/articleMenu/treeCell/web.pc.js +++ b/lib/components/articleMenu/treeCell/web.pc.js @@ -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) { // : (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); diff --git a/src/components/articleMenu/treeCell/web.pc.tsx b/src/components/articleMenu/treeCell/web.pc.tsx index 33aec35a9..3585882f3 100644 --- a/src/components/articleMenu/treeCell/web.pc.tsx +++ b/src/components/articleMenu/treeCell/web.pc.tsx @@ -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 { setNameEditing(true); - modal.confirm({ + const modalInstance = modal.confirm({ title: '编辑分类', cancelText: '取消', okText: '提交', @@ -231,6 +232,7 @@ export default function Render(props: WebComponentProps update({ name: val.target.value })} /> <> - ), - 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: () => + { + modalInstance!.destroy() + }} + beforeCommit={() => { + if (menuNameRef.current!.input!.value) { + return true + } else { + return false + } + }} + /> + + }); }} style={{ marginRight: 4 }}