Commit e7075134fe757d28f2b29e12d8bd824dd14a42df

Authored by 曾国涛
2 parents b1762459 f007db73

Merge branch 'master' into invoice

src/pages/Invoice/components/AddInvoiceDrawerForm.tsx
1 import { RESPONSE_CODE } from '@/constants/enum'; 1 import { RESPONSE_CODE } from '@/constants/enum';
  2 +import { PAYEE_OPTIONS } from '@/pages/Order/constant';
2 import { 3 import {
3 postServiceInvoiceAddInvoice, 4 postServiceInvoiceAddInvoice,
4 postServiceOrderQuerySalesCode, 5 postServiceOrderQuerySalesCode,
5 } from '@/services'; 6 } from '@/services';
  7 +import { enumToSelect } from '@/utils';
6 import { PlusOutlined } from '@ant-design/icons'; 8 import { PlusOutlined } from '@ant-design/icons';
7 import { 9 import {
8 DrawerForm, 10 DrawerForm,
@@ -97,9 +99,9 @@ export default ({ onClose }) => { @@ -97,9 +99,9 @@ export default ({ onClose }) => {
97 }); 99 });
98 if (res.result === RESPONSE_CODE.SUCCESS) { 100 if (res.result === RESPONSE_CODE.SUCCESS) {
99 message.success(res.message); 101 message.success(res.message);
100 - return true;  
101 } else { 102 } else {
102 message.error(res.message); 103 message.error(res.message);
  104 + return false;
103 } 105 }
104 onClose(); 106 onClose();
105 // 不返回不会关闭弹框 107 // 不返回不会关闭弹框
@@ -129,12 +131,15 @@ export default ({ onClose }) => { @@ -129,12 +131,15 @@ export default ({ onClose }) => {
129 placeholder="请输入购买方" 131 placeholder="请输入购买方"
130 rules={[{ required: true, message: '请输入购买方!' }]} 132 rules={[{ required: true, message: '请输入购买方!' }]}
131 /> 133 />
132 - <ProFormText 134 + <ProFormSelect
  135 + placeholder="收款单位"
133 name="payee" 136 name="payee"
134 - width="md"  
135 - label="收款单位"  
136 - placeholder="请输入收款单位"  
137 - rules={[{ required: true, message: '请输入收款单位!' }]} 137 + width="lg"
  138 + key="payee"
  139 + showSearch
  140 + label="开票收款单位"
  141 + tooltip="财务开票将依据这个字段,选择对应的公司开票"
  142 + options={enumToSelect(PAYEE_OPTIONS)}
138 /> 143 />
139 <ProFormText 144 <ProFormText
140 name="contacts" 145 name="contacts"
@@ -144,8 +149,8 @@ export default ({ onClose }) =&gt; { @@ -144,8 +149,8 @@ export default ({ onClose }) =&gt; {
144 rules={[{ required: true, message: '请输入联系人!' }]} 149 rules={[{ required: true, message: '请输入联系人!' }]}
145 /> 150 />
146 <ProFormSelect 151 <ProFormSelect
147 - name="salesCode"  
148 - key="salesCode" 152 + name="sale"
  153 + key="sale"
149 width="lg" 154 width="lg"
150 showSearch 155 showSearch
151 label="销售代表" 156 label="销售代表"
src/pages/Invoice/index.tsx
@@ -865,11 +865,11 @@ const InvoicePage = () =&gt; { @@ -865,11 +865,11 @@ const InvoicePage = () =&gt; {
865 scroll={{ x: 1400, y: 360 }} 865 scroll={{ x: 1400, y: 360 }}
866 toolBarRender={() => [ 866 toolBarRender={() => [
867 <AddInvoiceDrawerForm 867 <AddInvoiceDrawerForm
868 - key="addInvoiceDrawerForm"  
869 onClose={() => { 868 onClose={() => {
870 invoiceActionRef.current?.reload(); 869 invoiceActionRef.current?.reload();
871 bankActionRef.current?.reload(); 870 bankActionRef.current?.reload();
872 }} 871 }}
  872 + key="add"
873 ></AddInvoiceDrawerForm>, 873 ></AddInvoiceDrawerForm>,
874 ]} 874 ]}
875 /> 875 />
src/pages/Order/components/CheckModal.tsx
@@ -621,17 +621,6 @@ export default ({ @@ -621,17 +621,6 @@ export default ({
621 '' 621 ''
622 )} 622 )}
623 623
624 - <div>请特别注意订单总金额与订单金额。</div>  
625 - {!checkType(CHECK_TYPE.CONFIRM_DELIVER) ? (  
626 - <ProFormTextArea  
627 - width="lg"  
628 - name="name"  
629 - placeholder="若驳回,请填写驳回理由"  
630 - />  
631 - ) : (  
632 - <></>  
633 - )}  
634 -  
635 {checkType(CHECK_TYPE.PREPAID_AUDIT) && ( 624 {checkType(CHECK_TYPE.PREPAID_AUDIT) && (
636 <> 625 <>
637 <Divider orientation="center"> 626 <Divider orientation="center">
src/pages/Order/components/InvoicingDrawerForm.tsx 0 → 100644
  1 +import {
  2 + DrawerForm,
  3 + ProForm,
  4 + ProFormDateRangePicker,
  5 + ProFormSelect,
  6 + ProFormText,
  7 +} from '@ant-design/pro-components';
  8 +import { Form, message } from 'antd';
  9 +
  10 +const waitTime = (time: number = 100) => {
  11 + return new Promise((resolve) => {
  12 + setTimeout(() => {
  13 + resolve(true);
  14 + }, time);
  15 + });
  16 +};
  17 +
  18 +export default ({ subOrders, totalPayment, onClose }) => {
  19 + const [form] = Form.useForm<{ name: string; company: string }>();
  20 +
  21 + return (
  22 + <DrawerForm<{
  23 + name: string;
  24 + company: string;
  25 + }>
  26 + title="新建表单"
  27 + resize={{
  28 + onResize() {
  29 + console.log('resize!');
  30 + },
  31 + maxWidth: window.innerWidth * 0.8,
  32 + minWidth: 300,
  33 + }}
  34 + form={form}
  35 + /*trigger={
  36 + <Button type="primary">
  37 + <PlusOutlined />
  38 + 新建表单
  39 + </Button>
  40 + }*/
  41 + open={true}
  42 + autoFocusFirstInput
  43 + drawerProps={{
  44 + destroyOnClose: true,
  45 + }}
  46 + submitTimeout={2000}
  47 + onFinish={async (values) => {
  48 + await waitTime(2000);
  49 + console.log(values);
  50 + console.log(subOrders);
  51 + console.log(totalPayment);
  52 + message.success('提交成功');
  53 + onClose();
  54 + // 不返回不会关闭弹框
  55 + return true;
  56 + }}
  57 + >
  58 + <ProForm.Group>
  59 + <ProFormText
  60 + name="name"
  61 + width="md"
  62 + label="签约客户名称"
  63 + tooltip="最长为 24 位"
  64 + placeholder="请输入名称"
  65 + />
  66 + <ProFormText
  67 + rules={[
  68 + {
  69 + required: true,
  70 + },
  71 + ]}
  72 + width="md"
  73 + name="company"
  74 + label="我方公司名称"
  75 + placeholder="请输入名称"
  76 + />
  77 + </ProForm.Group>
  78 + <ProForm.Group>
  79 + <ProFormText
  80 + width="md"
  81 + name="contract"
  82 + label="合同名称"
  83 + placeholder="请输入名称"
  84 + />
  85 + <ProFormDateRangePicker name="contractTime" label="合同生效时间" />
  86 + </ProForm.Group>
  87 + <ProForm.Group>
  88 + <ProFormSelect
  89 + options={[
  90 + {
  91 + value: 'chapter',
  92 + label: '盖章后生效',
  93 + },
  94 + ]}
  95 + width="xs"
  96 + name="useMode"
  97 + label="合同约定生效方式"
  98 + />
  99 + <ProFormSelect
  100 + width="xs"
  101 + options={[
  102 + {
  103 + value: 'time',
  104 + label: '履行完终止',
  105 + },
  106 + ]}
  107 + formItemProps={{
  108 + style: {
  109 + margin: 0,
  110 + },
  111 + }}
  112 + name="unusedMode"
  113 + label="合同约定失效效方式"
  114 + />
  115 + </ProForm.Group>
  116 + <ProFormText width="sm" name="id" label="主合同编号" />
  117 + <ProFormText
  118 + name="project"
  119 + disabled
  120 + label="项目名称"
  121 + initialValue="xxxx项目"
  122 + />
  123 + <ProFormText
  124 + width="xs"
  125 + name="mangerName"
  126 + disabled
  127 + label="商务经理"
  128 + initialValue="启途"
  129 + />
  130 + </DrawerForm>
  131 + );
  132 +};
src/pages/Order/index.tsx
1 import ButtonConfirm from '@/components/ButtomConfirm'; 1 import ButtonConfirm from '@/components/ButtomConfirm';
2 import { RESPONSE_CODE } from '@/constants/enum'; 2 import { RESPONSE_CODE } from '@/constants/enum';
  3 +import InvoicingDrawerForm from '@/pages/Order/components/InvoicingDrawerForm';
3 import ReissueModal from '@/pages/Order/components/ReissueModal'; 4 import ReissueModal from '@/pages/Order/components/ReissueModal';
4 import { 5 import {
5 postKingdeeRepSalBillOutbound, 6 postKingdeeRepSalBillOutbound,
@@ -122,6 +123,8 @@ const OrderPage = () =&gt; { @@ -122,6 +123,8 @@ const OrderPage = () =&gt; {
122 const [allMainChecked, setAllMainChecked] = useState(false); 123 const [allMainChecked, setAllMainChecked] = useState(false);
123 const [imagesViewerModalVisible, setImagesViewerModalVisible] = 124 const [imagesViewerModalVisible, setImagesViewerModalVisible] =
124 useState<boolean>(false); 125 useState<boolean>(false);
  126 + const [InvoicingDrawerFormVisible, setInvoicingDrawerFormVisible] =
  127 + useState<boolean>(false);
125 const [data, setData] = useState([]); //列表数据 128 const [data, setData] = useState([]); //列表数据
126 const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); 129 const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
127 const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = 130 const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] =
@@ -3969,6 +3972,19 @@ const OrderPage = () =&gt; { @@ -3969,6 +3972,19 @@ const OrderPage = () =&gt; {
3969 ); 3972 );
3970 } 3973 }
3971 3974
  3975 + <Button
  3976 + type="primary"
  3977 + key="out"
  3978 + onClick={() => {
  3979 + setIsEdit(false);
  3980 + setIsMainOrder(true);
  3981 + setInvoicingDrawerFormVisible(true);
  3982 + }}
  3983 + disabled={selectedSubOrderKeys?.length === 0}
  3984 + >
  3985 + 申请开票
  3986 + </Button>;
  3987 +
3972 if (rolePath?.includes('mergeInvoicing')) { 3988 if (rolePath?.includes('mergeInvoicing')) {
3973 toolBtns.push( 3989 toolBtns.push(
3974 <Button 3990 <Button
@@ -4621,6 +4637,23 @@ const OrderPage = () =&gt; { @@ -4621,6 +4637,23 @@ const OrderPage = () =&gt; {
4621 /> 4637 />
4622 )} 4638 )}
4623 4639
  4640 + {InvoicingDrawerFormVisible && (
  4641 + <InvoicingDrawerForm
  4642 + subOrders={
  4643 + isMainOrder
  4644 + ? [...subOrderSelectedMap.values()].flat()
  4645 + : buildSubOrders()
  4646 + }
  4647 + totalPayment={getApplyInvoicingTotalPayment()}
  4648 + onClose={() => {
  4649 + setApplyForInvoicingVisible(false);
  4650 + setIsMainOrder(false);
  4651 + clearOptObject();
  4652 + refreshTable();
  4653 + }}
  4654 + ></InvoicingDrawerForm>
  4655 + )}
  4656 +
4624 {contextHolder} 4657 {contextHolder}
4625 <FloatButton.BackTop visibilityHeight={0} /> 4658 <FloatButton.BackTop visibilityHeight={0} />
4626 </div> 4659 </div>