Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
7e6a30a8
Commit
7e6a30a8
authored
May 26, 2022
by
前端-彭佳文
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-220518' into 'v2-220518'
物料bug fix See merge request linkseeks-design/pro-platform!863
parents
f04cb3da
efa39827
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
173 additions
and
55 deletions
+173
-55
useGetDetailCommon.tsx
src/pages/commodity/material/common/useGetDetailCommon.tsx
+1
-1
useGetTableSearchData.tsx
...pages/commodity/material/common/useGetTableSearchData.tsx
+6
-10
index.tsx
src/pages/commodity/material/components/fileItem/index.tsx
+15
-1
add.tsx
src/pages/commodity/material/materialPendingAdd/add.tsx
+20
-27
index.tsx
...aterialPendingAdd/components/requisitionerTable/index.tsx
+74
-0
index.tsx
.../commodity/material/materialPendingAdd/constant/index.tsx
+28
-0
useModalTable.ts
...modity/material/materialPendingAdd/model/useModalTable.ts
+14
-0
add.tsx
...ages/commodity/material/materialPendingAdd/schema/add.tsx
+4
-5
detail.tsx
.../commodity/material/materialPendingExamChangeI/detail.tsx
+3
-3
detail.tsx
...commodity/material/materialPendingExamChangeII/detail.tsx
+4
-4
detail.tsx
src/pages/commodity/material/materialPendingExamI/detail.tsx
+1
-1
detail.tsx
...pages/commodity/material/materialPendingExamII/detail.tsx
+1
-1
detail.tsx
src/pages/commodity/material/materialQuery/detail.tsx
+2
-2
No files found.
src/pages/commodity/material/common/useGetDetailCommon.tsx
View file @
7e6a30a8
...
...
@@ -43,7 +43,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
name
:
intl
.
formatMessage
({
id
:
'material.unitConversion.title'
,
defaultMessage
:
'单位换算'
})
},
{
key
:
'contact'
,
key
:
'contact
Info
'
,
name
:
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
},
{
...
...
src/pages/commodity/material/common/useGetTableSearchData.tsx
View file @
7e6a30a8
...
...
@@ -85,15 +85,11 @@ export const fetchUnit = async (name?: string) => {
}
}
export
const
fetchUserPage
=
async
()
=>
{
try
{
const
Data
:
any
=
{
current
:
1
,
status
:
'1'
,
pageSize
:
9999
}
const
{
data
,
code
}
=
await
getMemberUserPage
(
Data
);
if
(
code
===
1000
)
{
return
data
.
data
;
}
return
EMPTY_ARRAY
}
catch
{
return
EMPTY_ARRAY
export
const
fetchUserPage
=
async
(
params
)
=>
{
try
{
const
{
data
}
=
await
getMemberUserPage
(
params
)
return
data
}
catch
{
return
EMPTY_ARRAY
}
}
src/pages/commodity/material/components/fileItem/index.tsx
View file @
7e6a30a8
...
...
@@ -10,8 +10,22 @@ interface Iprops {
const
Files
:
React
.
FC
<
Iprops
>
&
{
isFieldComponent
:
boolean
}
=
(
props
:
Iprops
)
=>
{
// console.log()
const
{
value
}
=
props
const
onDownload
=
(
file
:
any
)
=>
{
const
xhr
=
new
XMLHttpRequest
()
xhr
.
open
(
'GEt'
,
file
.
url
,
true
)
xhr
.
responseType
=
'blob'
xhr
.
onload
=
function
(
e
){
const
url
=
window
.
URL
.
createObjectURL
(
xhr
.
response
)
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
url
a
.
download
=
file
.
name
a
.
click
()
}
xhr
.
send
()
}
return
(
<
a
href=
{
value
?.
url
||
''
}
>
{
value
?.
name
||
''
}
</
a
>
<
a
onClick=
{
()
=>
{
onDownload
(
value
)}
}
>
{
value
?.
name
||
''
}
</
a
>
)
}
...
...
src/pages/commodity/material/materialPendingAdd/add.tsx
View file @
7e6a30a8
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
AnchorPage
from
'@/components/AnchorPage'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
,
ISchema
,
Schema
}
from
'@formily/antd'
;
import
{
Button
,
Cascader
,
message
}
from
'antd'
import
{
LinkOutlined
}
from
'@ant-design/icons'
import
{
getSchema
,
propsCardSchema
}
from
'./schema/add'
;
import
FormilyUploadFiles
from
'@/components/UploadFiles/FormilyUploadFiles'
;
import
styles
from
'./add.less'
;
...
...
@@ -12,9 +13,9 @@ import UploadFileTip from '../components/uploadFileTip';
import
FormilyUploadEnclosure
from
'../components/formilyUploadEnclosure'
;
import
UploadFiles
from
'@/components/UploadFiles/UploadFiles'
;
import
FileItem
from
'../components/fileItem'
;
import
{
fetchBrand
,
fetchCategoryData
,
fetchTreeData
,
fetchUnit
,
useAsyncCascader
,
fetchUserPage
,
fetchMemberUserGet
}
from
'../common/useGetTableSearchData'
;
import
RequisitionerTable
from
'./components/requisitionerTable'
import
{
fetchBrand
,
fetchCategoryData
,
fetchTreeData
,
fetchUnit
,
useAsyncCascader
,
fetchUserPage
}
from
'../common/useGetTableSearchData'
;
import
{
getProductCustomerGetCustomerCategoryById
,
postProductGoodsSaveOrUpdateGoods
}
from
'@/services/ProductV2Api'
;
// import {getMemberUserPage} from '@/services/MemberV2Api';
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
;
import
useInitialValue
,
{
Options
}
from
'./useInitialValue'
;
...
...
@@ -42,6 +43,9 @@ const MaterialAdd: React.FC<IProps> = (props) => {
const
{
location
:
{
state
,
query
},
match
}
=
props
;
const
isAdd
=
lastTypeParams
===
'/add'
&&
!
id
;
const
isEdit
=
lastTypeParams
===
'/edit'
&&
id
;
const
isedtails
=
lastTypeParams
===
'/detail'
&&
id
;
// const isDetail = !isAdd && !isEdit;
const
{
loading
,
formatInitialValue
}
=
useInitialValue
({
id
:
id
,
query
,
state
});
...
...
@@ -54,6 +58,13 @@ const MaterialAdd: React.FC<IProps> = (props) => {
// 需要注意的是 这个需要跟 setSchema 一同使用
const
[
hasProperties
,
setHasProperties
]
=
useState
(
false
);
const
RequisRef
=
useRef
<
any
>
({})
// 请购人
/*联系人选择*/
const
handleOrder
=
()
=>
{
RequisRef
.
current
.
setVisible
(
true
)
}
const
RequisitionerBtn
=
<
div
className=
'connectBtn'
onClick=
{
handleOrder
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.xuanze'
,
defaultMessage
:
'选择'
})
}
</
div
>
useEffect
(()
=>
{
if
(
query
?.
type
===
'sourceData'
)
{
formActions
.
setFieldState
(
'sourceListCard'
,
(
state
)
=>
{
...
...
@@ -311,7 +322,7 @@ const MaterialAdd: React.FC<IProps> = (props) => {
},
(
hasProperties ? ({
key: '
props
',
key: '
type
',
name: intl.formatMessage({ id: 'material.props.title', defaultMessage: '属性信息' })
}) : null
),
...
...
@@ -407,6 +418,7 @@ const MaterialAdd: React.FC<IProps> = (props) => {
customizeFileItemRender: customizeFileItemRender,
...createDescriptionElement(),
handleSearchUnit,
Requisitioner:Boolean(isedtails)?'':RequisitionerBtn
}}
effects={($, actions) => {
useAsyncCascader('category', fetchCategoryData)
...
...
@@ -414,31 +426,14 @@ const MaterialAdd: React.FC<IProps> = (props) => {
useAsyncCascader('materialGroup', fetchTreeData);
useAsyncSelect('unitId', fetchUnit, ["name", "id"])
useAsyncSelect('unitConversions', fetchUnit, ["name", "id"])
useAsyncSelect('chargeUserId', fetchUserPage, ["name", "userId"])
//
useAsyncSelect('chargeUserId', fetchUserPage, ["name", "userId"])
$('onFormMount').subscribe(() => {
if (isEdit) {
formActions.setFieldState('code', (state) => {
FormPath.setIn(state, 'editable', false);
})
}
}
})
$('onFieldInputChange', 'chargeUserId').subscribe((fieldState) => {
formActions.setFieldState('contactMemberName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
formActions.setFieldState('chargeName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
formActions.setFieldState('contactMemberPhone', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.phone);
})
formActions.setFieldState('chargeAccount', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.account);
})
formActions.setFieldState('chargeRoleName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.roleName);
})
})
$('onFieldValueChange', 'category').subscribe((fieldState) => {
if (!fieldState.value || fieldState.value.length === 0) {
setSchema(
...
...
@@ -453,10 +448,7 @@ const MaterialAdd: React.FC<IProps> = (props) => {
getProductCustomerGetCustomerCategoryById({ id: categoryId })
.then((data) => {
const { customerAttributeList } = data.data;
if (customerAttributeList?.length === 0) {
setSchema(
getSchema(null)
)
if (customerAttributeList?.length === 0) {
setHasProperties(false);
return;
}
...
...
@@ -516,6 +508,7 @@ const MaterialAdd: React.FC<IProps> = (props) => {
}}
/>
<Prompt when={unsaved} message={intl.formatMessage({ id: 'common.tip.save.confirm' }, { default: '您还有未保存的内容,是否确定要离开?' })} />
<RequisitionerTable currentRef={RequisRef} schemaAction={formActions} />
</AnchorPage>
)
...
...
src/pages/commodity/material/materialPendingAdd/components/requisitionerTable/index.tsx
0 → 100644
View file @
7e6a30a8
import
React
,
{
useEffect
}
from
'react'
import
ModalTable
,
{
ModalTableProps
}
from
'@/components/ModalTable'
import
{
fetchUserPage
}
from
'../../../common/useGetTableSearchData'
;
import
{
useModalTable
}
from
'../../model/useModalTable'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
RequisitiColumns
}
from
'../../constant'
import
{
useIntl
}
from
'umi'
export
interface
MemberModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
schemaAction
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
currentRef
?:
any
,
confirmModal
?(),
productRef
?:
any
,
}
const
RequisitionerTable
:
React
.
FC
<
MemberModalTableProps
>
=
(
props
)
=>
{
const
{
type
=
'radio'
,
schemaAction
,
confirmModal
,
currentRef
,
...
restProps
}
=
props
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
useModalTable
({
type
,
customKey
:
'userId'
})
const
intl
=
useIntl
()
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
setVisible
,
visible
,
rowSelectionCtl
}
}
},
[])
useEffect
(()
=>
{
if
(
visible
)
{
const
memberId
=
schemaAction
.
getFieldValue
(
'requisitionerId'
)
rowSelectionCtl
.
setSelectedRowKeys
([
memberId
])
}
},
[
visible
])
const
handleConfirm
=
()
=>
{
const
rowItem
=
rowSelectionCtl
.
selectRow
[
0
]
/*当前选择的会员全部信息*/
console
.
log
(
rowItem
,
'row'
)
if
(
rowItem
)
{
schemaAction
.
setFieldValue
(
'contactMemberName'
,
rowItem
.
name
)
schemaAction
.
setFieldValue
(
'chargeUserId'
,
rowItem
.
userId
)
schemaAction
.
setFieldValue
(
'chargeName'
,
rowItem
.
name
)
schemaAction
.
setFieldValue
(
'contactMemberPhone'
,
rowItem
.
phone
)
schemaAction
.
setFieldValue
(
'chargeAccount'
,
rowItem
.
account
)
schemaAction
.
setFieldValue
(
'chargeRoleName'
,
rowItem
.
roleName
)
}
confirmModal
&&
confirmModal
()
setVisible
(
false
)
}
return
(
<
ModalTable
modalTitle=
"选择联系人"
columns=
{
RequisitiColumns
}
visible=
{
visible
}
confirm=
{
handleConfirm
}
cancel=
{
()
=>
setVisible
(
false
)
}
fetchTableData=
{
(
params
)
=>
fetchUserPage
({...
params
})
}
rowSelection=
{
rowSelection
}
modalType=
'requisitSchema'
tableProps=
{
{
rowKey
:
'userId'
}
}
{
...
restProps
}
/>
)
}
RequisitionerTable
.
defaultProps
=
{}
export
default
RequisitionerTable
src/pages/commodity/material/materialPendingAdd/constant/index.tsx
0 → 100644
View file @
7e6a30a8
export
const
RequisitiColumns
:
any
[]
=
[
{
title
:
"姓名"
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
"手机号"
,
dataIndex
:
'phone'
,
align
:
'center'
,
key
:
'phone'
,
},
{
title
:
"所属机构"
,
dataIndex
:
'orgName'
,
align
:
'center'
,
key
:
'orgName'
,
},
{
title
:
"职位"
,
dataIndex
:
'jobTitle'
,
align
:
'center'
,
key
:
'jobTitle'
,
},
]
src/pages/commodity/material/materialPendingAdd/model/useModalTable.ts
0 → 100644
View file @
7e6a30a8
import
{
useState
}
from
'react'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
export
const
useModalTable
=
(
options
?)
=>
{
const
[
visible
,
setVisible
]
=
useState
(
false
)
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
(
options
)
return
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
}
\ No newline at end of file
src/pages/commodity/material/materialPendingAdd/schema/add.tsx
View file @
7e6a30a8
...
...
@@ -285,7 +285,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type
:
'object'
,
"x-component"
:
'MellowCard'
,
"x-component-props"
:
{
id
:
'
test123456789
'
,
id
:
'
contactInfo
'
,
title
:
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
},
properties
:
{
...
...
@@ -306,21 +306,20 @@ export const getSchema = (schema: ISchema | null): ISchema => {
}
},
properties
:
{
charge
UserId
:
{
charge
Name
:
{
title
:
intl
.
formatMessage
({
id
:
'material.chargeName'
,
defaultMessage
:
'负责人'
}),
type
:
'string'
,
enum
:
[],
'x-component-props'
:
{
addonAfter
:
"{{Requisitioner}}"
,
showSearch
:
true
,
},
description
:
`{{desc()}}`
,
'x-rules'
:[
{
required
:
true
,
message
:
intl
.
formatMessage
({
id
:
'material.chargeName.required'
,
defaultMessage
:
'请输入'
})
}]
},
charge
Name
:
{
charge
UserId
:
{
title
:
intl
.
formatMessage
({
id
:
'material.chargeUserId'
,
defaultMessage
:
'负责人用户id'
}),
type
:
"string"
,
display
:
false
,
...
...
src/pages/commodity/material/materialPendingExamChangeI/detail.tsx
View file @
7e6a30a8
...
...
@@ -110,15 +110,15 @@ const Detail = () => {
<
CustomizeColumn
id=
"unitConversion"
data=
{
unitInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.unit
InfoList
.title'
,
defaultMessage
:
'单位换算'
})
}
title=
{
intl
.
formatMessage
({
id
:
'material.unit
Conversion
.title'
,
defaultMessage
:
'单位换算'
})
}
column=
{
2
}
/>
</
Space
>
<
Space
>
<
CustomizeColumn
id=
"contactInfo
List
"
id=
"contactInfo"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact
InfoList
.title'
,
defaultMessage
:
'联系信息'
})
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
}
column=
{
2
}
/>
</
Space
>
...
...
src/pages/commodity/material/materialPendingExamChangeII/detail.tsx
View file @
7e6a30a8
...
...
@@ -105,15 +105,15 @@ const Detail = () => {
<
CustomizeColumn
id=
"unitConversion"
data=
{
unitInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.unit
InfoList
.title'
,
defaultMessage
:
'单位换算'
})
}
title=
{
intl
.
formatMessage
({
id
:
'material.unit
Conversion
.title'
,
defaultMessage
:
'单位换算'
})
}
column=
{
2
}
/>
</
Space
>
<
Space
>
<
CustomizeColumn
id=
"contactInfoList
"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact
InfoList
.title'
,
defaultMessage
:
'联系信息'
})
}
id=
"contactInfo
"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
}
column=
{
2
}
/>
</
Space
>
...
...
src/pages/commodity/material/materialPendingExamI/detail.tsx
View file @
7e6a30a8
...
...
@@ -113,7 +113,7 @@ const Detail = () => {
</
Space
>
<
Space
>
<
CustomizeColumn
id=
"contact"
id=
"contact
Info
"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
}
column=
{
2
}
...
...
src/pages/commodity/material/materialPendingExamII/detail.tsx
View file @
7e6a30a8
...
...
@@ -122,7 +122,7 @@ const Detail = () => {
</
Space
>
<
Space
>
<
CustomizeColumn
id=
"contact"
id=
"contact
Info
"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
}
column=
{
2
}
...
...
src/pages/commodity/material/materialQuery/detail.tsx
View file @
7e6a30a8
...
...
@@ -77,8 +77,8 @@ const Detail = () => {
style=
{
{
marginBottom
:
'16px'
}
}
/>
<
CustomizeColumn
id=
"contact
"
data=
{
contactInfoList
}
id=
"contact
Info"
data=
{
contactInfoList
}
title=
{
intl
.
formatMessage
({
id
:
'material.contact.title'
,
defaultMessage
:
'联系信息'
})
}
column=
{
2
}
style=
{
{
marginBottom
:
'16px'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment