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
c4b50366
Commit
c4b50366
authored
Jul 31, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4a38f03d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
123 additions
and
25 deletions
+123
-25
proxy.ts
config/proxy.ts
+1
-1
index.ts
src/module/productModule/index.ts
+25
-7
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+4
-2
index.less
src/pages/commodity/products/addProductsItem/index.less
+51
-0
logisticsForm.tsx
...ages/commodity/products/addProductsItem/logisticsForm.tsx
+1
-0
otherForm.tsx
src/pages/commodity/products/addProductsItem/otherForm.tsx
+1
-0
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+11
-6
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+8
-2
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+0
-0
selectGoodsForm.tsx
...es/commodity/products/addProductsItem/selectGoodsForm.tsx
+3
-2
index.ts
src/services/index.ts
+0
-0
index.ts
src/store/product/index.ts
+18
-5
No files found.
config/proxy.ts
View file @
c4b50366
export
default
{
'/api'
:
{
'target'
:
'http://10.0.0.25:8
1
00/'
,
'target'
:
'http://10.0.0.25:8
9
00/'
,
'changeOrigin'
:
true
,
'pathRewrite'
:
{
'^/api'
:
''
},
}
...
...
src/module/productModule/index.ts
View file @
c4b50366
import
{
GetProductGoodsGetGoodsListResponseDetail
}
from
'@/services'
;
interface
InnerAttributeValueList
{
customerAttributeValueId
:
number
;
value
:
string
;
}
export
interface
IProductSelectAttribute
{
attributeName
:
string
;
customerAttributeId
:
number
;
customerAttributeValueList
:
InnerAttributeValueList
[]
isPrice
:
boolean
;
}
export
interface
IProductModule
{
attributeLists
:
any
[];
productName
:
string
;
productSelectAttribute
:
any
[];
selectedGoods
:
any
[];
productSelectAttribute
:
IProductSelectAttribute
[];
selectedGoods
:
GetProductGoodsGetGoodsListResponseDetail
[];
tableDataSource
:
any
[];
priceAttributeParams
:
any
[];
// 价格设置的传输数据
setProductName
(
name
:
string
):
void
;
setProductSelectAttribute
(
list
:
any
[]):
void
;
setSelectedGoods
(
lists
:
any
[]):
void
;
setTableDataSource
(
datas
:
any
[]):
void
;
clearData
(
data
:
any
[]):
void
;
setAttributeLists
(
lists
:
any
[]):
void
;
setProductName
(
name
:
string
):
void
;
setProductSelectAttribute
(
list
:
IProductSelectAttribute
[]):
void
;
setSelectedGoods
(
lists
:
GetProductGoodsGetGoodsListResponseDetail
[]):
void
;
setTableDataSource
<
T
>
(
datas
:
T
[]):
void
;
clearData
(
data
:
any
[]):
void
;
setPriceAttributeParams
<
T
>
(
datas
:
T
[]):
void
;
}
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
c4b50366
...
...
@@ -127,8 +127,10 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
let
seletCategoryId
=
value
[
1
]
||
value
[
0
]
if
(
value
.
length
>
0
)
{
PublicApi
.
getProductCustomerGetCustomerCategoryById
({
id
:
seletCategoryId
}).
then
(
res
=>
{
onChangeAttributeList
(
res
.
data
?.
customerAttributeList
)
setShowCategory
(
res
.
data
.
name
)
const
{
data
}
=
res
onChangeAttributeList
(
data
?.
customerAttributeList
)
setShowCategory
(
data
.
name
)
ProductStore
.
setAttributeLists
(
data
?.
customerAttributeList
)
})
}
else
...
...
src/pages/commodity/products/addProductsItem/index.less
View file @
c4b50366
.colBox{
background-color: #FAFBFC;
position: relative;
ul{
margin-bottom: 42px;
margin-top: 12px;
list-style: none;
padding: 0;
li{
padding-left: 24px;
height: 32px;
line-height: 32px;
color: #172B4D;
display: flex;
justify-content: space-between;
margin: 8px 0;
cursor: pointer;
// span{
// padding-top: 12px;
// padding-bottom: 12px;
// }
a{
color: #97A0AF;
float: right;
padding-right: 24px;
}
}
.actived-li{
box-sizing: border-box;
font-weight: bold;
border-left: 2px solid #00B37A;
}
.tipTitle{
height:20px;
font-size:12px;
font-weight:400;
color:rgba(151,160,175,0.8);
line-height:20px;
margin: 25px 0 20px 0;
padding-left: 24px;
}
}
.addBtn{
margin-top: 30px;
background-color: #F4F5F7;
width: 100%;
position: absolute;
bottom: 0;
}
}
\ No newline at end of file
src/pages/commodity/products/addProductsItem/logisticsForm.tsx
View file @
c4b50366
...
...
@@ -49,6 +49,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
name=
"logistic-form"
labelAlign=
"left"
ref=
{
logisticsFormRef
}
colon=
{
false
}
>
<
Form
.
Item
name=
"deliveryType"
...
...
src/pages/commodity/products/addProductsItem/otherForm.tsx
View file @
c4b50366
...
...
@@ -40,6 +40,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
name=
"other-form"
labelAlign=
"left"
ref=
{
otherFormRef
}
colon=
{
false
}
>
<
Form
.
Item
name=
"isInvoice"
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
c4b50366
...
...
@@ -11,8 +11,6 @@ import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
import
{
store
}
from
'@/store'
import
ProductDescForm
from
'./productDescForm'
import
{
Effects
}
from
'bizcharts'
const
layout
=
{
labelCol
:
{
...
...
@@ -54,7 +52,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
[
colums
,
setColumns
]
=
useState
<
ColumnType
<
any
>
[]
>
()
const
{
ProductStore
}
=
store
const
{
productName
,
selectedGoods
,
productSelectAttribute
,
tableDataSource
,
setTableDataSource
,
clearData
}
=
ProductStore
const
{
productName
,
selectedGoods
,
productSelectAttribute
,
tableDataSource
,
setTableDataSource
,
clearData
,
setPriceAttributeParams
}
=
ProductStore
_tableDataSource
=
useMemo
(()
=>
tableDataSource
,
[
tableDataSource
])
// 保持最新值
...
...
@@ -174,9 +172,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
combineArray
.
map
((
_rowArr
:
any
[],
i
:
any
)
=>
{
// _rowArr 属性值数组
let
_tempObj
:
any
=
{
索引
:
i
,
商品名称
:
productName
}
console
.
log
(
_rowArr
,
'_rowArr'
)
Array
.
isArray
(
_rowArr
)
&&
_rowArr
.
map
((
__rowArr
,
index
)
=>
{
Array
.
isArray
(
_rowArr
)
?
_rowArr
.
map
((
__rowArr
,
index
)
=>
{
_tempObj
[
_attributeNameArr
[
index
]]
=
__rowArr
})
})
:
_tempObj
[
_attributeNameArr
[
i
]]
=
_rowArr
_tempObj
[
'对应货品'
]
=
selectedGoods
.
length
>
0
&&
selectedGoods
[
0
].
id
_tempObj
[
'单价'
]
=
{}
_tableData
.
push
(
_tempObj
)
...
...
@@ -200,16 +198,22 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
console
.
log
(
'生成传输数据'
,
combineAttributeArray
,
attributeObjArr
,
attributeValObjArr
)
Array
.
isArray
(
combineAttributeArray
)
&&
combineAttributeArray
.
map
((
item
,
index
)
=>
{
// 当属性减少的时候 这个combine数组还是之前的
let
_tempArr
:
any
=
[],
_tempObj
:
any
=
{}
Array
.
isArray
(
item
)
&&
item
.
map
((
_item
,
_index
)
=>
{
Array
.
isArray
(
item
)
?
item
.
map
((
_item
,
_index
)
=>
{
let
_tempObject
:
any
=
{};
_tempObject
.
customerAttributeId
=
attributeObjArr
[
_index
].
customerAttributeId
_tempObject
.
customerAttributeName
=
attributeObjArr
[
_index
].
attributeName
_tempObject
.
customerAttributeValueId
=
attributeValObjArr
[
_index
].
find
(
__item
=>
__item
.
value
===
item
[
_index
]).
customerAttributeValueId
_tempObject
.
value
=
item
[
_index
]
_tempArr
.
push
(
_tempObject
)
})
:
_tempArr
.
push
({
customerAttributeId
:
attributeObjArr
[
0
].
customerAttributeId
,
customerAttributeName
:
attributeObjArr
[
0
].
attributeName
,
customerAttributeValueId
:
attributeValObjArr
[
0
][
0
].
customerAttributeValueId
,
value
:
item
.
toString
()
})
_paramsArray
.
push
({
goodsId
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'对应货品'
],
goodsCustomerAttributeList
:
_tempArr
,
unitPrice
:
_tableDataSource
[
index
]
&&
_tableDataSource
[
index
][
'单价'
]})
/*带上货品id 带上单价*/
})
setPriceAttributeParams
(
_paramsArray
)
console
.
log
(
_paramsArray
,
'params'
)
}
...
...
@@ -324,6 +328,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
name=
"price-form"
labelAlign=
"left"
ref=
{
priceFormRef
}
colon=
{
false
}
>
<
Form
.
Item
name=
"unitId"
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
c4b50366
...
...
@@ -85,12 +85,17 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
})
}
paramsArray
.
push
(
params
)
console
.
log
(
paramsArray
,
'paramsArray'
)
let
resultParams
=
Object
.
values
(
paramsArray
.
reduce
((
item
,
next
)
=>
{
let
_
resultParams
=
Object
.
values
(
paramsArray
.
reduce
((
item
,
next
)
=>
{
item
[
next
.
customerAttributeId
]
=
next
;
return
item
},{}))
console
.
log
(
resultParams
,
'result'
,
paramsArray
)
// 最终传输数据
//遍历 排空
let
resultParams
=
_resultParams
.
filter
((
_item
:
any
)
=>
_item
.
customerAttributeValueList
.
length
!=
0
)
console
.
log
(
resultParams
,
'resultParams'
)
// 最终传输数据
ProductStore
.
setProductSelectAttribute
(
resultParams
)
}
...
...
@@ -164,6 +169,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
labelAlign=
"left"
onFinish=
{
onFinish
}
ref=
{
productAttributeFormRef
}
colon=
{
false
}
>
<
Tabs
defaultActiveKey=
"1"
tabPosition=
"left"
>
{
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
c4b50366
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/addProductsItem/selectGoodsForm.tsx
View file @
c4b50366
...
...
@@ -6,7 +6,7 @@ import { PublicApi } from '@/services/api'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
EyeOutlined
}
from
'@ant-design/icons'
import
{
GetProductGoodsGetGoodsListResponseDetail
}
from
'@/services'
;
import
{
inject
,
observer
}
from
'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
...
...
@@ -28,7 +28,7 @@ export interface Iprops {
const
SelectGoodsForm
:
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
[
selectGoodsForm
]
=
Form
.
useForm
()
const
[
showSelectGoods
,
setIsSelectGoods
]
=
useState
(
false
)
const
[
selectGoodsRow
,
setSelectGoodsRow
]
=
useState
<
any
[]
>
([])
// 模态框选择的行数据
const
[
selectGoodsRow
,
setSelectGoodsRow
]
=
useState
<
GetProductGoodsGetGoodsListResponseDetail
[]
>
([])
// 模态框选择的行数据
const
[
selectedGoodsRowKeys
,
setSelectedGoodsRowKeys
]
=
useState
<
Array
<
number
>>
([])
const
{
ProductStore
}
=
store
...
...
@@ -104,6 +104,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
form=
{
selectGoodsForm
}
name=
"select-goods"
labelAlign=
"left"
colon=
{
false
}
>
<
Form
.
Item
label=
"是否选择货品"
...
...
src/services/index.ts
View file @
c4b50366
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/store/product/index.ts
View file @
c4b50366
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
IProductModule
}
from
'@/module/productModule'
;
// mobx要用到的数据类型
import
{
IProductModule
,
IProductSelectAttribute
}
from
'@/module/productModule'
;
// mobx要用到的数据类型
import
{
GetProductGoodsGetGoodsListResponseDetail
}
from
'@/services'
;
class
ProductStore
implements
IProductModule
{
@
observable
public
attributeLists
:
any
[]
=
[];
@
observable
public
productName
:
string
=
""
;
@
observable
public
productSelectAttribute
:
any
[]
=
[];
@
observable
public
selectedGoods
:
any
[]
=
[];
@
observable
public
productSelectAttribute
:
IProductSelectAttribute
[]
=
[];
@
observable
public
selectedGoods
:
GetProductGoodsGetGoodsListResponseDetail
[]
=
[];
@
observable
public
tableDataSource
:
any
[]
=
[];
@
observable
public
priceAttributeParams
:
any
[]
=
[];
/** 定义动作区块,外部调用,改变对应的状态 **/
// 可以改变存的testText值
@
action
.
bound
public
setAttributeLists
(
lists
:
any
[])
{
this
.
attributeLists
=
lists
;
}
@
action
.
bound
public
setProductName
(
name
:
string
)
{
this
.
productName
=
name
;
}
...
...
@@ -20,12 +28,12 @@ class ProductStore implements IProductModule {
}
@
action
.
bound
public
setSelectedGoods
(
list
:
any
[])
{
public
setSelectedGoods
(
list
:
GetProductGoodsGetGoodsListResponseDetail
[])
{
this
.
selectedGoods
=
list
;
}
@
action
.
bound
public
setTableDataSource
(
datas
:
any
[])
{
public
setTableDataSource
<
T
>
(
datas
:
T
[])
{
console
.
log
(
datas
,
'innerBox'
)
this
.
tableDataSource
=
datas
;
}
...
...
@@ -35,6 +43,11 @@ class ProductStore implements IProductModule {
this
.
tableDataSource
=
data
;
}
@
action
.
bound
public
setPriceAttributeParams
<
T
>
(
datas
:
T
[])
{
this
.
priceAttributeParams
=
datas
}
}
export
default
ProductStore
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