@bit-sun/business-component 1.0.0 → 1.0.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/{SheetTable → DataValidation}/index.d.ts +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +145 -66
- package/dist/index.js +145 -65
- package/package.json +2 -2
- package/src/{SheetTable → DataValidation}/index.less +0 -0
- package/src/DataValidation/index.md +31 -0
- package/src/{SheetTable → DataValidation}/index.tsx +121 -95
- package/src/index.ts +8 -2
- package/src/SheetTable/index.md +0 -32
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'antd/dist/antd.css';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare class
|
|
4
|
+
declare class DataValidation extends React.Component {
|
|
5
5
|
constructor(props: any);
|
|
6
6
|
onDragEnd(result: any): void;
|
|
7
7
|
getCount: () => {
|
|
@@ -13,7 +13,7 @@ declare class Luckysheet extends React.Component {
|
|
|
13
13
|
showtoolbar: boolean;
|
|
14
14
|
hook: {
|
|
15
15
|
columnTitleCellRenderBefore: (columnAbc: any, postion: any, ctx: any) => void;
|
|
16
|
-
|
|
16
|
+
cellRenderBefore: (cell: any, postion: any, sheetFile: any, ctx: any) => void;
|
|
17
17
|
cellAllRenderBefore: (data: any, sheetFile: any, ctx: any) => void;
|
|
18
18
|
};
|
|
19
19
|
data: {
|
|
@@ -128,6 +128,10 @@ declare class Luckysheet extends React.Component {
|
|
|
128
128
|
};
|
|
129
129
|
componentDidMount(): void;
|
|
130
130
|
componentWillUnmount(): void;
|
|
131
|
+
getValidateData: () => {
|
|
132
|
+
successData: any;
|
|
133
|
+
failData: any;
|
|
134
|
+
};
|
|
131
135
|
getData: () => any;
|
|
132
136
|
resetData: () => void;
|
|
133
137
|
filterData: (type: string) => void;
|
|
@@ -138,4 +142,4 @@ declare class Luckysheet extends React.Component {
|
|
|
138
142
|
leftMenu: JSX.Element;
|
|
139
143
|
render(): JSX.Element;
|
|
140
144
|
}
|
|
141
|
-
export default
|
|
145
|
+
export default DataValidation;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as DataValidation } from './DataValidation';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import React, { createContext, useContext, useEffect, forwardRef, createElement } from 'react';
|
|
2
|
-
import { Menu, Space,
|
|
3
|
+
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox } from 'antd';
|
|
3
4
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
4
5
|
import 'antd/dist/antd.css';
|
|
5
6
|
import classNames from 'classnames';
|
|
@@ -123,6 +124,42 @@ function _isNativeReflectConstruct() {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
128
|
+
if (source == null) return {};
|
|
129
|
+
var target = {};
|
|
130
|
+
var sourceKeys = Object.keys(source);
|
|
131
|
+
var key, i;
|
|
132
|
+
|
|
133
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
134
|
+
key = sourceKeys[i];
|
|
135
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
136
|
+
target[key] = source[key];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return target;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function _objectWithoutProperties(source, excluded) {
|
|
143
|
+
if (source == null) return {};
|
|
144
|
+
|
|
145
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
146
|
+
|
|
147
|
+
var key, i;
|
|
148
|
+
|
|
149
|
+
if (Object.getOwnPropertySymbols) {
|
|
150
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
151
|
+
|
|
152
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
153
|
+
key = sourceSymbolKeys[i];
|
|
154
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
155
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
156
|
+
target[key] = source[key];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return target;
|
|
161
|
+
}
|
|
162
|
+
|
|
126
163
|
function _assertThisInitialized(self) {
|
|
127
164
|
if (self === void 0) {
|
|
128
165
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -160,10 +197,6 @@ function _createSuper(Derived) {
|
|
|
160
197
|
};
|
|
161
198
|
}
|
|
162
199
|
|
|
163
|
-
function _readOnlyError(name) {
|
|
164
|
-
throw new TypeError("\"" + name + "\" is read-only");
|
|
165
|
-
}
|
|
166
|
-
|
|
167
200
|
function _slicedToArray(arr, i) {
|
|
168
201
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
169
202
|
}
|
|
@@ -355,7 +388,7 @@ function _slicedToArray$1(arr, i) {
|
|
|
355
388
|
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
356
389
|
}
|
|
357
390
|
|
|
358
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
391
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
359
392
|
if (source == null) return {};
|
|
360
393
|
var target = {};
|
|
361
394
|
var sourceKeys = Object.keys(source);
|
|
@@ -370,9 +403,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
370
403
|
return target;
|
|
371
404
|
}
|
|
372
405
|
|
|
373
|
-
function _objectWithoutProperties(source, excluded) {
|
|
406
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
374
407
|
if (source == null) return {};
|
|
375
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
408
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
376
409
|
var key, i;
|
|
377
410
|
|
|
378
411
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1377,7 +1410,7 @@ var IconBase = function IconBase(props) {
|
|
|
1377
1410
|
style = props.style,
|
|
1378
1411
|
primaryColor = props.primaryColor,
|
|
1379
1412
|
secondaryColor = props.secondaryColor,
|
|
1380
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
1413
|
+
restProps = _objectWithoutProperties$1(props, _excluded);
|
|
1381
1414
|
|
|
1382
1415
|
var colors = twoToneColorPalette;
|
|
1383
1416
|
|
|
@@ -1454,7 +1487,7 @@ var Icon = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1454
1487
|
tabIndex = props.tabIndex,
|
|
1455
1488
|
onClick = props.onClick,
|
|
1456
1489
|
twoToneColor = props.twoToneColor,
|
|
1457
|
-
restProps = _objectWithoutProperties(props, _excluded$1);
|
|
1490
|
+
restProps = _objectWithoutProperties$1(props, _excluded$1);
|
|
1458
1491
|
|
|
1459
1492
|
var _React$useContext = useContext(IconContext),
|
|
1460
1493
|
_React$useContext$pre = _React$useContext.prefixCls,
|
|
@@ -1578,8 +1611,16 @@ function styleInject(css, ref) {
|
|
|
1578
1611
|
var css_248z = ".luckysheet {\n overflow: hidden;\n}\n.luckysheet .luckysheet-work-area.luckysheet-noselected-text {\n display: none;\n}\n.sheet_table_top {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_top .menu_item_text {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.sheet_table_footer {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_text {\n color: #8f8f8f;\n}\n.sheet_table_dnd_text {\n background: #f2f2f2;\n border: 1px solid #d8d8d8;\n display: inline-block;\n width: 100px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
|
|
1579
1612
|
styleInject(css_248z);
|
|
1580
1613
|
|
|
1614
|
+
var _excluded$2 = ["flag", "checkResults"],
|
|
1615
|
+
_excluded2 = ["flag", "checkResults"];
|
|
1581
1616
|
var luckysheet = window.luckysheet;
|
|
1582
|
-
var itemsTemp = []; //
|
|
1617
|
+
var itemsTemp = []; // const mapping = [
|
|
1618
|
+
// { "key": "skuCode", "name": "SKU编码", "rule": "skuCode" },
|
|
1619
|
+
// { "key": "quantity", "name": "数量", "rule": "quantity" },
|
|
1620
|
+
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1621
|
+
// ]
|
|
1622
|
+
|
|
1623
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量']]); // for dnd
|
|
1583
1624
|
|
|
1584
1625
|
|
|
1585
1626
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1621,45 +1662,26 @@ var filterLetters = function filterLetters(i) {
|
|
|
1621
1662
|
}
|
|
1622
1663
|
};
|
|
1623
1664
|
|
|
1624
|
-
var
|
|
1625
|
-
_inherits(
|
|
1665
|
+
var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
1666
|
+
_inherits(DataValidation, _React$Component);
|
|
1626
1667
|
|
|
1627
|
-
var _super = _createSuper(
|
|
1668
|
+
var _super = _createSuper(DataValidation);
|
|
1628
1669
|
|
|
1629
|
-
function
|
|
1670
|
+
function DataValidation(props) {
|
|
1630
1671
|
var _this;
|
|
1631
1672
|
|
|
1632
|
-
_classCallCheck(this,
|
|
1673
|
+
_classCallCheck(this, DataValidation);
|
|
1633
1674
|
|
|
1634
1675
|
_this = _super.call(this, props);
|
|
1635
1676
|
|
|
1636
1677
|
_this.getCount = function () {
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
total: data.filter(function (item) {
|
|
1645
|
-
return item[validIndex];
|
|
1646
|
-
}).length,
|
|
1647
|
-
error: data.filter(function (item) {
|
|
1648
|
-
return item[validIndex] && item[validIndex].v !== '通过';
|
|
1649
|
-
}).length
|
|
1650
|
-
};
|
|
1651
|
-
} else {
|
|
1652
|
-
return {
|
|
1653
|
-
total: 0,
|
|
1654
|
-
error: 0
|
|
1655
|
-
};
|
|
1656
|
-
}
|
|
1657
|
-
} catch (e) {
|
|
1658
|
-
return {
|
|
1659
|
-
total: 0,
|
|
1660
|
-
error: 0
|
|
1661
|
-
};
|
|
1662
|
-
}
|
|
1678
|
+
var resultData = _this.state.resultData;
|
|
1679
|
+
return {
|
|
1680
|
+
total: resultData.length,
|
|
1681
|
+
error: resultData.filter(function (item) {
|
|
1682
|
+
return !item.flag;
|
|
1683
|
+
}).length
|
|
1684
|
+
};
|
|
1663
1685
|
};
|
|
1664
1686
|
|
|
1665
1687
|
_this.setConfig = function (data) {
|
|
@@ -1681,9 +1703,13 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1681
1703
|
}
|
|
1682
1704
|
}
|
|
1683
1705
|
},
|
|
1684
|
-
|
|
1706
|
+
cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
|
|
1685
1707
|
if (cell) {
|
|
1686
1708
|
cell.fs = 10;
|
|
1709
|
+
|
|
1710
|
+
if (typeof cell.v === 'string') {
|
|
1711
|
+
cell.m = cell.v = cell.m.trim();
|
|
1712
|
+
}
|
|
1687
1713
|
} // console.log(postion);
|
|
1688
1714
|
|
|
1689
1715
|
},
|
|
@@ -1829,6 +1855,30 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1829
1855
|
};
|
|
1830
1856
|
};
|
|
1831
1857
|
|
|
1858
|
+
_this.getValidateData = function () {
|
|
1859
|
+
var resultData = _this.state.resultData;
|
|
1860
|
+
return {
|
|
1861
|
+
successData: resultData.filter(function (item) {
|
|
1862
|
+
return item.flag;
|
|
1863
|
+
}).map(function (_ref2) {
|
|
1864
|
+
var flag = _ref2.flag,
|
|
1865
|
+
checkResults = _ref2.checkResults,
|
|
1866
|
+
item = _objectWithoutProperties(_ref2, _excluded$2);
|
|
1867
|
+
|
|
1868
|
+
return item;
|
|
1869
|
+
}),
|
|
1870
|
+
failData: resultData.filter(function (item) {
|
|
1871
|
+
return !item.flag;
|
|
1872
|
+
}).map(function (_ref3) {
|
|
1873
|
+
var flag = _ref3.flag,
|
|
1874
|
+
checkResults = _ref3.checkResults,
|
|
1875
|
+
item = _objectWithoutProperties(_ref3, _excluded2);
|
|
1876
|
+
|
|
1877
|
+
return item;
|
|
1878
|
+
})
|
|
1879
|
+
};
|
|
1880
|
+
};
|
|
1881
|
+
|
|
1832
1882
|
_this.getData = function () {
|
|
1833
1883
|
console.time();
|
|
1834
1884
|
var sheetData = luckysheet.getSheetData();
|
|
@@ -1846,16 +1896,26 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1846
1896
|
|
|
1847
1897
|
_this.resetData = function () {
|
|
1848
1898
|
var _this$props = _this.props,
|
|
1849
|
-
|
|
1850
|
-
updateData = _this$props.updateData
|
|
1899
|
+
validDataUrl = _this$props.validDataUrl,
|
|
1900
|
+
updateData = _this$props.updateData,
|
|
1901
|
+
columns = _this$props.columns;
|
|
1851
1902
|
|
|
1852
1903
|
var resultData = _this.getData();
|
|
1853
1904
|
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1905
|
+
axios.post(validDataUrl, {
|
|
1906
|
+
columns: columns,
|
|
1907
|
+
data: resultData
|
|
1908
|
+
}).then(function (result) {
|
|
1909
|
+
result = result.data;
|
|
1910
|
+
|
|
1911
|
+
if (result.status !== '0') {
|
|
1912
|
+
message.error(result.msg);
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1857
1916
|
var items = _this.state.items;
|
|
1858
1917
|
var validIndex = items.length;
|
|
1918
|
+
var res = result.data;
|
|
1859
1919
|
var sheetData = luckysheet.getSheetData();
|
|
1860
1920
|
sheetData.map(function (item, index) {
|
|
1861
1921
|
if (!res[index]) return item;
|
|
@@ -1888,18 +1948,20 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1888
1948
|
|
|
1889
1949
|
_this.setState({
|
|
1890
1950
|
data: luckysheet.transToCellData(sheetData),
|
|
1891
|
-
errorListCheck: false
|
|
1951
|
+
errorListCheck: false,
|
|
1952
|
+
resultData: res
|
|
1892
1953
|
});
|
|
1893
1954
|
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
});
|
|
1955
|
+
console.log(setExportData);
|
|
1956
|
+
setExportData([123123]);
|
|
1957
|
+
}).catch(function (err) {});
|
|
1897
1958
|
};
|
|
1898
1959
|
|
|
1899
1960
|
_this.filterData = function (type) {
|
|
1900
1961
|
var _this$state = _this.state,
|
|
1901
1962
|
showErrorData = _this$state.showErrorData,
|
|
1902
|
-
data = _this$state.data
|
|
1963
|
+
data = _this$state.data,
|
|
1964
|
+
resultData = _this$state.resultData;
|
|
1903
1965
|
var sheetData = luckysheet.transToData(data).filter(function (item, index) {
|
|
1904
1966
|
if (type === 'all') {
|
|
1905
1967
|
return false;
|
|
@@ -1910,11 +1972,13 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1910
1972
|
}
|
|
1911
1973
|
});
|
|
1912
1974
|
luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
1913
|
-
exportData = _this.getData();
|
|
1914
1975
|
|
|
1915
1976
|
_this.setState({
|
|
1916
1977
|
data: luckysheet.transToCellData(sheetData),
|
|
1917
|
-
errorListCheck: false
|
|
1978
|
+
errorListCheck: false,
|
|
1979
|
+
resultData: type === 'all' ? [] : resultData.filter(function (item) {
|
|
1980
|
+
return item.flag;
|
|
1981
|
+
})
|
|
1918
1982
|
});
|
|
1919
1983
|
};
|
|
1920
1984
|
|
|
@@ -1955,12 +2019,14 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1955
2019
|
};
|
|
1956
2020
|
|
|
1957
2021
|
_this.menuList = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2022
|
+
key: "1",
|
|
1958
2023
|
className: "sheet_table-menu_item_text"
|
|
1959
2024
|
}, /*#__PURE__*/React.createElement("a", {
|
|
1960
2025
|
onClick: function onClick() {
|
|
1961
2026
|
return _this.filterData('all');
|
|
1962
2027
|
}
|
|
1963
2028
|
}, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2029
|
+
key: "2",
|
|
1964
2030
|
className: "sheet_table-menu_item_text"
|
|
1965
2031
|
}, /*#__PURE__*/React.createElement("a", {
|
|
1966
2032
|
onClick: function onClick() {
|
|
@@ -1968,6 +2034,7 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1968
2034
|
}
|
|
1969
2035
|
}, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
|
|
1970
2036
|
_this.leftMenu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2037
|
+
key: "3",
|
|
1971
2038
|
className: "sheet_table-menu_item_text"
|
|
1972
2039
|
}, /*#__PURE__*/React.createElement("span", {
|
|
1973
2040
|
className: "sheet_table_text"
|
|
@@ -2000,11 +2067,15 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2000
2067
|
});
|
|
2001
2068
|
}), provided.placeholder);
|
|
2002
2069
|
}))));
|
|
2070
|
+
|
|
2071
|
+
_this.props.onRef(_assertThisInitialized(_this));
|
|
2072
|
+
|
|
2003
2073
|
itemsTemp = props.columns.map(function (item, index) {
|
|
2074
|
+
if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
|
|
2004
2075
|
return {
|
|
2005
2076
|
id: "item-0".concat(index),
|
|
2006
|
-
content: item
|
|
2007
|
-
code: item
|
|
2077
|
+
content: mapping.get(item),
|
|
2078
|
+
code: item
|
|
2008
2079
|
};
|
|
2009
2080
|
});
|
|
2010
2081
|
_this.state = {
|
|
@@ -2017,7 +2088,7 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2017
2088
|
return _this;
|
|
2018
2089
|
}
|
|
2019
2090
|
|
|
2020
|
-
_createClass(
|
|
2091
|
+
_createClass(DataValidation, [{
|
|
2021
2092
|
key: "onDragEnd",
|
|
2022
2093
|
value: function onDragEnd(result) {
|
|
2023
2094
|
// dropped outside the list
|
|
@@ -2058,17 +2129,15 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2058
2129
|
left: '0px',
|
|
2059
2130
|
top: '0px'
|
|
2060
2131
|
};
|
|
2061
|
-
return /*#__PURE__*/React.createElement(
|
|
2062
|
-
title: /*#__PURE__*/React.createElement(Space, null, title, /*#__PURE__*/React.createElement(Tooltip, {
|
|
2063
|
-
title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "1\u3001\u62D6\u52A8\u6570\u636E\u9879\uFF0C\u4EE5\u9002\u914D\u6E90\u6570\u636E\u7684\u987A\u5E8F\uFF0C\u5982\u60A8Excel\u4E2D\u6570\u636E\u6392\u5E8F\u4F9D\u6B21\u4E3A\u7F16\u7801\u3001\u4EF7\u683C\u548C\u6570\u91CF\uFF0C\u5219\u60A8\u4E5F\u53EF\u4EE5\u5C06\u6570\u636E\u9879\u7684\u987A\u5E8F\u8C03\u6574\u4E3A\u4E00\u81F4"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "2\u3001\u590D\u5236\u6587\u4EF6\u6570\u636E\uFF08\u591A\u5217\u4E00\u8D77\uFF09\uFF0C\u5728\u6587\u672C\u6846\u5185\u8FDB\u884C\u7C98\u8D34"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "3\u3001\u70B9\u51FB\u8BC6\u522B\u6309\u94AE\u8FDB\u884C\u6570\u636E\u6821\u9A8C\uFF0C\u5982\u5168\u90E8\u6B63\u786E\uFF0C\u5219\u70B9\u51FB\u5F55\u5165\u6309\u94AE\u53EF\u5F55\u5165\u6570\u636E\uFF0C\u5982\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5219\u9700\u4FEE\u6539\u540E\u518D\u8FDB\u884C\u5F55\u5165"))
|
|
2064
|
-
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined$2, null)))
|
|
2065
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2132
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2066
2133
|
className: "sheet_table_top"
|
|
2067
2134
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
2068
2135
|
trigger: ['click'],
|
|
2069
2136
|
overlay: this.leftMenu,
|
|
2070
2137
|
placement: "bottomLeft"
|
|
2071
|
-
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(ProfileTwoTone$2, null)))
|
|
2138
|
+
}, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(ProfileTwoTone$2, null))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
2139
|
+
title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "1\u3001\u62D6\u52A8\u6570\u636E\u9879\uFF0C\u4EE5\u9002\u914D\u6E90\u6570\u636E\u7684\u987A\u5E8F\uFF0C\u5982\u60A8Excel\u4E2D\u6570\u636E\u6392\u5E8F\u4F9D\u6B21\u4E3A\u7F16\u7801\u3001\u4EF7\u683C\u548C\u6570\u91CF\uFF0C\u5219\u60A8\u4E5F\u53EF\u4EE5\u5C06\u6570\u636E\u9879\u7684\u987A\u5E8F\u8C03\u6574\u4E3A\u4E00\u81F4"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "2\u3001\u590D\u5236\u6587\u4EF6\u6570\u636E\uFF08\u591A\u5217\u4E00\u8D77\uFF09\uFF0C\u5728\u6587\u672C\u6846\u5185\u8FDB\u884C\u7C98\u8D34"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "3\u3001\u70B9\u51FB\u8BC6\u522B\u6309\u94AE\u8FDB\u884C\u6570\u636E\u6821\u9A8C\uFF0C\u5982\u5168\u90E8\u6B63\u786E\uFF0C\u5219\u70B9\u51FB\u5F55\u5165\u6309\u94AE\u53EF\u5F55\u5165\u6570\u636E\uFF0C\u5982\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5219\u9700\u4FEE\u6539\u540E\u518D\u8FDB\u884C\u5F55\u5165"))
|
|
2140
|
+
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined$2, null))), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
2072
2141
|
trigger: ['click'],
|
|
2073
2142
|
overlay: this.menuList,
|
|
2074
2143
|
placement: "bottomRight"
|
|
@@ -2096,7 +2165,17 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2096
2165
|
}
|
|
2097
2166
|
}]);
|
|
2098
2167
|
|
|
2099
|
-
return
|
|
2168
|
+
return DataValidation;
|
|
2100
2169
|
}(React.Component);
|
|
2101
2170
|
|
|
2102
|
-
|
|
2171
|
+
/*
|
|
2172
|
+
* @Description:
|
|
2173
|
+
* @Author: rodchen
|
|
2174
|
+
* @Date: 2021-11-30 22:59:39
|
|
2175
|
+
* @LastEditTime: 2021-12-08 16:50:04
|
|
2176
|
+
* @LastEditors: rodchen
|
|
2177
|
+
*/
|
|
2178
|
+
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2179
|
+
axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2180
|
+
|
|
2181
|
+
export { DataValidation };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var axios = require('axios');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var antd = require('antd');
|
|
7
8
|
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
@@ -10,6 +11,7 @@ var classNames = require('classnames');
|
|
|
10
11
|
|
|
11
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
13
|
|
|
14
|
+
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
13
15
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
16
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
15
17
|
|
|
@@ -132,6 +134,42 @@ function _isNativeReflectConstruct() {
|
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
138
|
+
if (source == null) return {};
|
|
139
|
+
var target = {};
|
|
140
|
+
var sourceKeys = Object.keys(source);
|
|
141
|
+
var key, i;
|
|
142
|
+
|
|
143
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
144
|
+
key = sourceKeys[i];
|
|
145
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
146
|
+
target[key] = source[key];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return target;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function _objectWithoutProperties(source, excluded) {
|
|
153
|
+
if (source == null) return {};
|
|
154
|
+
|
|
155
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
156
|
+
|
|
157
|
+
var key, i;
|
|
158
|
+
|
|
159
|
+
if (Object.getOwnPropertySymbols) {
|
|
160
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
161
|
+
|
|
162
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
163
|
+
key = sourceSymbolKeys[i];
|
|
164
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
165
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
166
|
+
target[key] = source[key];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return target;
|
|
171
|
+
}
|
|
172
|
+
|
|
135
173
|
function _assertThisInitialized(self) {
|
|
136
174
|
if (self === void 0) {
|
|
137
175
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -169,10 +207,6 @@ function _createSuper(Derived) {
|
|
|
169
207
|
};
|
|
170
208
|
}
|
|
171
209
|
|
|
172
|
-
function _readOnlyError(name) {
|
|
173
|
-
throw new TypeError("\"" + name + "\" is read-only");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
210
|
function _slicedToArray(arr, i) {
|
|
177
211
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
178
212
|
}
|
|
@@ -364,7 +398,7 @@ function _slicedToArray$1(arr, i) {
|
|
|
364
398
|
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
365
399
|
}
|
|
366
400
|
|
|
367
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
401
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
368
402
|
if (source == null) return {};
|
|
369
403
|
var target = {};
|
|
370
404
|
var sourceKeys = Object.keys(source);
|
|
@@ -379,9 +413,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
379
413
|
return target;
|
|
380
414
|
}
|
|
381
415
|
|
|
382
|
-
function _objectWithoutProperties(source, excluded) {
|
|
416
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
383
417
|
if (source == null) return {};
|
|
384
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
418
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
385
419
|
var key, i;
|
|
386
420
|
|
|
387
421
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1386,7 +1420,7 @@ var IconBase = function IconBase(props) {
|
|
|
1386
1420
|
style = props.style,
|
|
1387
1421
|
primaryColor = props.primaryColor,
|
|
1388
1422
|
secondaryColor = props.secondaryColor,
|
|
1389
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
1423
|
+
restProps = _objectWithoutProperties$1(props, _excluded);
|
|
1390
1424
|
|
|
1391
1425
|
var colors = twoToneColorPalette;
|
|
1392
1426
|
|
|
@@ -1463,7 +1497,7 @@ var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
1463
1497
|
tabIndex = props.tabIndex,
|
|
1464
1498
|
onClick = props.onClick,
|
|
1465
1499
|
twoToneColor = props.twoToneColor,
|
|
1466
|
-
restProps = _objectWithoutProperties(props, _excluded$1);
|
|
1500
|
+
restProps = _objectWithoutProperties$1(props, _excluded$1);
|
|
1467
1501
|
|
|
1468
1502
|
var _React$useContext = React.useContext(IconContext),
|
|
1469
1503
|
_React$useContext$pre = _React$useContext.prefixCls,
|
|
@@ -1587,8 +1621,16 @@ function styleInject(css, ref) {
|
|
|
1587
1621
|
var css_248z = ".luckysheet {\n overflow: hidden;\n}\n.luckysheet .luckysheet-work-area.luckysheet-noselected-text {\n display: none;\n}\n.sheet_table_top {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_top .menu_item_text {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.sheet_table_footer {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_text {\n color: #8f8f8f;\n}\n.sheet_table_dnd_text {\n background: #f2f2f2;\n border: 1px solid #d8d8d8;\n display: inline-block;\n width: 100px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
|
|
1588
1622
|
styleInject(css_248z);
|
|
1589
1623
|
|
|
1624
|
+
var _excluded$2 = ["flag", "checkResults"],
|
|
1625
|
+
_excluded2 = ["flag", "checkResults"];
|
|
1590
1626
|
var luckysheet = window.luckysheet;
|
|
1591
|
-
var itemsTemp = []; //
|
|
1627
|
+
var itemsTemp = []; // const mapping = [
|
|
1628
|
+
// { "key": "skuCode", "name": "SKU编码", "rule": "skuCode" },
|
|
1629
|
+
// { "key": "quantity", "name": "数量", "rule": "quantity" },
|
|
1630
|
+
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1631
|
+
// ]
|
|
1632
|
+
|
|
1633
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量']]); // for dnd
|
|
1592
1634
|
|
|
1593
1635
|
|
|
1594
1636
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1630,45 +1672,26 @@ var filterLetters = function filterLetters(i) {
|
|
|
1630
1672
|
}
|
|
1631
1673
|
};
|
|
1632
1674
|
|
|
1633
|
-
var
|
|
1634
|
-
_inherits(
|
|
1675
|
+
var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
1676
|
+
_inherits(DataValidation, _React$Component);
|
|
1635
1677
|
|
|
1636
|
-
var _super = _createSuper(
|
|
1678
|
+
var _super = _createSuper(DataValidation);
|
|
1637
1679
|
|
|
1638
|
-
function
|
|
1680
|
+
function DataValidation(props) {
|
|
1639
1681
|
var _this;
|
|
1640
1682
|
|
|
1641
|
-
_classCallCheck(this,
|
|
1683
|
+
_classCallCheck(this, DataValidation);
|
|
1642
1684
|
|
|
1643
1685
|
_this = _super.call(this, props);
|
|
1644
1686
|
|
|
1645
1687
|
_this.getCount = function () {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
total: data.filter(function (item) {
|
|
1654
|
-
return item[validIndex];
|
|
1655
|
-
}).length,
|
|
1656
|
-
error: data.filter(function (item) {
|
|
1657
|
-
return item[validIndex] && item[validIndex].v !== '通过';
|
|
1658
|
-
}).length
|
|
1659
|
-
};
|
|
1660
|
-
} else {
|
|
1661
|
-
return {
|
|
1662
|
-
total: 0,
|
|
1663
|
-
error: 0
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
} catch (e) {
|
|
1667
|
-
return {
|
|
1668
|
-
total: 0,
|
|
1669
|
-
error: 0
|
|
1670
|
-
};
|
|
1671
|
-
}
|
|
1688
|
+
var resultData = _this.state.resultData;
|
|
1689
|
+
return {
|
|
1690
|
+
total: resultData.length,
|
|
1691
|
+
error: resultData.filter(function (item) {
|
|
1692
|
+
return !item.flag;
|
|
1693
|
+
}).length
|
|
1694
|
+
};
|
|
1672
1695
|
};
|
|
1673
1696
|
|
|
1674
1697
|
_this.setConfig = function (data) {
|
|
@@ -1690,9 +1713,13 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1690
1713
|
}
|
|
1691
1714
|
}
|
|
1692
1715
|
},
|
|
1693
|
-
|
|
1716
|
+
cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
|
|
1694
1717
|
if (cell) {
|
|
1695
1718
|
cell.fs = 10;
|
|
1719
|
+
|
|
1720
|
+
if (typeof cell.v === 'string') {
|
|
1721
|
+
cell.m = cell.v = cell.m.trim();
|
|
1722
|
+
}
|
|
1696
1723
|
} // console.log(postion);
|
|
1697
1724
|
|
|
1698
1725
|
},
|
|
@@ -1838,6 +1865,30 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1838
1865
|
};
|
|
1839
1866
|
};
|
|
1840
1867
|
|
|
1868
|
+
_this.getValidateData = function () {
|
|
1869
|
+
var resultData = _this.state.resultData;
|
|
1870
|
+
return {
|
|
1871
|
+
successData: resultData.filter(function (item) {
|
|
1872
|
+
return item.flag;
|
|
1873
|
+
}).map(function (_ref2) {
|
|
1874
|
+
var flag = _ref2.flag,
|
|
1875
|
+
checkResults = _ref2.checkResults,
|
|
1876
|
+
item = _objectWithoutProperties(_ref2, _excluded$2);
|
|
1877
|
+
|
|
1878
|
+
return item;
|
|
1879
|
+
}),
|
|
1880
|
+
failData: resultData.filter(function (item) {
|
|
1881
|
+
return !item.flag;
|
|
1882
|
+
}).map(function (_ref3) {
|
|
1883
|
+
var flag = _ref3.flag,
|
|
1884
|
+
checkResults = _ref3.checkResults,
|
|
1885
|
+
item = _objectWithoutProperties(_ref3, _excluded2);
|
|
1886
|
+
|
|
1887
|
+
return item;
|
|
1888
|
+
})
|
|
1889
|
+
};
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1841
1892
|
_this.getData = function () {
|
|
1842
1893
|
console.time();
|
|
1843
1894
|
var sheetData = luckysheet.getSheetData();
|
|
@@ -1855,16 +1906,26 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1855
1906
|
|
|
1856
1907
|
_this.resetData = function () {
|
|
1857
1908
|
var _this$props = _this.props,
|
|
1858
|
-
|
|
1859
|
-
updateData = _this$props.updateData
|
|
1909
|
+
validDataUrl = _this$props.validDataUrl,
|
|
1910
|
+
updateData = _this$props.updateData,
|
|
1911
|
+
columns = _this$props.columns;
|
|
1860
1912
|
|
|
1861
1913
|
var resultData = _this.getData();
|
|
1862
1914
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1915
|
+
axios__default['default'].post(validDataUrl, {
|
|
1916
|
+
columns: columns,
|
|
1917
|
+
data: resultData
|
|
1918
|
+
}).then(function (result) {
|
|
1919
|
+
result = result.data;
|
|
1920
|
+
|
|
1921
|
+
if (result.status !== '0') {
|
|
1922
|
+
antd.message.error(result.msg);
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1866
1926
|
var items = _this.state.items;
|
|
1867
1927
|
var validIndex = items.length;
|
|
1928
|
+
var res = result.data;
|
|
1868
1929
|
var sheetData = luckysheet.getSheetData();
|
|
1869
1930
|
sheetData.map(function (item, index) {
|
|
1870
1931
|
if (!res[index]) return item;
|
|
@@ -1897,18 +1958,20 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1897
1958
|
|
|
1898
1959
|
_this.setState({
|
|
1899
1960
|
data: luckysheet.transToCellData(sheetData),
|
|
1900
|
-
errorListCheck: false
|
|
1961
|
+
errorListCheck: false,
|
|
1962
|
+
resultData: res
|
|
1901
1963
|
});
|
|
1902
1964
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
});
|
|
1965
|
+
console.log(setExportData);
|
|
1966
|
+
setExportData([123123]);
|
|
1967
|
+
}).catch(function (err) {});
|
|
1906
1968
|
};
|
|
1907
1969
|
|
|
1908
1970
|
_this.filterData = function (type) {
|
|
1909
1971
|
var _this$state = _this.state,
|
|
1910
1972
|
showErrorData = _this$state.showErrorData,
|
|
1911
|
-
data = _this$state.data
|
|
1973
|
+
data = _this$state.data,
|
|
1974
|
+
resultData = _this$state.resultData;
|
|
1912
1975
|
var sheetData = luckysheet.transToData(data).filter(function (item, index) {
|
|
1913
1976
|
if (type === 'all') {
|
|
1914
1977
|
return false;
|
|
@@ -1919,11 +1982,13 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1919
1982
|
}
|
|
1920
1983
|
});
|
|
1921
1984
|
luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
1922
|
-
exportData = _this.getData();
|
|
1923
1985
|
|
|
1924
1986
|
_this.setState({
|
|
1925
1987
|
data: luckysheet.transToCellData(sheetData),
|
|
1926
|
-
errorListCheck: false
|
|
1988
|
+
errorListCheck: false,
|
|
1989
|
+
resultData: type === 'all' ? [] : resultData.filter(function (item) {
|
|
1990
|
+
return item.flag;
|
|
1991
|
+
})
|
|
1927
1992
|
});
|
|
1928
1993
|
};
|
|
1929
1994
|
|
|
@@ -1964,12 +2029,14 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1964
2029
|
};
|
|
1965
2030
|
|
|
1966
2031
|
_this.menuList = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2032
|
+
key: "1",
|
|
1967
2033
|
className: "sheet_table-menu_item_text"
|
|
1968
2034
|
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1969
2035
|
onClick: function onClick() {
|
|
1970
2036
|
return _this.filterData('all');
|
|
1971
2037
|
}
|
|
1972
2038
|
}, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2039
|
+
key: "2",
|
|
1973
2040
|
className: "sheet_table-menu_item_text"
|
|
1974
2041
|
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1975
2042
|
onClick: function onClick() {
|
|
@@ -1977,6 +2044,7 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
1977
2044
|
}
|
|
1978
2045
|
}, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
|
|
1979
2046
|
_this.leftMenu = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2047
|
+
key: "3",
|
|
1980
2048
|
className: "sheet_table-menu_item_text"
|
|
1981
2049
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1982
2050
|
className: "sheet_table_text"
|
|
@@ -2009,11 +2077,15 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2009
2077
|
});
|
|
2010
2078
|
}), provided.placeholder);
|
|
2011
2079
|
}))));
|
|
2080
|
+
|
|
2081
|
+
_this.props.onRef(_assertThisInitialized(_this));
|
|
2082
|
+
|
|
2012
2083
|
itemsTemp = props.columns.map(function (item, index) {
|
|
2084
|
+
if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
|
|
2013
2085
|
return {
|
|
2014
2086
|
id: "item-0".concat(index),
|
|
2015
|
-
content: item
|
|
2016
|
-
code: item
|
|
2087
|
+
content: mapping.get(item),
|
|
2088
|
+
code: item
|
|
2017
2089
|
};
|
|
2018
2090
|
});
|
|
2019
2091
|
_this.state = {
|
|
@@ -2026,7 +2098,7 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2026
2098
|
return _this;
|
|
2027
2099
|
}
|
|
2028
2100
|
|
|
2029
|
-
_createClass(
|
|
2101
|
+
_createClass(DataValidation, [{
|
|
2030
2102
|
key: "onDragEnd",
|
|
2031
2103
|
value: function onDragEnd(result) {
|
|
2032
2104
|
// dropped outside the list
|
|
@@ -2067,17 +2139,15 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2067
2139
|
left: '0px',
|
|
2068
2140
|
top: '0px'
|
|
2069
2141
|
};
|
|
2070
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
2071
|
-
title: /*#__PURE__*/React__default['default'].createElement(antd.Space, null, title, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
|
|
2072
|
-
title: /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "1\u3001\u62D6\u52A8\u6570\u636E\u9879\uFF0C\u4EE5\u9002\u914D\u6E90\u6570\u636E\u7684\u987A\u5E8F\uFF0C\u5982\u60A8Excel\u4E2D\u6570\u636E\u6392\u5E8F\u4F9D\u6B21\u4E3A\u7F16\u7801\u3001\u4EF7\u683C\u548C\u6570\u91CF\uFF0C\u5219\u60A8\u4E5F\u53EF\u4EE5\u5C06\u6570\u636E\u9879\u7684\u987A\u5E8F\u8C03\u6574\u4E3A\u4E00\u81F4"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "2\u3001\u590D\u5236\u6587\u4EF6\u6570\u636E\uFF08\u591A\u5217\u4E00\u8D77\uFF09\uFF0C\u5728\u6587\u672C\u6846\u5185\u8FDB\u884C\u7C98\u8D34"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "3\u3001\u70B9\u51FB\u8BC6\u522B\u6309\u94AE\u8FDB\u884C\u6570\u636E\u6821\u9A8C\uFF0C\u5982\u5168\u90E8\u6B63\u786E\uFF0C\u5219\u70B9\u51FB\u5F55\u5165\u6309\u94AE\u53EF\u5F55\u5165\u6570\u636E\uFF0C\u5982\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5219\u9700\u4FEE\u6539\u540E\u518D\u8FDB\u884C\u5F55\u5165"))
|
|
2073
|
-
}, /*#__PURE__*/React__default['default'].createElement(ExclamationCircleOutlined$2, null)))
|
|
2074
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2142
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2075
2143
|
className: "sheet_table_top"
|
|
2076
2144
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
2077
2145
|
trigger: ['click'],
|
|
2078
2146
|
overlay: this.leftMenu,
|
|
2079
2147
|
placement: "bottomLeft"
|
|
2080
|
-
}, /*#__PURE__*/React__default['default'].createElement("a", null, /*#__PURE__*/React__default['default'].createElement(ProfileTwoTone$2, null)))
|
|
2148
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", null, /*#__PURE__*/React__default['default'].createElement(ProfileTwoTone$2, null))), /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
|
|
2149
|
+
title: /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "1\u3001\u62D6\u52A8\u6570\u636E\u9879\uFF0C\u4EE5\u9002\u914D\u6E90\u6570\u636E\u7684\u987A\u5E8F\uFF0C\u5982\u60A8Excel\u4E2D\u6570\u636E\u6392\u5E8F\u4F9D\u6B21\u4E3A\u7F16\u7801\u3001\u4EF7\u683C\u548C\u6570\u91CF\uFF0C\u5219\u60A8\u4E5F\u53EF\u4EE5\u5C06\u6570\u636E\u9879\u7684\u987A\u5E8F\u8C03\u6574\u4E3A\u4E00\u81F4"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "2\u3001\u590D\u5236\u6587\u4EF6\u6570\u636E\uFF08\u591A\u5217\u4E00\u8D77\uFF09\uFF0C\u5728\u6587\u672C\u6846\u5185\u8FDB\u884C\u7C98\u8D34"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", null, "3\u3001\u70B9\u51FB\u8BC6\u522B\u6309\u94AE\u8FDB\u884C\u6570\u636E\u6821\u9A8C\uFF0C\u5982\u5168\u90E8\u6B63\u786E\uFF0C\u5219\u70B9\u51FB\u5F55\u5165\u6309\u94AE\u53EF\u5F55\u5165\u6570\u636E\uFF0C\u5982\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5219\u9700\u4FEE\u6539\u540E\u518D\u8FDB\u884C\u5F55\u5165"))
|
|
2150
|
+
}, /*#__PURE__*/React__default['default'].createElement(ExclamationCircleOutlined$2, null))), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
2081
2151
|
trigger: ['click'],
|
|
2082
2152
|
overlay: this.menuList,
|
|
2083
2153
|
placement: "bottomRight"
|
|
@@ -2105,7 +2175,17 @@ var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
|
2105
2175
|
}
|
|
2106
2176
|
}]);
|
|
2107
2177
|
|
|
2108
|
-
return
|
|
2178
|
+
return DataValidation;
|
|
2109
2179
|
}(React__default['default'].Component);
|
|
2110
2180
|
|
|
2111
|
-
|
|
2181
|
+
/*
|
|
2182
|
+
* @Description:
|
|
2183
|
+
* @Author: rodchen
|
|
2184
|
+
* @Date: 2021-11-30 22:59:39
|
|
2185
|
+
* @LastEditTime: 2021-12-08 16:50:04
|
|
2186
|
+
* @LastEditors: rodchen
|
|
2187
|
+
*/
|
|
2188
|
+
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2189
|
+
axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2190
|
+
|
|
2191
|
+
exports.DataValidation = DataValidation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bit-sun/business-component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"adaptd": "^0.1.0",
|
|
31
30
|
"antd": "4.17.2",
|
|
31
|
+
"axios": "^0.24.0",
|
|
32
32
|
"bs-business-component": "^1.0.1",
|
|
33
33
|
"classnames": "^2.3.1",
|
|
34
34
|
"react": "^16.12.0",
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: Components
|
|
4
|
+
path: /components
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## DataValidation
|
|
8
|
+
|
|
9
|
+
Demo:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import React, { useRef } from 'react';
|
|
13
|
+
import { DataValidation } from '../index';
|
|
14
|
+
|
|
15
|
+
export default () => {
|
|
16
|
+
let dataValidationRef: DataValidation = useRef();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<DataValidation
|
|
21
|
+
columns={['skuCode', 'quantity', 'price']}
|
|
22
|
+
onRef={(ref) => {
|
|
23
|
+
dataValidationRef = ref;
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2021-12-01 10:52:08
|
|
5
|
-
* @LastEditTime: 2021-12-
|
|
5
|
+
* @LastEditTime: 2021-12-21 14:01:02
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
// @ts-nocheck
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
Dropdown,
|
|
17
17
|
Menu,
|
|
18
18
|
Tooltip,
|
|
19
|
+
message,
|
|
19
20
|
} from 'antd';
|
|
20
21
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
21
22
|
import 'antd/dist/antd.css';
|
|
@@ -25,12 +26,27 @@ import {
|
|
|
25
26
|
ProfileTwoTone,
|
|
26
27
|
UnorderedListOutlined,
|
|
27
28
|
} from '@ant-design/icons';
|
|
29
|
+
import axios from 'axios';
|
|
28
30
|
import './index.less';
|
|
29
31
|
|
|
30
32
|
const luckysheet = window.luckysheet;
|
|
31
33
|
|
|
32
34
|
let itemsTemp = [];
|
|
33
35
|
|
|
36
|
+
// const mapping = [
|
|
37
|
+
// { "key": "skuCode", "name": "SKU编码", "rule": "skuCode" },
|
|
38
|
+
// { "key": "quantity", "name": "数量", "rule": "quantity" },
|
|
39
|
+
// { "key": "price", "name": "单价", "rule": "price" }
|
|
40
|
+
// ]
|
|
41
|
+
|
|
42
|
+
const mapping = new Map([
|
|
43
|
+
['skuCode', 'SKU编码'],
|
|
44
|
+
['quantity', '数量'],
|
|
45
|
+
['price', '单价'],
|
|
46
|
+
['regionCode', '库区'],
|
|
47
|
+
['checkQuantity', '实盘数量'],
|
|
48
|
+
]);
|
|
49
|
+
|
|
34
50
|
// for dnd
|
|
35
51
|
// fake data generator
|
|
36
52
|
const getItems = (count) =>
|
|
@@ -76,15 +92,20 @@ const filterLetters = (i) => {
|
|
|
76
92
|
}
|
|
77
93
|
};
|
|
78
94
|
|
|
79
|
-
class
|
|
95
|
+
class DataValidation extends React.Component {
|
|
80
96
|
constructor(props) {
|
|
81
97
|
super(props);
|
|
98
|
+
this.props.onRef(this);
|
|
82
99
|
|
|
83
100
|
itemsTemp = props.columns.map((item, index) => {
|
|
101
|
+
if (!mapping.get(item))
|
|
102
|
+
throw Error(
|
|
103
|
+
`${item} is not in DataValidation component, please fix this error`,
|
|
104
|
+
);
|
|
84
105
|
return {
|
|
85
106
|
id: `item-0${index}`,
|
|
86
|
-
content: item
|
|
87
|
-
code: item
|
|
107
|
+
content: mapping.get(item),
|
|
108
|
+
code: item,
|
|
88
109
|
};
|
|
89
110
|
});
|
|
90
111
|
|
|
@@ -119,31 +140,11 @@ class Luckysheet extends React.Component {
|
|
|
119
140
|
}
|
|
120
141
|
|
|
121
142
|
getCount = () => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (data[0] && data[0][validIndex]) {
|
|
129
|
-
return {
|
|
130
|
-
total: data.filter((item) => item[validIndex]).length,
|
|
131
|
-
error: data.filter(
|
|
132
|
-
(item) => item[validIndex] && item[validIndex].v !== '通过',
|
|
133
|
-
).length,
|
|
134
|
-
};
|
|
135
|
-
} else {
|
|
136
|
-
return {
|
|
137
|
-
total: 0,
|
|
138
|
-
error: 0,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
} catch (e) {
|
|
142
|
-
return {
|
|
143
|
-
total: 0,
|
|
144
|
-
error: 0,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
143
|
+
const { resultData } = this.state;
|
|
144
|
+
return {
|
|
145
|
+
total: resultData.length,
|
|
146
|
+
error: resultData.filter((item) => !item.flag).length,
|
|
147
|
+
};
|
|
147
148
|
};
|
|
148
149
|
|
|
149
150
|
setConfig = (data) => {
|
|
@@ -164,9 +165,13 @@ class Luckysheet extends React.Component {
|
|
|
164
165
|
}
|
|
165
166
|
}
|
|
166
167
|
},
|
|
167
|
-
|
|
168
|
+
cellRenderBefore: function (cell, postion, sheetFile, ctx) {
|
|
168
169
|
if (cell) {
|
|
169
170
|
cell.fs = 10;
|
|
171
|
+
|
|
172
|
+
if (typeof cell.v === 'string') {
|
|
173
|
+
cell.m = cell.v = cell.m.trim();
|
|
174
|
+
}
|
|
170
175
|
}
|
|
171
176
|
// console.log(postion);
|
|
172
177
|
},
|
|
@@ -325,6 +330,18 @@ class Luckysheet extends React.Component {
|
|
|
325
330
|
luckysheet.destroy();
|
|
326
331
|
}
|
|
327
332
|
|
|
333
|
+
getValidateData = () => {
|
|
334
|
+
const { resultData } = this.state;
|
|
335
|
+
return {
|
|
336
|
+
successData: resultData
|
|
337
|
+
.filter((item) => item.flag)
|
|
338
|
+
.map(({ flag, checkResults, ...item }) => item),
|
|
339
|
+
failData: resultData
|
|
340
|
+
.filter((item) => !item.flag)
|
|
341
|
+
.map(({ flag, checkResults, ...item }) => item),
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
|
|
328
345
|
getData = () => {
|
|
329
346
|
console.time();
|
|
330
347
|
let sheetData = luckysheet.getSheetData();
|
|
@@ -332,9 +349,11 @@ class Luckysheet extends React.Component {
|
|
|
332
349
|
.filter((item) => item[0])
|
|
333
350
|
.map((item) => {
|
|
334
351
|
let obj = {};
|
|
352
|
+
|
|
335
353
|
item.slice(0, itemsTemp.length).map((innerItem, index) => {
|
|
336
354
|
obj[this.state.items[index].code] = innerItem && innerItem.v;
|
|
337
355
|
});
|
|
356
|
+
|
|
338
357
|
return obj;
|
|
339
358
|
});
|
|
340
359
|
|
|
@@ -342,55 +361,68 @@ class Luckysheet extends React.Component {
|
|
|
342
361
|
};
|
|
343
362
|
|
|
344
363
|
resetData = () => {
|
|
345
|
-
const {
|
|
364
|
+
const { validDataUrl, updateData, columns } = this.props;
|
|
346
365
|
const resultData = this.getData();
|
|
347
|
-
new Promise((resolve, reject) => {
|
|
348
|
-
validDataFunction(resultData, resolve);
|
|
349
|
-
}).then((res) => {
|
|
350
|
-
const { items } = this.state;
|
|
351
|
-
let validIndex = items.length;
|
|
352
|
-
|
|
353
|
-
let sheetData = luckysheet.getSheetData();
|
|
354
366
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
} else {
|
|
366
|
-
item[validIndex] = {
|
|
367
|
-
...item[validIndex],
|
|
368
|
-
v: res[index].checkResults,
|
|
369
|
-
m: res[index].checkResults,
|
|
370
|
-
fc: 'red', //字体颜色为 "#990000"
|
|
371
|
-
};
|
|
367
|
+
axios
|
|
368
|
+
.post(validDataUrl, {
|
|
369
|
+
columns: columns,
|
|
370
|
+
data: resultData,
|
|
371
|
+
})
|
|
372
|
+
.then((result) => {
|
|
373
|
+
result = result.data;
|
|
374
|
+
if (result.status !== '0') {
|
|
375
|
+
message.error(result.msg);
|
|
376
|
+
return;
|
|
372
377
|
}
|
|
378
|
+
const { items } = this.state;
|
|
379
|
+
let validIndex = items.length;
|
|
380
|
+
let res = result.data;
|
|
381
|
+
|
|
382
|
+
let sheetData = luckysheet.getSheetData();
|
|
383
|
+
|
|
384
|
+
sheetData.map((item, index) => {
|
|
385
|
+
if (!res[index]) return item;
|
|
386
|
+
|
|
387
|
+
if (res[index].flag) {
|
|
388
|
+
item[validIndex] = {
|
|
389
|
+
...item[validIndex],
|
|
390
|
+
v: '通过',
|
|
391
|
+
m: '通过',
|
|
392
|
+
fc: 'green', //字体颜色为 "#990000"
|
|
393
|
+
};
|
|
394
|
+
} else {
|
|
395
|
+
item[validIndex] = {
|
|
396
|
+
...item[validIndex],
|
|
397
|
+
v: res[index].checkResults,
|
|
398
|
+
m: res[index].checkResults,
|
|
399
|
+
fc: 'red', //字体颜色为 "#990000"
|
|
400
|
+
};
|
|
401
|
+
}
|
|
373
402
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
403
|
+
item[validIndex].ct = { fa: 'General', t: 'g' };
|
|
404
|
+
});
|
|
405
|
+
// sheetData.map((item, index) => {
|
|
406
|
+
// luckysheet.setCellValue(index + 1, 4, 345)
|
|
407
|
+
// })
|
|
408
|
+
|
|
409
|
+
luckysheet.create(
|
|
410
|
+
this.setConfig(luckysheet.transToCellData(sheetData)),
|
|
411
|
+
);
|
|
412
|
+
this.setState({
|
|
413
|
+
data: luckysheet.transToCellData(sheetData),
|
|
414
|
+
errorListCheck: false,
|
|
415
|
+
resultData: res,
|
|
416
|
+
});
|
|
387
417
|
|
|
388
|
-
|
|
389
|
-
|
|
418
|
+
console.log(setExportData);
|
|
419
|
+
setExportData([123123]);
|
|
420
|
+
})
|
|
421
|
+
.catch((err) => {});
|
|
390
422
|
};
|
|
391
423
|
|
|
392
424
|
filterData = (type: string) => {
|
|
393
|
-
const { showErrorData, data } = this.state;
|
|
425
|
+
const { showErrorData, data, resultData } = this.state;
|
|
394
426
|
let sheetData = luckysheet.transToData(data).filter((item, index) => {
|
|
395
427
|
if (type === 'all') {
|
|
396
428
|
return false;
|
|
@@ -401,10 +433,10 @@ class Luckysheet extends React.Component {
|
|
|
401
433
|
});
|
|
402
434
|
|
|
403
435
|
luckysheet.create(this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
404
|
-
exportData = this.getData();
|
|
405
436
|
this.setState({
|
|
406
437
|
data: luckysheet.transToCellData(sheetData),
|
|
407
438
|
errorListCheck: false,
|
|
439
|
+
resultData: type === 'all' ? [] : resultData.filter((item) => item.flag),
|
|
408
440
|
});
|
|
409
441
|
};
|
|
410
442
|
|
|
@@ -443,11 +475,11 @@ class Luckysheet extends React.Component {
|
|
|
443
475
|
|
|
444
476
|
menuList = (
|
|
445
477
|
<Menu>
|
|
446
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
478
|
+
<Menu.Item key="1" className="sheet_table-menu_item_text">
|
|
447
479
|
<a onClick={() => this.filterData('all')}>清空全部数据</a>
|
|
448
480
|
</Menu.Item>
|
|
449
481
|
<Menu.Divider />
|
|
450
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
482
|
+
<Menu.Item key="2" className="sheet_table-menu_item_text">
|
|
451
483
|
<a onClick={() => this.filterData('error')}>仅清空错误数据</a>
|
|
452
484
|
</Menu.Item>
|
|
453
485
|
</Menu>
|
|
@@ -455,7 +487,7 @@ class Luckysheet extends React.Component {
|
|
|
455
487
|
|
|
456
488
|
leftMenu = (
|
|
457
489
|
<Menu>
|
|
458
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
490
|
+
<Menu.Item key="3" className="sheet_table-menu_item_text">
|
|
459
491
|
<span className="sheet_table_text">请拖动字段来对应列</span>
|
|
460
492
|
</Menu.Item>
|
|
461
493
|
<Menu.Divider />
|
|
@@ -519,10 +551,19 @@ class Luckysheet extends React.Component {
|
|
|
519
551
|
top: '0px',
|
|
520
552
|
};
|
|
521
553
|
return (
|
|
522
|
-
|
|
523
|
-
|
|
554
|
+
<>
|
|
555
|
+
<div className="sheet_table_top">
|
|
524
556
|
<Space>
|
|
525
|
-
|
|
557
|
+
<span>排序列</span>
|
|
558
|
+
<Dropdown
|
|
559
|
+
trigger={['click']}
|
|
560
|
+
overlay={this.leftMenu}
|
|
561
|
+
placement="bottomLeft"
|
|
562
|
+
>
|
|
563
|
+
<a>
|
|
564
|
+
<ProfileTwoTone />
|
|
565
|
+
</a>
|
|
566
|
+
</Dropdown>
|
|
526
567
|
<Tooltip
|
|
527
568
|
title={
|
|
528
569
|
<>
|
|
@@ -543,21 +584,6 @@ class Luckysheet extends React.Component {
|
|
|
543
584
|
<ExclamationCircleOutlined />
|
|
544
585
|
</Tooltip>
|
|
545
586
|
</Space>
|
|
546
|
-
}
|
|
547
|
-
>
|
|
548
|
-
<div className="sheet_table_top">
|
|
549
|
-
<Space>
|
|
550
|
-
<span>排序列</span>
|
|
551
|
-
<Dropdown
|
|
552
|
-
trigger={['click']}
|
|
553
|
-
overlay={this.leftMenu}
|
|
554
|
-
placement="bottomLeft"
|
|
555
|
-
>
|
|
556
|
-
<a>
|
|
557
|
-
<ProfileTwoTone />
|
|
558
|
-
</a>
|
|
559
|
-
</Dropdown>
|
|
560
|
-
</Space>
|
|
561
587
|
<Space>
|
|
562
588
|
<Dropdown
|
|
563
589
|
trigger={['click']}
|
|
@@ -591,9 +617,9 @@ class Luckysheet extends React.Component {
|
|
|
591
617
|
仅展示错误数据
|
|
592
618
|
</Space>
|
|
593
619
|
</div>
|
|
594
|
-
|
|
620
|
+
</>
|
|
595
621
|
);
|
|
596
622
|
}
|
|
597
623
|
}
|
|
598
624
|
|
|
599
|
-
export default
|
|
625
|
+
export default DataValidation;
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2021-11-30 22:59:39
|
|
5
|
-
* @LastEditTime: 2021-12-
|
|
5
|
+
* @LastEditTime: 2021-12-08 16:50:04
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
|
|
11
|
+
const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
12
|
+
|
|
13
|
+
axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
|
|
14
|
+
|
|
15
|
+
export { default as DataValidation } from './DataValidation';
|
package/src/SheetTable/index.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
nav:
|
|
3
|
-
title: Components
|
|
4
|
-
path: /components
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## SheetTable
|
|
8
|
-
|
|
9
|
-
Demo:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { SheetTable } from '../index';
|
|
14
|
-
|
|
15
|
-
export default () => (
|
|
16
|
-
<div>
|
|
17
|
-
<SheetTable
|
|
18
|
-
columns={[
|
|
19
|
-
['商品编码', 'skuCode'],
|
|
20
|
-
['商品名称', 'skuName'],
|
|
21
|
-
['商品名称1', 'skuName'],
|
|
22
|
-
]}
|
|
23
|
-
validDataFunction={(data, resolve) => {
|
|
24
|
-
resolve([]);
|
|
25
|
-
}}
|
|
26
|
-
title="商品录入"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|