centaline-data-driven 1.3.21 → 1.3.24

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.
@@ -1,325 +1,330 @@
1
1
  <template>
2
- <div ref="contact" v-if="apiRouter!=={} && model && model.listData.length>0"
3
- style="border: 1px solid #ECEFF2;box-shadow: 0 2px 4px 0 rgba(0,0,0,0.06);border-radius: 6px;
2
+ <div ref="contact" id="contactWidth" v-if="apiRouter !== {} && model && model.listData.length > 0" style="border: 1px solid #ECEFF2;box-shadow: 0 2px 4px 0 rgba(0,0,0,0.06);border-radius: 6px;
4
3
  padding-bottom: 10px;padding-top: 10px;padding-left: 10px;display: flex;font-size: 12px;width:100%">
5
- <div class="ct-so" style="width:auto;margin-right: 10px;flex:1">
4
+ <div class="ct-so"
5
+ style="width:auto;margin-right: 10px;flex:1;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
6
6
  <el-popover ref="pop" placement="bottom-start" v-model="showDrop" trigger="click">
7
7
  <div>
8
8
  <ctSelectOptionVertical :model="model" @click="selectOption($event)"></ctSelectOptionVertical>
9
9
  </div>
10
10
  <div slot="reference" readonly="readonly" ref="ct-input"
11
- style="font-weight: Bold;color:#333333 !important;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: flex;"
12
- :style="{height:inputHeight + 'px','line-height':inputLineHeight + 'px',width:'auto'}"
13
- @focus="focusHandle" @blur="blurHandle" @click="clickHandle" @input="inputHandler($event)" v-html="model.text"
14
- @change="changeHandler($event)" :disabled="model.lock" :class="model.lock ? 'ct-is-disabled' : 'ct-input_inner'"></div>
11
+ style="font-weight: Bold;color:#333333 !important;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
12
+ :style="{ height: inputHeight + 'px', 'line-height': inputLineHeight + 'px', }" @focus="focusHandle"
13
+ @blur="blurHandle" @click="clickHandle" @input="inputHandler($event)" v-html="model.text"
14
+ @change="changeHandler($event)" :disabled="model.lock"
15
+ :class="model.lock ? 'ct-is-disabled' : 'ct-input_inner'"></div>
15
16
  </el-popover>
16
- <span class="el-input__suffix" @click="clickHandle" :class="[model.attrs.size?'el-input--'+model.attrs.size:'']">
17
+ <span class="el-input__suffix" @click="clickHandle"
18
+ :class="[model.attrs.size ? 'el-input--' + model.attrs.size : '']">
17
19
  <span class="el-input__suffix-inner">
18
- <i class="el-select__caret el-input__icon el-icon-arrow-up" :class="{'is-reverse':showDrop}"></i>
20
+ <i class="el-select__caret el-input__icon el-icon-arrow-up" :class="{ 'is-reverse': showDrop }"></i>
19
21
  </span>
20
22
  </span>
21
23
  </div>
22
- <div ref="routers" style="margin-right: 5px;display: flex;">
23
- <component v-for="(router, index) in model.rowRouter" :key="index" :ref="'router'+router.id"
24
- v-if="!router.rightField || model.listData[model.value][router.rightField] == 1"
25
- :is="router.is" :vmodel="router" :api="model.optionApi" @click="fieldClickHandler(router)">
24
+ <div ref="routers" style="margin-right: 5px;" id="routersWidth">
25
+ <component v-for="(router, index) in model.rowRouter" :key="index" :ref="'router' + router.id"
26
+ v-if="!router.rightField || model.listData[model.value][router.rightField] == 1" :is="router.is"
27
+ :vmodel="router" :api="model.optionApi" @click="fieldClickHandler(router)">
26
28
  </component>
27
29
  </div>
28
30
  </div>
29
31
  </template>
30
32
 
31
33
  <script>
