centaline-data-driven 1.5.39 → 1.5.41

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,18 +1,55 @@
1
1
  <template>
2
2
  <div class="ct-form-repeat">
3
- <el-button v-if="model.create&&model.tableData.length<model.max" type="success" style="float: right; " class=" max-btn-add" size="mini" icon="el-icon-circle-plus-outline" @click="addRow">
4
- {{model.createText}}
5
- </el-button>
6
- <div class="el-col el-col-24 ct-form-repeat-el-col" v-for="(v, i) in model.tableData" :key="v.guid" v-if="!v.deleted">
3
+ <el-button
4
+ v-if="model.create&&model.tableData.length<model.max"
5
+ type="success"
6
+ style="float: right; "
7
+ class=" max-btn-add"
8
+ size="mini"
9
+ icon="el-icon-circle-plus-outline"
10
+ @click="addRow"
11
+ >
12
+ {{model.createText}}
13
+ </el-button>
14
+ <div
15
+ class="el-col el-col-24 ct-form-repeat-el-col"
16
+ v-for="(v, i) in model.tableData"
17
+ :key="v.$sourceIndex"
18
+ v-if="!v.deleted"
19
+ >
7
20
  <el-row v-if="v.field.length > 0">
8
- <el-col v-for="(col, index) in v.field" :key="col.guid" v-if="col.show !== false&&col.type!=13" :span="col.colspan" style="padding:5px">
9
- <component ref="Fields" :is="col.is" :vmodel="col" :api="model.OptApi" v-bind="col.bindPara"
10
- @click="fieldClickHandler(col,index,i)" @change="changeHandler(col,index,i)"
11
- @input="inputHandler(col,index,i)"></component>
21
+ <el-col
22
+ v-for="(col, index) in v.field"
23
+ :key="col.rowKey"
24
+ v-if="col.show !== false&&col.type!=13"
25
+ :span="col.colspan"
26
+ style="padding:5px"
27
+ >
28
+ <component
29
+ ref="Fields"
30
+ :is="col.is"
31
+ :vmodel="col"
32
+ :api="model.OptApi"
33
+ v-bind="col.bindPara"
34
+ @click="fieldClickHandler(col,index,i)"
35
+ @change="changeHandler(col,index,i,v.$sourceIndex)"
36
+ @popupSearchList="popupSearchListHandler(col,i)"
37
+ @input="inputHandler(col,index,i)"
38
+ ></component>
12
39
  </el-col>
13
40
  </el-row>
14
- <div class="list-button" v-if="i>0">
15
- <el-button v-if="v.delete" type="success" class=" max-btn-add" size="mini" icon="el-icon-delete" @click="deleteRow(i)">
41
+ <div
42
+ class="list-button"
43
+ v-if="i>0"
44
+ >
45
+ <el-button
46
+ v-if="v.delete"
47
+ type="success"
48
+ class=" max-btn-add"
49
+ size="mini"
50
+ icon="el-icon-delete"
51
+ @click="deleteRow(i)"
52
+ >
16
53
  删除
17
54
  </el-button>
18
55
  </div>
@@ -22,157 +59,331 @@
22
59
  </template>
23
60
 
24
61
  <script>
