Commit dd4eb6d885257ce82c09f5ac0836d19790af7420

Authored by 莫红玲
2 parents 188c91fc 06ef2f65

Merge branch 'deco_shop' into 'master'

Deco shop



See merge request !699
Showing 18 changed files with 130 additions and 481 deletions
src/pages/decoration/deco/DecorationPromotion/DecorateFullFree/components/Modal.tsx
... ... @@ -8,7 +8,7 @@ import ShopDetail from './ShopDetail';
8 8 import AddBrand from './AddBrand';
9 9 import AddSerie from './AddSerie';
10 10 import AddSpec from './AddSpec';
11   -import ShopSelect from '@/components/ShopSelectNew';
  11 +import ShopSelect from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
12 12  
13 13 const FormItem = Form.Item;
14 14 const { RangePicker } = DatePicker;
... ... @@ -316,7 +316,7 @@ export default function AddModal(props: Props) {
316 316  元(包含)  送  
317 317 <InputNumber defaultValue={item.expect} onChange={(value) => _changeTwo(value, index)} min={0} />
318 318 &nbsp;元 &nbsp;&nbsp;
319   - <DeleteOutlined onClick={() => deleteItem(index)} style={{ color: 'red', fontSize: 16 }} />
  319 + <DeleteOutlined rev={undefined} onClick={() => deleteItem(index)} style={{ color: 'red', fontSize: 16 }} />
320 320 </div>
321 321 ))}
322 322 <Button type="primary" style={{ marginTop: 20 }} onClick={addList}>
... ... @@ -328,7 +328,7 @@ export default function AddModal(props: Props) {
328 328 <RangePicker format="YYYY-MM-DD" disabledDate={(current) => disalbeTime(current)} />
329 329 </Form.Item>
330 330 <FormItem label="适用门店" name="applyShops" rules={[{ required: true, message: '请选择门店' }]}>
331   - <ShopSelect multiple />
  331 + <ShopSelect />
332 332 </FormItem>
333 333 <FormItem name="decos" label="必选装潢">
334 334 <Tabs type="card">
... ...
src/pages/decoration/deco/DecorationPromotion/DecorationPackage/components/Modal.tsx
1 1 import React, { useEffect, useState } from 'react';
2   -import { Modal, Form, Input, DatePicker, Select, InputNumber, Button, message } from 'antd';
  2 +import { Modal, Form, Input, DatePicker, InputNumber, Button, message } from 'antd';
3 3 import { DeleteOutlined } from '@ant-design/icons';
4 4 import moment from 'moment';
5 5 import { useStore } from '../index';
6   -import { getShopApi } from "@/common/api";
7   -import useInitial from '@/hooks/useInitail';
8 6 import * as API from '../api';
9   -import ShopSelect from "@/components/ShopSelectNew";
  7 +import ShopSelect from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
10 8  
11 9 const FormItem = Form.Item;
12   -const { Option } = Select;
13 10 const { RangePicker } = DatePicker;
14 11  
15 12 interface Props {
16   - setLoading: (value:any) => any
  13 + setLoading: (value: any) => any
17 14 }
18 15  
19   -export default function AddModal(props:Props) {
  16 +export default function AddModal(props: Props) {
20 17 const {setLoading} = props;
21   - const { data: shopData } = useInitial(getShopApi, [], {});
22 18 const [form] = Form.useForm();
23   - const { visible, setVisible, confirLoading, current = {} } = useStore();
  19 + const { visible, setVisible, confirLoading } = useStore();
24 20 const [discountList, setDiscountList] = useState<any>([]);
25 21  
26 22 useEffect(() => {
... ... @@ -122,6 +118,7 @@ export default function AddModal(props:Props) {
122 118 />
123 119 &nbsp;元 &nbsp;&nbsp;
124 120 <DeleteOutlined
  121 + rev={undefined}
125 122 onClick={() => deleteItem(index)}
126 123 style={{ color: "red", fontSize: 16 }}
127 124 />
... ... @@ -137,7 +134,7 @@ export default function AddModal(props:Props) {
137 134 name="applyShops"
138 135 rules={[{ required: true, message: "请选择门店" }]}
139 136 >
140   - <ShopSelect multiple />
  137 + <ShopSelect />
141 138 </FormItem>
142 139 </Form>
143 140 </Modal>
... ...
src/pages/decoration/deco/DecorationPromotion/SPPManage/subPage/AddPage.tsx
1 1 import React, { useState } from 'react';
2   -import { Button, DatePicker, Input, Select, Card, Form, message} from 'antd';
  2 +import { Button, DatePicker, Input, Card, Form, message} from 'antd';
3 3 import moment from 'moment';
4   -import {getShopApi} from '@/common/api';
5   -import useInitial from '@/hooks/useInitail';
6 4 import ShopDetail from './ShopDetail';
7 5 import * as API from '../api';
8 6 import { useStore } from "../index";
9   -import ShopSelect from "@/components/ShopSelectNew";
  7 +import ShopSelect from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
10 8  
11 9 const { RangePicker } = DatePicker;
12   -const { Option } = Select;
13   -
14 10 const FormItem = Form.Item;
15 11  
16 12 interface Props {
... ... @@ -19,13 +15,11 @@ interface Props {
19 15  
20 16 export default function AddPage({onReturn}: Props) {
21 17 const { setCurrentBreadcrumb} = useStore();
22   - const {data: shopData} = useInitial(getShopApi, [], {});
23 18 const [specData, setSpecData] = useState<any>([]);
24   -
25 19 const [form] = Form.useForm();
26 20  
27   - const onFinish = (value:any) => {
28   - specData.map((res:any) => {
  21 + const onFinish = (value: any) => {
  22 + specData.map((res: any) => {
29 23 res.goodsId = res.id;
30 24 return res;
31 25 });
... ... @@ -47,7 +41,7 @@ export default function AddPage({onReturn}: Props) {
47 41 });
48 42 };
49 43  
50   - const disalbeTime = (current:any) => {
  44 + const disalbeTime = (current: any) => {
51 45 return current && current <moment().subtract(1, "days"); //当天之前的不可选,不包括当天
52 46 //return current && current < moment().endOf(‘day');当天之前的不可选,包括当天
53 47 };
... ... @@ -82,22 +76,7 @@ export default function AddPage({onReturn}: Props) {
82 76 name="applyShops"
83 77 rules={[{ required: true, message: "请选择门店" }]}
84 78 >
85   - <ShopSelect multiple />
86   - {/* <Select
87   - optionFilterProp="children"
88   - mode="multiple"
89   - labelInValue
90   - allowClear
91   - style={{ width: 300 }}
92   - placeholder="请选择门店"
93   - >
94   - {shopData &&
95   - shopData.map((shop: any) => (
96   - <Option value={shop.id} key={shop.id}>
97   - {shop.name}
98   - </Option>
99   - ))}
100   - </Select> */}
  79 + <ShopSelect />
101 80 </FormItem>
102 81 <FormItem name="goods" label="装潢促销">
103 82 <ShopDetail
... ...
src/pages/decoration/deco/DeoGoodsManagement/components/AddShop.tsx
1   -import React, { useEffect, useState } from "react";
2   -import {
3   - Modal,
4   - Form,
5   - Input,
6   - DatePicker,
7   - Select,
8   - InputNumber,
9   - Button,
10   - message,
11   -} from "antd";
12   -import { DeleteOutlined } from "@ant-design/icons";
13   -import moment from "moment";
14   -import { useStore } from "../index";
15   -import { getShopApi } from "@/common/api";
  1 +import React, { useEffect } from "react";
  2 +import { Modal, Form, message } from "antd";
16 3 import useInitial from "@/hooks/useInitail";
17 4 import * as API from "../api";
18   -import ShopSelect from "@/components/ShopSelectNew";
  5 +import SelectorWithFull from '@/components/SelectorWithFull';
  6 +import { getShops } from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew/api';
19 7  
20 8 const FormItem = Form.Item;
21 9  
... ... @@ -29,7 +17,7 @@ export default function AddModal(props: Props) {
29 17 const { current, setCurrent, setLoading } = props;
30 18 const [form] = Form.useForm();
31 19  
32   - const {data: afterList} = useInitial(getShopApi, [], {})
  20 + const { data } = useInitial(getShops, [], {})
33 21  
34 22 useEffect(() => {
35 23 form.resetFields();
... ... @@ -39,11 +27,11 @@ export default function AddModal(props: Props) {
39 27 const _list = (value.applyShops || []).map((e: any) => {
40 28 return {
41 29 goodsId: current.goodsId,
42   - shopId: e.shopId
  30 + shopId: e.value
43 31 }
44 32 })
45 33 API.upListApi({goods: _list })
46   - .then((res) => {
  34 + .then(() => {
47 35 setCurrent({ visible: false, goodsId: undefined });
48 36 setLoading(true);
49 37 })
... ... @@ -52,18 +40,26 @@ export default function AddModal(props: Props) {
52 40  
53 41 return (
54 42 <Modal
55   - visible={current.visible}
  43 + open={current.visible}
56 44 onCancel={() => setCurrent({visible: false, goosId: undefined})}
57 45 width={800}
58 46 onOk={() => form.submit()}
59 47 >
60   - <Form form={form} onFinish={handleSave}>
  48 + <Form form={form} onFinish={handleSave} labelCol={{span: 3}} wrapperCol={{span: 18}}>
61 49 <FormItem
62 50 label="适用门店"
63 51 name="applyShops"
64 52 rules={[{ required: true, message: "请选择门店" }]}
65 53 >
66   - <ShopSelect multiple style={{width: 500}} type={2} shopIds={afterList.map(e => e.id)} />
  54 + <SelectorWithFull
  55 + treeNodeFilterProp="label"
  56 + labelInValue
  57 + data={data}
  58 + multiple
  59 + allowClear
  60 + autoClearSearchValue={false}
  61 + placeholder="请选择门店或输入关键词筛选"
  62 + />
67 63 </FormItem>
68 64 </Form>
69 65 </Modal>
... ...
src/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew/api.ts 0 → 100644
  1 +import type { http } from "@/typing/http";
  2 +import request from "@/utils/request";
  3 +import { DECORATION } from "@/utils/host";
  4 +
  5 +export interface Shop {
  6 + value: number;
  7 + label: string;
  8 +}
  9 +export function getShops(): http.PromiseResp<Shop[]> {
  10 + return request.get(`${DECORATION}/deco/common/get/group/deco/shops`)
  11 +}
0 12 \ No newline at end of file
... ...
src/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew/index.tsx 0 → 100644
  1 +import useInitial from '@/hooks/useInitail';
  2 +import React from 'react';
  3 +import type { Shop } from './api';
  4 +import { getShops } from './api';
  5 +import SelectorWithFull from '@/components/SelectorWithFull';
  6 +import st from './style.less'
  7 +
  8 +interface Props {
  9 + value?: Shop[]
  10 + onChange?: (v: Shop[]) => void
  11 +}
  12 +
  13 +export default function ShopSelect(props: Props) {
  14 + const { value, onChange } = props;
  15 + const { data } = useInitial(getShops, [], {})
  16 + return (
  17 + <SelectorWithFull
  18 + treeNodeFilterProp="label"
  19 + value={value}
  20 + onChange={onChange}
  21 + labelInValue
  22 + data={data}
  23 + multiple
  24 + allowClear
  25 + autoClearSearchValue={false}
  26 + placeholder="请选择门店或输入关键词筛选"
  27 + className={st.select_deco}
  28 + />
  29 + )
  30 +}
0 31 \ No newline at end of file
... ...
src/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew/style.less 0 → 100644
  1 +.select_deco {
  2 + margin-bottom: 20px;
  3 +}
0 4 \ No newline at end of file
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/DecoContent/index.tsx
1 1 import { Button, Checkbox, Popconfirm, Cascader, Divider, Input, message, Radio, Row, Spin, Table } from 'antd';
2   -import { CheckboxChangeEvent } from 'antd/lib/checkbox';
  2 +import type { CheckboxChangeEvent } from 'antd/lib/checkbox';
3 3 import React from 'react';
4 4 import { useStore } from '../../index';
5   -import { WorkItem, getSeriesApi, getSpecApi } from '../../../../api';
  5 +import type { WorkItem} from '../../../../api';
  6 +import { getSeriesApi, getSpecApi } from '../../../../api';
6 7 import ShopModal from '../../../../../common/Shop';
7 8  
8 9 const { Search } = Input;
... ... @@ -14,14 +15,13 @@ interface Props {
14 15  
15 16 type TableType = '列表' | '选择';
16 17  
17   -function Deco({ type = 1, multiple = true }: Props) {
  18 +function Deco({ multiple = true }: Props) {
18 19 const {
19 20 list,
20 21 setParams,
21 22 decoSelected: selected,
22 23 setDecoSelected: setSelected,
23 24 loading,
24   - paginationConfig,
25 25 brandOptions,
26 26 setBrandOptions,
27 27 } = useStore();
... ... @@ -55,7 +55,7 @@ function Deco({ type = 1, multiple = true }: Props) {
55 55 setParams({ keywords: e }, true);
56 56 }
57 57  
58   - function filterBySeries(value: any[], selectedOptions: any) {
  58 + function filterBySeries(value: any[]) {
59 59 if (value.length > 0) {
60 60 const seriesFilter = {
61 61 brandId: value[0],
... ... @@ -87,7 +87,7 @@ function Deco({ type = 1, multiple = true }: Props) {
87 87 getSeriesApi(targetOption.id)
88 88 .then((res: any) => {
89 89 const { data = [] } = res;
90   - targetOption.children = data.map((list: any, index: any) => ({
  90 + targetOption.children = data.map((list: any) => ({
91 91 id: list.id,
92 92 name: list.name,
93 93 isLeaf: false,
... ... @@ -104,7 +104,7 @@ function Deco({ type = 1, multiple = true }: Props) {
104 104 const { data = [] } = res;
105 105 targetOption.loading = false;
106 106 targetOption.children = [];
107   - data.forEach((list, index) => {
  107 + data.forEach((list) => {
108 108 targetOption.children.push({
109 109 id: list.id,
110 110 name: list.name,
... ... @@ -215,7 +215,7 @@ function Deco({ type = 1, multiple = true }: Props) {
215 215 当前选择({selected.length} 个)
216 216 </Radio.Button>
217 217 </Radio.Group>
218   - <Row>
  218 + <Row align="middle">
219 219 {multiple ? (
220 220 <Checkbox className="ShopSelectNew_checkbox" indeterminate={checkInfo.indeterminate} checked={checkInfo.checkAll} onChange={checkAll}>
221 221 全选
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/ShopContent/api.ts deleted
1   -/*
2   - * @Date: 2021-07-08 16:53:36
3   - * @LastEditors: wangqiang@feewee.cn
4   - * @LastEditTime: 2022-05-25 11:32:53
5   - */
6   -import type { http } from "@/typing/http";
7   -import request from "@/utils/request";
8   -import { OOP_HOST } from "@/utils/host";
9   -import type { LabelValueType } from "rc-tree-select/lib/interface";
10   -
11   -export interface QueryParams {
12   - type: 1 | 2; // 1 集团维度 2 自定义门店维度
13   - shops?: string; // 门店集合 ,分割
14   - keywords?: string; // 门店关键字搜索
15   - bizTypes?: string; // 业态类型集合 ,分割
16   - brands?: string; // 品牌id集合 ,分割
17   - regions?: string; // 区域编码集合 ,分割
18   - dealers?: string; // 商家id集合 ,分割
19   -}
20   -
21   -export interface ShopItem {
22   - shopId: number; //门店id
23   - shopFullName?: string; //门店全称
24   - shopShortName?: string; //门店简称
25   - casShopId?: number; //对应售后门店id(只有售前业态门店有)
26   - casShopName?: string; //对应售后门店名称
27   - bizType?: number; //业态类型
28   - region?: Region;
29   - dealer?: DealerOrBrand;
30   - brandList?: DealerOrBrand[]; //只有售前业态门店有
31   -}
32   -export interface Value extends ShopItem, LabelValueType {}
33   -
34   -export enum BizType {
35   - "新车销售" = 1,
36   - "售后",
37   - "二手车",
38   - "租车",
39   - "交付中心"
40   -}
41   -
42   -export interface Region {
43   - bh?: string; // 区域编码
44   - name?: string; // 区域名称
45   - fullName?: string; // 区域全称
46   -}
47   -
48   -export interface DealerOrBrand {
49   - id?: number;
50   - name?: string;
51   -}
52   -
53   -/**
54   - * @description: 门店选择列表
55   - * @param {QueryParams} params
56   - * @return {http.PromiseResp<ShopItem[]>}
57   - */
58   -export function getShopListApi(
59   - params: QueryParams
60   -): http.PromiseResp<ShopItem[]> {
61   - return request.get(`${OOP_HOST}/select/shop/classify`, { params });
62   -}
63   -
64   -export interface Option {
65   - bizList?: Biz[];
66   - regionList?: Region[];
67   - brandList?: DealerOrBrand[];
68   - dealerList?: DealerOrBrand[];
69   -}
70   -
71   -export interface Biz {
72   - type?: number;
73   - name?: string;
74   -}
75   -
76   -/**
77   - * @description: 门店选择条件
78   - * @param {QueryParams} params
79   - * @return {http.PromiseResp<Option>}
80   - */
81   -export function getShopListChooseOptionsApi(
82   - params: QueryParams
83   -): http.PromiseResp<Option> {
84   - return request.get(`${OOP_HOST}/select/shop/filters`, { params });
85   -}
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/ShopContent/index.tsx deleted
1   -import useInitial from '@/hooks/useInitail';
2   -import { Button, Checkbox, Divider, Input, Popconfirm, Popover, Radio, Row, Select, Spin, Table } from 'antd';
3   -import type { CheckboxChangeEvent } from 'antd/lib/checkbox';
4   -import { debounce } from 'lodash';
5   -import React from 'react';
6   -import type { ShopItem, DealerOrBrand, Value} from './api';
7   -import { BizType, getShopListChooseOptionsApi, getShopListApi } from './api';
8   -import { useStore } from '../../index';
9   -
10   -interface Props {
11   - type?: 1 | 2; // 1 集团维度 2 自定义门店维度
12   - multiple?: boolean;
13   -}
14   -
15   -type TableType = '列表' | '选择';
16   -
17   -function Shop({ type = 1, multiple = true }: Props) {
18   - const { shopSelected: selected, setShopSelected: setSelected } = useStore();
19   - const optionInitial = useInitial(getShopListChooseOptionsApi, {}, { type });
20   - const listInitial = useInitial(getShopListApi, [], {
21   - type,
22   - bizTypes: '1,2,3,5',
23   - });
24   - const [checkInfo, setCheckInfo] = React.useState({
25   - indeterminate: false,
26   - checkAll: false,
27   - });
28   - const fetchListByName = debounce((keywords) => {
29   - listInitial.setParams({ type, keywords }, true);
30   - // setCheckInfo({
31   - // indeterminate: false,
32   - // checkAll: false,
33   - // });
34   - // setSelected([]);
35   - }, 500);
36   -
37   - const [tableType, setTableType] = React.useState<TableType>('列表');
38   -
39   - React.useEffect(() => {
40   - setCheckInfo({
41   - indeterminate: selected.length > 0 && listInitial.data.length !== selected.length,
42   - checkAll: selected.length > 0 && listInitial.data.length === selected.length,
43   - });
44   - }, [selected, listInitial.data]);
45   -
46   - /**
47   - * @description: 当一个门店被点击时,触发该回调函数。
48   - * @param {ShopItem} record 当前门店数据
49   - * @param {boolean} _selected 是否选中
50   - * @param {Object[]} selectedRows 已被选择的数据
51   - * @param {Event} nativeEvent 点击事件
52   - */
53   - const onSelect = (record: ShopItem, _selected: boolean, selectedRows: Object[], nativeEvent: Event) => {
54   - if (multiple) {
55   - if (_selected) {
56   - // 若被选择,则将该数据处理后,插入已选择列表中
57   - setSelected([...selected, { ...record, value: record.shopId, label: record.shopShortName }]);
58   - } else {
59   - // 若被取消选择,则将该数据,从已选择列表中删除
60   - setSelected(selected.filter((item) => item.shopId !== record.shopId));
61   - }
62   - } else {
63   - true;
64   - if (_selected) {
65   - setSelected([{ ...record, value: record.shopId, label: record.shopShortName }]);
66   - } else {
67   - setSelected([]);
68   - }
69   - }
70   - };
71   -
72   - /**
73   - * @description: 当全选CheckBox被点击时,调用该回调函数
74   - * @description: 只有 多选才会调用该全选函数,故起函数内部不需要判断是否多选情况
75   - * @param {boolean} _selected 是否选中
76   - * @param {ShopItem[]} selectedRows 已被选择的数据列表
77   - * @param {ShopItem[]} changeRows 点击全选CheckBox后,受影响的数据列表。该数据与_selected参数共同使用,可以得知是应该将changeRows数据加入已选中数据还是删除
78   - */
79   - const onSelectAll = (_selected: boolean, selectedRows: ShopItem[], changeRows: ShopItem[]) => {
80   - if (_selected) {
81   - // 若选中全选CheckBox,则将changeRows中的还未被选入selected中的数据插入
82   - setSelected(
83   - selected.concat(
84   - changeRows.map((row) => ({
85   - ...row,
86   - value: row.shopId,
87   - label: row.shopShortName,
88   - })),
89   - ),
90   - );
91   - } else {
92   - // 若取消选择全选CheckBox,则将changeRows中的数据全部从selected中删除
93   - const cancelIds = changeRows.map((row) => row.shopId);
94   - // @ts-ignore
95   - setSelected(selected.filter((item) => !cancelIds.includes(item.value)));
96   - }
97   - };
98   -
99   - const rowClick = (record: Value) => {
100   - if (multiple) {
101   - if (selected.some((item) => item.value === record.shopId)) {
102   - setSelected(selected.filter((item) => item.value !== record.shopId));
103   - } else {
104   - setSelected(
105   - selected.concat({
106   - ...record,
107   - value: record.shopId,
108   - label: record.shopShortName,
109   - }),
110   - );
111   - }
112   - } else {
113   - setSelected([{ ...record, value: record.shopId, label: record.shopShortName }]);
114   - }
115   - };
116   -
117   - const checkAll = (e: CheckboxChangeEvent) => {
118   - const checked = e.target.checked;
119   - setSelected(
120   - checked
121   - ? listInitial.data.map((item) => ({
122   - ...item,
123   - value: item.shopId,
124   - label: item.shopShortName,
125   - }))
126   - : [],
127   - );
128   - };
129   -
130   - return (
131   - <div>
132   - <>
133   - <Row justify="space-between">
134   - <Radio.Group buttonStyle="solid" value={tableType} onChange={(e) => setTableType(e.target.value)}>
135   - <Radio.Button value="列表">列表</Radio.Button>
136   - <Radio.Button value="选择" disabled={!selected.length}>
137   - 当前选择({selected.length} 个)
138   - </Radio.Button>
139   - </Radio.Group>
140   - <Row>
141   - {multiple ? (
142   - <Checkbox className="ShopSelectNew_checkbox" indeterminate={checkInfo.indeterminate} checked={checkInfo.checkAll} onChange={checkAll}>
143   - 全选
144   - </Checkbox>
145   - ) : null}
146   - <Popconfirm
147   - title="确定清空已选择门店?"
148   - disabled={!selected.length}
149   - onConfirm={() => {
150   - setSelected([]);
151   - setTableType('列表');
152   - }}
153   - >
154   - <Button danger type="link" disabled={!selected.length}>
155   - 清空
156   - </Button>
157   - </Popconfirm>
158   - </Row>
159   - </Row>
160   - <Divider />
161   - </>
162   - <Spin spinning={optionInitial.loading}>
163   - <Row justify="start" align="middle" style={{ display: tableType === '列表' ? 'flex' : 'none' }} className="ShopSelectNew_Filter_Container">
164   - <Input
165   - allowClear
166   - placeholder="请输入门店名查询"
167   - // value={listInitial.params.keywords}
168   - onChange={(e) => fetchListByName(e.target.value)}
169   - style={{ maxWidth: 260, marginRight: 10, marginBottom: 10 }}
170   - />
171   - <Select
172   - allowClear
173   - placeholder="请选择业态"
174   - mode="multiple"
175   - value={listInitial.params.bizTypes ? listInitial.params.bizTypes.split(',') : undefined}
176   - onChange={(bizs) => listInitial.setParams({ type, bizTypes: bizs?.join(',') }, true)}
177   - // value="1"
178   - // disabled
179   - showSearch
180   - optionFilterProp="children"
181   - style={{ minWidth: 260, marginBottom: 10, marginRight: 10 }}
182   - getPopupContainer={(triggerNode) => triggerNode.parentNode}
183   - >
184   - {optionInitial.data.bizList
185   - ?.filter((item) => item.type !== 4)
186   - .map((biz) => (
187   - <Select.Option key={biz.type} value={'' + biz.type!}>
188   - {biz.name}
189   - </Select.Option>
190   - ))}
191   - </Select>
192   - <Select
193   - allowClear
194   - placeholder="请选择区域"
195   - mode="multiple"
196   - value={listInitial.params.regions ? listInitial.params.regions.split(',') : undefined}
197   - onChange={(regions) => listInitial.setParams({ type, regions: regions?.join(',') }, true)}
198   - showSearch
199   - optionFilterProp="children"
200   - style={{ minWidth: 260, marginBottom: 10, marginRight: 10 }}
201   - getPopupContainer={(triggerNode) => triggerNode.parentNode}
202   - >
203   - {optionInitial.data.regionList?.map((region) => (
204   - <Select.Option key={region.bh} value={region.bh!}>
205   - {region.fullName}
206   - </Select.Option>
207   - ))}
208   - </Select>
209   - <Select
210   - allowClear
211   - placeholder="请选择品牌"
212   - mode="multiple"
213   - value={listInitial.params.brands ? listInitial.params.brands.split(',') : undefined}
214   - onChange={(brandList) => listInitial.setParams({ type, brands: brandList?.join(',') }, true)}
215   - showSearch
216   - optionFilterProp="children"
217   - style={{ minWidth: 260, marginBottom: 10, marginRight: 10 }}
218   - getPopupContainer={(triggerNode) => triggerNode.parentNode}
219   - >
220   - {optionInitial.data.brandList?.map((brand) => (
221   - <Select.Option key={brand.id} value={'' + brand.id!}>
222   - {brand.name}
223   - </Select.Option>
224   - ))}
225   - </Select>
226   - <Select
227   - allowClear
228   - placeholder="请选择商家"
229   - mode="multiple"
230   - value={listInitial.params.dealers ? listInitial.params.dealers.split(',') : undefined}
231   - onChange={(dealerList) => listInitial.setParams({ type, dealers: dealerList?.join(',') }, true)}
232   - showSearch
233   - optionFilterProp="children"
234   - style={{ minWidth: 260, marginBottom: 10, marginRight: 10 }}
235   - getPopupContainer={(triggerNode) => triggerNode.parentNode}
236   - >
237   - {optionInitial.data.dealerList?.map((dealer) => (
238   - <Select.Option key={dealer.id} value={'' + dealer.id!}>
239   - {dealer.name}
240   - </Select.Option>
241   - ))}
242   - </Select>
243   - </Row>
244   - </Spin>
245   - <Table
246   - dataSource={tableType === '列表' ? listInitial.data : selected}
247   - rowKey="shopId"
248   - size="small"
249   - loading={listInitial.loading}
250   - onRow={(record) => ({
251   - onClick: () => rowClick(record),
252   - })}
253   - rowSelection={{
254   - type: multiple ? 'checkbox' : 'radio',
255   - selectedRowKeys: selected.map((item) => item.value || item.shopId || -1),
256   - onSelect,
257   - onSelectAll,
258   - }}
259   - >
260   - <Table.Column title="门店名称" dataIndex="shopFullName" align="left" render={(shopFullName) => shopFullName || '-'} />
261   - <Table.Column title="门店简称" dataIndex="shopShortName" align="left" render={(shopFullName) => shopFullName || '-'} />
262   - <Table.Column title="门店业态" dataIndex="bizType" align="left" render={(bizType) => (bizType ? BizType[bizType] : '-')} />
263   - <Table.Column title="归属公司" dataIndex="dealer" align="left" render={(dealer) => dealer?.name || '-'} />
264   - <Table.Column title="门店区域" dataIndex="region" align="left" render={(region) => region?.fullName || '-'} />
265   - <Table.Column
266   - title="授权品牌"
267   - dataIndex="brandList"
268   - align="left"
269   - render={(brandList: DealerOrBrand[]) =>
270   - brandList?.length ? (
271   - <Popover
272   - placement="topLeft"
273   - content={
274   - <span>
275   - {brandList?.map((brand) => (
276   - <div key={brand.id}>{brand.name}</div>
277   - ))}
278   - </span>
279   - }
280   - >
281   - <span className="span_limit_1">{brandList?.map((brand) => brand.name).join(';')}</span>
282   - </Popover>
283   - ) : (
284   - '-'
285   - )
286   - }
287   - />
288   - <Table.Column title="对应售后门店" dataIndex="casShopName" align="left" render={(casShopName) => casShopName || '-'} />
289   - </Table>
290   - </div>
291   - );
292   -}
293   -
294   -export default Shop;
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/Step2.tsx
1 1 import React from 'react';
2 2 import { Card, Button } from 'antd';
3   -import ShopContent from './ShopContent';
  3 +import ShopContent from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
4 4 import DecoContent from './DecoContent';
5   -
  5 +import { useStore } from '../index'
6 6 interface Props {
7 7 onNext: () => any;
8 8 onBack: () => any;
... ... @@ -19,10 +19,10 @@ export default function Step2(props: Props) {
19 19 disabled,
20 20 way,
21 21 } = props;
22   -
  22 + const { shopSelected, setShopSelected } = useStore();
23 23 return (
24 24 <Card bordered={false}>
25   - {way === 1 ? <DecoContent /> : <ShopContent />}
  25 + {way === 1 ? <DecoContent /> : <ShopContent value={shopSelected} onChange={setShopSelected} />}
26 26  
27 27 <div style={{ display: "flex", justifyContent: "center" }}>
28 28 <Button loading={loading} style={{ width: 120 }} onClick={onBack}>
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/Step3.tsx
1 1 import React from "react";
2 2 import { Card, Button } from "antd";
3   -import ShopContent from "./ShopContent";
  3 +import ShopContent from "@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew";
4 4 import DecoContent from "./DecoContent";
5   -
  5 +import { useStore } from '../index'
6 6 interface Props {
7 7 onNext: () => any;
8 8 onBack: () => any;
... ... @@ -13,10 +13,10 @@ interface Props {
13 13  
14 14 export default function Step3(props: Props) {
15 15 const { onNext, onBack, loading, disabled, way} = props;
16   -
  16 + const { shopSelected, setShopSelected } = useStore();
17 17 return (
18 18 <Card bordered={false}>
19   - {way === 1 ? <ShopContent /> : <DecoContent />}
  19 + {way === 1 ? <ShopContent value={shopSelected} onChange={setShopSelected} /> : <DecoContent />}
20 20  
21 21 <div style={{ display: "flex", justifyContent: "center" }}>
22 22 <Button loading={loading} style={{ width: 120 }} onClick={onBack}>
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/index.tsx
1   -import React, { useEffect, useState } from 'react';
  1 +import React, { useState } from 'react';
2 2 import { Card, Steps, message, Tabs, Form } from 'antd';
3 3 import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 4 import Step1 from './components/Step1';
... ... @@ -38,7 +38,7 @@ const Index = () =&gt; {
38 38 }
39 39 form
40 40 .validateFields(names)
41   - .then((res) => {
  41 + .then(() => {
42 42 setCurrent(cur);
43 43 setWay(form.getFieldValue('way'));
44 44 })
... ... @@ -57,8 +57,6 @@ const Index = () =&gt; {
57 57 }
58 58  
59 59 function _save() {
60   - console.log('门店', shopSelected);
61   - console.log('装潢', decoSelected);
62 60 if (shopSelected.length === 0) {
63 61 message.error('请选择门店');
64 62 return;
... ... @@ -70,12 +68,12 @@ const Index = () =&gt; {
70 68 const _list = { goods: [] } as API.UpParams;
71 69 for (let i = 0; i < decoSelected.length; i++) {
72 70 for (let j = 0; j < shopSelected.length; j++) {
73   - _list.goods.push({ goodsId: decoSelected[i].id, shopId: shopSelected[j].shopId });
  71 + _list.goods.push({ goodsId: decoSelected[i].id, shopId: shopSelected[j].value });
74 72 }
75 73 }
76 74 setSubmitLoading(true);
77 75 API.upListApi({ ..._list })
78   - .then((res) => {
  76 + .then(() => {
79 77 setCurrent(3);
80 78 setSubmitLoading(false);
81 79 })
... ... @@ -98,7 +96,7 @@ const Index = () =&gt; {
98 96 <TabPane key="0">
99 97 <Step1
100 98 form={form}
101   - onValuesChange={(changeValue, values) => {
  99 + onValuesChange={(changeValue) => {
102 100 setWay(changeValue.way || 1);
103 101 }}
104 102 disabled={disabled}
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/putOnShelves/components/DecoContent/index.tsx
1 1 import { Button, Checkbox, Popconfirm, Cascader, Divider, Input, message, Radio, Row, Spin, Table } from 'antd';
2   -import { CheckboxChangeEvent } from 'antd/lib/checkbox';
  2 +import type { CheckboxChangeEvent } from 'antd/lib/checkbox';
3 3 import React from 'react';
4 4 import { useStore } from '../../index';
5   -import { WorkItem, getSeriesApi, getSpecApi } from '../../../../api';
  5 +import type { WorkItem} from '../../../../api';
  6 +import { getSeriesApi, getSpecApi } from '../../../../api';
6 7 import ShopModal from '../../../../../common/Shop';
7 8  
8 9 const { Search } = Input;
... ... @@ -21,7 +22,6 @@ function Deco({ type = 1, multiple = true }: Props) {
21 22 decoSelected: selected,
22 23 setDecoSelected: setSelected,
23 24 loading,
24   - paginationConfig,
25 25 brandOptions,
26 26 setBrandOptions,
27 27 } = useStore();
... ... @@ -54,7 +54,7 @@ function Deco({ type = 1, multiple = true }: Props) {
54 54 setParams({ keywords: e }, true);
55 55 }
56 56  
57   - function filterBySeries(value: any[], selectedOptions: any) {
  57 + function filterBySeries(value: any[]) {
58 58 if (value.length > 0) {
59 59 const seriesFilter = {
60 60 brandId: value[0],
... ... @@ -86,7 +86,7 @@ function Deco({ type = 1, multiple = true }: Props) {
86 86 getSeriesApi(targetOption.id)
87 87 .then((res: any) => {
88 88 const { data = [] } = res;
89   - targetOption.children = data.map((list: any, index: any) => ({
  89 + targetOption.children = data.map((list: any) => ({
90 90 id: list.id,
91 91 name: list.name,
92 92 isLeaf: false,
... ... @@ -103,7 +103,7 @@ function Deco({ type = 1, multiple = true }: Props) {
103 103 const { data = [] } = res;
104 104 targetOption.loading = false;
105 105 targetOption.children = [];
106   - data.forEach((list, index) => {
  106 + data.forEach((list) => {
107 107 targetOption.children.push({
108 108 id: list.id,
109 109 name: list.name,
... ... @@ -214,7 +214,7 @@ function Deco({ type = 1, multiple = true }: Props) {
214 214 当前选择({selected.length} 个)
215 215 </Radio.Button>
216 216 </Radio.Group>
217   - <Row>
  217 + <Row align="middle">
218 218 {multiple ? (
219 219 <Checkbox className="ShopSelectNew_checkbox" indeterminate={checkInfo.indeterminate} checked={checkInfo.checkAll} onChange={checkAll}>
220 220 全选
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/putOnShelves/components/Step2.tsx
1 1 import React from 'react';
2 2 import { Card, Button } from 'antd';
3   -import ShopContent from './ShopContent';
  3 +import ShopContent from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
4 4 import DecoContent from './DecoContent';
  5 +import { useStore } from '../index'
5 6  
6 7 interface Props {
7 8 onNext: () => any;
... ... @@ -19,10 +20,11 @@ export default function Step2(props: Props) {
19 20 disabled,
20 21 way,
21 22 } = props;
  23 + const { shopSelected, setShopSelected } = useStore();
22 24  
23 25 return (
24 26 <Card bordered={false}>
25   - {way === 1 ? <DecoContent /> : <ShopContent />}
  27 + {way === 1 ? <DecoContent /> : <ShopContent value={shopSelected} onChange={setShopSelected} />}
26 28  
27 29 <div style={{ display: "flex", justifyContent: "center" }}>
28 30 <Button loading={loading} style={{ width: 120 }} onClick={onBack}>
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/putOnShelves/components/Step3.tsx
1 1 import React from "react";
2 2 import { Card, Button } from "antd";
3   -import ShopContent from "./ShopContent";
  3 +import ShopContent from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew';
4 4 import DecoContent from "./DecoContent";
  5 +import { useStore } from '../index'
5 6  
6 7 interface Props {
7 8 onNext: () => any;
... ... @@ -13,10 +14,11 @@ interface Props {
13 14  
14 15 export default function Step3(props: Props) {
15 16 const { onNext, onBack, loading, disabled, way} = props;
  17 + const { shopSelected, setShopSelected } = useStore();
16 18  
17 19 return (
18 20 <Card bordered={false}>
19   - {way === 1 ? <ShopContent /> : <DecoContent />}
  21 + {way === 1 ? <ShopContent value={shopSelected} onChange={setShopSelected} /> : <DecoContent />}
20 22  
21 23 <div style={{ display: "flex", justifyContent: "center" }}>
22 24 <Button loading={loading} style={{ width: 120 }} onClick={onBack}>
... ...
src/pages/decoration/deco/DeoGoodsManagement/subpages/putOnShelves/index.tsx
1   -import React, { useEffect, useState } from 'react';
  1 +import React, { useState } from 'react';
2 2 import { Card, Steps, message, Tabs, Form } from 'antd';
3 3 import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 4 import Step1 from './components/Step1';
... ... @@ -38,7 +38,7 @@ const Index = () =&gt; {
38 38 }
39 39 form
40 40 .validateFields(names)
41   - .then((res) => {
  41 + .then(() => {
42 42 setCurrent(cur);
43 43 setWay(form.getFieldValue('way'));
44 44 })
... ... @@ -72,13 +72,13 @@ const Index = () =&gt; {
72 72 for (let j = 0; j < shopSelected.length; j++) {
73 73 _list.goods.push({
74 74 goodsId: decoSelected[i].id,
75   - shopId: shopSelected[j].shopId,
  75 + shopId: shopSelected[j].value,
76 76 });
77 77 }
78 78 }
79 79 setSubmitLoading(true);
80 80 API.downListApi({ ..._list })
81   - .then((res) => {
  81 + .then(() => {
82 82 setCurrent(3);
83 83 setSubmitLoading(false);
84 84 })
... ...
src/pages/decoration/deco/DeoGoodsManagement/useStore.ts
  1 +/*
  2 + * @Author: jiangwei jiangwei.feewee.cn
  3 + * @Date: 2024-03-27 17:14:09
  4 + * @LastEditors: jiangwei jiangwei.feewee.cn
  5 + * @LastEditTime: 2024-03-27 17:15:50
  6 + * @FilePath: /fw-cms/src/pages/decoration/deco/DeoGoodsManagement/useStore.ts
  7 + * @Description:
  8 + *
  9 + * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
  10 + */
1 11 import { useState, useEffect } from 'react';
2 12 import type { Option } from './interface.d';
3 13 import { message } from 'antd';
... ... @@ -5,7 +15,7 @@ import usePagination from &#39;@/hooks/usePagination&#39;;
5 15 import useInitial from '@/hooks/useInitail';
6 16 import * as api from './api';
7 17 import { getGroupCasBrandApi } from '@/common/api';
8   -import type { Value } from '@/pages/decoration/deco/DeoGoodsManagement/subpages/pullOffShelves/components/ShopContent/api';
  18 +import type { Shop } from '@/pages/decoration/deco/DeoGoodsManagement/components/ShopConentNew/api';
9 19  
10 20 export default function useStore() {
11 21 const [currentType, setCurrentType] = useState<number>(0);
... ... @@ -16,7 +26,7 @@ export default function useStore() {
16 26  
17 27 const pagnation = usePagination(api.getShop, { bizType: 0, pageSize: 9999 });
18 28 // 门店选择
19   - const [shopSelected, setShopSelected] = useState<Value[]>([]);
  29 + const [shopSelected, setShopSelected] = useState<Shop[]>([]);
20 30 // 装潢选择
21 31 const [decoSelected, setDecoSelected] = useState<api.WorkItem[]>([]);
22 32 // 装潢分类
... ...