|
@@ -37,6 +37,7 @@ let pageSize = list_com_page_size_10;
|
|
export default class GoodsStorageLists extends Component {
|
|
export default class GoodsStorageLists extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
super(props);
|
|
super(props);
|
|
|
|
+ this.searchRef = React.createRef(); // 创建 ref
|
|
this.state = {
|
|
this.state = {
|
|
search_height:0,
|
|
search_height:0,
|
|
modal_width:700,
|
|
modal_width:700,
|
|
@@ -148,6 +149,15 @@ export default class GoodsStorageLists extends Component {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ title: `${sldComLanguage('发布渠道')}`,
|
|
|
|
+ dataIndex: 'distributionChannel',
|
|
|
|
+ align: 'center',
|
|
|
|
+ width: 100,
|
|
|
|
+ render: (text, record, index) => {
|
|
|
|
+ return this.state.siteList.find(item => item.value === text)?.title;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
title: `${sldComLanguage('店铺分类')}`,
|
|
title: `${sldComLanguage('店铺分类')}`,
|
|
dataIndex: 'innerLabelList',
|
|
dataIndex: 'innerLabelList',
|
|
align: 'center',
|
|
align: 'center',
|
|
@@ -220,6 +230,9 @@ export default class GoodsStorageLists extends Component {
|
|
),
|
|
),
|
|
},
|
|
},
|
|
],
|
|
],
|
|
|
|
+ siteList: [],
|
|
|
|
+ currentSite: {},
|
|
|
|
+ siteListLoading: false, // 站点tab列表loading
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -278,7 +291,7 @@ export default class GoodsStorageLists extends Component {
|
|
];
|
|
];
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
- this.get_list({ pageSize: pageSize });
|
|
|
|
|
|
+ this.getSiteList()
|
|
this.getTemplateList();
|
|
this.getTemplateList();
|
|
this.getStoreCat();//获取店铺分类
|
|
this.getStoreCat();//获取店铺分类
|
|
this.resize();
|
|
this.resize();
|
|
@@ -289,6 +302,26 @@ export default class GoodsStorageLists extends Component {
|
|
window.removeEventListener('resize', this.resize);
|
|
window.removeEventListener('resize', this.resize);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 获取站点列表
|
|
|
|
+ getSiteList = () => {
|
|
|
|
+ this.setState({ siteListLoading: true });
|
|
|
|
+ const { dispatch } = this.props;
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'common/get_site_list_data',
|
|
|
|
+ callback: (res) => {
|
|
|
|
+ if (res.state == 200) {
|
|
|
|
+ this.setState({ siteList: res.data, currentSite: res.data[0], siteListLoading: false })
|
|
|
|
+ // 设置当前站点
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'common/set_current_site',
|
|
|
|
+ payload: res.data[0]
|
|
|
|
+ })
|
|
|
|
+ this.get_list({ pageSize: pageSize, distributionChannel: res.data[0]?.value });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
resize = () =>{
|
|
resize = () =>{
|
|
const {search_height} = this.state;
|
|
const {search_height} = this.state;
|
|
if(this.refs.search_part!=undefined){
|
|
if(this.refs.search_part!=undefined){
|
|
@@ -332,10 +365,15 @@ export default class GoodsStorageLists extends Component {
|
|
|
|
|
|
//设置关联版式
|
|
//设置关联版式
|
|
setTemplate = () => {
|
|
setTemplate = () => {
|
|
- let {addData} = this.state;
|
|
|
|
|
|
+ let { addData, currentSite} = this.state;
|
|
this.setState({
|
|
this.setState({
|
|
operateData: JSON.parse(JSON.stringify(addData)),
|
|
operateData: JSON.parse(JSON.stringify(addData)),
|
|
- title:`${sldComLanguage('设置关联版式')}`,
|
|
|
|
|
|
+ // title:`${sldComLanguage('设置关联版式')}`,
|
|
|
|
+ title: <span style={{ color: '#fff' }}>
|
|
|
|
+ <span style={{ fontSize: '16px' }}>{ `${sldComLanguage('设置关联版式')}` } </span>
|
|
|
|
+ <span style={{ fontSize: '12px' }}>{ `( ${sldComLanguage('商品发布渠道为: ')}` }</span>
|
|
|
|
+ <span style={{ fontSize: '12px' }} >{ `${currentSite.title} )` }</span>
|
|
|
|
+ </span>,
|
|
modal_width: 500,
|
|
modal_width: 500,
|
|
modalVisible: true,
|
|
modalVisible: true,
|
|
type: 'template',
|
|
type: 'template',
|
|
@@ -371,7 +409,7 @@ export default class GoodsStorageLists extends Component {
|
|
//商品操作
|
|
//商品操作
|
|
operateGoods = (id, type) => {
|
|
operateGoods = (id, type) => {
|
|
this.setState({submiting:true});
|
|
this.setState({submiting:true});
|
|
- const { params } = this.state;
|
|
|
|
|
|
+ const { params, currentSite } = this.state;
|
|
const { dispatch } = this.props;
|
|
const { dispatch } = this.props;
|
|
let param_data = {};
|
|
let param_data = {};
|
|
let dis_type = '';
|
|
let dis_type = '';
|
|
@@ -386,8 +424,9 @@ export default class GoodsStorageLists extends Component {
|
|
param_data = id
|
|
param_data = id
|
|
} else if (type == 'template') {
|
|
} else if (type == 'template') {
|
|
dis_type = 'product/set_related_template';
|
|
dis_type = 'product/set_related_template';
|
|
- param_data = id
|
|
|
|
|
|
+ param_data = id;
|
|
}
|
|
}
|
|
|
|
+ param_data.distributionChannel = currentSite.value;
|
|
dispatch({
|
|
dispatch({
|
|
type: dis_type,
|
|
type: dis_type,
|
|
payload: param_data,
|
|
payload: param_data,
|
|
@@ -410,6 +449,9 @@ export default class GoodsStorageLists extends Component {
|
|
|
|
|
|
//获取数据列表
|
|
//获取数据列表
|
|
get_list = (params) => {
|
|
get_list = (params) => {
|
|
|
|
+ if (!params.distributionChannel) {
|
|
|
|
+ params.distributionChannel = this.state.currentSite.value;
|
|
|
|
+ }
|
|
this.setState({ initLoading: true });
|
|
this.setState({ initLoading: true });
|
|
const { dispatch } = this.props;
|
|
const { dispatch } = this.props;
|
|
dispatch({
|
|
dispatch({
|
|
@@ -479,8 +521,8 @@ export default class GoodsStorageLists extends Component {
|
|
this.setState({ [type]: datas });
|
|
this.setState({ [type]: datas });
|
|
};
|
|
};
|
|
|
|
|
|
- //搜索事件
|
|
|
|
- search = (data) => {
|
|
|
|
|
|
+ // 处理筛选数据
|
|
|
|
+ parseSearchData = (data) => {
|
|
const values = { ...data };
|
|
const values = { ...data };
|
|
//时间处理
|
|
//时间处理
|
|
if (values.search_create_time) {
|
|
if (values.search_create_time) {
|
|
@@ -488,11 +530,18 @@ export default class GoodsStorageLists extends Component {
|
|
values.endTime = values.search_create_time[1] ? values.search_create_time[1].format(dateFormat)+' 23:59:59' : '';
|
|
values.endTime = values.search_create_time[1] ? values.search_create_time[1].format(dateFormat)+' 23:59:59' : '';
|
|
values.search_create_time = '';
|
|
values.search_create_time = '';
|
|
}
|
|
}
|
|
- for(let i in values){
|
|
|
|
- if(values[i] == ''){
|
|
|
|
- delete values[i]
|
|
|
|
|
|
+ for (let i in values) {
|
|
|
|
+ if (values[i] == '') {
|
|
|
|
+ delete values[i];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return values;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //搜索事件
|
|
|
|
+ search = (data) => {
|
|
|
|
+ const values = this.parseSearchData(data);
|
|
this.setState({
|
|
this.setState({
|
|
formValues: values,
|
|
formValues: values,
|
|
params: { pageSize: pageSize }
|
|
params: { pageSize: pageSize }
|
|
@@ -523,15 +572,42 @@ export default class GoodsStorageLists extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 切换站点
|
|
|
|
+ setCurrentSite = (site) => {
|
|
|
|
+ const { dispatch } = this.props;
|
|
|
|
+ const data = this.searchRef.current.getFieldsValue(); // 调用子组件方法
|
|
|
|
+ const values = this.parseSearchData(data)
|
|
|
|
+ this.setState({ currentSite: site })
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'common/set_current_site',
|
|
|
|
+ payload: site
|
|
|
|
+ })
|
|
|
|
+ this.get_list({ pageSize: pageSize, distributionChannel: site.value, ...values });
|
|
|
|
+ }
|
|
|
|
+
|
|
render() {
|
|
render() {
|
|
- const { selectedRows, selectedRowKeys, search_data, columns, initLoading, data, modalVisible,operateData,title,modal_width,show_foot,submiting, search_height } = this.state;
|
|
|
|
|
|
+ const { siteListLoading, siteList, currentSite, selectedRows, selectedRowKeys, search_data, columns, initLoading, data, modalVisible,operateData,title,modal_width,show_foot,submiting, search_height } = this.state;
|
|
return (
|
|
return (
|
|
<div className={global.common_page} style={{ flex: 1,}}>
|
|
<div className={global.common_page} style={{ flex: 1,}}>
|
|
{sldLlineRtextAddGoodsAddMargin('#69A2F2', `${sldComLanguage('仓库中商品')}`, 0, 0, 10)}
|
|
{sldLlineRtextAddGoodsAddMargin('#69A2F2', `${sldComLanguage('仓库中商品')}`, 0, 0, 10)}
|
|
<div className={global.tableListForm} ref={'search_part'}>
|
|
<div className={global.tableListForm} ref={'search_part'}>
|
|
- <Search search_data={search_data} moreSearchToggle={() => this.moreSearchToggle()}
|
|
|
|
|
|
+ <Search ref={this.searchRef} search_data={search_data} moreSearchToggle={() => this.moreSearchToggle()}
|
|
seaSubmit={(data) => this.search(data)} seaReset={() => this.seaReset()}/>
|
|
seaSubmit={(data) => this.search(data)} seaReset={() => this.seaReset()}/>
|
|
</div>
|
|
</div>
|
|
|
|
+ {/* 站点tab列表 */}
|
|
|
|
+ <Spin spinning={siteListLoading}>
|
|
|
|
+ <div className={global.site_list}>
|
|
|
|
+ {siteList.map((site) => (
|
|
|
|
+ <div
|
|
|
|
+ key={site.name}
|
|
|
|
+ onClick={() => this.setCurrentSite(site)}
|
|
|
|
+ className={`${global.site_item} ${site.name === currentSite.name ? global.site_active : ''}`}
|
|
|
|
+ >
|
|
|
|
+ {site.title}
|
|
|
|
+ </div>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ </Spin>
|
|
{/*公共功能条-start*/}
|
|
{/*公共功能条-start*/}
|
|
<div className={global.operate_bg}
|
|
<div className={global.operate_bg}
|
|
style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
|