kts-component-invoice-operate 3.2.238 → 3.2.240

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.
Files changed (67) hide show
  1. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.d.ts +0 -1
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +0 -2
  3. package/dist/Invoice/InvoiceController/index.d.ts +0 -6
  4. package/dist/Invoice/index.d.ts +0 -2
  5. package/dist/index.esm.js +2749 -5769
  6. package/dist/index.js +2748 -5768
  7. package/package.json +1 -1
  8. package/src/Invoice/Invoice-digtal/_test/easiest/index.tsx +8 -40
  9. package/src/Invoice/Invoice-digtal/_test/freight/index.tsx +17 -23
  10. package/src/Invoice/Invoice-digtal/_test/realEstateInfo/index.tsx +0 -47
  11. package/src/Invoice/Invoice-digtal/index.md +6 -7
  12. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +0 -11
  13. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/IGood/index.ts +0 -2
  14. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +0 -3
  15. package/src/Invoice/InvoiceController/index.ts +0 -21
  16. package/src/Invoice/index.tsx +0 -3
  17. package/src/Invoice/tools/useToGenerateId/index.ts +0 -2
  18. package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +7 -0
  19. package/src/Invoice/ui/digtal/RealEstateInfo/index.tsx +37 -246
  20. package/src/Invoice/ui/digtal/StakeFarmerholder/index.less +1 -1
  21. package/src/Invoice/ui/digtal/StakeFarmerholder/index.tsx +204 -809
  22. package/dist/Invoice/Invoice-digtal/_test/pay/index.d.ts +0 -4
  23. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.d.ts +0 -6
  24. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.d.ts +0 -12
  25. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.d.ts +0 -21
  26. package/dist/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.d.ts +0 -31
  27. package/dist/Invoice/InvoiceController/fns/addPay.d.ts +0 -6
  28. package/dist/Invoice/InvoiceController/fns/delPay.d.ts +0 -6
  29. package/dist/Invoice/InvoiceController/fns/saveEditPay.d.ts +0 -6
  30. package/dist/Invoice/InvoiceController/fns/setEditPay.d.ts +0 -6
  31. package/dist/Invoice/InvoiceController/fns/setPay.d.ts +0 -6
  32. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/index.d.ts +0 -3
  33. package/dist/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.d.ts +0 -8
  34. package/dist/Invoice/ui/digtal/PayList/hook/useOnRow/index.d.ts +0 -8
  35. package/dist/Invoice/ui/digtal/PayList/hook/useRowSelection/index.d.ts +0 -8
  36. package/dist/Invoice/ui/digtal/PayList/hook/useWindowClick/index.d.ts +0 -5
  37. package/dist/Invoice/ui/digtal/PayList/index.d.ts +0 -18
  38. package/dist/Invoice/ui/digtal/PayList/ui/AddRowButton/index.d.ts +0 -3
  39. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.d.ts +0 -6
  40. package/dist/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.d.ts +0 -6
  41. package/dist/Invoice/ui/digtal/PayList/ui/TableRow/index.d.ts +0 -3
  42. package/dist/Invoice/ui/digtal/PayList/ui/TableVirtual/index.d.ts +0 -4
  43. package/src/Invoice/Invoice-digtal/_test/pay/index.tsx +0 -14637
  44. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IColumnsReplenish/index.ts +0 -10
  45. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/IGood/index.ts +0 -35
  46. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/ImportGoods/index.ts +0 -81
  47. package/src/Invoice/InvoiceController/InvoiceControllerState/PayListState/index.ts +0 -40
  48. package/src/Invoice/InvoiceController/fns/addPay.ts +0 -11
  49. package/src/Invoice/InvoiceController/fns/delPay.ts +0 -38
  50. package/src/Invoice/InvoiceController/fns/saveEditPay.ts +0 -23
  51. package/src/Invoice/InvoiceController/fns/setEditPay.ts +0 -16
  52. package/src/Invoice/InvoiceController/fns/setPay.ts +0 -11
  53. package/src/Invoice/ui/digtal/PayList/hook/useColumns/dist/index.js +0 -616
  54. package/src/Invoice/ui/digtal/PayList/hook/useColumns/index.tsx +0 -168
  55. package/src/Invoice/ui/digtal/PayList/hook/useColumns/ui/TitleText/index.tsx +0 -20
  56. package/src/Invoice/ui/digtal/PayList/hook/useOnRow/index.tsx +0 -37
  57. package/src/Invoice/ui/digtal/PayList/hook/useRowSelection/index.tsx +0 -120
  58. package/src/Invoice/ui/digtal/PayList/hook/useWindowClick/index.tsx +0 -19
  59. package/src/Invoice/ui/digtal/PayList/index.less +0 -73
  60. package/src/Invoice/ui/digtal/PayList/index.tsx +0 -132
  61. package/src/Invoice/ui/digtal/PayList/ui/AddRowButton/index.tsx +0 -75
  62. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useDelRowButton/index.tsx +0 -50
  63. package/src/Invoice/ui/digtal/PayList/ui/BulkMenu/hooks/useEmptyRefill/index.tsx +0 -37
  64. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.less +0 -29
  65. package/src/Invoice/ui/digtal/PayList/ui/TableRow/index.tsx +0 -21
  66. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.less +0 -39
  67. package/src/Invoice/ui/digtal/PayList/ui/TableVirtual/index.tsx +0 -109
