Commit 529b2e65bc5db90e13d11e89e0c1ff3ae988105b

Authored by zhongnanhuang
2 parents b5d69a01 42236fe8
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 1 import ButtonConfirm from '@/components/ButtomConfirm';
2 2 import { RESPONSE_CODE } from '@/constants/enum';
  3 +import InvoicingDrawerForm from '@/pages/Order/components/InvoicingDrawerForm';
3 4 import ReissueModal from '@/pages/Order/components/ReissueModal';
4 5 import {
5 6 postKingdeeRepSalBillOutbound,
... ... @@ -123,6 +124,8 @@ const OrderPage = () =&gt; {
123 124 const [allMainChecked, setAllMainChecked] = useState(false);
124 125 const [imagesViewerModalVisible, setImagesViewerModalVisible] =
125 126 useState<boolean>(false);
  127 + const [InvoicingDrawerFormVisible, setInvoicingDrawerFormVisible] =
  128 + useState<boolean>(false);
126 129 const [data, setData] = useState([]); //列表数据
127 130 const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
128 131 const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] =
... ... @@ -2397,7 +2400,7 @@ const OrderPage = () =&gt; {
2397 2400 )}
2398 2401 className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]"
2399 2402 >
2400   - <span className="text-[#8C8C8C]">开票款单位:</span>
  2403 + <span className="text-[#8C8C8C]">开票款单位:</span>
2401 2404 <span className="text-slate-700">
2402 2405 {record.receivingCompany !== null
2403 2406 ? enumValueToLabel(
... ... @@ -4071,6 +4074,19 @@ const OrderPage = () =&gt; {
4071 4074 );
4072 4075 }
4073 4076  
  4077 + <Button
  4078 + type="primary"
  4079 + key="out"
  4080 + onClick={() => {
  4081 + setIsEdit(false);
  4082 + setIsMainOrder(true);
  4083 + setInvoicingDrawerFormVisible(true);
  4084 + }}
  4085 + disabled={selectedSubOrderKeys?.length === 0}
  4086 + >
  4087 + 申请开票
  4088 + </Button>;
  4089 +
4074 4090 if (rolePath?.includes('mergeInvoicing')) {
4075 4091 toolBtns.push(
4076 4092 <Button
... ... @@ -4723,6 +4739,23 @@ const OrderPage = () =&gt; {
4723 4739 />
4724 4740 )}
4725 4741  
  4742 + {InvoicingDrawerFormVisible && (
  4743 + <InvoicingDrawerForm
  4744 + subOrders={
  4745 + isMainOrder
  4746 + ? [...subOrderSelectedMap.values()].flat()
  4747 + : buildSubOrders()
  4748 + }
  4749 + totalPayment={getApplyInvoicingTotalPayment()}
  4750 + onClose={() => {
  4751 + setApplyForInvoicingVisible(false);
  4752 + setIsMainOrder(false);
  4753 + clearOptObject();
  4754 + refreshTable();
  4755 + }}
  4756 + ></InvoicingDrawerForm>
  4757 + )}
  4758 +
4726 4759 {contextHolder}
4727 4760 <FloatButton.BackTop visibilityHeight={0} />
4728 4761 </div>
... ...