cloud-web-corejs-haier 1.0.46 → 1.0.48

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs-haier",
3
3
  "private": false,
4
- "version": "1.0.46",
4
+ "version": "1.0.48",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -28,9 +28,12 @@ tmixins = {
28
28
  type: Number,
29
29
  default: () => 100000,
30
30
  },
31
+ /* 单个文件大小限制(MB),0 表示不限制 */
31
32
  size: {
32
33
  type: Number,
33
- default: 200,
34
+ default: () => {
35
+ return settingConfig.uploadFileSize ?? 200;
36
+ },
34
37
  },
35
38
  accept: {
36
39
  type: String,
@@ -190,8 +193,9 @@ tmixins = {
190
193
  // this.show = true
191
194
  },
192
195
  handleChange(file, fileList) {
196
+ /* size 为 0(或未配置限制)时不做大小校验 */
193
197
  let maxSize = this.size * 1024 * 1024;
194
- if (file.size > maxSize) {
198
+ if (maxSize > 0 && file.size > maxSize) {
195
199
  fileList.map((item, index) => {
196
200
  if (item === file) {
197
201
  fileList.splice(index, 1);
@@ -1213,9 +1217,12 @@ tViewMixins = {
1213
1217
  type: Number,
1214
1218
  default: 100000,
1215
1219
  },
1220
+ /* 单个文件大小限制(MB),0 表示不限制 */
1216
1221
  size: {
1217
1222
  type: Number,
1218
- default: 200,
1223
+ default: () => {
1224
+ return settingConfig.uploadFileSize ?? 200;
1225
+ },
1219
1226
  },
1220
1227
  accept: {
1221
1228
  type: String,
@@ -28,9 +28,12 @@ tmixins = {
28
28
  type: Number,
29
29
  default: () => 100000,
30
30
  },
31
+ /* 单个文件大小限制(MB),0 表示不限制 */
31
32
  size: {
32
33
  type: Number,
33
- default: 200,
34
+ default: () => {
35
+ return settingConfig.uploadFileSize ?? 200;
36
+ },
34
37
  },
35
38
  accept: {
36
39
  type: String,
@@ -185,8 +188,9 @@ tmixins = {
185
188
  // this.show = true
186
189
  },
187
190
  handleChange(file, fileList) {
191
+ /* size 为 0(或未配置限制)时不做大小校验 */
188
192
  let maxSize = this.size * 1024 * 1024;
189
- if (file.size > maxSize) {
193
+ if (maxSize > 0 && file.size > maxSize) {
190
194
  fileList.map((item, index) => {
191
195
  if (item === file) {
192
196
  fileList.splice(index, 1);
@@ -2446,30 +2446,53 @@ modules = {
2446
2446
  let treeTaBm = newFormData.treeTaBm || [];
2447
2447
  treeTaBm.push(formTemplateTableDTO.tableAlias);
2448
2448
  newFormData.treeTaBm = treeTaBm;
2449
+ // 树的主键以 treeConfig.rowField 为准:transform 模式下 vxe 是用它
2450
+ // (xe-utils toArrayTree 的 key) 建树的,根节点判定必须与之同源,
2451
+ // 否则判出来的顶层节点和表格里的实际层级对不上。
2452
+ let idField = $grid.treeConfig.rowField || "id";
2449
2453
  let tableDatas = this.$baseLodash.cloneDeep(
2450
2454
  formDataModel[formTemplateTableDTO.name] || []
2451
2455
  );
2456
+ // 根节点判定必须在下面清空临时 id 之前完成:新增子行的父 id 是
2457
+ // "row_xxx",清空后变成空值,之后再判定就会被误判成根节点,既提交成
2458
+ // 顶层节点又已嵌在父行的 children 里,造成重复与层级错乱。
2459
+ // 判定口径与 toArrayTree 一致:父值为空(null/undefined/""/0/"0")视为
2460
+ // 根;父值非空但父行不在本表数据里(过滤/查询后的孤儿行)也要收进顶层
2461
+ // 数组,否则整棵子树被静默丢弃——它的 parentField 原值保留不清空,
2462
+ // 后端据此重新挂接到既有父节点。
2463
+ let idSet = new Set();
2452
2464
  tableDatas.forEach((tableData) => {
2453
- if (
2454
- tableData.id
2455
- && tableData.id.startsWith
2456
- && tableData.id.startsWith("row_")
2457
- ) {
2458
- tableData.id = null;
2465
+ let id = tableData[idField];
2466
+ if (id !== null && id !== undefined && id !== "") {
2467
+ idSet.add(String(id));
2459
2468
  }
2460
- if (
2461
- tableData[parentField]
2462
- && tableData[parentField].startsWith
2463
- && tableData[parentField].startsWith("row_")
2464
- ) {
2465
- tableData[parentField] = null;
2469
+ });
2470
+ let isRootFlags = tableDatas.map((tableData) => {
2471
+ let parentValue = tableData[parentField];
2472
+ if ([null, undefined, "", 0, "0"].includes(parentValue)) {
2473
+ return true;
2466
2474
  }
2475
+ return !idSet.has(String(parentValue));
2476
+ });
2477
+ // 临时 id 要连字面量 id 一起清:新增行(addTreeRow)把 "row_xxx" 写在
2478
+ // row.id 上,复制(handleCopyTreeData)写在 rowField 上,来源不同,
2479
+ // 只清一个会把临时 id 提交给后端。rowField 缺省时两者是同一字段。
2480
+ let clearTempValue = (tableData, field) => {
2481
+ let value = tableData[field];
2482
+ if (value && value.startsWith && value.startsWith("row_")) {
2483
+ tableData[field] = null;
2484
+ }
2485
+ };
2486
+ tableDatas.forEach((tableData) => {
2487
+ clearTempValue(tableData, idField);
2488
+ if (idField !== "id") {
2489
+ clearTempValue(tableData, "id");
2490
+ }
2491
+ clearTempValue(tableData, parentField);
2467
2492
  if (tableData[parentField] === undefined)
2468
2493
  tableData[parentField] = null;
2469
2494
  });
2470
- tableDatas = tableDatas.filter((item) => {
2471
- return item[parentField] === 0 || item[parentField] === null;
2472
- });
2495
+ tableDatas = tableDatas.filter((item, index) => isRootFlags[index]);
2473
2496
  newFormData[tableAlias] = tableDatas;
2474
2497
  } else {
2475
2498
  newFormData[tableAlias]