Commit cb884c0ee5d8fca7cb87cba1f3ff77c92e8de7d9

Authored by zhongnanhuang
1 parent 7b962be8

feat: update 发票核销

Showing 1 changed file with 48 additions and 26 deletions
src/pages/Invoice/index.tsx
@@ -253,31 +253,42 @@ const InvoicePage = () => { @@ -253,31 +253,42 @@ const InvoicePage = () => {
253 key: 'option', 253 key: 'option',
254 fixed: 'right', 254 fixed: 'right',
255 width: 120, 255 width: 120,
256 - render: (text, record, _, action) => [  
257 - <a  
258 - key="editable"  
259 - onClick={() => {  
260 - action?.startEditable?.(record.id);  
261 - }}  
262 - >  
263 - 编辑  
264 - </a>,  
265 - <ButtonConfirm  
266 - key="delete"  
267 - className="p-0"  
268 - title={'是否删除该银行流水记录?'}  
269 - text="删除"  
270 - onConfirm={async () => {  
271 - let res = await postServiceBankStatementDeleteBankStatement({  
272 - data: { id: record.id },  
273 - });  
274 - if (res.result === RESPONSE_CODE.SUCCESS) {  
275 - message.success(res.message);  
276 - reloadBankStatementTable();  
277 - }  
278 - }}  
279 - />,  
280 - ], 256 + render: (text, record, _, action) => {
  257 + let btns = [];
  258 + if (record.path?.includes('editBankStatement')) {
  259 + btns.push(
  260 + <a
  261 + key="editable"
  262 + onClick={() => {
  263 + action?.startEditable?.(record.id);
  264 + }}
  265 + >
  266 + 编辑
  267 + </a>,
  268 + );
  269 + }
  270 +
  271 + if (record.path?.includes('deleteBankStatement')) {
  272 + btns.push(
  273 + <ButtonConfirm
  274 + key="delete"
  275 + className="p-0"
  276 + title={'是否删除该银行流水记录?'}
  277 + text="删除"
  278 + onConfirm={async () => {
  279 + let res = await postServiceBankStatementDeleteBankStatement({
  280 + data: { id: record.id },
  281 + });
  282 + if (res.result === RESPONSE_CODE.SUCCESS) {
  283 + message.success(res.message);
  284 + reloadBankStatementTable();
  285 + }
  286 + }}
  287 + />,
  288 + );
  289 + }
  290 + return btns;
  291 + },
281 }); 292 });
282 293
283 return columns; 294 return columns;
@@ -441,7 +452,18 @@ const InvoicePage = () =&gt; { @@ -441,7 +452,18 @@ const InvoicePage = () =&gt; {
441 ], 452 ],
442 }} 453 }}
443 > 454 >
444 - <Tabs defaultActiveKey="1" items={tabsItems} /> 455 + <Tabs
  456 + defaultActiveKey="1"
  457 + items={tabsItems}
  458 + onChange={(value) => {
  459 + console.log(value);
  460 + if (value === '1') {
  461 + invoiceActionRef.current?.reload();
  462 + } else {
  463 + bankActionRef.current?.reload();
  464 + }
  465 + }}
  466 + />
445 </PageContainer> 467 </PageContainer>
446 468
447 {bankImportModalVisible ? ( 469 {bankImportModalVisible ? (