kts-component-invoice-operate 3.2.247 → 3.2.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +2 -0
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +6 -0
- package/dist/Invoice/ui/default/MeiTanModal/index.d.ts +4 -0
- package/dist/index.esm.js +297 -9
- package/dist/index.js +296 -8
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/importGoods/index.tsx +671 -1
- package/src/Invoice/Invoice-digtal/index.md +6 -7
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +2 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +17 -1
- package/src/Invoice/_test/importGoods/index.tsx +72 -4
- package/src/Invoice/index.md +5 -5
- package/src/Invoice/index.tsx +3 -0
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +23 -15
- package/src/Invoice/ui/default/ImportGoodsDrawer/index.tsx +7 -1
- package/src/Invoice/ui/default/MeiTanModal/index.less +40 -0
- package/src/Invoice/ui/default/MeiTanModal/index.tsx +155 -0
|
@@ -26,20 +26,19 @@
|
|
|
26
26
|
<code src="./_test/disabled/index.tsx"></code>
|
|
27
27
|
|
|
28
28
|
## 导入关系人
|
|
29
|
-
<code src="./_test/importStakeholder/index.tsx"></code
|
|
29
|
+
<code src="./_test/importStakeholder/index.tsx"></code>-->
|
|
30
|
+
|
|
31
|
+
|
|
30
32
|
|
|
31
33
|
## 导入项目
|
|
32
34
|
<code src="./_test/importGoods/index.tsx"></code>
|
|
33
35
|
|
|
34
|
-
## 预制模式
|
|
36
|
+
<!-- ## 预制模式
|
|
35
37
|
<code src="./_test/prefab/index.tsx"></code>
|
|
36
38
|
|
|
37
39
|
## 查看当前可用授信额度
|
|
38
|
-
<code src="./_test/lineCredit/index.tsx"></code>
|
|
39
|
-
|
|
40
|
+
<code src="./_test/lineCredit/index.tsx"></code> -->
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
-->
|
|
43
|
-
<!--
|
|
44
43
|
## 货物运输服务
|
|
45
|
-
<code src="./_test/freight/index.tsx"></code>
|
|
44
|
+
<code src="./_test/freight/index.tsx"></code>
|
|
@@ -23,7 +23,7 @@ export default class GoodsListState {
|
|
|
23
23
|
|
|
24
24
|
/** 是否根据税收分类编码改变商品的可选税率 */
|
|
25
25
|
isUpdateGoodsTaxRateList = false;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
/** 是否能添加折扣行 */
|
|
28
28
|
isAddDiscount?: boolean;
|
|
29
29
|
|
|
@@ -131,4 +131,20 @@ export default class GoodsListState {
|
|
|
131
131
|
/** 商品校验是否关闭,默认开启 */
|
|
132
132
|
isValidateGood = true;
|
|
133
133
|
|
|
134
|
+
/** 煤炭类校验是否关闭,默认开启 */
|
|
135
|
+
isValidateMeiTan = true;
|
|
136
|
+
|
|
137
|
+
/** 煤炭种类赋值商品索引 */
|
|
138
|
+
meiTanGoodIndex?: string[] = [];
|
|
139
|
+
|
|
140
|
+
/** 煤炭时校验函数 */
|
|
141
|
+
verifyMeiTanFn: (record: any) => Promise<boolean> = async record => {
|
|
142
|
+
const { taxClassificationCode } = record;
|
|
143
|
+
if (taxClassificationCode === '1020101000000000000' || taxClassificationCode === '1020102000000000000' || taxClassificationCode === '1020199000000000000') {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return false;
|
|
148
|
+
};
|
|
149
|
+
|
|
134
150
|
}
|
|
@@ -147,6 +147,40 @@ class MyInvoiceController extends InvoiceController {
|
|
|
147
147
|
this.state.goodsListState.endowCode.onSearchTaxClassificationCode = async (value: any) => {
|
|
148
148
|
console.log(value, 'value-onSearchTaxClassificationCode');
|
|
149
149
|
|
|
150
|
+
if(value === '1020199000000000000') {
|
|
151
|
+
return [
|
|
152
|
+
{
|
|
153
|
+
"taxCategoryCode": "1020199000000000000",
|
|
154
|
+
"productName": "其他煤炭",
|
|
155
|
+
"shorthand": "其他煤炭",
|
|
156
|
+
"id": null,
|
|
157
|
+
"specification": null,
|
|
158
|
+
"createTime": "Tue Jun 20 14:55:37 CST 2023",
|
|
159
|
+
"status": 1,
|
|
160
|
+
"versionCode": "48.0",
|
|
161
|
+
"version": "32.0",
|
|
162
|
+
"startTime": "20190401",
|
|
163
|
+
"endTime": null,
|
|
164
|
+
"cargo": null,
|
|
165
|
+
"desc": null,
|
|
166
|
+
"taxRate": "",
|
|
167
|
+
"keyword": "金融服务",
|
|
168
|
+
"summarizedItem": "Y",
|
|
169
|
+
"countCode": null,
|
|
170
|
+
"customsItem": null,
|
|
171
|
+
"updateTime": "Tue Jun 20 14:55:37 CST 2023",
|
|
172
|
+
"hzx": "Y",
|
|
173
|
+
"children": null,
|
|
174
|
+
"vatspecialManagement": "",
|
|
175
|
+
"pid": "3000000000000000000",
|
|
176
|
+
"vatpolicyBasis": null,
|
|
177
|
+
"vatspecialManagementCode": "",
|
|
178
|
+
"gstpolicyBasisCode": null,
|
|
179
|
+
"gstspecialManagement": null,
|
|
180
|
+
"gstpolicyBasis": null
|
|
181
|
+
},
|
|
182
|
+
]
|
|
183
|
+
}
|
|
150
184
|
return [
|
|
151
185
|
{
|
|
152
186
|
"taxCategoryCode": "1030206030000000000",
|
|
@@ -183,6 +217,40 @@ class MyInvoiceController extends InvoiceController {
|
|
|
183
217
|
|
|
184
218
|
this.state.goodsListState.endowCode.onLoadTaxClassificationCode = async (value: any) => {
|
|
185
219
|
console.log(value, 'value-onSearchTaxClassificationCode');
|
|
220
|
+
if(value === '1020199000000000000') {
|
|
221
|
+
return [
|
|
222
|
+
{
|
|
223
|
+
"taxCategoryCode": "1020199000000000000",
|
|
224
|
+
"productName": "其他煤炭",
|
|
225
|
+
"shorthand": "其他煤炭",
|
|
226
|
+
"id": null,
|
|
227
|
+
"specification": null,
|
|
228
|
+
"createTime": "Tue Jun 20 14:55:37 CST 2023",
|
|
229
|
+
"status": 1,
|
|
230
|
+
"versionCode": "48.0",
|
|
231
|
+
"version": "32.0",
|
|
232
|
+
"startTime": "20190401",
|
|
233
|
+
"endTime": null,
|
|
234
|
+
"cargo": null,
|
|
235
|
+
"desc": null,
|
|
236
|
+
"taxRate": "",
|
|
237
|
+
"keyword": "金融服务",
|
|
238
|
+
"summarizedItem": "Y",
|
|
239
|
+
"countCode": null,
|
|
240
|
+
"customsItem": null,
|
|
241
|
+
"updateTime": "Tue Jun 20 14:55:37 CST 2023",
|
|
242
|
+
"hzx": "Y",
|
|
243
|
+
"children": null,
|
|
244
|
+
"vatspecialManagement": "",
|
|
245
|
+
"pid": "3000000000000000000",
|
|
246
|
+
"vatpolicyBasis": null,
|
|
247
|
+
"vatspecialManagementCode": "",
|
|
248
|
+
"gstpolicyBasisCode": null,
|
|
249
|
+
"gstspecialManagement": null,
|
|
250
|
+
"gstpolicyBasis": null
|
|
251
|
+
},
|
|
252
|
+
]
|
|
253
|
+
}
|
|
186
254
|
if(value === '3000000000000000000') {
|
|
187
255
|
return [
|
|
188
256
|
{
|
|
@@ -809,7 +877,7 @@ const getMok = async (current: number = 1) => {
|
|
|
809
877
|
"id": 146200,
|
|
810
878
|
"internalNumber": "发动机盖",
|
|
811
879
|
"isUalityInspection": null,
|
|
812
|
-
"name": "
|
|
880
|
+
"name": "原煤",
|
|
813
881
|
"preferentialPoliciesType": null,
|
|
814
882
|
"priceAmount": 50,
|
|
815
883
|
"procurementCycle": 0,
|
|
@@ -817,7 +885,7 @@ const getMok = async (current: number = 1) => {
|
|
|
817
885
|
"specification": "abc",
|
|
818
886
|
"spuCode": "6000001738252675",
|
|
819
887
|
"status": 1,
|
|
820
|
-
"taxCategoryCode": "
|
|
888
|
+
"taxCategoryCode": "1020101000000000000",
|
|
821
889
|
"taxExemptionType": "",
|
|
822
890
|
"taxId": 11,
|
|
823
891
|
"taxRate": null,
|
|
@@ -825,13 +893,13 @@ const getMok = async (current: number = 1) => {
|
|
|
825
893
|
"unitName": "件",
|
|
826
894
|
"itemType": "通用",
|
|
827
895
|
"itemNo": "6000001738252675",
|
|
828
|
-
"itemName": "
|
|
896
|
+
"itemName": "原煤",
|
|
829
897
|
"itemCode": "123123",
|
|
830
898
|
"itemModelName": "abc",
|
|
831
899
|
"unit": "件",
|
|
832
900
|
"priceIncludeTax": 50,
|
|
833
901
|
"priceExcludeTax": 50,
|
|
834
|
-
"taxClassificationCode": "
|
|
902
|
+
"taxClassificationCode": "1020101000000000000"
|
|
835
903
|
},
|
|
836
904
|
{
|
|
837
905
|
"attributeVOList": null,
|
package/src/Invoice/index.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# 默认
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 简单用法
|
|
4
4
|
<code src="./_test/easiest/index.tsx"></code>
|
|
5
5
|
|
|
6
6
|
## 设置为草稿,设置默认参数 扩展按钮
|
|
7
7
|
<code src="./_test/draft/index.tsx" title="类似的操作,请查看API" ></code>
|
|
8
8
|
|
|
9
9
|
## 设置购买方名称搜索
|
|
10
|
-
<code src="./_test/buyerNameSearch/index.tsx"></code>
|
|
10
|
+
<code src="./_test/buyerNameSearch/index.tsx"></code>
|
|
11
11
|
|
|
12
12
|
## 设置扣除额(差额征税)
|
|
13
13
|
<code src="./_test/deduction/index.tsx"></code>
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<code src="./_test/goodsMenuExpand/index.tsx" title="查看 Console" ></code>
|
|
38
38
|
|
|
39
39
|
## 设置数据源 获取发票单据编号
|
|
40
|
-
<code src="./_test/setDataSource/index.tsx" ></code
|
|
40
|
+
<code src="./_test/setDataSource/index.tsx" ></code>-->
|
|
41
41
|
|
|
42
42
|
## 设置数据源 导入购买方
|
|
43
43
|
<code src="./_test/importBuyer/index.tsx"></code>
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
## 设置数据源 赋码 税收分类编码列表
|
|
49
49
|
<code src="./_test/endowCode/index.tsx"></code>
|
|
50
50
|
|
|
51
|
-
<API name="Invoice 发票组件 API" exports='["default"]' src="./index.tsx" ></API>
|
|
51
|
+
<!-- <API name="Invoice 发票组件 API" exports='["default"]' src="./index.tsx" ></API>
|
|
52
52
|
<API name="InvoiceHeader 发票头 API" exports='["default"]' src="./ui/default/InvoiceHeader/index.tsx"></API>
|
|
53
53
|
<API name="GoodsList 商品列表 API" exports='["default"]' src="./ui/default/GoodsList/index.tsx"></API>
|
|
54
54
|
<API name="Buyer 购买方 API" exports='["default"]' src="./ui/default/Buyer/index.tsx"></API>
|
|
55
55
|
<API name="Seller 销售方 API" exports='["default"]' src="./ui/default/Seller/index.tsx"></API>
|
|
56
|
-
<API name="Sign 落款 API" exports='["default"]' src="./ui/default/Sign/index.tsx"></API>
|
|
56
|
+
<API name="Sign 落款 API" exports='["default"]' src="./ui/default/Sign/index.tsx"></API> -->
|
package/src/Invoice/index.tsx
CHANGED
|
@@ -27,6 +27,7 @@ import ImportBuyerDrawer from './ui/default/ImportBuyerDrawer';
|
|
|
27
27
|
import ImportGoodsDrawer from './ui/default/ImportGoodsDrawer';
|
|
28
28
|
import EndowCodeDrawer from './ui/default/EndowCodeDrawer';
|
|
29
29
|
import AddComparisonDrawer from './ui/default/AddComparisonDrawer';
|
|
30
|
+
import MeiTanModal from './ui/default/MeiTanModal';
|
|
30
31
|
// import { create, all } from 'mathjs';
|
|
31
32
|
// const config = {
|
|
32
33
|
// number: 'BigNumber',
|
|
@@ -164,6 +165,7 @@ const Main = (props: IInvoiceProps) => {
|
|
|
164
165
|
<ImportGoodsDrawer />{/* 导入货品的抽屉 */}
|
|
165
166
|
<EndowCodeDrawer />{/* 给货品赋码的抽屉 */}
|
|
166
167
|
<AddComparisonDrawer />{/* 添加商品对照的抽屉 */}
|
|
168
|
+
<MeiTanModal /> {/* 煤炭类弹框 */}
|
|
167
169
|
</InvoiceContext.Provider>
|
|
168
170
|
);
|
|
169
171
|
};
|
|
@@ -193,6 +195,7 @@ const Digtal = (props: IInvoiceProps) => {
|
|
|
193
195
|
|
|
194
196
|
<ImportGoodsDrawer />{ /** 导入货品的抽屉 */}
|
|
195
197
|
<EndowCodeDrawer />{ /** 给货品赋码的抽屉 */}
|
|
198
|
+
<MeiTanModal /> {/* 煤炭类弹框 */}
|
|
196
199
|
</InvoiceContext.Provider>
|
|
197
200
|
)
|
|
198
201
|
}
|
|
@@ -317,9 +317,9 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
317
317
|
const [list, setList] = React.useState<any>([]);
|
|
318
318
|
|
|
319
319
|
const onSearch = React.useCallback(async (value: any = null) => {
|
|
320
|
-
if(value?.target?.value){
|
|
320
|
+
if (value?.target?.value) {
|
|
321
321
|
const arr = await controller.state.goodsListState.endowCode.onSearchTaxClassificationCode(value?.target?.value);
|
|
322
|
-
const list: any[] = arr.map((item: any)=> {
|
|
322
|
+
const list: any[] = arr.map((item: any) => {
|
|
323
323
|
return {
|
|
324
324
|
...item,
|
|
325
325
|
title: `${item.productName} ${item.taxCategoryCode}`,
|
|
@@ -335,7 +335,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
335
335
|
|
|
336
336
|
const onLoad = React.useCallback(async (value?: any) => {
|
|
337
337
|
const arr = await controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value?.taxCategoryCode);
|
|
338
|
-
const data: any[] = arr.map((item: any)=> {
|
|
338
|
+
const data: any[] = arr.map((item: any) => {
|
|
339
339
|
return {
|
|
340
340
|
...item,
|
|
341
341
|
title: `${item.productName} ${item.taxCategoryCode}`,
|
|
@@ -345,8 +345,8 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
345
345
|
|
|
346
346
|
const treeData = optimizeTreeData(data);
|
|
347
347
|
|
|
348
|
-
if(value?.key) {
|
|
349
|
-
setList((origin: any)=> {
|
|
348
|
+
if (value?.key) {
|
|
349
|
+
setList((origin: any) => {
|
|
350
350
|
updateTreeData(origin, value.key, treeData)
|
|
351
351
|
});
|
|
352
352
|
} else {
|
|
@@ -386,20 +386,20 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
386
386
|
// });
|
|
387
387
|
let node = info.node || info;
|
|
388
388
|
actions.setFieldState('taxClassificationCode', async s => {
|
|
389
|
-
if(node.taxCategoryCode) {
|
|
389
|
+
if (node.taxCategoryCode) {
|
|
390
390
|
s.value = node.taxCategoryCode
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
|
|
394
394
|
actions.setFieldState('shorthand', async (s) => {
|
|
395
|
-
if (node.shorthand){
|
|
395
|
+
if (node.shorthand) {
|
|
396
396
|
s.value = node.shorthand
|
|
397
397
|
}
|
|
398
|
-
});
|
|
398
|
+
});
|
|
399
399
|
setOpen(false);
|
|
400
400
|
}, [controller, actions]);
|
|
401
401
|
|
|
402
|
-
const onSelect = React.useCallback((key: any, info: any) => {
|
|
402
|
+
const onSelect = React.useCallback((key: any, info: any) => {
|
|
403
403
|
let node = info.node || info;
|
|
404
404
|
if (controller.state.goodsListState.isUpdateGoodsTaxRateList) {
|
|
405
405
|
if (node.taxRateList?.length) {
|
|
@@ -421,7 +421,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
421
421
|
}, [controller, actions]);
|
|
422
422
|
|
|
423
423
|
const optimizeTreeData = (data: any): any => {
|
|
424
|
-
return data.map((item: any)=> {
|
|
424
|
+
return data.map((item: any) => {
|
|
425
425
|
return {
|
|
426
426
|
...item,
|
|
427
427
|
selectable: item?.hzx === 'N',
|
|
@@ -459,7 +459,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
459
459
|
info={info}
|
|
460
460
|
onSelect={onSelect}
|
|
461
461
|
onSubmit={onSubmit1}
|
|
462
|
-
onCancel={()=> {setOpen(false); setInfo({})}}
|
|
462
|
+
onCancel={() => { setOpen(false); setInfo({}) }}
|
|
463
463
|
onSearch={onSearch}
|
|
464
464
|
onLoad={onLoad}
|
|
465
465
|
/>
|
|
@@ -486,11 +486,12 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
486
486
|
good.taxFreeType = values.taxFreeType;
|
|
487
487
|
good.favouredPolicyMark = values.favouredPolicyMark;
|
|
488
488
|
good.favouredPolicyName = values.favouredPolicyName;
|
|
489
|
+
good.mtzlDm = undefined; //设置成空
|
|
489
490
|
|
|
490
491
|
// 无论是否含税,都保持价税合计不变
|
|
491
492
|
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
492
|
-
if (good.taxAmount || good.taxAmount === 0
|
|
493
|
-
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
|
493
|
+
if (good.taxAmount || good.taxAmount === 0) {
|
|
494
|
+
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
|
494
495
|
}
|
|
495
496
|
if (good.lineAmountExcludeTax && good.quantity) {
|
|
496
497
|
good.priceExcludeTax = countPrice(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits) as any;
|
|
@@ -500,8 +501,15 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
500
501
|
good.goodsTaxRateList = goodsTaxRateList;
|
|
501
502
|
|
|
502
503
|
});
|
|
503
|
-
|
|
504
504
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|
|
505
|
+
|
|
506
|
+
// 煤炭类判断
|
|
507
|
+
if (s.goodsListState.isValidateMeiTan) {
|
|
508
|
+
if (await s.goodsListState.verifyMeiTanFn(values) === true) {
|
|
509
|
+
s.goodsListState.meiTanGoodIndex = s.goodsListState.endowCode.endowcodeGoodIndex.slice();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
505
513
|
s.goodsListState.endowCode.endowcodeGoodIndex = [];
|
|
506
514
|
})();
|
|
507
515
|
}, [controller, goodsTaxRateList]);
|
|
@@ -532,7 +540,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
532
540
|
}, [controller]);
|
|
533
541
|
|
|
534
542
|
return (
|
|
535
|
-
<SchemaForm actions={actions} previewPlaceholder=" "
|
|
543
|
+
<SchemaForm actions={actions} previewPlaceholder=" " components={{ ...components, showSearch: !!controller.state.goodsListState.endowCode.onLoadTaxClassificationCode ? ShowSearch3 : ShowSearch }} effects={effects}>
|
|
536
544
|
<FormButtonGroup>
|
|
537
545
|
<Field
|
|
538
546
|
name="taxClassificationCode"
|
|
@@ -14,7 +14,7 @@ export default () => {
|
|
|
14
14
|
const topExpand = controller.useMemo(s => s.goodsListState.importGoods.topExpand, []);
|
|
15
15
|
|
|
16
16
|
const onClose = React.useCallback(() => {
|
|
17
|
-
controller.pipeline(async s => {
|
|
17
|
+
controller.pipeline(async s => {
|
|
18
18
|
s.goodsListState.importGoods.filter = {};
|
|
19
19
|
s.goodsListState.importGoods.isVisibleDrawer = false;
|
|
20
20
|
})();
|
|
@@ -90,6 +90,7 @@ const DrawerBody = () => {
|
|
|
90
90
|
...s.goodsListState.editGood,
|
|
91
91
|
itemModelName: undefined,
|
|
92
92
|
itemModelNameSelf: undefined,
|
|
93
|
+
mtzlDm: undefined,
|
|
93
94
|
...between
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -128,6 +129,11 @@ const DrawerBody = () => {
|
|
|
128
129
|
s.goodsListState.isTaxIncluded
|
|
129
130
|
? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
|
|
130
131
|
: await updateUnitPriceTax(controller, s.goodsListState.form, record)
|
|
132
|
+
if (s.goodsListState.isValidateMeiTan) {
|
|
133
|
+
if (await s.goodsListState.verifyMeiTanFn(record) === true) {
|
|
134
|
+
s.goodsListState.meiTanGoodIndex = [editGood.$index];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
131
137
|
})
|
|
132
138
|
}
|
|
133
139
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.kts-invoice-operate-meitan-modal {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
|
|
5
|
+
.kts-invoice-operate-meitan-title {
|
|
6
|
+
|
|
7
|
+
line-height: 30px;
|
|
8
|
+
|
|
9
|
+
.kts-invoice-operate-meitan-title2 {
|
|
10
|
+
margin-left: 24px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.kts-invoice-operate-meitan-content {
|
|
16
|
+
margin-top: 20px;
|
|
17
|
+
padding: 20px;
|
|
18
|
+
background-color: #f9fafd;
|
|
19
|
+
|
|
20
|
+
.content-item {
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
margin: 20px 24px;
|
|
23
|
+
padding: 20px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ktsAntX-space-item {
|
|
28
|
+
margin: 5px 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ktsAntX-form-item-explain {
|
|
32
|
+
margin-top: 20px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
.kts-invoice-operate-meitan-button {
|
|
36
|
+
display: flex!important;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: 2px 20px!important;
|
|
40
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, Form, Radio, Space } from 'kts-components-antd-x4';
|
|
3
|
+
import { Button, message } from 'kts-xui'
|
|
4
|
+
import Invoice from '../../..';
|
|
5
|
+
import './index.less';
|
|
6
|
+
import LineAttributeType from '@/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/LineAttributeType';
|
|
7
|
+
|
|
8
|
+
export default () => {
|
|
9
|
+
|
|
10
|
+
const controller = Invoice.useInvoiceController();
|
|
11
|
+
|
|
12
|
+
const [form] = Form.useForm();
|
|
13
|
+
|
|
14
|
+
const [mainOption, setMainOption] = React.useState(null);
|
|
15
|
+
// 监听煤炭种类变化
|
|
16
|
+
const mtzlDm = Form.useWatch('mtzlDm', form);
|
|
17
|
+
|
|
18
|
+
const visible = controller.useMemo((s) => s.goodsListState.meiTanGoodIndex && s.goodsListState.meiTanGoodIndex.length > 0, []);
|
|
19
|
+
|
|
20
|
+
const onClose = React.useCallback(() => {
|
|
21
|
+
controller.pipeline(async (s) => {
|
|
22
|
+
s.goodsListState.meiTanGoodIndex = [];
|
|
23
|
+
form.setFieldsValue({ mtzlDm: undefined });
|
|
24
|
+
setMainOption(null);
|
|
25
|
+
})();
|
|
26
|
+
}, [controller]);
|
|
27
|
+
|
|
28
|
+
// 提交表单
|
|
29
|
+
const onSubmit = () => {
|
|
30
|
+
form.submit();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// 表单
|
|
34
|
+
const onFinish = (values: any) => {
|
|
35
|
+
console.log('煤炭种类:', values);
|
|
36
|
+
|
|
37
|
+
controller.pipeline(async (s) => {
|
|
38
|
+
const mtzl = values.mtzlDm;
|
|
39
|
+
const goods = s.goodsListState.meiTanGoodIndex?.map(e => s.goodsListState.goodsMap.get(e)) || [];
|
|
40
|
+
const editGood = s.goodsListState.editGood;
|
|
41
|
+
const editGoodIndex = editGood?.$index;
|
|
42
|
+
goods.forEach((g) => {
|
|
43
|
+
if (!g) return;
|
|
44
|
+
if (g.lineAttribute === LineAttributeType.被折扣行 || g.lineAttribute === LineAttributeType.正常) {
|
|
45
|
+
g.mtzlDm = mtzl;
|
|
46
|
+
if (editGood && editGoodIndex === g.$index) { // 编辑行
|
|
47
|
+
editGood.mtzlDm = mtzl;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|
|
52
|
+
onClose();
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// 自定义校验规则
|
|
58
|
+
const validateOption = (_:any, value: any, callback: any) => {
|
|
59
|
+
console.log('自定义校验规则:', value);
|
|
60
|
+
if (!value) {
|
|
61
|
+
return Promise.reject(new Error('请选择选项'));
|
|
62
|
+
// callback('请选择选项');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (value === '0200') {
|
|
66
|
+
return Promise.reject(new Error('请选择长协煤的子选项'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return Promise.resolve();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleMainOptionChange = (e: any) => {
|
|
73
|
+
const value = e.target.value;
|
|
74
|
+
setMainOption(value);
|
|
75
|
+
if (value === 'A' || value === 'C') {
|
|
76
|
+
form.setFieldsValue({ mtzlDm: value });
|
|
77
|
+
} else if (value === 'B') {
|
|
78
|
+
form.setFieldsValue({ mtzlDm: undefined }); // 清空option,等待选择子选项
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Modal
|
|
84
|
+
title="温馨提示"
|
|
85
|
+
destroyOnClose={true}
|
|
86
|
+
width={700}
|
|
87
|
+
onCancel={onClose}
|
|
88
|
+
visible={visible}
|
|
89
|
+
footer={
|
|
90
|
+
<Space align='end' style={{ paddingRight: 20 }}>
|
|
91
|
+
<Button
|
|
92
|
+
onClick={onClose}
|
|
93
|
+
className='kts-invoice-operate-meitan-button'
|
|
94
|
+
>
|
|
95
|
+
取消
|
|
96
|
+
</Button>
|
|
97
|
+
<Button type="primary" onClick={onSubmit} className='kts-invoice-operate-meitan-button'>
|
|
98
|
+
|
|
99
|
+
确定
|
|
100
|
+
</Button>
|
|
101
|
+
</Space>
|
|
102
|
+
}
|
|
103
|
+
>
|
|
104
|
+
<div className='kts-invoice-operate-meitan-modal'>
|
|
105
|
+
<div className='kts-invoice-operate-meitan-title'>
|
|
106
|
+
<div>尊敬的纳税人:</div>
|
|
107
|
+
<div className='kts-invoice-operate-meitan-title2'>您选择了“煤炭”类商品编码,请根据真实业务情况选择
|
|
108
|
+
“煤炭种类”:</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div className='kts-invoice-operate-meitan-content'>
|
|
111
|
+
<Form
|
|
112
|
+
form={form}
|
|
113
|
+
layout="vertical"
|
|
114
|
+
initialValues={{ mtzlDm: null }}
|
|
115
|
+
onFinish={onFinish}
|
|
116
|
+
>
|
|
117
|
+
<Form.Item
|
|
118
|
+
name="mtzlDm"
|
|
119
|
+
label=""
|
|
120
|
+
rules={[
|
|
121
|
+
// { required: true , message: '请选择煤炭种类' },
|
|
122
|
+
{ validator: validateOption }
|
|
123
|
+
]}
|
|
124
|
+
>
|
|
125
|
+
<Radio.Group value={mainOption} onChange={handleMainOptionChange}>
|
|
126
|
+
<Space direction="vertical">
|
|
127
|
+
<Radio value="0100">政府保供煤</Radio>
|
|
128
|
+
<div>
|
|
129
|
+
<Radio value="0200">长协煤</Radio>
|
|
130
|
+
{mainOption === '0200' && (
|
|
131
|
+
<div className='content-item'>
|
|
132
|
+
<div style={{ marginBottom: 8, color: '#666', fontSize: 14 }}>
|
|
133
|
+
<span style={{ color: 'red' }}>*</span>请选择协议期限:
|
|
134
|
+
</div>
|
|
135
|
+
<Radio.Group value={mtzlDm} onChange={(e) => form.setFieldsValue({ mtzlDm: e.target.value })}>
|
|
136
|
+
<Space direction="vertical">
|
|
137
|
+
<Radio value="0201">协议期不足半年</Radio>
|
|
138
|
+
<Radio value="0202">协议期在半年至一年之间</Radio>
|
|
139
|
+
<Radio value="0203">协议期在一年至两年之间</Radio>
|
|
140
|
+
<Radio value="0204">协议期在两年以上</Radio>
|
|
141
|
+
</Space>
|
|
142
|
+
</Radio.Group>
|
|
143
|
+
</div>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
<Radio value="0300">市场煤</Radio>
|
|
147
|
+
</Space>
|
|
148
|
+
</Radio.Group>
|
|
149
|
+
</Form.Item>
|
|
150
|
+
</Form>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</Modal>
|
|
154
|
+
);
|
|
155
|
+
};
|