doway-coms 1.3.4 → 1.3.6

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,213 +1,213 @@
1
1
  <template>
2
- <div class="d-form-items">
3
- <div
4
- class="d-form-item"
5
- v-for="col in internalComputedHiddenCols"
6
- :key="col.field"
7
- >
8
- <!-- 文本框输入控件 -->
9
- <BaseInput
10
- v-if="
11
- col.controlType === 'text' &&
12
- (col.isButtonShow == false || col.isButtonShow == undefined)
13
- "
14
- :label="col.title"
15
- v-model="row[col.field]"
16
- :edit="col.edit"
17
- :tooltip="col.tooltip"
18
- :rules="col.rules"
19
- @change="
20
- () => {
21
- inputChange(col);
22
- }
23
- "
24
- @blur="
25
- () => {
26
- blurChange(col);
27
- }
28
- "
29
- />
30
- <!-- 按钮弹出框输入控件 -->
31
- <!-- isButtonShow字段是额外添加字段,用于控制区分输入框控件 -->
32
- <base-button
33
- v-if="col.isButtonShow == true"
34
- v-model="row[col.field]"
35
- :colInfo="col"
36
- :row="row"
37
- :formRow="formRow"
38
- @preSearch="preSearch"
39
- @handleOk="
40
- value => {
41
- buttonHandleOk(col, value);
42
- }
43
- "
44
- />
45
- <!-- 文本框输入控件 -->
46
- <BaseTextArea
47
- v-if="
48
- col.controlType === 'textarea' &&
49
- (col.isButtonShow == false || col.isButtonShow == undefined)
50
- "
51
- :label="col.title"
52
- v-model="row[col.field]"
53
- :edit="col.edit"
54
- :tooltip="col.tooltip"
55
- :rules="col.rules"
56
- @change="
57
- () => {
58
- inputChange(col);
59
- }
60
- "
61
- />
62
- <!-- 数字输入 -->
63
- <BaseNumberInput
64
- v-if="
65
- col.controlType === 'number' &&
66
- (col.isButtonShow == false || col.isButtonShow == undefined)
67
- "
68
- :label="col.title"
69
- v-model="row[col.field]"
70
- :edit="col.edit"
71
- :rules="col.rules"
72
- :min="col.min"
73
- :tooltip="col.tooltip"
74
- :max="col.max"
75
- :precision="col.precision"
76
- @change="
77
- () => {
78
- numberChange(col);
79
- }
80
- "
81
- @blur="
82
- () => {
83
- blurChange(col);
84
- }
85
- "
86
- />
87
- <BaseIntervalInput
88
- v-if="
89
- col.controlType === 'interval' &&
90
- (col.isButtonShow == false || col.isButtonShow == undefined)
91
- "
92
- :label="col.title"
93
- v-model="row[col.field]"
94
- :edit="col.edit"
95
- :rules="col.rules"
96
- :tooltip="col.tooltip"
97
- :displayType="col.displayType"
98
- :valueType="col.valueType"
99
- @change="
100
- () => {
101
- numberChange(col);
102
- }
103
- "
104
- />
105
- <!-- 日期选择控件 -->
106
- <BaseDate
107
- v-if="
108
- col.controlType === 'date' &&
109
- (col.isButtonShow == false || col.isButtonShow == undefined)
110
- "
111
- :label="col.title"
112
- v-model="row[col.field]"
113
- :edit="col.edit"
114
- :tooltip="col.tooltip"
115
- :pastDate="col.pastDate"
116
- :rules="col.rules"
117
- @change="
118
- () => {
119
- inputChange(col);
120
- }
121
- "
122
- />
123
- <!-- 日期时间控件 -->
124
- <BaseDatetime
125
- v-if="
126
- col.controlType === 'datetime' &&
127
- (col.isButtonShow == false || col.isButtonShow == undefined)
128
- "
129
- :label="col.title"
130
- v-model="row[col.field]"
131
- :pastDate="col.pastDate"
132
- :tooltip="col.tooltip"
133
- :edit="col.edit"
134
- :rules="col.rules"
135
- @change="
136
- () => {
137
- inputChange(col);
138
- }
139
- "
140
- />
141
- <!-- 单选框 -->
142
- <BaseCheckbox
143
- v-if="
144
- col.controlType === 'checkbox' &&
145
- (col.isButtonShow == false || col.isButtonShow == undefined)
146
- "
147
- :label="col.title"
148
- v-model="row[col.field]"
149
- :edit="col.edit"
150
- :tooltip="col.tooltip"
151
- :rules="col.rules"
152
- @change="
153
- rowInfo => {
154
- checkboxChange(col);
155
- }
156
- "
157
- />
158
- <BaseTime
159
- v-if="
160
- col.controlType === 'time' &&
161
- (col.isButtonShow == false || col.isButtonShow == undefined)
162
- "
163
- :label="col.title"
164
- v-model="row[col.field]"
165
- :tooltip="col.tooltip"
166
- :edit="col.edit"
167
- :rules="col.rules"
168
- @change="
169
- () => {
170
- inputChange(col);
171
- }
172
- "
173
- />
174
- <BaseDateWeek
175
- v-if="
176
- col.controlType === 'dateweek' &&
177
- (col.isButtonShow == false || col.isButtonShow == undefined)
178
- "
179
- :label="col.title"
180
- v-model="row[col.field]"
181
- :edit="col.edit"
182
- :tooltip="col.tooltip"
183
- :rules="col.rules"
184
- @change="
185
- () => {
186
- inputChange(col);
187
- }
188
- "
189
- />
190
- <BaseSelect
191
- v-if="
192
- col.controlType === 'select' &&
193
- (col.isButtonShow == false || col.isButtonShow == undefined)
194
- "
195
- :label="col.title"
196
- v-model="row[col.field]"
197
- :edit="col.edit"
198
- :rules="col.rules"
199
- :tooltip="col.tooltip"
200
- :dataSource="col.dataSource"
201
- @change="
202
- rowInfo => {
203
- selectChange(col);
204
- }
205
- "
206
- />
207
- <BaseSelectMulti
2
+ <div class="d-form-items">
3
+ <div
4
+ class="d-form-item"
5
+ v-for="col in internalComputedHiddenCols"
6
+ :key="col.field"
7
+ >
8
+ <!-- 文本框输入控件 -->
9
+ <BaseInput
10
+ v-if="
11
+ col.controlType === 'text' &&
12
+ (col.isButtonShow == false || col.isButtonShow == undefined)
13
+ "
14
+ :label="col.title"
15
+ v-model="row[col.field]"
16
+ :edit="col.edit"
17
+ :tooltip="col.tooltip"
18
+ :rules="col.rules"
19
+ @change="
20
+ () => {
21
+ inputChange(col);
22
+ }
23
+ "
24
+ @blur="
25
+ () => {
26
+ blurChange(col);
27
+ }
28
+ "
29
+ />
30
+ <!-- 按钮弹出框输入控件 -->
31
+ <!-- isButtonShow字段是额外添加字段,用于控制区分输入框控件 -->
32
+ <base-button
33
+ v-if="col.isButtonShow == true"
34
+ v-model="row[col.field]"
35
+ :colInfo="col"
36
+ :row="row"
37
+ :formRow="formRow"
38
+ @preSearch="preSearch"
39
+ @handleOk="
40
+ (value) => {
41
+ buttonHandleOk(col, value);
42
+ }
43
+ "
44
+ />
45
+ <!-- 文本框输入控件 -->
46
+ <BaseTextArea
47
+ v-if="
48
+ col.controlType === 'textarea' &&
49
+ (col.isButtonShow == false || col.isButtonShow == undefined)
50
+ "
51
+ :label="col.title"
52
+ v-model="row[col.field]"
53
+ :edit="col.edit"
54
+ :tooltip="col.tooltip"
55
+ :rules="col.rules"
56
+ @change="
57
+ () => {
58
+ inputChange(col);
59
+ }
60
+ "
61
+ />
62
+ <!-- 数字输入 -->
63
+ <BaseNumberInput
64
+ v-if="
65
+ col.controlType === 'number' &&
66
+ (col.isButtonShow == false || col.isButtonShow == undefined)
67
+ "
68
+ :label="col.title"
69
+ v-model="row[col.field]"
70
+ :edit="col.edit"
71
+ :rules="col.rules"
72
+ :min="col.min"
73
+ :tooltip="col.tooltip"
74
+ :max="col.max"
75
+ :precision="col.precision"
76
+ @change="
77
+ () => {
78
+ numberChange(col);
79
+ }
80
+ "
81
+ @blur="
82
+ () => {
83
+ blurChange(col);
84
+ }
85
+ "
86
+ />
87
+ <BaseIntervalInput
88
+ v-if="
89
+ col.controlType === 'interval' &&
90
+ (col.isButtonShow == false || col.isButtonShow == undefined)
91
+ "
92
+ :label="col.title"
93
+ v-model="row[col.field]"
94
+ :edit="col.edit"
95
+ :rules="col.rules"
96
+ :tooltip="col.tooltip"
97
+ :displayType="col.displayType"
98
+ :valueType="col.valueType"
99
+ @change="
100
+ () => {
101
+ numberChange(col);
102
+ }
103
+ "
104
+ />
105
+ <!-- 日期选择控件 -->
106
+ <BaseDate
107
+ v-if="
108
+ col.controlType === 'date' &&
109
+ (col.isButtonShow == false || col.isButtonShow == undefined)
110
+ "
111
+ :label="col.title"
112
+ v-model="row[col.field]"
113
+ :edit="col.edit"
114
+ :tooltip="col.tooltip"
115
+ :pastDate="col.pastDate"
116
+ :rules="col.rules"
117
+ @change="
118
+ () => {
119
+ inputChange(col);
120
+ }
121
+ "
122
+ />
123
+ <!-- 日期时间控件 -->
124
+ <BaseDatetime
125
+ v-if="
126
+ col.controlType === 'datetime' &&
127
+ (col.isButtonShow == false || col.isButtonShow == undefined)
128
+ "
129
+ :label="col.title"
130
+ v-model="row[col.field]"
131
+ :pastDate="col.pastDate"
132
+ :tooltip="col.tooltip"
133
+ :edit="col.edit"
134
+ :rules="col.rules"
135
+ @change="
136
+ () => {
137
+ inputChange(col);
138
+ }
139
+ "
140
+ />
141
+ <!-- 单选框 -->
142
+ <BaseCheckbox
143
+ v-if="
144
+ col.controlType === 'checkbox' &&
145
+ (col.isButtonShow == false || col.isButtonShow == undefined)
146
+ "
147
+ :label="col.title"
148
+ v-model="row[col.field]"
149
+ :edit="col.edit"
150
+ :tooltip="col.tooltip"
151
+ :rules="col.rules"
152
+ @change="
153
+ (rowInfo) => {
154
+ checkboxChange(col);
155
+ }
156
+ "
157
+ />
158
+ <BaseTime
159
+ v-if="
160
+ col.controlType === 'time' &&
161
+ (col.isButtonShow == false || col.isButtonShow == undefined)
162
+ "
163
+ :label="col.title"
164
+ v-model="row[col.field]"
165
+ :tooltip="col.tooltip"
166
+ :edit="col.edit"
167
+ :rules="col.rules"
168
+ @change="
169
+ () => {
170
+ inputChange(col);
171
+ }
172
+ "
173
+ />
174
+ <BaseDateWeek
175
+ v-if="
176
+ col.controlType === 'dateweek' &&
177
+ (col.isButtonShow == false || col.isButtonShow == undefined)
178
+ "
179
+ :label="col.title"
180
+ v-model="row[col.field]"
181
+ :edit="col.edit"
182
+ :tooltip="col.tooltip"
183
+ :rules="col.rules"
184
+ @change="
185
+ () => {
186
+ inputChange(col);
187
+ }
188
+ "
189
+ />
190
+ <BaseSelect
191
+ v-if="
192
+ col.controlType === 'select' &&
193
+ (col.isButtonShow == false || col.isButtonShow == undefined)
194
+ "
195
+ :label="col.title"
196
+ v-model="row[col.field]"
197
+ :edit="col.edit"
198
+ :rules="col.rules"
199
+ :tooltip="col.tooltip"
200
+ :dataSource="col.dataSource"
201
+ @change="
202
+ (rowInfo) => {
203
+ selectChange(col);
204
+ }
205
+ "
206
+ />
207
+ <BaseSelectMulti
208
208
  v-if="
