centaline-data-driven-v3 0.0.93 → 0.0.94

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,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -11,7 +11,7 @@
11
11
  <span v-html="item.name" style="line-height: 16px;"></span>
12
12
  <el-icon :size="18" v-if="item.toolTip" style="margin-left: 5px;">
13
13
  <el-tooltip raw-content :content="item.toolTip" placement="top" effect="light">
14
- <WarningFilled />
14
+ <InfoFilled />
15
15
  </el-tooltip>
16
16
  </el-icon>
17
17
  </el-checkbox>
@@ -3,7 +3,6 @@ import LibFunction from './LibFunction';
3
3
  import Enum from '../../utils/Enum';
4
4
  import common from '../../utils/common';
5
5
  import request from '../../utils/request';
6
- import formData from '../../utils/formData';
7
6
 
8
7
  function loadSearchScreenApi(action, callBack, screenPara, prevParam, failCallBack) {
9
8
  if (action) {
@@ -28,7 +27,398 @@ function loadSearchScreenApi(action, callBack, screenPara, prevParam, failCallBa
28
27
  }
29
28
  function loadSearchScreenModel(source, prevParam) {
30
29
  let rtn = {
31
- formData:formData,
30
+ formData:{
31
+ form: null,
32
+ formTable: null,
33
+ excuteData: null,//fields
34
+ fieldsDic: null,//fieldsDic
35
+ source:null,
36
+ _excuteListData: undefined,
37
+ enableRelationFields(FlagRelation) {
38
+ this.form.enableRelationFields = FlagRelation
39
+ },
40
+ //获取code1
41
+ getCode1ByField1(id) {
42
+ var rtn1 = this.fieldsDic[id];
43
+ if (rtn1) {
44
+ return rtn1.code1;
45
+ }
46
+ },
47
+
48
+ //获取code2
49
+ getCode2ByField1(id) {
50
+ var rtn1 = this.fieldsDic[id];
51
+ if (rtn1) {
52
+ return rtn1.code2;
53
+ }
54
+ },
55
+ setActionRouter(id, attrKey, attrValue) {
56
+ var router = this.form.actionRouters.find((v1) => {
57
+ return v1.key === id;
58
+ });
59
+ if (router) {
60
+ router[attrKey] = attrValue;
61
+ }
62
+ },
63
+ //获取Field的属性attrKey的值
64
+ getValueByFieldName(id, attrKey) {
65
+ attrKey = common.initialsToLowerCase(attrKey);
66
+ var rtn1 = this.fieldsDic[id];
67
+ if (rtn1) {
68
+ return rtn1[attrKey];
69
+ }
70
+ },
71
+ getValueByFieldNameFromParent(id, attrKey) {
72
+ if (this.form && this.form.parentModelForm) {
73
+ return this.form.parentModelForm.getValueByFieldName(id, attrKey);
74
+ }
75
+ return null;
76
+ },
77
+ //设置Field的属性attrKey的值
78
+ setValueByFieldName(id, attrKey, attrValue) {
79
+ attrKey = common.initialsToLowerCase(attrKey);
80
+ var rtn1 = this.fieldsDic[id];
81
+ if (rtn1) {
82
+ if (attrKey == 'code1' && rtn1.controlType === Enum.ControlType.NumericTextBox
83
+ && attrValue != undefined && attrValue != null && attrValue != '') {
84
+ if (rtn1.decimals1 != undefined && rtn1.decimals1 != null && rtn1.decimals1 > -1) {
85
+ attrValue = Number(attrValue).toFixed(rtn1.decimals1)
86
+ }
87
+ }
88
+ else if (attrKey == 'code1' && (rtn1.controlType === Enum.ControlType.File
89
+ || rtn1.controlType === Enum.ControlType.SliceUpload || rtn1.controlType === Enum.ControlType.PhotoSelect)
90
+ && attrValue != undefined && attrValue != null && attrValue != '') {
91
+ rtn1.jsSetFile(attrValue, rtn1);
92
+ }
93
+ rtn1[attrKey] = attrValue;
94
+ if (rtn1.controlType === Enum.ControlType.Tags) {
95
+ rtn1["value"] = JSON.parse(attrValue);
96
+ }
97
+ if (rtn1.controlType === Enum.ControlType.SearchListBox
98
+ || rtn1.controlType === Enum.ControlType.ComboBox
99
+ || rtn1.controlType === Enum.ControlType.MultiSelectWithSearch
100
+ || rtn1.controlType === Enum.ControlType.MultiSelectNoSearch
101
+ ) {
102
+ if (rtn1["options"].length == 0) {
103
+ rtn1["options"] = [{ value: '', label: '' }];
104
+ }
105
+ if (attrKey == 'code1') {
106
+ rtn1["value"] = attrValue;
107
+ rtn1["options"][0]["value"] = attrValue
108
+ }
109
+ if (attrKey == 'name1') {
110
+ rtn1["options"][0]["label"] = attrValue
111
+ }
112
+ if (rtn1.itemKey) rtn1.itemKey = Math.random()
113
+ }
114
+ if (rtn1.is == 'ct-button') {
115
+ if (common.flagApp() && this.form.$vue.loaded) {
116
+ this.form.$vue.loaded(this.form)
117
+ }
118
+ }
119
+ this.source.hiddenHandle(rtn1, this.form);
120
+ if(this.source.requiredHandle){
121
+ this.source.requiredHandle(rtn1, this.form);
122
+ }
123
+ }
124
+ },
125
+ setValueByFieldNameFromParent(id, attrKey, attrValue) {
126
+ if (this.form && this.form.parentModelForm) {
127
+ return this.form.parentModelForm.setValueByFieldName(id, attrKey, attrValue);
128
+ }
129
+ return null;
130
+ },
131
+ //设置Field的v1、v2的值
132
+ setV1AndV2ByField1(id, code1, code2) {
133
+ var rtn1 = this.fieldsDic[id];
134
+ if (rtn1) {
135
+ if (typeof rtn1.code1 !== 'undefined') {
136
+ rtn1.code1 = code1;
137
+ this.source.hiddenHandle(rtn1);//隐藏关联的
138
+ }
139
+ if (typeof rtn1.code2 !== 'undefined') {
140
+ rtn1.code2 = code2;
141
+ }
142
+ }
143
+ },
144
+ clearMedia(id) {
145
+ var rtn1 = this.fieldsDic[id];
146
+ for (let i = 0; i < rtn1.fileSourceList.length; i++) {
147
+ rtn1.fileSourceList[i].flagDeleted = true;
148
+ }
149
+ rtn1.fileList = [];
150
+ },
151
+ setTabsSelect(id) {
152
+ if (this.form && this.form.$vue) {
153
+ var f = this.fieldsDic[id];
154
+ if (this.form.isHorizontalLayout) {
155
+ this.form.$vue.activeName = f.collapseName.toString() === '-1' ? this.form.$vue.activeName : f.collapseName.toString();
156
+ }
157
+ }
158
+ },
159
+ //路由提交
160
+ submit(fieldName1) {
161
+ if (this.form && this.form.$vue) {
162
+ this.form.$vue.fieldClickHandler({ fieldName1: fieldName1 });
163
+ }
164
+ },
165
+
166
+ //获取列表数据
167
+ get excuteListData() {
168
+ if (this._excuteListData) {
169
+ return this._excuteListData;
170
+ }
171
+ else {
172
+ if (this.excuteData !== null) {
173
+ this._excuteListData = this.excuteData.filter((v) => {
174
+ return typeof v.is !== undefined && (v.is === 'ct-formlist' || v.is === 'ct-repeat');
175
+ });
176
+ }
177
+ }
178
+ return this._excuteListData;
179
+ },
180
+ setExcuteListData(fields) {
181
+ this._excuteListData = null;
182
+ if (fields !== null) {
183
+ this.excuteData = fields;
184
+ this._excuteListData = fields.filter((v) => {
185
+ return typeof v.is !== undefined && (v.is === 'ct-formlist' || v.is === 'ct-repeat');
186
+ });
187
+ }
188
+ },
189
+ //获取列表的Field
190
+ getListField(tableName, rowNum, fiedlId) {
191
+ let listData = this.excuteListData.find((v) => {
192
+ return v.name === tableName;
193
+ });
194
+ if (listData) {
195
+ let field = null;
196
+ //正在编辑的Field
197
+ if (rowNum === null && (fiedlId === null || listData.currentEventField.fieldName1 === fiedlId)) {
198
+ field = listData.currentEventField;
199
+ }
200
+ //正在编辑的行
201
+ else if (rowNum === null && listData.currentRowIndex === 0) {
202
+ let fields = listData.currentRow.data;
203
+ field = fields[fiedlId];
204
+ }
205
+ //源数据
206
+ else {
207
+ if (rowNum === null && listData.currentRowIndex) {
208
+ rowNum = listData.currentRowIndex;
209
+ }
210
+
211
+ if (rowNum === 0 || (rowNum && fiedlId)) {
212
+ try {
213
+ let fields = listData.rows[rowNum].field;
214
+ field = fields.find((v) => {
215
+ return v.fieldName1 === fiedlId;
216
+ });
217
+ } catch (e) {
218
+ if (listData.rows.length <= rowNum) {
219
+ common.message('获取列表行索引超出界限', 'error')
220
+ }
221
+ }
222
+ }
223
+ }
224
+
225
+ return { listData: listData, field: field };
226
+ }
227
+ },
228
+ //获取列表的行数(注意 这里包括列头)
229
+ getListCount(tableName) {
230
+ tableName = tableName ? tableName : this.form.scripts.$fd;
231
+ let data = this.getListField(tableName, null, null);
232
+ if (data) {
233
+ return data.listData.rows.length;
234
+ }
235
+ },
236
+ //获取表格某行某列的值
237
+ getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
238
+ tableName = tableName ? tableName : this.form.scripts.$fd;
239
+ let data = this.getListField(tableName, rowNum, fiedlId);
240
+
241
+ attrName = common.initialsToLowerCase(attrName);
242
+ attrName = attrName ? attrName : 'code1';
243
+
244
+ if (!fiedlId) {
245
+ fiedlId = data.listData.currentEventField.fieldName1;
246
+ }
247
+ if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.fieldName1) {
248
+ data.field = data.listData.currentEventField;
249
+ }
250
+ rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
251
+
252
+ //若该行正在编辑,则取编辑状态的。
253
+ if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
254
+ && data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
255
+ return data.listData.currentRow.data[fiedlId][attrName];
256
+ }
257
+ else if (data && data.field) {
258
+ if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
259
+ return defaultValue;
260
+ }
261
+ return data.field[attrName];
262
+ }
263
+ },
264
+ //设置表格某行某列的值
265
+ setListFieldValue(value, tableName, rowNum, fiedlId, attrName, flagTemplate) {
266
+ value = value == undefined ? "" : value.toString();
267
+ tableName = tableName ? tableName : this.form.scripts.$fd;
268
+ let data = this.getListField(tableName, rowNum, fiedlId);
269
+
270
+ attrName = common.initialsToLowerCase(attrName);
271
+ attrName = attrName ? attrName : 'code1';
272
+
273
+ if (!fiedlId) {
274
+ fiedlId = data.listData.currentEventField.id;
275
+ }
276
+
277
+ rowNum = rowNum ? rowNum : data.listData.currentRowIndex;
278
+
279
+ if (data) {
280
+ //正在编辑的行
281
+ if (data.listData.currentRow.data && data.listData.currentRow.data[fiedlId] && rowNum > -1
282
+ && data.listData.currentRow.data.$sourceIndex === data.listData.source.rows[rowNum].$sourceIndex) {
283
+ let currentField = data.listData.currentRow.data[fiedlId];
284
+ currentField[attrName] = value;
285
+ //校验自己
286
+ if (currentField.validExcute) {
287
+ currentField.validExcute();
288
+ }
289
+ if (data.field) {
290
+ data.field[attrName] = value;
291
+ }
292
+ }
293
+ else if (data.field) {
294
+ if (data.field) {
295
+ data.field[attrName] = value;
296
+ }
297
+ if (data.field.source) {
298
+ data.field.source[attrName] = value;
299
+ }
300
+ if (flagTemplate) {
301
+ data.field[attrName] = value;
302
+ }
303
+ if (data.listData.flagTemplate && data.listData.$vue) {
304
+ data.listData.$vue.itemKey = Math.random()
305
+ }
306
+ }
307
+
308
+ //如果有汇总列,触发重新计算汇总
309
+ if (data.listData.showSummary) {
310
+ data.listData.tableData.push({});
311
+ data.listData.tableData.pop();
312
+ }
313
+
314
+ return true;
315
+ }
316
+ return false;
317
+ },
318
+ //设置表格选择路由
319
+ setListSelectRouter(tableId, attrKey, attrValue) {
320
+ let listData = this.excuteListData.find((v) => {
321
+ return v.fieldName1 === tableId;
322
+ });
323
+ if (listData) {
324
+ var router = listData.selectRouter;
325
+ if (router) {
326
+ router[attrKey] = attrValue;
327
+ }
328
+ }
329
+ },
330
+ //设置表格属性值
331
+ setListAttr(tableId, attrName, attrValue) {
332
+ let listData = this.excuteListData.find((v) => {
333
+ return v.fieldName1 === tableId;
334
+ });
335
+ if (listData) {
336
+ listData[attrName] = attrValue
337
+ }
338
+ },
339
+ //新增表格数据
340
+ insertRow(tableId, rows) {
341
+ let listData = this.excuteListData.find((v) => {
342
+ return v.fieldName1 === tableId;
343
+ });
344
+ if (listData) {
345
+ listData.$vue.insertRow(rows);
346
+ }
347
+ },
348
+ //添加单选表格数据
349
+ insertSingleRow(tableId, row) {
350
+ let listData = this.excuteListData.find((v) => {
351
+ return v.fieldName1 === tableId;
352
+ });
353
+ if (listData) {
354
+ listData.$vue.insertSingleRow(row);
355
+ }
356
+ },
357
+ //新增或替换表格数据
358
+ insertOrUpdateRow(tableId, row) {
359
+ let listData = this.excuteListData.find((v) => {
360
+ return v.fieldName1 === tableId;
361
+ });
362
+ if (listData) {
363
+ listData.$vue.insertOrUpdateRow(row);
364
+ }
365
+ },
366
+ //删除表格数据
367
+ deleteRow(tableId, row) {
368
+ let listData = this.excuteListData.find((v) => {
369
+ return v.id === tableId;
370
+ });
371
+ if (listData) {
372
+ listData.$vue.delRow(row);
373
+ }
374
+ },
375
+ //清空表格数据
376
+ clear(tableId) {
377
+ let listData = this.excuteListData.find((v) => {
378
+ return v.fieldName1 === tableId;
379
+ });
380
+ if (listData) {
381
+ listData.$vue.deleteAll();
382
+ }
383
+ },
384
+
385
+ //获取后台数据,并返回脚本。
386
+ execServerScript(action, object, successCallback) {
387
+ let formData = this;//作用域保存
388
+
389
+ //是否是行内触发的
390
+ let data = this.getListField(this.form.scripts.$fd, null, null);
391
+ object.editMode = data ? 1 : 0;
392
+
393
+ request.postHandler(common.globalUri(), { action: action, para: object }).then(
394
+ function (response) {
395
+ if (response.rtnCode === Enum.ReturnCode.Successful) {
396
+ var data = response.content;
397
+ if (response.clientActionType === Enum.ClientActionType.ExcuteScript && data) {
398
+ common.excute.call(formData.form.scripts, data);
399
+ }
400
+ else
401
+ if (response.clientActionType === Enum.ClientActionType.None && data && successCallback) {
402
+ //因为要传参,并直接执行方法,故successCallback回调里要使用formData的话,要加this
403
+ //若不能接受this,也可修改common.excute方法
404
+ //successCallback.call(formData.form.scripts, data);
405
+
406
+ //优化,不需要加this
407
+ common.excuteFun.call(formData.form.scripts, successCallback, data);
408
+ }
409
+ }
410
+ }
411
+ );
412
+ },
413
+ execRouter(routerKey) {
414
+ let field = { fieldName1: routerKey };
415
+ this.form.$vue.fieldClickHandler(field);
416
+ },
417
+ //消息提示 type主题:success/warning/info/error。 duration 显示时间, 毫秒。设为 0 则不会自动关闭。 showClose 是否显示关闭按钮。
418
+ message(message, type, center, duration, showClose, dangerouslyUseHTMLString) {
419
+ common.message(message, type, center, duration, showClose, dangerouslyUseHTMLString)
420
+ },
421
+ },
32
422
  get title() {
33
423
  return source.title;
34
424
  },
