Commit 53dd6146 by 放生的三文鱼

资产草稿

parent 7de5bf81
...@@ -11,9 +11,16 @@ import { ...@@ -11,9 +11,16 @@ import {
} from "antd"; } from "antd";
import { useGetAssetDraft } from "../hooks/assetData"; import { useGetAssetDraft } from "../hooks/assetData";
import { debounce } from "lodash"; import { debounce } from "lodash";
import './index.less' import AssetDetailDrawer from "../../AssetManage/Component/AssetDetailDrawer";
import "./index.less";
// 主组件 // 主组件
const AssetManagementTable = () => { const AssetManagementTable = () => {
const [draftParams, setDraftParams] = React.useState({
visible: false,
dirId: "",
id:'',
templateType: "",
});
const { const {
loading, loading,
templates, templates,
...@@ -25,8 +32,7 @@ const AssetManagementTable = () => { ...@@ -25,8 +32,7 @@ const AssetManagementTable = () => {
setPagination, setPagination,
dataLoading, dataLoading,
draftData, draftData,
} = useGetAssetDraft(); } = useGetAssetDraft({ setDraftParams });
console.log("columns", columns);
const changeTemplate = (value) => { const changeTemplate = (value) => {
setCurrentTemplate(value); setCurrentTemplate(value);
...@@ -56,7 +62,7 @@ const AssetManagementTable = () => { ...@@ -56,7 +62,7 @@ const AssetManagementTable = () => {
}; };
return ( return (
<div style={{ background: "#fff"}} className="container"> <div style={{ background: "#fff" }} className="container">
{/* 操作按钮区域 */} {/* 操作按钮区域 */}
<div <div
style={{ style={{
...@@ -123,7 +129,7 @@ const AssetManagementTable = () => { ...@@ -123,7 +129,7 @@ const AssetManagementTable = () => {
scroll={{ x: true }} scroll={{ x: true }}
/> />
<Pagination <Pagination
style={{ margin: "12px auto",textAlign: "center"}} style={{ margin: "12px auto", textAlign: "center" }}
showTotal={(total) => `共 ${total} 条记录`} showTotal={(total) => `共 ${total} 条记录`}
showSizeChanger showSizeChanger
showQuickJumper showQuickJumper
...@@ -133,6 +139,18 @@ const AssetManagementTable = () => { ...@@ -133,6 +139,18 @@ const AssetManagementTable = () => {
onShowSizeChange={handlePageChange} onShowSizeChange={handlePageChange}
total={pagination.total} total={pagination.total}
/> />
<AssetDetailDrawer
{...draftParams}
onCancel={() => {
setDraftParams({
visible: false,
dirId: "",
id:'',
templateType: "",
});
}}
/>
</div> </div>
); );
}; };
......
...@@ -11,7 +11,7 @@ import { showMessage } from "../../../../util"; ...@@ -11,7 +11,7 @@ import { showMessage } from "../../../../util";
const { Text } = Typography; const { Text } = Typography;
// ../standardmanage/hooks/sourceMap // ../standardmanage/hooks/sourceMap
export function useGetAssetDraft() { export function useGetAssetDraft({ setDraftParams }) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [templates, setTemplates] = useState(); const [templates, setTemplates] = useState();
const [currentTemplate, setCurrentTemplate] = useState(); const [currentTemplate, setCurrentTemplate] = useState();
...@@ -66,7 +66,6 @@ export function useGetAssetDraft() { ...@@ -66,7 +66,6 @@ export function useGetAssetDraft() {
); );
}, },
}; };
// if (name === "编号") { // if (name === "编号") {
// params.width = 60; // params.width = 60;
// // params.fixed = 'left'; // // params.fixed = 'left';
...@@ -182,13 +181,15 @@ export function useGetAssetDraft() { ...@@ -182,13 +181,15 @@ export function useGetAssetDraft() {
// 发布操作逻辑 // 发布操作逻辑
console.log("发布记录:", record); console.log("发布记录:", record);
}; };
const handleStop = () => { const handleEdit = (record) => {
// 停用操作逻辑
console.log("停用记录:", record);
};
const handleEdit = () => {
// 编辑操作逻辑 // 编辑操作逻辑
console.log("编辑记录:", record); console.log("编辑记录:", record);
setDraftParams({
visible: true,
dirId: record?.dirId,
id: record?.id,
templateType: currentTemplate,
});
}; };
const handleDelete = async (record) => { const handleDelete = async (record) => {
// 删除操作逻辑 // 删除操作逻辑
...@@ -222,7 +223,9 @@ export function useGetAssetDraft() { ...@@ -222,7 +223,9 @@ export function useGetAssetDraft() {
waring waring
disabled={disabled} disabled={disabled}
type="link" type="link"
onClick={handleEdit} onClick={() => {
handleEdit(record);
}}
> >
编辑 编辑
</Button> </Button>
......
...@@ -604,7 +604,6 @@ const AssetAction = (props) => { ...@@ -604,7 +604,6 @@ const AssetAction = (props) => {
}) })
} catch (errInfo) { } catch (errInfo) {
console.log('Validate Failed:', errInfo);
showMessage('warn', '请完成资产必填项') showMessage('warn', '请完成资产必填项')
} }
} }
......
...@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd'; ...@@ -4,7 +4,7 @@ import { Drawer, Form } from 'antd';
import AssetAction from './AssetAction'; import AssetAction from './AssetAction';
const AssetDetailDrawer = (props) => { const AssetDetailDrawer = (props) => {
const { onCancel, visible, id, dirId, reference } = props; const { onCancel, visible, id, dirId, reference, templateType='', draftId='' } = props;
const [ form ] = Form.useForm(); const [ form ] = Form.useForm();
return ( return (
...@@ -20,7 +20,7 @@ const AssetDetailDrawer = (props) => { ...@@ -20,7 +20,7 @@ const AssetDetailDrawer = (props) => {
}} }}
> >
{ {
visible && <AssetAction reference={reference} form={form} id={id} dirId={dirId} action='detail' onChange={() => { visible && <AssetAction templateType={templateType} reference={reference} form={form} id={id} dirId={dirId} draftId={draftId} action='detail' onChange={() => {
onCancel?.(true); onCancel?.(true);
}} /> }} />
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment