kmkf-work-order-service-component 0.3.6 → 0.3.7

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.
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import BasicComponent from '../../BasicComponent';
3
+ declare class BasicRate extends BasicComponent {
4
+ constructor(options: any);
5
+ render: (value: any) => JSX.Element;
6
+ customRules: () => {
7
+ required: boolean;
8
+ validator: (_: any, value: any) => Promise<void>;
9
+ }[];
10
+ renderExport: (value: any, record: any) => any;
11
+ editRender: (value: any) => JSX.Element;
12
+ }
13
+ export default BasicRate;
@@ -0,0 +1,144 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+
7
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
+
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
+
13
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
14
+
15
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
+
17
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
+
19
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
+
21
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
+
23
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
+
25
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
+
27
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
+
29
+ import React from 'react';
30
+ import BasicComponent from "../../BasicComponent";
31
+ import { ApaasRate } from '@raycloud-apaas-fe-setup/apaas-react-basics-widgets';
32
+ import { getFormItem } from "../../common/formItemWrap";
33
+ import { Rate } from 'antd'; //状态文字映射
34
+
35
+ import { jsx as _jsx } from "react/jsx-runtime";
36
+ import { jsxs as _jsxs } from "react/jsx-runtime";
37
+ var RATE_MAP = {
38
+ 0: '',
39
+ 0.5: '非常差',
40
+ 1: '非常差',
41
+ 1.5: '差',
42
+ 2: '差',
43
+ 2.5: '一般',
44
+ 3: '一般',
45
+ 3.5: '好',
46
+ 4: '好',
47
+ 4.5: '非常好',
48
+ 5: '非常好'
49
+ };
50
+
51
+ var BasicRate = /*#__PURE__*/function (_BasicComponent) {
52
+ _inherits(BasicRate, _BasicComponent);
53
+
54
+ var _super = _createSuper(BasicRate);
55
+
56
+ function BasicRate(options) {
57
+ var _this;
58
+
59
+ _classCallCheck(this, BasicRate);
60
+
61
+ _this = _super.call(this, options);
62
+
63
+ _defineProperty(_assertThisInitialized(_this), "render", function (value) {
64
+ return /*#__PURE__*/_jsx("div", {
65
+ children: value.map(function (item) {
66
+ return /*#__PURE__*/_jsxs("div", {
67
+ children: [/*#__PURE__*/_jsx("span", {
68
+ style: {
69
+ marginRight: '8px'
70
+ },
71
+ children: item.name
72
+ }), /*#__PURE__*/_jsx(Rate, {
73
+ value: item.value,
74
+ style: {
75
+ color: 'red',
76
+ fontSize: '12px'
77
+ },
78
+ disabled: true
79
+ }), /*#__PURE__*/_jsx("span", {
80
+ style: {
81
+ color: 'red',
82
+ fontSize: '12px'
83
+ },
84
+ children: RATE_MAP[item.value]
85
+ })]
86
+ }, item.id);
87
+ })
88
+ });
89
+ });
90
+
91
+ _defineProperty(_assertThisInitialized(_this), "customRules", function () {
92
+ return [{
93
+ required: true,
94
+ validator: function validator(_, value) {
95
+ if (value && !value.length) {
96
+ return Promise.reject(new Error("\u8BF7\u9009\u62E9".concat(_this.name)));
97
+ }
98
+
99
+ return Promise.resolve();
100
+ }
101
+ }];
102
+ });
103
+
104
+ _defineProperty(_assertThisInitialized(_this), "renderExport", function (value, record) {
105
+ var textArr = value.reduce(function (prv, next) {
106
+ if (next.value) {
107
+ prv.push("".concat(next.name, ":").concat(next.value, "\u661F"));
108
+ }
109
+
110
+ return prv;
111
+ }, []);
112
+ return textArr.join(';');
113
+ });
114
+
115
+ _defineProperty(_assertThisInitialized(_this), "editRender", function (value) {
116
+ return getFormItem(_objectSpread({
117
+ title: _this.name,
118
+ name: _this.id,
119
+ rules: _this.componentConfig.required ? _this.customRules() : [],
120
+ required: false,
121
+ component: /*#__PURE__*/_jsx(ApaasRate, _objectSpread(_objectSpread({}, _this.componentConfig), {}, {
122
+ allowClear: false,
123
+ style: {
124
+ color: '#FD5105'
125
+ },
126
+ textStyle: {
127
+ color: '#FD5105'
128
+ }
129
+ }))
130
+ }, value));
131
+ });
132
+
133
+ _this.canFilter = false;
134
+ _this.canGroup = false;
135
+ _this.canHidden = true;
136
+ _this.editable = true;
137
+ _this.dataType = 'array';
138
+ return _this;
139
+ }
140
+
141
+ return _createClass(BasicRate);
142
+ }(BasicComponent);
143
+
144
+ export default BasicRate;
@@ -9,6 +9,7 @@ import BasicMultSelect from '../Widget/basic/MultSelect';
9
9
  import BasicCascader from '../Widget/basic/Cascader';
