Commit 53dd6146 by 放生的三文鱼

资产草稿

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