diff --git a/src/pages/Instalment/components/comfire/comfire.tsx b/src/pages/Instalment/components/comfire/comfire.tsx new file mode 100644 index 0000000..b960eb8 --- /dev/null +++ b/src/pages/Instalment/components/comfire/comfire.tsx @@ -0,0 +1,58 @@ +import { PlusOutlined } from '@ant-design/icons'; +import { + ModalForm, + ProForm, + ProFormDateRangePicker, + ProFormSelect, + ProFormText, +} from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useState } from 'react'; + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; + +export default ({currtDid,sureDelete}) => { + const [form] = Form.useForm<{ name: string; company: string }>(); + const [ids,setIds]=useState([]); + + function getIds(){ + // console.log(currtDid); + setIds([]) + setIds(currtDid) + } + return ( + <ModalForm<{ + name: string; + company: string; + }> + trigger={ + <a onClick={()=>{getIds()}}> + 删除 + </a> + } + form={form} + autoFocusFirstInput + width={190} + modalProps={{ + destroyOnClose: true, + // onCancel: () => console.log('run'), + }} + onFinish={async (values) => { + await waitTime(100); + sureDelete([ids]); + // console.log(values.name); + message.success('提交成功'); + return true; + }} + > + <br/> + <h2>确定删除吗</h2> + </ModalForm> + ); +}; \ No newline at end of file diff --git a/src/pages/Instalment/components/detail/detail.tsx b/src/pages/Instalment/components/detail/detail.tsx index cc20a02..c5f81fe 100644 --- a/src/pages/Instalment/components/detail/detail.tsx +++ b/src/pages/Instalment/components/detail/detail.tsx @@ -12,7 +12,7 @@ import ProductDetail from '../productDetail/productDetail'; import PayWayDetail from '../payWayDetail/payWayDetail'; import { Button, Form,message } from 'antd'; import { useEffect,useState } from 'react'; -import { postOrderErpOrderStagesPayWaySaveOrUpdate, postOrderErpOrderStagesSaveOrUpdate, postOrderErpOrderStagesSearch, postOrderErpOrderStagesUpload } from '@/services'; +import { postOrderErpOrderStagesAdd, postOrderErpOrderStagesPayWaySaveOrUpdate, postOrderErpOrderStagesSaveOrUpdate, postOrderErpOrderStagesSearch, postOrderErpOrderStagesUpload } from '@/services'; import { RcFile } from 'antd/es/upload'; const waitTime = (time: number = 100) => { @@ -23,7 +23,7 @@ const waitTime = (time: number = 100) => { }); }; -export default ({ toReload }) => { +export default ({ toReload}) => { const [form] = Form.useForm<{ name: string; company: string }>(); const [contextBody, setContextBody] = useState<OrderStagesWithListItem>({ id:undefined, @@ -42,7 +42,6 @@ export default ({ toReload }) => { const [otherBody, setOtherBody] = useState([]) const [isDis,setIsDis]=useState(true) - type OrderStagesWithListItem = { //文件编号 id?: number; @@ -81,7 +80,7 @@ export default ({ toReload }) => { } function getEditProductBody(value) { - console.log(value); + // console.log(value); setEditProductBody(value) let price = 0; @@ -98,7 +97,7 @@ export default ({ toReload }) => { } [] function setSave(value) { - console.log(value); + // console.log(value); setOtherBody(value) } @@ -143,6 +142,21 @@ export default ({ toReload }) => { } }; + function refresh(){ + setContextBody({ + id:undefined, + contract:undefined, + dateRange:undefined, + terminal:undefined, + orderStagesDeviceVoList:[], + totalPrice:undefined, + payWay:"30/30/30/10", + annex:undefined, + remark:undefined + }) + handleInputChange("30/30/30/10",0,0) + } + return ( <ModalForm<OrderStagesWithListItem> title="新建" @@ -151,6 +165,7 @@ export default ({ toReload }) => { key="button" icon={<PlusOutlined />} type="primary" + onClick={()=>refresh()} > 新增 </Button> @@ -159,15 +174,21 @@ export default ({ toReload }) => { autoFocusFirstInput modalProps={{ destroyOnClose: true, - onCancel: () => console.log('run'), - }} - onChange={(value) => { - console.log(value); + // onCancel: () => console.log('run'), }} + // onChange={(e) => { + // console.log(e); + + // console.log(e.target.value); + // }} submitTimeout={2000} onFinish={async (values) => { - console.log(values); - console.log(otherBody); + if (editProductBody.length==0) { + message.error("请填写产品数据") + return false; + } + // console.log(values); + // console.log(otherBody); let remakeValue = []; let remakeItem = {} @@ -195,12 +216,12 @@ export default ({ toReload }) => { } }); if (res.data) { - console.log(values) - console.log(contextBody); + // console.log(values) + // console.log(contextBody); toSendEdit.annex = res.data } } - const isSaveOrUpdate = await postOrderErpOrderStagesSaveOrUpdate({ + const isSaveOrUpdate = await postOrderErpOrderStagesAdd({ data: { ...toSendEdit } }) @@ -241,7 +262,7 @@ export default ({ toReload }) => { return { ...item, ossId: returnOssID.data[0].id }; }); - console.log(makeEnd); + // console.log(makeEnd); } } @@ -250,12 +271,12 @@ export default ({ toReload }) => { // 使用Promise.all等待所有异步操作完成后再执行保存操作 Promise.all(promises).then( async () => { - console.log(makeEnd); + // console.log(makeEnd); await postOrderErpOrderStagesPayWaySaveOrUpdate({ data: makeEnd }); }); - console.log(isSaveOrUpdate); + // console.log(isSaveOrUpdate); toReload() } await waitTime(2000); @@ -306,10 +327,10 @@ export default ({ toReload }) => { placeholder="请输入" initialValue={contextBody.payWay} disabled={!isDis} - // onBlur={(e) => { - // setContextBody({...contextBody,payWay:e.target.value}) - // handleInputChange(e.target.value, 1); - // }} + onBlur={(e) => { + setContextBody({...contextBody,payWay:e.target.value}) + handleInputChange(e.target.value, 1); + }} /> <ProFormText @@ -325,7 +346,7 @@ export default ({ toReload }) => { name="annex" max={1} onChange={(value) => { - console.log(value); + // console.log(value); }} label="合同附件" /> @@ -350,7 +371,7 @@ export default ({ toReload }) => { </ProForm.Group> </ProCard> <ProCard - title="产品明细" + title={<><span style={{ color: 'red' }}>*</span>产品明细</>} style={{ marginTop: 10 }} headerBordered bordered diff --git a/src/pages/Instalment/components/edit/edit.tsx b/src/pages/Instalment/components/edit/edit.tsx index ce84d17..80a9a4a 100644 --- a/src/pages/Instalment/components/edit/edit.tsx +++ b/src/pages/Instalment/components/edit/edit.tsx @@ -1,17 +1,23 @@ +import { PlusOutlined } from '@ant-design/icons'; import { ModalForm, ProCard, ProForm, ProFormDatePicker, + ProFormDateRangePicker, + ProFormDependency, + ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton, } from '@ant-design/pro-components'; import ProductDetail from '../productDetail/productDetail'; import PayWayDetail from '../payWayDetail/payWayDetail'; -import { Form,message } from 'antd'; -import { useEffect, useState } from 'react'; -import { postOrderErpOrderStagesPayWaySaveOrUpdate, postOrderErpOrderStagesSaveOrUpdate, postOrderErpOrderStagesSearch, postOrderErpOrderStagesUpload } from '@/services'; +import { Button, Form, UploadProps, message } from 'antd'; +import Item from 'antd/es/list/Item'; +import { useEffect, useRef, useState } from 'react'; +import { postOrderErpOrderStagesPayWaySaveOrUpdate, postOrderErpOrderStagesPayWayUploadForPayWay, postOrderErpOrderStagesSaveOrUpdate, postOrderErpOrderStagesSearch, postOrderErpOrderStagesUpload, postServiceOrderFileProcess } from '@/services'; +import { context } from '@/.umi/core/helmetContext'; import { RcFile } from 'antd/es/upload'; const waitTime = (time: number = 100) => { @@ -22,7 +28,7 @@ const waitTime = (time: number = 100) => { }); }; -export default ({ currentContract,toReload }) => { +export default ({ currentContract, toReload }) => { const [form] = Form.useForm<{ name: string; company: string }>(); const [contextBody, setContextBody] = useState({}); const [editProductBody, setEditProductBody] = useState([]); @@ -72,8 +78,8 @@ export default ({ currentContract,toReload }) => { data: { contract: currentContract }, }); const context = res.data[0]; - console.log(context); - + // console.log(context); + if (context.contract != null) { setContextBody(context); setTotal(context.totalPrice) @@ -82,8 +88,22 @@ export default ({ currentContract,toReload }) => { handleInputChange(context.payWay, 0, context.totalPrice) } + async function refresh() { + const res = await postOrderErpOrderStagesSearch({ + data: { contract: currentContract }, + }); + const context = res.data[0]; + // console.log(context); + + if (context.contract != null) { + setContextBody(context); + setTotal(context.totalPrice) + form.setFieldValue('totalPrice', context.totalPrice); + } + } + function getEditProductBody(value) { - console.log(value); + // console.log(value); setEditProductBody(value) let price = 0; @@ -94,9 +114,9 @@ export default ({ currentContract,toReload }) => { setContextBody({ ...contextBody, orderStagesDeviceVoList: value }) handleInputChange(contextBody.payWay, 0, price) } - [] + function setSave(value) { - console.log(value); + // console.log(value); setOtherBody(value) } @@ -146,27 +166,30 @@ export default ({ currentContract,toReload }) => { <ModalForm<OrderStagesWithListItem> title="新建" trigger={ - <a> - 编辑 - </a> + <a onClick={refresh}>编辑</a> } form={form} autoFocusFirstInput modalProps={{ destroyOnClose: true, - onCancel: () => console.log('run'), + // onCancel: () => console.log('run'), }} submitTimeout={2000} onFinish={async (values) => { - console.log(values); - console.log(otherBody); + if (contextBody.orderStagesDeviceVoList.length == 0) { + message.error("请填写产品数据") + return false; + } + + // console.log(values); + // console.log(otherBody); let remakeValue = []; let remakeItem = {} // 创建一个用于存储所有异步操作的Promise数组 const promises = []; otherBody.forEach(item => { - let remakeItem = { ossId: item.ossId, number: item.id, dataRange: item.payDate, fileName: item.fileName }; + let remakeItem = { ossId: contextBody.id, number: item.id, dateRange: item.payDate, fileName: item.fileName }; if (typeof item.fileUrl === 'object' && item.fileUrl instanceof File) { const formData = new FormData(); formData.append('file', item.fileUrl as RcFile); @@ -188,6 +211,8 @@ export default ({ currentContract,toReload }) => { // 使用Promise.all等待所有异步操作完成后再执行保存操作 Promise.all(promises).then(async () => { + // console.log(remakeValue); + const resp = await postOrderErpOrderStagesPayWaySaveOrUpdate({ data: remakeValue }); @@ -216,8 +241,8 @@ export default ({ currentContract,toReload }) => { } }); if (res.data) { - console.log(values) - console.log(contextBody); + // console.log(values) + // console.log(contextBody); toSendEdit.annex = res.data } } @@ -225,7 +250,7 @@ export default ({ currentContract,toReload }) => { data: { ...toSendEdit } }) if (isSaveOrUpdate) { - console.log(isSaveOrUpdate); + // console.log(isSaveOrUpdate); getBody() toReload() } @@ -294,7 +319,7 @@ export default ({ currentContract,toReload }) => { name="annex" max={1} onChange={(value) => { - console.log(value); + // console.log(value); }} label="合同附件" /> @@ -304,20 +329,22 @@ export default ({ currentContract,toReload }) => { label="合同金额" placeholder="请输入" disabled - // rules={[{ required: true, message: '此项为必填项' }]} - // value={contextBody.totalPrice} - initialValue={contextBody.totalPrice} + // rules={[{ required: true, message: '此项为必填项' }]} + // value={contextBody.totalPrice} + initialValue={contextBody.totalPrice} /> </ProForm.Group> </ProCard> - <ProCard - title="产品明细" - style={{ marginTop: 10 }} - headerBordered - bordered - > - <ProductDetail productBody={contextBody.orderStagesDeviceVoList} EditProductBody={getEditProductBody}></ProductDetail> - </ProCard> + + <ProCard + title={<><span style={{ color: 'red' }}>*</span>产品明细</>} + style={{ marginTop: 10 }} + headerBordered + bordered + > + <ProductDetail productBody={contextBody.orderStagesDeviceVoList} EditProductBody={getEditProductBody}></ProductDetail> + </ProCard> + <ProCard title="付款信息" diff --git a/src/pages/Instalment/components/payWayDetail/payWayDetail.css b/src/pages/Instalment/components/payWayDetail/payWayDetail.css new file mode 100644 index 0000000..a2184b0 --- /dev/null +++ b/src/pages/Instalment/components/payWayDetail/payWayDetail.css @@ -0,0 +1,11 @@ +.payway-detail-index td { + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif; + font-size: 14px; + margin: 0; +} +.payway-detail-index td .css-dev-only-do-not-override-nllxry { + margin-bottom: 0px !important; +} +.dataChoose { + margin: 0; +} diff --git a/src/pages/Instalment/components/payWayDetail/payWayDetail.tsx b/src/pages/Instalment/components/payWayDetail/payWayDetail.tsx index 1f3c556..47afb56 100644 --- a/src/pages/Instalment/components/payWayDetail/payWayDetail.tsx +++ b/src/pages/Instalment/components/payWayDetail/payWayDetail.tsx @@ -1,13 +1,17 @@ import type { ProColumns } from '@ant-design/pro-components'; import { EditableProTable, + ProCard, ProFormDatePicker, + ProFormDateTimePicker, + ProFormField, ProFormRadio, + ProFormTimePicker, ProFormUploadButton, } from '@ant-design/pro-components'; import React, { useEffect, useState } from 'react'; import './payWayDetail.less' -import { postOrderErpOrderStagesPayWaySelect } from '@/services'; +import { getOrderErpOrderStagesPayWaySelectOssId, postOrderErpOrderStagesPayWaySelect } from '@/services'; import { message } from 'antd'; const waitTime = (time: number = 100) => { @@ -82,19 +86,18 @@ export default ({ payBody, thisId, currtSave }) => { const [isCurrtSave, setIsCurrtSave] = useState(false); async function getOther(value, arr) { - console.log(value); const res = await postOrderErpOrderStagesPayWaySelect({ data: { ossId: value } }); if (res.data) { - const context = res.data; + const context = res.data; const remake = arr.map(obj => { let currt = obj; context.forEach(object => { if (object.number == obj.id) { currt = { ...obj, - ossId: object.ossId, + ossId: value, payDate: object.dateRange, fileName: object.fileName, fileUrl: object.fileUrl @@ -102,10 +105,10 @@ export default ({ payBody, thisId, currtSave }) => { return currt; } }); - console.log(currt); + // console.log(currt); return currt; }); - console.log(context); + // console.log(context); setPayWayDetailBody(remake); } } @@ -114,10 +117,10 @@ export default ({ payBody, thisId, currtSave }) => { const remakeData = payWayDetailBody.map(obj => { return { ...obj, proportion: value[obj.id - 1]?.proportion, payPrice: value[obj.id - 1]?.payPrice } }) - console.log(remakeData); + // console.log(remakeData); setPayWayDetailBody(remakeData) - console.log(thisId); + // console.log(thisId); if (thisId!=null) { getOther(thisId, remakeData) @@ -132,7 +135,7 @@ export default ({ payBody, thisId, currtSave }) => { }, [payBody]) function setCurrtSave(value) { - console.log(value); + // console.log(value); setIsCurrtSave(payWayDetailBody) } @@ -180,7 +183,7 @@ export default ({ payBody, thisId, currtSave }) => { } return item; }); - console.log(updatedDataSource); + // console.log(updatedDataSource); setPayWayDetailBody(updatedDataSource); currtSave(updatedDataSource) @@ -215,8 +218,8 @@ export default ({ payBody, thisId, currtSave }) => { <ProFormUploadButton name={record.id} onChange={(value) => { - console.log(value); - console.log(payWayDetailBody); + // console.log(value); + // console.log(payWayDetailBody); let remakeBody = []; let remakeBodyItem = {}; payWayDetailBody.forEach(item => { @@ -224,9 +227,10 @@ export default ({ payBody, thisId, currtSave }) => { remakeBodyItem = { ...item, fileUrl: value.file.originFileObj, fileName: value.file.name } } else { remakeBodyItem = { ...item } - } if (value.fileList.length == 0) { - remakeBodyItem = { ...item, fileUrl: undefined, fileName: undefined } - } + } + // if (value.fileList.length == 0) { + // remakeBodyItem = { ...item, fileUrl: undefined, fileName: undefined } + // } remakeBody.push(remakeBodyItem) }) setPayWayDetailBody(remakeBody) @@ -254,7 +258,7 @@ export default ({ payBody, thisId, currtSave }) => { }} > - {(record.fileName !== undefined || record.fileName !== '') ? '重新上传' : '上传回执'} + {(record.fileName !== undefined && record.fileName !== "" && record.fileName !== null) ? '重新上传' : '上传回执'} </a> ], }, @@ -264,7 +268,7 @@ export default ({ payBody, thisId, currtSave }) => { <> <EditableProTable<DataSourceType> rowKey="id" - className='payWayDetail-index' + className='payway-detail-index' toolbar={{ style: { display: 'none' } }} ghost={true} scroll={{ @@ -299,7 +303,7 @@ export default ({ payBody, thisId, currtSave }) => { type: 'multiple', editableKeys, onSave: async (rowKey, data, row) => { - console.log(rowKey, data, row); + // console.log(rowKey, data, row); await waitTime(2000); }, onChange: setEditableRowKeys, diff --git a/src/pages/Instalment/components/productDetail/productDetail.tsx b/src/pages/Instalment/components/productDetail/productDetail.tsx index ec453ff..dc539a6 100644 --- a/src/pages/Instalment/components/productDetail/productDetail.tsx +++ b/src/pages/Instalment/components/productDetail/productDetail.tsx @@ -8,6 +8,7 @@ import { import React, { useEffect, useState } from 'react'; import './productDetail.less' import { countBy } from 'lodash'; +import { Form } from 'antd'; const waitTime = (time: number = 100) => { return new Promise((resolve) => { @@ -40,34 +41,35 @@ const defaultData: DataSourceType[] = [ export default ({ productBody, EditProductBody }) => { const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]); const [dataSource, setDataSource] = useState<readonly DataSourceType[]>([]); + const [form] = Form.useForm<{ name: string; company: string }>(); const [position, setPosition] = useState<'top' | 'bottom' | 'hidden'>( 'bottom', ); function getDataSourece() { - if (productBody.length!=0) { + if (productBody.length != 0) { setDataSource(productBody) } } function setEditProductBody(value) { - console.log(value); - console.log(dataSource); - + // console.log(value); + // console.log(dataSource); + const modifiedArray = value.map(obj => { if (obj.dId && Number(obj.dId) <= 1000) { return { ...obj, - count:obj.count, + count: obj.count, dId: null, - deviceModel:obj.deviceModel, - deviceName:obj.deviceName, - price:obj.price, - unitPrice:obj.unitPrice + deviceModel: obj.deviceModel, + deviceName: obj.deviceName, + price: Number(obj.unitPrice)*Number(obj.count), + unitPrice: obj.unitPrice }; } else { - return obj; + return {...obj,price: Number(obj.unitPrice)*Number(obj.count)}; } }); - console.log(modifiedArray); + // console.log(modifiedArray); EditProductBody(modifiedArray) setDataSource(value) @@ -84,7 +86,7 @@ export default ({ productBody, EditProductBody }) => { deviceModel: string, deviceName: string, price: number - unitPrice: number, + unitPrice: number } @@ -92,7 +94,7 @@ export default ({ productBody, EditProductBody }) => { { title: '设备编号', dataIndex: 'dId', - hideInTable: true + hideInTable: true, }, { title: '设备名称', @@ -138,12 +140,14 @@ export default ({ productBody, EditProductBody }) => { { title: '总价', dataIndex: 'price', - formItemProps: (form, { rowIndex }) => { - return { - rules: - [{ required: true, message: '此项为必填项' }] - }; - } + hideInSetting:true, + disable:true, + editable:false, + render: (text, record, _, action) => [ + <span> + {record.count*record.unitPrice} + </span> + ], }, { title: '操作', @@ -154,6 +158,9 @@ export default ({ productBody, EditProductBody }) => { key="editable" onClick={() => { if (record.dId) { + // EditProductBody(dataSource.filter((item) => item.dId !== record.dId)); + // console.log(record); + action?.startEditable?.(record.dId); } }} @@ -163,6 +170,7 @@ export default ({ productBody, EditProductBody }) => { <a key="delete" onClick={() => { + EditProductBody(dataSource.filter((item) => item.dId !== record.dId)); setDataSource(dataSource.filter((item) => item.dId !== record.dId)); }} > @@ -208,7 +216,8 @@ export default ({ productBody, EditProductBody }) => { type: 'multiple', editableKeys, onSave: async (rowKey, data, row) => { - await waitTime(2000); + // console.log(data); + await waitTime(500); }, onChange: setEditableRowKeys, }} diff --git a/src/pages/Instalment/components/read/read.tsx b/src/pages/Instalment/components/read/read.tsx new file mode 100644 index 0000000..a68865e --- /dev/null +++ b/src/pages/Instalment/components/read/read.tsx @@ -0,0 +1,362 @@ +import { PlusOutlined } from '@ant-design/icons'; +import { + ModalForm, + ProCard, + ProForm, + ProFormDatePicker, + ProFormDateRangePicker, + ProFormDependency, + ProFormSelect, + ProFormText, + ProFormTextArea, + ProFormUploadButton, +} from '@ant-design/pro-components'; +import ProductDetail from './readProduct'; +import PayWayDetail from './readPayWay' +import { Button, Form, UploadProps, message } from 'antd'; +import Item from 'antd/es/list/Item'; +import { useEffect, useRef, useState } from 'react'; +import { postOrderErpOrderStagesPayWaySaveOrUpdate, postOrderErpOrderStagesPayWayUploadForPayWay, postOrderErpOrderStagesSaveOrUpdate, postOrderErpOrderStagesSearch, postOrderErpOrderStagesUpload, postServiceOrderFileProcess } from '@/services'; +import { context } from '@/.umi/core/helmetContext'; +import { RcFile } from 'antd/es/upload'; + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; + +export default ({ currentContract }) => { + const [form] = Form.useForm<{ name: string; company: string }>(); + const [contextBody, setContextBody] = useState({}); + const [editProductBody, setEditProductBody] = useState([]); + const [total, setTotal] = useState(0); + const [payWayBody, setPayWayBody] = useState([]) + const [otherBody, setOtherBody] = useState([]) + const [isOnlyRead, setisOnlyRead] = useState() + + type OrderStagesWithListItem = { + //文件编号 + id: number; + //合同编号 + contract: string; + //供应商名称 + vendor: string; + //签合同日期 + dateRange: Date; + //终端名称 + terminal: string; + orderStagesDeviceVoList: orderStagesDevice[] + //合同总金额 + totalPrice: number; + //付款方式 + payWay: string; + //附件 + annex: string; + //备注 + remark: string; + }; + + type orderStagesDevice = { + //设备id + dId: number; + //设备名称 + deviceName: string; + //设备型号 + deviceModel: string; + //数量 + count: number; + //单价 + unitPrice: number; + //总价 + price: number; + } + + async function getBody() { + const res = await postOrderErpOrderStagesSearch({ + data: { contract: currentContract }, + }); + const context = res.data[0]; + // console.log(context); + + if (context.contract != null) { + setContextBody(context); + setTotal(context.totalPrice) + form.setFieldValue('totalPrice', context.totalPrice); + } + handleInputChange(context.payWay, 0, context.totalPrice) + } + + async function refresh() { + const res = await postOrderErpOrderStagesSearch({ + data: { contract: currentContract }, + }); + const context = res.data[0]; + // console.log(context); + + if (context.contract != null) { + setContextBody(context); + setTotal(context.totalPrice) + form.setFieldValue('totalPrice', context.totalPrice); + } + } + + function getEditProductBody(value) { + // console.log(value); + + setEditProductBody(value) + let price = 0; + value.map(obj => ( + price += (obj.count * obj.unitPrice) + )); + setTotal(price); + setContextBody({ ...contextBody, orderStagesDeviceVoList: value }) + handleInputChange(contextBody.payWay, 0, price) + } + [] + function setSave(value) { + // console.log(value); + setOtherBody(value) + } + + useEffect(() => { + setContextBody({ ...contextBody, totalPrice: total }) + form.setFieldValue('totalPrice', total); + }, [total]) + + useEffect(() => { + getBody() + }, []) + + const handleInputChange = (value: string, no: number, priceNow?: number) => { + let totalPay = 0; + const payValue: string[] = value.split("/") + let body: ((prevState: never[]) => never[]) | { proportion: string; payPrice: number; }[] = []; + if (no === 1) { + if (payValue.length !== 4) { + message.warning('比例个数总和不为4个!'); + } else { + payValue.forEach((item, index) => { + totalPay += Number(item) + }) + } + if (totalPay != 100) { + message.warning('比例总和不为100!'); + } else { + message.success('输入有效!'); + const price = total + payValue.forEach((item, index) => { + body.push({ proportion: item + "%", payPrice: Number(item) * price / 100 }) + }) + setPayWayBody(body) + } + } else { + payValue.forEach((item, index) => { + totalPay += Number(item) + }) + payValue.forEach((item, index) => { + body.push({ proportion: item + "%", payPrice: Number(item) * priceNow / 100 }) + }) + setPayWayBody(body) + } + }; + + return ( + <ModalForm<OrderStagesWithListItem> + title="新建" + trigger={ + <a onClick={refresh}>查看</a> + } + form={form} + autoFocusFirstInput + modalProps={{ + destroyOnClose: true, + // onCancel: () => console.log('run'), + }} + submitTimeout={2000} + onFinish={async (values) => { + // console.log(values); + // console.log(otherBody); + let remakeValue = []; + let remakeItem = {} + // 创建一个用于存储所有异步操作的Promise数组 + const promises = []; + + otherBody.forEach(item => { + let remakeItem = { ossId: item.ossId, number: item.id, dataRange: item.payDate, fileName: item.fileName }; + if (typeof item.fileUrl === 'object' && item.fileUrl instanceof File) { + const formData = new FormData(); + formData.append('file', item.fileUrl as RcFile); + const uploadPromise = async () => { + const res = await postOrderErpOrderStagesUpload({ + data: formData, + headers: { + 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', + } + }); + if (res.data) { + remakeItem.fileUrl = res.data; + } + }; + promises.push(uploadPromise()); + } + remakeValue.push(remakeItem); + }); + + // 使用Promise.all等待所有异步操作完成后再执行保存操作 + Promise.all(promises).then(async () => { + const resp = await postOrderErpOrderStagesPayWaySaveOrUpdate({ + data: remakeValue + }); + }); + const formData = new FormData(); + // let toSendEdit={...values,orderStagesDeviceVoList:contextBody.orderStagesDeviceVoList}; + let toSendEdit = { + id: values.id || contextBody.id, + contract: values.contract || contextBody.contract, + vendor: values.vendor || contextBody.vendor, + dateRange: values.dateRange || contextBody.dateRange, + terminal: values.terminal || contextBody.terminal, + orderStagesDeviceDoList: values.orderStagesDeviceVoList || contextBody.orderStagesDeviceVoList, + totalPrice: values.totalPrice || contextBody.totalPrice, + payWay: values.payWay || contextBody.payWay, + annex: contextBody.annex, + remark: values.remark || contextBody.remark, + }; + if (values.annex) { + formData.append('file', values.annex[0].originFileObj as RcFile); + const res = await postOrderErpOrderStagesUpload({ + data: formData, + headers: { + 'Content-Type': + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', + } + }); + if (res.data) { + // console.log(values) + // console.log(contextBody); + toSendEdit.annex = res.data + } + } + const isSaveOrUpdate = await postOrderErpOrderStagesSaveOrUpdate({ + data: { ...toSendEdit } + }) + if (isSaveOrUpdate) { + // console.log(isSaveOrUpdate); + getBody() + } + await waitTime(2000); + message.success('提交成功'); + return true; + }} + > + <ProCard + title="基本信息" + headerBordered + bordered + > + <ProForm.Group> + <ProFormText + width="md" + name="vendor" + label="供应商名称" + placeholder="请输入" + initialValue={contextBody.vendor} + readonly + /> + + <ProFormText + width="md" + name="terminal" + label="终端名称" + placeholder="请输入" + initialValue={contextBody.terminal} + readonly + /> + + <ProFormDatePicker + name="dateRange" + width="md" + label="签合同日期" + placeholder="请选择日期" + fieldProps={{ + format: (value) => value.format('YYYY-MM-DD'), + }} + initialValue={contextBody.dateRange} + readonly + /> + + <ProFormText + width="md" + name="payWay" + label="付款比例" + placeholder="请输入" + initialValue={contextBody.payWay} + readonly + onBlur={(e) => { + handleInputChange(e.target.value, 1); + }} + /> + + <ProFormText + width="md" + name="contract" + label="合同编号" + placeholder="请输入" + initialValue={contextBody.contract} + readonly + /> + + {/* <ProFormText + width="md" + name="annex" + label="合同附件" + placeholder="请输入" + initialValue={contextBody.fileUrl} + readonly + /> */} + + + <ProFormText + width="md" + name="totalPrice" + label="合同金额" + placeholder="请输入" + disabled + readonly + // rules={[{ required: true, message: '此项为必填项' }]} + // value={contextBody.totalPrice} + initialValue={contextBody.totalPrice} + /> + </ProForm.Group> + </ProCard> + <ProCard + title="产品明细" + style={{ marginTop: 10 }} + headerBordered + bordered + > + <ProductDetail productBody={contextBody.orderStagesDeviceVoList} EditProductBody={getEditProductBody}></ProductDetail> + </ProCard> + + <ProCard + title="付款信息" + style={{ marginTop: 10 }} + headerBordered + bordered + > + <PayWayDetail payBody={payWayBody} thisId={contextBody.id} currtSave={setSave}></PayWayDetail> + </ProCard> + + <ProCard + style={{ marginTop: 10 }} + headerBordered + bordered + > + <ProFormTextArea label="备注" name="remark" initialValue={contextBody.remark} readonly /> + </ProCard> + </ModalForm> + ); +}; \ No newline at end of file diff --git a/src/pages/Instalment/components/read/readPayWay.tsx b/src/pages/Instalment/components/read/readPayWay.tsx new file mode 100644 index 0000000..e60accf --- /dev/null +++ b/src/pages/Instalment/components/read/readPayWay.tsx @@ -0,0 +1,293 @@ +import type { ProColumns } from '@ant-design/pro-components'; +import { + EditableProTable, + ProCard, + ProFormDatePicker, + ProFormDateTimePicker, + ProFormField, + ProFormRadio, + ProFormTimePicker, + ProFormUploadButton, +} from '@ant-design/pro-components'; +import React, { useEffect, useState } from 'react'; +import { postOrderErpOrderStagesPayWaySelect } from '@/services'; +import { message } from 'antd'; + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; + +type DataSourceType = { + id: number; + payStep?: string; + proportion?: string; + ossId?: number, + payPrice?: number; + payDate?: Date; + fileName?: string; + fileUrl?: string; +}; + +export default ({ payBody, thisId, currtSave }) => { + const defaultData: DataSourceType[] = [ + { + id: 1, + payStep: '预付款', + proportion: undefined, + payPrice: undefined, + ossId: undefined, + payDate: undefined, + fileName: undefined, + fileUrl: undefined + }, + { + id: 2, + payStep: '发贷款', + proportion: undefined, + payPrice: undefined, + ossId: undefined, + payDate: undefined, + fileName: undefined, + fileUrl: undefined + }, + { + id: 3, + payStep: '验收款', + proportion: undefined, + payPrice: undefined, + ossId: undefined, + payDate: undefined, + fileName: undefined, + fileUrl: undefined + }, + { + id: 4, + payStep: '质保金', + proportion: undefined, + payPrice: undefined, + ossId: undefined, + payDate: undefined, + fileName: undefined, + fileUrl: undefined + } + ]; + + const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]); + const [dataSource, setDataSource] = useState<readonly DataSourceType[]>([]); + const [position, setPosition] = useState<'top' | 'bottom' | 'hidden'>('hidden'); + const [payWayDetailBody, setPayWayDetailBody] = useState<readonly DataSourceType[]>([...defaultData]) + const [body, setBody] = useState([]) + const [isAccept, setIsAccept] = useState(null) + const [isCurrtSave, setIsCurrtSave] = useState(false); + + async function getOther(value, arr) { + const res = await postOrderErpOrderStagesPayWaySelect({ + data: { ossId: value } + }); + if (res.data) { + const context = res.data; + const remake = arr.map(obj => { + let currt = obj; + context.forEach(object => { + if (object.number == obj.id) { + currt = { + ...obj, + ossId: value, + payDate: object.dateRange, + fileName: object.fileName, + fileUrl: object.fileUrl + }; + return currt; + } + }); + // console.log(currt); + return currt; + }); + // console.log(context); + setPayWayDetailBody(remake); + } + } + + function setPayWay(value) { + const remakeData = payWayDetailBody.map(obj => { + return { ...obj, proportion: value[obj.id - 1]?.proportion, payPrice: value[obj.id - 1]?.payPrice } + }) + // console.log(remakeData); + + setPayWayDetailBody(remakeData) + // console.log(thisId); + + if (thisId!=null) { + getOther(thisId, remakeData) + } + } + // useEffect(() => { + // getOther(thisId) + // }, [thisId]) + + useEffect(() => { + setPayWay(payBody) + }, [payBody]) + + function setCurrtSave(value) { + // console.log(value); + setIsCurrtSave(payWayDetailBody) + } + + + const columns: ProColumns<DataSourceType>[] = [ + { + title: '编号', + dataIndex: 'id', + hideInTable: true, + editable: false + }, + { + title: '付款信息', + dataIndex: 'payStep', + editable: false + }, + { + title: '付款比例', + dataIndex: 'proportion', + editable: false + }, + { + title: '付款金额', + dataIndex: 'payPrice', + editable: false + }, + { + title: '对应的订单', + dataIndex: 'ossId', + editable: false, + hideInTable: true, + }, + { + title: '付款时间', + dataIndex: 'payDate', + editable: false, + render: (text, record, _, action) => { + const handleChange = (value) => { + const updatedDataSource = payWayDetailBody.map(item => { + if (item.id === record.id) { + return { + ...item, + payDate: value + }; + } + return item; + }); + // console.log(updatedDataSource); + + setPayWayDetailBody(updatedDataSource); + currtSave(updatedDataSource) + }; + + return ( + <span>{new Intl.DateTimeFormat('zh-CN', { year: 'numeric', month: 'long', day: 'numeric' }).format(record.payDate)}</span> + // <ProFormDatePicker + // className='dataChoose' + // initialValue={record.payDate} + // value={record.payDate} + // placeholder={"请填写时间"} + // fieldProps={{ + // format: (value) => value.format('YYYY-MM-DD'), + // onChange: handleChange, + // }} + // /> + ); + } + }, + { + title: '付款单回执', + dataIndex: 'fileName', + render: (text, record, _, action) => { + if (isAccept !== record.id) { + if (typeof record.fileUrl === 'object' && record.fileUrl instanceof File) { + return (<a onClick={() => message.error("请先保存")}>{record.fileName}</a>) + } else { + return (<a href={record.fileUrl}>{record.fileName}</a>) + } + } else { + return ( + <ProFormUploadButton + name={record.id} + onChange={(value) => { + // console.log(value); + // console.log(payWayDetailBody); + let remakeBody = []; + let remakeBodyItem = {}; + payWayDetailBody.forEach(item => { + if (item.id === record.id) { + remakeBodyItem = { ...item, fileUrl: value.file.originFileObj, fileName: value.file.name } + } else { + remakeBodyItem = { ...item } + } if (value.fileList.length == 0) { + remakeBodyItem = { ...item, fileUrl: undefined, fileName: undefined } + } + remakeBody.push(remakeBodyItem) + }) + setPayWayDetailBody(remakeBody) + currtSave(remakeBody) + }} + width="md" + max={1} /> + ) + } + }, + } + ]; + + return ( + <> + <EditableProTable<DataSourceType> + rowKey="id" + className='payway-detail-index' + toolbar={{ style: { display: 'none' } }} + ghost={true} + scroll={{ + x: 960, + }} + recordCreatorProps={ + position !== 'hidden' + ? { + position: position as 'top', + record: () => ({ id: (Math.random() * 1000000).toFixed(0) }), + } + : false + } + loading={false} + toolBarRender={() => [ + <ProFormRadio.Group + key="render" + fieldProps={{ + value: position, + onChange: (e) => setPosition(e.target.value), + }} + />, + ]} + columns={columns} + request={payWayDetailBody} + value={payWayDetailBody} + onChange={() => { + setPayWayDetailBody; + setCurrtSave(payWayDetailBody) + }} + editable={{ + type: 'multiple', + editableKeys, + onSave: async (rowKey, data, row) => { + // console.log(rowKey, data, row); + await waitTime(2000); + }, + onChange: setEditableRowKeys, + }} + /> + </> + ); +}; \ No newline at end of file diff --git a/src/pages/Instalment/components/read/readProduct.tsx b/src/pages/Instalment/components/read/readProduct.tsx new file mode 100644 index 0000000..433a2f6 --- /dev/null +++ b/src/pages/Instalment/components/read/readProduct.tsx @@ -0,0 +1,202 @@ +import type { ProColumns } from '@ant-design/pro-components'; +import { + EditableProTable, + ProCard, + ProFormField, + ProFormRadio, +} from '@ant-design/pro-components'; +import React, { useEffect, useState } from 'react'; +import { countBy } from 'lodash'; +import { Form } from 'antd'; + +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; + +type DataSourceType = { + count?: number; + id: React.Key; + deviceModel?: string; + deviceName?: string; + price?: number; + unitPrice?: number; +}; + +const defaultData: DataSourceType[] = [ + // { + // id:1, + // deviceName: '高低温试验箱', + // deviceModel: 'CAN-TES36-0049ST', + // count: 1, + // unitPrice: 24500, + // price: 24500, + // } +]; + +export default ({ productBody, EditProductBody }) => { + const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]); + const [dataSource, setDataSource] = useState<readonly DataSourceType[]>([]); + const [form] = Form.useForm<{ name: string; company: string }>(); + const [position, setPosition] = useState<'top' | 'bottom' | 'hidden'>( + 'hidden', + ); + function getDataSourece() { + if (productBody.length != 0) { + setDataSource(productBody) + } + } + function setEditProductBody(value) { + // console.log(value); + // console.log(dataSource); + + const modifiedArray = value.map(obj => { + if (obj.dId && Number(obj.dId) <= 1000) { + return { + ...obj, + count: obj.count, + dId: null, + deviceModel: obj.deviceModel, + deviceName: obj.deviceName, + price: obj.price, + unitPrice: obj.unitPrice + }; + } else { + return obj; + } + }); + // console.log(modifiedArray); + + EditProductBody(modifiedArray) + setDataSource(value) + } + + useEffect(() => { + getDataSourece() + }, [productBody]) + + type DataSourceType = { + id: React.Key, + count: number, + dId?: number, + deviceModel: string, + deviceName: string, + price: number + unitPrice: number, + // logicDelete:1 + } + + + const columns: ProColumns<DataSourceType>[] = [ + { + title: '设备编号', + dataIndex: 'dId', + hideInTable: true, + }, + { + title: '设备名称', + dataIndex: 'deviceName', + formItemProps: (form, { rowIndex }) => { + return { + rules: + [{ required: true, message: '此项为必填项' }] + }; + } + }, + { + title: '设备型号', + dataIndex: 'deviceModel', + width: '15%', + formItemProps: (form, { rowIndex }) => { + return { + rules: + [{ required: true, message: '此项为必填项' }] + }; + } + }, + { + title: '数量', + dataIndex: 'count', + onChange: (e) => { + // console.log(e); + const unitPrice = form.getFieldValue(`data[${rowIndex}].unitPrice`); + form.setFieldsValue({ + [`data[${rowIndex}].price`]: e * unitPrice + }); + }, + formItemProps: (form, { rowIndex }) => { + return { + rules: + [{ required: true, message: '此项为必填项' }] + }; + } + }, + { + title: '单价', + dataIndex: 'unitPrice', + formItemProps: (form, { rowIndex }) => { + return { + rules: + [{ required: true, message: '此项为必填项' }] + }; + } + }, + { + title: '总价', + dataIndex: 'price', + formItemProps: (form, { rowIndex }) => { + return { + rules: + [{ required: true, message: '此项为必填项' }] + }; + } + } + ]; + + return ( + <> + <EditableProTable<DataSourceType> + className='product-detail-index' + rowKey="dId" + toolbar={{ style: { display: 'none' } }} + ghost={true} + scroll={{ + x: 960, + }} + recordCreatorProps={ + position !== 'hidden' + ? { + position: position as 'top', + record: () => ({ dId: (Math.random() * 1000).toFixed(0) }), + } + : false + } + loading={false} + toolBarRender={() => [ + <ProFormRadio.Group + key="render" + fieldProps={{ + value: position, + onChange: (e) => setPosition(e.target.value), + }} + />, + ]} + columns={columns} + request={dataSource} + value={dataSource} + onChange={setEditProductBody} + editable={{ + type: 'multiple', + editableKeys, + onSave: async (rowKey, data, row) => { + await waitTime(500); + }, + onChange: setEditableRowKeys, + }} + /> + </> + ); +}; \ No newline at end of file diff --git a/src/pages/Instalment/components/title/title.tsx b/src/pages/Instalment/components/title/title.tsx index af94553..a09696f 100644 --- a/src/pages/Instalment/components/title/title.tsx +++ b/src/pages/Instalment/components/title/title.tsx @@ -9,6 +9,9 @@ import { request } from 'umi'; import AddModel from '../detail/detail'; import EditorModel from '../edit/edit'; import UploadModel from '../upload/uploadModel'; +import ReadModel from '../read/read' +import Comfire from '../comfire/comfire'; +import { orderExport } from '@/services/order'; import './title.less' export const waitTimePromise = async (time: number = 100) => { return new Promise((resolve) => { @@ -33,6 +36,8 @@ type OrderStagesItem = { dateRange?: Date; //终端名称 terminal?: string; + //设备编号 + dId?: number; //设备名称 deviceName?: string; //设备型号 @@ -134,10 +139,12 @@ export default () => { } async function toDelete(value) { + // console.log(value); + const res = await deleteOrderErpOrderStagesDelect({ data: { - ids: value, - deviceIds: null + ids: null, + deviceIds: value } }) if (res) { @@ -148,8 +155,19 @@ export default () => { } } + const exportLoadingDestory = () => { + message.success("导出成功"); + }; + async function toExport() { - await getOrderErpOrderStagesExport() + // await getOrderErpOrderStagesExport() + orderExport( + '/api/order/erp/orderStages/export', + '分期订单.xlsx', + 'get', + {}, + exportLoadingDestory, + ); } @@ -157,7 +175,7 @@ export default () => { { title: '文件编号', dataIndex: 'id', - width: '5%', + width: '7%', render: (_, record) => { if (record.id) { const text = record.id.toString(); @@ -173,7 +191,7 @@ export default () => { filters: true, onFilter: true, ellipsis: true, - width: '6%' + width: '8%' }, { disable: true, @@ -302,18 +320,16 @@ export default () => { if (record?.id) { return ( <> - <a href={record.annex} target="_blank" rel="noopener noreferrer" key="view"> - 查看 - </a> + <ReadModel currentContract={record.contract}></ReadModel> <EditorModel currentContract={record.contract} toReload={reload}></EditorModel> - <a key="delect" target="_blank" rel="noopener noreferrer" onClick={() => { toDelete([record.id]) }}> + {/* <a key="delect" target="_blank" rel="noopener noreferrer" onClick={() => { toDelete([record.dId]) }}> 删除 - </a> + </a> */} + <Comfire currtDid={record.dId} sureDelete={ toDelete }></Comfire> </> ) - } return null; }, @@ -328,11 +344,11 @@ export default () => { actionRef={ref} cardBordered request={async (params, sort, filter) => { - console.log(params); + // console.log(params); if (params.id != null || params.contract != null || params.vendor != null || params.terminal != null || params.deviceName != null || params.dateRange != null) { - console.log(params.id); - console.log(params.contract); - console.log(params.vendor); + // console.log(params.id); + // console.log(params.contract); + // console.log(params.vendor); let PostOrderErpOrderStagesSearchOption = { id: params.id, contract: params.contract, @@ -357,6 +373,7 @@ export default () => { vendor: undefined, dateRange: undefined, terminal: undefined, + dId: undefined, deviceName: undefined, deviceModel: undefined, count: undefined, @@ -374,6 +391,7 @@ export default () => { item.vendor = orderStagesWithList[ind].vendor; item.dateRange = orderStagesWithList[ind].dateRange; item.terminal = orderStagesWithList[ind].terminal; + item.dId = orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; item.deviceName = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceName; item.deviceModel = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceModel; item.count = orderStagesWithList[ind].orderStagesDeviceVoList[index].count; @@ -385,11 +403,21 @@ export default () => { item.remark = orderStagesWithList[ind].remark; orderStagesList.push(item); } else { + item.id = orderStagesWithList[ind].id; + item.contract = orderStagesWithList[ind].contract; + item.vendor = orderStagesWithList[ind].vendor; + item.dateRange = orderStagesWithList[ind].dateRange; + item.terminal = orderStagesWithList[ind].terminal; + item.dId = orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; item.deviceName = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceName; item.deviceModel = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceModel; item.count = orderStagesWithList[ind].orderStagesDeviceVoList[index].count; item.unitPrice = orderStagesWithList[ind].orderStagesDeviceVoList[index].unitPrice; item.price = orderStagesWithList[ind].orderStagesDeviceVoList[index].price; + item.totalPrice = orderStagesWithList[ind].totalPrice; + item.payWay = orderStagesWithList[ind].payWay; + item.annex = orderStagesWithList[ind].annex; + item.remark = orderStagesWithList[ind].remark; orderStagesList.push(item); } } @@ -413,6 +441,7 @@ export default () => { vendor: undefined, dateRange: undefined, terminal: undefined, + dId: undefined, deviceName: undefined, deviceModel: undefined, count: undefined, @@ -430,6 +459,7 @@ export default () => { item.vendor = orderStagesWithList[ind].vendor; item.dateRange = orderStagesWithList[ind].dateRange; item.terminal = orderStagesWithList[ind].terminal; + item.dId = orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; item.deviceName = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceName; item.deviceModel = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceModel; item.count = orderStagesWithList[ind].orderStagesDeviceVoList[index].count; @@ -441,11 +471,21 @@ export default () => { item.remark = orderStagesWithList[ind].remark; orderStagesList.push(item); } else { + item.id = orderStagesWithList[ind].id; + item.contract = orderStagesWithList[ind].contract; + item.vendor = orderStagesWithList[ind].vendor; + item.dateRange = orderStagesWithList[ind].dateRange; + item.terminal = orderStagesWithList[ind].terminal; + item.dId = orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; item.deviceName = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceName; item.deviceModel = orderStagesWithList[ind].orderStagesDeviceVoList[index].deviceModel; item.count = orderStagesWithList[ind].orderStagesDeviceVoList[index].count; item.unitPrice = orderStagesWithList[ind].orderStagesDeviceVoList[index].unitPrice; item.price = orderStagesWithList[ind].orderStagesDeviceVoList[index].price; + item.totalPrice = orderStagesWithList[ind].totalPrice; + item.payWay = orderStagesWithList[ind].payWay; + item.annex = orderStagesWithList[ind].annex; + item.remark = orderStagesWithList[ind].remark; orderStagesList.push(item); } } @@ -465,11 +505,11 @@ export default () => { defaultValue: { option: { fixed: 'right', disable: true }, }, - onChange(value) { - console.log('value: ', value); - }, + // onChange(value) { + // console.log('value: ', value); + // }, }} - rowKey="id" + rowKey="dId" search={{ labelWidth: 'auto', }} @@ -479,7 +519,6 @@ export default () => { }, }} form={{ - // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下 syncToUrl: (values, type) => { if (type === 'get') { return { @@ -492,7 +531,7 @@ export default () => { }} pagination={{ pageSize: 10, - onChange: (page) => console.log(page), + // onChange: (page) => console.log(page), }} dateFormatter="string" headerTitle={[ @@ -502,10 +541,10 @@ export default () => { <> <AddModel toReload={reload}></AddModel> <UploadModel toReload={reload}></UploadModel> - {/* <Button type="primary" onClick={()=>{toExport()}}> + <Button type="primary" onClick={() => { toExport() }}> <VerticalAlignTopOutlined /> 导出 - </Button> */} + </Button> </> ]} /> diff --git a/src/pages/Instalment/components/upload/uploadApp.tsx b/src/pages/Instalment/components/upload/uploadApp.tsx index 7c72580..3941e1c 100644 --- a/src/pages/Instalment/components/upload/uploadApp.tsx +++ b/src/pages/Instalment/components/upload/uploadApp.tsx @@ -10,12 +10,12 @@ const App: React.FC = ({ uploadFile }) => { multiple: true, maxCount: 1, onChange:(info)=> { - console.log(info.file.originFileObj); + // console.log(info.file.originFileObj); uploadFile(info.file.originFileObj) }, - onDrop(e) { - console.log('Dropped files', e.dataTransfer.files); - }, + // onDrop(e) { + // console.log('Dropped files', e.dataTransfer.files); + // }, }; return ( diff --git a/src/pages/Instalment/components/upload/uploadModel.tsx b/src/pages/Instalment/components/upload/uploadModel.tsx index 8a8c4ee..bf7a36e 100644 --- a/src/pages/Instalment/components/upload/uploadModel.tsx +++ b/src/pages/Instalment/components/upload/uploadModel.tsx @@ -24,7 +24,7 @@ export default ({toReload}) => { const [form] = Form.useForm<{ name: string; company: string }>(); const [uploadFile, setUploadFile] = useState({}) function setUploadFileWay(value) { - console.log(value); + // console.log(value); setUploadFile(value) } return ( @@ -43,7 +43,7 @@ export default ({toReload}) => { autoFocusFirstInput modalProps={{ destroyOnClose: true, - onCancel: () => console.log('run'), + // onCancel: () => console.log('run'), }} submitTimeout={2000} onFinish={async (values) => { diff --git a/src/pages/Order/components/ImportModal.tsx b/src/pages/Order/components/ImportModal.tsx index 1ac235e..7081518 100644 --- a/src/pages/Order/components/ImportModal.tsx +++ b/src/pages/Order/components/ImportModal.tsx @@ -26,7 +26,7 @@ export default ({ onClose }) => { }; const downloadTemplate = async () => { exportLoading('正在下载模板...'); - orderExport('/api/service/order/exportTemplate', {}, exportLoadingDestory); + orderExport('/api/service/order/exportTemplate','订单.xlsx','post',{}, exportLoadingDestory); }; const handleUpload = async () => { @@ -59,6 +59,8 @@ export default ({ onClose }) => { exportLoading('正在下载错误信息...'); orderExport( '/api/service/order/errorExcelInformation', + '订单.xlsx', + 'post', formData, exportLoadingDestory, ); diff --git a/src/pages/OrderPrint/index.css b/src/pages/OrderPrint/index.css new file mode 100644 index 0000000..fe863ae --- /dev/null +++ b/src/pages/OrderPrint/index.css @@ -0,0 +1,670 @@ +.font0 { + color: windowtext; + font-size: 12pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font1 { + color: windowtext; + font-size: 16pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font2 { + color: windowtext; + font-size: 10pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font3 { + color: windowtext; + font-size: 14pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font4 { + color: windowtext; + font-size: 8pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font5 { + color: #00f; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: underline; + font-family: '宋体'; +} +.font6 { + color: #800080; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: underline; + font-family: '宋体'; +} +.font7 { + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font8 { + color: #f00; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font9 { + color: #44546a; + font-size: 18pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font10 { + color: #7f7f7f; + font-size: 11pt; + font-weight: 400; + font-style: italic; + text-decoration: none; + font-family: '宋体'; +} +.font11 { + color: #44546a; + font-size: 15pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font12 { + color: #44546a; + font-size: 13pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font13 { + color: #44546a; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font14 { + color: #3f3f76; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font15 { + color: #3f3f3f; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font16 { + color: #fa7d00; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font17 { + color: #fff; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font18 { + color: #fa7d00; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font19 { + color: #000; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font20 { + color: #006100; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font21 { + color: #9c0006; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font22 { + color: #9c6500; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font23 { + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.font24 { + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style0 { + text-align: general; + vertical-align: middle; + white-space: nowrap; + color: windowtext; + font-size: 12pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: none; +} +.style21 { + color: #00f; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: underline; + font-family: '宋体'; +} +.style22 { + color: #800080; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: underline; + font-family: '宋体'; +} +.style23 { + background: #ffc; + border: 0.5pt solid #b2b2b2; +} +.style24 { + color: #f00; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style25 { + color: #44546a; + font-size: 18pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style26 { + color: #7f7f7f; + font-size: 11pt; + font-weight: 400; + font-style: italic; + text-decoration: none; + font-family: '宋体'; +} +.style27 { + color: #44546a; + font-size: 15pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border-bottom: 1pt solid #5b9bd5; +} +.style28 { + color: #44546a; + font-size: 13pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border-bottom: 1pt solid #5b9bd5; +} +.style29 { + color: #44546a; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border-bottom: 1pt solid #acccea; +} +.style30 { + color: #44546a; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style31 { + background: #fc9; + color: #3f3f76; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: 0.5pt solid #7f7f7f; +} +.style32 { + background: #f2f2f2; + color: #3f3f3f; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: 0.5pt solid #3f3f3f; +} +.style33 { + background: #f2f2f2; + color: #fa7d00; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: 0.5pt solid #7f7f7f; +} +.style34 { + background: #a5a5a5; + color: #fff; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: 2pt double #3f3f3f; +} +.style35 { + color: #fa7d00; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border-bottom: 2pt double #ff8001; +} +.style36 { + color: #000; + font-size: 11pt; + font-weight: 700; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border-top: 0.5pt solid #5b9bd5; + border-bottom: 2pt double #5b9bd5; +} +.style37 { + background: #c6efce; + color: #006100; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style38 { + background: #ffc7ce; + color: #9c0006; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style39 { + background: #ffeb9c; + color: #9c6500; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style40 { + background: #5b9bd5; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style41 { + background: #ddebf7; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style42 { + background: #bdd7ee; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style43 { + background: #9bc2e6; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style44 { + background: #ed7d31; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style45 { + background: #fce4d6; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style46 { + background: #f8cbad; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style47 { + background: #f4b084; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style48 { + background: #a5a5a5; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style49 { + background: #ededed; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style50 { + background: #dbdbdb; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style51 { + background: #c9c9c9; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style52 { + background: #ffc000; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style53 { + background: #fff2cc; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style54 { + background: #ffe699; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style55 { + background: #ffd966; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style56 { + background: #4472c4; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style57 { + background: #d9e1f2; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style58 { + background: #b4c6e7; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style59 { + background: #8ea9db; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style60 { + background: #70ad47; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style61 { + background: #e2efda; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style62 { + background: #c6e0b4; + color: #000; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +.style63 { + background: #a9d08e; + color: #fff; + font-size: 11pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; +} +td { + padding-top: 1px; + padding-right: 1px; + padding-left: 1px; + text-align: general; + vertical-align: middle; + white-space: nowrap; + color: windowtext; + font-size: 12pt; + font-weight: 400; + font-style: normal; + text-decoration: none; + font-family: '宋体'; + border: none; +} +.xl65 { + text-align: center; + font-size: 16pt; +} +.xl66 { + text-align: center; + font-size: 10pt; +} +.xl67 { + text-align: center; + font-size: 14pt; +} +.xl68 { + text-align: center; + font-size: 14pt; +} +.xl69 { + text-align: left; + font-size: 8pt; +} +.xl70 { + text-align: left; + font-size: 8pt; +} +.xl71 { + text-align: center; + font-size: 8pt; + border: 0.5pt solid windowtext; +} +.xl72 { + text-align: center; + font-size: 8pt; + border: 0.5pt solid windowtext; + white-space: normal; +} +.xl73 { + white-space: normal; + font-size: 8pt; + border: 0.5pt solid windowtext; +} +.xl74 { + text-align: center; + white-space: normal; + font-size: 8pt; + border: 0.5pt solid windowtext; +} +.xl75 { + text-align: center; + white-space: normal; + font-size: 8pt; + border: 0.5pt solid windowtext; +} +.xl76 { + font-size: 8pt; +} +.xl77 { + font-size: 8pt; +} +.xl78 { + text-align: center; + font-size: 8pt; +} diff --git a/src/services/order.ts b/src/services/order.ts index b06c453..5d85b52 100644 --- a/src/services/order.ts +++ b/src/services/order.ts @@ -2,12 +2,14 @@ import axios from 'axios'; export const orderExport = async ( url: any = '', + fileName:any='', + method:any='', data: any = {}, exportLoadingDestory: any, ) => { axios({ url: url, - method: 'post', + method: method, responseType: 'blob', headers: { Authorization: localStorage.getItem('token') }, data, @@ -18,7 +20,7 @@ export const orderExport = async ( const downloadUrl = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = downloadUrl; - a.download = '订单.xlsx'; // 你可以为文件命名 + a.download = fileName; // 你可以为文件命名 document.body.appendChild(a); a.click(); // 模拟点击操作来下载文件 URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存 diff --git a/src/services/request.ts b/src/services/request.ts index a2508a7..1edb629 100644 --- a/src/services/request.ts +++ b/src/services/request.ts @@ -64,8 +64,8 @@ import type { OrderBaseInfoQueryVO, OrderUpdateVO, OrderUnlockFieldApplyVO, - OrderStagesDelDo, OrderStagesFromDo, + OrderStagesDelDo, OrderStagesSelDo, OrderStagesPayWay, OrderStagesPayWayDo, @@ -6058,6 +6058,77 @@ export const postOrderErpOrderQueryById = /* #__PURE__ */ (() => { return request; })(); +/** @description request parameter type for postOrderErpOrderStagesAdd */ +export interface PostOrderErpOrderStagesAddOption { + /** + * @description + * orderStagesFromDo + */ + body: { + /** + @description + orderStagesFromDo */ + orderStagesFromDo: OrderStagesFromDo; + }; +} + +/** @description response type for postOrderErpOrderStagesAdd */ +export interface PostOrderErpOrderStagesAddResponse { + /** + * @description + * OK + */ + 200: ServerResult; + /** + * @description + * Created + */ + 201: any; + /** + * @description + * Unauthorized + */ + 401: any; + /** + * @description + * Forbidden + */ + 403: any; + /** + * @description + * Not Found + */ + 404: any; +} + +export type PostOrderErpOrderStagesAddResponseSuccess = + PostOrderErpOrderStagesAddResponse[200]; +/** + * @description + * 添加或者修改分期账单 + * @tags order-stages-controller + * @produces * + * @consumes application/json + */ +export const postOrderErpOrderStagesAdd = /* #__PURE__ */ (() => { + const method = "post"; + const url = "/order/erp/orderStages/add"; + function request( + option: PostOrderErpOrderStagesAddOption + ): Promise<PostOrderErpOrderStagesAddResponseSuccess> { + return requester(request.url, { + method: request.method, + ...option, + }) as unknown as Promise<PostOrderErpOrderStagesAddResponseSuccess>; + } + + /** http method */ + request.method = method; + /** request url */ + request.url = url; + return request; +})(); + /** @description request parameter type for deleteOrderErpOrderStagesDelect */ export interface DeleteOrderErpOrderStagesDelectOption { /**