10
10
  import BasicAddress from '../Widget/basic/Address';
11
11
  import BasicGrade from '../Widget/basic/Grade';
12
+ import BasicRate from '../Widget/basic/Rate';
12
13
  import EBuyerNick from '../Widget/electricity/EBuyerNick';
13
14
  import EReceiverAddress from '../Widget/electricity/EReceiverAddress';
14
15
  import ELogistics from '../Widget/electricity/ELogistics';
@@ -22,4 +23,4 @@ import Status from '../Widget/third/Status';
22
23
  import Ordinary from '../Widget/third/Ordinary';
23
24
  import ItemSelectThird from '../Widget/third/ItemSelect';
24
25
  import Payment from '../Widget/third/Payment';
25
- export declare const factory: (type: string, options: any) => BasicInput | BasicRadio | BasicTextArea | BasicCheckBox | BasicDateTime | BasicSelect | BasicPicture | BasicMultSelect | BasicCascader | BasicAddress | BasicGrade | EBuyerNick | EReceiverAddress | ELogistics | EReturnLogistics | ERemark | EItemSelect | EItemId | EItemEncode | EAlipay | Status | Ordinary | ItemSelectThird | Payment;
26
+ export declare const factory: (type: string, options: any) => BasicRate | BasicInput | BasicRadio | BasicTextArea | BasicCheckBox | BasicDateTime | BasicSelect | BasicPicture | BasicMultSelect | BasicCascader | BasicAddress | BasicGrade | EBuyerNick | EReceiverAddress | ELogistics | EReturnLogistics | ERemark | EItemSelect | EItemId | EItemEncode | EAlipay | Status | Ordinary | ItemSelectThird | Payment;
@@ -9,6 +9,7 @@ import BasicMultSelect from "../Widget/basic/MultSelect";
9
9
  import BasicCascader from "../Widget/basic/Cascader";
10
10
  import BasicAddress from "../Widget/basic/Address";
11
11
  import BasicGrade from "../Widget/basic/Grade";
12
+ import BasicRate from "../Widget/basic/Rate";
12
13
  import EShopName from "../Widget/electricity/ShopName";
13
14
  import ETradeId from "../Widget/electricity/ETradeId";
14
15
  import EBuyerNick from "../Widget/electricity/EBuyerNick";
@@ -64,6 +65,9 @@ export var factory = function factory(type, options) {
64
65
  case 'BASIC_GRADE':
65
66
  return new BasicGrade(options);
66
67
 
68
+ case 'RATE':
69
+ return new BasicRate(options);
70
+
67
71
  case 'SHOP_NAME_INPUT':
68
72
  return new EShopName(options);
69
73
 
@@ -149,6 +149,12 @@ export var submitDataTransOldFormat = function submitDataTransOldFormat(nowData,
149
149
  content: get(nowData, "".concat(item.uniqueKey), ''),
150
150
  name: item.name
151
151
  });
152
+ } else if (item.workOrderComponentType === 'RATE') {
153
+ contentVoList.push({
154
+ uniqueKey: "".concat(item.uniqueKey, "_rate"),
155
+ content: JSON.stringify(get(nowData, "".concat(item.uniqueKey), [])),
156
+ name: item.name
157
+ });
152
158
  } else if (item.workOrderComponentType === 'BUYER_NICK_INPUT') {
153
159
  contentVoList.push({
154
160
  uniqueKey: "".concat(item.uniqueKey, "_buyerNick"),
@@ -491,6 +497,8 @@ var transDataSource = function transDataSource(templateColumns) {
491
497
  return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), item.jsonMap["".concat(nex.uniqueKey, "_select")] || (config === null || config === void 0 ? void 0 : config.select)));
492
498
  } else if (nex.workOrderComponentType === 'BASIC_GRADE') {
493
499
  return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), item.jsonMap["".concat(nex.uniqueKey, "_basicGrade")]));
