|
@@ -1,5 +1,5 @@
|
|
|
-import React, { useState, useEffect } from 'react'
|
|
|
|
|
-import { Tag, Select, Tooltip, Input, DatePicker } from 'antd'
|
|
|
|
|
|
|
+import React, { useState } from 'react'
|
|
|
|
|
+import { Tag, Select, Tooltip, Input, DatePicker, Button } from 'antd'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { useModel } from 'umi'
|
|
import { useModel } from 'umi'
|
|
@@ -11,6 +11,7 @@ import { useModal } from '@/components/Modal'
|
|
|
import { useTableScroll } from '@/hooks/useAutoTable'
|
|
import { useTableScroll } from '@/hooks/useAutoTable'
|
|
|
import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
|
|
import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
|
|
|
import { refactorSortField } from '@/utils/utils'
|
|
import { refactorSortField } from '@/utils/utils'
|
|
|
|
|
+import ReceiveLock from './components/ReceiveLock'
|
|
|
|
|
|
|
|
// 渲染产品标签
|
|
// 渲染产品标签
|
|
|
export const ProductLabel = ({ data }) => {
|
|
export const ProductLabel = ({ data }) => {
|
|
@@ -62,25 +63,32 @@ const longleStatusNum = {
|
|
|
|
|
|
|
|
const LockStore = () => {
|
|
const LockStore = () => {
|
|
|
const [selectKeys] = useState([])
|
|
const [selectKeys] = useState([])
|
|
|
- const { toggleDrawer, setDrawerProps } = useModal()
|
|
|
|
|
|
|
+ const { toggleDrawer, setDrawerProps, toggleModal, setModalProps } = useModal()
|
|
|
|
|
+ const showReceiveLockModal = () => {
|
|
|
|
|
+ setModalProps({
|
|
|
|
|
+ width: '60vw',
|
|
|
|
|
+ modalRender: () => <ReceiveLock />,
|
|
|
|
|
+ onCancel: () => toggleModal()
|
|
|
|
|
+ })
|
|
|
|
|
+ toggleModal()
|
|
|
|
|
+ }
|
|
|
const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
|
|
const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
params: { dataPermission: 'oneself' },
|
|
params: { dataPermission: 'oneself' },
|
|
|
data: [],
|
|
data: [],
|
|
|
prodList: [], // 产品列表
|
|
prodList: [], // 产品列表
|
|
|
|
|
+ totalOld: 0, // 待接收锁总数
|
|
|
id: ''
|
|
id: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- useEffect(() => {
|
|
|
|
|
- // 获取软件锁产品列表
|
|
|
|
|
- async function fetchSoftProducts() {
|
|
|
|
|
- const { code = -1, data = [] } = await querySoftwareProducts()
|
|
|
|
|
- if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
- setState({ ...state, prodList: data })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 获取软件锁产品列表
|
|
|
|
|
+ async function fetchSoftProducts() {
|
|
|
|
|
+ const { code = -1, data = [] } = await querySoftwareProducts()
|
|
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ setState({ ...state, prodList: data })
|
|
|
}
|
|
}
|
|
|
- fetchSoftProducts()
|
|
|
|
|
- }, [])
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const handleSearch = value => {
|
|
const handleSearch = value => {
|
|
|
setState({ ...state, params: { ...state.params, search: value } })
|
|
setState({ ...state, params: { ...state.params, search: value } })
|
|
|
}
|
|
}
|
|
@@ -225,19 +233,25 @@ const LockStore = () => {
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
const { getScrollRef, redoHeight } = useTableScroll(columns, selectKeys)
|
|
const { getScrollRef, redoHeight } = useTableScroll(columns, selectKeys)
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<ProTable
|
|
<ProTable
|
|
|
rowKey={record => record.id}
|
|
rowKey={record => record.id}
|
|
|
search={false}
|
|
search={false}
|
|
|
headerTitle={
|
|
headerTitle={
|
|
|
- <Select
|
|
|
|
|
- defaultValue="oneself"
|
|
|
|
|
- dropdownMatchSelectWidth={false}
|
|
|
|
|
- onChange={e => {
|
|
|
|
|
- setState({ ...state, params: { ...state.params, dataPermission: e } })
|
|
|
|
|
- }}
|
|
|
|
|
- options={permData?.product || []}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Select
|
|
|
|
|
+ defaultValue="oneself"
|
|
|
|
|
+ dropdownMatchSelectWidth={false}
|
|
|
|
|
+ onChange={e => {
|
|
|
|
|
+ setState({ ...state, params: { ...state.params, dataPermission: e } })
|
|
|
|
|
+ }}
|
|
|
|
|
+ options={permData?.product || []}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Button type="primary" className="ml-4" onClick={() => showReceiveLockModal()}>
|
|
|
|
|
+ 待接收锁 ({state.totalOld})
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </>
|
|
|
}
|
|
}
|
|
|
bordered
|
|
bordered
|
|
|
params={state.params}
|
|
params={state.params}
|
|
@@ -247,8 +261,11 @@ const LockStore = () => {
|
|
|
}}
|
|
}}
|
|
|
request={async (params, sort, filter) => {
|
|
request={async (params, sort, filter) => {
|
|
|
const srotOrder = refactorSortField(sort)
|
|
const srotOrder = refactorSortField(sort)
|
|
|
- const { code = -1, data: { longle = [], total = 0 } = { longle: [], total: 0 } } =
|
|
|
|
|
- await queryLock({ ...params, ...srotOrder, ...filter })
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ code = -1,
|
|
|
|
|
+ data: { longle = [], total = 0, totalOld = 0 } = { longle: [], total: 0, totalOld: 0 }
|
|
|
|
|
+ } = await queryLock({ ...params, ...srotOrder, ...filter })
|
|
|
|
|
+ setState({ ...state, totalOld })
|
|
|
return {
|
|
return {
|
|
|
data: longle,
|
|
data: longle,
|
|
|
success: code === consts.RET_CODE.SUCCESS,
|
|
success: code === consts.RET_CODE.SUCCESS,
|
|
@@ -288,8 +305,13 @@ const LockStore = () => {
|
|
|
labelInValue={true}
|
|
labelInValue={true}
|
|
|
allowClear={true}
|
|
allowClear={true}
|
|
|
placeholder="请选择产品"
|
|
placeholder="请选择产品"
|
|
|
|
|
+ onDropdownVisibleChange={async e => {
|
|
|
|
|
+ e && !state.prodList?.length && (await fetchSoftProducts())
|
|
|
|
|
+ }}
|
|
|
options={state.prodList.map(item => ({ value: item.title }))}
|
|
options={state.prodList.map(item => ({ value: item.title }))}
|
|
|
- onChange={e => setState({ ...state, params: { ...state.params, product: e } })}
|
|
|
|
|
|
|
+ onChange={e =>
|
|
|
|
|
+ setState({ ...state, params: { ...state.params, product: e?.value || '' } })
|
|
|
|
|
+ }
|
|
|
/>
|
|
/>
|
|
|
]
|
|
]
|
|
|
}}
|
|
}}
|