32
- import dynamicElement from '../../mixins/dynamicElement';
33
- import selectOption from '../../selectOption/src/selectOption.vue';
34
- import ctSelectOptionVertical from '../../selectOption/src/selectOptionVertical';
35
- export default {
36
- name: 'ct-contact',
37
- mixins: [dynamicElement],
38
- components: {
39
- 'ct-select-option': selectOption,
40
- 'ctSelectOptionVertical': ctSelectOptionVertical,
34
+ import dynamicElement from '../../mixins/dynamicElement';
35
+ import selectOption from '../../selectOption/src/selectOption.vue';
36
+ import ctSelectOptionVertical from '../../selectOption/src/selectOptionVertical';
37
+ export default {
38
+ name: 'ct-contact',
39
+ mixins: [dynamicElement],
40
+ components: {
41
+ 'ct-select-option': selectOption,
42
+ 'ctSelectOptionVertical': ctSelectOptionVertical,
43
+ },
44
+ props: {
45
+ vmodel: Object,
46
+ api: String,
47
+ apiParam: Object,
48
+ apiRouter: {
49
+ Object,
50
+ default: {}
41
51
  },
42
- props: {
43
- vmodel: Object,
44
- api: String,
45
- apiParam: Object,
46
- apiRouter: {
47
- Object,
48
- default:{}
49
- },
50
- },
51
- data() {
52
- return {
53
- focus: false,
54
- showDrop: false,
55
- inputHeight: 26,
56
- inputLineHeight: 26,
57
- inputLinewidth: 150,
52
+ },
53
+ data() {
54
+ return {
55
+ focus: false,
56
+ showDrop: false,
57
+ inputHeight: 26,
58
+ inputLineHeight: 26,
59
+ inputLinewidth: 150,
60
+ }
61
+ },
62
+ created() {
63
+ var self = this;
64
+ this.$nextTick(function () {
65
+ if (self.vmodel) {
66
+ self.load(self.vmodel);
58
67
  }
59
- },
60
- created() {
68
+ else if (typeof self.source !== 'undefined') {
69
+ self.loaderObj.Contact(self.source, null, self.load);
70
+ }
71
+ else if (typeof self.api !== 'undefined' && self.apiParam) {
72
+ self.loaderObj.Contact(self.api, self.apiParam, self.load);
73
+ }
74
+
75
+ });
76
+
77
+ },
78
+ activated() {
79
+ this.$nextTick(() => {
80
+ this.setCss();
81
+ })
82
+ },
83
+ methods: {
84
+ load(data) {
61
85
  var self = this;
62
- this.$nextTick(function () {
63
- if (self.vmodel) {
64
- self.load(self.vmodel);
65
- }
66
- else if (typeof self.source !== 'undefined') {
67
- self.loaderObj.Contact(self.source,null,self.load);
68
- }
69
- else if (typeof self.api !== 'undefined' && self.apiParam) {
70
- self.loaderObj.Contact(self.api,self.apiParam, self.load);
71
- }
72
- });
73
- },
74
- activated() {
86
+ this.model = data;
87
+ this.model.$vue = self;
88
+ if (this.model.listData.length > 0) {
89
+ this.model.text = data.listData[0][data.columns[0].id];
90
+ this.model.value = 0;
91
+ }
92
+ this.setCss();
75
93
  this.$nextTick(() => {
76
- this.setCss();
77
- })
78
- },
79
- methods: {
80
- load(data) {
81
- var self=this;
82
- this.model = data;
83
- this.model.$vue = self;
84
- if(this.model.listData.length>0){
85
- this.model.text=data.listData[0][data.columns[0].id];
86
- this.model.value=0;
87
- }
88
- this.setCss();
89
- this.$nextTick(() => {
90
- window.addEventListener("resize", (ev) => {
91
- self.setCss();
92
- });
94
+ window.addEventListener("resize", (ev) => {
95
+ self.setCss();
93
96
  });
94
- },
95
- focusHandle: function () {
96
- this.$refs['ct-input'].focus();
97
- this.$set(this, 'focus', true);
98
- },
99
- blurHandle: function () {
100
- this.$set(this, 'focus', false);
101
- },
102
- clickHandle: function () {
103
- if (this.model.lock) {
104
- return false;
105
- }
106
- this.$set(this, 'showDrop', !this.showDrop);
107
- if (this.showDrop) {
108
- this.getOptions();
109
- }
110
- this.focusHandle();
111
- },
112
- selectOption(value) {
113
- if (this.model.value === value) {
114
- this.$set(this, 'showDrop', false);
115
- return;
116
- }
117
- else {
118
- this.model.value = value;
119
- }
120
- this.soChange();
97
+ });
98
+
99
+ },
100
+
101
+ focusHandle: function () {
102
+ this.$refs['ct-input'].focus();
103
+ this.$set(this, 'focus', true);
104
+ },
105
+ blurHandle: function () {
106
+ this.$set(this, 'focus', false);
107
+ },
108
+ clickHandle: function () {
109
+ if (this.model.lock) {
110
+ return false;
111
+ }
112
+ this.$set(this, 'showDrop', !this.showDrop);
113
+ if (this.showDrop) {
114
+ this.getOptions();
115
+ }
116
+ this.focusHandle();
117
+ },
118
+ selectOption(value) {
119
+ if (this.model.value === value) {
121
120
  this.$set(this, 'showDrop', false);
122
- },
123
- getOptions: function () {
124
- this.model.getOptions();
125
- },
126
- soChange: function () {
127
- var self = this;
128
- if (typeof this.model.child !== 'undefined') {
129
- this.model.child.value = this.model.child.defaultValue || '';
130
- this.model.child.text = this.model.child.defaultText || '';
131
- }
132
- var currentOption = this.model.options.find((value) => {
133
- return self.model.value === value[self.model.optionAttrs.value];
121
+ return;
122
+ }
123
+ else {
124
+ this.model.value = value;
125
+ }
126
+ this.soChange();
127
+ this.$set(this, 'showDrop', false);
128
+ },
129
+ getOptions: function () {
130
+ this.model.getOptions();
131
+ },
132
+ soChange: function () {
133
+ var self = this;
134
+ if (typeof this.model.child !== 'undefined') {
135
+ this.model.child.value = this.model.child.defaultValue || '';
136
+ this.model.child.text = this.model.child.defaultText || '';
137
+ }
138
+ var currentOption = this.model.options.find((value) => {
139
+ return self.model.value === value[self.model.optionAttrs.value];
140
+ });
141
+ if (currentOption) {
142
+ this.model.text = currentOption[self.model.optionAttrs.label];
143
+ }
144
+ else {
145
+ this.model.text = '';
146
+ }
147
+ this.inputHandler(self.model.value);
148
+ this.changeHandler(self.model.value);
149
+ if (this.model.autoSearch) this.$emit('click');
150
+ },
151
+ fieldClickHandler(field) {
152
+ var self = this;
153
+ let submitData = {};
154
+ var router = this.model.buttons.find((v) => {
155
+ return v.id === field.id;
156
+ });
157
+ if (router == undefined && this.model.actionRouter) {
158
+ router = this.model.actionRouter.find((v) => {
159
+ return v.id === field.id;
134
160
  });
135
- if (currentOption) {
136
- this.model.text = currentOption[self.model.optionAttrs.label];
137
- }
138
- else {
139
- this.model.text = '';
161
+ }
162
+ if (router == undefined && this.model.otherTradeActionRouter) {
163
+ if (field.id === this.model.otherTradeActionRouter.id) {
164
+ router = this.model.otherTradeActionRouter
140
165
  }
141
- this.inputHandler(self.model.value);
142
- this.changeHandler(self.model.value);
143
- if(this.model.autoSearch) this.$emit('click');
144
- },
145
- fieldClickHandler(field) {
146
- var self = this;
147
- let submitData={};
148
- var router = this.model.buttons.find((v) => {
166
+ }
167
+ if (router == undefined && this.model.operationRouters) {
168
+ router = this.model.operationRouters.find((v) => {
149
169
  return v.id === field.id;
150
170
  });
151
- if(router==undefined && this.model.actionRouter){
152
- router = this.model.actionRouter.find((v) => {
153
- return v.id === field.id;
171
+ callBack = "loadOperation";
172
+ }
173
+
174
+ if (router) {
175
+ if (field.isSubmitDataFromSelf) {
176
+ router.submitFormField.forEach((v) => {
177
+ submitData[v] = field.list[field.listIndex].code;
154
178
  });
155
179
  }
156
- if(router==undefined && this.model.otherTradeActionRouter){
157
- if(field.id===this.model.otherTradeActionRouter.id){
158
- router = this.model.otherTradeActionRouter
159
- }
160
- }
161
- if(router==undefined && this.model.operationRouters){
162
- router = this.model.operationRouters.find((v) => {
163
- return v.id === field.id;
164
- });
165
- callBack="loadOperation";
180
+ else {
181
+ router.submitFormField.forEach((v) => {
182
+ submitData[v] = self.model.listData[self.model.value][v];
183
+ });
166
184
  }
185
+ }
167
186
 
168
- if(router){
169
- if(field.isSubmitDataFromSelf){
170
- router.submitFormField.forEach((v) => {
171
- submitData[v] = field.list[field.listIndex].code;
172
- });
173
- }
174
- else{
175
- router.submitFormField.forEach((v) => {
176
- submitData[v] = self.model.listData[self.model.value][v];
177
- });
178
- }
179
- }
180
-
181
- this.routerClickHandler(router,submitData);
182
- },
183
- routerClickHandler(field, submitData,callBack) {
184
- var self = this;
185
- // this.model.scripts.$fd = field.id;
186
- // this.model.scripts.$result = [];
187
-
188
- var clickAcion = function (field) {
189
- //若不是客户端方法,则直接访问接口
190
- if (!field.isClientFuntion) {
191
- // if (typeof field.onClick !== 'undefined') {
192
- // verified = self.$common.excute.call(self.model.scripts, field.onClick);
193
- // }
194
-
195
- if (field.isOpenForm) {
196
- var dialogOption = {
197
- title: field.pageTitle,
198
- pane: self.$common.getParentPane(self),
199
- content: [{
200
- component: 'ct-form',
201
- attrs: {
202
- api: field.action,
203
- apiParam: field.getActionPara(submitData).para,
204
- showTitle: false,
205
- width: field.dialogWidth + 'px',
206
- height: field.dialogHeight + 'px'
207
- },
208
- on: {
209
- submit(ev) {
210
- self.model.doAction(ev,field);
211
- if(callBack){
212
- callBack();
213
- }
214
- self.$common.closeDialog(dialogOption.dialog);
187
+ this.routerClickHandler(router, submitData);
188
+ },
189
+ routerClickHandler(field, submitData, callBack) {
190
+ var self = this;
191
+ // this.model.scripts.$fd = field.id;
192
+ // this.model.scripts.$result = [];
193
+
194
+ var clickAcion = function (field) {
195
+ //若不是客户端方法,则直接访问接口
196
+ if (!field.isClientFuntion) {
197
+ // if (typeof field.onClick !== 'undefined') {
198
+ // verified = self.$common.excute.call(self.model.scripts, field.onClick);
199
+ // }
200
+
201
+ if (field.isOpenForm) {
202
+ var dialogOption = {
203
+ title: field.pageTitle,
204
+ pane: self.$common.getParentPane(self),
205
+ content: [{
206
+ component: 'ct-form',
207
+ attrs: {
208
+ api: field.action,
209
+ apiParam: field.getActionPara(submitData).para,
210
+ showTitle: false,
211
+ width: field.dialogWidth + 'px',
212
+ height: field.dialogHeight + 'px'
213
+ },
214
+ on: {
215
+ submit(ev) {
216
+ self.model.doAction(ev, field);
217
+ if (callBack) {
218
+ callBack();
215
219
  }
220
+ self.$common.closeDialog(dialogOption.dialog);
216
221
  }
217
- }]
218
- };
219
- self.$common.openDialog(dialogOption);
220
- }
221
- else if (field.isOpenList) {
222
- var dialogOption = {
223
- title: field.pageTitle,
224
- pane: self.$common.getParentPane(self),
225
- content: [{
226
- component: 'ct-searchlist',
227
- attrs: {
228
- searchConditionApi: field.actionForSearchLayout,
229
- searchDataApi: field.actionForSearch,
230
- apiParam: submitData,
231
- width: field.dialogWidth + 'px',
232
- height: field.dialogHeight + 'px'
233
- },
234
- on: {
235
- submit(ev) {
236
- self.model.updateFields(ev, () => {
237
- self.$refs.Fields.forEach((fd) => {
238
- fd.$forceUpdate();
239
- });
222
+ }
223
+ }]
224
+ };
225
+ self.$common.openDialog(dialogOption);
226
+ }
227
+ else if (field.isOpenList) {
228
+ var dialogOption = {
229
+ title: field.pageTitle,
230
+ pane: self.$common.getParentPane(self),
231
+ content: [{
232
+ component: 'ct-searchlist',
233
+ attrs: {
234
+ searchConditionApi: field.actionForSearchLayout,
235
+ searchDataApi: field.actionForSearch,
236
+ apiParam: submitData,
237
+ width: field.dialogWidth + 'px',
238
+ height: field.dialogHeight + 'px'
239
+ },
240
+ on: {
241
+ submit(ev) {
242
+ self.model.updateFields(ev, () => {
243
+ self.$refs.Fields.forEach((fd) => {
244
+ fd.$forceUpdate();
240
245
  });
241
- self.$common.closeDialog(dialogOption.dialog);
242
- }
246
+ });
247
+ self.$common.closeDialog(dialogOption.dialog);
243
248
  }
244
- }]
245
- };
246
- self.$common.openDialog(dialogOption);
247
- }
248
- else if (field.isFormPageInTab) {// 外部框架tab页打开
249
- submitData = field.getActionPara(submitData).para;
250
- self.$common.getDataDrivenOpts().handler.openTab(field.action, submitData, field.pageTitle);
251
- }
252
- else if (field.isSearchPageInTab) {// 外部框架tab页打开
253
- submitData = field.getActionPara(submitData).para;
254
- self.$common.getDataDrivenOpts().handler.openTabSearch(field, submitData);
255
- }
256
- else if (field.isBrowserNewTab) {// 浏览器打开
257
- submitData = field.getActionPara(submitData).para;
258
- let query = self.$common.objectToQueryStr(submitData);
259
- window.open(field.action + query, "_blank");
260
- }
261
- else if (field.isOpenUrlInBrowse) {// 浏览器打开
262
- window.open(submitData[field.submitFormField], "_blank");
263
- }
264
- else if (field.isSeeVoice) {//看视频
265
- self.$common.browseVideo(field,submitData)
266
- }
267
- else{
268
- field.doAction(submitData, (data) => {
269
- self.model.doAction(data,field);
270
- if(callBack){
271
- callBack();
272
- }
273
- if(field.actionType===10){
274
- self.loaderObj.Contact(data,null,self.load);
275
- }
276
- else if(field.actionType===19){
277
- self.$refs['router'+field.id][0].callTelClick(data);
278
249
  }
279
- })
280
- }
250
+ }]
251
+ };
252
+ self.$common.openDialog(dialogOption);
281
253
  }
282
- //执行客户端脚本
283
- else {
254
+ else if (field.isFormPageInTab) {// 外部框架tab页打开
284
255
  submitData = field.getActionPara(submitData).para;
285
- let title=field.pageTitle==undefined ?field.label:field.pageTitle;
286
- submitData.actionType=field.actionType;
287
- var fun =self.$common.getDataDrivenOpts().handler[field.action];
288
- fun(submitData,title,self.model);
256
+ self.$common.getDataDrivenOpts().handler.openTab(field.action, submitData, field.pageTitle);
257
+ }
258
+ else if (field.isSearchPageInTab) {// 外部框架tab页打开
259
+ submitData = field.getActionPara(submitData).para;
260
+ self.$common.getDataDrivenOpts().handler.openTabSearch(field, submitData);
261
+ }
262
+ else if (field.isBrowserNewTab) {// 浏览器打开
263
+ submitData = field.getActionPara(submitData).para;
264
+ let query = self.$common.objectToQueryStr(submitData);
265
+ window.open(field.action + query, "_blank");
266
+ }
267
+ else if (field.isOpenUrlInBrowse) {// 浏览器打开
268
+ window.open(submitData[field.submitFormField], "_blank");
269
+ }
270
+ else if (field.isSeeVoice) {//看视频
271
+ self.$common.browseVideo(field, submitData)
272
+ }
273
+ else {
274
+ field.doAction(submitData, (data) => {
275
+ self.model.doAction(data, field);
276
+ if (callBack) {
277
+ callBack();
278
+ }
279
+ if (field.actionType === 10) {
280
+ self.loaderObj.Contact(data, null, self.load);
281
+ }
282
+ else if (field.actionType === 19) {
283
+ self.$refs['router' + field.id][0].callTelClick(data);
284
+ }
285
+ })
289
286
  }
290
287
  }
291
-
292
- if (field.isSubmit && !self.validExcute()) {
293
- return;
294
- }
295
-
296
- if (field.alert) {
297
- self.$common.confirm(field.alertMsg, field.alertCaption, {
298
- confirmButtonText: field.alertOKButtonText,
299
- cancelButtonText: field.alertCancelButtonText,
300
- //type: 'warning'
301
- center: field.alertCenter
302
- }).then(() => {
303
- clickAcion(field,submitData);
304
- }).catch(() => {
305
- });
306
- }
288
+ //执行客户端脚本
307
289
  else {
308
- clickAcion(field,submitData);
290
+ submitData = field.getActionPara(submitData).para;
291
+ let title = field.pageTitle == undefined ? field.label : field.pageTitle;
292
+ submitData.actionType = field.actionType;
293
+ var fun = self.$common.getDataDrivenOpts().handler[field.action];
294
+ fun(submitData, title, self.model);
309
295
  }
310
- },
311
- setCss() {
312
- this.$nextTick(() => {
313
- if (this.$refs.contact) {
314
- var w1 = this.$refs.contact.clientWidth | 0;
315
- var w2 = this.$refs.routers.clientWidth | 0;
316
- this.inputLinewidth=w1-w2-80;
317
- }
296
+ }
297
+
298
+ if (field.isSubmit && !self.validExcute()) {
299
+ return;
300
+ }
301
+
302
+ if (field.alert) {
303
+ self.$common.confirm(field.alertMsg, field.alertCaption, {
304
+ confirmButtonText: field.alertOKButtonText,
305
+ cancelButtonText: field.alertCancelButtonText,
306
+ //type: 'warning'
307
+ center: field.alertCenter
308
+ }).then(() => {
309
+ clickAcion(field, submitData);
310
+ }).catch(() => {
318
311
  });
319
- },
320
- }
312
+ }
313
+ else {
314
+ clickAcion(field, submitData);
315
+ }
316
+ },
317
+ setCss() {
318
+ this.$nextTick(() => {
319
+ if (this.$refs.contact) {
320
+ var w1 = this.$refs.contact.clientWidth | 0;
321
+ var w2 = this.$refs.routers.clientWidth | 0;
322
+ this.inputLinewidth = w1 - w2 - 80;
323
+ }
324
+ });
325
+ },
321
326
  }
327
+ }
322
328
  </script>
323
329
  <style lang="scss" scoped>
324
-
325
330
  </style>