@gingkoo/base-server 0.0.4-alpha.29 → 0.0.4-alpha.30

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.
@@ -51,8 +51,11 @@ const columnToNumber = (column) => {
51
51
  * }
52
52
  * }
53
53
  * }
54
+ * @param {strict | default} mappingRules 字段匹配规则
55
+ * strict 匹配不上就为空
56
+ * default 匹配不上 等于原值
54
57
  */
55
- async function _excelImport(filePath, dataModel, mappingData) {
58
+ async function _excelImport(filePath, dataModel, mappingData, mappingRules = 'default') {
56
59
  let result = {
57
60
  data: [],
58
61
  };
@@ -102,7 +105,7 @@ async function _excelImport(filePath, dataModel, mappingData) {
102
105
  rec[colIndex[colId]] = mappingData2?.[mappingId]?.data?.[cell.value];
103
106
  } else {
104
107
  //数据字典匹配不到
105
- rec[colIndex[colId]] = cell.value;
108
+ mappingRules != 'strict' ? (rec[colIndex[colId]] = cell.value) : null;
106
109
  }
107
110
  } else {
108
111
  //非数据字典字段
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/base-server",
3
- "version": "0.0.4-alpha.29",
3
+ "version": "0.0.4-alpha.30",
4
4
  "description": "",
5
5
  "main": "app.js",
6
6
  "scripts": {