|
|
@@ -1,5 +1,5 @@
|
|
|
import React, { useEffect, useState, useRef } from 'react'
|
|
|
-import { Tag, Select, Tooltip, Input, DatePicker, Button } from 'antd'
|
|
|
+import { Tag, Tooltip, Input, DatePicker, Button } from 'antd'
|
|
|
import consts from '@/consts'
|
|
|
import { useModel, connect } from 'umi'
|
|
|
import { queryLock } from '@/services/product'
|
|
|
@@ -18,15 +18,15 @@ import { getPermAuthCache } from '@/utils/auth'
|
|
|
|
|
|
// 渲染产品标签
|
|
|
export const ProductLabel = ({ data }) => {
|
|
|
- if (!data) return <></>
|
|
|
- let newData = data
|
|
|
+ if (!data) return null
|
|
|
+ let newData
|
|
|
if (!Array.isArray(data)) {
|
|
|
newData = data.split('+')
|
|
|
}
|
|
|
return (
|
|
|
<div className="children:m-2px">
|
|
|
- {newData.map((item, index) => (
|
|
|
- <Tag color="purple" key={index}>
|
|
|
+ {newData.map((item, idx) => (
|
|
|
+ <Tag color="purple" key={item + idx}>
|
|
|
{item}
|
|
|
</Tag>
|
|
|
))}
|
|
|
@@ -113,18 +113,20 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
orderIds: []
|
|
|
})
|
|
|
|
|
|
- // 获取软件锁产品列表
|
|
|
- function fetchSoftProducts() {
|
|
|
- dispatch({
|
|
|
- type: 'lock/fetchProdList'
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
const handleSearch = value => {
|
|
|
setState({ ...state, params: { ...state.params, search: value } })
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ // 获取软件锁产品列表
|
|
|
+ function fetchSoftProducts() {
|
|
|
+ dispatch({
|
|
|
+ type: 'lock/fetchProdList'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (!prodList?.length) {
|
|
|
+ fetchSoftProducts()
|
|
|
+ }
|
|
|
if (shouldUpdate) {
|
|
|
tRef.current.reload()
|
|
|
}
|
|
|
@@ -193,7 +195,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
render: (keyNum, record) => (
|
|
|
<span
|
|
|
onClick={() => showDrawer(record.id)}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{keyNum}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -201,14 +204,35 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
{
|
|
|
title: '产品',
|
|
|
dataIndex: 'product',
|
|
|
+ key: 'product',
|
|
|
width: 200,
|
|
|
fixed: 'left',
|
|
|
- render: text => <ProductLabel data={text} />
|
|
|
+ filters: true,
|
|
|
+ filterMultiple: false,
|
|
|
+ valueEnum: prodList.reduce((prev, curr) => {
|
|
|
+ const obj = { ...prev }
|
|
|
+ obj[curr.title] = {
|
|
|
+ text: curr.title
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+ }, {}),
|
|
|
+ render: (_, record) => <ProductLabel data={record.product} />
|
|
|
},
|
|
|
+ // {
|
|
|
+ // title: '出库时间',
|
|
|
+ // dataIndex: 'makeDay',
|
|
|
+ // key: 'makeDay',
|
|
|
+ // valueType: 'date',
|
|
|
+ // filters: true,
|
|
|
+ // sorter: true,
|
|
|
+ // width: 150
|
|
|
+ // },
|
|
|
{
|
|
|
title: '出库时间',
|
|
|
- dataIndex: 'makeDay',
|
|
|
+ dataIndex: 'stockTime',
|
|
|
+ key: 'stockTime',
|
|
|
valueType: 'date',
|
|
|
+ filters: true,
|
|
|
sorter: true,
|
|
|
width: 90
|
|
|
},
|
|
|
@@ -220,14 +244,11 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
onFilter: true,
|
|
|
valueType: 'select',
|
|
|
valueEnum: longleStatusNum,
|
|
|
- render: (_, { status }) => {
|
|
|
- return <>{longleStatusNum[status]?.text}</>
|
|
|
- }
|
|
|
+ renderText: (_, { status }) => longleStatusNum[status]?.text
|
|
|
},
|
|
|
{
|
|
|
title: '出库状态',
|
|
|
dataIndex: 'stockStatus',
|
|
|
- valueType: 'date',
|
|
|
key: 'stockStatus',
|
|
|
width: 60,
|
|
|
render: (_, { stockStatus }) => {
|
|
|
@@ -244,7 +265,6 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
{
|
|
|
title: '销售状态',
|
|
|
dataIndex: 'sellStatus',
|
|
|
- valueType: 'date',
|
|
|
key: 'sellStatus',
|
|
|
width: 60,
|
|
|
render: (_, { sellStatus }) => {
|
|
|
@@ -254,14 +274,12 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
{
|
|
|
title: '销售时间',
|
|
|
dataIndex: 'sellTime',
|
|
|
- valueType: 'date',
|
|
|
key: 'sellTime',
|
|
|
width: 90
|
|
|
},
|
|
|
{
|
|
|
title: '维护状态',
|
|
|
dataIndex: 'preserveStatus',
|
|
|
- valueType: 'date',
|
|
|
key: 'preserveStatus',
|
|
|
width: 60,
|
|
|
render: (_, { preserveStatus }) => {
|
|
|
@@ -282,7 +300,8 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
render: (text, record) => (
|
|
|
<span
|
|
|
onClick={() => showDrawerResponsible(record.responsibleId)}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{text}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -290,11 +309,13 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
{
|
|
|
title: '单位名称',
|
|
|
dataIndex: 'customerName',
|
|
|
+ key: 'customerName',
|
|
|
width: 300,
|
|
|
render: (text, record) => (
|
|
|
<span
|
|
|
onClick={() => showCompanyDrawer(record.customerId)}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{text}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -302,11 +323,13 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
{
|
|
|
title: '客户',
|
|
|
dataIndex: 'client',
|
|
|
+ key: 'client',
|
|
|
width: 150,
|
|
|
render: (text, record) => (
|
|
|
<span
|
|
|
onClick={() => showDrawerClient(record.clientId)}
|
|
|
- className="text-primary cursor-pointer hover:text-[#967bbd]">
|
|
|
+ className="text-primary cursor-pointer hover:text-[#967bbd]"
|
|
|
+ >
|
|
|
{text}
|
|
|
</span>
|
|
|
)
|
|
|
@@ -331,9 +354,6 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
stockStatus: {
|
|
|
show: false
|
|
|
},
|
|
|
- stockTime: {
|
|
|
- show: false
|
|
|
- },
|
|
|
sellStatus: {
|
|
|
show: false
|
|
|
},
|
|
|
@@ -437,22 +457,7 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
|
|
|
})
|
|
|
}}
|
|
|
/>
|
|
|
- </Tooltip>,
|
|
|
- <Select
|
|
|
- key="select"
|
|
|
- bordered={false}
|
|
|
- style={{ width: '150px' }}
|
|
|
- labelInValue={true}
|
|
|
- allowClear={true}
|
|
|
- placeholder="请选择产品"
|
|
|
- onDropdownVisibleChange={async e => {
|
|
|
- e && !prodList?.length && (await fetchSoftProducts())
|
|
|
- }}
|
|
|
- options={prodList.map(item => ({ value: item.title }))}
|
|
|
- onChange={e =>
|
|
|
- setState({ ...state, params: { ...state.params, product: e?.value || '' } })
|
|
|
- }
|
|
|
- />
|
|
|
+ </Tooltip>
|
|
|
]
|
|
|
}}
|
|
|
/>
|