@@ -1,616 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
- return new (P || (P = Promise))(function (resolve, reject) {
29
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33
- });
34
- };
35
- var __generator = (this && this.__generator) || function (thisArg, body) {
36
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
37
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
38
- function verb(n) { return function (v) { return step([n, v]); }; }
39
- function step(op) {
40
- if (f) throw new TypeError("Generator is already executing.");
41
- while (_) try {
42
- 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;
43
- if (y = 0, t) op = [op[0] & 2, t.value];
44
- switch (op[0]) {
45
- case 0: case 1: t = op; break;
46
- case 4: _.label++; return { value: op[1], done: false };
47
- case 5: _.label++; y = op[1]; op = [0]; continue;
48
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
49
- default:
50
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
51
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
52
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
53
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54
- if (t[2]) _.ops.pop();
55
- _.trys.pop(); continue;
56
- }
57
- op = body.call(thisArg, _);
58
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
59
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
60
- }
61
- };
62
- var __spreadArrays = (this && this.__spreadArrays) || function () {
63
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
64
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
65
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
66
- r[k] = a[j];
67
- return r;
68
- };
69
- exports.__esModule = true;
70
- var react_1 = require("react");
71
- var kts_components_antd_x3_1 = require("kts-components-antd-x3");
72
- var plus_svg_1 = require("./svg/plus.svg");
73
- var kts_xui_1 = require("kts-xui");
74
- var itemName_1 = require("../../../../../tools/itemName");
75
- var InvoiceController_1 = require("../../../../../InvoiceController");
76
- var __1 = require("../../../../..");
77
- var TitleText_1 = require("./ui/TitleText");
78
- var ItemNameInput_1 = require("./ui/ItemNameInput");
79
- var autoFillFn_1 = require("./autoFillFn");
80
- exports["default"] = (function (form) {
81
- var getFieldDecorator = form.getFieldDecorator, getFieldValue = form.getFieldValue;
82
- var controller = __1["default"].useInvoiceController();
83
- /** 是否含税 */
84
- var isTaxIncluded = controller.useMemo(function (e) { return e.goodsListState.isTaxIncluded; }, []);
85
- /** 组件模式 */
86
- var model = controller.useMemo(function (e) { return e.model; }, []);
87
- /** 是否显示我方 */
88
- var isMyShow = controller.useMemo(function (e) { return e.goodsListState.isMyShow; }, []);
89
- /** 正在编辑的货物 */
90
- var editGood = controller.useMemo(function (e) { return e.goodsListState.editGood; }, []);
91
- /** 搜索条件 */
92
- var searchValue = controller.useMemo(function (e) { return e.goodsListState.searchValue; }, []);
93
- /** 税率列表 */
94
- var taxRateList = controller.useMemo(function (e) { return e.goodsListState.taxRateList; }, []);
95
- /** 单位列表 */
96
- var unitList = controller.useMemo(function (e) { return e.goodsListState.unitList; }, []);
97
- /** 商品表格补充配置 */
98
- var columnsReplenish = controller.useMemo(function (e) { return e.goodsListState.columnsReplenish; }, []);
99
- /** 扣除额 */
100
- var deduction = controller.useMemo(function (e) { return e.goodsListState.deduction; }, []);
101
- /** 计算中启动字段 */
102
- var changeField = controller.useMemo(function (e) { return e.calculatingField; }, []);
103
- /** 计算中启动字段 */
104
- var setChangeField = react_1["default"].useCallback(function (value) { return controller.run(function (s) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
105
- s.calculatingField = value;
106
- return [2 /*return*/];
107
- }); }); }); }, []);
108
- var onNumberValueChange = react_1["default"].useCallback(function (e) {
109
- var _a;
110
- var value = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value;
111
- if (value) {
112
- return value.replace(/[^0-9-\.]/g, '');
113
- }
114
- }, []);
115
- /** 获取补充校验规则 */
116
- var getReplenishRules = react_1["default"].useCallback(function (id) {
117
- return columnsReplenish[id] ? columnsReplenish[id].rules || [] : [];
118
- }, [columnsReplenish]);
119
- /** 金额整数位限制,不传默认9位 */
120
- var priceIntegerDigit = controller.useMemo(function (e) { return e.priceIntegerDigit || 9; }, []);
121
- /** 表头 */
122
- var columns = react_1["default"].useMemo(function () {
123
- var _a, _b, _c, _d, _e, _f;
124
- return [
125
- {
126
- title: '序号',
127
- key: 'serialNo',
128
- dataIndex: 'serialNo',
129
- width: 50,
130
- render: function (e) { return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, e); }
131
- },
132
- {
133
- title: react_1["default"].createElement(TitleText_1["default"], { required: true }, "\u9879\u76EE\u540D\u79F0"),
134
- key: 'itemName',
135
- render: function (_, record) {
136
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
137
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null,
138
- react_1["default"].createElement("div", { style: { display: 'flex' } }, getFieldDecorator('itemName', {
139
- initialValue: isMyShow ? record.itemNameSelf : record.itemName,
140
- rules: __spreadArrays(getReplenishRules('itemName'), [
141
- {
142
- validator: function (_, __, callback) { return __awaiter(void 0, void 0, void 0, function () {
143
- var value;
144
- return __generator(this, function (_a) {
145
- switch (_a.label) {
146
- case 0: return [4 /*yield*/, controller.wait()];
147
- case 1:
148
- _a.sent();
149
- value = controller.state.goodsListState.editGood;
150
- if (!(value === null || value === void 0 ? void 0 : value.itemName) && !(value === null || value === void 0 ? void 0 : value.itemNameSelf)) {
151
- callback('项目名称不能为空');
152
- }
153
- else {
154
- return [2 /*return*/];
155
- }
156
- return [2 /*return*/];
157
- }
158
- });
159
- }); }
160
- }
161
- ])
162
- })(react_1["default"].createElement(ItemNameInput_1["default"], { shorthand: editGood.shorthand, suffix: react_1["default"].createElement(kts_xui_1.Tooltip, { title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F" },
163
- react_1["default"].createElement(kts_xui_1.Button, { type: "link", style: { padding: 0, width: 20, fontSize: 20, fill: '#0074ff' }, icon: react_1["default"].createElement(plus_svg_1.ReactComponent, null), onClick: controller.pipeline(function (s) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
164
- s.goodsListState.importGoods.isVisibleDrawer = true;
165
- return [2 /*return*/];
166
- }); }); }) })), onChange: function () {
167
- autoFillFn_1.onChangeItemName(controller, form, record);
168
- } })))));
169
- }
170
- else {
171
- return (react_1["default"].createElement("span", null,
172
- record.lineAttribute === InvoiceController_1.LineAttributeType.折扣行 ? react_1["default"].createElement("span", { className: 'goods-list-digtal-discount-tag' }, "\u6298\u6263") : react_1["default"].createElement(react_1["default"].Fragment, null),
173
- react_1["default"].createElement(MyItemNameDiv, { valueT: formatSearch(itemName_1.getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemNameSelf || '' }), searchValue), valueF: formatSearch(itemName_1.getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemName || '' }), searchValue), isMyShow: isMyShow })));
174
- }
175
- }
176
- },
177
- {
178
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_a = columnsReplenish['itemModelName']) === null || _a === void 0 ? void 0 : _a.rules }, "\u89C4\u683C\u578B\u53F7"),
179
- key: 'itemModelName',
180
- width: 119,
181
- render: function (_, record) {
182
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
183
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('itemModelName', {
184
- initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
185
- rules: getReplenishRules('itemModelName')
186
- })(react_1["default"].createElement(MyInput, { onChange: function () { return __awaiter(void 0, void 0, void 0, function () {
187
- var key, value;
188
- return __generator(this, function (_a) {
189
- switch (_a.label) {
190
- case 0: return [4 /*yield*/, controller.wait()];
191
- case 1:
192
- _a.sent();
193
- key = isMyShow ? 'itemModelNameSelf' : 'itemModelName';
194
- value = {};
195
- value[key] = form.getFieldsValue().itemModelName;
196
- controller.setEditGood(value);
197
- return [2 /*return*/];
198
- }
199
- });
200
- }); } }))));
201
- }
202
- else {
203
- return (react_1["default"].createElement(MyItemNameDiv, { valueT: formatSearch(record.itemModelNameSelf, searchValue), valueF: formatSearch(record.itemModelName, searchValue), isMyShow: isMyShow }));
204
- }
205
- }
206
- },
207
- {
208
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_b = columnsReplenish['unit']) === null || _b === void 0 ? void 0 : _b.rules }, "\u5355\u4F4D"),
209
- key: 'unit',
210
- width: 70,
211
- render: function (_, record) {
212
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
213
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('unit', {
214
- initialValue: editGood.unit,
215
- rules: getReplenishRules('unit')
216
- })(react_1["default"].createElement(kts_xui_1.AutoComplete, { style: { width: '100%' }, dataSource: unitList, onChange: function () { return __awaiter(void 0, void 0, void 0, function () {
217
- return __generator(this, function (_a) {
218
- switch (_a.label) {
219
- case 0: return [4 /*yield*/, controller.wait()
220
- // const key = isMyShow ? 'unit' : 'unitOther';
221
- // const value = {} as any;
222
- // value[key] = form.getFieldsValue().unit;
223
- ];
224
- case 1:
225
- _a.sent();
226
- // const key = isMyShow ? 'unit' : 'unitOther';
227
- // const value = {} as any;
228
- // value[key] = form.getFieldsValue().unit;
229
- controller.setEditGood({ unit: form.getFieldsValue().unit });
230
- return [2 /*return*/];
231
- }
232
- });
233
- }); } }))));
234
- }
235
- else {
236
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, record.unit);
237
- }
238
- }
239
- },
240
- {
241
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_c = columnsReplenish['quantity']) === null || _c === void 0 ? void 0 : _c.rules }, "\u6570\u91CF"),
242
- dataIndex: 'quantity',
243
- key: 'quantity',
244
- align: 'right',
245
- width: 149,
246
- render: function (value, record) {
247
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
248
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('quantity', {
249
- initialValue: editGood.quantity,
250
- getValueFromEvent: onNumberValueChange,
251
- rules: __spreadArrays(getReplenishRules('quantity'), [
252
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '数量必须为数字' },
253
- {
254
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
255
- var isvalue, isPrice;
256
- return __generator(this, function (_a) {
257
- switch (_a.label) {
258
- case 0: return [4 /*yield*/, controller.wait()];
259
- case 1:
260
- _a.sent();
261
- isvalue = !!value || value === 0;
262
- isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
263
- if (isvalue || isPrice === isvalue)
264
- return [2 /*return*/];
265
- callback('请输入数量');
266
- return [2 /*return*/];
267
- }
268
- });
269
- }); }
270
- }
271
- ])
272
- })(react_1["default"].createElement(MyInput, { style: { textAlign: 'right' }, maxLength: 16, loading: isCipher(changeField, "quantity"), onChange: function () { return __awaiter(void 0, void 0, void 0, function () {
273
- return __generator(this, function (_a) {
274
- switch (_a.label) {
275
- case 0:
276
- setChangeField('quantity');
277
- return [4 /*yield*/, autoFillFn_1.onChangeQuantity(controller, form, record)];
278
- case 1:
279
- _a.sent();
280
- return [2 /*return*/];
281
- }
282
- });
283
- }); } }))));
284
- }
285
- else {
286
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, value);
287
- }
288
- }
289
- },
290
- {
291
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_d = columnsReplenish['priceIncludeTax']) === null || _d === void 0 ? void 0 : _d.rules }, "\u5355\u4EF7(\u542B\u7A0E)"),
292
- dataIndex: 'priceIncludeTax',
293
- key: 'priceIncludeTax',
294
- align: 'right',
295
- width: 149,
296
- render: function (value, record) {
297
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
298
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('priceIncludeTax', {
299
- initialValue: editGood.priceIncludeTax,
300
- getValueFromEvent: onNumberValueChange,
301
- rules: __spreadArrays(getReplenishRules('priceIncludeTax'), [
302
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
303
- {
304
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
305
- var isQuantity, isvalue;
306
- return __generator(this, function (_a) {
307
- switch (_a.label) {
308
- case 0: return [4 /*yield*/, controller.wait()];
309
- case 1:
310
- _a.sent();
311
- isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
312
- isvalue = !!value || value === 0;
313
- if (isvalue || isQuantity === isvalue)
314
- return [2 /*return*/];
315
- callback('请输入单价');
316
- return [2 /*return*/];
317
- }
318
- });
319
- }); }
320
- }
321
- ])
322
- })(react_1["default"].createElement(MyInput, { style: { textAlign: 'right' }, maxLength: 16, loading: isCipher(changeField, 'priceIncludeTax'), onChange: function () {
323
- setChangeField('priceIncludeTax');
324
- autoFillFn_1.onChangePriceIncludeTax(controller, form, record);
325
- } }))));
326
- }
327
- else {
328
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, value);
329
- }
330
- }
331
- },
332
- {
333
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_e = columnsReplenish['priceExcludeTax']) === null || _e === void 0 ? void 0 : _e.rules }, "\u5355\u4EF7(\u4E0D\u542B\u7A0E)"),
334
- dataIndex: 'priceExcludeTax',
335
- key: 'priceExcludeTax',
336
- align: 'right',
337
- width: 149,
338
- render: function (value, record) {
339
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
340
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('priceExcludeTax', {
341
- initialValue: editGood.priceExcludeTax,
342
- getValueFromEvent: onNumberValueChange,
343
- rules: __spreadArrays(getReplenishRules('priceExcludeTax'), [
344
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
345
- {
346
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
347
- var isQuantity, isvalue;
348
- return __generator(this, function (_a) {
349
- switch (_a.label) {
350
- case 0: return [4 /*yield*/, controller.wait()];
351
- case 1:
352
- _a.sent();
353
- isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
354
- isvalue = !!value || value === 0;
355
- if (isvalue || isQuantity === isvalue)
356
- return [2 /*return*/];
357
- callback('请输入单价');
358
- return [2 /*return*/];
359
- }
360
- });
361
- }); }
362
- }
363
- ])
364
- })(react_1["default"].createElement(MyInput, { style: { textAlign: 'right' }, maxLength: 16, loading: isCipher(changeField, 'priceExcludeTax'), onChange: function () {
365
- setChangeField('priceExcludeTax');
366
- autoFillFn_1.onChangePriceExcludeTax(controller, form, record);
367
- } }))));
368
- }
369
- else {
370
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, value);
371
- }
372
- }
373
- },
374
- {
375
- title: react_1["default"].createElement(TitleText_1["default"], { required: true }, "\u91D1\u989D(\u542B\u7A0E)"),
376
- dataIndex: 'lineAmountIncludeTax',
377
- key: 'lineAmountIncludeTax',
378
- width: 119,
379
- align: 'right',
380
- render: function (value, record) {
381
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
382
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
383
- initialValue: editGood.lineAmountIncludeTax,
384
- getValueFromEvent: onNumberValueChange,
385
- rules: __spreadArrays(getReplenishRules('lineAmountIncludeTax'), [
386
- { required: true, message: '金额不能为空' },
387
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
388
- {
389
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
390
- return __generator(this, function (_a) {
391
- if (("" + value).split('.')[0].length > priceIntegerDigit) {
392
- callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E" + priceIntegerDigit + "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D");
393
- }
394
- return [2 /*return*/];
395
- });
396
- }); }
397
- },
398
- {
399
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
400
- return __generator(this, function (_a) {
401
- if (deduction && parseFloat(value) <= deduction) {
402
- callback('扣除额不能大于等于价税合计');
403
- }
404
- return [2 /*return*/];
405
- });
406
- }); }
407
- },
408
- ])
409
- })(react_1["default"].createElement(MyInput, { style: { textAlign: 'right' }, loading: isCipher(changeField, 'lineAmountIncludeTax'), onChange: function () {
410
- setChangeField('lineAmountIncludeTax');
411
- autoFillFn_1.onChangeLineAmountIncludeTax(controller, form, record);
412
- } }))));
413
- }
414
- else {
415
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, formatSearch(parseFloat(value).toFixed(2), searchValue));
416
- }
417
- }
418
- },
419
- {
420
- title: react_1["default"].createElement(TitleText_1["default"], { required: true }, "\u91D1\u989D(\u4E0D\u542B\u7A0E)"),
421
- dataIndex: 'lineAmountExcludeTax',
422
- key: 'lineAmountExcludeTax',
423
- align: 'right',
424
- width: 119,
425
- render: function (value, record) {
426
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
427
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
428
- initialValue: editGood.lineAmountExcludeTax,
429
- getValueFromEvent: onNumberValueChange,
430
- rules: __spreadArrays(getReplenishRules('lineAmountExcludeTax'), [
431
- { required: true, message: '金额不能为空' },
432
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '金额必须为数字' },
433
- {
434
- validator: function (_, value, callback) { return __awaiter(void 0, void 0, void 0, function () {
435
- return __generator(this, function (_a) {
436
- if (("" + value).split('.')[0].length > priceIntegerDigit) {
437
- callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E" + priceIntegerDigit + "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D");
438
- }
439
- return [2 /*return*/];
440
- });
441
- }); }
442
- },
443
- ])
444
- })(react_1["default"].createElement(MyInput, { style: { textAlign: 'right' }, loading: isCipher(changeField, 'lineAmountExcludeTax'), onChange: function () {
445
- setChangeField('lineAmountExcludeTax');
446
- autoFillFn_1.onChangeLineAmountExcludeTax(controller, form, record);
447
- } }))));
448
- }
449
- else {
450
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, formatSearch(parseFloat(value).toFixed(2), searchValue));
451
- }
452
- }
453
- },
454
- {
455
- title: react_1["default"].createElement(TitleText_1["default"], { required: true }, "\u7A0E\u7387%"),
456
- dataIndex: 'taxRate',
457
- key: 'taxRate',
458
- align: 'right',
459
- width: 70,
460
- render: function (value, record) {
461
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
462
- return (react_1["default"].createElement(kts_components_antd_x3_1.Form.Item, null, getFieldDecorator('taxRate', {
463
- initialValue: editGood.taxRate,
464
- rules: __spreadArrays(getReplenishRules('taxRate'), [
465
- { required: true, message: ' ' },
466
- { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: ' ' },
467
- ])
468
- })(react_1["default"].createElement(kts_xui_1.Select, { className: "kts-invoice-operate-goods-list-table-tax-rate",
469
- // dropdownMenuStyle={{ textAlign: "right" }}
470
- showArrow: false, style: { width: '100%' }, onChange: function () {
471
- setChangeField('taxRate');
472
- autoFillFn_1.onChangeTaxRate(controller, form, record);
473
- } }, taxRateList.map(function (e, i) {
474
- return (react_1["default"].createElement(kts_xui_1.Select.Option, { key: i, value: e },
475
- e,
476
- "%"));
477
- })))));
478
- }
479
- else {
480
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } },
481
- value,
482
- "%");
483
- }
484
- }
485
- },
486
- {
487
- title: react_1["default"].createElement(TitleText_1["default"], { rules: (_f = columnsReplenish['taxAmount']) === null || _f === void 0 ? void 0 : _f.rules }, "\u7A0E\u989D"),
488
- dataIndex: 'taxAmount',
489
- key: 'taxAmount',
490
- align: 'right',
491
- width: 119,
492
- render: function (value, record) {
493
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
494
- return getFieldDecorator('taxAmount', {
495
- initialValue: editGood.taxAmount,
496
- rules: getReplenishRules('taxAmount')
497
- })(react_1["default"].createElement(MyDiv, { loading: isCipher(changeField, 'taxAmount') }));
498
- }
499
- else {
500
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, parseFloat(value).toFixed(2));
501
- }
502
- }
503
- },
504
- ]
505
- // 含税不含税
506
- .filter(function (e) {
507
- if (isTaxIncluded) {
508
- return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
509
- }
510
- else {
511
- return !(e.key === 'priceIncludeTax' || e.key === 'lineAmountIncludeTax');
512
- }
513
- })
514
- // 只读
515
- .filter(function (e) {
516
- if (model === 'readOnly') {
517
- return e.key !== 'operating';
518
- }
519
- else {
520
- return true;
521
- }
522
- })
523
- .map(function (e) {
524
- return __assign(__assign({}, e), { ellipsis: true });
525
- });
526
- }, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish]);
527
- // React.useEffect(() => {
528
- // clearTimeout(t)
529
- // const t = setTimeout(() => { setChangeField('') }, 1000);
530
- // return () => { clearTimeout(t) }
531
- // }, [changeField]);
532
- return columns;
533
- });
534
- /** 字段 */
535
- function isCipher(name, field) {
536
- if (!name || !field)
537
- return false;
538
- return name !== field;
539
- }
540
- var MyInput = /** @class */ (function (_super) {
541
- __extends(MyInput, _super);
542
- function MyInput() {
543
- return _super !== null && _super.apply(this, arguments) || this;
544
- }
545
- MyInput.prototype.render = function () {
546
- if (this.props.loading) {
547
- return (react_1["default"].createElement(kts_xui_1.Spin, { size: "small" },
548
- react_1["default"].createElement(kts_xui_1.Input, __assign({}, this.props, { autoComplete: "off" }))));
549
- }
550
- else {
551
- return react_1["default"].createElement(kts_xui_1.Input, __assign({}, this.props, { autoComplete: "off" }));
552
- }
553
- };
554
- return MyInput;
555
- }(react_1["default"].Component));
556
- var MyDiv = /** @class */ (function (_super) {
557
- __extends(MyDiv, _super);
558
- function MyDiv() {
559
- return _super !== null && _super.apply(this, arguments) || this;
560
- }
561
- MyDiv.prototype.render = function () {
562
- if (this.props.loading) {
563
- return (react_1["default"].createElement(kts_xui_1.Spin, { size: "small" },
564
- react_1["default"].createElement("span", { style: { padding: '0 10px' } }, this.props.value)));
565
- }
566
- else {
567
- return react_1["default"].createElement("span", { style: { padding: '0 10px' } }, this.props.value);
568
- }
569
- };
570
- return MyDiv;
571
- }(react_1["default"].Component));
572
- var MyItemNameDiv = /** @class */ (function (_super) {
573
- __extends(MyItemNameDiv, _super);
574
- function MyItemNameDiv() {
575
- return _super !== null && _super.apply(this, arguments) || this;
576
- }
577
- MyItemNameDiv.prototype.render = function () {
578
- var _a = this.props, isMyShow = _a.isMyShow, valueT = _a.valueT, valueF = _a.valueF;
579
- if (isMyShow) {
580
- if (valueT) {
581
- return (react_1["default"].createElement(kts_xui_1.Tooltip, { title: valueT },
582
- react_1["default"].createElement("span", { style: { padding: '0 10px', color: '#0074ff' } }, valueT)));
583
- }
584
- else {
585
- return (react_1["default"].createElement(kts_xui_1.Tooltip, { title: valueF },
586
- react_1["default"].createElement("span", { style: { padding: '0 10px' } }, valueF)));
587
- }
588
- }
589
- else {
590
- if (valueF) {
591
- return (react_1["default"].createElement(kts_xui_1.Tooltip, { title: valueF },
592
- react_1["default"].createElement("span", { style: { padding: '0 10px' } }, valueF)));
593
- }
594
- else {
595
- return (react_1["default"].createElement(kts_xui_1.Tooltip, { title: valueT },
596
- react_1["default"].createElement("span", { style: { padding: '0 10px', color: '#0074ff' } }, valueT)));
597
- }
598
- }
599
- };
600
- return MyItemNameDiv;
601
- }(react_1["default"].Component));
602
- /** 格式搜索结果 */
603
- function formatSearch(value, search) {
604
- if (!value || !search)
605
- return value;
606
- var __html = ucoding(value).split(new RegExp(ucoding(search), 'g')).map(function (e) { return dcoding(e); }).join("<span class=\"kts-invoice-operate-goods-list-table-search-protrude\" >" + search + "</span>");
607
- return react_1["default"].createElement("span", { dangerouslySetInnerHTML: { __html: __html } });
608
- }
609
- /** 编码 */
610
- function ucoding(v) {
611
- return v.split('').map(function (e) { return "U" + e.charCodeAt(0) + "E"; }).join('');
612
- }
613
- /** 解码 */
614
- function dcoding(v) {
615
- return v.split('U').map(function (e) { return e ? String.fromCharCode(parseInt(e.replace('E', ''))) : ''; }).join('');
616
- }