Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
89bb7a79
提交
89bb7a79
authored
6月 07, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
联调:行业方案,品牌,产品管理联调
上级
185fd540
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
1357 行增加
和
164 行删除
+1357
-164
.env.development
env/.env.development
+1
-1
interface.ts
src/api/interface.ts
+2
-2
categoryManage.ts
src/api/interface/categoryManage.ts
+26
-0
industryManageType.ts
src/api/interface/industryManageType.ts
+135
-0
produceManageType.ts
src/api/interface/produceManageType.ts
+35
-0
categoryManage.ts
src/api/modules/categoryManage.ts
+5
-5
industryManageAPI.ts
src/api/modules/industryManageAPI.ts
+41
-36
produceManageAPI.ts
src/api/modules/produceManageAPI.ts
+10
-6
index.ts
src/common/interface/PaginationEntity/index.ts
+0
-10
index.tsx
src/components/uploader/index.tsx
+1
-1
index.tsx
...ge/industryDetail/components/addOrEditSpecModal/index.tsx
+246
-0
index.tsx
...e/industryDetail/components/connectProduceModal/index.tsx
+292
-0
index.tsx
...ge/industryDetail/components/designateSpecModal/index.tsx
+133
-0
index.tsx
...nage/industryDetail/components/productListModal/index.tsx
+102
-0
index.tsx
src/pages/mallManage/industryManage/industryDetail/index.tsx
+0
-0
index.tsx
.../industryList/components/addOrEditIndustryModal/index.tsx
+46
-56
index.tsx
src/pages/mallManage/industryManage/industryList/index.tsx
+0
-0
propsType.ts
...pages/mallManage/industryManage/industryList/propsType.ts
+0
-18
index.tsx
...keManage/makeList/components/addOrEditMakeModal/index.tsx
+61
-0
index.tsx
src/pages/mallManage/makeManage/makeList/index.tsx
+45
-0
index.tsx
...oods/goodsAddOrEditOrDetail/components/stockSku/index.tsx
+66
-2
index.tsx
...ge/produceList/components/addOrEditProduceModal/index.tsx
+22
-23
index.tsx
src/pages/mallManage/produceManage/produceList/index.tsx
+0
-0
index.tsx
...Goods/rentAddOrEditOrDetail/components/stockSku/index.tsx
+66
-1
router.tsx
src/router/router.tsx
+12
-2
index.ts
src/utils/index.ts
+9
-0
vite.config.ts
vite.config.ts
+1
-1
没有找到文件。
env/.env.development
浏览文件 @
89bb7a79
...
...
@@ -7,7 +7,7 @@ VITE_REQUEST_BASE_URL='/api'
#VITE_REQUEST_BASE_URL='https://test.iuav.mmcuav.cn'
#本地测试
#VITE_REQUEST_BASE_URL='http://192.168.3.22:10001'
#VITE_REQUEST_BASE_URL='http://192.168.3.
22
:8099'
#VITE_REQUEST_BASE_URL='http://192.168.3.
17
:8099'
#VITE_REQUEST_BASE_URL='http://192.168.3.23:35150'
#版本
NODE_ENV='development'
...
...
src/api/interface.ts
浏览文件 @
89bb7a79
// 分页通用接口
export
interface
PaginationProps
{
pageSize
?
:
number
;
pageNo
?
:
number
;
pageSize
:
number
;
pageNo
:
number
;
}
// 通用返回接口(分页)
...
...
src/api/interface/categoryManage.ts
浏览文件 @
89bb7a79
// 分类详情
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
export
interface
GoodsInfo
{
goodsId
:
number
;
goodsImg
:
string
;
...
...
@@ -26,3 +28,27 @@ export interface categoryDec {
id
:
number
;
sortName
:
string
;
}
//分类列表类型
type
categoryReposeType
=
{
id
:
number
;
classifyName
:
string
;
icon
:
string
;
createTime
:
string
;
children
:
categoryReposeType
[];
directoryId
:
number
;
remark
:
string
;
};
export
type
categoryListType
=
InterItemFunction
<
{
directoryId
?:
number
;
type
?:
number
},
categoryReposeType
[]
>
;
//目录列表类型-不分页
export
type
directoryListType
=
InterFunction
<
{
type
:
number
},
{
id
:
number
;
directoryName
:
string
;
type
:
number
;
}[]
>
;
src/api/interface/industryManageType.ts
浏览文件 @
89bb7a79
// 行业方案-列表
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
//行业方案-列表
export
type
listIndustryType
=
InterItemFunction
<
{
categoryId
?:
number
;
solutionName
?:
string
},
{
categoryId
:
number
;
categoryName
:
string
;
createTime
:
string
;
description
:
string
;
id
:
number
;
solutionName
:
string
;
}[]
>
;
//行业方案-新增
export
type
industryAddType
=
InterFunction
<
{
categoryId
:
number
;
description
:
string
;
solutionName
:
string
},
null
>
;
//行业方案-编辑
export
type
industryEditType
=
InterFunction
<
{
categoryId
:
number
;
description
:
string
;
solutionName
:
string
;
id
?:
number
},
null
>
;
//行业方案-删除
export
type
industryDeleteType
=
InterFunction
<
{
id
:
number
},
null
>
;
//行业方案-详情
export
type
industryDetailType
=
InterFunction
<
{
id
:
number
},
{
categoryId
:
number
;
description
:
string
;
solutionName
:
string
;
categoryName
:
string
;
id
:
number
;
}
>
;
//行业方案-方案规格列表
export
type
industrySpecList
=
InterItemFunction
<
{
productSkuId
:
number
},
any
>
;
//行业方案-方案规格-新增
export
type
industrySpecAdd
=
InterFunction
<
{
industrySkuId
:
number
;
specImage
:
string
;
specName
:
string
;
productInventoryList
:
{
productSku
:
{
id
:
number
;
productName
:
string
;
productBrandId
:
number
;
productBrand
:
string
;
model
:
string
;
goodsTypeId
:
number
;
directoryId
:
number
;
directoryName
:
string
;
};
productSpecList
:
{
id
:
number
;
partNo
:
string
;
specImage
:
string
;
specName
:
string
;
versionDesc
:
string
;
productSkuId
:
number
;
}[];
select
:
number
;
}[];
},
null
>
;
//行业方案-方案规格-删除
export
type
removeIndustrySpecType
=
InterFunction
<
{
id
:
number
},
any
>
;
//行业方案-方案规格-详情
export
type
industrySpecDetailType
=
InterFunction
<
{
industrySpecId
:
number
},
{
id
:
number
;
industrySkuId
:
number
;
specImage
:
string
;
specName
:
string
;
productInventoryList
:
{
productSku
:
{
id
:
number
;
productName
:
string
;
productBrandId
:
number
;
productBrand
:
string
;
model
:
string
;
goodsTypeId
:
number
;
directoryId
:
number
;
categoryName
:
string
;
};
productSkuId
:
number
;
productSpecList
:
{
id
:
number
;
partNo
:
string
;
specImage
:
string
;
specName
:
string
;
versionDesc
:
string
;
productSkuId
:
number
;
}[];
select
:
number
;
}[];
}
>
;
//行业-方案规格-编辑
export
type
editIndustrySpecType
=
InterFunction
<
{
id
:
number
;
industrySkuId
:
number
;
specImage
:
string
;
specName
:
string
;
productInventoryList
:
{
productSku
:
{
id
:
number
;
productName
:
string
;
productBrandId
:
number
;
productBrand
:
string
;
model
:
string
;
goodsTypeId
:
number
;
directoryId
:
number
;
directoryName
:
string
;
};
productSpecList
:
{
id
:
number
;
partNo
:
string
;
specImage
:
string
;
specName
:
string
;
versionDesc
:
string
;
productSkuId
:
number
;
}[];
select
:
number
;
}[];
},
null
>
;
src/api/interface/produceManageType.ts
浏览文件 @
89bb7a79
...
...
@@ -8,3 +8,38 @@ export type MakeListType = InterItemFunction<
id
:
number
;
}[]
>
;
//产品-列表
export
type
productListType
=
InterItemFunction
<
{
categoryId
?:
number
;
directoryId
?:
number
;
productName
?:
string
},
{
id
:
number
;
productName
:
string
;
productBrandId
:
number
;
productBrand
:
string
;
model
:
string
;
categoriesId
:
number
;
categoryName
:
string
;
directoryId
:
number
;
directoryName
:
string
;
productSpecList
:
{
id
:
number
;
partNo
:
string
;
specImage
:
string
;
specName
:
string
;
versionDesc
:
string
;
productSkuId
:
number
;
}[];
}[]
>
;
//产品-规格-列表
export
type
ProductSpecListType
=
InterItemFunction
<
{
productSkuId
:
number
},
{
id
:
number
;
partNo
:
string
;
specImage
:
string
;
specName
:
string
;
versionDesc
:
string
;
productSkuId
:
number
;
}[]
>
;
src/api/modules/categoryManage.ts
浏览文件 @
89bb7a79
import
axios
from
'../request'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
categoryListType
,
directoryListType
}
from
'~/api/interface/categoryManage'
;
export
class
CategoryManageAPI
{
// 分类管理
// 分类目录
static
directoryList
=
(
)
=>
{
return
axios
.
get
(
'
uavgoods/directory/directoryList'
);
static
getDirectoryList
:
directoryListType
=
(
params
)
=>
{
return
axios
.
get
(
'
/pms/classify/getDirectoryList'
,
{
params
}
);
};
// 新增或编辑目录
...
...
@@ -24,8 +24,8 @@ export class CategoryManageAPI {
};
// 分类列表
static
get
ListGoodsTypeList
=
(
type
:
number
):
any
=>
{
return
axios
.
get
(
`uavgoods/mgoods/getGoodsTypeInfoList/
${
type
}
`
);
static
get
CategoryList
:
categoryListType
=
(
data
)
=>
{
return
axios
.
post
(
'/pms/classify/getClassificationList'
,
data
);
};
// PC端-根据分类信息新增自定义规格-下拉选项 (只查产品类型)
...
...
src/api/modules/industryManageAPI.ts
浏览文件 @
89bb7a79
import
axios
from
'../request'
;
import
{
industryAddType
,
industryDeleteType
,
industryDetailType
,
industryEditType
,
industrySpecAdd
,
industrySpecDetailType
,
industrySpecList
,
listIndustryType
,
removeIndustrySpecType
,
editIndustrySpecType
,
}
from
'~/api/interface/industryManageType'
;
export
class
IndustryManageAPI
{
// 行业列表
static
get
FirstIndustryTypeInfo
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'uavgoods/appgoods/getFirstGoodsTypeInfo/2'
,
{
params
}
);
static
get
IndustryList
:
listIndustryType
=
(
data
)
=>
{
return
axios
.
post
(
'/pms/industry/spec/listPageIndustrySku'
,
data
);
};
// 行业sku管理-方案规格管理-分页列表
static
listPageIndustrySpec
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'uavgoods/industry/spec/listPageIndustrySpec'
,
{
params
,
});
};
// 行业sku管理---分页列表
static
listPageIndustrySku
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'uavgoods/industry/spec/listPageIndustrySku'
,
data
);
// 行业-新增
static
addIndustryRequest
:
industryAddType
=
(
data
)
=>
{
return
axios
.
post
(
'/pms/industry/spec/addIndustrySku'
,
data
);
};
// 行业
sku管理---新增行业sku
static
addIndustrySku
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'
uavgoods/industry/spec/add
IndustrySku'
,
data
);
// 行业
---编辑
static
editIndustryRequest
:
industryEditType
=
(
data
)
=>
{
return
axios
.
post
(
'
/pms/industry/spec/edit
IndustrySku'
,
data
);
};
// 行业
sku管理---编辑行业sku
static
editIndustrySku
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'uavgoods/industry/spec/editIndustrySku'
,
data
);
// 行业
--删除
static
removeIndustryRequest
:
industryDeleteType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/industry/spec/removeIndustrySku'
,
{
params
}
);
};
// 行业sku管理---删除行业sku
static
removeIndustrySku
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'uavgoods/industry/spec/removeIndustrySku'
,
{
params
});
// 行业-详情
static
getIndustryDetail
:
industryDetailType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/industry/spec/getIndustrySkuDetail'
,
{
params
,
});
};
// 行业sku管理-详情-基本信息
static
getIndustrySkuDetail
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'uavgoods/industry/spec/getIndustrySkuDetail'
,
{
// 行业-方案规格-列表
static
getIndustrySpecList
:
industrySpecList
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/industry/spec/listPageIndustrySpec'
,
{
params
,
});
};
// 行业sku管理---方案规格管理---新增方案规格
static
addIndustrySpec
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'uavgoods/industry/spec/addIndustrySpec'
,
data
);
// 行业---方案规格管理---新增方案规格
static
addIndustrySpec
:
industrySpecAdd
=
(
data
)
=>
{
return
axios
.
post
(
'/pms/industry/spec/addIndustrySpec'
,
data
);
};
// 行业sku管理---方案规格管理---编辑行业规格
static
editIndustrySpec
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'
uavgood
s/industry/spec/editIndustrySpec'
,
data
);
static
editIndustrySpec
:
editIndustrySpecType
=
(
data
)
=>
{
return
axios
.
post
(
'
/pm
s/industry/spec/editIndustrySpec'
,
data
);
};
// 行业
sku管理
---方案规格管理---删除行业规格
static
removeIndustrySpec
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'
uavgood
s/industry/spec/removeIndustrySpec'
,
{
params
});
// 行业---方案规格管理---删除行业规格
static
removeIndustrySpec
:
removeIndustrySpecType
=
(
params
)
=>
{
return
axios
.
get
(
'
/pm
s/industry/spec/removeIndustrySpec'
,
{
params
});
};
// 行业sku管理---方案规格管理---获取价格配置信息 (获取价格配置)
...
...
@@ -69,8 +74,8 @@ export class IndustryManageAPI {
};
// 行业sku管理---方案规格管理---单个方案规格回显 (查看产品清单)
static
getIndustrySpecDetail
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'
uavgood
s/industry/spec/getIndustrySpecDetail'
,
{
static
getIndustrySpecDetail
:
industrySpecDetailType
=
(
params
)
=>
{
return
axios
.
get
(
'
/pm
s/industry/spec/getIndustrySpecDetail'
,
{
params
,
});
};
...
...
src/api/modules/produceManageAPI.ts
浏览文件 @
89bb7a79
import
axios
from
'../request'
;
import
{
MakeListType
}
from
'~/api/interface/produceManageType'
;
import
{
MakeListType
,
productListType
,
ProductSpecListType
,
}
from
'~/api/interface/produceManageType'
;
export
class
ProduceManageAPI
{
// 产品
sku
管理-分页列表
static
listPageProductSku
=
(
data
:
unknown
)
=>
{
return
axios
.
post
(
'
uavgood
s/product/spec/listPageProductSku'
,
data
);
// 产品管理-分页列表
static
listPageProductSku
:
productListType
=
(
data
)
=>
{
return
axios
.
post
(
'
/pm
s/product/spec/listPageProductSku'
,
data
);
};
// 产品sku管理-删除产品sku
static
removeProductSku
=
(
params
:
unknown
)
=>
{
...
...
@@ -41,7 +45,7 @@ export class ProduceManageAPI {
};
// 产品sku管理-产品规格管理-分页列表
static
listPageProductSpec
=
(
params
:
unknown
)
=>
{
return
axios
.
get
(
'
uavgood
s/product/spec/listPageProductSpec'
,
{
params
});
static
listPageProductSpec
:
ProductSpecListType
=
(
params
)
=>
{
return
axios
.
get
(
'
/pm
s/product/spec/listPageProductSpec'
,
{
params
});
};
}
src/common/interface/PaginationEntity/index.ts
浏览文件 @
89bb7a79
/*
* @Author: 龚洪江
* @Date: 2022-07-26 11:43:44
* @LastEditors: 龚洪江
* @LastEditTime: 2022-07-26 11:45:29
* @FilePath: \code\mmc-store\src\common\PaginationEntity\index.ts
* @Description:
*
* Copyright (c) 2022 by 龚洪江 2238959530@qq.com, All Rights Reserved.
*/
export
interface
PaginationEntity
{
pageNo
:
number
;
pageSize
:
number
;
...
...
src/components/uploader/index.tsx
浏览文件 @
89bb7a79
...
...
@@ -112,7 +112,7 @@ export const Uploader: React.FC<PropsType> = (props) => {
if
(
defaultFileList
?.
length
)
{
setFileList
(
defaultFileList
);
}
},
[]);
},
[
defaultFileList
]);
return
(
<
div
className=
'uploader-view'
>
{
listType
===
'text'
?
(
...
...
src/pages/mallManage/industryManage/industryDetail/components/addOrEditSpecModal/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
Modal
,
message
,
Table
,
Button
,
ModalProps
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
InterDataType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
Uploader
}
from
'~/components/uploader'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
productListType
}
from
'~/api/interface/produceManageType'
;
import
{
IndustryManageAPI
}
from
'~/api'
;
import
{
filterObjAttr
}
from
'~/utils'
;
import
{
industrySpecDetailType
}
from
'~/api/interface/industryManageType'
;
//自定义产品返回类型
type
selfProduceItemType
=
InterDataType
<
productListType
>
[
'list'
][
0
]
&
{
radio
?:
number
;
};
//方案规格详情返回类型
type
specDetailType
=
InterDataType
<
industrySpecDetailType
>
;
interface
PropsType
{
produceSpecList
:
selfProduceItemType
[];
close
:
()
=>
void
;
connectSpecModalShow
:
()
=>
void
;
industrySkuId
:
number
;
handleSuccess
:
()
=>
void
;
specDetail
:
specDetailType
;
}
const
AddOrEditSpecModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
produceSpecList
,
close
,
connectSpecModalShow
,
industrySkuId
,
specDetail
,
handleSuccess
,
})
=>
{
// 表格事件
const
[
form
]
=
Form
.
useForm
<
{
specName
:
string
;
specImage
:
string
;
list
:
any
}
>
();
//图片
const
[
fileList
,
setFileList
]
=
useState
<
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[]
>
([]);
// 表格结构
const
columns
:
ColumnsType
<
selfProduceItemType
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
selfProduceItemType
,
index
:
number
)
=>
{
return
(
pagination
.
pageNo
-
1
)
*
pagination
.
pageSize
+
index
+
1
;
},
},
{
title
:
'产品名称'
,
dataIndex
:
'productName'
,
align
:
'center'
},
{
title
:
'产品类型'
,
dataIndex
:
'categoryName'
,
align
:
'center'
},
{
title
:
'型号'
,
dataIndex
:
'model'
,
align
:
'center'
},
{
title
:
'产品品牌'
,
dataIndex
:
'productBrand'
,
align
:
'center'
},
{
title
:
'产品规格'
,
// align: "left",
width
:
300
,
ellipsis
:
true
,
render
:
(
record
:
selfProduceItemType
)
=>
{
if
(
record
.
radio
===
0
)
{
return
'不指定'
;
}
return
record
.
productSpecList
.
map
((
i
:
any
,
index
:
number
)
=>
(
<
div
key=
{
index
}
>
{
i
.
specName
}
(
{
i
.
partNo
}
)
</
div
>
));
},
onHeaderCell
:
()
=>
{
return
{
style
:
{
textAlign
:
'center'
,
},
};
},
},
];
// 分页
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
>
({
pageNo
:
1
,
pageSize
:
10
,
});
// 关闭弹窗
const
handleClosed
=
async
()
=>
{
setFileList
([]);
form
.
resetFields
();
close
();
};
// 打开关联产品弹窗
const
handleConnectSpecModalShow
=
()
=>
{
connectSpecModalShow
();
};
//图片上传成功
const
uploadFileSuccess
=
(
fileList
:
{
id
:
number
;
name
:
string
;
uid
:
number
;
url
:
string
;
}[],
)
=>
{
form
.
setFieldsValue
({
specImage
:
fileList
[
0
].
url
,
});
};
// 触发表单验证
const
handleSubmit
=
()
=>
{
form
.
validateFields
()
.
then
((
values
)
=>
{
const
productInventoryList
:
any
=
produceSpecList
.
map
((
v
)
=>
({
productSku
:
{
id
:
v
.
id
,
directoryId
:
v
.
directoryId
,
goodsTypeId
:
v
.
categoriesId
,
model
:
v
.
model
,
productBrand
:
v
.
productBrand
,
productBrandId
:
v
.
productBrandId
,
productName
:
v
.
productName
,
},
select
:
v
.
radio
,
productSpecList
:
v
.
productSpecList
,
}));
IndustryManageAPI
[
specDetail
.
id
?
'editIndustrySpec'
:
'addIndustrySpec'
]({
...
filterObjAttr
(
values
,
[
'list'
]),
productInventoryList
,
industrySkuId
,
id
:
specDetail
.
id
?
specDetail
.
id
:
undefined
,
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
specDetail
.
id
?
'编辑成功'
:
'新增成功'
);
form
.
resetFields
();
handleSuccess
();
}
});
})
.
catch
((
err
)
=>
{
message
.
warning
(
err
.
errorFields
[
0
].
errors
[
0
]).
then
();
});
};
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
pagination
.
pageNo
=
pageNo
;
pagination
.
pageSize
=
pageSize
;
setPagination
({
...
pagination
});
};
// componentsDidMounted
useEffect
(()
=>
{
form
.
setFieldsValue
({
list
:
produceSpecList
.
length
!==
0
?
produceSpecList
:
undefined
,
});
},
[
produceSpecList
]);
useEffect
(()
=>
{
form
.
setFieldsValue
({
specName
:
specDetail
.
specName
||
undefined
,
specImage
:
specDetail
.
specImage
||
undefined
,
});
if
(
specDetail
.
specImage
)
{
setFileList
([
{
id
:
Math
.
random
(),
name
:
'img'
,
uid
:
Math
.
random
(),
url
:
specDetail
.
specImage
,
},
]);
}
else
{
setFileList
([]);
}
},
[
specDetail
]);
return
(
<>
<
Modal
open=
{
open
}
title=
'新增'
onCancel=
{
handleClosed
}
onOk=
{
handleSubmit
}
destroyOnClose
width=
{
800
}
>
<
Form
name=
'form'
form=
{
form
}
layout=
'horizontal'
>
<
Form
.
Item
name=
'specName'
label=
'规格名称'
rules=
{
[{
required
:
true
,
message
:
'请输入方案产品名称'
}]
}
>
<
Input
placeholder=
'请输入规格名称'
allowClear
style=
{
{
width
:
'400px'
}
}
maxLength=
{
30
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'specImage'
label=
'规格图片'
rules=
{
[{
required
:
true
,
message
:
'请上传规格图片'
}]
}
>
<
Uploader
listType=
'picture-card'
fileUpload
onChange=
{
uploadFileSuccess
}
defaultFileList=
{
fileList
}
>
<
UploadOutlined
/>
</
Uploader
>
</
Form
.
Item
>
<
Form
.
Item
label=
'产品清单'
name=
'list'
rules=
{
[{
required
:
true
,
message
:
'请选择产品清单'
}]
}
>
<
Button
type=
'primary'
onClick=
{
handleConnectSpecModalShow
}
>
添加关联
</
Button
>
</
Form
.
Item
>
<
Form
.
Item
>
<
Table
size=
'small'
dataSource=
{
produceSpecList
}
columns=
{
columns
}
rowKey=
'id'
style=
{
{
width
:
'100%'
}
}
pagination=
{
{
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
pageNo
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
}
}
bordered
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
</>
);
};
export
default
AddOrEditSpecModal
;
src/pages/mallManage/industryManage/industryDetail/components/connectProduceModal/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Form
,
Input
,
message
,
Modal
,
ModalProps
,
Radio
,
Select
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
CategoryManageAPI
,
ProduceManageAPI
}
from
'~/api'
;
import
{
InterDataType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
productListType
}
from
'~/api/interface/produceManageType'
;
import
{
categoryListType
}
from
'~/api/interface/categoryManage'
;
//自定义产品返回类型
type
selfProduceItemType
=
InterDataType
<
productListType
>
[
'list'
][
0
]
&
{
radio
?:
number
;
};
//分类通用类型
type
categoryResponseType
=
InterDataType
<
categoryListType
>
[
'list'
];
const
{
Option
}
=
Select
;
interface
PropsType
{
close
:
()
=>
void
;
data
:
selfProduceItemType
[];
//已被关联产品
connectProduceSubmit
:
(
data
:
selfProduceItemType
[])
=>
void
;
toDesignateSpec
:
(
id
:
number
)
=>
void
;
}
// 表单提交
interface
FormType
{
keyword
?:
string
;
userType
?:
number
;
roleId
?:
number
;
accountStatus
?:
number
;
}
// 当前选择的参数
const
ConnectProduceModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
close
,
connectProduceSubmit
,
data
,
toDesignateSpec
,
})
=>
{
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
selfProduceItemType
[]
>
([]);
// 所有表格数据
const
[
allTableData
,
setAllTableData
]
=
useState
<
selfProduceItemType
[]
>
([]);
// 产品类型列表
const
[
productTypeList
,
setProductTypeList
]
=
useState
<
categoryResponseType
>
([]);
// 表格结构
const
columns
:
ColumnsType
<
selfProduceItemType
>
=
[
{
title
:
'产品名称'
,
dataIndex
:
'productName'
,
align
:
'center'
},
{
title
:
'产品类型'
,
dataIndex
:
'categoryName'
,
align
:
'center'
,
width
:
'100px'
,
},
{
title
:
'型号'
,
dataIndex
:
'model'
,
align
:
'center'
},
{
title
:
'产品品牌'
,
dataIndex
:
'productBrand'
,
align
:
'center'
},
{
title
:
'产品规格'
,
align
:
'center'
,
width
:
'250px'
,
render
:
(
record
)
=>
{
return
(
<
div
>
<
Radio
.
Group
onChange=
{
(
e
)
=>
{
const
{
value
}
=
e
.
target
;
// 通过index生成新tableData
const
list
=
tableData
.
map
((
i
)
=>
{
if
(
i
.
id
===
record
.
id
)
{
return
{
...
i
,
radio
:
value
,
};
}
return
i
;
});
setTableData
(
list
);
const
allList
=
allTableData
.
map
((
i
)
=>
{
if
(
i
.
id
===
record
.
id
)
{
return
{
...
i
,
radio
:
value
,
};
}
return
i
;
});
setAllTableData
(
allList
);
}
}
value=
{
record
.
radio
}
disabled=
{
getTableDisable
(
record
.
id
)
}
>
<
Radio
value=
{
0
}
>
不指定
</
Radio
>
<
Radio
value=
{
1
}
>
指定
</
Radio
>
</
Radio
.
Group
>
<
Button
disabled=
{
getTableDisable
(
record
.
id
)
||
record
.
radio
===
0
}
onClick=
{
()
=>
toDesignateSpecClick
(
record
.
id
)
}
type=
'link'
>
去指定
</
Button
>
</
div
>
);
},
},
];
// 表格分页配置
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
;
totalPage
:
number
}
>
({
totalCount
:
0
,
pageSize
:
10
,
pageNo
:
1
,
totalPage
:
0
,
});
// 表格多选
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
// 表格多选事件
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[],
selectedRows
:
selfProduceItemType
[])
=>
{
// 新增
const
isAdd
:
boolean
=
newSelectedRowKeys
.
some
((
v
:
React
.
Key
)
=>
!
selectedRowKeys
.
includes
(
v
));
// 删除
const
isDelete
:
boolean
=
selectedRowKeys
.
some
(
(
v
:
React
.
Key
)
=>
!
newSelectedRowKeys
.
includes
(
v
),
);
let
rowKeys
:
React
.
Key
[]
=
[];
if
(
isAdd
)
{
const
filterList
:
selfProduceItemType
[]
=
selectedRows
.
filter
(
(
v
:
selfProduceItemType
)
=>
!
selectedRowKeys
.
includes
(
v
.
id
),
);
const
obj
:
selfProduceItemType
|
undefined
=
filterList
.
find
(
(
v
:
selfProduceItemType
)
=>
!
v
.
productSpecList
,
);
const
currentKeys
:
React
.
Key
[]
=
filterList
.
filter
((
v
:
selfProduceItemType
)
=>
v
.
productSpecList
)
.
map
((
v
:
selfProduceItemType
)
=>
v
.
id
);
rowKeys
=
[...
selectedRowKeys
,
...
currentKeys
];
if
(
obj
)
{
message
.
warning
(
`请先为产品
${
obj
?.
productName
}
添加规格
`);
}
} else if (isDelete) {
rowKeys = selectedRowKeys.filter((v: React.Key) => {
const bol: boolean = tableData.every((i: selfProduceItemType) => i.id !== v);
return bol || newSelectedRowKeys.includes(v);
});
}
setSelectedRowKeys(rowKeys);
};
// 根据id判断是否有操作的权限
const getTableDisable = (id: number) => {
return !selectedRowKeys.includes(id);
};
//获取产品列表
const getListPageProductSku = (value?: any, tip?: string) => {
ProduceManageAPI.listPageProductSku({
pageNo: pagination.pageNo,
pageSize: pagination.pageSize,
...value,
}).then(({ result: { list, totalPage, totalCount } }) => {
pagination.totalCount = totalCount;
pagination.totalPage = totalPage;
setPagination(pagination);
// 设置产品规格默认项
if (!list) {
return setTableData([]);
}
const arr = list.map((i) => {
return {
...i,
radio: 0,
};
});
const brr = arr.map((i) => {
const item = data.find((j) => j.id === i.id);
if (item?.id === i.id) {
return {
...i,
radio: item.radio,
};
}
return i;
});
setTableData(brr);
if (tip === 'all') {
setAllTableData(brr);
}
});
};
// 翻页
const paginationChange = (pageNo: number, pageSize: number) => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
getListPageProductSku();
};
// 表单提交
const onFinish = (val: FormType) => {
// 在这里对提交的数据做处理,如range转为开始和结束时间
const data = Object.fromEntries(
// 过滤为空项
Object.entries({
...val,
}).filter((i) => i[1] !== '' && i[1] !== undefined && i[1] !== null),
);
getListPageProductSku(data);
};
// 获取产品类型
const getProduceTypeList = () => {
CategoryManageAPI.getCategoryList({ directoryId: 1, type: 4, pageNo: 1, pageSize: 99999 }).then(
({ result }) => {
setProductTypeList(result.list || []);
},
);
};
// 关联产品的数据提交
const handleSubmit = () => {
if (selectedRowKeys.length === 0) {
return message.warning('请选择关联产品');
}
const connectProduceList = allTableData.filter((i) => selectedRowKeys.includes(i.id));
connectProduceSubmit(connectProduceList);
};
// componentsDidMounted
useEffect(() => {
getListPageProductSku();
getListPageProductSku({ pageNo: 1, pageSize: 99999 }, 'all');
getProduceTypeList();
if (data.length !== 0) {
setSelectedRowKeys(data.map((v) => v.id));
}
}, [data]);
//去指定
const toDesignateSpecClick = (id: number) => {
toDesignateSpec(id);
};
return (
<>
<Modal
open={open}
title='关联产品'
onCancel={() => close()}
onOk={handleSubmit}
destroyOnClose
width={860}
>
<Form name='basic' layout='inline' onFinish={onFinish} style={{ marginBottom: '20px' }}>
<Form.Item name='productName' label='产品名称'>
<Input placeholder='请输入产品名称' allowClear />
</Form.Item>
<Form.Item name='goodsTypeId' label='产品类型'>
<Select placeholder='请选择产品类型' allowClear>
{productTypeList.map((i, j) => (
<Option value={i.id} key={j}>
{i.classifyName}
</Option>
))}
</Select>
</Form.Item>
<Form.Item>
<Button type='primary' htmlType='submit'>
搜索
</Button>
</Form.Item>
</Form>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
scroll={{ x: '100%' }}
bordered
rowSelection={{
selectedRowKeys,
onChange: onSelectChange,
}}
pagination={{
total: pagination.totalCount,
pageSize: pagination.pageSize,
current: pagination.pageNo,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `
当前
$
{
range
[
0
]}
-
$
{
range
[
1
]}
条记录
/
共
$
{
total
}
条数据
`,
}}
/>
</Modal>
</>
);
};
export default ConnectProduceModal;
src/pages/mallManage/industryManage/industryDetail/components/designateSpecModal/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Image
,
message
,
Modal
,
ModalProps
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ProduceManageAPI
}
from
'~/api'
;
import
{
InterDataType
,
PaginationProps
}
from
'~/api/interface'
;
import
{
ProductSpecListType
}
from
'~/api/interface/produceManageType'
;
//产品sku返回类型
type
produceSpecType
=
InterDataType
<
ProductSpecListType
>
[
'list'
];
interface
PropsType
{
data
:
produceSpecType
;
produceSpecSelectEvent
:
(
data
:
produceSpecType
)
=>
void
;
productId
:
number
;
onCancel
:
()
=>
void
;
}
const
DesignateSpecModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
onCancel
,
data
,
produceSpecSelectEvent
,
productId
,
})
=>
{
// 表格多选
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
// 表格多选事件
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
setSelectedRowKeys
(
newSelectedRowKeys
);
};
// 产品sku列表
const
[
productSpecList
,
setProductSpecList
]
=
useState
<
produceSpecType
>
([]);
// 表格结构
const
columns
:
ColumnsType
<
{
id
:
number
}
>
=
[
{
title
:
'规格名称'
,
dataIndex
:
'specName'
,
align
:
'center'
},
{
title
:
'规格图片'
,
dataIndex
:
'specImage'
,
align
:
'center'
,
render
:
(
record
)
=>
{
return
<
Image
width=
{
50
}
height=
{
50
}
src=
{
record
.
specImage
}
alt=
'图片'
/>;
},
},
{
title
:
'版本描述'
,
dataIndex
:
'versionDesc'
,
align
:
'center'
},
{
title
:
'料号'
,
dataIndex
:
'partNo'
,
align
:
'center'
},
];
// 表格分页配置
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
;
totalPage
:
number
}
>
({
totalCount
:
0
,
pageSize
:
5
,
pageNo
:
1
,
totalPage
:
0
,
});
// 翻页
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
pagination
.
pageNo
=
pageNo
;
pagination
.
pageSize
=
pageSize
;
getProduceSpecList
(
productId
);
};
// 提交数据到父组件
const
handleSubmit
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
return
message
.
warning
(
'请选择产品规格'
);
}
const
selectProductSpecList
=
productSpecList
.
filter
((
i
)
=>
selectedRowKeys
.
includes
(
i
.
id
));
if
(
selectProductSpecList
.
length
===
0
)
{
return
message
.
warning
(
'请选择产品规格'
);
}
produceSpecSelectEvent
(
selectProductSpecList
);
};
//取消
const
handleCancel
=
()
=>
{
setSelectedRowKeys
([]);
onCancel
();
};
//获取产品-sku
const
getProduceSpecList
=
(
productSkuId
:
number
)
=>
{
ProduceManageAPI
.
listPageProductSpec
({
productSkuId
,
pageSize
:
pagination
.
pageSize
,
pageNo
:
pagination
.
pageNo
,
}).
then
(({
result
})
=>
{
setProductSpecList
(
result
.
list
||
[]);
pagination
.
totalPage
=
result
.
totalPage
;
pagination
.
totalCount
=
result
.
totalCount
;
setPagination
(
pagination
);
setSelectedRowKeys
(
data
.
map
((
v
)
=>
v
.
id
));
});
};
useEffect
(()
=>
{
if
(
productId
)
{
getProduceSpecList
(
productId
);
}
},
[
productId
]);
return
(
<
div
>
<
Modal
title=
'指定产品规格'
open=
{
open
}
onCancel=
{
handleCancel
}
width=
{
768
}
zIndex=
{
1010
}
onOk=
{
handleSubmit
}
>
<
Table
dataSource=
{
productSpecList
}
columns=
{
columns
}
rowKey=
'id'
style=
{
{
width
:
'100%'
}
}
size=
'small'
bordered
rowSelection=
{
{
selectedRowKeys
,
onChange
:
onSelectChange
,
}
}
pagination=
{
{
total
:
pagination
.
totalCount
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
</
Modal
>
</
div
>
);
};
export
default
DesignateSpecModal
;
src/pages/mallManage/industryManage/industryDetail/components/productListModal/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
React
,
{
FC
}
from
'react'
;
import
{
Modal
,
ModalProps
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
industrySpecDetailType
}
from
'~/api/interface/industryManageType'
;
//方案规格详情返回类型
type
productInventoryListType
=
InterDataType
<
industrySpecDetailType
>
[
'productInventoryList'
];
interface
PropsType
{
data
:
productInventoryListType
;
onCancel
:
()
=>
void
;
}
const
ProductListModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
onCancel
,
data
})
=>
{
// 表格结构
const
columns
:
ColumnsType
<
productInventoryListType
[
0
]
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
width
:
'50px'
,
render
:
(
text
:
string
,
record
:
productInventoryListType
[
0
],
index
:
number
)
=>
{
return
index
+
1
;
},
},
{
title
:
'产品名称'
,
dataIndex
:
'productName'
,
align
:
'center'
,
width
:
'100px'
,
render
:
(
text
:
string
,
record
:
productInventoryListType
[
0
])
=>
{
return
record
.
productSku
.
productName
;
},
},
{
title
:
'产品类型'
,
dataIndex
:
'typeName'
,
align
:
'center'
,
width
:
'100px'
,
render
:
(
text
:
string
,
record
:
productInventoryListType
[
0
])
=>
{
return
record
.
productSku
.
goodsTypeId
;
},
},
{
title
:
'型号'
,
dataIndex
:
'model'
,
align
:
'center'
,
width
:
'100px'
,
render
:
(
text
:
string
,
record
:
productInventoryListType
[
0
])
=>
{
return
record
.
productSku
.
model
;
},
},
{
title
:
'产品品牌'
,
dataIndex
:
'productBrand'
,
align
:
'center'
,
width
:
'100px'
,
render
:
(
text
:
string
,
record
:
productInventoryListType
[
0
])
=>
{
return
record
.
productSku
.
productName
;
},
},
{
title
:
'产品规格'
,
// align: "left",
width
:
'200px'
,
render
:
(
text
:
string
,
record
)
=>
{
if
(
record
.
select
===
0
)
{
return
'不指定'
;
}
return
record
.
productSpecList
.
map
((
i
:
any
,
index
:
number
)
=>
(
<
div
key=
{
index
}
>
{
i
.
specName
}
(
{
i
.
partNo
}
)
</
div
>
));
},
onHeaderCell
:
()
=>
{
return
{
style
:
{
textAlign
:
'center'
,
},
};
},
},
];
// 关闭
const
onClose
=
()
=>
{
onCancel
();
};
return
(
<
Modal
open=
{
open
}
title=
'产品清单'
onCancel=
{
onClose
}
destroyOnClose
footer=
{
null
}
width=
{
800
}
>
<
Table
size=
'small'
dataSource=
{
data
}
columns=
{
columns
}
rowKey=
'id'
style=
{
{
width
:
'100%'
}
}
bordered
pagination=
{
false
}
/>
</
Modal
>
);
};
export
default
ProductListModal
;
src/pages/mallManage/industryManage/industryDetail/index.tsx
浏览文件 @
89bb7a79
差异被折叠。
点击展开。
src/pages/mallManage/industryManage/industryList/components/addOrEditIndustryModal/index.tsx
浏览文件 @
89bb7a79
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
Modal
,
message
,
Select
}
from
'antd'
;
import
React
,
{
FC
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Modal
,
message
,
Select
,
ModalProps
}
from
'antd'
;
import
{
IndustryManageAPI
}
from
'~/api'
;
import
{
IndustrySkuType
}
from
'../../propsType'
;
import
'./index.scss'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
categoryListType
}
from
'~/api/interface/categoryManage'
;
import
{
industryAddType
,
listIndustryType
}
from
'~/api/interface/industryManageType'
;
type
categoryResponseType
=
InterDataType
<
categoryListType
>
[
'list'
];
type
industryListType
=
InterDataType
<
listIndustryType
>
[
'list'
];
type
industryFormType
=
InterReqType
<
industryAddType
>
;
interface
PropsType
{
visible
:
boolean
;
closed
:
any
;
data
:
IndustrySkuType
;
categoryIndustryList
:
categoryResponseType
;
industryItem
:
Partial
<
industryListType
[
0
]
>
|
undefined
;
close
:
()
=>
void
;
addOrEditSuccess
:
()
=>
void
;
}
const
{
Option
}
=
Select
;
function
AddOrEditIndustryModal
(
props
:
PropsType
)
{
// 父组件传参
const
{
visible
,
closed
,
data
}
=
props
;
const
AddOrEditIndustryModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
categoryIndustryList
,
industryItem
,
close
,
addOrEditSuccess
,
})
=>
{
// 表格事件
const
[
form
]
=
Form
.
useForm
();
// 所属行业列表
const
[
industryType
,
setIndustryType
]
=
useState
<
{
label
:
string
;
val
:
number
}[]
>
([]);
const
[
form
]
=
Form
.
useForm
<
industryFormType
>
();
// 关闭弹窗
const
handleClosed
=
async
()
=>
{
form
.
setFieldsValue
({
goodsTypeId
:
undefined
,
description
:
undefined
,
solutionName
:
undefined
,
id
:
undefined
,
});
closed
();
};
// 获取所属行业列表
const
getFirstIndustryTypeInfo
=
async
()
=>
{
const
res
:
any
=
await
IndustryManageAPI
.
getFirstIndustryTypeInfo
({});
if
(
res
&&
res
.
code
===
'200'
)
{
const
arr
=
res
.
result
.
map
((
i
:
{
goodsMasterType
:
string
;
goodsMasterTypeId
:
number
})
=>
{
return
{
label
:
i
.
goodsMasterType
,
val
:
i
.
goodsMasterTypeId
,
};
});
setIndustryType
(
arr
);
}
const
handleClosed
=
()
=>
{
form
.
resetFields
();
close
();
};
// 触发表单验证
const
handleSubmit
=
()
=>
{
form
.
validateFields
()
.
then
(
async
(
values
)
=>
{
const
obj
=
{
...
data
,
...
values
};
const
res
:
any
=
await
IndustryManageAPI
[
!
obj
.
id
?
'addIndustrySku'
:
'editIndustrySku'
](
obj
,
);
const
res
:
any
=
await
IndustryManageAPI
[
industryItem
?
'editIndustryRequest'
:
'addIndustryRequest'
]({
...
values
,
id
:
industryItem
?
industryItem
.
id
:
undefined
});
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
await
handleClosed
();
handleClosed
();
addOrEditSuccess
();
}
else
{
message
.
warning
(
res
.
message
);
}
...
...
@@ -62,19 +52,19 @@ function AddOrEditIndustryModal(props: PropsType) {
message
.
warning
(
err
.
errorFields
[
0
].
errors
[
0
]).
then
();
});
};
// componentsDidMounted
useEffect
(()
=>
{
if
(
!
data
)
return
;
// console.log("新增编辑弹窗 -->", data);
form
.
setFieldsValue
({
...
data
,
});
getFirstIndustryTypeInfo
().
then
();
},
[
data
]);
if
(
industryItem
)
{
form
.
setFieldsValue
({
solutionName
:
industryItem
.
solutionName
,
categoryId
:
industryItem
.
categoryId
,
description
:
industryItem
.
description
,
});
}
},
[
industryItem
]);
return
(
<
Modal
open=
{
visible
}
title=
{
data
.
id
?
'修改'
:
'新增'
}
open=
{
open
}
title=
{
industryItem
?
'修改'
:
'新增'
}
onCancel=
{
handleClosed
}
onOk=
{
handleSubmit
}
destroyOnClose
...
...
@@ -96,15 +86,15 @@ function AddOrEditIndustryModal(props: PropsType) {
<
Input
placeholder=
'请输入方案名称'
allowClear
maxLength=
{
30
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'
goodsType
Id'
name=
'
category
Id'
label=
'所属行业'
rules=
{
[{
required
:
true
,
message
:
'请选择所属行业'
}]
}
>
<
Select
placeholder=
'请选择所属行业'
allowClear
>
{
industryType
.
map
((
i
,
j
)
=>
(
<
Option
value=
{
i
.
val
}
key=
{
j
}
>
{
i
.
label
}
</
Option
>
{
categoryIndustryList
.
map
((
i
,
j
)
=>
(
<
Select
.
Option
value=
{
i
.
id
}
key=
{
j
}
>
{
i
.
classifyName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
...
...
@@ -124,5 +114,5 @@ function AddOrEditIndustryModal(props: PropsType) {
</
Form
>
</
Modal
>
);
}
}
;
export
default
AddOrEditIndustryModal
;
src/pages/mallManage/industryManage/industryList/index.tsx
浏览文件 @
89bb7a79
差异被折叠。
点击展开。
src/pages/mallManage/industryManage/industryList/propsType.ts
浏览文件 @
89bb7a79
// 行业sku管理-分页列表
export
interface
IndustrySkuType
{
goodsTypeId
:
number
|
undefined
;
description
:
string
;
solutionName
:
string
;
id
:
number
;
createTime
:
string
;
}
// 行业sku管理-行业规格管理-分页列表
export
interface
IndustrySpecType
{
createTime
?:
string
;
productSkuId
?:
number
;
id
:
number
;
industrySkuId
?:
number
;
list
:
inventoryType
[];
specImage
:
string
;
specName
:
string
;
}
// 行业sku管理-行业规格管理-清单列表
export
interface
inventoryType
{
productSku
:
productSkuType
;
...
...
src/pages/mallManage/makeManage/makeList/components/addOrEditMakeModal/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
{
FC
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Modal
,
message
,
ModalProps
}
from
'antd'
;
import
{
MakeManageAPI
}
from
'~/api'
;
interface
selfProps
{
makeItem
:
any
;
onOk
:
()
=>
void
;
handleCancel
:
()
=>
void
;
}
const
AddOrEditModal
:
FC
<
ModalProps
&
selfProps
>
=
({
open
,
handleCancel
,
onOk
,
title
,
makeItem
,
})
=>
{
const
[
form
]
=
Form
.
useForm
<
{
brandName
:
string
}
>
();
const
submit
=
()
=>
{
form
.
validateFields
().
then
((
value
)
=>
{
MakeManageAPI
[
makeItem
?
'editBrandInfo'
:
'addBrandInfo'
]({
...
value
,
id
:
makeItem
?.
id
,
}).
then
(({
code
,
message
:
msg
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
makeItem
?
'编辑成功'
:
'新增成功'
);
onOk
();
form
.
resetFields
();
}
else
{
message
.
error
(
msg
);
}
});
});
};
const
onCancel
=
()
=>
{
form
.
resetFields
();
handleCancel
();
};
useEffect
(()
=>
{
if
(
makeItem
)
{
form
.
setFieldsValue
({
brandName
:
makeItem
.
brandName
,
});
}
},
[
makeItem
]);
return
(
<
Modal
open=
{
open
}
onOk=
{
submit
}
onCancel=
{
onCancel
}
title=
{
title
}
>
<
Form
form=
{
form
}
>
<
Form
.
Item
label=
'品牌名称'
name=
'brandName'
rules=
{
[{
required
:
true
,
message
:
'请输入品牌名称!'
}]
}
>
<
Input
placeholder=
'请输入品牌名称'
maxLength=
{
10
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddOrEditModal
;
src/pages/mallManage/makeManage/makeList/index.tsx
0 → 100644
浏览文件 @
89bb7a79
import
{
Button
,
Table
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
// import AddOrEditMakeModal from './components/addOrEditMakeModal';
const
MakeList
=
()
=>
{
const
columns
:
ColumnsType
<
any
>
=
[
{
title
:
'品牌名称'
,
align
:
'center'
,
dataIndex
:
'brandName'
,
},
{
title
:
'创建时间'
,
align
:
'center'
,
dataIndex
:
'createTime'
,
},
{
title
:
'操作'
,
align
:
'center'
,
render
:
()
=>
(
<>
<
Button
type=
'link'
>
编辑
</
Button
>
<
Button
type=
'link'
danger
>
删除
</
Button
>
</>
),
},
];
return
(
<
div
className=
'make-list'
>
<
div
className=
'make-list-operate'
>
<
Button
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
>
新增
</
Button
>
</
div
>
<
div
className=
'make-list-content'
style=
{
{
marginTop
:
'10px'
}
}
>
<
Table
bordered
columns=
{
columns
}
/>
</
div
>
{
/*<AddOrEditMakeModal />*/
}
</
div
>
);
};
export
default
MakeList
;
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/components/stockSku/index.tsx
浏览文件 @
89bb7a79
...
...
@@ -2,7 +2,71 @@ import React from 'react';
import
{
Table
,
Button
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
'./index.scss'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
const
columns
:
ColumnsType
<
any
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
`产品类型`
,
align
:
'center'
,
// dataIndex: "goodsTypeId",
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'规格名称'
,
align
:
'center'
,
dataIndex
:
'goodsSpecName'
,
},
{
title
:
`方案`
,
align
:
'center'
,
dataIndex
:
'skuName'
,
},
{
title
:
'选项来源'
,
align
:
'center'
,
dataIndex
:
'specIds'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'选择方式'
,
align
:
'center'
,
dataIndex
:
'chooseType'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'是否必选'
,
align
:
'center'
,
dataIndex
:
'must'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'规格单位'
,
align
:
'center'
,
dataIndex
:
'skuUnitId'
,
render
:
()
=>
{
return
<
div
>
--
</
div
>;
},
},
{
title
:
'操作'
,
align
:
'center'
,
width
:
'20%'
,
render
:
()
=>
{
return
(
<
div
>
<
Button
type=
'link'
style=
{
{
marginRight
:
'10px'
}
}
>
编辑
</
Button
>
<
Button
type=
'link'
>
删除
</
Button
>
</
div
>
);
},
},
];
const
StockSku
:
React
.
FC
<
any
>
=
()
=>
{
return
(
<
div
className=
'stock-sku'
>
...
...
@@ -13,7 +77,7 @@ const StockSku: React.FC<any> = () => {
添加规格
</
Button
>
</
div
>
<
Table
size=
'small'
bordered
rowKey=
'id'
pagination=
{
false
}
/>
<
Table
size=
'small'
bordered
rowKey=
'id'
pagination=
{
false
}
columns=
{
columns
}
/>
</
div
>
</
div
>
);
...
...
src/pages/mallManage/produceManage/produceList/components/addOrEditProduceModal/index.tsx
浏览文件 @
89bb7a79
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
Modal
,
message
,
Select
}
from
'antd'
;
import
{
ProduceManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
,
ProduceManageAPI
}
from
'~/api'
;
import
{
ProductSkuType
,
MakeItemEntity
}
from
'../../propsType'
;
// import { categoryDec } from '@/api/modules/goods';
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
categoryListType
,
directoryListType
}
from
'~/api/interface/categoryManage'
;
//目录返回类型
type
directoryType
=
InterDataType
<
directoryListType
>
;
//分类返回类型
type
categoryType
=
InterDataType
<
categoryListType
>
[
'list'
];
interface
PropsType
{
visible
:
boolean
;
closed
:
any
;
data
:
ProductSkuType
|
undefined
;
makeList
:
MakeItemEntity
[];
decList
:
any
;
decList
:
directoryType
;
}
const
{
Option
}
=
Select
;
...
...
@@ -18,9 +24,7 @@ function AddOrEditProduceModal(props: PropsType) {
// 父组件传参
const
{
visible
,
closed
,
data
,
makeList
,
decList
}
=
props
;
// 产品类型下拉列表
const
[
productTypeSelectList
,
setProductTypeSelectList
]
=
useState
<
{
label
:
string
;
val
:
number
}[]
>
([]);
const
[
productTypeSelectList
,
setProductTypeSelectList
]
=
useState
<
categoryType
>
([]);
// 表格事件
const
[
form
]
=
Form
.
useForm
();
// 关闭弹窗
...
...
@@ -46,28 +50,23 @@ function AddOrEditProduceModal(props: PropsType) {
message
.
warning
(
err
.
errorFields
[
0
].
errors
[
0
]).
then
();
});
};
// 获取产品类型列表
const
getListGoodsTypeList
=
async
(
type
:
number
)
=>
{
const
res
:
any
=
await
ProduceManageAPI
.
getListGoodsTypeList
(
type
);
if
(
res
&&
res
.
code
===
'200'
)
{
const
arr
=
res
.
result
.
map
((
i
:
{
goodsMasterType
:
string
;
goodsMasterTypeId
:
number
})
=>
{
return
{
label
:
i
.
goodsMasterType
,
val
:
i
.
goodsMasterTypeId
,
};
});
setProductTypeSelectList
(
arr
);
}
//根据目录获取分类
const
getCategoryListByDirectory
=
(
directoryId
:
number
)
=>
{
CategoryManageAPI
.
getCategoryList
({
pageNo
:
1
,
pageSize
:
99999
,
directoryId
,
type
:
4
}).
then
(
({
result
})
=>
{
setProductTypeSelectList
(
result
.
list
||
[]);
},
);
};
// 目录修改
const
decSelectChange
=
(
value
:
number
)
=>
{
form
.
setFieldValue
(
'goodsTypeId'
,
undefined
);
get
ListGoodsTypeList
(
value
);
get
CategoryListByDirectory
(
value
);
};
// componentsDidMounted
useEffect
(()
=>
{
if
(
!
data
)
return
;
get
ListGoodsTypeList
(
data
.
directoryId
);
get
CategoryListByDirectory
(
data
.
directoryId
);
form
.
setFieldsValue
({
...
data
,
});
...
...
@@ -103,7 +102,7 @@ function AddOrEditProduceModal(props: PropsType) {
<
Select
placeholder=
'请选择产品目录'
onChange=
{
decSelectChange
}
>
{
decList
.
map
((
v
:
any
,
index
:
number
)
=>
(
<
Select
.
Option
value=
{
v
.
id
}
key=
{
index
}
>
{
v
.
sort
Name
}
{
v
.
directory
Name
}
</
Select
.
Option
>
))
}
</
Select
>
...
...
@@ -122,8 +121,8 @@ function AddOrEditProduceModal(props: PropsType) {
}
>
{
productTypeSelectList
.
map
((
i
,
j
)
=>
(
<
Option
value=
{
i
.
val
}
key=
{
j
}
>
{
i
.
label
}
<
Option
value=
{
i
.
id
}
key=
{
j
}
>
{
i
.
classifyName
}
</
Option
>
))
}
</
Select
>
...
...
src/pages/mallManage/produceManage/produceList/index.tsx
浏览文件 @
89bb7a79
差异被折叠。
点击展开。
src/pages/mallManage/rentGoods/rentAddOrEditOrDetail/components/stockSku/index.tsx
浏览文件 @
89bb7a79
...
...
@@ -2,8 +2,73 @@ import React from 'react';
import
{
Table
,
Button
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
'./index.scss'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
const
StockSku
:
React
.
FC
<
any
>
=
()
=>
{
const
columns
:
ColumnsType
<
any
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
`产品类型`
,
align
:
'center'
,
// dataIndex: "goodsTypeId",
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'规格名称'
,
align
:
'center'
,
dataIndex
:
'goodsSpecName'
,
},
{
title
:
`方案`
,
align
:
'center'
,
dataIndex
:
'skuName'
,
},
{
title
:
'选项来源'
,
align
:
'center'
,
dataIndex
:
'specIds'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'选择方式'
,
align
:
'center'
,
dataIndex
:
'chooseType'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'是否必选'
,
align
:
'center'
,
dataIndex
:
'must'
,
render
:
()
=>
<
div
>
--
</
div
>,
},
{
title
:
'规格单位'
,
align
:
'center'
,
dataIndex
:
'skuUnitId'
,
render
:
()
=>
{
return
<
div
>
--
</
div
>;
},
},
{
title
:
'操作'
,
align
:
'center'
,
width
:
'20%'
,
render
:
()
=>
{
return
(
<
div
>
<
Button
type=
'link'
style=
{
{
marginRight
:
'10px'
}
}
>
编辑
</
Button
>
<
Button
type=
'link'
>
删除
</
Button
>
</
div
>
);
},
},
];
return
(
<
div
className=
'stock-sku'
>
<
div
className=
'stock-sku-title'
>
库存规格
</
div
>
...
...
@@ -13,7 +78,7 @@ const StockSku: React.FC<any> = () => {
添加规格
</
Button
>
</
div
>
<
Table
size=
'small'
bordered
rowKey=
'id'
pagination=
{
false
}
/>
<
Table
size=
'small'
bordered
rowKey=
'id'
pagination=
{
false
}
columns=
{
columns
}
/>
</
div
>
</
div
>
);
...
...
src/router/router.tsx
浏览文件 @
89bb7a79
...
...
@@ -62,6 +62,7 @@ const ProduceListView = React.lazy(() => import('~/pages/mallManage/produceManag
const
ProduceDetailView
=
React
.
lazy
(
()
=>
import
(
'~/pages/mallManage/produceManage/produceDetail'
),
);
//产品详情
const
MakeListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/makeManage/makeList'
));
const
IndustryListView
=
React
.
lazy
(()
=>
import
(
'~/pages/mallManage/industryManage/industryList'
));
//行业列表
const
IndustryDetailView
=
React
.
lazy
(
()
=>
import
(
'~/pages/mallManage/industryManage/industryDetail'
),
...
...
@@ -304,10 +305,19 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path
:
'/mallManage/makeList'
,
element
:
withLoadingComponent
(<
MakeListView
/>),
meta
:
{
id
:
10170
,
icon
:
<
SmileOutlined
/>,
title
:
'品牌管理'
,
},
},
{
path
:
'/mallManage/industryList'
,
element
:
withLoadingComponent
(<
IndustryListView
/>),
meta
:
{
id
:
101
7
0
,
id
:
101
8
0
,
icon
:
<
SmileOutlined
/>,
title
:
'行业方案'
,
},
...
...
@@ -316,7 +326,7 @@ export const routerList: Array<RouteObjectType> = [
path
:
'/mallManage/industryDetail'
,
element
:
withLoadingComponent
(<
IndustryDetailView
/>),
meta
:
{
id
:
101
8
0
,
id
:
101
9
0
,
icon
:
<
SmileOutlined
/>,
title
:
'行业详情'
,
hidden
:
true
,
...
...
src/utils/index.ts
浏览文件 @
89bb7a79
...
...
@@ -33,3 +33,12 @@ export const urlToBase64 = (url: string) => {
};
});
};
// 过滤对象属性
export
const
filterObjAttr
=
(
obj
:
any
,
key
:
string
[])
=>
{
return
Object
.
keys
(
obj
).
reduce
((
pre
:
any
,
cur
:
string
)
=>
{
if
(
!
key
.
includes
(
cur
))
{
pre
[
cur
]
=
obj
[
cur
];
}
return
pre
;
},
{});
};
vite.config.ts
浏览文件 @
89bb7a79
...
...
@@ -12,7 +12,7 @@ export default defineConfig({
proxy
:
{
'/api'
:
{
// target: 'http://192.168.3.111:8077',后端女
target
:
'http
s://test.iuav.shop
'
,
target
:
'http
://192.168.3.17:8099
'
,
changeOrigin
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
/^
\/
api/
,
''
),
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论