centaline-data-driven-v3 0.1.45 → 0.1.46

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.
@@ -846,14 +846,13 @@ const Base = function (source, moreActionRouter, formLabelPlacement) {
846
846
  || this.controlType === Enum.ControlType.MultiLineLabel) {
847
847
  }
848
848
  else if (this.isList || this.isScreen) {
849
-
850
849
  if (this.controlType === Enum.ControlType.SearchListBox || this.controlType === Enum.ControlType.ComboBox || this.controlType === Enum.ControlType.MultiSelectWithSearch || this.controlType === Enum.ControlType.MultiSelectNoSearch
851
850
  || this.controlType === Enum.ControlType.PhoneNumberText) {
852
851
  if (this.multiple) {
853
852
  this.value.splice(0);
854
853
  this.labelValue.splice(0);
855
854
  if (this.defaultCode1) {
856
- var defaultCode1=JSON.parse(this.defaultCode1)
855
+ var defaultCode1 = JSON.parse(this.defaultCode1)
857
856
  defaultCode1.forEach((v) => {
858
857
  this.value.push(v.code);
859
858
  this.labelValue.push(v);
@@ -876,20 +875,23 @@ const Base = function (source, moreActionRouter, formLabelPlacement) {
876
875
  if (this.defaultValue) {
877
876
  this.value = this.defaultValue;
878
877
  }
879
-
880
878
  }
881
879
  else if (this.controlType === Enum.ControlType.CheckBox || this.controlType === Enum.ControlType.Switch) {
882
880
  if (this.defaultCode1 == '1') {
883
881
  this.value = true
884
882
  }
885
-
886
883
  }
887
884
  this.code1 = this.defaultCode1 || '';
888
885
  this.code2 = this.defaultCode2 || '';
889
886
  this.name1 = this.defaultName1 || '';
890
- if (this.controlType === Enum.ControlType.SearchListBox && this.defaultCode1 && this.defaultName1) {
887
+ if ((this.controlType === Enum.ControlType.SearchListBox || this.controlType === Enum.ControlType.ComboBox
888
+ ) && this.defaultCode1 && this.defaultName1) {
891
889
  this.options = [{ value: this.code1, label: this.name1 }]
892
890
  }
891
+ if ((this.controlType === Enum.ControlType.MultiSelectWithSearch || this.controlType === Enum.ControlType.MultiSelectNoSearch
892
+ ) && this.defaultCode1) {
893
+ this.options = [].concat(JSON.parse(this.code1))
894
+ }
893
895
  }
894
896
  else {
895
897
  if (this.controlType === Enum.ControlType.DateRange
@@ -129,12 +129,12 @@ function loadSearchTreeModel(source, searchModel) {
129
129
  return rtn;
130
130
  }
131
131
 
132
-
133
132
  function buildDeptTreeByField(flatList, opt = {}) {
134
133
  const {
135
134
  pathKey = 'path',
136
135
  separator = '.',
137
- sortKey = 'sort'
136
+ sortKey = 'sort',
137
+ lazyMode = false
138
138
  } = opt;
139
139
 
140
140
  const firstItem = flatList.length > 0 ? flatList[0] : null;
@@ -156,7 +156,7 @@ function buildDeptTreeByField(flatList, opt = {}) {
156
156
  const node = {
157
157
  ...item,
158
158
  children: [],
159
- isLeaf: true
159
+ isLeaf: !lazyMode, // 默认非懒加载模式下为叶子节点
160
160
  };
161
161
 
162
162
  pathMap.set(path, node);
@@ -175,7 +175,22 @@ function buildDeptTreeByField(flatList, opt = {}) {
175
175
 
176
176
  root.push(node);
177
177
  }
178
-
178
+ // 如果不是懒加载模式,需要递归判断所有节点是否为叶子节点
179
+ if (!lazyMode) {
180
+ const determineIsLeaf = (node) => {
181
+ if (node.children && node.children.length > 0) {
182
+ // 递归处理子节点
183
+ node.children.forEach(determineIsLeaf);
184
+ // 有子节点,不是叶子节点
185
+ node.isLeaf = false;
186
+ } else {
187
+ // 没有子节点,是叶子节点
188
+ node.isLeaf = true;
189
+ }
190
+ };
191
+
192
+ root.forEach(determineIsLeaf);
193
+ }
179
194
  const sortTree = (nodes) => {
180
195
  nodes.sort((a, b) => {
181
196
  const aVal = a[actualSortKey] || a[pathKey] || '';
@@ -195,49 +210,49 @@ function buildDeptTreeByField(flatList, opt = {}) {
195
210
  const hasAnyLeaf = root.some(n => !n.isLeaf);
196
211
  return { tree: root, hasAnyLeaf };
197
212
  }
198
- function getFirstNLevelKeys(nodes, targetLevel = 1) {
199
- const result = [];
200
-
201
- if (!nodes || nodes.length === 0 || targetLevel < 0) {
202
- return result;
203
- }
204
-
205
- const traverse = (nodes, currentLevel) => {
206
- if (currentLevel > targetLevel || !nodes) return;
207
-
208
- nodes.forEach(node => {
209
- if (node.code) {
210
- result.push(node.code);
211
- }
212
213
 
213
- // 如果还有下一层且没超过目标层级,继续遍历
214
- if (currentLevel < targetLevel && node.children && node.children.length > 0) {
215
- traverse(node.children, currentLevel + 1);
216
- }
217
- });
218
- };
219
214
 
220
- traverse(nodes, 0);
221
- return result;
215
+ // 获取前N层节点的 key
216
+ function getFirstNLevelKeys(treeData, level = 0) {
217
+ const keys = [];
218
+
219
+ function traverse(nodes, currentLevel) {
220
+ if (!nodes || nodes.length === 0 || currentLevel > level) return;
221
+
222
+ nodes.forEach(node => {
223
+ if (node.code) {
224
+ keys.push(node.code);
225
+ }
226
+
227
+ if (currentLevel < level && node.children && node.children.length > 0) {
228
+ traverse(node.children, currentLevel + 1);
229
+ }
230
+ });
231
+ }
232
+
233
+ traverse(treeData, 0);
234
+ return keys;
222
235
  }
223
-
224
- // 递归获取所有节点的key(用于搜索时全展开)
225
- function getAllNodeKeys(nodes, result = []) {
226
- if (!nodes || nodes.length === 0) {
227
- return result;
228
- }
229
-
236
+ // 获取树中所有节点的 key
237
+ function getAllNodeKeys(treeData) {
238
+ const keys = [];
239
+
240
+ function traverse(nodes) {
241
+ if (!nodes || nodes.length === 0) return;
242
+
230
243
  nodes.forEach(node => {
231
- if (node.code) {
232
- result.push(node.code);
233
- }
234
-
235
- if (node.children && node.children.length > 0) {
236
- getAllNodeKeys(node.children, result);
237
- }
244
+ if (node.code) {
245
+ keys.push(node.code);
246
+ }
247
+
248
+ if (node.children && node.children.length > 0) {
249
+ traverse(node.children);
250
+ }
238
251
  });
239
-
240
- return result;
252
+ }
253
+
254
+ traverse(treeData);
255
+ return keys;
241
256
  }
242
257
 
243
258
  // 新增:构建节点Map,便于快速查找
package/src/main.js CHANGED
@@ -22,7 +22,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
22
22
 
23
23
  app.use(centaline, {
24
24
  //baseUrl: "http://10.88.22.13:7080/ibs-api/",
25
- baseUrl:"http://10.88.22.57:28251/service-api/",
25
+ baseUrl:"http://10.88.22.13:7070/onecard-api/",
26
26
  //baseUrl: "https://kq-api.centaline.com.cn/onecard-api/",
27
27
  //baseUrl: "http://10.88.22.13:6060/onecard-api/",
28
28
  //baseUrl: "http://10.88.22.66/IBS.Mvc/api/",
@@ -66,8 +66,8 @@ app.use(centaline, {
66
66
  getRequestHeaders: function () {
67
67
  return {
68
68
 
69
- AuthorizationCode:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyaWQiOiIyNTEyMTUxNzQyMTg5QzI4MTgwRDkxRTk0MDhEOTA0QSIsImxvZ2luX3VzZXJfa2V5IjoiN2MzYzNjNjAtNWVjMy00MzdkLWExMDYtOWYxZTMwYjU0Mjg2In0.daG9mS98Gg8KmHSUjYHktMcO2Jk7SVtCcqm2sRB0I8Y2N0TuonIrVUDcHdNdDiuD3v6qO_f010tQWlBsAQ1dqg',
70
- authobject: '{"currentEstate":{},"platform":1,"osVersion":"","clientVersion":"","machineCode":"f43f90f1caf5e3960a12e17aebd80b67","token":"","random":"tBBZub","time":1767510778671,"sign":""}',
69
+ //AuthorizationCode:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyaWQiOiIyNTEyMTUxNzQyMTg5QzI4MTgwRDkxRTk0MDhEOTA0QSIsImxvZ2luX3VzZXJfa2V5IjoiN2MzYzNjNjAtNWVjMy00MzdkLWExMDYtOWYxZTMwYjU0Mjg2In0.daG9mS98Gg8KmHSUjYHktMcO2Jk7SVtCcqm2sRB0I8Y2N0TuonIrVUDcHdNdDiuD3v6qO_f010tQWlBsAQ1dqg',
70
+ authobject: '{token:"wufw-2008030035520409600",platform:"WEB"}',
71
71
  //authobject: '{EmpID:"Token_946d56e1-7972-4382-9d10-4a72496aab39",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_946d56e1-7972-4382-9d10-4a72496aab39",Platform:"WEB"}',
72
72
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
73
73
  //authObject: '{token:"jiangzf-1958445358178844672",platform:"WEB"}',
@@ -77,7 +77,7 @@ const request = {
77
77
  if (data.rtnCode === Enum.ReturnCode.Successful) {
78
78
  if (data.rtnMsg && common.getDataDrivenOpts().showRequestSuccessMessage) {
79
79
  if (data.msgAlertStyle && data.msgAlertStyle == Enum.MessageAlertStyle.Dialog) {
80
- common.message(data.rtnMsg, 'error', '', 0, true)
80
+ common.message(data.rtnMsg, 'success', '', 0, true)
81
81
  }
82
82
  else {
83
83
  common.message(data.rtnMsg, 'success')