@ibiz-template/runtime 0.7.17 → 0.7.18
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/index.esm.js +187 -68
- package/dist/index.system.min.js +1 -1
- package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
- package/out/controller/control/chart/generator/base-series-generator.js +2 -0
- package/out/controller/control/gantt/gantt.controller.d.ts +12 -4
- package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
- package/out/controller/control/gantt/gantt.controller.js +110 -28
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +2 -1
- package/out/interface/controller/event/control/i-gantt.event.d.ts +10 -9
- package/out/interface/controller/event/control/i-gantt.event.d.ts.map +1 -1
- package/out/utils/file-util/file-util.d.ts +20 -0
- package/out/utils/file-util/file-util.d.ts.map +1 -1
- package/out/utils/file-util/file-util.js +52 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -5064,10 +5064,12 @@ var AnimeUtil = class {
|
|
|
5064
5064
|
|
|
5065
5065
|
// src/utils/file-util/file-util.ts
|
|
5066
5066
|
import {
|
|
5067
|
+
CoreConst,
|
|
5067
5068
|
RuntimeError as RuntimeError5,
|
|
5068
5069
|
downloadFileFromBlob
|
|
5069
5070
|
} from "@ibiz-template/core";
|
|
5070
5071
|
import qs2 from "qs";
|
|
5072
|
+
import { getCookie } from "qx-util";
|
|
5071
5073
|
var FileUtil = class {
|
|
5072
5074
|
/**
|
|
5073
5075
|
* 计算OSSCat参数
|
|
@@ -5207,6 +5209,55 @@ var FileUtil = class {
|
|
|
5207
5209
|
}
|
|
5208
5210
|
return fileName;
|
|
5209
5211
|
}
|
|
5212
|
+
/**
|
|
5213
|
+
* 选择文件并上传
|
|
5214
|
+
*
|
|
5215
|
+
* @param {IContext} context
|
|
5216
|
+
* @param {IParams} params
|
|
5217
|
+
* @param {IData} data
|
|
5218
|
+
* @param {IData} [option={}]
|
|
5219
|
+
* @return {*} {Promise<IData[]>}
|
|
5220
|
+
* @memberof FileUtil
|
|
5221
|
+
*/
|
|
5222
|
+
async chooseFileAndUpload(context, params, data, option = {}) {
|
|
5223
|
+
const { accept, multiple } = option;
|
|
5224
|
+
const urls = ibiz.util.file.calcFileUpDownUrl(context, params, data);
|
|
5225
|
+
const files = await ibiz.util.file.chooseFile(accept, multiple);
|
|
5226
|
+
const promises = [];
|
|
5227
|
+
const headers = { Authorization: "Bearer ".concat(getCookie(CoreConst.TOKEN)) };
|
|
5228
|
+
for (let i = 0; i < files.length; i++) {
|
|
5229
|
+
const promise = await ibiz.util.file.fileUpload(
|
|
5230
|
+
urls.uploadUrl,
|
|
5231
|
+
files[i],
|
|
5232
|
+
headers
|
|
5233
|
+
);
|
|
5234
|
+
promises.push(promise);
|
|
5235
|
+
}
|
|
5236
|
+
return Promise.all(promises);
|
|
5237
|
+
}
|
|
5238
|
+
/**
|
|
5239
|
+
* 选择文件
|
|
5240
|
+
*
|
|
5241
|
+
* @param {string} [accept='']
|
|
5242
|
+
* @param {boolean} [multiple=false]
|
|
5243
|
+
* @return {*} {Promise<FileList>}
|
|
5244
|
+
* @memberof FileUtil
|
|
5245
|
+
*/
|
|
5246
|
+
chooseFile(accept = "", multiple = false) {
|
|
5247
|
+
return new Promise((resolve) => {
|
|
5248
|
+
const inputElement = document.createElement("input");
|
|
5249
|
+
inputElement.type = "file";
|
|
5250
|
+
inputElement.accept = accept;
|
|
5251
|
+
inputElement.multiple = multiple;
|
|
5252
|
+
inputElement.webkitdirectory = false;
|
|
5253
|
+
inputElement.addEventListener("change", (e) => {
|
|
5254
|
+
resolve(e.target.files);
|
|
5255
|
+
});
|
|
5256
|
+
document.body.appendChild(inputElement);
|
|
5257
|
+
inputElement.click();
|
|
5258
|
+
document.body.removeChild(inputElement);
|
|
5259
|
+
});
|
|
5260
|
+
}
|
|
5210
5261
|
};
|
|
5211
5262
|
|
|
5212
5263
|
// src/utils/short-cut/short-cut-util.ts
|
|
@@ -11947,11 +11998,11 @@ var AuthorityService = class {
|
|
|
11947
11998
|
};
|
|
11948
11999
|
|
|
11949
12000
|
// src/service/service/auth/v7-auth.service.ts
|
|
11950
|
-
import { CoreConst } from "@ibiz-template/core";
|
|
11951
|
-
import { clearCookie, getCookie, setCookie } from "qx-util";
|
|
12001
|
+
import { CoreConst as CoreConst2 } from "@ibiz-template/core";
|
|
12002
|
+
import { clearCookie, getCookie as getCookie2, setCookie } from "qx-util";
|
|
11952
12003
|
var V7AuthService = class {
|
|
11953
12004
|
get isAnonymous() {
|
|
11954
|
-
return
|
|
12005
|
+
return getCookie2(CoreConst2.IS_ANONYMOUS) === "1";
|
|
11955
12006
|
}
|
|
11956
12007
|
/**
|
|
11957
12008
|
* 使用匿名账号登录
|
|
@@ -11968,16 +12019,16 @@ var V7AuthService = class {
|
|
|
11968
12019
|
}
|
|
11969
12020
|
const result = await this.login(anonymousUser, anonymousPwd);
|
|
11970
12021
|
if (result) {
|
|
11971
|
-
setCookie(
|
|
11972
|
-
const token =
|
|
11973
|
-
const expirein =
|
|
11974
|
-
const remember =
|
|
11975
|
-
const refreshToken =
|
|
11976
|
-
setCookie(
|
|
11977
|
-
setCookie(
|
|
11978
|
-
setCookie(
|
|
12022
|
+
setCookie(CoreConst2.IS_ANONYMOUS, "1", 0, true);
|
|
12023
|
+
const token = getCookie2(CoreConst2.TOKEN);
|
|
12024
|
+
const expirein = getCookie2(CoreConst2.TOKEN_EXPIRES);
|
|
12025
|
+
const remember = getCookie2(CoreConst2.TOKEN_REMEMBER);
|
|
12026
|
+
const refreshToken = getCookie2(CoreConst2.REFRESH_TOKEN);
|
|
12027
|
+
setCookie(CoreConst2.TOKEN, token, 0, true);
|
|
12028
|
+
setCookie(CoreConst2.TOKEN_EXPIRES, expirein, 0, true);
|
|
12029
|
+
setCookie(CoreConst2.TOKEN_REMEMBER, remember, 0, true);
|
|
11979
12030
|
if (refreshToken) {
|
|
11980
|
-
setCookie(
|
|
12031
|
+
setCookie(CoreConst2.REFRESH_TOKEN, refreshToken, 0, true);
|
|
11981
12032
|
}
|
|
11982
12033
|
}
|
|
11983
12034
|
return result;
|
|
@@ -12010,20 +12061,20 @@ var V7AuthService = class {
|
|
|
12010
12061
|
if (data && data.token) {
|
|
12011
12062
|
const cacheDay = remember ? 30 : 0;
|
|
12012
12063
|
if (remember) {
|
|
12013
|
-
setCookie(
|
|
12064
|
+
setCookie(CoreConst2.TOKEN_REMEMBER, "1", cacheDay, true);
|
|
12014
12065
|
}
|
|
12015
|
-
setCookie(
|
|
12066
|
+
setCookie(CoreConst2.TOKEN, data.token, cacheDay, true);
|
|
12016
12067
|
const expiredDate = (/* @__PURE__ */ new Date()).getTime() + (data.expirein || 7199) * 1e3;
|
|
12017
|
-
setCookie(
|
|
12068
|
+
setCookie(CoreConst2.TOKEN_EXPIRES, "".concat(expiredDate), cacheDay, true);
|
|
12018
12069
|
if (data.refresh_token) {
|
|
12019
12070
|
setCookie(
|
|
12020
|
-
|
|
12071
|
+
CoreConst2.REFRESH_TOKEN,
|
|
12021
12072
|
data.refresh_token,
|
|
12022
12073
|
cacheDay,
|
|
12023
12074
|
true
|
|
12024
12075
|
);
|
|
12025
12076
|
}
|
|
12026
|
-
clearCookie(
|
|
12077
|
+
clearCookie(CoreConst2.IS_ANONYMOUS);
|
|
12027
12078
|
}
|
|
12028
12079
|
return true;
|
|
12029
12080
|
} catch (err) {
|
|
@@ -12085,15 +12136,15 @@ var V7AuthService = class {
|
|
|
12085
12136
|
if (this.isAnonymous) {
|
|
12086
12137
|
return;
|
|
12087
12138
|
}
|
|
12088
|
-
const token =
|
|
12089
|
-
const expirein =
|
|
12139
|
+
const token = getCookie2(CoreConst2.TOKEN);
|
|
12140
|
+
const expirein = getCookie2(CoreConst2.TOKEN_EXPIRES);
|
|
12090
12141
|
if (token && expirein) {
|
|
12091
12142
|
let wait = Number(expirein) - (/* @__PURE__ */ new Date()).getTime();
|
|
12092
12143
|
const early = 5 * 60 * 1e3;
|
|
12093
12144
|
wait = wait > early ? wait - early : 0;
|
|
12094
12145
|
setTimeout(async () => {
|
|
12095
|
-
const remember =
|
|
12096
|
-
const refreshToken =
|
|
12146
|
+
const remember = getCookie2(CoreConst2.TOKEN_REMEMBER);
|
|
12147
|
+
const refreshToken = getCookie2(CoreConst2.REFRESH_TOKEN);
|
|
12097
12148
|
const cacheDay = remember ? 30 : 0;
|
|
12098
12149
|
let res;
|
|
12099
12150
|
if (refreshToken != null && refreshToken !== "") {
|
|
@@ -12103,14 +12154,14 @@ var V7AuthService = class {
|
|
|
12103
12154
|
}
|
|
12104
12155
|
if (res.ok) {
|
|
12105
12156
|
if (remember) {
|
|
12106
|
-
setCookie(
|
|
12157
|
+
setCookie(CoreConst2.TOKEN_REMEMBER, "1", cacheDay, true);
|
|
12107
12158
|
}
|
|
12108
|
-
setCookie(
|
|
12159
|
+
setCookie(CoreConst2.TOKEN, res.data.token, cacheDay, true);
|
|
12109
12160
|
const expiredDate = (/* @__PURE__ */ new Date()).getTime() + (res.data.expirein || 7199) * 1e3;
|
|
12110
|
-
setCookie(
|
|
12161
|
+
setCookie(CoreConst2.TOKEN_EXPIRES, "".concat(expiredDate), cacheDay, true);
|
|
12111
12162
|
if (res.data.refresh_token) {
|
|
12112
12163
|
setCookie(
|
|
12113
|
-
|
|
12164
|
+
CoreConst2.REFRESH_TOKEN,
|
|
12114
12165
|
res.data.refresh_token,
|
|
12115
12166
|
cacheDay,
|
|
12116
12167
|
true
|
|
@@ -12133,27 +12184,27 @@ var V7AuthService = class {
|
|
|
12133
12184
|
* @return {*} {Promise<void>}
|
|
12134
12185
|
*/
|
|
12135
12186
|
async refreshToken() {
|
|
12136
|
-
const remember =
|
|
12137
|
-
const refreshToken =
|
|
12187
|
+
const remember = getCookie2(CoreConst2.TOKEN_REMEMBER);
|
|
12188
|
+
const refreshToken = getCookie2(CoreConst2.REFRESH_TOKEN);
|
|
12138
12189
|
if (refreshToken != null && refreshToken !== "") {
|
|
12139
12190
|
const res = await ibiz.net.get("/uaa/refresh_token/".concat(refreshToken));
|
|
12140
12191
|
if (res.ok) {
|
|
12141
12192
|
const cacheDay = remember ? 30 : 0;
|
|
12142
12193
|
if (remember) {
|
|
12143
|
-
setCookie(
|
|
12194
|
+
setCookie(CoreConst2.TOKEN_REMEMBER, "1", cacheDay, true);
|
|
12144
12195
|
}
|
|
12145
|
-
setCookie(
|
|
12196
|
+
setCookie(CoreConst2.TOKEN, res.data.token, cacheDay, true);
|
|
12146
12197
|
const expiredDate = (/* @__PURE__ */ new Date()).getTime() + (res.data.expirein || 7199) * 1e3;
|
|
12147
|
-
setCookie(
|
|
12198
|
+
setCookie(CoreConst2.TOKEN_EXPIRES, "".concat(expiredDate), cacheDay, true);
|
|
12148
12199
|
if (res.data.refresh_token) {
|
|
12149
12200
|
setCookie(
|
|
12150
|
-
|
|
12201
|
+
CoreConst2.REFRESH_TOKEN,
|
|
12151
12202
|
res.data.refresh_token,
|
|
12152
12203
|
cacheDay,
|
|
12153
12204
|
true
|
|
12154
12205
|
);
|
|
12155
12206
|
}
|
|
12156
|
-
clearCookie(
|
|
12207
|
+
clearCookie(CoreConst2.IS_ANONYMOUS);
|
|
12157
12208
|
}
|
|
12158
12209
|
}
|
|
12159
12210
|
}
|
|
@@ -12165,8 +12216,8 @@ var V7AuthService = class {
|
|
|
12165
12216
|
* @return {*} {(IAuthInfo | undefined)}
|
|
12166
12217
|
*/
|
|
12167
12218
|
getAuthInfo() {
|
|
12168
|
-
const token =
|
|
12169
|
-
const isAnonymous = !!
|
|
12219
|
+
const token = getCookie2(CoreConst2.TOKEN);
|
|
12220
|
+
const isAnonymous = !!getCookie2(CoreConst2.IS_ANONYMOUS);
|
|
12170
12221
|
return token ? {
|
|
12171
12222
|
token,
|
|
12172
12223
|
isAnonymous
|
|
@@ -12193,11 +12244,11 @@ var V7AuthService = class {
|
|
|
12193
12244
|
* @protected
|
|
12194
12245
|
*/
|
|
12195
12246
|
clearAuthData() {
|
|
12196
|
-
clearCookie(
|
|
12197
|
-
clearCookie(
|
|
12198
|
-
clearCookie(
|
|
12199
|
-
clearCookie(
|
|
12200
|
-
clearCookie(
|
|
12247
|
+
clearCookie(CoreConst2.TOKEN);
|
|
12248
|
+
clearCookie(CoreConst2.TOKEN_EXPIRES);
|
|
12249
|
+
clearCookie(CoreConst2.TOKEN_REMEMBER);
|
|
12250
|
+
clearCookie(CoreConst2.REFRESH_TOKEN);
|
|
12251
|
+
clearCookie(CoreConst2.IS_ANONYMOUS);
|
|
12201
12252
|
ibiz.appData = void 0;
|
|
12202
12253
|
ibiz.orgData = void 0;
|
|
12203
12254
|
}
|
|
@@ -19867,9 +19918,11 @@ var BaseSeriesGenerator = class {
|
|
|
19867
19918
|
prepareChartData(groupData, deData, catalog, group) {
|
|
19868
19919
|
var _a;
|
|
19869
19920
|
if (this.groupField) {
|
|
19921
|
+
deData["".concat(this.groupField, "_value")] = deData[this.groupField];
|
|
19870
19922
|
Object.assign(deData, { [this.groupField]: group });
|
|
19871
19923
|
}
|
|
19872
19924
|
if (this.catalogField) {
|
|
19925
|
+
deData["".concat(this.catalogField, "_value")] = deData[this.catalogField];
|
|
19873
19926
|
Object.assign(deData, { [this.catalogField]: catalog });
|
|
19874
19927
|
}
|
|
19875
19928
|
const tempChartData = new ChartData(deData, this.model, catalog, group);
|
|
@@ -35349,10 +35402,11 @@ var TreeController = class extends MDControlController {
|
|
|
35349
35402
|
var _a, _b;
|
|
35350
35403
|
const draggingNodeModel = this.getNodeModel(draggingNode._nodeId);
|
|
35351
35404
|
if (type === "inner") {
|
|
35405
|
+
const nodeModel = this.getNodeModel(dropNode._nodeId);
|
|
35352
35406
|
return !!this.findDropNodeRS(
|
|
35353
35407
|
dropNode._nodeId,
|
|
35354
35408
|
draggingNodeModel.appDataEntityId
|
|
35355
|
-
);
|
|
35409
|
+
) && !!(nodeModel == null ? void 0 : nodeModel.allowDrop);
|
|
35356
35410
|
}
|
|
35357
35411
|
if (((_a = draggingNode._parent) == null ? void 0 : _a._id) === ((_b = dropNode._parent) == null ? void 0 : _b._id)) {
|
|
35358
35412
|
const currentNodeModel = this.getNodeModel(dropNode._nodeId);
|
|
@@ -39176,9 +39230,6 @@ var GanttService = class extends TreeService {
|
|
|
39176
39230
|
|
|
39177
39231
|
// src/controller/control/gantt/gantt.controller.ts
|
|
39178
39232
|
var GanttController = class extends TreeGridExController {
|
|
39179
|
-
get _evt() {
|
|
39180
|
-
return this.evt;
|
|
39181
|
-
}
|
|
39182
39233
|
/**
|
|
39183
39234
|
* 初始化状态
|
|
39184
39235
|
*
|
|
@@ -39255,7 +39306,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39255
39306
|
if (item._nodeType === "DE") {
|
|
39256
39307
|
await this.onNodeDataActive(nodeParams);
|
|
39257
39308
|
}
|
|
39258
|
-
return this.
|
|
39309
|
+
return this.evt.emit("onActive", { ...nodeParams, nodeData: item });
|
|
39259
39310
|
}
|
|
39260
39311
|
/**
|
|
39261
39312
|
* 节点数据激活
|
|
@@ -39285,12 +39336,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39285
39336
|
});
|
|
39286
39337
|
const children = this.model.rootVisible ? nodes : nodes[0]._children;
|
|
39287
39338
|
if (children) {
|
|
39288
|
-
|
|
39289
|
-
if (state) {
|
|
39290
|
-
this._evt.emit("onDefaultExpand", {
|
|
39291
|
-
nodes: children
|
|
39292
|
-
});
|
|
39293
|
-
}
|
|
39339
|
+
await this.handleDefaultExpandNodes(children);
|
|
39294
39340
|
}
|
|
39295
39341
|
},
|
|
39296
39342
|
{
|
|
@@ -39326,34 +39372,30 @@ var GanttController = class extends TreeGridExController {
|
|
|
39326
39372
|
}
|
|
39327
39373
|
const targetNode = refreshParent ? currentNode._parent : currentNode;
|
|
39328
39374
|
const nodes = await this.loadNodes(targetNode);
|
|
39329
|
-
|
|
39330
|
-
|
|
39331
|
-
this._evt.emit("onDefaultExpand", {
|
|
39332
|
-
nodes
|
|
39333
|
-
});
|
|
39334
|
-
}
|
|
39335
|
-
this._evt.emit("onAfterRefreshParent", {
|
|
39375
|
+
await this.handleDefaultExpandNodes(nodes);
|
|
39376
|
+
this.evt.emit("onAfterRefreshParent", {
|
|
39336
39377
|
parentNode: targetNode,
|
|
39337
39378
|
children: nodes
|
|
39338
39379
|
});
|
|
39339
39380
|
}
|
|
39340
39381
|
/**
|
|
39341
|
-
*
|
|
39382
|
+
* 处理默认展开
|
|
39342
39383
|
*
|
|
39343
39384
|
* @param {ITreeNodeData[]} data 子节点数据
|
|
39344
39385
|
* @return {*} {Promise<void>}
|
|
39345
39386
|
*/
|
|
39346
39387
|
async handleDefaultExpandNodes(data) {
|
|
39347
|
-
let state = false;
|
|
39348
39388
|
for (let i = 0; i < data.length; i++) {
|
|
39349
39389
|
const nodeData = data[i];
|
|
39350
39390
|
if (this.state.expandedKeys.includes(nodeData._id)) {
|
|
39351
|
-
|
|
39352
|
-
const
|
|
39391
|
+
const key = nodeData.srfkey ? "srfkey" : "_id";
|
|
39392
|
+
const currentNode = this.state.items.find(
|
|
39393
|
+
(item) => item[key] === nodeData[key]
|
|
39394
|
+
);
|
|
39395
|
+
const nodes = await this.loadNodes(currentNode);
|
|
39353
39396
|
await this.handleDefaultExpandNodes(nodes);
|
|
39354
39397
|
}
|
|
39355
39398
|
}
|
|
39356
|
-
return state;
|
|
39357
39399
|
}
|
|
39358
39400
|
/**
|
|
39359
39401
|
* 打开编辑数据视图
|
|
@@ -39496,7 +39538,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39496
39538
|
nodeData._deData
|
|
39497
39539
|
);
|
|
39498
39540
|
} catch (error) {
|
|
39499
|
-
await this.
|
|
39541
|
+
await this.evt.emit("onSaveError", void 0);
|
|
39500
39542
|
this.actionNotification("".concat(isCreate ? "CREATE" : "UPDATE", "ERROR"), {
|
|
39501
39543
|
error,
|
|
39502
39544
|
data: rowState.data
|
|
@@ -39506,7 +39548,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39506
39548
|
rowState.data._deData = res.data;
|
|
39507
39549
|
rowState.modified = false;
|
|
39508
39550
|
this.gridStateNotify(rowState, "SAVE" /* SAVE */);
|
|
39509
|
-
await this.
|
|
39551
|
+
await this.evt.emit("onSaveSuccess", void 0);
|
|
39510
39552
|
}
|
|
39511
39553
|
/**
|
|
39512
39554
|
* 删除
|
|
@@ -39533,7 +39575,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39533
39575
|
return;
|
|
39534
39576
|
}
|
|
39535
39577
|
}
|
|
39536
|
-
await this.
|
|
39578
|
+
await this.evt.emit("onBeforeRemove", void 0);
|
|
39537
39579
|
await this.startLoading();
|
|
39538
39580
|
let needRefresh = false;
|
|
39539
39581
|
let refreshNode;
|
|
@@ -39578,7 +39620,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39578
39620
|
await this.refreshNodeChildren(refreshNode);
|
|
39579
39621
|
}
|
|
39580
39622
|
} catch (error) {
|
|
39581
|
-
await this.
|
|
39623
|
+
await this.evt.emit("onRemoveError", void 0);
|
|
39582
39624
|
this.actionNotification("REMOVEERROR", {
|
|
39583
39625
|
error,
|
|
39584
39626
|
data
|
|
@@ -39588,7 +39630,7 @@ var GanttController = class extends TreeGridExController {
|
|
|
39588
39630
|
await this.endLoading();
|
|
39589
39631
|
}
|
|
39590
39632
|
this.state.selectedData = [];
|
|
39591
|
-
await this.
|
|
39633
|
+
await this.evt.emit("onRemoveSuccess", void 0);
|
|
39592
39634
|
}
|
|
39593
39635
|
/**
|
|
39594
39636
|
* 后台删除结束后界面删除逻辑
|
|
@@ -39696,11 +39738,88 @@ var GanttController = class extends TreeGridExController {
|
|
|
39696
39738
|
if (editShowMode === "row") {
|
|
39697
39739
|
this.switchRowEdit(rowState, true);
|
|
39698
39740
|
}
|
|
39699
|
-
this.
|
|
39741
|
+
this.evt.emit("onNewRow", { row: parentRow });
|
|
39700
39742
|
this.actionNotification("GETDRAFTSUCCESS", { data: draftData });
|
|
39701
39743
|
}
|
|
39702
39744
|
}
|
|
39703
39745
|
}
|
|
39746
|
+
/**
|
|
39747
|
+
* 处理节点拖入事件
|
|
39748
|
+
*
|
|
39749
|
+
* @param {IGanttNodeData} draggingNode 拖动节点
|
|
39750
|
+
* @param {IGanttNodeData} dropNode 目标节点
|
|
39751
|
+
* @param {('inner' | 'prev' | 'next')} dropType 拖放类型
|
|
39752
|
+
* @return {*} {Promise<void>}
|
|
39753
|
+
* @memberof GanttController
|
|
39754
|
+
*/
|
|
39755
|
+
async onNodeDrop(draggingNode, dropNode, dropType) {
|
|
39756
|
+
var _a, _b;
|
|
39757
|
+
if (dropType === "inner" && !dropNode._leaf && dropNode._children === void 0) {
|
|
39758
|
+
await this.expandNodeByKey([dropNode._id]);
|
|
39759
|
+
}
|
|
39760
|
+
const modifiedNodeDatas = [];
|
|
39761
|
+
const draggingNodeModel = this.getNodeModel(draggingNode._nodeId);
|
|
39762
|
+
const dropInNode = dropType === "inner" ? dropNode : dropNode._parent;
|
|
39763
|
+
let orderNodeModel = this.getNodeModel(dropNode._nodeId);
|
|
39764
|
+
if (dropType === "inner" || ((_a = dropNode._parent) == null ? void 0 : _a._id) !== ((_b = draggingNode._parent) == null ? void 0 : _b._id)) {
|
|
39765
|
+
const dropNodeRs = this.findDropNodeRS(
|
|
39766
|
+
dropInNode._nodeId,
|
|
39767
|
+
draggingNodeModel.appDataEntityId
|
|
39768
|
+
);
|
|
39769
|
+
if (dropNodeRs) {
|
|
39770
|
+
draggingNode._deData[dropNodeRs.pickupDEFName] = dropInNode._value;
|
|
39771
|
+
modifiedNodeDatas.push(draggingNode);
|
|
39772
|
+
orderNodeModel = this.getNodeModel(dropNodeRs.childDETreeNodeId);
|
|
39773
|
+
}
|
|
39774
|
+
draggingNode._parent = dropInNode;
|
|
39775
|
+
draggingNode._nodeId = orderNodeModel.id;
|
|
39776
|
+
}
|
|
39777
|
+
const { sortAppDEFieldId, sortDir, allowOrder } = orderNodeModel;
|
|
39778
|
+
if (allowOrder === true) {
|
|
39779
|
+
if (!sortAppDEFieldId) {
|
|
39780
|
+
throw new RuntimeModelError72(
|
|
39781
|
+
orderNodeModel,
|
|
39782
|
+
ibiz.i18n.t("runtime.controller.control.tree.sortAttribute")
|
|
39783
|
+
);
|
|
39784
|
+
}
|
|
39785
|
+
const sortField = sortAppDEFieldId.toLowerCase();
|
|
39786
|
+
const isAsc = sortDir === "ASC";
|
|
39787
|
+
const changedArr = dropInNode._children;
|
|
39788
|
+
if (!isAsc) {
|
|
39789
|
+
changedArr.reverse();
|
|
39790
|
+
}
|
|
39791
|
+
const getNextSort = (num) => {
|
|
39792
|
+
return num + (100 - num % 100);
|
|
39793
|
+
};
|
|
39794
|
+
const getSort = (deData) => {
|
|
39795
|
+
return deData[sortField] || 0;
|
|
39796
|
+
};
|
|
39797
|
+
let lastSort;
|
|
39798
|
+
changedArr.forEach((item, index) => {
|
|
39799
|
+
const deData = item._deData;
|
|
39800
|
+
if (lastSort === void 0) {
|
|
39801
|
+
if (item === draggingNode) {
|
|
39802
|
+
if (index === 0) {
|
|
39803
|
+
lastSort = 100;
|
|
39804
|
+
} else {
|
|
39805
|
+
lastSort = getNextSort(getSort(changedArr[index - 1]._deData));
|
|
39806
|
+
}
|
|
39807
|
+
deData[sortField] = lastSort;
|
|
39808
|
+
if (modifiedNodeDatas.indexOf(item) === -1) {
|
|
39809
|
+
modifiedNodeDatas.push(item);
|
|
39810
|
+
}
|
|
39811
|
+
}
|
|
39812
|
+
} else {
|
|
39813
|
+
if (lastSort >= getSort(deData)) {
|
|
39814
|
+
deData[sortField] = getNextSort(lastSort);
|
|
39815
|
+
modifiedNodeDatas.push(item);
|
|
39816
|
+
}
|
|
39817
|
+
lastSort = getSort(deData);
|
|
39818
|
+
}
|
|
39819
|
+
});
|
|
39820
|
+
}
|
|
39821
|
+
await this.updateDeNodeData(modifiedNodeDatas);
|
|
39822
|
+
}
|
|
39704
39823
|
onDEDataChange(msg) {
|
|
39705
39824
|
}
|
|
39706
39825
|
};
|