package/src/main.js CHANGED
@@ -30,7 +30,7 @@ app.use(centaline, {
30
30
  //baseUrl: "http://10.1.245.111:38028/",
31
31
 
32
32
  flagRouterSelf: true,
33
- flagApp: true,//是否app端
33
+ flagApp: false,//是否app端
34
34
  zindex: 999,
35
35
  showRequestSuccessMessage: true,
36
36
  showRequestErrorMessage: false,
@@ -68,7 +68,7 @@ app.use(centaline, {
68
68
  //authObject: '{token:"aplus eyJhbGciOiJIUzI1NiIsInppcCI6IkRFRiJ9.eNrEjjsOwjAQBe-ydVay1xvvOl3sJA2HiPIxElSIJBIIcXdAQEfPFK-YZt4Nlm2EChqtDafOYWqpRG6kxLoTxZhUTSRxHLUPH_DHfOmt5SDWt1gHScieHapNiol94q5pXYoNFJAvJ6isGHWmNMYVcBjWtyCr_iW2JZ93-fqPc8f18MwGIqFRCIO1GXmWGYd9npCZJ6N5JjYZ7g8AAAD__w.HgtNKtHWooj8c9Hy_vB8CfKq-qOeHMp0irnW0DfXtHo"}',
69
69
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
70
70
  //authObject: '{token:"1-bce18a8d-21f0-4022-a6ca-450de105cafc"}',
71
- authObject: '{EmpID:"Token_35daf643-69e6-4da4-addf-c6c9ffdf59ff",MachineCode:"7c4b2ffd-920a-462c-a586-37bbfb45c4fe",SSO_Token:"SSOToken_35daf643-69e6-4da4-addf-c6c9ffdf59ff",Platform:"IOS"}',
71
+ authObject: '{EmpID:"Token_f2b14d49-9708-4747-8e03-5c55c7c95aa7",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_f2b14d49-9708-4747-8e03-5c55c7c95aa7",Platform:"WEB"}',
72
72
  };
73
73
  },
74
74
  getToken() {
package/src/utils/Enum.js CHANGED
@@ -348,6 +348,11 @@ const Enum = {
348
348
  ///
349
349
  /// </summary>
350
350
  Data: 4,
351
+
352
+ /// <summary>
353
+ ///
354
+ /// </summary>
355
+ Url: 5,
351
356
  },
352
357
 
353
358
  /// <summary>