centaline-data-driven 1.2.91 → 1.2.92

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",
3
- "version": "1.2.91",
3
+ "version": "1.2.92",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
@@ -1,11 +1,11 @@
1
1
  <template>
2
- <el-row v-if="model.fields.length > 0">
3
- <el-col v-for="(col, index) in model.fields" :key="index" v-if="col.show !== false" :span="col.colspan" :class="index>0&&col.label==''?'complex-left-10':''">
2
+ <el-container v-if="model.fields.length > 0">
3
+ <div v-for="(col, index) in model.fields" :key="index" v-if="col.show !== false" :class="index>0&&col.label==''?'complex-left-10':''" :style="{'width':(col.width!='0'?col.width+'px':'100%'),'flex':(col.width!='0'?'0 0 '+col.width+'px':'100%')}">
4
4
  <component ref="Fields" :is="col.is" :vmodel="col" :api="model.OptApi" v-bind="col.bindPara"
5
- @click="fieldClickHandler(col,index)" @change="changeHandler(col,index)"
6
- @input="inputHandler(col,index)"></component>
7
- </el-col>
8
- </el-row>
5
+ @click="fieldClickHandler(col,$event)" @change="changeHandler(col,$event)"
6
+ @input="inputHandler(col,$event)"></component>
7
+ </div>
8
+ </el-container>
9
9
  </template>
10
10
 
11
11
  <script>
@@ -15,7 +15,6 @@
15
15
  },
16
16
  data: function () {
17
17
  return {
18
-
19
18
  }
20
19
  },
21
20
  methods: {
@@ -30,7 +29,8 @@
30
29
  },
31
30
  props: {
32
31
  vmodel: Object,
33
- api: String
32
+ api: String,
33
+ parentModel: Object,
34
34
  },
35
35
  data() {
36
36
  return {
@@ -40,7 +40,6 @@
40
40
  }
41
41
  },
42
42
  created() {
43
- let self = this;
44
43
  this.model = this.vmodel;
45
44
  this.model.OptApi = this.api;
46
45
  },
@@ -67,17 +66,59 @@
67
66
  }
68
67
  return rtnBool;
69
68
  },
70
- changeHandler(field,index) {
69
+ changeHandler(field) {
71
70
  var self = this;
72
- this.model.change = field.change;
73
- self.$emit('change');
71
+ if (typeof field.change !== 'undefined') {
72
+ if (typeof this.model.scripts !== 'undefined') {
73
+ this.model.scripts.formData.setExcuteListData(this.model.fields);
74
+ }
75
+ this.model.scripts.$fd = field.id;
76
+ this.$common.excute.call(this.model.scripts, field.change);
77
+ }
78
+
79
+ self.model.isChanged = true;
80
+ self.model.hiddenHandle(field);
81
+ self.model.requiredHandle(field);
82
+ //self.model.validMrf(field);
83
+
84
+ if (field.onAfterChanged) {
85
+ var router = self.model.actionRouters.find((v) => {
86
+ return v.id === field.onAfterChanged;
87
+ });
88
+ self.$parent.$parent.$parent.$parent.clickHandler(router);
89
+ }
90
+
91
+ self.$forceUpdate();
74
92
  },
75
- inputHandler(field, index) {
93
+ inputHandler(field) {
76
94
  var self = this;
77
95
  this.model.input = field.input;//当前小组件事件作为大组件事件
78
96
  self.$emit('input');
79
97
 
80
98
  },
99
+ fieldClickHandler(field) {
100
+ let submitData = null;
101
+ var router = this.model.buttons.find((v) => {
102
+ return v.id === field.id;
103
+ });
104
+ if (router == undefined) {
105
+ router = this.model.links.find((v) => {
106
+ return v.id === field.id;
107
+ });
108
+ }
109
+ if (router == undefined) {
110
+ router = this.model.actionRouters.find((v) => {
111
+ return v.id === field.id;
112
+ });
113
+ }
114
+ if (router && field.isSubmitDataFromSelf) {
115
+ submitData = {};
116
+ router.submitFormField.forEach((v) => {
117
+ submitData[v] = field.list[field.listIndex].code;
118
+ });
119
+ }
120
+ this.$parent.$parent.$parent.$parent.clickHandler(router, submitData);
121
+ },
81
122
  }
82
123
  }
