fix(产品管理): 编辑: 初始化空数据后新增

perf/export-docx
Lei OT 11 months ago
parent 722851aef6
commit c101d6660c

@ -12,12 +12,12 @@ import ProductInfo from './Detail/ProductInfo';
import NewProductModal from './Detail/NewProductModal';
function Detail() {
const { notification, modal } = App.useApp()
const { notification, modal } = App.useApp();
const { travel_agency_id, audit_state, use_year } = useParams();
const [addProductVisible, setAddProductVisible] = useState(false);
const [agencyProducts, switchParams] = useProductsStore((state) => [state.agencyProducts, state.switchParams]);
const [getAgencyProducts, activeAgency] = useProductsStore((state) => [state.getAgencyProducts, state.activeAgency]);
const [loading, setLoading] = useProductsStore(state => [state.loading, state.setLoading]);
const [loading, setLoading] = useProductsStore((state) => [state.loading, state.setLoading]);
const { travelAgencyId } = usingStorage();
const handleGetAgencyProducts = ({ pick_year, pick_agency, pick_state } = {}) => {
@ -26,14 +26,14 @@ function Detail() {
const state = pick_state ?? audit_state;
const param = { travel_agency_id: agency, use_year: year, audit_state: state };
// setEditingProduct({});
getAgencyProducts(param).catch(ex => {
getAgencyProducts(param).catch((ex) => {
setLoading(false);
notification.error({
message: 'Notification',
description: ex.message,
placement: 'top',
duration: 4,
})
});
});
};
@ -41,27 +41,17 @@ function Detail() {
<SecondHeaderWrapper
loading={loading}
backTo={false}
header={
<Header
title={activeAgency.travel_agency_name}
refresh={handleGetAgencyProducts}
handleNewProduct={() => setAddProductVisible(true)}
/>
}>
{isEmpty(agencyProducts) ? (
<Empty />
) : (
<>
<Flex gap={10}>
{/* onNodeSelect={handleNodeSelect} */}
<ProductsTree className='basis-80 sticky top-16 overflow-y-auto shrink-0' style={{ height: 'calc(100vh - 150px)' }} />
<Divider type={'vertical'} className='mx-1 h-auto' />
<div className=' flex-auto '>
<ProductInfo />
</div>
</Flex>
</>
)}
header={<Header title={activeAgency.travel_agency_name} refresh={handleGetAgencyProducts} handleNewProduct={() => setAddProductVisible(true)} />}>
<>
<Flex gap={10}>
{/* onNodeSelect={handleNodeSelect} */}
<ProductsTree className='basis-80 sticky top-16 overflow-y-auto shrink-0' style={{ height: 'calc(100vh - 150px)' }} />
<Divider type={'vertical'} className='mx-1 h-auto' />
<div className=' flex-auto '>
<ProductInfo />
</div>
</Flex>
</>
</SecondHeaderWrapper>
);
}

@ -143,7 +143,7 @@ const Header = ({ refresh, ...props }) => {
<AuditStateSelector variant={'borderless'} className='w-32' size='large' value={pickAuditState} onChange={handleAuditStateChange} />
{/* <Divider type={'vertical'} />
{(use_year || '').replace('all', '')} */}
<Button onClick={() => refresh(param)} type='text' className='text-primary round-none' ghost icon={<ReloadOutlined />} />
<Button onClick={() => refresh(param)} type='text' className='text-primary round-none' icon={<ReloadOutlined />} />
</h2>
</div>
{showEditA && (

Loading…
Cancel
Save