209
209
  col.controlType === 'dropmulti' &&
210
- (col.isButtonShow == false || col.isButtonShow == undefined)
210
+ (col.isButtonShow == false || col.isButtonShow == undefined)
211
211
  "
212
212
  :label="col.title"
213
213
  v-model="row[col.field]"
@@ -215,449 +215,447 @@
215
215
  :tooltip="col.tooltip"
216
216
  :rules="col.rules"
217
217
  @change="
218
- rowInfo => {
218
+ (rowInfo) => {
219
219
  selectMultiChange(col);
220
220
  }
221
221
  "
222
222
  :dataSource="col.dataSource"
223
223
  />
224
- <BasePulldown
225
- v-if="
226
- col.controlType === 'pulldown' &&
227
- (col.isButtonShow == false || col.isButtonShow == undefined)
228
- "
229
- :formRow="formRow"
230
- :isOld="isOld"
231
- :edit="col.edit"
232
- :defaultExpression="col.defaultExpression"
233
- :row="row"
234
- :api="col.api"
235
- :tooltip="col.tooltip"
236
- :optBtns="col.optBtns"
237
- :popupAddName="col.popupAddName"
238
- :popupAddPath="col.popupAddPath"
239
- @pulldownBtnClick="pulldownBtnClick"
240
- :label="col.title"
241
- :rules="col.rules"
242
- :route="col.route"
243
- v-model="row[col.field]"
244
- :field="col.field"
245
- :columns="col.columns"
246
- :pageSize="col.pageSize"
247
- :immediate="col.immediate"
248
- @preSearch="preSearch"
249
- @selectChanged="
250
- rowInfo => {
251
- pullDownChange(col, rowInfo);
252
- }
253
- "
254
- />
255
- </div>
256
- <div class="d-form-item-ghost"></div>
257
- <div class="d-form-item-ghost"></div>
258
- <div class="d-form-item-ghost"></div>
259
- <div class="d-form-item-ghost"></div>
224
+ <BasePulldown
225
+ v-if="
226
+ col.controlType === 'pulldown' &&
227
+ (col.isButtonShow == false || col.isButtonShow == undefined)
228
+ "
229
+ :formRow="formRow"
230
+ :isOld="isOld"
231
+ :edit="col.edit"
232
+ :defaultExpression="col.defaultExpression"
233
+ :row="row"
234
+ :api="col.api"
235
+ :tooltip="col.tooltip"
236
+ :optBtns="col.optBtns"
237
+ :popupAddName="col.popupAddName"
238
+ :popupAddPath="col.popupAddPath"
239
+ @pulldownBtnClick="pulldownBtnClick"
240
+ :label="col.title"
241
+ :rules="col.rules"
242
+ :route="col.route"
243
+ v-model="row[col.field]"
244
+ :field="col.field"
245
+ :columns="col.columns"
246
+ :pageSize="col.pageSize"
247
+ :immediate="col.immediate"
248
+ @preSearch="preSearch"
249
+ @selectChanged="
250
+ (rowInfo) => {
251
+ pullDownChange(col, rowInfo);
252
+ }
253
+ "
254
+ />
260
255
  </div>
261
- </template>
256
+ <div class="d-form-item-ghost"></div>
257
+ <div class="d-form-item-ghost"></div>
258
+ <div class="d-form-item-ghost"></div>
259
+ <div class="d-form-item-ghost"></div>
260
+ </div>
261
+ </template>
262
262
 
263
263
  <script>
264
- import { sysFormState, sysRowState } from '../../utils/enum'
265
- import BaseInput from '../../BaseInput/index';
266
- import BaseCheckbox from '../../BaseCheckbox/index';
267
- import BaseDate from '../../BaseDate/index';
268
- import BaseDatetime from '../../BaseDatetime/index';
269
- import BaseDateWeek from '../../BaseDateWeek/index';
270
- import BaseTextArea from '../../BaseTextArea/index';
271
- import BaseSelect from '../../BaseSelect/index';
272
- import BaseSelectMulti from '../../BaseSelectMulti/index';
273
- import BaseTime from '../../BaseTime/index';
274
- import BasePulldown from '../../BasePulldown/index';
275
- import BaseIntervalInput from '../../BaseIntervalInput/index';
276
- import BaseNumberInput from '../../BaseNumberInput/index';
277
-
264
+ import { sysFormState, sysRowState } from "../../utils/enum";
265
+ import BaseInput from "../../BaseInput/index";
266
+ import BaseCheckbox from "../../BaseCheckbox/index";
267
+ import BaseDate from "../../BaseDate/index";
268
+ import BaseDatetime from "../../BaseDatetime/index";
269
+ import BaseDateWeek from "../../BaseDateWeek/index";
270
+ import BaseTextArea from "../../BaseTextArea/index";
271
+ import BaseSelect from "../../BaseSelect/index";
272
+ import BaseSelectMulti from "../../BaseSelectMulti/index";
273
+ import BaseTime from "../../BaseTime/index";
274
+ import BasePulldown from "../../BasePulldown/index";
275
+ import BaseIntervalInput from "../../BaseIntervalInput/index";
276
+ import BaseNumberInput from "../../BaseNumberInput/index";
278
277
 
279
- import moment from 'moment'
280
- export default {
281
- components:{
282
- BaseInput,
283
- BaseCheckbox,
284
- BaseDate,
285
- BaseDatetime,
286
- BaseDateWeek,
287
- BaseTextArea,
288
- BaseSelect,
289
- BaseSelectMulti,
290
- BaseTime,
291
- BasePulldown,
292
- BaseIntervalInput,
293
- BaseNumberInput
294
- },
295
- name: 'BaseForm',
296
- props: {
297
- updateDatas: {
298
- // 更新的数据
299
- type: Object,
300
- default: function() {
301
- return {}
302
- }
303
- },
304
- showLoading: {
305
- // 是否显示加载信息
306
- type: Boolean,
307
- default: false
278
+ import moment from "moment";
279
+ export default {
280
+ components: {
281
+ BaseInput,
282
+ BaseCheckbox,
283
+ BaseDate,
284
+ BaseDatetime,
285
+ BaseDateWeek,
286
+ BaseTextArea,
287
+ BaseSelect,
288
+ BaseSelectMulti,
289
+ BaseTime,
290
+ BasePulldown,
291
+ BaseIntervalInput,
292
+ BaseNumberInput,
293
+ },
294
+ name: "BaseForm",
295
+ props: {
296
+ updateDatas: {
297
+ // 更新的数据
298
+ type: Object,
299
+ default: function () {
300
+ return {};
308
301
  },
309
- isOld: {
310
- // 是否老系统
311
- type: Boolean,
312
- default: false
313
- },
314
- valueState: {
315
- type: Object,
316
- default: function() {
317
- return {}
318
- }
302
+ },
303
+ showLoading: {
304
+ // 是否显示加载信息
305
+ type: Boolean,
306
+ default: false,
307
+ },
308
+ isOld: {
309
+ // 是否老系统
310
+ type: Boolean,
311
+ default: false,
312
+ },
313
+ valueState: {
314
+ type: Object,
315
+ default: function () {
316
+ return {};
319
317
  },
320
- formState: {
321
- type: String,
322
- default: sysFormState.view
318
+ },
319
+ formState: {
320
+ type: String,
321
+ default: sysFormState.view,
322
+ },
323
+ formRow: {
324
+ // 当前页面数据集
325
+ type: Object,
326
+ default: () => {
327
+ return {};
323
328
  },
324
- formRow: {
325
- // 当前页面数据集
326
- type: Object,
327
- default: () => {
328
- return {}
329
- }
329
+ },
330
+ row: {
331
+ // 当前行,如果是表单的话当前行和当前页面数据集是一样的
332
+ type: Object,
333
+ default: () => {
334
+ return {};
330
335
  },
331
- row: {
332
- // 当前行,如果是表单的话当前行和当前页面数据集是一样的
333
- type: Object,
334
- default: () => {
335
- return {}
336
- }
336
+ },
337
+ columns: {
338
+ // 表格列信息
339
+ type: Array,
340
+ default: function () {
341
+ return [];
337
342
  },
338
- columns: {
339
- // 表格列信息
340
- type: Array,
341
- default: function() {
342
- return []
343
- }
343
+ },
344
+ dataName: {
345
+ type: String,
346
+ default: function () {
347
+ return "";
344
348
  },
345
- dataName: {
346
- type: String,
347
- default: function() {
348
- return ''
349
+ },
350
+ },
351
+ computed: {
352
+ internalComputedHiddenCols: function () {
353
+ let vm = this;
354
+ return this.columns.filter((item) => {
355
+ // if (item.isTitle === true) {
356
+ // // vm.titleCol = item
357
+ // return false
358
+ // }
359
+ // if (item.controlType === controlType.image) {
360
+ // vm.logoCol = item
361
+ // return false
362
+ // }
363
+ return item.visible === true;
364
+ });
365
+ },
366
+ },
367
+ filters: {},
368
+ data() {
369
+ return {
370
+ moment,
371
+ editFormName: "",
372
+ internalEdit: false,
373
+ internalCols: [],
374
+ internalValueState: {},
375
+ internalFormState: sysFormState.view,
376
+ rules: {},
377
+ titleCols: [],
378
+ logoCol: null,
379
+ isShowEditForm: false,
380
+ ref: "",
381
+ };
382
+ },
383
+ watch: {
384
+ // row: {
385
+ // handler: function (newVal) {
386
+ // },
387
+ // deep: true
388
+ // },
389
+ // cols: {
390
+ // handler: function (newVal) {
391
+ // this.internalCols = newVal
392
+ // },
393
+ // deep: true
394
+ // },
395
+ // valueState: { // 表单值状态,更新,还是插入
396
+ // handler: function (newVal) {
397
+ // this.internalValueState = newVal
398
+ // },
399
+ // deep: true
400
+ // },
401
+ // formState: {
402
+ // handler: function (newVal) {
403
+ // this.internalFormState = newVal
404
+ // this.setColState()
405
+ // },
406
+ // deep: true
407
+ // }
408
+ },
409
+ created() {
410
+ for (let i = 0; i < this.columns.length; i++) {
411
+ // if (this.columns[i].isLogo === true) {
412
+ // this.logoCol = this.columns[i]
413
+ // continue
414
+ // }
415
+ // if (this.columns[i].isTitle === true) {
416
+ // this.titleCols.push(this.columns[i])
417
+ // continue
418
+ // }
419
+ if (this.columns[i].controlType === "popup") {
420
+ let formUrl =
421
+ process.env[
422
+ "VUE_APP_" +
423
+ this.columns[i].linkModuleData.objectService.toUpperCase() +
424
+ "_SERVICE_URL"
425
+ ] +
426
+ "/" +
427
+ this.columns[i].linkModuleData.objectApiVersion +
428
+ "/" +
429
+ this.columns[i].linkModuleData.objectName +
430
+ "/";
431
+ this.columns[i]["api"] = this.columns[i].linkModuleData.objectApiRoute
432
+ ? formUrl + this.columns[i].linkModuleData.objectApiRoute
433
+ : formUrl + "Search";
434
+
435
+ this.columns[i]["columns"] = {};
436
+
437
+ for (
438
+ let x = 0;
439
+ x < this.columns[i].linkModuleData.moduleFields.length;
440
+ x++
441
+ ) {
442
+ let tempField = this.columns[i].linkModuleData.moduleFields[x];
443
+ this.columns[i]["columns"][tempField.field] = {
444
+ title: tempField.caption,
445
+ width: tempField.width,
446
+ visible: tempField.visible,
447
+ linkField: tempField.linkValueField,
448
+ filter: tempField.isFilter,
449
+ };
450
+ if (tempField.field === this.columns[i].linkCaptionField) {
451
+ this.columns[i]["columns"][tempField.field].linkField =
452
+ this.columns[i].field;
453
+ this.columns[i]["columns"][tempField.field].filter = true;
454
+ }
349
455
  }
350
456
  }
457
+
458
+ // this.columns[i]['rules'] = {}
459
+ // if (this.columns[i].isRequire === true) {
460
+ // this.columns[i].rules['required'] = true
461
+ // }
462
+ // if (this.columns[i].maxLength) {
463
+ // this.columns[i].rules['length'] = [0, this.columns[i].maxLength]
464
+ // }
465
+ }
466
+ },
467
+
468
+ mounted() {
469
+ //let letterLength = this.$refs.content.value
470
+ //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
471
+ window.addEventListener("beforeunload", (e) => this.beforeunloadHandler(e));
472
+ },
473
+ destroyed() {
474
+ window.removeEventListener("beforeunload", (e) =>
475
+ this.beforeunloadHandler(e)
476
+ );
477
+ },
478
+ activated() {},
479
+ methods: {
480
+ preSearch(searchInfo, repeatRowInfo) {
481
+ this.$emit("preSearch", searchInfo, repeatRowInfo);
351
482
  },
352
- computed: {
353
- internalComputedHiddenCols: function() {
354
- let vm = this
355
- return this.columns.filter(item => {
356
- // if (item.isTitle === true) {
357
- // // vm.titleCol = item
358
- // return false
359
- // }
360
- // if (item.controlType === controlType.image) {
361
- // vm.logoCol = item
362
- // return false
363
- // }
364
- return item.visible === true
365
- })
483
+ beforeunloadHandler(e) {
484
+ if (this.formState !== "view") {
485
+ e = e || window.event;
486
+ e.returnValue = "提示";
487
+ return confirm("确认退出");
488
+ } else {
489
+ return;
366
490
  }
367
491
  },
368
- filters: {},
369
- data() {
370
- return {
371
- moment,
372
- editFormName: '',
373
- internalEdit: false,
374
- internalCols: [],
375
- internalValueState: {},
376
- internalFormState: sysFormState.view,
377
- rules: {},
378
- titleCols: [],
379
- logoCol: null,
380
- isShowEditForm: false,
381
- ref: ''
492
+ pulldownBtnClick(btnInfo) {
493
+ this.$emit("pulldownBtnClick", btnInfo);
494
+ },
495
+ showToolTip() {},
496
+ fieldCaptionClick(col) {
497
+ // 下拉框
498
+ if (
499
+ col.linkModuleData &&
500
+ col.linkModuleData.linkModuleId &&
501
+ col.linkModuleData.linkModuleOperate.indexOf(sysFormState.view) >= 0
502
+ ) {
503
+ // 查找模块信息
504
+ let linkModule = this.$store.getters.addRouters.filter((filterItem) => {
505
+ return (
506
+ filterItem.meta &&
507
+ filterItem.meta.moduleId === col.linkModuleData.linkModuleId
508
+ );
509
+ });
510
+ if (linkModule.length > 0) {
511
+ this.$router.pushRoute({
512
+ name: linkModule[0].name,
513
+ query: { id: this.row[col.field] },
514
+ });
515
+ }
382
516
  }
383
517
  },
384
- watch: {
385
- // row: {
386
- // handler: function (newVal) {
387
- // },
388
- // deep: true
389
- // },
390
- // cols: {
391
- // handler: function (newVal) {
392
- // this.internalCols = newVal
393
- // },
394
- // deep: true
395
- // },
396
- // valueState: { // 表单值状态,更新,还是插入
397
- // handler: function (newVal) {
398
- // this.internalValueState = newVal
399
- // },
400
- // deep: true
401
- // },
402
- // formState: {
403
- // handler: function (newVal) {
404
- // this.internalFormState = newVal
405
- // this.setColState()
406
- // },
407
- // deep: true
408
- // }
518
+ // selectChange(col) {
519
+ // if (col.field.indexOf('.') < 0) {
520
+ // this.updateDatas[col.field] = this.row[col.field]
521
+ // }
522
+ // if (
523
+ // this.row['sysRowState'] === sysRowState.add ||
524
+ // this.row['sysRowState'] === sysRowState.update
525
+ // ) {
526
+ // return
527
+ // }
528
+ // this.row['sysRowState'] = sysRowState.update
529
+ // },
530
+ pullDownChange(colInfo, row) {
531
+ this.$emit("change", colInfo);
409
532
  },
410
- created() {
411
- for (let i = 0; i < this.columns.length; i++) {
412
- // if (this.columns[i].isLogo === true) {
413
- // this.logoCol = this.columns[i]
414
- // continue
415
- // }
416
- // if (this.columns[i].isTitle === true) {
417
- // this.titleCols.push(this.columns[i])
418
- // continue
419
- // }
420
- if (this.columns[i].controlType === 'popup') {
421
- let formUrl =
422
- process.env[
423
- 'VUE_APP_' +
424
- this.columns[i].linkModuleData.objectService.toUpperCase() +
425
- '_SERVICE_URL'
426
- ] +
427
- '/' +
428
- this.columns[i].linkModuleData.objectApiVersion +
429
- '/' +
430
- this.columns[i].linkModuleData.objectName +
431
- '/'
432
- this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
433
- ? formUrl + this.columns[i].linkModuleData.objectApiRoute
434
- : formUrl + 'Search'
435
-
436
- this.columns[i]['columns'] = {}
437
-
438
- for (
439
- let x = 0;
440
- x < this.columns[i].linkModuleData.moduleFields.length;
441
- x++
442
- ) {
443
- let tempField = this.columns[i].linkModuleData.moduleFields[x]
444
- this.columns[i]['columns'][tempField.field] = {
445
- title: tempField.caption,
446
- width: tempField.width,
447
- visible: tempField.visible,
448
- linkField: tempField.linkValueField,
449
- filter: tempField.isFilter
450
- }
451
- if (tempField.field === this.columns[i].linkCaptionField) {
452
- this.columns[i]['columns'][
453
- tempField.field
454
- ].linkField = this.columns[i].field
455
- this.columns[i]['columns'][tempField.field].filter = true
456
- }
457
- }
458
- }
459
-
460
- // this.columns[i]['rules'] = {}
461
- // if (this.columns[i].isRequire === true) {
462
- // this.columns[i].rules['required'] = true
463
- // }
464
- // if (this.columns[i].maxLength) {
465
- // this.columns[i].rules['length'] = [0, this.columns[i].maxLength]
466
- // }
533
+ selectMultiChange(colInfo, row) {
534
+ this.$emit("change", colInfo);
535
+ },
536
+ selectChange(colInfo) {
537
+ this.$emit("change", colInfo);
538
+ },
539
+ checkboxChange(colInfo) {
540
+ this.$emit("change", colInfo);
541
+ },
542
+ checkBoxChange(col) {
543
+ if (col.field.indexOf(".") < 0) {
544
+ this.updateDatas[col.field] = this.row[col.field];
545
+ }
546
+ this.$emit("change", col);
547
+ if (
548
+ this.row["sysRowState"] === sysRowState.add ||
549
+ this.row["sysRowState"] === sysRowState.update
550
+ ) {
551
+ return;
467
552
  }
553
+ this.row["sysRowState"] = sysRowState.update;
468
554
  },
469
-
470
- mounted() {
471
- //let letterLength = this.$refs.content.value
472
- //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
473
- window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
555
+ dateChange(col) {
556
+ if (col.field.indexOf(".") < 0) {
557
+ this.updateDatas[col.field] = this.row[col.field];
558
+ }
559
+ this.$emit("change", col);
560
+ if (
561
+ this.row["sysRowState"] === sysRowState.add ||
562
+ this.row["sysRowState"] === sysRowState.update
563
+ ) {
564
+ return;
565
+ }
566
+ this.row["sysRowState"] = sysRowState.update;
474
567
  },
475
- destroyed() {
476
- window.removeEventListener('beforeunload', e =>
477
- this.beforeunloadHandler(e)
478
- )
568
+ inputChange(colInfo) {
569
+ // 输入框改变
570
+ this.$emit("change", colInfo);
479
571
  },
480
- activated() {},
481
- methods: {
482
- preSearch(searchInfo, repeatRowInfo) {
483
- this.$emit('preSearch', searchInfo, repeatRowInfo)
484
- },
485
- beforeunloadHandler(e) {
486
- if (this.formState !== 'view') {
487
- e = e || window.event
488
- e.returnValue = '提示'
489
- return confirm('确认退出')
490
- } else {
491
- return
492
- }
493
- },
494
- pulldownBtnClick(btnInfo) {
495
- this.$emit('pulldownBtnClick', btnInfo)
496
- },
497
- showToolTip() {},
498
- fieldCaptionClick(col) {
499
- // 下拉框
500
- if (
501
- col.linkModuleData &&
502
- col.linkModuleData.linkModuleId &&
503
- col.linkModuleData.linkModuleOperate.indexOf(sysFormState.view) >= 0
504
- ) {
505
- // 查找模块信息
506
- let linkModule = this.$store.getters.addRouters.filter(filterItem => {
507
- return (
508
- filterItem.meta &&
509
- filterItem.meta.moduleId === col.linkModuleData.linkModuleId
510
- )
511
- })
512
- if (linkModule.length > 0) {
513
- this.$router.pushRoute({
514
- name: linkModule[0].name,
515
- query: { id: this.row[col.field] }
516
- })
517
- }
518
- }
519
- },
520
- // selectChange(col) {
521
- // if (col.field.indexOf('.') < 0) {
522
- // this.updateDatas[col.field] = this.row[col.field]
523
- // }
524
- // if (
525
- // this.row['sysRowState'] === sysRowState.add ||
526
- // this.row['sysRowState'] === sysRowState.update
527
- // ) {
528
- // return
529
- // }
530
- // this.row['sysRowState'] = sysRowState.update
531
- // },
532
- pullDownChange(colInfo, row) {
533
- this.$emit('change', colInfo)
534
- },
535
- selectMultiChange(colInfo, row) {
536
- this.$emit('change', colInfo)
537
- },
538
- selectChange(colInfo) {
539
- this.$emit('change', colInfo)
540
- },
541
- checkboxChange(colInfo) {
542
- this.$emit('change', colInfo)
543
- },
544
- checkBoxChange(col) {
545
- if (col.field.indexOf('.') < 0) {
546
- this.updateDatas[col.field] = this.row[col.field]
547
- }
548
- this.$emit('change', col)
549
- if (
550
- this.row['sysRowState'] === sysRowState.add ||
551
- this.row['sysRowState'] === sysRowState.update
552
- ) {
553
- return
554
- }
555
- this.row['sysRowState'] = sysRowState.update
556
- },
557
- dateChange(col) {
558
- if (col.field.indexOf('.') < 0) {
559
- this.updateDatas[col.field] = this.row[col.field]
560
- }
561
- this.$emit('change', col)
562
- if (
563
- this.row['sysRowState'] === sysRowState.add ||
564
- this.row['sysRowState'] === sysRowState.update
565
- ) {
566
- return
567
- }
568
- this.row['sysRowState'] = sysRowState.update
569
- },
570
- inputChange(colInfo) {
571
- // 输入框改变
572
- this.$emit('change', colInfo)
573
- },
574
- // 按钮弹出组件返回输入的值
575
- buttonHandleOk(colInfo, value) {
576
- // 按钮弹出确定改变内容改变
577
- this.$emit('buttonHandleOk', colInfo, value)
578
- },
579
- blurChange(colInfo) {
580
- // 输入框失去焦点
581
- this.$emit('blur', colInfo)
582
- },
583
- numberChange(colInfo) {
584
- // 输入框改变
585
- this.$emit('change', colInfo)
586
- },
587
- longtimeChange(data, col) {
588
- this.row[col.field] = data
589
- this.$emit('change', col)
590
- if (
591
- this.row['sysRowState'] === sysRowState.add ||
592
- this.row['sysRowState'] === sysRowState.update
593
- ) {
594
- return
595
- }
596
- this.row['sysRowState'] = sysRowState.update
572
+ // 按钮弹出组件返回输入的值
573
+ buttonHandleOk(colInfo, value) {
574
+ // 按钮弹出确定改变内容改变
575
+ this.$emit("buttonHandleOk", colInfo, value);
576
+ },
577
+ blurChange(colInfo) {
578
+ // 输入框失去焦点
579
+ this.$emit("blur", colInfo);
580
+ },
581
+ numberChange(colInfo) {
582
+ // 输入框改变
583
+ this.$emit("change", colInfo);
584
+ },
585
+ longtimeChange(data, col) {
586
+ this.row[col.field] = data;
587
+ this.$emit("change", col);
588
+ if (
589
+ this.row["sysRowState"] === sysRowState.add ||
590
+ this.row["sysRowState"] === sysRowState.update
591
+ ) {
592
+ return;
597
593
  }
598
- }
599
- }
600
- </script>
594
+ this.row["sysRowState"] = sysRowState.update;
595
+ },
596
+ },
597
+ };
598
+ </script>
601
599
 
602
600
  <style lang="less" scoped>
603
- .form-head {
604
- display: flex;
605
- flex-flow: row wrap;
606
- margin-bottom: 10px;
607
- .form-title {
608
- margin-left: 10px;
609
- }
610
- }
611
- .input-span {
612
- // line-height: 33px;
613
- color: #0b0b0b;
614
- font-size: 12px;
615
- font-weight: normal;
616
- overflow: hidden;
617
- text-overflow: ellipsis;
618
- -o-text-overflow: ellipsis;
619
- display: inline-block;
620
- width: 100%;
621
- height: 32.8px;
622
- white-space: nowrap;
623
- // font-family: "Arial", "Microsoft YaHei";
624
- }
625
- .title-first-input {
626
- width: 200px;
627
- height: 25px;
628
- font-size: 15px;
629
- margin-left: 10px;
630
- font-weight: 500;
631
- }
632
- .title-second-input {
633
- width: 200px;
634
- height: 25px;
635
- font-size: 15px;
601
+ .form-head {
602
+ display: flex;
603
+ flex-flow: row wrap;
604
+ margin-bottom: 10px;
605
+ .form-title {
636
606
  margin-left: 10px;
637
- font-weight: 500;
638
- }
639
- .title-first-value {
640
- width: 200px;
641
- height: 40px;
642
- font-size: 24px;
643
- margin-left: 10px;
644
- font-weight: 700;
645
- }
646
- .title-second-value {
647
- width: 200px;
648
- height: 26px;
649
- font-size: 18px;
650
- margin-left: 10px;
651
- font-weight: 600;
652
- }
653
- .option:hover {
654
- background-color: #219bff;
655
- }
656
- .form {
657
- margin-left: 30px;
658
607
  }
659
- </style>
608
+ }
609
+ .input-span {
610
+ // line-height: 33px;
611
+ color: #0b0b0b;
612
+ font-size: 12px;
613
+ font-weight: normal;
614
+ overflow: hidden;
615
+ text-overflow: ellipsis;
616
+ -o-text-overflow: ellipsis;
617
+ display: inline-block;
618
+ width: 100%;
619
+ height: 32.8px;
620
+ white-space: nowrap;
621
+ // font-family: "Arial", "Microsoft YaHei";
622
+ }
623
+ .title-first-input {
624
+ width: 200px;
625
+ height: 25px;
626
+ font-size: 15px;
627
+ margin-left: 10px;
628
+ font-weight: 500;
629
+ }
630
+ .title-second-input {
631
+ width: 200px;
632
+ height: 25px;
633
+ font-size: 15px;
634
+ margin-left: 10px;
635
+ font-weight: 500;
636
+ }
637
+ .title-first-value {
638
+ width: 200px;
639
+ height: 40px;
640
+ font-size: 24px;
641
+ margin-left: 10px;
642
+ font-weight: 700;
643
+ }
644
+ .title-second-value {
645
+ width: 200px;
646
+ height: 26px;
647
+ font-size: 18px;
648
+ margin-left: 10px;
649
+ font-weight: 600;
650
+ }
651
+ .option:hover {
652
+ background-color: #219bff;
653
+ }
654
+ .form {
655
+ margin-left: 30px;
656
+ }
657
+ </style>
660
658
  <style lang="less">
661
- @import '../../styles/default.less';
662
- </style>
659
+ @import "../../styles/default.less";
660
+ </style>
663
661