83
124
  </script>
@@ -554,10 +554,14 @@
554
554
  h2 = this.$parent.$parent.$refs.contact.offsetHeight | 0;
555
555
  }
556
556
  var h3 = 0;
557
- if (this.$parent.$parent.$refs.contact) {
557
+ if (this.$parent.$parent.$refs.title) {
558
558
  h3 = this.$parent.$parent.$refs.title.offsetHeight | 0;
559
559
  }
560
- let tableHeight = h1 - h2 - h3 - 270;
560
+ var h4 = 0;
561
+ if (this.$parent.$parent.$refs.shortcutFollow) {
562
+ h4 = this.$parent.$parent.$refs.shortcutFollow.offsetHeight | 0;
563
+ }
564
+ let tableHeight = h1 - h2 - h3-h4 - 290;
561
565
  if (h2 == 0) {
562
566
  tableHeight = tableHeight + 15;
563
567
  }
@@ -753,6 +757,35 @@
753
757
  else if (field.isOpenUrlInBrowse) {// 浏览器打开
754
758
  window.open(submitData[field.submitFormField], "_blank");
755
759
  }
760
+ else if (field.isSeeVoice && false) {//看视频
761
+ var dialogOption = {
762
+ title: field.pageTitle,
763
+ pane: self.$common.getParentPane(self),
764
+ content: [{
765
+ component: 'ct-form',
766
+ attrs: {
767
+ //ssource: data.content,
768
+ api: field.action,
769
+ apiParam: field.getActionPara(submitData).para,
770
+ showTitle: false,
771
+ width: field.dialogWidth + 'px',
772
+ height: field.dialogHeight + 'px'
773
+ },
774
+ on: {
775
+ submit(ev) {
776
+ self.model.updateFields(ev, () => {
777
+ self.$refs.Fields.forEach((fd) => {
778
+ fd.$forceUpdate();
779
+ });
780
+ });
781
+ self.$common.closeDialog(dialogOption.dialog);
782
+ }
783
+ }
784
+ }]
785
+ };
786
+ self.$common.openDialog(dialogOption);
787
+ window.open(submitData[field.submitFormField], "_blank");
788
+ }
756
789
  else {
757
790
  //self.operationLoading = true;
758
791
 
@@ -6,7 +6,7 @@ import Router from './Router';
6
6
  import Enum from './lib/Enum';
7
7
  import Vue from 'vue';
8
8
 
9
- const Compound = function (source, dateType) {
9
+ const Compound = function (source, sourceParent) {
10
10
  var rtn = {
11
11
  get label() {
12
12
  let l = '';
@@ -18,9 +18,63 @@ const Compound = function (source, dateType) {
18
18
  }
19
19
  return l;
20
20
  },
21
+ isChanged: false,
21
22
  set label(v) {
22
23
  source.controlLabel = v;
23
24
  },
25
+ _buttons: null,
26
+ get buttons() {
27
+ if (rtn._buttons !== null) {
28
+ return rtn._buttons;
29
+ }
30
+ else {
31
+ rtn._buttons = [];
32
+ if (sourceParent.buttons) {
33
+ sourceParent.buttons.forEach((v) => {
34
+ var button = Router(v);
35
+ button.is = "ct-btn";
36
+ rtn._buttons.push(button);
37
+ });
38
+ }
39
+ return rtn._buttons;
40
+ }
41
+ },
42
+ _links: null,
43
+ get links() {
44
+ if (rtn._links !== null) {
45
+ return rtn._links;
46
+ }
47
+ else {
48
+ rtn._links = [];
49
+ if (sourceParent.links) {
50
+ sourceParent.links.forEach((v) => {
51
+ var button = Router(v);
52
+ button.is = "ct-btn";
53
+ if (button.show) {
54
+ rtn._links.push(button);
55
+ }
56
+ });
57
+ }
58
+ return rtn._links;
59
+ }
60
+ },
61
+ _actionRouters: null,
62
+ get actionRouters() {
63
+ if (rtn._actionRouters !== null) {
64
+ return rtn._actionRouters;
65
+ }
66
+ else {
67
+ rtn._actionRouters = [];
68
+ if (sourceParent.actionRouters) {
69
+ sourceParent.actionRouters.forEach((v) => {
70
+ var button = Router(v);
71
+ button.is = "ct-btn";
72
+ rtn._actionRouters.push(button);
73
+ });
74
+ }
75
+ return rtn._actionRouters;
76
+ }
77
+ },
24
78
  getFormObj() {
25
79
  var rtnFormObj = {};
26
80
  rtn.fields.forEach((f) => {
@@ -30,6 +84,20 @@ const Compound = function (source, dateType) {
30
84
  });
31
85
  return rtnFormObj;
32
86
  },
87
+ _compoundfieldsDic: null,//字典,方便取值
88
+ get compoundfieldsDic() {
89
+ if (rtn._compoundfieldsDic !== null) {
90
+ return rtn._compoundfieldsDic;
91
+ }
92
+ rtn._compoundfieldsDic = {};
93
+ if (source.compoundFields) {
94
+ source.compoundFields.forEach((f) => {
95
+ let item = LibFunction.GetControl(f, sourceParent, false, false);
96
+ rtn._compoundfieldsDic[item.id] = item;
97
+ });
98
+ }
99
+ return rtn._compoundfieldsDic;
100
+ },
33
101
  _fields: null,//数组,方便遍历
34
102
  get fields() {
35
103
  if (rtn._fields !== null) {
@@ -37,21 +105,104 @@ const Compound = function (source, dateType) {
37
105
  }
38
106
  let Index = 0;
39
107
  rtn._fields = [];
40
- for (var key in source.compoundFields) {
41
- let value = source.compoundFields[key];
108
+ source.compoundFields.forEach((v) => {
42
109
  Index++;
43
110
  let showLabel = true;
44
- let item = LibFunction.GetControl(value, source, showLabel, false);
111
+ let item = LibFunction.GetControl(v, sourceParent, showLabel, false);
45
112
  if (item instanceof Object) {
113
+ item.width = v.width;
46
114
  item.form = rtn;
47
115
  if (Index == 1 && item.label == "") {
48
116
  item.label = rtn.label;
49
117
  }
118
+ rtn.hiddenHandle(item);//是否隐藏关联组件
50
119
  rtn._fields.push(item);
51
120
  }
52
- }
121
+ });
122
+ rtn.allRequiredHandle();//必填关联组件
53
123
  return rtn._fields;
54
124
  },
125
+ //隐藏关联组件
126
+ hiddenHandle(item, update) {
127
+ if (item.id) {
128
+ let sign = false;
129
+ let field = null;
130
+
131
+ for (var i in source.compoundFields) {
132
+ if (source.compoundFields[i].hiddenRelationField === item.id) {
133
+ field = source.compoundFields[i];
134
+ if (field) {
135
+ let hiddenValueArr = field.hiddenRelationFieldValue.split(',');
136
+ if (hiddenValueArr.indexOf(item.code1) > -1) {
137
+ field.show = false;
138
+ }
139
+ else {
140
+ field.show = true;
141
+ }
142
+ sign = true;
143
+
144
+ if (update && rtn.self && sign) {
145
+ rtn.self.$forceUpdate();
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ }
152
+ },
153
+ //验证必填关联组件
154
+ validMrf(item) {
155
+ let field = rtn.fields[item.mrf];
156
+
157
+ if (field && field.self) {
158
+ if (field.type === Enum.ControlType.List) {
159
+ //f.required = '0';
160
+ }
161
+ else {
162
+ field.self.validExcute();
163
+ }
164
+ }
165
+ },
166
+ allRequiredHandle() {
167
+ rtn.fields.forEach(v => {
168
+ rtn.requiredHandle(v, null, false);
169
+ });
170
+ },
171
+ //处理必填关联组件
172
+ requiredHandle(item, update, doMrf) {
173
+ if (item.id) {
174
+ let field = null;
175
+ for (var i in source.compoundFields) {
176
+ if (source.compoundFields[i].requiredRelationField === item.id) {
177
+ field = source.compoundFields[i];
178
+ let f = rtn.compoundfieldsDic[field.fieldName1];
179
+
180
+ if (field) {
181
+ let hiddenValueArr = field.requiredRelationFieldValue.split(',');
182
+ if (hiddenValueArr.indexOf(item.value) > -1) {
183
+ field.required = true;
184
+ }
185
+ else {
186
+ field.required = false;
187
+ }
188
+
189
+ if (f && f.self && f.self.$forceUpdate) {
190
+ f.self.$forceUpdate();
191
+ }
192
+
193
+ if (update && rtn.self) {
194
+ rtn.self.$forceUpdate();
195
+ }
196
+ }
197
+ }
198
+ }
199
+
200
+ if (doMrf !== false) {
201
+ rtn.validMrf(item);
202
+ }
203
+ }
204
+ },
205
+
55
206
  };
56
207
  rtn = base.copy(Base(source), rtn);
57
208
  return rtn;
@@ -42,6 +42,13 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
42
42
  rtn._fieldsDic = {};
43
43
  if (rtn.fields) {
44
44
  rtn.fields.forEach((f) => {
45
+ if (f.type == Enum.ControlType.Compound) {
46
+ if (f.fields) {
47
+ f.fields.forEach((v) => {
48
+ rtn._fieldsDic[v.id] = v;
49
+ });
50
+ }
51
+ }
45
52
  rtn._fieldsDic[f.id] = f;
46
53
  });
47
54
  }
@@ -196,7 +203,7 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
196
203
  },
197
204
  //设置Field的属性attrKey的值
198
205
  setValueByFieldName(id, attrKey, attrValue) {
199
- attrKey = this.common.initialsToLowerCase(attrKey);
206
+ attrKey = this.common.initialsToLowerCase(attrKey);
200
207
  var rtn1 = this.fieldsDic[id];
201
208
  if (rtn1) {
202
209
  rtn1.source[attrKey] = attrValue;
@@ -211,22 +218,22 @@ const Form = function (source, callBack, apiParam, failCallBack, isFormList) {
211
218
  },
212
219
  //设置Field的v1、v2的值
213
220
  setV1AndV2ByField1(id, code1, code2) {
214
- var rtn1 = this.fieldsDic[id];
215
- if (rtn1) {
216
- if (typeof rtn1.value !== 'undefined') {
217
- rtn1.value = code1;
221
+ var rtn1 = this.fieldsDic[id];
222
+ if (rtn1) {
223
+ if (typeof rtn1.value !== 'undefined') {
224
+ rtn1.value = code1;
218
225
 
219
- this.form.validMrf(rtn1);//验证必填关联组件
220
- this.form.hiddenHandle(rtn1, true);//隐藏关联的
221
- }
222
- if (typeof rtn1.value1 !== 'undefined') {
223
- rtn1.value1 = code2;
224
- }
226
+ this.form.validMrf(rtn1);//验证必填关联组件
227
+ this.form.hiddenHandle(rtn1, true);//隐藏关联的
228
+ }
229
+ if (typeof rtn1.value1 !== 'undefined') {
230
+ rtn1.value1 = code2;
231
+ }
225
232
 
226
- if (rtn1.self.$forceUpdate) {
227
- rtn1.self.$forceUpdate();
228
- }
233
+ if (rtn1.self.$forceUpdate) {
234
+ rtn1.self.$forceUpdate();
229
235
  }
236
+ }
230
237
  },
231
238
 
232
239
  //获取列表数据
@@ -104,6 +104,9 @@ const Router = function (source) {
104
104
  get isListenVoice() {
105
105
  return source.actionType === Enum.ActionType.ListenVoice;
106
106
  },
107
+ get isSeeVoice() {
108
+ return source.actionType === Enum.ActionType.SeeVoice;
109
+ },
107
110
  //打开页面(1Form,2SearchList(弹在tab),3Tab,4执行客户端脚本,5SearchList(弹出))
108
111
  get navToNewPage() {
109
112
  return source.navToNewPage;
@@ -221,7 +221,7 @@ const LibFunction = {
221
221
  item.is = 'ct-repeat';
222
222
  break;
223
223
  case Enum.ControlType.Compound://复合
224
- item = Compound(field);
224
+ item = Compound(field,source);
225
225
  item.is = 'ct-compound';
226
226
  break;
227
227
  case Enum.ControlType.Hidden://隐藏控件