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
陈智峰
jinfa-platform
Commits
156967c1
Commit
156967c1
authored
Nov 26, 2020
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加远程检索
parent
a7eb2caa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
12 deletions
+67
-12
index.tsx
...ion/stockSellStorage/bills/components/BillsForm/index.tsx
+55
-0
index.ts
...ockSellStorage/bills/components/BillsForm/schema/index.ts
+12
-12
No files found.
src/pages/transaction/stockSellStorage/bills/components/BillsForm/index.tsx
View file @
156967c1
...
...
@@ -10,6 +10,7 @@ import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
ModalTable
from
'@/components/ModalTable'
;
...
...
@@ -43,6 +44,7 @@ import { createEffects } from './effects';
const
addSchemaAction
=
createFormActions
();
const
{
onFormInputChange$
,
onFormInit$
,
}
=
FormEffectHooks
;
interface
BillsFormProps
{
...
...
@@ -98,6 +100,28 @@ const BillsForm: React.FC<BillsFormProps> = ({
},
]
// 获取品牌
const
fetchBrand
=
async
(
name
=
''
)
=>
{
const
res
=
await
PublicApi
.
getProductSelectGetSelectBrand
({
name
,
});
if
(
res
.
code
===
1000
)
{
return
res
.
data
;
}
return
[];
}
// 获取会员品类
const
fetchCustomerCategory
=
async
(
name
=
''
)
=>
{
const
res
=
await
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
,
});
if
(
res
.
code
===
1000
)
{
return
res
.
data
;
}
return
[];
}
// 获取单据详情
const
getBillInfo
=
()
=>
{
if
(
!
id
)
{
...
...
@@ -878,12 +902,43 @@ const BillsForm: React.FC<BillsFormProps> = ({
SearchSelect
,
},
effects
:
(
$
,
actions
)
=>
{
const
linkage
=
useLinkageUtils
();
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'name'
,
FORM_FILTER_PATH
,
);
useAsyncSelect
(
'brandId'
,
fetchBrand
,
[
'name'
,
'id'
]);
useAsyncSelect
(
'customerCategoryId'
,
fetchCustomerCategory
,
[
'name'
,
'id'
]);
onFormInit$
().
subscribe
(()
=>
{
// 初始化远程检索逻辑
linkage
.
componentProps
(
'customerCategoryId'
,
{
onSearch
:
async
value
=>
{
linkage
.
loading
(
'customerCategoryId'
);
const
dataSource
=
await
fetchCustomerCategory
(
value
);
linkage
.
enum
(
'customerCategoryId'
,
dataSource
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
id
,
})));
linkage
.
loaded
(
'customerCategoryId'
);
},
});
// 初始化远程检索逻辑
linkage
.
componentProps
(
'brandId'
,
{
onSearch
:
async
value
=>
{
linkage
.
loading
(
'brandId'
);
const
dataSource
=
await
fetchCustomerCategory
(
value
);
linkage
.
enum
(
'brandId'
,
dataSource
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
id
,
})));
linkage
.
loaded
(
'brandId'
);
},
});
});
},
inline
:
false
,
}
...
...
src/pages/transaction/stockSellStorage/bills/components/BillsForm/schema/index.ts
View file @
156967c1
...
...
@@ -779,24 +779,24 @@ export const goodsSearchSchema: ISchema = {
},
customerCategoryId
:
{
type
:
'string'
,
'x-component'
:
'SearchSelect'
,
enum
:
[]
,
'x-component-props'
:
{
placeholder
:
'品类'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCustomerCategory
,
style
:
{
width
:
'100%'
,
}
placeholder
:
'品类'
,
showSearch
:
true
,
defaultActiveFirstOption
:
false
,
showArrow
:
true
,
filterOption
:
false
,
},
},
brandId
:
{
type
:
'string'
,
'x-component'
:
'SearchSelect'
,
enum
:
[]
,
'x-component-props'
:
{
placeholder
:
'品牌'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectBrand
,
style
:
{
width
:
'100%'
,
}
placeholder
:
'品牌'
,
showSearch
:
true
,
defaultActiveFirstOption
:
false
,
showArrow
:
true
,
filterOption
:
false
,
},
},
submit
:
{
...
...
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