Commit c6ce5d0f75153f12806c8f9a3f7fd4e60b0aab15

Authored by jiangwei
2 parents 67b0c63c e14da908

Merge branch 'bug_fix' of gitlab.feewee.cn:FEV2/fw-cms into bug_fix

src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddIndicatorsModal.tsx
... ... @@ -125,7 +125,11 @@ export default function CreateModal(props: Props) {
125 125 function handSubmit(fieldsValue: any) {
126 126 const pa: any = transformDTO(fieldsValue);
127 127 // 校验标准分不能大于绩效分值
128   - pa.id = id;
  128 + if (id) {
  129 + pa.id = id;
  130 + } else {
  131 + pa.id = pa.name;
  132 + }
129 133 if (pa?.ladderParams && pa?.ladderParams.length > 0) {
130 134 pa.ladderParamAlias = ladderParamAlias;
131 135 }
... ... @@ -180,7 +184,7 @@ export default function CreateModal(props: Props) {
180 184 setIsHundred(true);
181 185 setIsHundredLadder(true);
182 186 }
183   - } else if (!pa?.ladderParams && pa?.commissionParams.length > 0) {
  187 + } else if (!pa?.ladderParams && pa?.commissionParams && pa?.commissionParams.length > 0) {
184 188 if (hundred === 100) {
185 189 setIsHundred(false);
186 190 onOk(pa);
... ... @@ -207,8 +211,17 @@ export default function CreateModal(props: Props) {
207 211 } else {
208 212 setIsHundredLadder(true);
209 213 }
210   - }
211   - console.log("100pa", pa);
  214 + } else if (pa?.commissionParams == undefined) {
  215 + setIsHundred(false);
  216 + onOk(pa);
  217 + console.log("100pa", pa);
  218 + onCancel && onCancel();
  219 + } else if (pa?.commissionParams && pa?.commissionParams.length == 0) {
  220 + setIsHundred(false);
  221 + onOk(pa);
  222 + console.log("100pa", pa);
  223 + onCancel && onCancel();
  224 + }
212 225 }
213 226  
214 227 // 校验阶梯越小,标准分越小
... ... @@ -354,6 +367,35 @@ export default function CreateModal(props: Props) {
354 367 >
355 368 {({ getFieldValue }) => {
356 369 const caculateType = getFieldValue("calMethod");
  370 + if (caculateType) {
  371 + return (
  372 + <>
  373 + <Form.Item
  374 + name="commissionParams"
  375 + label="提成指标"
  376 + rules={[{ required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }]}
  377 + >
  378 + <CommissionParams
  379 + postId={postId}
  380 + shopIds={shopIds}
  381 + setItemId={setItemId}
  382 + isHundred={isHundred}
  383 + caculateType={caculateType}
  384 + />
  385 + </Form.Item>
  386 + </>
  387 + );
  388 + } else {
  389 + return null;
  390 + }
  391 + }}
  392 + </Form.Item>
  393 + <Form.Item
  394 + noStyle
  395 + shouldUpdate={(prevValues, currentValues) => prevValues.calMethod !== currentValues.calMethod}
  396 + >
  397 + {({ getFieldValue }) => {
  398 + const caculateType = getFieldValue("calMethod");
357 399 //星级
358 400 if (caculateType === 1) {
359 401 return (
... ... @@ -425,7 +467,7 @@ export default function CreateModal(props: Props) {
425 467 } else if (ladderParams[0].dataType === 2) {
426 468 setIsPercent(2);
427 469 } else if (ladderParams[0].dataType === 1 || ladderParams[0].dataType === 3) {
428   - console.log('hasvdhjasvhdj');
  470 + console.log("hasvdhjasvhdj");
429 471 setIsPercent(1);
430 472 }
431 473 }
... ... @@ -441,38 +483,6 @@ export default function CreateModal(props: Props) {
441 483 >
442 484 {({ getFieldValue }) => {
443 485 const caculateType = getFieldValue("calMethod");
444   - if (caculateType) {
445   - return (
446   - <>
447   - <Form.Item
448   - name="commissionParams"
449   - label="提成指标"
450   - rules={[{ required: caculateType !== 3, message: "请增加提成指标" }]}
451   - >
452   - <CommissionParams
453   - postId={postId}
454   - shopIds={shopIds}
455   - setItemId={setItemId}
456   - isHundred={isHundred}
457   - caculateType={caculateType}
458   - />
459   - </Form.Item>
460   - </>
461   - );
462   - } else {
463   - return null;
464   - }
465   - }}
466   - </Form.Item>
467   - <Form.Item
468   - noStyle
469   - shouldUpdate={(prevValues, currentValues) =>
470   - prevValues.calMethod !== currentValues.calMethod ||
471   - prevValues.salaryProjectName !== currentValues.salaryProjectName
472   - }
473   - >
474   - {({ getFieldValue }) => {
475   - const caculateType = getFieldValue("calMethod");
476 486 //阶梯(总)
477 487 if (caculateType === 3) {
478 488 return (
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/components/IndivatorsTable.tsx
... ... @@ -162,6 +162,8 @@ const IndivatorsTable = ({ value, onChange, postId, shopIds }: Props) =&gt; {
162 162 } else {
163 163 return "--";
164 164 }
  165 + } else {
  166 + return "--";
165 167 }
166 168 },
167 169 },
... ...
src/pages/performance/CompensateGroupConfig/EditComfirm/index.tsx
... ... @@ -16,6 +16,7 @@ import IndivatorsTable from &quot;./components/IndivatorsTable&quot;;
16 16 import FeeweeUpload from "@/components/FeeweeUpload";
17 17 import { transformDTO, transformFormData } from "../entity";
18 18 import moment from "moment";
  19 +import ShopSelectNew from "@/components/ShopSelectNew";
19 20  
20 21 export const { Provider, useStore } = createStore(store);
21 22 const { Option } = Select;
... ... @@ -54,6 +55,7 @@ function Index(props: Props) {
54 55 useEffect(() => {
55 56 if (configId && data) {
56 57 const res = transformFormData(data);
  58 + console.log('res', res);
57 59 form.setFieldsValue({
58 60 ...res,
59 61 });
... ... @@ -84,7 +86,7 @@ function Index(props: Props) {
84 86 function handSubmit(fieldsValue: any) {
85 87 const _shopIds: number[] = fieldsValue.shop.map((item:any) => item.value);
86 88 const res = transformDTO(fieldsValue);
87   - const _shopNames = shopList.filter((item) => _shopIds.find((y) => y === item.shopId)).map((i) => i.shopName);
  89 + const _shopNames = fieldsValue.shop.map((item: any) => item.label);
88 90 const pa = { ...res, id: configId, shopNames: _shopNames };
89 91 console.log("总的提交表单pa", pa);
90 92 setSaveLoading(true);
... ... @@ -175,7 +177,7 @@ function Index(props: Props) {
175 177 </Select>
176 178 </Form.Item>
177 179 <Form.Item name="shop" label="门店" rules={[{ required: true, message: "请选择门店" }]}>
178   - <Select
  180 + {/* <Select
179 181 placeholder="请选择门店"
180 182 allowClear
181 183 mode="multiple"
... ... @@ -200,7 +202,28 @@ function Index(props: Props) {
200 202 {shopList.map((item) => (
201 203 <Option value={item.shopId}>{item.shopName}</Option>
202 204 ))}
203   - </Select>
  205 + </Select> */}
  206 + {/* map那里注意加小括号 */}
  207 + <ShopSelectNew
  208 + multiple
  209 + disabled={readOnly}
  210 + shopIds={shopList.map((item) => item.shopId)}
  211 + type={2}
  212 + onChange={(
  213 + shops: {
  214 + key: number;
  215 + label: string;
  216 + value: number;
  217 + }[]
  218 + ) => {
  219 + const shopIds = shops.map((item) => item.value).join(",");
  220 + setShopIds(shopIds);
  221 + setPersonModal({
  222 + ...personModal,
  223 + shopIds,
  224 + });
  225 + }}
  226 + />
204 227 </Form.Item>
205 228 <div style={{ marginBottom: 20 }}>
206 229 <a onClick={() => personView()}>{`人员查看 >`}</a>
... ...
src/pages/performance/CompensateGroupConfig/entity.ts
... ... @@ -152,7 +152,7 @@ export function transformFormData(detail: ApprovalSetteing.ApprovalListItems) {
152 152 case "shopIds":
153 153 const _shopIdsOptions: string[] = value || [];
154 154 if (_shopIdsOptions.length) {
155   - const _ShopIds = _shopIdsOptions.map((item) => ({ value: item }));
  155 + const _ShopIds = _shopIdsOptions.map((item, index) => ({ value: item, label: detail.shopNames[index] }));
156 156 formData.shop = _ShopIds;
157 157 }
158 158 break;
... ...
src/pages/performance/KpiGroupSetting/EditComfirm/index.tsx
... ... @@ -17,6 +17,7 @@ import StarRatingList from &quot;./components/StarRatingList&quot;;
17 17 import FeeweeUpload from "@/components/FeeweeUpload";
18 18 import { transformDTO, transformFormData } from "../entity";
19 19 import moment from "moment";
  20 +import ShopSelectNew from "@/components/ShopSelectNew";
20 21 import { kpiGroupApi } from "../../KpiGroupSetting/api";
21 22 import usePagination from "@/hooks/usePagination";
22 23  
... ... @@ -87,7 +88,7 @@ function Index(props: Props) {
87 88 console.log('fieldsValue', fieldsValue);
88 89 const _shopIds: number[] = fieldsValue.shop.map((item:any) => item.value);
89 90 const res = transformDTO(fieldsValue);
90   - const _shopNames = shopList.filter((item) => _shopIds.find((y) => y === item.shopId)).map((i) => i.shopName);
  91 + const _shopNames = fieldsValue.shop.map((item: any) => item.label);
91 92 const pa = { ...res, force: true, id: Number(configId), shopNames: _shopNames };
92 93 console.log(pa);
93 94 setSaveLoading(true);
... ... @@ -176,12 +177,11 @@ function Index(props: Props) {
176 177 </Select>
177 178 </Form.Item>
178 179 <Form.Item name="shop" label="门店" rules={[{ required: true, message: "请选择门店" }]}>
179   - <Select
180   - placeholder="请选择门店"
181   - allowClear
182   - mode="multiple"
183   - labelInValue
  180 + <ShopSelectNew
  181 + multiple
184 182 disabled={readOnly}
  183 + shopIds={shopList.map((item) => item.shopId)}
  184 + type={2}
185 185 onChange={(
186 186 shops: {
187 187 key: number;
... ... @@ -192,11 +192,7 @@ function Index(props: Props) {
192 192 const shopIds = shops.map((item) => item.value).join(",");
193 193 setPersonModal({ ...personModal, shopIds });
194 194 }}
195   - >
196   - {shopList.map((item) => (
197   - <Option value={item.shopId}>{item.shopName}</Option>
198   - ))}
199   - </Select>
  195 + />
200 196 </Form.Item>
201 197 <div style={{ marginBottom: 20 }}>
202 198 <a onClick={() => personView()}>{`人员查看 >`}</a>
... ...
src/pages/performance/KpiGroupSetting/entity.ts
... ... @@ -144,7 +144,7 @@ export function transformFormData(detail: KpiGroupSetteing.KpiGroupDetail): form
144 144 case 'shopIds':
145 145 const _shopIdsOptions: number[] = value || [];
146 146 if (_shopIdsOptions.length) {
147   - const _ShopIds = _shopIdsOptions.map((item) => ({ value: item }));
  147 + const _ShopIds = _shopIdsOptions.map((item, index) => ({ value: item, label: detail.shopNames[index] }));
148 148 formData.shop = _ShopIds;
149 149 }
150 150 break;
... ...