|
@@ -1,15 +1,16 @@
|
|
|
-import React, { useState } from 'react'
|
|
|
|
|
-import { Tag, Select, Tooltip, Input } from 'antd'
|
|
|
|
|
|
|
+import React, { useState, useEffect } from 'react'
|
|
|
|
|
+import { Tag, Select, Tooltip, Input, DatePicker } 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'
|
|
|
-import { queryLock } from '@/services/lock'
|
|
|
|
|
|
|
+import { queryLock, querySoftwareProducts } from '@/services/lock'
|
|
|
import LocksDetail from '@/pages/Product/Lock/LockStore/components/LocksDetail'
|
|
import LocksDetail from '@/pages/Product/Lock/LockStore/components/LocksDetail'
|
|
|
import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
|
|
import ContactDetail from '@/pages/Customer/Client/components/ClientDetail'
|
|
|
import SoftwareDetail from '@/pages/Product/Lock/LockStore/components/SoftwareDetail'
|
|
import SoftwareDetail from '@/pages/Product/Lock/LockStore/components/SoftwareDetail'
|
|
|
import { useModal } from '@/components/Modal'
|
|
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'
|
|
|
|
|
|
|
|
// 渲染产品标签
|
|
// 渲染产品标签
|
|
|
export const ProductLabel = ({ data }) => {
|
|
export const ProductLabel = ({ data }) => {
|
|
@@ -30,15 +31,33 @@ export const ProductLabel = ({ data }) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const longleStatusNum = {
|
|
const longleStatusNum = {
|
|
|
- 1: '生成',
|
|
|
|
|
- 2: '接收',
|
|
|
|
|
- 3: '借出',
|
|
|
|
|
- 4: '销售',
|
|
|
|
|
- 5: '升级',
|
|
|
|
|
- 6: '更换',
|
|
|
|
|
- 7: '收回',
|
|
|
|
|
- 8: '备注',
|
|
|
|
|
- 9: '赠送'
|
|
|
|
|
|
|
+ 1: {
|
|
|
|
|
+ text: '生成'
|
|
|
|
|
+ },
|
|
|
|
|
+ 2: {
|
|
|
|
|
+ text: '接收'
|
|
|
|
|
+ },
|
|
|
|
|
+ 3: {
|
|
|
|
|
+ text: '借出'
|
|
|
|
|
+ },
|
|
|
|
|
+ 4: {
|
|
|
|
|
+ text: '销售'
|
|
|
|
|
+ },
|
|
|
|
|
+ 5: {
|
|
|
|
|
+ text: '升级'
|
|
|
|
|
+ },
|
|
|
|
|
+ 6: {
|
|
|
|
|
+ text: '更换'
|
|
|
|
|
+ },
|
|
|
|
|
+ 7: {
|
|
|
|
|
+ text: '收回'
|
|
|
|
|
+ },
|
|
|
|
|
+ 8: {
|
|
|
|
|
+ text: '备注'
|
|
|
|
|
+ },
|
|
|
|
|
+ 9: {
|
|
|
|
|
+ text: '赠送'
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const LockStore = () => {
|
|
const LockStore = () => {
|
|
@@ -48,8 +67,20 @@ const LockStore = () => {
|
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
|
params: { dataPermission: 'oneself' },
|
|
params: { dataPermission: 'oneself' },
|
|
|
data: [],
|
|
data: [],
|
|
|
|
|
+ prodList: [], // 产品列表
|
|
|
id: ''
|
|
id: ''
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ // 获取软件锁产品列表
|
|
|
|
|
+ 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 } })
|
|
|
}
|
|
}
|
|
@@ -111,7 +142,6 @@ const LockStore = () => {
|
|
|
{
|
|
{
|
|
|
title: '锁号',
|
|
title: '锁号',
|
|
|
dataIndex: 'keyNum',
|
|
dataIndex: 'keyNum',
|
|
|
- key: 'keyNum',
|
|
|
|
|
width: 150,
|
|
width: 150,
|
|
|
render: (keyNum, record) => (
|
|
render: (keyNum, record) => (
|
|
|
<span
|
|
<span
|
|
@@ -124,7 +154,6 @@ const LockStore = () => {
|
|
|
{
|
|
{
|
|
|
title: '产品',
|
|
title: '产品',
|
|
|
dataIndex: 'product',
|
|
dataIndex: 'product',
|
|
|
- key: 'product',
|
|
|
|
|
width: 200,
|
|
width: 200,
|
|
|
render: text => {
|
|
render: text => {
|
|
|
return <ProductLabel data={text} />
|
|
return <ProductLabel data={text} />
|
|
@@ -133,20 +162,25 @@ const LockStore = () => {
|
|
|
{
|
|
{
|
|
|
title: '出库时间',
|
|
title: '出库时间',
|
|
|
dataIndex: 'makeDay',
|
|
dataIndex: 'makeDay',
|
|
|
- key: 'makeDay',
|
|
|
|
|
|
|
+ valueType: 'date',
|
|
|
|
|
+ sorter: true,
|
|
|
width: 150
|
|
width: 150
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '状态',
|
|
title: '状态',
|
|
|
dataIndex: 'status',
|
|
dataIndex: 'status',
|
|
|
- key: 'status',
|
|
|
|
|
width: 150,
|
|
width: 150,
|
|
|
- render: status => <>{longleStatusNum[status]}</>
|
|
|
|
|
|
|
+ filters: true,
|
|
|
|
|
+ onFilter: true,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ valueEnum: longleStatusNum,
|
|
|
|
|
+ render: (_, { status }) => {
|
|
|
|
|
+ return <>{longleStatusNum[status]?.text}</>
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '责任人',
|
|
title: '责任人',
|
|
|
dataIndex: 'responsible',
|
|
dataIndex: 'responsible',
|
|
|
- key: 'responsible',
|
|
|
|
|
width: 150,
|
|
width: 150,
|
|
|
render: (text, record) => (
|
|
render: (text, record) => (
|
|
|
<span
|
|
<span
|
|
@@ -170,7 +204,6 @@ const LockStore = () => {
|
|
|
{
|
|
{
|
|
|
title: '联系人',
|
|
title: '联系人',
|
|
|
dataIndex: 'client',
|
|
dataIndex: 'client',
|
|
|
- key: 'client',
|
|
|
|
|
width: 150,
|
|
width: 150,
|
|
|
render: (text, record) => (
|
|
render: (text, record) => (
|
|
|
<span
|
|
<span
|
|
@@ -183,13 +216,11 @@ const LockStore = () => {
|
|
|
{
|
|
{
|
|
|
title: '销售/借出/赠送时间',
|
|
title: '销售/借出/赠送时间',
|
|
|
dataIndex: 'allotedTime',
|
|
dataIndex: 'allotedTime',
|
|
|
- key: 'allotedTime',
|
|
|
|
|
width: 160
|
|
width: 160
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '办事处',
|
|
title: '办事处',
|
|
|
dataIndex: 'category',
|
|
dataIndex: 'category',
|
|
|
- key: 'category',
|
|
|
|
|
width: 150
|
|
width: 150
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
@@ -214,12 +245,10 @@ const LockStore = () => {
|
|
|
onLoadingChange={loadingStatus => {
|
|
onLoadingChange={loadingStatus => {
|
|
|
loadingStatus && redoHeight()
|
|
loadingStatus && redoHeight()
|
|
|
}}
|
|
}}
|
|
|
- request={async params => {
|
|
|
|
|
- const {
|
|
|
|
|
- code = -1,
|
|
|
|
|
- data: { longle = [], log = [], total = 0 } = { longle: [], log: [], total: 0 }
|
|
|
|
|
- } = await queryLock({ ...params })
|
|
|
|
|
- setState({ ...state, data: longle, log, total })
|
|
|
|
|
|
|
+ request={async (params, sort, filter) => {
|
|
|
|
|
+ const srotOrder = refactorSortField(sort)
|
|
|
|
|
+ const { code = -1, data: { longle = [], total = 0 } = { longle: [], total: 0 } } =
|
|
|
|
|
+ await queryLock({ ...params, ...srotOrder, ...filter })
|
|
|
return {
|
|
return {
|
|
|
data: longle,
|
|
data: longle,
|
|
|
success: code === consts.RET_CODE.SUCCESS,
|
|
success: code === consts.RET_CODE.SUCCESS,
|
|
@@ -239,7 +268,30 @@ const LockStore = () => {
|
|
|
onSearch={handleSearch}
|
|
onSearch={handleSearch}
|
|
|
/>
|
|
/>
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
|
- )
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ actions: [
|
|
|
|
|
+ <DatePicker
|
|
|
|
|
+ key="date"
|
|
|
|
|
+ bordered={false}
|
|
|
|
|
+ placeholder="请选择出库时间"
|
|
|
|
|
+ onChange={e =>
|
|
|
|
|
+ setState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ params: { ...state.params, makeDay: e ? e.format('YYYY-MM-DD') : '' }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ />,
|
|
|
|
|
+ <Select
|
|
|
|
|
+ key="select"
|
|
|
|
|
+ bordered={false}
|
|
|
|
|
+ style={{ width: '150px' }}
|
|
|
|
|
+ labelInValue={true}
|
|
|
|
|
+ allowClear={true}
|
|
|
|
|
+ placeholder="请选择产品"
|
|
|
|
|
+ options={state.prodList.map(item => ({ value: item.title }))}
|
|
|
|
|
+ onChange={e => setState({ ...state, params: { ...state.params, product: e } })}
|
|
|
|
|
+ />
|
|
|
|
|
+ ]
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
// {/* <Locks onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
|
|
// {/* <Locks onClose={hideDrawer} visible={state.visible} onCreate={onCreate} id={state.id} /> */}
|