Commit 29f50b81 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:

parent 1ff03345
...@@ -24,6 +24,7 @@ import Submit from '@/components/NiceForm/components/Submit' ...@@ -24,6 +24,7 @@ import Submit from '@/components/NiceForm/components/Submit'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import ModalTable from '@/components/ModalTable' import ModalTable from '@/components/ModalTable'
import { clearModalParams } from '@/utils' import { clearModalParams } from '@/utils'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
// import styles from './index.less' // import styles from './index.less'
const formActions = createFormActions(); const formActions = createFormActions();
...@@ -82,10 +83,11 @@ const Attribute: React.FC<{}> = () => { ...@@ -82,10 +83,11 @@ const Attribute: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const syncRef = useRef<any>({}) const syncRef = useRef<any>({})
const [syncVisible, setSyncVisible] = useState<boolean>(false) const [syncVisible, setSyncVisible] = useState<boolean>(false)
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据 // const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) // const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [syncLoading, setSyncLoading] = useState<boolean>(false) const [syncLoading, setSyncLoading] = useState<boolean>(false)
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const fetchData = (params?: any) => { const fetchData = (params?: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -201,23 +203,23 @@ const Attribute: React.FC<{}> = () => { ...@@ -201,23 +203,23 @@ const Attribute: React.FC<{}> = () => {
setSyncVisible(true) setSyncVisible(true)
} }
const rowSelection: any = { // const rowSelection: any = {
type: 'checkbox', // type: 'checkbox',
selectedRowKeys: selectedRowKeys, // selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => { // onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows) // setSelectRow(selectedRows)
setSelectedRowKeys(selectedRowKeys) // setSelectedRowKeys(selectedRowKeys)
} // }
}; // };
const handleAsyncOk = () => { const handleAsyncOk = () => {
setSyncLoading(true) setSyncLoading(true)
if(selectedRowKeys.length) { if(rowSelectionCtl.selectedRowKeys.length) {
// @ts-ignore // @ts-ignore
PublicApi.postProductCustomerSyncAttribute({idList: selectedRowKeys}).then(res => { PublicApi.postProductCustomerSyncAttribute({idList: rowSelectionCtl.selectedRowKeys}).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
ref.current.reload() ref.current.reload()
setSelectedRowKeys([]) rowSelectionCtl.setSelectedRowKeys([])
} }
setSyncVisible(false) setSyncVisible(false)
setSyncLoading(false) setSyncLoading(false)
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi'; import { history } from 'umi';
import { MenuTree, StandardTable } from 'god'; import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { useTreeTabs } from '@/hooks/useTreeTabs'; import { useTreeTabs } from '@/hooks/useTreeTabs';
...@@ -21,6 +21,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -21,6 +21,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import Submit from '@/components/NiceForm/components/Submit' import Submit from '@/components/NiceForm/components/Submit'
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { clearModalParams } from '@/utils'; import { clearModalParams } from '@/utils';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
const treeActions = createTreeActions() const treeActions = createTreeActions()
...@@ -91,8 +92,9 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -91,8 +92,9 @@ const PropertyValue: React.FC<{}> = () => {
const [syncVisible, setSyncVisible] = useState(false) const [syncVisible, setSyncVisible] = useState(false)
const [syncLoading, setSyncLoading] = useState<boolean>(false) const [syncLoading, setSyncLoading] = useState<boolean>(false)
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据 // const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) // const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const { const {
treeData, treeData,
...@@ -282,26 +284,26 @@ const PropertyValue: React.FC<{}> = () => { ...@@ -282,26 +284,26 @@ const PropertyValue: React.FC<{}> = () => {
setSyncVisible(true) setSyncVisible(true)
} }
const rowSelection: any = { // const rowSelection: any = {
type: 'checkbox', // type: 'checkbox',
selectedRowKeys: selectedRowKeys, // selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => { // onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows) // setSelectRow(selectedRows)
setSelectedRowKeys(selectedRowKeys) // setSelectedRowKeys(selectedRowKeys)
} // }
}; // };
const handleAsyncOk = () => { const handleAsyncOk = () => {
setSyncLoading(true) setSyncLoading(true)
if(selectedRowKeys.length) { if(rowSelectionCtl.selectedRowKeys.length) {
// @ts-ignore // @ts-ignore
PublicApi.postProductCustomerSyncAttributeValue({idList: selectedRowKeys}).then(res => { PublicApi.postProductCustomerSyncAttributeValue({idList: rowSelectionCtl.selectedRowKeys}).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
if(ref?.current?.reload) { if(ref?.current?.reload) {
ref.current.reload() ref.current.reload()
} }
resetMenu() resetMenu()
setSelectedRowKeys([]) rowSelectionCtl.setSelectedRowKeys([])
} }
setSyncVisible(false) setSyncVisible(false)
setSyncLoading(false) setSyncLoading(false)
......
...@@ -379,7 +379,6 @@ export const materialInfoColumns: any[] = [ ...@@ -379,7 +379,6 @@ export const materialInfoColumns: any[] = [
dataIndex: 'amount', dataIndex: 'amount',
align: 'center', align: 'center',
key: 'amount', key: 'amount',
render: (t) => `¥${t}`
}, },
// 接口调用 // 接口调用
{ {
......
...@@ -155,6 +155,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -155,6 +155,8 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const address = deliveryAddress[0] const address = deliveryAddress[0]
return { return {
...item, ...item,
spec: item.type,
quotedSpec: item.relevanceProductType,
deliveryType: item.logistics, deliveryType: item.logistics,
addressId: address.id, addressId: address.id,
address: address.fullAddress, address: address.fullAddress,
......
...@@ -37,24 +37,23 @@ const fetchOrderMode = async () => { ...@@ -37,24 +37,23 @@ const fetchOrderMode = async () => {
} }
const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => { const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
const { run: deleteRun } = useHttpRequest(PublicApi.postOrderProcurementOrderDeleteAll) const { run: deleteRun } = useHttpRequest(PublicApi.postOrderBuyerCreateDeleteBatch)
const { loading: submitLoading, run: submitRun } = useHttpRequest(PublicApi.postOrderProcurementOrderSubmitExamineAll) const { loading: submitLoading, run: submitRun } = useHttpRequest(PublicApi.postOrderBuyerCreateSubmitBatch)
const currentRef = useRef<any>({}) const currentRef = useRef<any>({})
const { columns, ref, rowSelection, rowSelectionCtl } = useSelfTable() const { columns, ref, rowSelection, rowSelectionCtl } = useSelfTable()
const handleMenuClick = async (e) => { const handleMenuClick = async (e) => {
switch(e.key) { switch(e.key) {
case '1': { case '1': {
// 批量删除 // 批量删除
const canDelete = !rowSelectionCtl.selectRow.some(v => v.interiorState !== PurchaseOrderInsideWorkState.ADD_PURCHASE_ORDER) if (rowSelectionCtl.selectRow.length) {
if (canDelete) { const { code } = await deleteRun(rowSelectionCtl.selectedRowKeys.map(item => ({ orderId: item })))
const { code } = await deleteRun({ids: rowSelectionCtl.selectedRowKeys})
if (code === 1000) { if (code === 1000) {
ref.current.reload() ref.current.reload()
rowSelectionCtl.setSelectRow([]) rowSelectionCtl.setSelectRow([])
rowSelectionCtl.setSelectedRowKeys([]) rowSelectionCtl.setSelectedRowKeys([])
} }
} else { } else {
message.error('只能删除内部状态为未审核过的订单') message.error('请先选择待新增的订单')
} }
break; break;
} }
...@@ -63,7 +62,7 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => { ...@@ -63,7 +62,7 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
const handleBitchPush = async () => { const handleBitchPush = async () => {
if (rowSelectionCtl.selectRow.length) { if (rowSelectionCtl.selectRow.length) {
const { code } = await submitRun({ids: rowSelectionCtl.selectedRowKeys}) const { code } = await submitRun(rowSelectionCtl.selectedRowKeys.map(item => ({ orderId: item })))
if (code === 1000) { if (code === 1000) {
ref.current.reload() ref.current.reload()
rowSelectionCtl.setSelectRow([]) rowSelectionCtl.setSelectRow([])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment