centaline-data-driven 1.3.13 → 1.3.16

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.
@@ -160,6 +160,12 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
160
160
  get saveButtonAction() {
161
161
  return source.saveButtonAction;
162
162
  },
163
+ get flagShowSaveLine() {
164
+ return source.flagShowSaveLine;
165
+ },
166
+ get flagHideSaveLine() {
167
+ return source.flagHideSaveLine;
168
+ },
163
169
  //获取新的初始化的方法
164
170
  _scripts: null,
165
171
  get scripts() {
@@ -207,6 +213,12 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
207
213
  return rtn1.source[attrKey];
208
214
  }
209
215
  },
216
+ getValueByFieldNameFromParent(id, attrKey) {
217
+ if(this.form && this.form.self && this.form.self.$parent){
218
+ return this.form.self.$parent.vmodel.content[0].on.getValueByFieldName(id, attrKey);
219
+ }
220
+ return null;
221
+ },
210
222
  //设置Field的属性attrKey的值
211
223
  setValueByFieldName(id, attrKey, attrValue) {
212
224
  attrKey = this.common.initialsToLowerCase(attrKey);
@@ -214,7 +226,6 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
214
226
  if (rtn1) {
215
227
  rtn1.source[attrKey] = attrValue;
216
228
  this.form.hatchHandle(id, attrKey, attrValue, rtn1);
217
- //this.form.hiddenHandle(rtn1);//隐藏关联的
218
229
 
219
230
  //用于处理源数据改动,强制更新视图数据 todo
220
231
  if (rtn1.self.$forceUpdate) {
@@ -222,6 +233,12 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
222
233
  }
223
234
  }
224
235
  },
236
+ setValueByFieldNameFromParent(id, attrKey, attrValue) {
237
+ if(this.form && this.form.self && this.form.self.$parent){
238
+ return this.form.self.$parent.vmodel.content[0].on.setValueByFieldName(id, attrKey, attrValue);
239
+ }
240
+ return null;
241
+ },
225
242
  //设置Field的v1、v2的值
226
243
  setV1AndV2ByField1(id, code1, code2) {
227
244
  var rtn1 = this.fieldsDic[id];
@@ -342,6 +359,12 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
342
359
  return data.field.source[attrName];
343
360
  }
344
361
  },
362
+ getListFieldValueFromParent(tableName, rowNum, fiedlId, attrName, defaultValue) {
363
+ if(this.form && this.form.self && this.form.self.$parent){
364
+ return this.form.self.$parent.vmodel.content[0].on.getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue);
365
+ }
366
+ return null;
367
+ },
345
368
  //设置表格某行某列的值
346
369
  setListFieldValue(value, tableName, rowNum, fiedlId, attrName) {
347
370
  value = value==undefined?"":value.toString();
@@ -475,6 +498,92 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
475
498
  });
476
499
  },
477
500
  },
501
+ getValueByFieldName(id, attrKey) {
502
+ attrKey = common.initialsToLowerCase(attrKey);
503
+ var rtn1 = this.fieldsDic[id];
504
+ if (rtn1) {
505
+ return rtn1.source[attrKey];
506
+ }
507
+ },
508
+ setValueByFieldName(id, attrKey, attrValue) {
509
+ attrKey = common.initialsToLowerCase(attrKey);
510
+ var rtn1 = this.fieldsDic[id];
511
+ if (rtn1) {
512
+ rtn1.source[attrKey] = attrValue;
513
+ this.self.hatchHandle(id, attrKey, attrValue, rtn1);
514
+
515
+ //用于处理源数据改动,强制更新视图数据 todo
516
+ if (rtn1.self.$forceUpdate) {
517
+ rtn1.self.$forceUpdate();
518
+ }
519
+ }
520
+ },
521
+ getListField(tableName, rowNum, fiedlId) {
522
+ let listData = this.fields.find((v) => {
523
+ return v.id === tableName;
524
+ });
525
+ if (listData) {
526
+ let field = null;
527
+ //正在编辑的Field
528
+ if (rowNum === null && (fiedlId === null || listData.currentEventField.id === fiedlId)) {
529
+ field = listData.currentEventField;
530
+ }
531
+ //正在编辑的行
532
+ else if (rowNum === null && listData.currentRowIndex === 0) {
533
+ let fields = listData.currentRow.data;
534
+ field = fields[fiedlId];
535
+ }
536
+ //源数据
537
+ else {
538
+ if (rowNum === null && listData.currentRowIndex) {
539
+ rowNum = listData.currentRowIndex;
540
+ }
541
+
542
+ if (rowNum === 0 || (rowNum && fiedlId)) {
543
+ try {
544
+ let fields = listData.rows[rowNum].field;
545
+ field = fields.find((v) => {
546
+ return v.id === fiedlId;
547
+ });
548
+ } catch (e) {
549
+ if (listData.rows.length <= rowNum) {
550
+ var checkMsg = "获取列表行索引超出界限";
551
+ this.message(checkMsg);
552
+ }
553
+ }
554
+ }
555
+ }
556
+
557
+ return { listData: listData, field: field };
558
+ }
559
+ },
560
+ getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue) {
561
+ tableName = tableName ? tableName : this.scripts.$fd;
562
+ let data = this.getListField(tableName, rowNum, fiedlId);
563
+
564
+ attrName = common.initialsToLowerCase(attrName);
565
+ attrName = attrName ? attrName : 'code1';
566
+
567
+ if (!fiedlId) {
568
+ fiedlId = data.listData.currentEventField.id;
569
+ }
570
+ if (fiedlId && rowNum === null && fiedlId === data.listData.currentEventField.id) {
571
+ data.field = data.listData.currentEventField;
572
+ }
573
+ rowNum = rowNum !== null ? rowNum : data.listData.currentRowIndex;
574
+
575
+ //若该行正在编辑,则取编辑状态的。
576
+ if (data && data.listData && data.listData.currentRow.data && data.listData.currentRow.data[fiedlId]
577
+ && data.listData.currentRow.data.$sourceIndex === rowNum && data.listData.currentRow.isSet) {
578
+ return data.listData.currentRow.data[fiedlId].source[attrName];
579
+ }
580
+ else if (data && data.field) {
581
+ if (typeof defaultValue !== 'undefined' && data.listData.rows[rowNum].deleted) {//若该行被删除时,则直接返回默认值
582
+ return defaultValue;
583
+ }
584
+ return data.field.source[attrName];
585
+ }
586
+ },
478
587
  getFormObj() {
479
588
  var rtnFormObj = {};
480
589
  rtn.fields.forEach((f) => {
@@ -529,8 +638,9 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
529
638
  case 'code1':
530
639
  rtn.validMrf(item);//验证必填关联组件
531
640
  rtn.hiddenHandle(item, true);
641
+ rtn.requiredHandle(item);
532
642
  break;
533
- //case 'lk':
643
+ case 'lk':
534
644
  case 'locked':
535
645
  if (item.self && item.self.resize) {
536
646
  item.self.resize();//重新计算多选框长度
@@ -309,6 +309,7 @@ const FormList = function (source, master) {
309
309
  },
310
310
  editRow(index, callback) {
311
311
  var self = this;
312
+ self.currentRowIndex=index;
312
313
  var dialogOption = {
313
314
  title: '修改',
314
315
  pane: common.getParentPane(self),
@@ -353,7 +354,16 @@ const FormList = function (source, master) {
353
354
  common.closeDialog(dialogOption.dialog);
354
355
  callback();
355
356
  }
356
- }
357
+ },
358
+ getValueByFieldName:function(id, attrKey){
359
+ return self.$self.parentModel.getValueByFieldName(id, attrKey);
360
+ },
361
+ setValueByFieldName:function(id, attrKey, attrValue){
362
+ return self.$self.parentModel.setValueByFieldName(id, attrKey, attrValue);
363
+ },
364
+ getListFieldValue:function(tableName, rowNum, fiedlId, attrName, defaultValue){
365
+ return self.$self.parentModel.getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue);
366
+ },
357
367
  }
358
368
  }]
359
369
  };
@@ -425,7 +435,16 @@ const FormList = function (source, master) {
425
435
  common.closeDialog(dialogOption.dialog);
426
436
  callback();
427
437
  }
428
- }
438
+ },
439
+ getValueByFieldName:function(id, attrKey){
440
+ return self.$self.parentModel.getValueByFieldName(id, attrKey);
441
+ },
442
+ setValueByFieldName:function(id, attrKey, attrValue){
443
+ return self.$self.parentModel.setValueByFieldName(id, attrKey, attrValue);
444
+ },
445
+ getListFieldValue:function(tableName, rowNum, fiedlId, attrName, defaultValue){
446
+ return self.$self.parentModel.getListFieldValue(tableName, rowNum, fiedlId, attrName, defaultValue);
447
+ },
429
448
  }
430
449
  }]
431
450
  };
@@ -1,95 +1,132 @@
1
+ <!--
2
+ * @Author: linchunmei 179466780@qq.com~
3
+ * @Date: 2022-06-21 11:29:34
4
+ * @LastEditors: linchunmei 179466780@qq.com
5
+ * @LastEditTime: 2022-06-28 15:45:15
6
+ * @FilePath: \js-sdk-v3\src\centaline\quickInputSos\src\quickInput.vue
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ -->
1
9
  <template>
2
10
  <div class="ct-quickInput">
3
-
4
- <el-popover ref="pop" placement="bottom-start" v-model="showDrop" trigger="click" @show="searchInputHandle">
5
- <div>
6
- <div>
7
- <el-input ref="searchInput" size="mini" suffix-icon="el-icon-search" v-model="searchText" @input="searchInputHandle"></el-input>
8
- </div>
9
- <ctSelectOptionVertical :model="model" @click="selectOption($event)"></ctSelectOptionVertical>
10
- </div>
11
- <i slot="reference" class="el-icon-more"></i>
12
- </el-popover>
11
+ <el-popover
12
+ ref="pop"
13
+ placement="bottom-start"
14
+ v-model="showDrop"
15
+ trigger="click"
16
+ @show="searchInputHandle"
17
+ class="more-dropdown"
18
+ >
19
+ <div>
20
+ <div>
21
+ <el-input
22
+ ref="searchInput"
23
+ size="mini"
24
+ suffix-icon="el-icon-search"
25
+ v-model="searchText"
26
+ @input="searchInputHandle"
27
+ ></el-input>
28
+ </div>
29
+ <ctSelectOptionVertical
30
+ :model="model"
31
+ @click="selectOption($event)"
32
+ ></ctSelectOptionVertical>
33
+ </div>
34
+ <!-- <i slot="reference" class="el-icon-more"></i> -->
35
+ <span slot="reference" style="font-family: Comic Sans MS; font-size: 14px"
36
+ ><div class="my-icon-more"></div
37
+ ></span>
38
+ </el-popover>
13
39
  </div>
14
40
  </template>
15
41
  <script>
16
-
17
- import selectOption from '../../selectOption/src/selectOption'
18
- import dynamicElement from '../../mixins/dynamicElement'
19
- import ctSelectOptionVertical from '../../selectOption/src/selectOptionVertical'
20
- export default {
21
- name: 'ctQuickInput',
22
- mixins: [dynamicElement],
23
- props: {
24
- pn: String,
25
- action: String
42
+ import selectOption from "../../selectOption/src/selectOption";
43
+ import dynamicElement from "../../mixins/dynamicElement";
44
+ import ctSelectOptionVertical from "../../selectOption/src/selectOptionVertical";
45
+ export default {
46
+ name: "ctQuickInput",
47
+ mixins: [dynamicElement],
48
+ props: {
49
+ pn: String,
50
+ action: String,
51
+ },
52
+ components: {
53
+ ctSelectOption: selectOption,
54
+ ctSelectOptionVertical: ctSelectOptionVertical,
55
+ },
56
+ created() {
57
+ let that = this;
58
+ if (typeof this.vmodel === "undefined") {
59
+ this.model = this.loaderObj.QuickInputSos({
60
+ code1: "",
61
+ name1: "",
62
+ paramName1: that.pn,
63
+ });
64
+ } else {
65
+ this.model = this.vmodel;
66
+ }
67
+ },
68
+ data() {
69
+ return {
70
+ options: [],
71
+ searchText: "",
72
+ showDrop: false,
73
+ };
74
+ },
75
+ methods: {
76
+ getOptions: function () {
77
+ var self = this;
78
+ this.model.getOptions(this.action, self.searchText);
26
79
  },
27
- components: {
28
- 'ctSelectOption': selectOption,
29
- 'ctSelectOptionVertical': ctSelectOptionVertical
80
+ searchInputHandle: function () {
81
+ var currentSeatch = this.searchText;
82
+ this.searchTickControl(currentSeatch);
30
83
  },
31
- created() {
32
- let that=this;
33
- if (typeof this.vmodel === 'undefined') {
34
- this.model = this.loaderObj.QuickInputSos(
35
- {
36
- code1:'',
37
- name1:'',
38
- paramName1:that.pn,
84
+ searchTickControl: function (search) {
85
+ var self = this;
86
+ setTimeout(function () {
87
+ if (search === self.searchText) {
88
+ self.getOptions(self.searchText);
39
89
  }
40
- );
41
- }
42
- else {
43
- this.model = this.vmodel;
44
- }
45
- },
46
- data() {
47
- return {
48
- options:[],
49
- searchText: "",
50
- showDrop: false,
51
-
52
- };
90
+ }, self.model.searchTick);
53
91
  },
54
- methods: {
55
-
56
- getOptions: function () {
57
- var self = this;
58
- this.model.getOptions(this.action, self.searchText);
59
-
60
- },
61
- searchInputHandle: function () {
62
- var currentSeatch = this.searchText;
63
- this.searchTickControl(currentSeatch);
64
- },
65
- searchTickControl: function (search) {
66
- var self = this;
67
- setTimeout(function () {
68
- if (search === self.searchText) {
69
- self.getOptions(self.searchText);
70
- }
71
- }, self.model.searchTick);
72
- },
73
- selectOption(value) {
74
- if (this.model.value === value) {
75
- this.$set(this, 'showDrop', false);
76
- return;
77
- }
78
- else {
79
- this.model.value = value;
80
- }
81
- this.$set(this, 'showDrop', false);
82
- this.$emit('click', value);
83
- },
92
+ selectOption(value) {
93
+ if (this.model.value === value) {
94
+ this.$set(this, "showDrop", false);
95
+ return;
96
+ } else {
97
+ this.model.value = value;
98
+ }
99
+ this.$set(this, "showDrop", false);
100
+ this.$emit("click", value);
84
101
  },
85
- mounted() {
86
-
87
- }
88
- }
102
+ },
103
+ mounted() {},
104
+ };
89
105
  </script>
90
106
  <style>
91
- .ct-quickInput .el-icon-more:hover {
92
- cursor: pointer;
93
- color: #409EFF;
94
- }
107
+ .ct-quickInput .el-icon-more:hover {
108
+ cursor: pointer;
109
+ color: #409eff;
110
+ }
111
+ .more-dropdown {
112
+ position: absolute;
113
+ width: 16px;
114
+ height: 20px;
115
+ text-align: left;
116
+ top: 3px;
117
+ right: -2px;
118
+ }
119
+ .my-icon-more {
120
+ width: 16px;
121
+ height: 20px;
122
+ border-top: 4px solid rgb(153, 153, 153);
123
+ border-bottom: 4px solid rgb(153, 153, 153);
124
+ background-color: rgb(153, 153, 153);
125
+ padding: 4px 0;
126
+ background-clip: content-box;
127
+ margin-left: 5px;
128
+ }
129
+ .ct-flex-div .ct-flex-div-input {
130
+ margin-right: 12px;
131
+ }
95
132
  </style>
package/src/main.js CHANGED
@@ -12,8 +12,8 @@ Vue.use(ElementUI, { size: 'mini'});
12
12
  // 关闭生产模式下给出的提示
13
13
  Vue.config.productionTip = false;
14
14
  Vue.use(centaline, {
15
- baseUrl: "http://10.88.22.46:7070/v1/form/router",
16
- // baseUrl: "http://10.88.23.22:9999/v1/form/router",
15
+ // baseUrl: "http://10.88.22.46:7070/v1/form/router",
16
+ baseUrl: "http://10.88.23.22:9999/v1/form/router",
17
17
  // baseUrl: "http://10.88.22.69:8080/",
18
18
  // flagRouterSelf: true,
19
19
  zindex: 999,
@@ -39,10 +39,10 @@ Vue.use(centaline, {
39
39
  // 获取请求头
40
40
  getRequestHeaders: function () {
41
41
  return {
42
- oldToken: '059a0de9-385e-49d1-85a7-c04e4c1c0a18',
42
+ oldToken: 'f6a35199-5dd7-423c-a4e4-e1553c3d76bb',
43
43
  originalRequestURL: 'http://10.88.22.67:8080',
44
44
  EstateInfo: '{"estateId":"201703020943128D8A8FCF463E4016D6","estateName":"%E4%B8%87%E7%A7%91%E4%BA%91%E5%9F%8E"}',
45
- Authorization:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6Ijc4N2U5ZDA1LThlMGItNDY0ZS1iMThjLTQzNjEyZWIyZDQ1ZCJ9.1W1c_YwAF9jfjAtOq9twaB6FH4KiySPuZmWIzcLSDxjfJTgXu7fcf4Cu8kyWcRC2bXrzNQoOYsHAR1vfMAQvGA',
45
+ Authorization:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjZiYWE5MDU5LTNkNTEtNGFlMC04YjBlLTc5YjQ4MTQzNzhjOCJ9.IYQdOekUibZsjx2OYXnCt0AVdBq9FhEx6RKnUQdJ6SA8aW6Ou3thl5JghE2w6nzXhlYYyPmc6vVu8YBe0JINsg',
46
46
  };
47
47
  },
48
48
  // 请求完成事件,可判断是否登录过期执行响应操作