Commit b33257b8962551b4edcbf5a49978bd576cdcaa5e
Merge remote-tracking branch 'origin/bug_fix'
Showing
42 changed files
with
506 additions
and
199 deletions
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddCommissionParamsModal.tsx
... | ... | @@ -29,6 +29,7 @@ interface Props { |
29 | 29 | comItem: Commission; |
30 | 30 | setItemId: Function; |
31 | 31 | caculateType?: number; |
32 | + isOne: number; | |
32 | 33 | } |
33 | 34 | type Commission = KpiGroupSetteing.CommissionParams; |
34 | 35 | export default function AddCommissionParamsModal(props: Props) { |
... | ... | @@ -39,7 +40,7 @@ export default function AddCommissionParamsModal(props: Props) { |
39 | 40 | |
40 | 41 | const [isTarget, setIsTarget] = useState(false); |
41 | 42 | // console.log(form); |
42 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, caculateType } = props; | |
43 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, caculateType, isOne } = props; | |
43 | 44 | const [delay, setDelay] = useState(true); |
44 | 45 | const [only, setOnly] = useState<KpiGroupSetteing.IndicatorByPost[]>([]); |
45 | 46 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
... | ... | @@ -82,6 +83,7 @@ export default function AddCommissionParamsModal(props: Props) { |
82 | 83 | value: comItem.indicatorCode, |
83 | 84 | label: comItem.indicatorName, |
84 | 85 | }, |
86 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
85 | 87 | }); |
86 | 88 | } |
87 | 89 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddIndicatorsModal.tsx
... | ... | @@ -327,8 +327,6 @@ export default function CreateModal(props: Props) { |
327 | 327 | > |
328 | 328 | <Form |
329 | 329 | form={form} |
330 | - // labelCol={{ span: 4 }} | |
331 | - // wrapperCol={{ span: 20 }} | |
332 | 330 | onFinish={handSubmit} |
333 | 331 | style={{ width: "90%", marginLeft: 60 }} |
334 | 332 | > |
... | ... | @@ -398,7 +396,16 @@ export default function CreateModal(props: Props) { |
398 | 396 | <Form.Item |
399 | 397 | name="commissionParams" |
400 | 398 | label="提成指标" |
401 | - rules={[{ required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }]} | |
399 | + rules={[ | |
400 | + { required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }, | |
401 | + { | |
402 | + validator: (_, value) => | |
403 | + (value && value.length > 0 && value.every((item: any) => item.cap !== undefined)) || | |
404 | + (caculateType !== 2 && caculateType !== 4 && !value) | |
405 | + ? Promise.resolve() | |
406 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
407 | + }, | |
408 | + ]} | |
402 | 409 | > |
403 | 410 | <CommissionParams |
404 | 411 | postId={postId} |
... | ... | @@ -449,7 +456,15 @@ export default function CreateModal(props: Props) { |
449 | 456 | <Form.Item |
450 | 457 | name="ladderParams" |
451 | 458 | label="台阶条件指标" |
452 | - rules={[{ required: true, message: "请增加台阶条件指标" }]} | |
459 | + rules={[ | |
460 | + { required: true, message: "请增加台阶条件指标" }, | |
461 | + { | |
462 | + validator: (_, value) => | |
463 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
464 | + ? Promise.resolve() | |
465 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
466 | + }, | |
467 | + ]} | |
453 | 468 | > |
454 | 469 | <LadderParams |
455 | 470 | postId={postId} | ... | ... |
src/pages/performance/CompensateGroupConfig/EditComfirm/components/AddLadderParamsModal.tsx
... | ... | @@ -18,6 +18,7 @@ interface Props { |
18 | 18 | onOk: (vales: any) => void; |
19 | 19 | comItem: Commission; |
20 | 20 | setItemId: Function; |
21 | + isOne: number; | |
21 | 22 | } |
22 | 23 | type Commission = KpiGroupSetteing.CommissionParams; |
23 | 24 | export default function AddLadderParamsModal(props: Props) { |
... | ... | @@ -29,7 +30,7 @@ export default function AddLadderParamsModal(props: Props) { |
29 | 30 | const [isTarget, setIsTarget] = useState(false); |
30 | 31 | const [dataType, setDataType] = useState<number>(2); |
31 | 32 | // console.log(form); |
32 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId } = props; | |
33 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, isOne } = props; | |
33 | 34 | const [delay, setDelay] = useState(true); |
34 | 35 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
35 | 36 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -69,6 +70,7 @@ export default function AddLadderParamsModal(props: Props) { |
69 | 70 | value: comItem.indicatorCode, |
70 | 71 | label: comItem.indicatorName, |
71 | 72 | }, |
73 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
72 | 74 | }); |
73 | 75 | } |
74 | 76 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/CompensateGroupConfig/EditComfirm/components/CommissionParams.tsx
... | ... | @@ -77,7 +77,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
77 | 77 | dataIndex: "proportion", |
78 | 78 | key: "proportion", |
79 | 79 | render: (val: any, record: Commission, index: number) => { |
80 | - return val ? `${val}%` : "需编辑"; | |
80 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
81 | 81 | }, |
82 | 82 | }, |
83 | 83 | { |
... | ... | @@ -143,27 +143,33 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
143 | 143 | <div style={{ display: "flex", justifyContent: "flex-start", width: 500 }}> |
144 | 144 | 提成指标名称: |
145 | 145 | <Select |
146 | + allowClear | |
146 | 147 | loading={loading} |
147 | 148 | value={{ label: commissionParamAlias }} |
148 | 149 | placeholder="选择指标(带*号的为组合指标,不带的为单个指标)" |
149 | 150 | labelInValue |
150 | 151 | onChange={(value, Option: any) => { |
151 | - setComCode(Option.indicatorCode); | |
152 | - setItemId(Option.key); | |
153 | - setCommissionParamAlias(Option.indicatorName); | |
154 | - setSelectedIndicators([...selectedIndicators, Option.indicatorCode]); | |
155 | - if (Option.combines) { | |
156 | - onChange && onChange(Option.combines); | |
152 | + if (Option) { | |
153 | + setComCode(Option.indicatorCode); | |
154 | + setItemId(Option.key); | |
155 | + setCommissionParamAlias(Option.indicatorName); | |
156 | + setSelectedIndicators([...selectedIndicators, Option.indicatorCode]); | |
157 | + if (Option.combines) { | |
158 | + onChange && onChange(Option.combines); | |
159 | + } else { | |
160 | + const newOp = [ | |
161 | + { | |
162 | + ...Option, | |
163 | + }, | |
164 | + ]; | |
165 | + newOp.forEach((item: any) => { | |
166 | + delete item.children; | |
167 | + }); | |
168 | + onChange && onChange(newOp); | |
169 | + } | |
157 | 170 | } else { |
158 | - const newOp = [ | |
159 | - { | |
160 | - ...Option, | |
161 | - }, | |
162 | - ]; | |
163 | - newOp.forEach((item: any) => { | |
164 | - delete item.children; | |
165 | - }); | |
166 | - onChange && onChange(newOp); | |
171 | + onChange && onChange(undefined); | |
172 | + setCommissionParamAlias(""); | |
167 | 173 | } |
168 | 174 | }} |
169 | 175 | showSearch |
... | ... | @@ -203,6 +209,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
203 | 209 | postId={postId} |
204 | 210 | shopIds={shopIds} |
205 | 211 | caculateType={caculateType} |
212 | + isOne={value && value?.length ? value?.length : 0} | |
206 | 213 | onOk={(values) => { |
207 | 214 | if (!comItem.indicatorCode) { |
208 | 215 | tableData.push(values); | ... | ... |
src/pages/performance/CompensateGroupConfig/EditComfirm/components/LadderParams.tsx
... | ... | @@ -62,7 +62,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundredLa |
62 | 62 | dataIndex: "proportion", |
63 | 63 | key: "proportion", |
64 | 64 | render: (val: any, record: Commission, index: number) => { |
65 | - return val ? `${val}%` : "需编辑"; | |
65 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
66 | 66 | }, |
67 | 67 | }, |
68 | 68 | { |
... | ... | @@ -186,6 +186,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundredLa |
186 | 186 | onCancel={onCancel} |
187 | 187 | postId={postId} |
188 | 188 | shopIds={shopIds} |
189 | + isOne={value && value?.length ? value?.length : 0} | |
189 | 190 | onOk={(values) => { |
190 | 191 | if (!comItem.indicatorCode) { |
191 | 192 | tableData.push(values); | ... | ... |
src/pages/performance/CompensateGroupConfig/EditComfirm/components/PreviewReport.tsx
... | ... | @@ -15,7 +15,7 @@ const columns = [ |
15 | 15 | { |
16 | 16 | title: "人员", |
17 | 17 | dataIndex: "userName", |
18 | - width: 150, | |
18 | + width: 100, | |
19 | 19 | align: "center", |
20 | 20 | render: (value: Number) => value || "-", |
21 | 21 | }, |
... | ... | @@ -23,14 +23,14 @@ const columns = [ |
23 | 23 | title: "岗位", |
24 | 24 | dataIndex: "postName", |
25 | 25 | align: "center", |
26 | - width: 200, | |
26 | + width: 150, | |
27 | 27 | render: (value: Number) => value || "-", |
28 | 28 | }, |
29 | 29 | { |
30 | 30 | title: "在职门店", |
31 | 31 | dataIndex: "shopName", |
32 | 32 | align: "center", |
33 | - width: 300, | |
33 | + width: 200, | |
34 | 34 | render: (value: Number) => value || "-", |
35 | 35 | }, |
36 | 36 | ]; |
... | ... | @@ -48,7 +48,7 @@ const TargetModal = ({ reportVisible, projects, setReportVisible, item }: Props) |
48 | 48 | setParams({ postId, shopIds }, true); |
49 | 49 | setDelay(false); |
50 | 50 | const allIndicatorList = projects.map((item: any) => { |
51 | - return { title: item.name, key: item.id, align: "center", width: 300, render: () => "-" }; | |
51 | + return { title: item.name, key: item.id, align: "center", width: 200, render: () => "-" }; | |
52 | 52 | }); |
53 | 53 | setAllIndicator(allIndicatorList); |
54 | 54 | setRealList([...columns, ...allIndicatorList]); |
... | ... | @@ -125,7 +125,7 @@ const TargetModal = ({ reportVisible, projects, setReportVisible, item }: Props) |
125 | 125 | } |
126 | 126 | const sonList = newArr.map((item: any) => { |
127 | 127 | return { |
128 | - title: item.indicatorName, | |
128 | + title: item.indicatorName || item.name, | |
129 | 129 | key: item.indicatorCode, |
130 | 130 | align: "center", |
131 | 131 | width: 300, |
... | ... | @@ -160,7 +160,7 @@ const TargetModal = ({ reportVisible, projects, setReportVisible, item }: Props) |
160 | 160 | dataSource={data} |
161 | 161 | columns={realList} |
162 | 162 | loading={loading} |
163 | - scroll={{ x: true, y: 500 }} | |
163 | + scroll={{ x: 1000, y: 500 }} | |
164 | 164 | pagination={false} |
165 | 165 | /> |
166 | 166 | </Modal> | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddCommissionParamsModal.tsx
... | ... | @@ -25,6 +25,7 @@ interface Props { |
25 | 25 | comItem: Commission; |
26 | 26 | setItemId: Function; |
27 | 27 | scopeType: number; |
28 | + isOne: number; | |
28 | 29 | } |
29 | 30 | type Commission = EvaGroupSetteing.CommissionParams; |
30 | 31 | export default function AddCommissionParamsModal(props: Props) { |
... | ... | @@ -35,7 +36,7 @@ export default function AddCommissionParamsModal(props: Props) { |
35 | 36 | |
36 | 37 | const [isTarget, setIsTarget] = useState(false); |
37 | 38 | // console.log(form); |
38 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
39 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
39 | 40 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
40 | 41 | const [targetType, setTargetType] = useState<number>(); |
41 | 42 | // 保存选中指标是否考评类型 |
... | ... | @@ -53,12 +54,10 @@ export default function AddCommissionParamsModal(props: Props) { |
53 | 54 | setTargetType(1); |
54 | 55 | }, [addComVisible]); |
55 | 56 | // 修改 |
56 | - | |
57 | 57 | useEffect(() => { |
58 | 58 | if (indicatorsList && indicatorsList.length > 0 && !comItem.code) { |
59 | 59 | const res = indicatorsList.filter((item) => !selectedIndicators.find((y) => y === item.code)); |
60 | 60 | setNewIndicators([...res]); |
61 | - // console.log("selectedIndicators", selectedIndicators); | |
62 | 61 | } |
63 | 62 | if (addComVisible && comItem.code) { |
64 | 63 | const indTar = indicatorsList.find((item: any) => item.code == comItem.code)?.targetType; |
... | ... | @@ -72,6 +71,7 @@ export default function AddCommissionParamsModal(props: Props) { |
72 | 71 | value: comItem.code, |
73 | 72 | label: comItem.name, |
74 | 73 | }, |
74 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
75 | 75 | }); |
76 | 76 | } |
77 | 77 | if (comItem.targetValue && comItem.targetCalcType) { |
... | ... | @@ -162,8 +162,6 @@ export default function AddCommissionParamsModal(props: Props) { |
162 | 162 | <Spin spinning={loading}> |
163 | 163 | <Form |
164 | 164 | form={form} |
165 | - // labelCol={{ span: 6 }} | |
166 | - // wrapperCol={{ span: 18 }} | |
167 | 165 | onFinish={handSubmit} |
168 | 166 | style={{ width: "70%", marginLeft: 150 }} |
169 | 167 | > | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddCommissionParamsModalSal.tsx
... | ... | @@ -25,6 +25,7 @@ interface Props { |
25 | 25 | comItem: Commission; |
26 | 26 | setItemId: Function; |
27 | 27 | scopeType: number; |
28 | + isOne: number; | |
28 | 29 | } |
29 | 30 | type Commission = EvaGroupSetteing.CommissionParams; |
30 | 31 | export default function AddCommissionParamsModal(props: Props) { |
... | ... | @@ -35,7 +36,7 @@ export default function AddCommissionParamsModal(props: Props) { |
35 | 36 | |
36 | 37 | const [isTarget, setIsTarget] = useState(false); |
37 | 38 | // console.log(form); |
38 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
39 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
39 | 40 | const [delay, setDelay] = useState(true); |
40 | 41 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
41 | 42 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -71,6 +72,7 @@ export default function AddCommissionParamsModal(props: Props) { |
71 | 72 | value: comItem.code, |
72 | 73 | label: comItem.name, |
73 | 74 | }, |
75 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
74 | 76 | }); |
75 | 77 | } |
76 | 78 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddCommissionParamsModalSalShop.tsx
... | ... | @@ -25,6 +25,7 @@ interface Props { |
25 | 25 | comItem: Commission; |
26 | 26 | setItemId: Function; |
27 | 27 | scopeType: number; |
28 | + isOne: number; | |
28 | 29 | } |
29 | 30 | type Commission = EvaGroupSetteing.CommissionParams; |
30 | 31 | export default function AddCommissionParamsModal(props: Props) { |
... | ... | @@ -36,7 +37,7 @@ export default function AddCommissionParamsModal(props: Props) { |
36 | 37 | |
37 | 38 | const [isTarget, setIsTarget] = useState(false); |
38 | 39 | // console.log(form); |
39 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
40 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
40 | 41 | const [delay, setDelay] = useState(true); |
41 | 42 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
42 | 43 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -72,6 +73,7 @@ export default function AddCommissionParamsModal(props: Props) { |
72 | 73 | value: comItem.code, |
73 | 74 | label: comItem.name, |
74 | 75 | }, |
76 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
75 | 77 | }); |
76 | 78 | } |
77 | 79 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddIndicatorsModal.tsx
... | ... | @@ -48,6 +48,7 @@ export default function AddIndicatorsModal(props: Props) { |
48 | 48 | const [condsVisible, setCondsVisible] = useState(false); |
49 | 49 | // 判断占比相加是否为100 |
50 | 50 | const [isHundred, setIsHundred] = useState(false); |
51 | + const [isCap, setCap] = useState(false); | |
51 | 52 | // 保存过滤后指标列表 |
52 | 53 | // const [newIndicators, setNewIndicators] = useState<EvaGroupSetteing.IndicatorByPost[]>([]); |
53 | 54 | const [id, setItemId] = useState<number>(); |
... | ... | @@ -60,9 +61,9 @@ export default function AddIndicatorsModal(props: Props) { |
60 | 61 | } else if (currentItem.ladderParamAlias) { |
61 | 62 | setParamAlias(currentItem.ladderParamAlias); |
62 | 63 | } |
63 | - if (currentItem.code) { | |
64 | - setAllCode(currentItem.code); | |
65 | - } | |
64 | + if (currentItem.code) { | |
65 | + setAllCode(currentItem.code); | |
66 | + } | |
66 | 67 | if (currentItem.codeType) { |
67 | 68 | setCodeType(currentItem.codeType); |
68 | 69 | } |
... | ... | @@ -114,25 +115,25 @@ export default function AddIndicatorsModal(props: Props) { |
114 | 115 | console.log("大", pa); |
115 | 116 | let hundred = 0; |
116 | 117 | if (pa?.commissionParams) { |
117 | - pa.commissionParamAlias = paramAlias; | |
118 | - hundred = pa?.commissionParams.reduce((data: number, item: EvaGroupSetteing.CommissionParams) => { | |
119 | - return data + item.proportion; | |
120 | - }, 0); | |
121 | 118 | if (pa?.commissionParams.length == 1) { |
122 | 119 | pa.codeType = codeType; |
123 | 120 | } else { |
124 | 121 | pa.codeType = 3; |
125 | 122 | } |
126 | - } | |
127 | - if (pa?.ladderParams) { | |
128 | - hundred = pa?.ladderParams.reduce((data: number, item: EvaGroupSetteing.CommissionParams) => { | |
123 | + pa.commissionParamAlias = paramAlias; | |
124 | + hundred = pa?.commissionParams.reduce((data: number, item: EvaGroupSetteing.CommissionParams) => { | |
129 | 125 | return data + item.proportion; |
130 | 126 | }, 0); |
127 | + } | |
128 | + if (pa?.ladderParams) { | |
131 | 129 | if (pa?.ladderParams.length == 1) { |
132 | 130 | pa.codeType = codeType; |
133 | 131 | } else { |
134 | 132 | pa.codeType = 3; |
135 | 133 | } |
134 | + hundred = pa?.ladderParams.reduce((data: number, item: EvaGroupSetteing.CommissionParams) => { | |
135 | + return data + item.proportion; | |
136 | + }, 0); | |
136 | 137 | } |
137 | 138 | //设置conds的sort |
138 | 139 | if (pa?.conds && pa?.conds.length > 0) { |
... | ... | @@ -196,7 +197,7 @@ export default function AddIndicatorsModal(props: Props) { |
196 | 197 | return ( |
197 | 198 | <Modal |
198 | 199 | title={`${currentItem.name ? "编辑" : "新增"}指标`} |
199 | - visible={visible} | |
200 | + open={visible} | |
200 | 201 | maskClosable={false} |
201 | 202 | afterClose={() => { |
202 | 203 | form.resetFields(); |
... | ... | @@ -208,8 +209,6 @@ export default function AddIndicatorsModal(props: Props) { |
208 | 209 | > |
209 | 210 | <Form |
210 | 211 | form={form} |
211 | - // labelCol={{ span: 6 }} | |
212 | - // wrapperCol={{ span: 18 }} | |
213 | 212 | onFinish={handSubmit} |
214 | 213 | style={{ width: "80%", marginLeft: 120 }} |
215 | 214 | initialValues={{ |
... | ... | @@ -257,7 +256,15 @@ export default function AddIndicatorsModal(props: Props) { |
257 | 256 | <Form.Item |
258 | 257 | name="ladderParams" |
259 | 258 | label="台阶得分" |
260 | - rules={[{ required: true, message: "请增加台阶得分指标" }]} | |
259 | + rules={[ | |
260 | + { required: true, message: "请增加台阶得分指标" }, | |
261 | + { | |
262 | + validator: (_, value) => | |
263 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
264 | + ? Promise.resolve() | |
265 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
266 | + }, | |
267 | + ]} | |
261 | 268 | > |
262 | 269 | <LadderParams |
263 | 270 | postId={postId} |
... | ... | @@ -275,7 +282,15 @@ export default function AddIndicatorsModal(props: Props) { |
275 | 282 | <Form.Item |
276 | 283 | name="commissionParams" |
277 | 284 | label="固定得分" |
278 | - rules={[{ required: true, message: "请增加固定得分指标" }]} | |
285 | + rules={[ | |
286 | + { required: true, message: "请增加固定得分指标" }, | |
287 | + { | |
288 | + validator: (_, value) => | |
289 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
290 | + ? Promise.resolve() | |
291 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
292 | + }, | |
293 | + ]} | |
279 | 294 | > |
280 | 295 | <CommissionParams |
281 | 296 | postId={postId} | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddLadderParamsModal.tsx
... | ... | @@ -19,6 +19,7 @@ interface Props { |
19 | 19 | comItem: Commission; |
20 | 20 | setItemId: Function; |
21 | 21 | scopeType: number; |
22 | + isOne: number; | |
22 | 23 | } |
23 | 24 | type Commission = EvaGroupSetteing.CommissionParams; |
24 | 25 | export default function AddLadderParamsModal(props: Props) { |
... | ... | @@ -30,7 +31,7 @@ export default function AddLadderParamsModal(props: Props) { |
30 | 31 | const [isTarget, setIsTarget] = useState(false); |
31 | 32 | const [dataType, setDataType] = useState<number>(2); |
32 | 33 | // console.log(form); |
33 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
34 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
34 | 35 | const [delay, setDelay] = useState(true); |
35 | 36 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
36 | 37 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -65,6 +66,7 @@ export default function AddLadderParamsModal(props: Props) { |
65 | 66 | label: comItem.name, |
66 | 67 | dataType: comItem.dataType, |
67 | 68 | }, |
69 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
68 | 70 | }); |
69 | 71 | } |
70 | 72 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddLadderParamsModalSal.tsx
... | ... | @@ -19,6 +19,7 @@ interface Props { |
19 | 19 | comItem: Commission; |
20 | 20 | setItemId: Function; |
21 | 21 | scopeType: number; |
22 | + isOne: number; | |
22 | 23 | } |
23 | 24 | type Commission = EvaGroupSetteing.CommissionParams; |
24 | 25 | export default function AddLadderParamsModal(props: Props) { |
... | ... | @@ -30,7 +31,7 @@ export default function AddLadderParamsModal(props: Props) { |
30 | 31 | const [isTarget, setIsTarget] = useState(false); |
31 | 32 | const [dataType, setDataType] = useState<number>(2); |
32 | 33 | // console.log(form); |
33 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
34 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
34 | 35 | const [delay, setDelay] = useState(true); |
35 | 36 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
36 | 37 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -65,6 +66,7 @@ export default function AddLadderParamsModal(props: Props) { |
65 | 66 | label: comItem.name, |
66 | 67 | dataType: comItem.dataType, |
67 | 68 | }, |
69 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
68 | 70 | }); |
69 | 71 | } |
70 | 72 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddLadderParamsModalSalShop.tsx
... | ... | @@ -19,6 +19,7 @@ interface Props { |
19 | 19 | comItem: Commission; |
20 | 20 | setItemId: Function; |
21 | 21 | scopeType: number; |
22 | + isOne: number; | |
22 | 23 | } |
23 | 24 | type Commission = EvaGroupSetteing.CommissionParams; |
24 | 25 | export default function AddLadderParamsModal(props: Props) { |
... | ... | @@ -31,7 +32,7 @@ export default function AddLadderParamsModal(props: Props) { |
31 | 32 | const [isTarget, setIsTarget] = useState(false); |
32 | 33 | const [dataType, setDataType] = useState<number>(2); |
33 | 34 | // console.log(form); |
34 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType } = props; | |
35 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, scopeType, isOne } = props; | |
35 | 36 | const [delay, setDelay] = useState(true); |
36 | 37 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
37 | 38 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -66,6 +67,7 @@ export default function AddLadderParamsModal(props: Props) { |
66 | 67 | label: comItem.name, |
67 | 68 | dataType: comItem.dataType, |
68 | 69 | }, |
70 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
69 | 71 | }); |
70 | 72 | } |
71 | 73 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddRewardsModal.tsx
... | ... | @@ -292,7 +292,16 @@ export default function CreateModal(props: Props) { |
292 | 292 | <Form.Item |
293 | 293 | name="commissionParams" |
294 | 294 | label="提成指标" |
295 | - rules={[{ required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }]} | |
295 | + rules={[ | |
296 | + { required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }, | |
297 | + { | |
298 | + validator: (_, value) => | |
299 | + (value && value.length > 0 && value.every((item: any) => item.cap !== undefined)) || | |
300 | + (caculateType !== 2 && caculateType !== 4 && !value) | |
301 | + ? Promise.resolve() | |
302 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
303 | + }, | |
304 | + ]} | |
296 | 305 | > |
297 | 306 | <CommissionParamsSal |
298 | 307 | postId={postId} |
... | ... | @@ -321,7 +330,15 @@ export default function CreateModal(props: Props) { |
321 | 330 | <Form.Item |
322 | 331 | name="ladderParams" |
323 | 332 | label="台阶条件指标" |
324 | - rules={[{ required: true, message: "请增加台阶条件指标" }]} | |
333 | + rules={[ | |
334 | + { required: true, message: "请增加台阶条件指标" }, | |
335 | + { | |
336 | + validator: (_, value) => | |
337 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
338 | + ? Promise.resolve() | |
339 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
340 | + }, | |
341 | + ]} | |
325 | 342 | > |
326 | 343 | <LadderParamsSal |
327 | 344 | postId={postId} |
... | ... | @@ -409,7 +426,15 @@ export default function CreateModal(props: Props) { |
409 | 426 | <Form.Item |
410 | 427 | name="ladderParams" |
411 | 428 | label="台阶条件指标" |
412 | - rules={[{ required: true, message: "请增加台阶条件指标" }]} | |
429 | + rules={[ | |
430 | + { required: true, message: "请增加台阶条件指标" }, | |
431 | + { | |
432 | + validator: (_, value) => | |
433 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
434 | + ? Promise.resolve() | |
435 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
436 | + }, | |
437 | + ]} | |
413 | 438 | > |
414 | 439 | <LadderParamsSal |
415 | 440 | postId={postId} | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddRewardsModalShop.tsx
... | ... | @@ -283,7 +283,16 @@ export default function CreateModal(props: Props) { |
283 | 283 | <Form.Item |
284 | 284 | name="commissionParams" |
285 | 285 | label="提成指标" |
286 | - rules={[{ required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }]} | |
286 | + rules={[ | |
287 | + { required: caculateType == 2 || caculateType == 4, message: "请增加提成指标" }, | |
288 | + { | |
289 | + validator: (_, value) => | |
290 | + (value && value.length > 0 && value.every((item: any) => item.cap !== undefined)) || | |
291 | + (caculateType !== 2 && caculateType !== 4 && !value) | |
292 | + ? Promise.resolve() | |
293 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
294 | + }, | |
295 | + ]} | |
287 | 296 | > |
288 | 297 | <CommissionParamsSalShop |
289 | 298 | postId={postId} |
... | ... | @@ -312,7 +321,15 @@ export default function CreateModal(props: Props) { |
312 | 321 | <Form.Item |
313 | 322 | name="ladderParams" |
314 | 323 | label="台阶条件指标" |
315 | - rules={[{ required: true, message: "请增加台阶条件指标" }]} | |
324 | + rules={[ | |
325 | + { required: true, message: "请增加台阶条件指标" }, | |
326 | + { | |
327 | + validator: (_, value) => | |
328 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
329 | + ? Promise.resolve() | |
330 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
331 | + }, | |
332 | + ]} | |
316 | 333 | > |
317 | 334 | <LadderParamsSalShop |
318 | 335 | postId={postId} |
... | ... | @@ -394,7 +411,15 @@ export default function CreateModal(props: Props) { |
394 | 411 | <Form.Item |
395 | 412 | name="ladderParams" |
396 | 413 | label="台阶条件指标" |
397 | - rules={[{ required: true, message: "请增加台阶条件指标" }]} | |
414 | + rules={[ | |
415 | + { required: true, message: "请增加台阶条件指标" }, | |
416 | + { | |
417 | + validator: (_, value) => | |
418 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
419 | + ? Promise.resolve() | |
420 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
421 | + }, | |
422 | + ]} | |
398 | 423 | > |
399 | 424 | <LadderParamsSalShop |
400 | 425 | postId={postId} | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/AddStaffRewardsModal.tsx
... | ... | @@ -136,7 +136,10 @@ export default function CreateModal(props: Props) { |
136 | 136 | return null; |
137 | 137 | }} |
138 | 138 | </Form.Item> */} |
139 | - <Form.Item name="rewards" label="考评奖惩"> | |
139 | + <Form.Item | |
140 | + name="rewards" | |
141 | + label="考评奖惩" | |
142 | + > | |
140 | 143 | <RewardsTableSal scopeType={scopeType} shopIds={shopIds} rewardLength={rewardLength} /> |
141 | 144 | </Form.Item> |
142 | 145 | <Form.Item noStyle shouldUpdate={(prevValues, currentValues) => prevValues.rewards !== currentValues.rewards}> | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/CommissionParams.tsx
... | ... | @@ -69,7 +69,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
69 | 69 | dataIndex: "proportion", |
70 | 70 | key: "proportion", |
71 | 71 | render: (val: any, record: Commission, index: number) => { |
72 | - return val ? `${val}%` : "需编辑"; | |
72 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
73 | 73 | }, |
74 | 74 | }, |
75 | 75 | { |
... | ... | @@ -161,7 +161,6 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
161 | 161 | setParamAlias(Option.name); |
162 | 162 | setCodeType(Option.codeType); |
163 | 163 | setSelectedIndicators([...selectedIndicators, Option.code]); |
164 | - console.log("Option", Option); | |
165 | 164 | if (Option.combines) { |
166 | 165 | onChange && onChange(Option.combines); |
167 | 166 | } else { |
... | ... | @@ -213,6 +212,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
213 | 212 | onCancel={onCancel} |
214 | 213 | postId={postId} |
215 | 214 | shopIds={shopIds} |
215 | + isOne={value && value?.length ? value?.length : 0} | |
216 | 216 | scopeType={scopeType} |
217 | 217 | onOk={(values) => { |
218 | 218 | if (!comItem.code) { | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/CommissionParamsSal.tsx
... | ... | @@ -76,7 +76,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
76 | 76 | dataIndex: "proportion", |
77 | 77 | key: "proportion", |
78 | 78 | render: (val: any, record: Commission, index: number) => { |
79 | - return val ? `${val}%` : "需编辑"; | |
79 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
80 | 80 | }, |
81 | 81 | }, |
82 | 82 | { |
... | ... | @@ -158,28 +158,34 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
158 | 158 | <div style={{ display: "flex", justifyContent: "flex-start", width: 300 }}> |
159 | 159 | X= |
160 | 160 | <Select |
161 | + allowClear | |
161 | 162 | loading={loading} |
162 | 163 | value={{ label: commissionParamAlias }} |
163 | 164 | placeholder="选择指标(带*号的为组合指标,不带的为单个指标)" |
164 | 165 | labelInValue |
165 | 166 | onChange={(value, Option: any) => { |
166 | - setComCode(Option.code); | |
167 | - setItemId(Option.key); | |
168 | - setCommissionParamAlias(Option.name); | |
169 | - setComCodeType(Option.codeType); | |
170 | - setSelectedIndicatorsSal([...selectedIndicatorSal, Option.code]); | |
171 | - if (Option.combines) { | |
172 | - onChange && onChange(Option.combines); | |
167 | + if (Option) { | |
168 | + setComCode(Option.code); | |
169 | + setItemId(Option.key); | |
170 | + setCommissionParamAlias(Option.name); | |
171 | + setComCodeType(Option.codeType); | |
172 | + setSelectedIndicatorsSal([...selectedIndicatorSal, Option.code]); | |
173 | + if (Option.combines) { | |
174 | + onChange && onChange(Option.combines); | |
175 | + } else { | |
176 | + const newOp = [ | |
177 | + { | |
178 | + ...Option, | |
179 | + }, | |
180 | + ]; | |
181 | + newOp.forEach((item: any) => { | |
182 | + delete item.children; | |
183 | + }); | |
184 | + onChange && onChange(newOp); | |
185 | + } | |
173 | 186 | } else { |
174 | - const newOp = [ | |
175 | - { | |
176 | - ...Option, | |
177 | - }, | |
178 | - ]; | |
179 | - newOp.forEach((item: any) => { | |
180 | - delete item.children; | |
181 | - }); | |
182 | - onChange && onChange(newOp); | |
187 | + onChange && onChange(undefined); | |
188 | + setCommissionParamAlias(""); | |
183 | 189 | } |
184 | 190 | }} |
185 | 191 | showSearch |
... | ... | @@ -220,6 +226,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
220 | 226 | postId={postId} |
221 | 227 | shopIds={shopIds} |
222 | 228 | scopeType={scopeType} |
229 | + isOne={value && value?.length ? value?.length : 0} | |
223 | 230 | onOk={(values) => { |
224 | 231 | if (!comItem.code) { |
225 | 232 | tableData.push(values); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/CommissionParamsSalShop.tsx
... | ... | @@ -6,6 +6,7 @@ import AddCommissionParamsModalSalShop from "@/pages/performance/EvaGroupSetting |
6 | 6 | import { TargetTypeEnum } from "@/pages/performance/entity"; |
7 | 7 | import { queryPostIndicatorApi, queryShopIndicatorApi } from "@/pages/performance/EvaGroupSetting/EditComfirm/api"; |
8 | 8 | import useInitail from "@/hooks/useInitail"; |
9 | +import e from "express"; | |
9 | 10 | |
10 | 11 | const Option = Select.Option; |
11 | 12 | |
... | ... | @@ -76,7 +77,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
76 | 77 | dataIndex: "proportion", |
77 | 78 | key: "proportion", |
78 | 79 | render: (val: any, record: Commission, index: number) => { |
79 | - return val ? `${val}%` : "需编辑"; | |
80 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
80 | 81 | }, |
81 | 82 | }, |
82 | 83 | { |
... | ... | @@ -158,28 +159,34 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
158 | 159 | <div style={{ display: "flex", justifyContent: "flex-start", width: 300 }}> |
159 | 160 | X= |
160 | 161 | <Select |
162 | + allowClear | |
161 | 163 | loading={loading} |
162 | 164 | value={{ label: commissionParamAliasShop }} |
163 | 165 | placeholder="选择指标(带*号的为组合指标,不带的为单个指标)" |
164 | 166 | labelInValue |
165 | 167 | onChange={(value, Option: any) => { |
166 | - setComCodeShop(Option.code); | |
167 | - setItemId(Option.key); | |
168 | - setCommissionParamAliasShop(Option.name); | |
169 | - setComCodeTypeShop(Option.codeType); | |
170 | - setSelectedIndicatorsSalShop([...selectedIndicatorSalShop, Option.code]); | |
171 | - if (Option.combines) { | |
172 | - onChange && onChange(Option.combines); | |
168 | + if (Option) { | |
169 | + setComCodeShop(Option.code); | |
170 | + setItemId(Option.key); | |
171 | + setCommissionParamAliasShop(Option.name); | |
172 | + setComCodeTypeShop(Option.codeType); | |
173 | + setSelectedIndicatorsSalShop([...selectedIndicatorSalShop, Option.code]); | |
174 | + if (Option.combines) { | |
175 | + onChange && onChange(Option.combines); | |
176 | + } else { | |
177 | + const newOp = [ | |
178 | + { | |
179 | + ...Option, | |
180 | + }, | |
181 | + ]; | |
182 | + newOp.forEach((item: any) => { | |
183 | + delete item.children; | |
184 | + }); | |
185 | + onChange && onChange(newOp); | |
186 | + } | |
173 | 187 | } else { |
174 | - const newOp = [ | |
175 | - { | |
176 | - ...Option, | |
177 | - }, | |
178 | - ]; | |
179 | - newOp.forEach((item: any) => { | |
180 | - delete item.children; | |
181 | - }); | |
182 | - onChange && onChange(newOp); | |
188 | + onChange && onChange(undefined); | |
189 | + setCommissionParamAliasShop(""); | |
183 | 190 | } |
184 | 191 | }} |
185 | 192 | showSearch |
... | ... | @@ -220,6 +227,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
220 | 227 | postId={postId} |
221 | 228 | shopIds={shopIds} |
222 | 229 | scopeType={scopeType} |
230 | + isOne={value && value?.length ? value?.length : 0} | |
223 | 231 | onOk={(values) => { |
224 | 232 | if (!comItem.code) { |
225 | 233 | tableData.push(values); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/LadderParams.tsx
... | ... | @@ -69,7 +69,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundred, |
69 | 69 | dataIndex: "proportion", |
70 | 70 | key: "proportion", |
71 | 71 | render: (val: any, record: Commission, index: number) => { |
72 | - return val ? `${val}%` : "需编辑"; | |
72 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
73 | 73 | }, |
74 | 74 | }, |
75 | 75 | { |
... | ... | @@ -213,6 +213,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundred, |
213 | 213 | postId={postId} |
214 | 214 | shopIds={shopIds} |
215 | 215 | scopeType={scopeType} |
216 | + isOne={value && value?.length ? value?.length : 0} | |
216 | 217 | onOk={(values) => { |
217 | 218 | if (!comItem.code) { |
218 | 219 | tableData.push(values); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/LadderParamsSal.tsx
... | ... | @@ -86,7 +86,7 @@ const LadderParams = ({ |
86 | 86 | dataIndex: "proportion", |
87 | 87 | key: "proportion", |
88 | 88 | render: (val: any, record: Commission, index: number) => { |
89 | - return val ? `${val}%` : "需编辑"; | |
89 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
90 | 90 | }, |
91 | 91 | }, |
92 | 92 | { |
... | ... | @@ -230,6 +230,7 @@ const LadderParams = ({ |
230 | 230 | postId={postId} |
231 | 231 | shopIds={shopIds} |
232 | 232 | scopeType={scopeType} |
233 | + isOne={value && value?.length ? value?.length : 0} | |
233 | 234 | onOk={(values) => { |
234 | 235 | if (!comItem.code) { |
235 | 236 | tableData.push(values); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/LadderParamsSalShop.tsx
... | ... | @@ -86,7 +86,7 @@ const LadderParams = ({ |
86 | 86 | dataIndex: "proportion", |
87 | 87 | key: "proportion", |
88 | 88 | render: (val: any, record: Commission, index: number) => { |
89 | - return val ? `${val}%` : "需编辑"; | |
89 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
90 | 90 | }, |
91 | 91 | }, |
92 | 92 | { |
... | ... | @@ -230,6 +230,7 @@ const LadderParams = ({ |
230 | 230 | postId={postId} |
231 | 231 | shopIds={shopIds} |
232 | 232 | scopeType={scopeType} |
233 | + isOne={value && value?.length ? value?.length : 0} | |
233 | 234 | onOk={(values) => { |
234 | 235 | if (!comItem.code) { |
235 | 236 | tableData.push(values); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/LadderTable.tsx
src/pages/performance/EvaGroupSetting/EditComfirm/components/PreviewReport.tsx
... | ... | @@ -13,7 +13,7 @@ const columns = [ |
13 | 13 | { |
14 | 14 | title: "人员", |
15 | 15 | dataIndex: "userName", |
16 | - width: 150, | |
16 | + width: 100, | |
17 | 17 | align: "center", |
18 | 18 | render: (value: Number) => value || "-", |
19 | 19 | }, |
... | ... | @@ -21,14 +21,23 @@ const columns = [ |
21 | 21 | title: "岗位", |
22 | 22 | dataIndex: "postName", |
23 | 23 | align: "center", |
24 | - width: 200, | |
24 | + width: 150, | |
25 | 25 | render: (value: Number) => value || "-", |
26 | 26 | }, |
27 | 27 | { |
28 | 28 | title: "在职门店", |
29 | 29 | dataIndex: "shopName", |
30 | 30 | align: "center", |
31 | - width: 300, | |
31 | + width: 200, | |
32 | + render: (value: Number) => value || "-", | |
33 | + }, | |
34 | +]; | |
35 | +const shopColumns = [ | |
36 | + { | |
37 | + title: "门店", | |
38 | + dataIndex: "shopName", | |
39 | + align: "center", | |
40 | + width: 200, | |
32 | 41 | render: (value: Number) => value || "-", |
33 | 42 | }, |
34 | 43 | ]; |
... | ... | @@ -39,15 +48,24 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
39 | 48 | const [comList, setComList] = useState<any[]>([]); |
40 | 49 | const [allIndicator, setAllIndicator] = useState<any[]>([]); |
41 | 50 | const [delay, setDelay] = useState(true); |
42 | - const [maybePostIds, setMaybePostIds] = useState<any[]>([]); | |
51 | + const [shopData, setShopData] = useState<any[]>([]); | |
43 | 52 | const { data, setParams, loading } = useInitial(fetchRealtimeStaffs, [], { postIds: "", shopIds: "" }, delay); |
44 | 53 | useEffect(() => { |
45 | 54 | if (reportVisible && stages && stages.length > 0) { |
46 | 55 | const shopIdsArr = stages.map((item: any) => { |
47 | 56 | return item.evalGroups.map((i: any) => i.shopIds); |
48 | 57 | }); |
49 | - const newShopIdsArr = [...new Set(shopIdsArr.flat(2))]; | |
50 | - console.log("shopIdsArr", newShopIdsArr); | |
58 | + const newShopIdsArr = [...new Set(shopIdsArr.flat(2))]; // 找门店id | |
59 | + // 找到门店名字 | |
60 | + const shopNamesArr = stages.map((item: any) => { | |
61 | + return item.evalGroups.map((i: any) => i.shopNames); | |
62 | + }); | |
63 | + const newShopNamesArr = [...new Set(shopNamesArr.flat(2))]; | |
64 | + const shopNmaes = newShopNamesArr.map((item: any) => { | |
65 | + return {shopName: item}; | |
66 | + }); | |
67 | + setShopData(shopNmaes); | |
68 | + // 找到岗位id | |
51 | 69 | const postIdsArr = stages.map((i1: any) => { |
52 | 70 | return i1.evalGroups.map((i2: any) => { |
53 | 71 | if (i2?.staffRewardDims && i2?.staffRewardDims?.length > 0) { |
... | ... | @@ -58,26 +76,29 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
58 | 76 | }); |
59 | 77 | }); |
60 | 78 | const newPostIdsArr = [...new Set(postIdsArr.flat(3))]; |
61 | - console.log(newPostIdsArr); | |
62 | - setMaybePostIds(newPostIdsArr); | |
63 | 79 | if (newPostIdsArr.length > 0) { |
64 | 80 | setParams({ postIds: newPostIdsArr.join(","), shopIds: newShopIdsArr.join(",") }, true); |
65 | 81 | setDelay(false); |
66 | 82 | } |
67 | - // const arr = kpiGroups.map((item) => { | |
68 | - // return item.indicators; | |
69 | - // }); | |
70 | - // const mergedArr = arr.reduce((acc, cur) => acc.concat(cur), []); | |
71 | - // let removalArr = mergedArr.filter((item: any, index: number, self: any) => { | |
72 | - // return self.findIndex((el: any) => el.code === item.code) === index; | |
73 | - // }); | |
74 | - // const allIndicatorList = removalArr.map((item: any) => { | |
75 | - // return { title: item.name, key: item.code, align: "center", width: 300, render: () => "-" }; | |
76 | - // }); | |
77 | - // setAllIndicator(allIndicatorList); | |
78 | - // setRealList([...columns, ...allIndicatorList]); | |
79 | - // const com = removalArr.filter((item: any) => item.codeType == 3); | |
80 | - // setComList(com); | |
83 | + const arr = stages.map((i1) => { | |
84 | + return i1.evalGroups.map((i2: any) => i2.indicators); | |
85 | + }); | |
86 | + const mergedArr = arr.flat(2); | |
87 | + let removalArr = mergedArr.filter((item: any, index: number, self: any) => { | |
88 | + return self.findIndex((el: any) => el.code === item.code) === index; | |
89 | + }); | |
90 | + const allIndicatorList = removalArr.map((item: any) => { | |
91 | + return { title: item.name, key: item.code, align: "center", width: 200, render: () => "-" }; | |
92 | + }); | |
93 | + setAllIndicator(allIndicatorList); | |
94 | + console.log("allIndicatorList", removalArr); | |
95 | + if (newPostIdsArr.length > 0) { | |
96 | + setRealList([...columns, ...allIndicatorList]); | |
97 | + } else { | |
98 | + setRealList([...shopColumns, ...allIndicatorList]); | |
99 | + } | |
100 | + const com = removalArr.filter((item: any) => item.codeType == 3); | |
101 | + setComList(com); | |
81 | 102 | } |
82 | 103 | }, [reportVisible]); |
83 | 104 | const preOnCancel = () => { |
... | ... | @@ -88,7 +109,11 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
88 | 109 | const returnAll = () => { |
89 | 110 | form.resetFields(); |
90 | 111 | setType(1); |
91 | - setRealList([...columns, ...allIndicator]); | |
112 | + if (data && data?.length > 0) { | |
113 | + setRealList([...columns, ...allIndicator]); | |
114 | + } else { | |
115 | + setRealList([...shopColumns, ...allIndicator]); | |
116 | + } | |
92 | 117 | }; |
93 | 118 | return ( |
94 | 119 | <> |
... | ... | @@ -101,10 +126,10 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
101 | 126 | onOk={() => preOnCancel()} |
102 | 127 | > |
103 | 128 | <div style={{ display: "flex" }}> |
104 | - {/* <Form form={form}> | |
129 | + <Form form={form}> | |
105 | 130 | <Form.Item name="ind"> |
106 | 131 | <Select |
107 | - loading={loading} | |
132 | + loading={data && data?.length > 0 ? loading : false} | |
108 | 133 | placeholder="指标下钻" |
109 | 134 | labelInValue |
110 | 135 | optionFilterProp="children" |
... | ... | @@ -113,26 +138,34 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
113 | 138 | if (Option.commissionParams && Option.commissionParams?.length > 0) { |
114 | 139 | const sonList = Option.commissionParams.map((item: any) => { |
115 | 140 | return { |
116 | - title: item.indicatorName, | |
141 | + title: item.indicatorName || item.name, | |
117 | 142 | key: item.code, |
118 | 143 | align: "center", |
119 | 144 | width: 300, |
120 | 145 | render: () => "-", |
121 | 146 | }; |
122 | 147 | }); |
123 | - setRealList([...columns, ...sonList]); | |
148 | + if (data && data?.length > 0) { | |
149 | + setRealList([...columns, ...sonList]); | |
150 | + } else { | |
151 | + setRealList([...shopColumns, ...sonList]); | |
152 | + } | |
124 | 153 | } |
125 | 154 | if (Option.ladderParams && Option.ladderParams?.length > 0) { |
126 | 155 | const sonList = Option.ladderParams.map((item: any) => { |
127 | 156 | return { |
128 | - title: item.indicatorName, | |
157 | + title: item.indicatorName || item.name, | |
129 | 158 | key: item.code, |
130 | 159 | align: "center", |
131 | 160 | width: 300, |
132 | 161 | render: () => "-", |
133 | 162 | }; |
134 | 163 | }); |
135 | - setRealList([...columns, ...sonList]); | |
164 | + if (data && data?.length > 0) { | |
165 | + setRealList([...columns, ...sonList]); | |
166 | + } else { | |
167 | + setRealList([...shopColumns, ...sonList]); | |
168 | + } | |
136 | 169 | } |
137 | 170 | }} |
138 | 171 | style={{ width: 200 }} |
... | ... | @@ -149,19 +182,19 @@ const TargetModal = ({ reportVisible, stages, setReportVisible }: Props) => { |
149 | 182 | ))} |
150 | 183 | </Select> |
151 | 184 | </Form.Item> |
152 | - </Form> */} | |
153 | - {/* {type == 2 ? ( | |
185 | + </Form> | |
186 | + {type == 2 ? ( | |
154 | 187 | <Button onClick={() => returnAll()} style={{ marginLeft: 10 }} type="primary"> |
155 | 188 | 返回至全部指标 |
156 | 189 | </Button> |
157 | - ) : null} */} | |
190 | + ) : null} | |
158 | 191 | </div> |
159 | 192 | <Table |
160 | 193 | bordered |
161 | - dataSource={data} | |
162 | - columns={columns} | |
163 | - loading={maybePostIds.length > 0 ? loading : false} | |
164 | - scroll={{ x: true, y: 500 }} | |
194 | + dataSource={data && data?.length > 0 ? data : shopData} | |
195 | + columns={realList} | |
196 | + loading={data && data?.length > 0 ? loading : false} | |
197 | + scroll={{ x: 1000, y: 500 }} | |
165 | 198 | pagination={false} |
166 | 199 | /> |
167 | 200 | </Modal> | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/TotalAmountSal.tsx
... | ... | @@ -245,13 +245,12 @@ const TotalAmount = ({ |
245 | 245 | { |
246 | 246 | title: "封顶金额 (元)", |
247 | 247 | dataIndex: "capMoney", |
248 | - width: "20%", | |
248 | + width: "15%", | |
249 | 249 | editable: true, |
250 | 250 | render: (text: number) => (typeof text === "number" ? `${text}` : "--"), |
251 | 251 | }, |
252 | 252 | { |
253 | 253 | title: "操作", |
254 | - width: "40%", | |
255 | 254 | dataIndex: "operation", |
256 | 255 | render: (_: any, record: Item, index: number) => { |
257 | 256 | const editable = isEditing(record); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/components/TotalAmountSalShop.tsx
... | ... | @@ -245,13 +245,12 @@ const TotalAmount = ({ |
245 | 245 | { |
246 | 246 | title: "封顶金额 (元)", |
247 | 247 | dataIndex: "capMoney", |
248 | - width: "20%", | |
248 | + width: "15%", | |
249 | 249 | editable: true, |
250 | 250 | render: (text: number) => (typeof text === "number" ? `${text}` : "--"), |
251 | 251 | }, |
252 | 252 | { |
253 | 253 | title: "操作", |
254 | - width: "40%", | |
255 | 254 | dataIndex: "operation", |
256 | 255 | render: (_: any, record: Item, index: number) => { |
257 | 256 | const editable = isEditing(record); | ... | ... |
src/pages/performance/EvaGroupSetting/EditComfirm/index.tsx
... | ... | @@ -302,7 +302,7 @@ function Index(props: Props) { |
302 | 302 | > |
303 | 303 | 返回 |
304 | 304 | </Button> |
305 | - {/* <Button | |
305 | + <Button | |
306 | 306 | type="default" |
307 | 307 | size="large" |
308 | 308 | onClick={() => setReportVisible(true)} |
... | ... | @@ -310,7 +310,7 @@ function Index(props: Props) { |
310 | 310 | disabled={!stages || stages?.length == 0} |
311 | 311 | > |
312 | 312 | 预览考评表 |
313 | - </Button> */} | |
313 | + </Button> | |
314 | 314 | {!readOnly && ( |
315 | 315 | <Popconfirm |
316 | 316 | title="确定完成,提交后不可更改?" | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddCommissionParamsModal.tsx
... | ... | @@ -28,6 +28,7 @@ interface Props { |
28 | 28 | onOk: (vales: any) => void; |
29 | 29 | comItem: Commission; |
30 | 30 | setItemId: Function; |
31 | + isOne: number; | |
31 | 32 | } |
32 | 33 | type Commission = KpiGroupSetteing.CommissionParams; |
33 | 34 | export default function AddCommissionParamsModal(props: Props) { |
... | ... | @@ -38,7 +39,7 @@ export default function AddCommissionParamsModal(props: Props) { |
38 | 39 | |
39 | 40 | const [isTarget, setIsTarget] = useState(false); |
40 | 41 | // console.log(form); |
41 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId } = props; | |
42 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, isOne } = props; | |
42 | 43 | |
43 | 44 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
44 | 45 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -79,6 +80,7 @@ export default function AddCommissionParamsModal(props: Props) { |
79 | 80 | value: comItem.indicatorCode, |
80 | 81 | label: comItem.indicatorName, |
81 | 82 | }, |
83 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
82 | 84 | }); |
83 | 85 | } |
84 | 86 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddIndicatorsModal.tsx
... | ... | @@ -189,8 +189,6 @@ export default function AddIndicatorsModal(props: Props) { |
189 | 189 | > |
190 | 190 | <Form |
191 | 191 | form={form} |
192 | - // labelCol={{ span: 6 }} | |
193 | - // wrapperCol={{ span: 15 }} | |
194 | 192 | style={{ width: "80%", marginLeft: 150 }} |
195 | 193 | onFinish={handSubmit} |
196 | 194 | initialValues={{ |
... | ... | @@ -238,7 +236,15 @@ export default function AddIndicatorsModal(props: Props) { |
238 | 236 | <Form.Item |
239 | 237 | name="ladderParams" |
240 | 238 | label="台阶得分" |
241 | - rules={[{ required: true, message: "请增加台阶得分指标" }]} | |
239 | + rules={[ | |
240 | + { required: true, message: "请增加台阶得分指标" }, | |
241 | + { | |
242 | + validator: (_, value) => | |
243 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
244 | + ? Promise.resolve() | |
245 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
246 | + }, | |
247 | + ]} | |
242 | 248 | > |
243 | 249 | <LadderParams postId={postId} shopIds={shopIds} setItemId={setItemId} isHundred={isHundred} /> |
244 | 250 | </Form.Item> |
... | ... | @@ -254,7 +260,15 @@ export default function AddIndicatorsModal(props: Props) { |
254 | 260 | <Form.Item |
255 | 261 | name="commissionParams" |
256 | 262 | label="固定得分" |
257 | - rules={[{ required: true, message: "请增加固定得分指标" }]} | |
263 | + rules={[ | |
264 | + { required: true, message: "请增加固定得分指标" }, | |
265 | + { | |
266 | + validator: (_, value) => | |
267 | + value && value.length > 0 && value.every((item: any) => item.cap !== undefined) | |
268 | + ? Promise.resolve() | |
269 | + : Promise.reject(new Error("请对是否封顶进行编辑")), | |
270 | + }, | |
271 | + ]} | |
258 | 272 | > |
259 | 273 | <CommissionParams postId={postId} shopIds={shopIds} setItemId={setItemId} isHundred={isHundred} /> |
260 | 274 | </Form.Item> | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/AddLadderParamsModal.tsx
... | ... | @@ -18,6 +18,7 @@ interface Props { |
18 | 18 | onOk: (vales: any) => void; |
19 | 19 | comItem: Commission; |
20 | 20 | setItemId: Function; |
21 | + isOne: number; | |
21 | 22 | } |
22 | 23 | type Commission = KpiGroupSetteing.CommissionParams; |
23 | 24 | export default function AddLadderParamsModal(props: Props) { |
... | ... | @@ -29,7 +30,7 @@ export default function AddLadderParamsModal(props: Props) { |
29 | 30 | const [isTarget, setIsTarget] = useState(false); |
30 | 31 | const [dataType, setDataType] = useState<number>(2); |
31 | 32 | // console.log(form); |
32 | - const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId } = props; | |
33 | + const { addComVisible, onCancel, postId, shopIds, onOk, comItem, setItemId, isOne } = props; | |
33 | 34 | const [delay, setDelay] = useState(true); |
34 | 35 | // 保存选中绩效指标需要配置的绩效考核目标值类型 |
35 | 36 | const [targetType, setTargetType] = useState<number>(); |
... | ... | @@ -69,6 +70,7 @@ export default function AddLadderParamsModal(props: Props) { |
69 | 70 | label: comItem.indicatorName, |
70 | 71 | dataType: comItem.dataType, |
71 | 72 | }, |
73 | + proportion: comItem.proportion !== undefined ? comItem.proportion : isOne == 1 ? 100 : null, | |
72 | 74 | }); |
73 | 75 | } |
74 | 76 | if (comItem.targetValue && comItem.targetCalcType) { | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/CommissionParams.tsx
... | ... | @@ -47,6 +47,9 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
47 | 47 | useEffect(() => { |
48 | 48 | if (Array.isArray(value)) { |
49 | 49 | setTableData([...value]); |
50 | + if (value.length > 0) { | |
51 | + console.log("value", value); | |
52 | + } | |
50 | 53 | } |
51 | 54 | }, [value]); |
52 | 55 | useEffect(() => { |
... | ... | @@ -70,7 +73,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
70 | 73 | dataIndex: "proportion", |
71 | 74 | key: "proportion", |
72 | 75 | render: (val: any, record: Commission, index: number) => { |
73 | - return val ? `${val}%` : "需编辑"; | |
76 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
74 | 77 | }, |
75 | 78 | }, |
76 | 79 | { |
... | ... | @@ -195,6 +198,7 @@ const CommissionParams = ({ postId, shopIds, value, onChange, setItemId, isHundr |
195 | 198 | onCancel={onCancel} |
196 | 199 | postId={postId} |
197 | 200 | shopIds={shopIds} |
201 | + isOne={value && value?.length ? value?.length : 0} | |
198 | 202 | onOk={(values) => { |
199 | 203 | if (!comItem.indicatorCode) { |
200 | 204 | tableData.push(values); | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/LadderParams.tsx
... | ... | @@ -70,7 +70,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundred } |
70 | 70 | dataIndex: "proportion", |
71 | 71 | key: "proportion", |
72 | 72 | render: (val: any, record: Commission, index: number) => { |
73 | - return val ? `${val}%` : "需编辑"; | |
73 | + return val ? `${val}%` : value && value?.length == 1 ? "100%" : "需编辑"; | |
74 | 74 | }, |
75 | 75 | }, |
76 | 76 | { |
... | ... | @@ -195,6 +195,7 @@ const LadderParams = ({ postId, shopIds, value, onChange, setItemId, isHundred } |
195 | 195 | onCancel={onCancel} |
196 | 196 | postId={postId} |
197 | 197 | shopIds={shopIds} |
198 | + isOne={value && value?.length ? value?.length : 0} | |
198 | 199 | onOk={(values) => { |
199 | 200 | if (!comItem.indicatorCode) { |
200 | 201 | tableData.push(values); | ... | ... |
src/pages/performance/KpiGroupSetting/EditComfirm/components/PreviewReport.tsx
... | ... | @@ -13,7 +13,7 @@ const columns = [ |
13 | 13 | { |
14 | 14 | title: "人员", |
15 | 15 | dataIndex: "userName", |
16 | - width: 150, | |
16 | + width: 100, | |
17 | 17 | align: "center", |
18 | 18 | render: (value: Number) => value || "-", |
19 | 19 | }, |
... | ... | @@ -21,14 +21,14 @@ const columns = [ |
21 | 21 | title: "岗位", |
22 | 22 | dataIndex: "postName", |
23 | 23 | align: "center", |
24 | - width: 200, | |
24 | + width: 150, | |
25 | 25 | render: (value: Number) => value || "-", |
26 | 26 | }, |
27 | 27 | { |
28 | 28 | title: "在职门店", |
29 | 29 | dataIndex: "shopName", |
30 | 30 | align: "center", |
31 | - width: 300, | |
31 | + width: 200, | |
32 | 32 | render: (value: Number) => value || "-", |
33 | 33 | }, |
34 | 34 | ]; |
... | ... | @@ -47,15 +47,14 @@ const TargetModal = ({ reportVisible, kpiGroups, setReportVisible }: Props) => { |
47 | 47 | }); |
48 | 48 | setParams({ shopsPosts: newArr }, true); |
49 | 49 | setDelay(false); |
50 | - const arr = kpiGroups.map((item) => { | |
51 | - return item.indicators; | |
52 | - }); | |
53 | - const mergedArr = arr.reduce((acc, cur) => acc.concat(cur), []); | |
50 | + const arr = kpiGroups.map((item) => item.indicators); // 筛选出indicators | |
51 | + const mergedArr = arr.reduce((acc, cur) => acc.concat(cur), []); // 二维数组转化为一维数组 | |
52 | + console.log("arr", arr, mergedArr); | |
54 | 53 | let removalArr = mergedArr.filter((item: any, index: number, self: any) => { |
55 | - return self.findIndex((el: any) => el.code === item.code) === index; | |
54 | + return self.findIndex((el: any) => el.code === item.code) === index; // 去重 | |
56 | 55 | }); |
57 | 56 | const allIndicatorList = removalArr.map((item: any) => { |
58 | - return { title: item.name, key: item.code, align: "center", width: 300, render: () => "-" }; | |
57 | + return { title: item.name, key: item.code, align: "center", width: 200, render: () => "-" }; // 得到动态表头 | |
59 | 58 | }); |
60 | 59 | setAllIndicator(allIndicatorList); |
61 | 60 | setRealList([...columns, ...allIndicatorList]); |
... | ... | @@ -96,7 +95,7 @@ const TargetModal = ({ reportVisible, kpiGroups, setReportVisible }: Props) => { |
96 | 95 | if (Option.commissionParams && Option.commissionParams?.length > 0) { |
97 | 96 | const sonList = Option.commissionParams.map((item: any) => { |
98 | 97 | return { |
99 | - title: item.indicatorName, | |
98 | + title: item.indicatorName || item.name, | |
100 | 99 | key: item.code, |
101 | 100 | align: "center", |
102 | 101 | width: 300, |
... | ... | @@ -108,7 +107,7 @@ const TargetModal = ({ reportVisible, kpiGroups, setReportVisible }: Props) => { |
108 | 107 | if (Option.ladderParams && Option.ladderParams?.length > 0) { |
109 | 108 | const sonList = Option.ladderParams.map((item: any) => { |
110 | 109 | return { |
111 | - title: item.indicatorName, | |
110 | + title: item.indicatorName || item.name, | |
112 | 111 | key: item.code, |
113 | 112 | align: "center", |
114 | 113 | width: 300, |
... | ... | @@ -144,7 +143,7 @@ const TargetModal = ({ reportVisible, kpiGroups, setReportVisible }: Props) => { |
144 | 143 | dataSource={data} |
145 | 144 | columns={realList} |
146 | 145 | loading={loading} |
147 | - scroll={{ x: true, y: 500 }} | |
146 | + scroll={{ x: 1000, y: 500 }} | |
148 | 147 | pagination={false} |
149 | 148 | /> |
150 | 149 | </Modal> | ... | ... |
src/pages/performance/KpiSetting/components/EditModal.tsx
... | ... | @@ -117,10 +117,10 @@ export default function EditModal({ onClose, setItem, item, roleList }: Props) { |
117 | 117 | <> |
118 | 118 | <Form.Item |
119 | 119 | name="businessName" |
120 | - label="业务模块对接" | |
121 | - rules={[{ required: true, message: "请输入业务模块对接名称" }]} | |
120 | + label="业务报表指标名称" | |
121 | + rules={[{ required: true, message: "请输入业务报表指标名称" }]} | |
122 | 122 | > |
123 | - <Input placeholder="请输入业务模块对接名称" /> | |
123 | + <Input placeholder="请输入业务报表指标名称" /> | |
124 | 124 | </Form.Item> |
125 | 125 | </> |
126 | 126 | ) : null | ... | ... |
src/pages/performance/KpiSetting/index.tsx
... | ... | @@ -78,7 +78,7 @@ export default () => { |
78 | 78 | /> |
79 | 79 | <Column title="数值类型" dataIndex="dataType" align="center" render={(type) => DataTypeEnum[type]} /> |
80 | 80 | <Column |
81 | - title="业务模块对接" | |
81 | + title="业务报表指标名称" | |
82 | 82 | dataIndex="businessName" |
83 | 83 | align="center" |
84 | 84 | render={(businessName: string, record: any) => { | ... | ... |
src/pages/stock/RepertoryFw/index.tsx
src/pages/stock/TicketImport/api.ts
... | ... | @@ -58,11 +58,16 @@ export function getTemplateCheck(params: { brandId: number, fid: string }): http |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * 押品数据导入解析 |
61 | - * /erp/ticket/collateral/import | |
62 | 61 | */ |
63 | 62 | export function importCollateralApi(params?: TicketImport.InvoiceParams): http.PromiseResp<any> { |
64 | 63 | return request.post(`${FVM_HOST}/erp/ticket/collateral/import`, params); |
65 | 64 | } |
65 | +/** | |
66 | + * 发动机号导入 | |
67 | + */ | |
68 | +export function importEnginenoApi(params?: TicketImport.InvoiceParams): http.PromiseResp<any> { | |
69 | + return request.get(`${FVM_HOST}/erp/ticket/engineNoImport`, { params }); | |
70 | +} | |
66 | 71 | |
67 | 72 | /** |
68 | 73 | * 押品数据确认提交 | ... | ... |
src/pages/stock/TicketImport/components/EnginenoUpload.tsx
0 → 100644
1 | +import React, { useState, useEffect } from "react"; | |
2 | +import { RightOutlined, UploadOutlined } from "@ant-design/icons"; | |
3 | +import { Button, Modal, Upload, message, Select, Form } from "antd"; | |
4 | +import { bankList } from "../entity"; | |
5 | +import { importEnginenoApi } from '../api'; | |
6 | +import { useStore } from "../index"; | |
7 | + | |
8 | +const Option = Select.Option; | |
9 | +interface Props { | |
10 | + visible: boolean; | |
11 | + onCancel: () => any; | |
12 | +} | |
13 | +const invoiceFilePath = { | |
14 | + 1: "invoice/bill-chang-an-template.xlsx", | |
15 | + 2: "invoice/bill-ceb-template.xls", | |
16 | + 3: "invoice/bill-spde-template.xls", | |
17 | +}; | |
18 | + | |
19 | +export default function Collateral({ visible, onCancel }: Props) { | |
20 | + const { setBreadcrumbs, breadcrumbs, setCollateralItem, setUploadCollateralModal, uploadCollateralModal } = useStore(); | |
21 | + const [form] = Form.useForm(); | |
22 | + const [saveLoading, setSaveLoading] = useState(false); | |
23 | + const [bankType, setBankType] = useState<string>(); | |
24 | + | |
25 | + useEffect(() => { | |
26 | + if (visible) { | |
27 | + if (uploadCollateralModal) { | |
28 | + form.setFieldsValue({ | |
29 | + ...uploadCollateralModal, | |
30 | + }); | |
31 | + } | |
32 | + } | |
33 | + }, [visible]); | |
34 | + | |
35 | + function beforeUpload(file: any) { | |
36 | + const isLt2M = file.size / 1024 / 1024 < 20; | |
37 | + if (!isLt2M) { | |
38 | + message.error("文件不能超过20MB!"); | |
39 | + } | |
40 | + return isLt2M; | |
41 | + } | |
42 | + function handleChange(e: any) { | |
43 | + if (Array.isArray(e)) { | |
44 | + return e.slice(-1); | |
45 | + } | |
46 | + if (!e.file.status) return []; | |
47 | + if (e.file.status == "error") { | |
48 | + message.error("文件上传出错,请重新上传"); | |
49 | + return ""; | |
50 | + } | |
51 | + return e && e.fileList.slice(-1); | |
52 | + } | |
53 | + const uploadProps = { | |
54 | + accept: ".xlsx,.xls", | |
55 | + name: "file", | |
56 | + multiple: false, | |
57 | + action: `api/file/upload`, | |
58 | + beforeUpload: (info: any) => beforeUpload(info), | |
59 | + }; | |
60 | + function saveBill(fieldsValue: any) { | |
61 | + setSaveLoading(true); | |
62 | + const pa = { | |
63 | + fid: fieldsValue.fid[0].response.data, | |
64 | + // invoiceType: fieldsValue.invoiceType, | |
65 | + }; | |
66 | + | |
67 | + // 点击确定按钮,发送请求 | |
68 | + importEnginenoApi(pa) | |
69 | + .then((res) => { | |
70 | + message.success("操作成功"); | |
71 | + setSaveLoading(false); | |
72 | + onCancel(); //添加押品数据modal不可见 | |
73 | + // setCollateralItem(res.data); | |
74 | + // setBreadcrumbs([...breadcrumbs, { name: "确认押品清单", key: "comfirmCollateral" }]); | |
75 | + // setUploadCollateralModal(fieldsValue); | |
76 | + }) | |
77 | + .catch((e) => { | |
78 | + setSaveLoading(false); | |
79 | + message.error(e.message); | |
80 | + }); | |
81 | + } | |
82 | + return ( | |
83 | + <Modal | |
84 | + visible={visible} | |
85 | + maskClosable={false} | |
86 | + title="发动机号导入" | |
87 | + onCancel={() => onCancel()} | |
88 | + confirmLoading={saveLoading} | |
89 | + onOk={form.submit} | |
90 | + afterClose={() => { | |
91 | + form.resetFields(); | |
92 | + // setBankType(undefined); | |
93 | + }} | |
94 | + > | |
95 | + <Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} onFinish={saveBill}> | |
96 | + <Form.Item | |
97 | + label="数据文档" | |
98 | + name="fid" | |
99 | + extra={ | |
100 | + <a href="api/fvm/ticket/engineNoTemplateExport" rel="noopener noreferrer"> | |
101 | + 下载模板 | |
102 | + <RightOutlined /> | |
103 | + </a> | |
104 | + } | |
105 | + rules={[{ required: true, message: "请上传发动机号数据文档" }]} | |
106 | + valuePropName="fileList" | |
107 | + getValueFromEvent={handleChange} | |
108 | + > | |
109 | + <Upload {...uploadProps}> | |
110 | + <Button icon={<UploadOutlined />} style={{ width: 300 }}> | |
111 | + 上传票据押品数据文档 | |
112 | + </Button> | |
113 | + </Upload> | |
114 | + </Form.Item> | |
115 | + </Form> | |
116 | + </Modal> | |
117 | + ); | |
118 | +} | ... | ... |
src/pages/stock/TicketImport/components/List.tsx
... | ... | @@ -11,6 +11,7 @@ import useInitial from '@/hooks/useInitail'; |
11 | 11 | import _ from 'lodash'; |
12 | 12 | import { useStore } from '../index'; |
13 | 13 | import Collateral from './Collateral'; |
14 | +import EnginenoUpload from './EnginenoUpload'; | |
14 | 15 | |
15 | 16 | const Column = Table.Column; |
16 | 17 | const { MonthPicker } = DatePicker; |
... | ... | @@ -20,6 +21,7 @@ export default function TicketImport() { |
20 | 21 | const [delay, setDelay] = useState(true); |
21 | 22 | const { loading, data, setParams, params } = useInitial<TicketImport.Item[], TicketImport.QueryParams>(api.getPageListApi, [], {}, delay); |
22 | 23 | const [templateVisble, setTemplateVisible] = useState(false); |
24 | + const [engineVisible, setEngineVisible] = useState(false); | |
23 | 25 | |
24 | 26 | useEffect(() => { |
25 | 27 | if (brandList.length > 0) { |
... | ... | @@ -49,36 +51,37 @@ export default function TicketImport() { |
49 | 51 | |
50 | 52 | return ( |
51 | 53 | <Card> |
52 | - <Row style={{ marginBottom: 10 }}> | |
53 | - <Col span={14} style={{ display: "flex", flexWrap: "nowrap" }}> | |
54 | - <MonthPicker | |
55 | - allowClear={false} | |
56 | - defaultValue={moment()} | |
57 | - placeholder="请选择月份" | |
58 | - style={{ width: 200, marginRight: 20 }} | |
59 | - onChange={(date) => { | |
60 | - setParams({ ticketTime: (date && date.valueOf()) || undefined }, true); | |
61 | - }} | |
62 | - /> | |
63 | - <Select style={{ width: 200, marginRight: 20 }} placeholder="请选择品牌" value={params.brandId} onChange={(v) => setParams({ ...params, brandId: v }, true)}> | |
64 | - {brandList.map((item) => ( | |
65 | - <Select.Option value={item.brandId} key={item.brandId}> | |
66 | - {item.brandName} | |
67 | - </Select.Option> | |
68 | - ))} | |
69 | - </Select> | |
70 | - <Select allowClear style={{ width: 200 }} showSearch optionFilterProp="children" value={params.dealerId} placeholder="搜索商家" onChange={(v) => setParams({ ...params, dealerId: v }, true)}> | |
71 | - {dealerList.map((d) => ( | |
72 | - <Select.Option key={d.id} value={d.id!}> | |
73 | - {d.name} | |
74 | - </Select.Option> | |
75 | - ))} | |
76 | - </Select> | |
77 | - </Col> | |
78 | - | |
54 | + <Row justify="space-between" style={{ marginBottom: 10 }}> | |
55 | + {/* <Col span={14} style={{ display: "flex", flexWrap: "nowrap" }}> */} | |
56 | + <MonthPicker | |
57 | + allowClear={false} | |
58 | + defaultValue={moment()} | |
59 | + placeholder="请选择月份" | |
60 | + style={{ width: 200, marginRight: 20 }} | |
61 | + onChange={(date) => { | |
62 | + setParams({ ticketTime: (date && date.valueOf()) || undefined }, true); | |
63 | + }} | |
64 | + /> | |
65 | + <Select style={{ width: 200, marginRight: 20 }} placeholder="请选择品牌" value={params.brandId} onChange={(v) => setParams({ ...params, brandId: v }, true)}> | |
66 | + {brandList.map((item) => ( | |
67 | + <Select.Option value={item.brandId} key={item.brandId}> | |
68 | + {item.brandName} | |
69 | + </Select.Option> | |
70 | + ))} | |
71 | + </Select> | |
72 | + <Select allowClear style={{ width: 200 }} showSearch optionFilterProp="children" value={params.dealerId} placeholder="搜索商家" onChange={(v) => setParams({ ...params, dealerId: v }, true)}> | |
73 | + {dealerList.map((d) => ( | |
74 | + <Select.Option key={d.id} value={d.id!}> | |
75 | + {d.name} | |
76 | + </Select.Option> | |
77 | + ))} | |
78 | + </Select> | |
79 | + {/* </Col> */} | |
80 | + </Row> | |
81 | + <Row justify="end" style={{ marginBottom: 15 }}> | |
79 | 82 | <Col span={10} style={{ display: "flex", justifyContent: "flex-end" }}> |
80 | - <Button type="primary" onClick={() => setTemplateVisible(true)} style={{ width: 100, marginRight: 20 }}> | |
81 | - 模板校验 | |
83 | + <Button type="primary" onClick={() => setTemplateVisible(true)} style={{ marginRight: 20 }}> | |
84 | + 长安模板校验 | |
82 | 85 | </Button> |
83 | 86 | <Dropdown |
84 | 87 | overlay={ |
... | ... | @@ -98,6 +101,9 @@ export default function TicketImport() { |
98 | 101 | <Button icon={<UploadOutlined />} type="primary" onClick={() => setCollateralVisible(true)} style={{ width: 100, marginRight: 20 }}> |
99 | 102 | 押品导入 |
100 | 103 | </Button> |
104 | + <Button icon={<UploadOutlined />} type="primary" onClick={() => setEngineVisible(true)} style={{ marginRight: 20 }}> | |
105 | + 发动机号导入 | |
106 | + </Button> | |
101 | 107 | </Col> |
102 | 108 | </Row> |
103 | 109 | |
... | ... | @@ -144,6 +150,7 @@ export default function TicketImport() { |
144 | 150 | /> |
145 | 151 | {/* <Collateral visible={collateralVisible} onCancel={() => setCollateralVisible(false)} onsave={saveBills} /> */} |
146 | 152 | <Collateral visible={collateralVisible} onCancel={() => setCollateralVisible(false)} /> |
153 | + <EnginenoUpload visible={engineVisible} onCancel={() => setEngineVisible(false)} /> | |
147 | 154 | </Card> |
148 | 155 | ); |
149 | 156 | } |
150 | 157 | \ No newline at end of file | ... | ... |
src/pages/stock/TicketImport/components/TemplateCheck.tsx
... | ... | @@ -113,6 +113,7 @@ export default function TemplateCheck(props: Props) { |
113 | 113 | wrapperCol={{ span: 15 }} |
114 | 114 | > |
115 | 115 | <Form.Item label="品牌" name="brandId" rules={[{ required: true, message: '请选择品牌' }]}> |
116 | + {/* 暂时过滤哈佛、魏牌品牌 */} | |
116 | 117 | <Select |
117 | 118 | labelInValue |
118 | 119 | placeholder="请选择品牌" |
... | ... | @@ -123,7 +124,7 @@ export default function TemplateCheck(props: Props) { |
123 | 124 | onChange={(v: any) => { setBrandId(v); brandId && form.setFieldsValue({ fid1: undefined, fid2: undefined }); }} |
124 | 125 | > |
125 | 126 | { |
126 | - brandList && brandList.map((item) => { | |
127 | + brandList && brandList.filter(i => !["59", "148"].includes(String(i.brandId))).map((item) => { | |
127 | 128 | return <Option value={item.brandId} key={item.brandId}>{item.brandName}</Option>; |
128 | 129 | }) |
129 | 130 | } | ... | ... |
src/pages/stock/TicketImport/components/TicketDetail.tsx
... | ... | @@ -28,6 +28,7 @@ export default function TicketDetail() { |
28 | 28 | onChange={(_pagination) => setParams({ ..._pagination }, true)} |
29 | 29 | > |
30 | 30 | <Column title="VIN" dataIndex="vin" align="center" /> |
31 | + <Column title="发动机号" dataIndex="engineNo" /> | |
31 | 32 | <Column title="订单类型" dataIndex="orderType" align="center" render={(text) => <span>{orderType[text]}</span>} /> |
32 | 33 | <Column title="车辆类型" dataIndex="vehicleType" align="center" render={(text) => <span>{vehicleType[text]}</span>} /> |
33 | 34 | <Column title="资金类型" dataIndex="financeType" align="center" render={(text) => <span>{financeType[text]}</span>} /> | ... | ... |
src/pages/stock/TicketImport/components/UploadExcel.tsx
... | ... | @@ -157,7 +157,7 @@ export default function UploadExcel(props: Props) { |
157 | 157 | }} |
158 | 158 | > |
159 | 159 | { |
160 | - brandList && brandList.map((item) => { | |
160 | + brandList && brandList.filter(i => !["59", "148"].includes(String(i.brandId))).map((item) => { | |
161 | 161 | return <Option value={item.brandId} key={item.brandId}>{item.brandName}</Option>; |
162 | 162 | }) |
163 | 163 | } | ... | ... |