25
- //Form内表格
26
- var ctSpan = {//临时的span组件对象,用于vue双向绑定,强制更新
27
- props: {
28
- vmodel: Object,
29
- rowNum: Number,
30
- },
31
- data: function () {
32
- return {
33
-
62
+ //Form内表格
63
+ var ctSpan = {
64
+ //临时的span组件对象,用于vue双向绑定,强制更新
65
+ props: {
66
+ vmodel: Object,
67
+ rowNum: Number,
68
+ },
69
+ data: function () {
70
+ return {};
71
+ },
72
+ methods: {
73
+ getClass() {
74
+ if (this.vmodel.is === "ct-inputNumber") {
75
+ return "ct-table-inputnumber";
34
76
  }
35
77
  },
36
- methods: {
37
- getClass() {
38
- if (this.vmodel.is === "ct-inputNumber") {
39
- return 'ct-table-inputnumber';
78
+ },
79
+ template:
80
+ '<div :class="getClass()">{{vmodel.labelValue}}{{vmodel.unitName}}</div>',
81
+ };
82
+
83
+ export default {
84
+ name: "ct-repeat",
85
+ components: {
86
+ "ct-span": ctSpan,
87
+ },
88
+ props: {
89
+ vmodel: Object,
90
+ api: String,
91
+ },
92
+ data() {
93
+ return {
94
+ model: null,
95
+ foucus: false,
96
+ itemKey: Math.random(),
97
+ activeName: ["0"],
98
+ };
99
+ },
100
+ created() {
101
+ let self = this;
102
+ this.model = this.vmodel;
103
+ this.model.OptApi = this.api;
104
+ this.model.$self = self;
105
+ this.$nextTick(function () {
106
+ self.model.refField = this.$refs.Fields;
107
+ });
108
+ this.model.tableData.forEach((v, i) => {
109
+ v.field.forEach((f, n) => {
110
+ self.model.hiddenHandle(f, i);
111
+ self.model.requiredHandle(f, i);
112
+ });
113
+ //联动组件处理 todo:去掉,使用form方式
114
+ var hasParent = self.model.tableData[i].field.filter((v1) => {
115
+ return typeof v1.parentName !== "undefined";
116
+ });
117
+
118
+ hasParent.forEach((v1, index) => {
119
+ var arr = v1.parentName.split(",");
120
+ for (var j = 0; j < arr.length; j++) {
121
+ var parent = self.model.tableData[i].field.find((v2) => {
122
+ return v2.id === arr[j];
123
+ });
124
+ if (parent) {
125
+ parent.child = parent.child ? parent.child : [];
126
+ parent.child.push(v1);
127
+ v.parent = parent;
128
+ }
40
129
  }
41
- }
42
- },
43
- template: '<div :class="getClass()">{{vmodel.labelValue}}{{vmodel.unitName}}</div>'
44
- }
130
+ });
131
+ });
132
+ },
133
+ methods: {
134
+ //添加
135
+ addRow() {
136
+ var app = this;
137
+ if (app.fieldsValidExcute()) {
138
+ let newRow = app.model.getCloneRowData(0);
139
+ app.model.tableData.push(newRow);
140
+ app.model.addSourceRow(newRow.$sourceIndex);
141
+ app.model.tableData[app.model.tableData.length - 1].field.forEach(
142
+ (f, n) => {
143
+ app.model.hiddenHandle(f, app.model.tableData.length - 1);
144
+ app.model.requiredHandle(f, app.model.tableData.length - 1);
145
+ }
146
+ );
147
+ //联动组件处理 todo:去掉,使用form方式
148
+ var hasParent = app.model.tableData[
149
+ app.model.tableData.length - 1
150
+ ].field.filter((v1) => {
151
+ return typeof v1.parentName !== "undefined";
152
+ });
45
153
 
46
- export default {
47
- name: 'ct-repeat',
48
- components: {
49
- 'ct-span': ctSpan
50
- },
51
- props: {
52
- vmodel: Object,
53
- api: String
54
- },
55
- data() {
56
- return {
57
- model: null,
58
- foucus: false,
59
- itemKey: Math.random(),
60
- activeName: ['0'],
154
+ hasParent.forEach((v1, index) => {
155
+ var arr = v1.parentName.split(",");
156
+ for (var j = 0; j < arr.length; j++) {
157
+ var parent = app.model.tableData[
158
+ app.model.tableData.length - 1
159
+ ].field.find((v2) => {
160
+ return v2.id === arr[j];
161
+ });
162
+ if (parent) {
163
+ parent.child = parent.child ? parent.child : [];
164
+ parent.child.push(v1);
165
+ }
166
+ }
167
+ });
61
168
  }
62
169
  },
63
- created() {
64
- let self = this;
65
- this.model = this.vmodel;
66
- this.model.OptApi = this.api;
67
- this.$nextTick(function () {
68
- self.model.refField = this.$refs.Fields;
69
- self.model.refFieldsLabel = this.$refs.FieldsLabel;
170
+ //删除
171
+ deleteRow(index) {
172
+ var self = this;
173
+ this.model.deleteRow(index + 1, () => {
174
+ if (self.model.tableData[index].isNewFlag) {
175
+ self.model.tableData.splice(index, 1);
176
+ } else {
177
+ self.model.tableData[index].deleted = true;
178
+ }
179
+ self.$forceUpdate();
180
+ self.model.change = self.model.formListChange;
181
+ self.$emit("change");
70
182
  });
71
183
  },
72
- methods: {
73
- //添加
74
- addRow() {
75
- var app = this;
76
- if (app.fieldsValidExcute()) {
77
- let newRow = app.model.getCloneRowData(0)
78
- app.model.tableData.push(newRow);
79
- app.model.addSourceRow();
80
- }
81
- },
82
- //删除
83
- deleteRow(index) {
84
- var self = this;
85
- this.model.deleteRow(index + 1, () => {
86
- if (self.model.tableData[index].isNewFlag) {
87
- self.model.tableData.splice(index, 1);
88
- }
89
- else {
90
- self.model.tableData[index].deleted = true;
184
+ fieldsValidExcute() {
185
+ var self = this;
186
+ var rtnBool = true;
187
+ if (typeof self.$refs.Fields !== "undefined") {
188
+ self.$refs.Fields.forEach((f) => {
189
+ if (typeof f.validExcute !== "undefined") {
190
+ if (!f.validExcute()) {
191
+ rtnBool = false;
192
+ }
91
193
  }
92
- self.$forceUpdate();
93
- self.model.change = self.model.formListChange;
94
- self.$emit('change');
95
194
  });
96
- },
97
- fieldsValidExcute() {
98
- var self = this;
99
- var rtnBool = true;
100
- if (typeof self.$refs.Fields !== 'undefined') {
101
- self.$refs.Fields.forEach((f) => {
102
- if (typeof f.validExcute !== 'undefined') {
195
+ }
196
+ return rtnBool;
197
+ },
198
+ validExcute() {
199
+ var self = this;
200
+ var rtnBool = true;
201
+ if (this.model.show) {
202
+ if (!self.fieldsValidExcute()) {
203
+ rtnBool = false;
204
+ } else if (this.model.tableData.length < this.model.min) {
205
+ self.$message({
206
+ message: this.model.title + " 最少需要" + this.model.min + "条数据",
207
+ type: "warning",
208
+ showClose: true,
209
+ });
210
+ rtnBool = false;
211
+ }
212
+ if (
213
+ rtnBool &&
214
+ self.model.required &&
215
+ this.model.tableData.length === 0
216
+ ) {
217
+ self.$message({
218
+ message: this.model.title + " 表格不能为空",
219
+ type: "warning",
220
+ showClose: true,
221
+ });
222
+ rtnBool = false;
223
+ }
224
+ }
225
+ return rtnBool;
226
+ },
227
+ fieldClickHandler() {},
228
+ changeHandler(field, rowindex, index, guid) {
229
+ var self = this;
230
+ self.model.hiddenHandle(field, index);
231
+ self.model.requiredHandle(field, index);
232
+ self.model.change = field.change;
233
+ self.model.input = field.input; //当前小组件事件作为大组件事件
234
+ self.model.currentRowIndex = this.model.source.rows.findIndex(
235
+ (v) => v.$sourceIndex === guid
236
+ );
237
+ self.model.currentEventField = field;
238
+ self.model.currentRow.data = self.model.getCurrentRowData(guid);
239
+ self.model.currentRow.index = index;
240
+
241
+ self.$emit("change");
242
+ if (field.type !== 19) {
243
+ self.$forceUpdate();
244
+ }
245
+ },
246
+ inputHandler(field, rowindex, index) {
247
+ var self = this;
248
+ self.model.input = field.input; //当前小组件事件作为大组件事件
249
+ self.$emit("input");
250
+ },
251
+
252
+ popupSearchListHandler(field, index) {
253
+ var self = this;
254
+ var submitData = {};
255
+ var verified = true;
256
+ var flagSearchlist = false;
257
+ var tempFormData = self.model.getFormObj();
258
+ var router = field.moreActionRouter;
259
+ var check = true;
260
+ var checkMsg;
261
+ router.submitFormField.forEach((v) => {
262
+ self.model.tableData[index].field.forEach((f) => {
263
+ if (f.model && f.model.id === v) {
264
+ if (typeof f.validExcute !== "undefined") {
103
265
  if (!f.validExcute()) {
104
- rtnBool = false;
266
+ if (f.validMessage) {
267
+ if (f.validMessage == "必填") {
268
+ self.$message({
269
+ message: "【" + f.model.label + "】" + f.validMessage,
270
+ type: "error",
271
+ showClose: true,
272
+ });
273
+ } else {
274
+ self.$message({
275
+ message: f.validMessage,
276
+ type: "error",
277
+ showClose: true,
278
+ });
279
+ }
280
+ } else {
281
+ self.$message({
282
+ message: "【" + f.model.label + "】不能为空!",
283
+ type: "error",
284
+ showClose: true,
285
+ });
286
+ }
287
+ verified = false;
288
+ return;
105
289
  }
106
290
  }
107
- });
108
- }
109
- return rtnBool;
110
- },
111
- validExcute() {
112
- var self = this;
113
- var rtnBool = true;
114
- if (this.model.show) {
115
- if (!self.fieldsValidExcute()) {
116
- rtnBool = false;
117
- }
118
- else if (this.model.tableData.length < this.model.min) {
119
- self.$message({
120
- message: this.model.title + " 最少需要" + this.model.min + "条数据",
121
- type: 'warning',
122
- showClose: true,
123
- });
124
- rtnBool = false;
125
291
  }
126
- if (rtnBool && self.model.required && this.model.tableData.length === 0) {
127
- self.$message({
128
- message: this.model.title + " 表格不能为空",
129
- type: 'warning',
130
- showClose: true,
131
- });
132
- rtnBool = false;
292
+ });
293
+ if (!verified) {
294
+ return;
295
+ }
296
+ submitData[v] = self.$common.getDataOfUpperLower(
297
+ tempFormData[self.model.id][index],
298
+ v
299
+ );
300
+ if (!submitData[v]) {
301
+ var row = self.model.tableData[index].field.filter((value) => {
302
+ return self.$common.initialsToLowerCase(value.id) === v;
303
+ });
304
+ if (row[0].value == "") {
305
+ checkMsg = "请先录入" + row[0].label;
306
+ } else {
307
+ checkMsg = "未读取到表单项(" + v + ")的值";
133
308
  }
309
+ check = false;
134
310
  }
135
- return rtnBool;
136
- },
137
- changeHandler(field, rowindex,index) {
138
- var self = this;
139
- this.model.change = field.change;
140
- self.$emit('change');
141
- },
142
- inputHandler(field, rowindex, index) {
143
- var self = this;
144
- this.model.input = field.input;//当前小组件事件作为大组件事件
145
- self.$emit('input');
146
- },
147
- }
148
- }
149
- </script>
150
- <style>
151
- .ct-form-repeat {
152
- display: table;
153
- background: aliceblue;
154
- padding:10px;
155
- }
156
-
157
- .ct-form-repeat .list-title {
158
- padding-bottom: 5px;
159
- text-align: left;
160
- display: inline-table;
161
- width: 45%;
162
- }
311
+ });
312
+ if (!verified) {
313
+ return;
314
+ }
163
315
 
164
- .ct-form-repeat .list-button {
165
- padding-bottom: 5px;
166
- text-align: right;
167
- display: inline-table;
168
- float: right;
169
- }
170
- .ct-form-repeat .ct-form-repeat-el-col {
171
- border-bottom: 1px dashed #f1706b;
172
- }
173
- .ct-form-repeat .ct-form-repeat-el-col:last-child {
174
- border-bottom: none;
316
+ if (!check) {
317
+ self.$message({
318
+ message: checkMsg,
319
+ type: "warning",
320
+ showClose: true,
321
+ });
322
+ return;
323
+ }
324
+ if (router.id.indexOf("_") === 0) {
325
+ flagSearchlist = true;
175
326
  }
176
327
 
328
+ submitData = router.getActionPara(submitData).para;
329
+ var dialogOption = {
330
+ title: router.pageTitle,
331
+ pane: self.$common.getParentPane(self),
332
+ content: [
333
+ {
334
+ component: flagSearchlist ? "ct-searchlist" : "ct-popupSearchList",
335
+ attrs: {
336
+ searchConditionApi: router.actionForSearchLayout,
337
+ searchFormApi: router.actionForSearchLayout,
338
+ searchDataApi: router.actionForSearch,
339
+ apiParam: submitData,
340
+ singleSelectio: true,
341
+ width: router.dialogWidth + "px",
342
+ height: (router.dialogHeight || 500) + "px",
343
+ documentHeight: self.documentHeight,
344
+ documentWidth: self.documentWidth,
345
+ flagPopupSearchlist: flagSearchlist,
346
+ },
347
+ on: {
348
+ submit(option) {
349
+ field.value = option[field.optionAttrs.value];
350
+ field.text = option[field.optionAttrs.label];
351
+ field.options.push(option);
352
+ },
353
+ },
354
+ },
355
+ ],
356
+ };
357
+ this.$common.openDialog(dialogOption);
358
+ },
359
+ },
360
+ };
361
+ </script>
362
+ <style>
363
+ .ct-form-repeat {
364
+ display: table;
365
+ background: aliceblue;
366
+ padding: 10px;
367
+ width: 100%;
368
+ }
369
+
370
+ .ct-form-repeat .list-title {
371
+ padding-bottom: 5px;
372
+ text-align: left;
373
+ display: inline-table;
374
+ width: 45%;
375
+ }
177
376
 
377
+ .ct-form-repeat .list-button {
378
+ padding-bottom: 5px;
379
+ text-align: right;
380
+ display: inline-table;
381
+ float: right;
382
+ }
383
+ .ct-form-repeat .ct-form-repeat-el-col {
384
+ border-bottom: 1px dashed #f1706b;
385
+ }
386
+ .ct-form-repeat .ct-form-repeat-el-col:last-child {
387
+ border-bottom: none;
388
+ }
178
389
  </style>
@@ -16,7 +16,7 @@
16
16
  @loaded="tableLoaded" :documentWidth="documentWidth" :flagPopupSearchlist="flagPopupSearchlist" :screenTop="screenTop" :flagAppMode="flagAppMode"
17
17
  @toolbarClick="toolbarClickHandler" @refreshParent="refreshParentHandler" :key="reloadKeyTable" @searchComplate="searchComplate" @closeSideBar="closeSideBar"
18
18
  @rowClickHandle="rowClickHandle" @scrollHandle="scrollHandle" @refreshRowHandle="refreshRowHandle" @doClosePopoverHandle="doClosePopoverHandle"
19
- @showTitle="showTitleHandler" @popupClickHandler="popupClickHandler"></ct-searchtable>
19
+ @showTitle="showTitleHandler" @popupClickHandler="popupClickHandler" @simpleRouterRefreshHandler="simpleRouterRefreshHandler"></ct-searchtable>
20
20
  </div>
21
21
  <div ref="sidebar" v-if="flagSideBar && flagSideBarOfData"
22
22
  :style="{'height': pageHeight? pageHeight:'100%','width':sideBarWidth+'px',right:sideBarRight+'px'}"
@@ -380,6 +380,10 @@
380
380
  this.selectIndex=-1;
381
381
  this.rowClickHandle();
382
382
  },
383
+ simpleRouterRefreshHandler() {
384
+ this.selectIndex=-1;
385
+ this.rowClickHandle();
386
+ },
383
387
  saveShortcut(){
384
388
  this.$refs.table.getPage(1);
385
389
  },
@@ -7,8 +7,13 @@
7
7
  <component v-else class="list-field max-list-field" v-bind="col.listBind" :is="col.is" :vmodel="col" :api="model.optionApi" :key="col.keyScreen" :actionRouters="model.actionRouters"
8
8
  @click="clickHandler(col)" @change="changeHandler(col,$event)"></component>
9
9
  </template>
10
- <component v-for="(col, index) in model.btnScreen" :key="index" :is="col.is" :vmodel="col" :api="model.optionApi" :actionRouters="model.actionRouters"
11
- @click="clickHandler(col)" @change="changeHandler(col,$event)" @SaveSearchWhere="SaveSearchWhere" @SearchWhereManage="SearchWhereManage" @clichSearchWhere="clichSearchWhere"></component>
10
+ <template v-for="(col, index) in model.btnScreen" v-if="col.show !== false">
11
+ <component v-if="col.type===16 || col.type===17 || col.type===18" :key="index" :is="col.is" :vmodel="col" :api="model.optionApi" :actionRouters="model.actionRouters"
12
+ @click="clickHandler(col)" @change="changeHandler(col,$event)" @SaveSearchWhere="SaveSearchWhere" @SearchWhereManage="SearchWhereManage" @clichSearchWhere="clichSearchWhere"></component>
13
+ <br v-else-if="col.is === 'ct-linefeed'" />
14
+ <component v-else class="list-field max-list-field" v-bind="col.listBind" :is="col.is" :vmodel="col" :api="model.optionApi" :key="col.keyScreen" :actionRouters="model.actionRouters"
15
+ @click="clickHandler(col)" @change="changeHandler(col,$event)"></component>
16
+ </template>
12
17
  </div>
13
18
  <div class="shortcutFollow max-shortcutFollow" style="padding-left: 20px;" v-if="model.shortcutForm">
14
19
  <ct-form :source="model.shortcutForm.code1" @submit="saveShortcut" :openType="'detail'"></ct-form>
@@ -17,7 +22,8 @@
17
22
  <div style="width:100%">
18
23
  <template v-for="(col, index) in highScreenRow" v-if="col.show !== false">
19
24
  <br v-if="col.is === 'ct-linefeed'" />
20
- <component v-else class="list-field" v-bind="col.listBind" :key="col.keyScreen" :is="col.is" :vmodel="col" :api="model.optionApi" :actionRouters="model.actionRouters" @click="clickHandler(col)"></component>
25
+ <component v-else class="list-field" v-bind="col.listBind" :key="col.keyScreen" :is="col.is" :vmodel="col" :api="model.optionApi" :actionRouters="model.actionRouters"
26
+ @click="clickHandler(col)" @change="changeHandler(col,$event)"></component>
21
27
  </template>
22
28
  </div>
23
29
  </div>
@@ -456,33 +462,33 @@ import dynamicElement from '../../mixins/dynamicElement';
456
462
  }
457
463
  else {
458
464
  if (field.action.indexOf("http://") === 0 || field.action.indexOf("https://") === 0) {
459
- //var tempwindow = window.open('about:blank');
460
- //tempwindow.location = field.action;
461
- if (field.action.indexOf("?") > -1) {
462
- self.downloadUrl = field.action + "&" + Math.random();
465
+ if(field.action.indexOf(".zip") > -1){
466
+ window.location.href = encodeURI(field.action);
463
467
  }
464
- else {
465
- self.downloadUrl = field.action + "?" + Math.random();
468
+ else{
469
+ if (field.action.indexOf("?") > -1) {
470
+ self.downloadUrl = field.action + "&" + Math.random();
471
+ }
472
+ else {
473
+ self.downloadUrl = field.action + "?" + Math.random();
474
+ }
466
475
  }
467
- // document.body.addEventListener('click', function() {
468
- // window.open(field.action, "_blank");
469
- // });
470
476
  }
471
477
  else {
472
478
  field.doAction(submitData, (data) => {
473
479
  if (data.content) {
474
480
  if (data.content.indexOf("http://") === 0 || data.content.indexOf("https://") === 0) {
475
- //var tempwindow = window.open('about:blank');
476
- //tempwindow.location = data.content;
477
- if (data.content.indexOf("?") > -1) {
478
- self.downloadUrl = data.content + "&" + Math.random();
481
+ if(data.action.indexOf(".zip") > -1){
482
+ window.location.href = encodeURI(data.action);
479
483
  }
480
- else {
481
- self.downloadUrl = data.content + "?" + Math.random();
484
+ else{
485
+ if (data.content.indexOf("?") > -1) {
486
+ self.downloadUrl = data.content + "&" + Math.random();
487
+ }
488
+ else {
489
+ self.downloadUrl = data.content + "?" + Math.random();
490
+ }
482
491
  }
483
- // document.body.addEventListener('click', function() {
484
- // window.open(data.content, "_blank");
485
- // });
486
492
  }
487
493
  else {
488
494
  }