500
+ } else if (nex.workOrderComponentType === 'RATE') {
501
+ return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_rate")], [])));
494
502
  } else if (nex.workOrderComponentType === 'TRADE_ID_INPUT') {
495
503
  return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), item.jsonMap["".concat(nex.uniqueKey, "_tradeId")]));
496
504
  } else if (nex.workOrderComponentType === 'BUYER_NICK_INPUT') {
@@ -569,20 +577,20 @@ var transDataSource = function transDataSource(templateColumns) {
569
577
  remark: item.jsonMap["".concat(nex.uniqueKey, "_remark")] || (config === null || config === void 0 ? void 0 : config.remark) || ''
570
578
  }));
571
579
  } else if (nex.workOrderComponentType === 'STATUS') {
572
- var _objectSpread28;
580
+ var _objectSpread29;
573
581
 
574
- return _objectSpread(_objectSpread({}, cur), {}, (_objectSpread28 = {}, _defineProperty(_objectSpread28, "".concat(nex.uniqueKey), {
582
+ return _objectSpread(_objectSpread({}, cur), {}, (_objectSpread29 = {}, _defineProperty(_objectSpread29, "".concat(nex.uniqueKey), {
575
583
  status: item.jsonMap["".concat(nex.uniqueKey, "_status")] || config.status,
576
584
  customerService: jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_customerService")], item.jsonMap["".concat(nex.uniqueKey, "_customerService")])
577
- }), _defineProperty(_objectSpread28, "".concat(nex.uniqueKey, "_processTime"), item.jsonMap['processTime']), _defineProperty(_objectSpread28, "".concat(nex.uniqueKey, "_lastProcessingTime"), item.jsonMap['lastProcessingTime']), _objectSpread28));
585
+ }), _defineProperty(_objectSpread29, "".concat(nex.uniqueKey, "_processTime"), item.jsonMap['processTime']), _defineProperty(_objectSpread29, "".concat(nex.uniqueKey, "_lastProcessingTime"), item.jsonMap['lastProcessingTime']), _objectSpread29));
578
586
  } else if (nex.workOrderComponentType === 'ORDINARY_INVOICE') {
579
- var _objectSpread29;
587
+ var _objectSpread30;
580
588
 
581
- return _objectSpread(_objectSpread({}, cur), {}, (_objectSpread29 = {}, _defineProperty(_objectSpread29, "".concat(nex.uniqueKey), {
589
+ return _objectSpread(_objectSpread({}, cur), {}, (_objectSpread30 = {}, _defineProperty(_objectSpread30, "".concat(nex.uniqueKey), {
582
590
  ordinaryMoney: item.jsonMap["".concat(nex.uniqueKey, "_ordinaryMoney")],
583
591
  ordinarySerial: item.jsonMap["".concat(nex.uniqueKey, "_ordinarySerial")],
584
592
  ordinaryTaitou: item.jsonMap["".concat(nex.uniqueKey, "_ordinaryTaitou")]
585
- }), _defineProperty(_objectSpread29, "".concat(nex.uniqueKey, "_ordinaryMoney"), item.jsonMap["".concat(nex.uniqueKey, "_ordinaryMoney")] ? Number(item.jsonMap["".concat(nex.uniqueKey, "_ordinaryMoney")]).toFixed(2) : null), _objectSpread29));
593
+ }), _defineProperty(_objectSpread30, "".concat(nex.uniqueKey, "_ordinaryMoney"), item.jsonMap["".concat(nex.uniqueKey, "_ordinaryMoney")] ? Number(item.jsonMap["".concat(nex.uniqueKey, "_ordinaryMoney")]).toFixed(2) : null), _objectSpread30));
586
594
  } else if (nex.workOrderComponentType === 'ITEM_SELECT') {
587
595
  return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_itemList")], [])));
588
596
  } else if (nex.workOrderComponentType === 'ITEM_ENCODE') {
@@ -284,7 +284,7 @@ export var workOrderSlice = createSlice({
284
284
  tempList.push(t);
285
285
  }
286
286
 
287
- return !item.enabled;
287
+ return t.enabled;
288
288
  });
289
289
  prv.push({
290
290
  label: item.groupName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kmkf-work-order-service-component",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",