kts-component-invoice-operate 3.2.4 → 3.2.5
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/index.esm.js +10 -4
- package/dist/index.js +10 -4
- package/docs-dist/404.html +33 -0
- package/docs-dist/index.html +33 -0
- package/docs-dist/static/add.a70623b4.svg +12 -0
- package/docs-dist/static/arrowDown.a1cbf0d8.svg +3 -0
- package/docs-dist/static/arrowUp.4c482054.svg +3 -0
- package/docs-dist/static/auto.a6cd905c.svg +1 -0
- package/docs-dist/static/fork.5431267d.svg +12 -0
- package/docs-dist/static/magnifier.2b26be6e.svg +1 -0
- package/docs-dist/static/plus.4fd1af30.svg +12 -0
- package/docs-dist/static/spot.42e620e1.svg +1 -0
- package/docs-dist/umi.css +20 -0
- package/docs-dist/umi.js +1 -0
- package/package.json +1 -1
- package/src/InvoiceTypeModal/dist/index.js +92 -0
- package/src/InvoiceTypeModal/index.tsx +8 -2
package/package.json
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
var react_1 = require("react");
|
|
40
|
+
var kts_xui_1 = require("kts-xui");
|
|
41
|
+
require("./index.less");
|
|
42
|
+
function InvoiceTypeModal(props) {
|
|
43
|
+
var _this = this;
|
|
44
|
+
var _a = props.disableds, disableds = _a === void 0 ? [] : _a;
|
|
45
|
+
var _b = react_1["default"].useState({ billingType: props.defaultBillingType || 'digital' }), formValues = _b[0], setValues = _b[1];
|
|
46
|
+
var form = kts_xui_1.Form.useForm()[0];
|
|
47
|
+
var onConfirm = react_1["default"].useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
48
|
+
var values;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0: return [4 /*yield*/, form.validateFields()];
|
|
52
|
+
case 1:
|
|
53
|
+
values = _a.sent();
|
|
54
|
+
props.onOk && props.onOk(values);
|
|
55
|
+
return [2 /*return*/];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); }, [props.onOk, form]);
|
|
59
|
+
var onChangeBillingType = react_1["default"].useCallback(function (e) {
|
|
60
|
+
props.onChange && props.onChange(e.target.value);
|
|
61
|
+
form.setFieldsValue({ invoiceType: null, business: null });
|
|
62
|
+
setValues(form.getFieldsValue());
|
|
63
|
+
}, [props.onChange, form]);
|
|
64
|
+
react_1["default"].useEffect(function () {
|
|
65
|
+
if (props.open) {
|
|
66
|
+
var values = {
|
|
67
|
+
billingType: props.defaultBillingType || 'digital',
|
|
68
|
+
invoiceType: props.defaultInvoiceType,
|
|
69
|
+
business: props.defaultBusiness
|
|
70
|
+
};
|
|
71
|
+
form.resetFields();
|
|
72
|
+
form.setFieldsValue(values);
|
|
73
|
+
setValues(values);
|
|
74
|
+
}
|
|
75
|
+
}, [props.open, props.defaultBillingType, props.defaultBusiness, props.defaultInvoiceType, form]);
|
|
76
|
+
return (react_1["default"].createElement(kts_xui_1.Modal, { title: props.modalTitle || "选择开具信息", open: props.open, onOk: onConfirm, onCancel: props.onCancel, okText: '\u786E\u5B9A', cancelText: '\u53D6\u6D88' },
|
|
77
|
+
react_1["default"].createElement(kts_xui_1.Form, { form: form, layout: "vertical", style: { paddingTop: 20 }, onValuesChange: function (_, e) { setValues(e); } },
|
|
78
|
+
react_1["default"].createElement(kts_xui_1.Row, { gutter: [16, 16] },
|
|
79
|
+
react_1["default"].createElement(kts_xui_1.Col, { span: 24 },
|
|
80
|
+
react_1["default"].createElement(kts_xui_1.Form.Item, { name: 'billingType' },
|
|
81
|
+
react_1["default"].createElement(kts_xui_1.Radio.Group, { size: 'large', className: "goods-list-digtal-reselect-invoice-typeModal-radio", optionType: "button", disabled: disableds.indexOf('billingType') >= 0, onChange: onChangeBillingType, options: [
|
|
82
|
+
{ label: '数电发票', value: 'digital' },
|
|
83
|
+
{ label: '税控发票', value: 'taxation' },
|
|
84
|
+
] }))),
|
|
85
|
+
react_1["default"].createElement(kts_xui_1.Col, { span: 12 },
|
|
86
|
+
react_1["default"].createElement(kts_xui_1.Form.Item, { name: 'invoiceType', label: "\u9009\u62E9\u7968\u7C7B", rules: [{ required: true, message: '选择票类必填' }] },
|
|
87
|
+
react_1["default"].createElement(kts_xui_1.Select, { size: 'large', allowClear: true, placeholder: "\u8BF7\u9009\u62E9\uFF08\u5FC5\u586B\u9879\uFF09", disabled: disableds.indexOf('invoiceType') >= 0, options: props.invoiceTypeOptions }))),
|
|
88
|
+
react_1["default"].createElement(kts_xui_1.Col, { span: 12 },
|
|
89
|
+
react_1["default"].createElement(kts_xui_1.Form.Item, { name: 'business', label: "\u7279\u5B9A\u4E1A\u52A1" },
|
|
90
|
+
react_1["default"].createElement(kts_xui_1.Select, { size: 'large', allowClear: true, placeholder: "\u8BF7\u9009\u62E9\uFF08\u975E\u5FC5\u586B\u9879\uFF09", disabled: disableds.indexOf('business') >= 0 || !formValues.invoiceType, options: props.businessOptions })))))));
|
|
91
|
+
}
|
|
92
|
+
exports["default"] = InvoiceTypeModal;
|
|
@@ -63,7 +63,13 @@ export default function InvoiceTypeModal(props: IInvoiceTypeModalProps) {
|
|
|
63
63
|
const onConfirm = React.useCallback(async () => {
|
|
64
64
|
const values = await form.validateFields();
|
|
65
65
|
props.onOk && props.onOk(values);
|
|
66
|
-
}, [props.onOk])
|
|
66
|
+
}, [props.onOk, form])
|
|
67
|
+
|
|
68
|
+
const onChangeBillingType = React.useCallback(e => {
|
|
69
|
+
props.onChange && props.onChange(e.target.value);
|
|
70
|
+
form.setFieldsValue({ invoiceType: null, business: null });
|
|
71
|
+
setValues(form.getFieldsValue());
|
|
72
|
+
}, [props.onChange, form])
|
|
67
73
|
|
|
68
74
|
React.useEffect(() => {
|
|
69
75
|
if (props.open) {
|
|
@@ -102,7 +108,7 @@ export default function InvoiceTypeModal(props: IInvoiceTypeModalProps) {
|
|
|
102
108
|
className="goods-list-digtal-reselect-invoice-typeModal-radio"
|
|
103
109
|
optionType="button"
|
|
104
110
|
disabled={disableds.indexOf('billingType') >= 0}
|
|
105
|
-
onChange={
|
|
111
|
+
onChange={onChangeBillingType}
|
|
106
112
|
options={[
|
|
107
113
|
{ label: '数电发票', value: 'digital' },
|
|
108
114
|
{ label: '税控发票', value: 'taxation' },
|