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'; import NewProductModal from './Detail/NewProductModal';
function Detail() { function Detail() {
const { notification, modal } = App.useApp() const { notification, modal } = App.useApp();
const { travel_agency_id, audit_state, use_year } = useParams(); const { travel_agency_id, audit_state, use_year } = useParams();
const [addProductVisible, setAddProductVisible] = useState(false); const [addProductVisible, setAddProductVisible] = useState(false);
const [agencyProducts, switchParams] = useProductsStore((state) => [state.agencyProducts, state.switchParams]); const [agencyProducts, switchParams] = useProductsStore((state) => [state.agencyProducts, state.switchParams]);
const [getAgencyProducts, activeAgency] = useProductsStore((state) => [state.getAgencyProducts, state.activeAgency]); 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 { travelAgencyId } = usingStorage();
const handleGetAgencyProducts = ({ pick_year, pick_agency, pick_state } = {}) => { const handleGetAgencyProducts = ({ pick_year, pick_agency, pick_state } = {}) => {
@ -26,14 +26,14 @@ function Detail() {
const state = pick_state ?? audit_state; const state = pick_state ?? audit_state;
const param = { travel_agency_id: agency, use_year: year, audit_state: state }; const param = { travel_agency_id: agency, use_year: year, audit_state: state };
// setEditingProduct({}); // setEditingProduct({});
getAgencyProducts(param).catch(ex => { getAgencyProducts(param).catch((ex) => {
setLoading(false); setLoading(false);
notification.error({ notification.error({
message: 'Notification', message: 'Notification',
description: ex.message, description: ex.message,
placement: 'top', placement: 'top',
duration: 4, duration: 4,
}) });
}); });
}; };
@ -41,27 +41,17 @@ function Detail() {
<SecondHeaderWrapper <SecondHeaderWrapper
loading={loading} loading={loading}
backTo={false} backTo={false}
header={ header={<Header title={activeAgency.travel_agency_name} refresh={handleGetAgencyProducts} handleNewProduct={() => setAddProductVisible(true)} />}>
<Header <>
title={activeAgency.travel_agency_name} <Flex gap={10}>
refresh={handleGetAgencyProducts} {/* onNodeSelect={handleNodeSelect} */}
handleNewProduct={() => setAddProductVisible(true)} <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 '>
{isEmpty(agencyProducts) ? ( <ProductInfo />
<Empty /> </div>
) : ( </Flex>
<> </>
<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> </SecondHeaderWrapper>
); );
} }

@ -143,7 +143,7 @@ const Header = ({ refresh, ...props }) => {
<AuditStateSelector variant={'borderless'} className='w-32' size='large' value={pickAuditState} onChange={handleAuditStateChange} /> <AuditStateSelector variant={'borderless'} className='w-32' size='large' value={pickAuditState} onChange={handleAuditStateChange} />
{/* <Divider type={'vertical'} /> {/* <Divider type={'vertical'} />
{(use_year || '').replace('all', '')} */} {(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> </h2>
</div> </div>
{showEditA && ( {showEditA && (

Loading…
Cancel
Save