doway-coms 2.10.69 → 2.10.70

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.
Files changed (89) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/package.json +54 -54
  4. package/packages/AuditsList/index.js +7 -7
  5. package/packages/AuditsList/src/index.vue +315 -315
  6. package/packages/BaseButton/index.js +7 -7
  7. package/packages/BaseButton/src/index.vue +242 -242
  8. package/packages/BaseCheckbox/index.js +7 -7
  9. package/packages/BaseCheckbox/src/index.vue +134 -134
  10. package/packages/BaseDate/index.js +7 -7
  11. package/packages/BaseDate/src/index.vue +197 -197
  12. package/packages/BaseDateWeek/index.js +7 -7
  13. package/packages/BaseDateWeek/src/index.vue +163 -163
  14. package/packages/BaseDatetime/index.js +7 -7
  15. package/packages/BaseDatetime/src/index.vue +196 -196
  16. package/packages/BaseFileGroup/index.js +7 -7
  17. package/packages/BaseFileGroup/src/index.vue +724 -724
  18. package/packages/BaseForm/index.js +7 -7
  19. package/packages/BaseForm/src/index.vue +871 -871
  20. package/packages/BaseGantt/index.js +9 -9
  21. package/packages/BaseGantt/src/index.vue +617 -617
  22. package/packages/BaseGrid/index.js +9 -9
  23. package/packages/BaseGrid/src/exportCmp.vue +105 -105
  24. package/packages/BaseGrid/src/gridApi.js +32 -32
  25. package/packages/BaseGrid/src/index.vue +4032 -4032
  26. package/packages/BaseGridAdjust/index.js +9 -9
  27. package/packages/BaseGridAdjust/src/index.vue +482 -482
  28. package/packages/BaseInput/index.js +7 -7
  29. package/packages/BaseInput/src/index.vue +194 -164
  30. package/packages/BaseIntervalInput/index.js +7 -7
  31. package/packages/BaseIntervalInput/src/index.vue +310 -310
  32. package/packages/BaseKanbanEmpty/index.js +7 -7
  33. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  34. package/packages/BaseNumberInput/index.js +7 -7
  35. package/packages/BaseNumberInput/src/index.vue +290 -290
  36. package/packages/BasePagination/index.js +7 -7
  37. package/packages/BasePagination/src/index.vue +91 -91
  38. package/packages/BasePictureCard/index.js +7 -7
  39. package/packages/BasePictureCard/src/index.vue +671 -671
  40. package/packages/BasePrintPreview/index.js +7 -7
  41. package/packages/BasePrintPreview/src/index.vue +150 -150
  42. package/packages/BasePulldown/index.js +7 -7
  43. package/packages/BasePulldown/src/index.vue +1392 -1392
  44. package/packages/BaseSearch/index.js +7 -7
  45. package/packages/BaseSearch/src/index.vue +935 -935
  46. package/packages/BaseSelect/index.js +7 -7
  47. package/packages/BaseSelect/src/index.vue +155 -155
  48. package/packages/BaseSelectMulti/index.js +7 -7
  49. package/packages/BaseSelectMulti/src/index.vue +148 -148
  50. package/packages/BaseTextArea/index.js +7 -7
  51. package/packages/BaseTextArea/src/index.vue +178 -178
  52. package/packages/BaseTime/index.js +7 -7
  53. package/packages/BaseTime/src/index.vue +166 -166
  54. package/packages/BaseTool/index.js +7 -7
  55. package/packages/BaseTool/src/index.vue +353 -353
  56. package/packages/BaseToolStatus/index.js +7 -7
  57. package/packages/BaseToolStatus/src/ApprovalPersonsGroup.vue +41 -41
  58. package/packages/BaseToolStatus/src/index.vue +439 -439
  59. package/packages/BaseTreeSelect/index.js +8 -8
  60. package/packages/BaseTreeSelect/src/index.vue +437 -437
  61. package/packages/HistoryModal/index.js +8 -8
  62. package/packages/HistoryModal/src/index.vue +144 -144
  63. package/packages/LeaveAMessage/index.js +7 -7
  64. package/packages/LeaveAMessage/src/index.vue +601 -601
  65. package/packages/directive/clickoutside.js +44 -44
  66. package/packages/index.js +197 -197
  67. package/packages/styles/default.css +78 -78
  68. package/packages/styles/default.less +91 -91
  69. package/packages/utils/api.js +106 -106
  70. package/packages/utils/auth.js +38 -38
  71. package/packages/utils/common.js +636 -636
  72. package/packages/utils/dom.js +181 -181
  73. package/packages/utils/enum.js +86 -86
  74. package/packages/utils/filters.js +485 -485
  75. package/packages/utils/gridFormat.js +66 -66
  76. package/packages/utils/msg.js +84 -84
  77. package/packages/utils/patchFiles.js +44 -44
  78. package/packages/utils/request.js +181 -181
  79. package/packages/utils/store.js +372 -372
  80. package/vue.config.js +59 -59
  81. package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
  82. package/dist/css/index.7946d50b.css +0 -1
  83. package/dist/favicon.ico +0 -0
  84. package/dist/js/chunk-vendors.28fda91d.js +0 -340
  85. package/dist/js/index.49bc6add.js +0 -2
  86. package/lib/doway-coms.common.js +0 -120397
  87. package/lib/doway-coms.css +0 -1
  88. package/lib/doway-coms.umd.js +0 -120407
  89. package/lib/doway-coms.umd.min.js +0 -328
@@ -1,871 +1,871 @@
1
- <template>
2
- <div :style="computedformStyle" class="form-container">
3
- <a-button v-if="showFold===true"
4
- class="collapse-btn"
5
- type="link"
6
- @click="hiddenDetail = !hiddenDetail"
7
- >
8
- <a-icon :type="hiddenDetail ? 'down' : 'up'" class="collapse-icon" />
9
- <!-- {{ hiddenDetail ? '展开' : '收起' }} -->
10
- </a-button>
11
- <div
12
- :style="getFieldStyle(col)"
13
- v-for="(col,colIndex) in internalComputedHiddenCols"
14
- :key="col.field"
15
- v-show="hiddenDetail ? col.foldVisible===true : true"
16
- >
17
- <!-- 文本框输入控件 -->
18
- <BaseInput
19
- v-if="
20
- col.controlType === 'text' &&
21
- (col.isButtonShow == false || col.isButtonShow == undefined)
22
- "
23
- :label="col.title"
24
- v-model="row[col.field]"
25
- :edit="col.edit"
26
- :tooltip="col.tooltip"
27
- :rules="col.rules"
28
- @change="
29
- () => {
30
- inputChange(col)
31
- }
32
- "
33
- @blur="
34
- () => {
35
- blurChange(col)
36
- }
37
- "
38
- />
39
- <!-- 按钮弹出框输入控件 -->
40
- <!-- isButtonShow字段是额外添加字段,用于控制区分输入框控件 -->
41
- <BaseButton
42
- v-if="col.isButtonShow == true"
43
- v-model="row[col.field]"
44
- :colInfo="col"
45
- :row="row"
46
- :formRow="formRow"
47
- @preSearch="preSearch"
48
- @handleOk="
49
- (value) => {
50
- buttonHandleOk(col, value)
51
- }
52
- "
53
- />
54
- <!-- 文本框输入控件 -->
55
- <BaseTextArea
56
- v-if="
57
- col.controlType === 'textarea' &&
58
- (col.isButtonShow == false || col.isButtonShow == undefined)
59
- "
60
- :label="col.title"
61
- v-model="row[col.field]"
62
- :edit="col.edit"
63
- :tooltip="col.tooltip"
64
- :rules="col.rules"
65
- @change="
66
- () => {
67
- inputChange(col)
68
- }
69
- "
70
- />
71
- <!-- 数字输入 -->
72
- <BaseNumberInput
73
- v-if="
74
- col.controlType === 'number' &&
75
- (col.isButtonShow == false || col.isButtonShow == undefined)
76
- "
77
- :label="col.title"
78
- v-model="row[col.field]"
79
- :edit="col.edit"
80
- :rules="col.rules"
81
- :min="col.min"
82
- :tooltip="col.tooltip"
83
- :warnTooltip="col.warnTooltip"
84
- :max="col.max"
85
- :precision="col.precision"
86
- :percent="col.percent"
87
- :doFormat="col.doFormat"
88
- @change="
89
- () => {
90
- numberChange(col)
91
- }
92
- "
93
- @blur="
94
- () => {
95
- blurChange(col)
96
- }
97
- "
98
- />
99
- <BaseIntervalInput
100
- v-if="
101
- col.controlType === 'interval' &&
102
- (col.isButtonShow == false || col.isButtonShow == undefined)
103
- "
104
- :label="col.title"
105
- v-model="row[col.field]"
106
- :edit="col.edit"
107
- :rules="col.rules"
108
- :tooltip="col.tooltip"
109
- :displayType="col.displayType"
110
- :valueType="col.valueType"
111
- @change="
112
- () => {
113
- numberChange(col)
114
- }
115
- "
116
- />
117
- <!-- 日期选择控件 -->
118
- <BaseDate
119
- v-if="
120
- col.controlType === 'date' &&
121
- (col.isButtonShow == false || col.isButtonShow == undefined)
122
- "
123
- :label="col.title"
124
- v-model="row[col.field]"
125
- :edit="col.edit"
126
- :tooltip="col.tooltip"
127
- :pastDate="col.pastDate"
128
- :rules="col.rules"
129
- :disabledDateValue="col.disabledDateValue"
130
- @change="
131
- () => {
132
- inputChange(col)
133
- }
134
- "
135
- />
136
- <!-- 日期时间控件 -->
137
- <BaseDatetime
138
- v-if="
139
- col.controlType === 'datetime' &&
140
- (col.isButtonShow == false || col.isButtonShow == undefined)
141
- "
142
- :label="col.title"
143
- v-model="row[col.field]"
144
- :pastDate="col.pastDate"
145
- :tooltip="col.tooltip"
146
- :edit="col.edit"
147
- :rules="col.rules"
148
- :disabledDateValue="col.disabledDateValue"
149
- @change="
150
- () => {
151
- inputChange(col)
152
- }
153
- "
154
- />
155
- <!-- 单选框 -->
156
- <BaseCheckbox
157
- v-if="
158
- col.controlType === 'checkbox' &&
159
- (col.isButtonShow == false || col.isButtonShow == undefined)
160
- "
161
- :label="col.title"
162
- v-model="row[col.field]"
163
- :edit="col.edit"
164
- :tooltip="col.tooltip"
165
- :rules="col.rules"
166
- @change="
167
- (rowInfo) => {
168
- checkboxChange(col)
169
- }
170
- "
171
- />
172
- <BaseTime
173
- v-if="
174
- col.controlType === 'time' &&
175
- (col.isButtonShow == false || col.isButtonShow == undefined)
176
- "
177
- :label="col.title"
178
- v-model="row[col.field]"
179
- :tooltip="col.tooltip"
180
- :edit="col.edit"
181
- :rules="col.rules"
182
- @change="
183
- () => {
184
- inputChange(col)
185
- }
186
- "
187
- />
188
- <BaseDateWeek
189
- v-if="
190
- col.controlType === 'dateweek' &&
191
- (col.isButtonShow == false || col.isButtonShow == undefined)
192
- "
193
- :label="col.title"
194
- v-model="row[col.field]"
195
- :edit="col.edit"
196
- :tooltip="col.tooltip"
197
- :rules="col.rules"
198
- @change="
199
- () => {
200
- inputChange(col)
201
- }
202
- "
203
- />
204
- <BaseDateMonth
205
- v-if="
206
- col.controlType === 'datemonth' &&
207
- (col.isButtonShow == false || col.isButtonShow == undefined)
208
- "
209
- :label="col.title"
210
- v-model="row[col.field]"
211
- :edit="col.edit"
212
- :tooltip="col.tooltip"
213
- :rules="col.rules"
214
- @change="
215
- () => {
216
- inputChange(col)
217
- }
218
- "
219
- />
220
- <BaseSelect
221
- v-if="
222
- col.controlType === 'select' &&
223
- (col.isButtonShow == false || col.isButtonShow == undefined)
224
- "
225
- :label="col.title"
226
- v-model="row[col.field]"
227
- :edit="col.edit"
228
- :rules="col.rules"
229
- :tooltip="col.tooltip"
230
- :showSearch="true"
231
- :dataSource="col.dataSource"
232
- @change="
233
- (rowInfo) => {
234
- selectChange(col)
235
- }
236
- "
237
- />
238
- <BaseSelectMulti
239
- v-if="
240
- col.controlType === 'dropmulti' &&
241
- (col.isButtonShow == false || col.isButtonShow == undefined)
242
- "
243
- :label="col.title"
244
- v-model="row[col.field]"
245
- :edit="col.edit"
246
- :tooltip="col.tooltip"
247
- :rules="col.rules"
248
- @change="
249
- (rowInfo) => {
250
- selectMultiChange(col)
251
- }
252
- "
253
- :dataSource="col.dataSource"
254
- />
255
- <BasePulldown
256
- v-if="
257
- col.controlType === 'pulldown' &&
258
- (col.isButtonShow == false || col.isButtonShow == undefined)
259
- "
260
- :formRow="formRow"
261
- :isOld="isOld"
262
- :edit="col.edit"
263
- :defaultExpression="col.defaultExpression"
264
- :row="row"
265
- :api="col.api"
266
- :tooltip="col.tooltip"
267
- :optBtns="col.optBtns"
268
- :linkData="col.linkData"
269
- :popupAddName="col.popupAddName"
270
- :popupAddPath="col.popupAddPath"
271
- @pulldownBtnClick="pulldownBtnClick"
272
- :label="col.title"
273
- :rules="col.rules"
274
- :route="col.route"
275
- v-model="row[col.field]"
276
- :field="col.field"
277
- :columns="col.columns"
278
- :pageSize="col.pageSize"
279
- :immediate="col.immediate"
280
- :allowAutoClear="col.allowAutoClear"
281
- @preSearch="preSearch"
282
- @selectChanged="
283
- (rowInfo) => {
284
- pullDownChange(col, rowInfo)
285
- }
286
- "
287
- @confirmMultiSelect="
288
- (pulldownView, selectRows) =>
289
- pulldownMultiSelect(col, pulldownView, selectRows)
290
- "
291
- :dataSource="col.dataSource"
292
- :isMultiSelect="col.isMultiSelect"
293
- :isLocalData="col.isLocalData"
294
- />
295
- <BaseTreeSelect
296
- v-if="
297
- col.controlType === 'treeSelect' &&
298
- (col.isButtonShow == false || col.isButtonShow == undefined)
299
- "
300
- :formRow="formRow"
301
- :api="col.api"
302
- :tooltip="col.tooltip"
303
- :row="row"
304
- :edit="col.edit"
305
- :label="col.title"
306
- :rules="col.rules"
307
- :route="col.route"
308
- :field="col.field"
309
- :columns="col.columns"
310
- @preSearch="preSearch"
311
- :replaceFields="col.replaceFields"
312
- :treeWidth="col.treeWidth"
313
- :width="col.width"
314
- :linkedField="col.linkedField"
315
- :showSearch="col.showSearch"
316
- :allowClear="col.allowClear"
317
- :placeholder="col.placeholder"
318
- :linkedTitle="col.linkedTitle"
319
- :method="col.method"
320
- v-model="row[col.field]"
321
- @change="
322
- () => {
323
- inputChange(col)
324
- }
325
- "
326
- />
327
- </div>
328
- <template v-if="layoutType==='default'">
329
- <!-- <div class="d-form-item-ghost"></div>
330
- <div class="d-form-item-ghost"></div>
331
- <div class="d-form-item-ghost"></div>
332
- <div class="d-form-item-ghost"></div> -->
333
- </template>
334
- </div>
335
- </template>
336
-
337
- <script>
338
- import XEUtils from 'xe-utils'
339
- import { sysFormState, sysRowState } from '../../utils/enum'
340
- import BaseInput from '../../BaseInput/index'
341
- import BaseCheckbox from '../../BaseCheckbox/index'
342
- import BaseDate from '../../BaseDate/index'
343
- import BaseDatetime from '../../BaseDatetime/index'
344
- import BaseDateWeek from '../../BaseDateWeek/index'
345
- import BaseTextArea from '../../BaseTextArea/index'
346
- import BaseButton from '../../BaseButton/index'
347
- import BaseSelect from '../../BaseSelect/index'
348
- import BaseSelectMulti from '../../BaseSelectMulti/index'
349
- import BaseTime from '../../BaseTime/index'
350
- import BasePulldown from '../../BasePulldown/index'
351
- import BaseIntervalInput from '../../BaseIntervalInput/index'
352
- import BaseNumberInput from '../../BaseNumberInput/index'
353
- import BaseTreeSelect from '../../BaseTreeSelect'
354
-
355
- import moment from 'moment'
356
- import BaseDateMonth from '../../BaseDateMonth'
357
- export default {
358
- components: {
359
- BaseInput,
360
- BaseCheckbox,
361
- BaseDate,
362
- BaseDatetime,
363
- BaseDateWeek,
364
- BaseDateMonth,
365
- BaseTextArea,
366
- BaseButton,
367
- BaseSelect,
368
- BaseSelectMulti,
369
- BaseTime,
370
- BasePulldown,
371
- BaseIntervalInput,
372
- BaseNumberInput,
373
- BaseTreeSelect,
374
- },
375
- name: 'BaseForm',
376
- props: {
377
- showFold:{
378
- type: Boolean,
379
- default: function () {
380
- return false
381
- },
382
- },
383
- layoutType: {
384
- // 布局方式。默认布局是flex自动换行布局,grid网格固定布局
385
- type: String,
386
- default: function () {
387
- return 'default'
388
- },
389
- },
390
- updateDatas: {
391
- // 更新的数据
392
- type: Object,
393
- default: function () {
394
- return {}
395
- },
396
- },
397
- showLoading: {
398
- // 是否显示加载信息
399
- type: Boolean,
400
- default: false,
401
- },
402
- isOld: {
403
- // 是否老系统
404
- type: Boolean,
405
- default: false,
406
- },
407
- valueState: {
408
- type: Object,
409
- default: function () {
410
- return {}
411
- },
412
- },
413
- formState: {
414
- type: String,
415
- default: sysFormState.view,
416
- },
417
- formRow: {
418
- // 当前页面数据集
419
- type: Object,
420
- default: () => {
421
- return {}
422
- },
423
- },
424
- row: {
425
- // 当前行,如果是表单的话当前行和当前页面数据集是一样的
426
- type: Object,
427
- default: () => {
428
- return {}
429
- },
430
- },
431
- columns: {
432
- // 表格列信息
433
- type: Array,
434
- default: function () {
435
- return []
436
- },
437
- },
438
- dataName: {
439
- type: String,
440
- default: function () {
441
- return ''
442
- },
443
- },
444
- },
445
- computed: {
446
- computedformStyle(){
447
- let layoutFormStyle = {
448
- display: 'flex',
449
- columnGap: this.flexGap+ 'px',
450
- rowGap:'7px',
451
- flexFlow: 'row wrap',
452
- justifyContent: 'flex-start',
453
- padding: '5px 5px 0px 5px',
454
- overflowY: 'auto',
455
- paddingBottom:'7px'
456
- }
457
-
458
- if(this.layoutType==='grid'){
459
- // 计算最大的行和列
460
- let maxRow = XEUtils.max(this.columns,p=>p.row)
461
- let maxCol = XEUtils.max(this.columns,p=>p.col)
462
- layoutFormStyle = {
463
- display: 'grid',
464
- gridTemplateRows: `repeat(${maxRow}, auto)`,
465
- gridTemplateColumns: `repeat(${maxCol}, 1fr)`,
466
- columnGrap: this.flexGap + 'px'
467
- }
468
- }
469
- //默认布局
470
- return layoutFormStyle
471
-
472
- },
473
- internalComputedHiddenCols: function () {
474
- let vm = this
475
- return this.columns.filter((item) => {
476
- // if (item.isTitle === true) {
477
- // // vm.titleCol = item
478
- // return false
479
- // }
480
- // if (item.controlType === controlType.image) {
481
- // vm.logoCol = item
482
- // return false
483
- // }
484
- return item.visible === true
485
- })
486
- },
487
- },
488
- filters: {},
489
- data() {
490
- return {
491
- flexGap:10,
492
- hiddenDetail: false,
493
- moment,
494
- editFormName: '',
495
- internalEdit: false,
496
- internalCols: [],
497
- internalValueState: {},
498
- internalFormState: sysFormState.view,
499
- rules: {},
500
- titleCols: [],
501
- logoCol: null,
502
- isShowEditForm: false,
503
- ref: '',
504
- }
505
- },
506
- watch: {
507
- // row: {
508
- // handler: function (newVal) {
509
- // },
510
- // deep: true
511
- // },
512
- // cols: {
513
- // handler: function (newVal) {
514
- // this.internalCols = newVal
515
- // },
516
- // deep: true
517
- // },
518
- // valueState: { // 表单值状态,更新,还是插入
519
- // handler: function (newVal) {
520
- // this.internalValueState = newVal
521
- // },
522
- // deep: true
523
- // },
524
- // formState: {
525
- // handler: function (newVal) {
526
- // this.internalFormState = newVal
527
- // this.setColState()
528
- // },
529
- // deep: true
530
- // }
531
- },
532
- created() {
533
- for (let i = 0; i < this.columns.length; i++) {
534
- // if (this.columns[i].isLogo === true) {
535
- // this.logoCol = this.columns[i]
536
- // continue
537
- // }
538
- // if (this.columns[i].isTitle === true) {
539
- // this.titleCols.push(this.columns[i])
540
- // continue
541
- // }
542
- if (this.columns[i].controlType === 'popup') {
543
- let formUrl =
544
- process.env[
545
- 'VUE_APP_' +
546
- this.columns[i].linkModuleData.objectService.toUpperCase() +
547
- '_SERVICE_URL'
548
- ] +
549
- '/' +
550
- this.columns[i].linkModuleData.objectApiVersion +
551
- '/' +
552
- this.columns[i].linkModuleData.objectName +
553
- '/'
554
- this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
555
- ? formUrl + this.columns[i].linkModuleData.objectApiRoute
556
- : formUrl + 'Search'
557
-
558
- this.columns[i]['columns'] = {}
559
-
560
- for (
561
- let x = 0;
562
- x < this.columns[i].linkModuleData.moduleFields.length;
563
- x++
564
- ) {
565
- let tempField = this.columns[i].linkModuleData.moduleFields[x]
566
- this.columns[i]['columns'][tempField.field] = {
567
- title: tempField.caption,
568
- width: tempField.width,
569
- visible: tempField.visible,
570
- linkField: tempField.linkValueField,
571
- filter: tempField.isFilter,
572
- }
573
- if (tempField.field === this.columns[i].linkCaptionField) {
574
- this.columns[i]['columns'][tempField.field].linkField =
575
- this.columns[i].field
576
- this.columns[i]['columns'][tempField.field].filter = true
577
- }
578
- }
579
- }
580
-
581
- // this.columns[i]['rules'] = {}
582
- // if (this.columns[i].isRequire === true) {
583
- // this.columns[i].rules['required'] = true
584
- // }
585
- // if (this.columns[i].maxLength) {
586
- // this.columns[i].rules['length'] = [0, this.columns[i].maxLength]
587
- // }
588
- }
589
- },
590
-
591
- mounted() {
592
- //let letterLength = this.$refs.content.value
593
- //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
594
- window.addEventListener('beforeunload', (e) => this.beforeunloadHandler(e))
595
- },
596
- destroyed() {
597
- window.removeEventListener('beforeunload', (e) =>
598
- this.beforeunloadHandler(e)
599
- )
600
- },
601
- activated() {},
602
- methods: {
603
- getFieldStyle(colInfo){
604
- // console.debug('0 0 calc('+colInfo.colSpan*250+'px -'+(colInfo.colSpan-1)*this.flexGap +'px)')
605
- let fieldStyle ={
606
- // width: colInfo.colSpan ? ('calc('+colInfo.colSpan*250+'px + '+(colInfo.colSpan-1)*16+'px)'): '250px',
607
- flex: '0 0 ' + (colInfo.width && colInfo.width>200?colInfo.width:250)+'px', //colInfo.colSpan ? '0 0 '+(colInfo.colSpan*250+(colInfo.colSpan-1)*this.flexGap)+'px': '0 0 250px',
608
-
609
- // flexGrow: 0,
610
- // flexShrink: 0,
611
- // flexBasis: colInfo.colSpan? (colInfo.colSpan*250)+'px':'250px',
612
- // flexGrow: '1',
613
- // flexShrink: '1',
614
- // flexBasis:'250px', //colInfo.colSpan ? ('calc('+colInfo.colSpan*250+'px + '+(colInfo.colSpan-1)*16+'px)'): '250px',
615
- marginTop: '0px',
616
- // marginRight: '8px',
617
- marginBottom: '0px',
618
- // marginLeft: '8px',
619
- // padding: '2px 8px 2px 8px',
620
- // minWidth: '250px',
621
- borderRadius: '6px',
622
- maxWidth:'100%'
623
- }
624
- if(this.layoutType==='grid'){
625
- fieldStyle = {
626
- gridRow: colInfo.row,
627
- gridColumn: colInfo.col
628
- }
629
- }
630
- return fieldStyle
631
- },
632
- preSearch(searchInfo, repeatRowInfo) {
633
- this.$emit('preSearch', searchInfo, repeatRowInfo)
634
- },
635
- beforeunloadHandler(e) {
636
- if (this.formState !== 'view') {
637
- e = e || window.event
638
- e.returnValue = '提示'
639
- return confirm('确认退出')
640
- } else {
641
- return
642
- }
643
- },
644
- pulldownBtnClick(btnInfo) {
645
- this.$emit('pulldownBtnClick', btnInfo)
646
- },
647
- showToolTip() {},
648
- fieldCaptionClick(col) {
649
- // 下拉框
650
- if (
651
- col.linkModuleData &&
652
- col.linkModuleData.linkModuleId &&
653
- col.linkModuleData.linkModuleOperate.indexOf(sysFormState.view) >= 0
654
- ) {
655
- // 查找模块信息
656
- let linkModule = this.$store.getters.addRouters.filter((filterItem) => {
657
- return (
658
- filterItem.meta &&
659
- filterItem.meta.moduleId === col.linkModuleData.linkModuleId
660
- )
661
- })
662
- if (linkModule.length > 0) {
663
- this.$router.pushRoute({
664
- name: linkModule[0].name,
665
- query: { id: this.row[col.field] },
666
- })
667
- }
668
- }
669
- },
670
- // selectChange(col) {
671
- // if (col.field.indexOf('.') < 0) {
672
- // this.updateDatas[col.field] = this.row[col.field]
673
- // }
674
- // if (
675
- // this.row['sysRowState'] === sysRowState.add ||
676
- // this.row['sysRowState'] === sysRowState.update
677
- // ) {
678
- // return
679
- // }
680
- // this.row['sysRowState'] = sysRowState.update
681
- // },
682
- pullDownChange(colInfo, row) {
683
- this.$emit('change', colInfo,row)
684
- },
685
- selectMultiChange(colInfo, row) {
686
- this.$emit('change', colInfo)
687
- },
688
- selectChange(colInfo) {
689
- this.$emit('change', colInfo)
690
- },
691
- checkboxChange(colInfo) {
692
- this.$emit('change', colInfo)
693
- },
694
- checkBoxChange(col) {
695
- if (col.field.indexOf('.') < 0) {
696
- this.updateDatas[col.field] = this.row[col.field]
697
- }
698
- this.$emit('change', col)
699
- if (
700
- this.row['sysRowState'] === sysRowState.add ||
701
- this.row['sysRowState'] === sysRowState.update
702
- ) {
703
- return
704
- }
705
- this.row['sysRowState'] = sysRowState.update
706
- },
707
- dateChange(col) {
708
- if (col.field.indexOf('.') < 0) {
709
- this.updateDatas[col.field] = this.row[col.field]
710
- }
711
- this.$emit('change', col)
712
- if (
713
- this.row['sysRowState'] === sysRowState.add ||
714
- this.row['sysRowState'] === sysRowState.update
715
- ) {
716
- return
717
- }
718
- this.row['sysRowState'] = sysRowState.update
719
- },
720
- inputChange(colInfo) {
721
- // 输入框改变
722
- this.$emit('change', colInfo)
723
- },
724
- // 按钮弹出组件返回输入的值
725
- buttonHandleOk(colInfo, value) {
726
- // 按钮弹出确定改变内容改变
727
- this.$emit('buttonHandleOk', colInfo, value)
728
- },
729
- blurChange(colInfo) {
730
- // 输入框失去焦点
731
- this.$emit('blur', colInfo)
732
- },
733
- numberChange(colInfo) {
734
- // 输入框改变
735
- this.$emit('change', colInfo)
736
- },
737
- longtimeChange(data, col) {
738
- this.row[col.field] = data
739
- this.$emit('change', col)
740
- if (
741
- this.row['sysRowState'] === sysRowState.add ||
742
- this.row['sysRowState'] === sysRowState.update
743
- ) {
744
- return
745
- }
746
- this.row['sysRowState'] = sysRowState.update
747
- },
748
- changeControlType(field, controlType) {
749
- let col = this.internalComputedHiddenCols.find(
750
- (col) => col.field === field
751
- )
752
- col.controlType = controlType
753
- },
754
- pulldownMultiSelect(col,pulldownView,selectRows){
755
- //第一行选中
756
- // pulldownView.setLinkValue(selectRows[0], this.row)
757
-
758
- // this.cellValueChange(scope)
759
- // let vm = this
760
- // for (let i = 1; i < selectRows.length; i++) {
761
- // let tempSelectRow = selectRows[i]
762
- // this.$emit('defaultRow', (newRow) => {
763
- // pulldownView.setLinkValue(tempSelectRow, newRow)
764
- // vm.insertAt(newRow, -1, false, (insertRow) => {
765
- // vm.cellValueChange({ row: insertRow, column: scope.column })
766
- // })
767
- // })
768
- // }
769
- this.$emit('selectRows', selectRows)
770
- }
771
- },
772
- }
773
- </script>
774
-
775
- <style lang="less" scoped>
776
- .form-container{
777
- position: relative
778
- }
779
- .d-form-item-ghost{
780
- visibility: hidden;
781
- height: 0;
782
- min-height: 0px !important;
783
- flex-grow: 1;
784
- flex-shrink: 1;
785
- flex-basis: auto;
786
- border: 1px solid #9ad4dc;
787
- min-width: 150px;
788
- width: 280px;
789
- margin-right: 8px;
790
- margin-left: 8px;
791
- border-radius: 6px;
792
- }
793
- .form-head {
794
- display: flex;
795
- flex-flow: row wrap;
796
- margin-bottom: 10px;
797
- .form-title {
798
- margin-left: 10px;
799
- }
800
- }
801
- .input-span {
802
- // line-height: 33px;
803
- color: #0b0b0b;
804
- font-size: 12px;
805
- font-weight: normal;
806
- overflow: hidden;
807
- text-overflow: ellipsis;
808
- -o-text-overflow: ellipsis;
809
- display: inline-block;
810
- width: 100%;
811
- height: 32.8px;
812
- white-space: nowrap;
813
- // font-family: "Arial", "Microsoft YaHei";
814
- }
815
- .title-first-input {
816
- width: 200px;
817
- height: 25px;
818
- font-size: 15px;
819
- margin-left: 10px;
820
- font-weight: 500;
821
- }
822
- .title-second-input {
823
- width: 200px;
824
- height: 25px;
825
- font-size: 15px;
826
- margin-left: 10px;
827
- font-weight: 500;
828
- }
829
- .title-first-value {
830
- width: 200px;
831
- height: 40px;
832
- font-size: 24px;
833
- margin-left: 10px;
834
- font-weight: 700;
835
- }
836
- .title-second-value {
837
- width: 200px;
838
- height: 26px;
839
- font-size: 18px;
840
- margin-left: 10px;
841
- font-weight: 600;
842
- }
843
- .option:hover {
844
- background-color: #219bff;
845
- }
846
- .form {
847
- margin-left: 30px;
848
- }
849
-
850
- .collapse-btn {
851
- position: absolute;
852
- top: 0px;
853
- right: 0px;
854
- padding: 4px 8px;
855
- z-index: 100;
856
- background-color: #fff; // 添加背景色使按钮更突出
857
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); // 添加阴影效果
858
- border-radius: 4px;
859
- .collapse-icon {
860
- transition: transform 0.3s;
861
- }
862
- &:hover {
863
- background-color: #f0f0f0;
864
- }
865
- }
866
-
867
-
868
- </style>
869
- <style lang="less">
870
- @import '../../styles/default.less';
871
- </style>
1
+ <template>
2
+ <div :style="computedformStyle" class="form-container">
3
+ <a-button v-if="showFold===true"
4
+ class="collapse-btn"
5
+ type="link"
6
+ @click="hiddenDetail = !hiddenDetail"
7
+ >
8
+ <a-icon :type="hiddenDetail ? 'down' : 'up'" class="collapse-icon" />
9
+ <!-- {{ hiddenDetail ? '展开' : '收起' }} -->
10
+ </a-button>
11
+ <div
12
+ :style="getFieldStyle(col)"
13
+ v-for="(col,colIndex) in internalComputedHiddenCols"
14
+ :key="col.field"
15
+ v-show="hiddenDetail ? col.foldVisible===true : true"
16
+ >
17
+ <!-- 文本框输入控件 -->
18
+ <BaseInput
19
+ v-if="
20
+ col.controlType === 'text' &&
21
+ (col.isButtonShow == false || col.isButtonShow == undefined)
22
+ "
23
+ :label="col.title"
24
+ v-model="row[col.field]"
25
+ :edit="col.edit"
26
+ :tooltip="col.tooltip"
27
+ :rules="col.rules"
28
+ @change="
29
+ () => {
30
+ inputChange(col)
31
+ }
32
+ "
33
+ @blur="
34
+ () => {
35
+ blurChange(col)
36
+ }
37
+ "
38
+ />
39
+ <!-- 按钮弹出框输入控件 -->
40
+ <!-- isButtonShow字段是额外添加字段,用于控制区分输入框控件 -->
41
+ <BaseButton
42
+ v-if="col.isButtonShow == true"
43
+ v-model="row[col.field]"
44
+ :colInfo="col"
45
+ :row="row"
46
+ :formRow="formRow"
47
+ @preSearch="preSearch"
48
+ @handleOk="
49
+ (value) => {
50
+ buttonHandleOk(col, value)
51
+ }
52
+ "
53
+ />
54
+ <!-- 文本框输入控件 -->
55
+ <BaseTextArea
56
+ v-if="
57
+ col.controlType === 'textarea' &&
58
+ (col.isButtonShow == false || col.isButtonShow == undefined)
59
+ "
60
+ :label="col.title"
61
+ v-model="row[col.field]"
62
+ :edit="col.edit"
63
+ :tooltip="col.tooltip"
64
+ :rules="col.rules"
65
+ @change="
66
+ () => {
67
+ inputChange(col)
68
+ }
69
+ "
70
+ />
71
+ <!-- 数字输入 -->
72
+ <BaseNumberInput
73
+ v-if="
74
+ col.controlType === 'number' &&
75
+ (col.isButtonShow == false || col.isButtonShow == undefined)
76
+ "
77
+ :label="col.title"
78
+ v-model="row[col.field]"
79
+ :edit="col.edit"
80
+ :rules="col.rules"
81
+ :min="col.min"
82
+ :tooltip="col.tooltip"
83
+ :warnTooltip="col.warnTooltip"
84
+ :max="col.max"
85
+ :precision="col.precision"
86
+ :percent="col.percent"
87
+ :doFormat="col.doFormat"
88
+ @change="
89
+ () => {
90
+ numberChange(col)
91
+ }
92
+ "
93
+ @blur="
94
+ () => {
95
+ blurChange(col)
96
+ }
97
+ "
98
+ />
99
+ <BaseIntervalInput
100
+ v-if="
101
+ col.controlType === 'interval' &&
102
+ (col.isButtonShow == false || col.isButtonShow == undefined)
103
+ "
104
+ :label="col.title"
105
+ v-model="row[col.field]"
106
+ :edit="col.edit"
107
+ :rules="col.rules"
108
+ :tooltip="col.tooltip"
109
+ :displayType="col.displayType"
110
+ :valueType="col.valueType"
111
+ @change="
112
+ () => {
113
+ numberChange(col)
114
+ }
115
+ "
116
+ />
117
+ <!-- 日期选择控件 -->
118
+ <BaseDate
119
+ v-if="
120
+ col.controlType === 'date' &&
121
+ (col.isButtonShow == false || col.isButtonShow == undefined)
122
+ "
123
+ :label="col.title"
124
+ v-model="row[col.field]"
125
+ :edit="col.edit"
126
+ :tooltip="col.tooltip"
127
+ :pastDate="col.pastDate"
128
+ :rules="col.rules"
129
+ :disabledDateValue="col.disabledDateValue"
130
+ @change="
131
+ () => {
132
+ inputChange(col)
133
+ }
134
+ "
135
+ />
136
+ <!-- 日期时间控件 -->
137
+ <BaseDatetime
138
+ v-if="
139
+ col.controlType === 'datetime' &&
140
+ (col.isButtonShow == false || col.isButtonShow == undefined)
141
+ "
142
+ :label="col.title"
143
+ v-model="row[col.field]"
144
+ :pastDate="col.pastDate"
145
+ :tooltip="col.tooltip"
146
+ :edit="col.edit"
147
+ :rules="col.rules"
148
+ :disabledDateValue="col.disabledDateValue"
149
+ @change="
150
+ () => {
151
+ inputChange(col)
152
+ }
153
+ "
154
+ />
155
+ <!-- 单选框 -->
156
+ <BaseCheckbox
157
+ v-if="
158
+ col.controlType === 'checkbox' &&
159
+ (col.isButtonShow == false || col.isButtonShow == undefined)
160
+ "
161
+ :label="col.title"
162
+ v-model="row[col.field]"
163
+ :edit="col.edit"
164
+ :tooltip="col.tooltip"
165
+ :rules="col.rules"
166
+ @change="
167
+ (rowInfo) => {
168
+ checkboxChange(col)
169
+ }
170
+ "
171
+ />
172
+ <BaseTime
173
+ v-if="
174
+ col.controlType === 'time' &&
175
+ (col.isButtonShow == false || col.isButtonShow == undefined)
176
+ "
177
+ :label="col.title"
178
+ v-model="row[col.field]"
179
+ :tooltip="col.tooltip"
180
+ :edit="col.edit"
181
+ :rules="col.rules"
182
+ @change="
183
+ () => {
184
+ inputChange(col)
185
+ }
186
+ "
187
+ />
188
+ <BaseDateWeek
189
+ v-if="
190
+ col.controlType === 'dateweek' &&
191
+ (col.isButtonShow == false || col.isButtonShow == undefined)
192
+ "
193
+ :label="col.title"
194
+ v-model="row[col.field]"
195
+ :edit="col.edit"
196
+ :tooltip="col.tooltip"
197
+ :rules="col.rules"
198
+ @change="
199
+ () => {
200
+ inputChange(col)
201
+ }
202
+ "
203
+ />
204
+ <BaseDateMonth
205
+ v-if="
206
+ col.controlType === 'datemonth' &&
207
+ (col.isButtonShow == false || col.isButtonShow == undefined)
208
+ "
209
+ :label="col.title"
210
+ v-model="row[col.field]"
211
+ :edit="col.edit"
212
+ :tooltip="col.tooltip"
213
+ :rules="col.rules"
214
+ @change="
215
+ () => {
216
+ inputChange(col)
217
+ }
218
+ "
219
+ />
220
+ <BaseSelect
221
+ v-if="
222
+ col.controlType === 'select' &&
223
+ (col.isButtonShow == false || col.isButtonShow == undefined)
224
+ "
225
+ :label="col.title"
226
+ v-model="row[col.field]"
227
+ :edit="col.edit"
228
+ :rules="col.rules"
229
+ :tooltip="col.tooltip"
230
+ :showSearch="true"
231
+ :dataSource="col.dataSource"
232
+ @change="
233
+ (rowInfo) => {
234
+ selectChange(col)
235
+ }
236
+ "
237
+ />
238
+ <BaseSelectMulti
239
+ v-if="
240
+ col.controlType === 'dropmulti' &&
241
+ (col.isButtonShow == false || col.isButtonShow == undefined)
242
+ "
243
+ :label="col.title"
244
+ v-model="row[col.field]"
245
+ :edit="col.edit"
246
+ :tooltip="col.tooltip"
247
+ :rules="col.rules"
248
+ @change="
249
+ (rowInfo) => {
250
+ selectMultiChange(col)
251
+ }
252
+ "
253
+ :dataSource="col.dataSource"
254
+ />
255
+ <BasePulldown
256
+ v-if="
257
+ col.controlType === 'pulldown' &&
258
+ (col.isButtonShow == false || col.isButtonShow == undefined)
259
+ "
260
+ :formRow="formRow"
261
+ :isOld="isOld"
262
+ :edit="col.edit"
263
+ :defaultExpression="col.defaultExpression"
264
+ :row="row"
265
+ :api="col.api"
266
+ :tooltip="col.tooltip"
267
+ :optBtns="col.optBtns"
268
+ :linkData="col.linkData"
269
+ :popupAddName="col.popupAddName"
270
+ :popupAddPath="col.popupAddPath"
271
+ @pulldownBtnClick="pulldownBtnClick"
272
+ :label="col.title"
273
+ :rules="col.rules"
274
+ :route="col.route"
275
+ v-model="row[col.field]"
276
+ :field="col.field"
277
+ :columns="col.columns"
278
+ :pageSize="col.pageSize"
279
+ :immediate="col.immediate"
280
+ :allowAutoClear="col.allowAutoClear"
281
+ @preSearch="preSearch"
282
+ @selectChanged="
283
+ (rowInfo) => {
284
+ pullDownChange(col, rowInfo)
285
+ }
286
+ "
287
+ @confirmMultiSelect="
288
+ (pulldownView, selectRows) =>
289
+ pulldownMultiSelect(col, pulldownView, selectRows)
290
+ "
291
+ :dataSource="col.dataSource"
292
+ :isMultiSelect="col.isMultiSelect"
293
+ :isLocalData="col.isLocalData"
294
+ />
295
+ <BaseTreeSelect
296
+ v-if="
297
+ col.controlType === 'treeSelect' &&
298
+ (col.isButtonShow == false || col.isButtonShow == undefined)
299
+ "
300
+ :formRow="formRow"
301
+ :api="col.api"
302
+ :tooltip="col.tooltip"
303
+ :row="row"
304
+ :edit="col.edit"
305
+ :label="col.title"
306
+ :rules="col.rules"
307
+ :route="col.route"
308
+ :field="col.field"
309
+ :columns="col.columns"
310
+ @preSearch="preSearch"
311
+ :replaceFields="col.replaceFields"
312
+ :treeWidth="col.treeWidth"
313
+ :width="col.width"
314
+ :linkedField="col.linkedField"
315
+ :showSearch="col.showSearch"
316
+ :allowClear="col.allowClear"
317
+ :placeholder="col.placeholder"
318
+ :linkedTitle="col.linkedTitle"
319
+ :method="col.method"
320
+ v-model="row[col.field]"
321
+ @change="
322
+ () => {
323
+ inputChange(col)
324
+ }
325
+ "
326
+ />
327
+ </div>
328
+ <template v-if="layoutType==='default'">
329
+ <!-- <div class="d-form-item-ghost"></div>
330
+ <div class="d-form-item-ghost"></div>
331
+ <div class="d-form-item-ghost"></div>
332
+ <div class="d-form-item-ghost"></div> -->
333
+ </template>
334
+ </div>
335
+ </template>
336
+
337
+ <script>
338
+ import XEUtils from 'xe-utils'
339
+ import { sysFormState, sysRowState } from '../../utils/enum'
340
+ import BaseInput from '../../BaseInput/index'
341
+ import BaseCheckbox from '../../BaseCheckbox/index'
342
+ import BaseDate from '../../BaseDate/index'
343
+ import BaseDatetime from '../../BaseDatetime/index'
344
+ import BaseDateWeek from '../../BaseDateWeek/index'
345
+ import BaseTextArea from '../../BaseTextArea/index'
346
+ import BaseButton from '../../BaseButton/index'
347
+ import BaseSelect from '../../BaseSelect/index'
348
+ import BaseSelectMulti from '../../BaseSelectMulti/index'
349
+ import BaseTime from '../../BaseTime/index'
350
+ import BasePulldown from '../../BasePulldown/index'
351
+ import BaseIntervalInput from '../../BaseIntervalInput/index'
352
+ import BaseNumberInput from '../../BaseNumberInput/index'
353
+ import BaseTreeSelect from '../../BaseTreeSelect'
354
+
355
+ import moment from 'moment'
356
+ import BaseDateMonth from '../../BaseDateMonth'
357
+ export default {
358
+ components: {
359
+ BaseInput,
360
+ BaseCheckbox,
361
+ BaseDate,
362
+ BaseDatetime,
363
+ BaseDateWeek,
364
+ BaseDateMonth,
365
+ BaseTextArea,
366
+ BaseButton,
367
+ BaseSelect,
368
+ BaseSelectMulti,
369
+ BaseTime,
370
+ BasePulldown,
371
+ BaseIntervalInput,
372
+ BaseNumberInput,
373
+ BaseTreeSelect,
374
+ },
375
+ name: 'BaseForm',
376
+ props: {
377
+ showFold:{
378
+ type: Boolean,
379
+ default: function () {
380
+ return false
381
+ },
382
+ },
383
+ layoutType: {
384
+ // 布局方式。默认布局是flex自动换行布局,grid网格固定布局
385
+ type: String,
386
+ default: function () {
387
+ return 'default'
388
+ },
389
+ },
390
+ updateDatas: {
391
+ // 更新的数据
392
+ type: Object,
393
+ default: function () {
394
+ return {}
395
+ },
396
+ },
397
+ showLoading: {
398
+ // 是否显示加载信息
399
+ type: Boolean,
400
+ default: false,
401
+ },
402
+ isOld: {
403
+ // 是否老系统
404
+ type: Boolean,
405
+ default: false,
406
+ },
407
+ valueState: {
408
+ type: Object,
409
+ default: function () {
410
+ return {}
411
+ },
412
+ },
413
+ formState: {
414
+ type: String,
415
+ default: sysFormState.view,
416
+ },
417
+ formRow: {
418
+ // 当前页面数据集
419
+ type: Object,
420
+ default: () => {
421
+ return {}
422
+ },
423
+ },
424
+ row: {
425
+ // 当前行,如果是表单的话当前行和当前页面数据集是一样的
426
+ type: Object,
427
+ default: () => {
428
+ return {}
429
+ },
430
+ },
431
+ columns: {
432
+ // 表格列信息
433
+ type: Array,
434
+ default: function () {
435
+ return []
436
+ },
437
+ },
438
+ dataName: {
439
+ type: String,
440
+ default: function () {
441
+ return ''
442
+ },
443
+ },
444
+ },
445
+ computed: {
446
+ computedformStyle(){
447
+ let layoutFormStyle = {
448
+ display: 'flex',
449
+ columnGap: this.flexGap+ 'px',
450
+ rowGap:'7px',
451
+ flexFlow: 'row wrap',
452
+ justifyContent: 'flex-start',
453
+ padding: '5px 5px 0px 5px',
454
+ overflowY: 'auto',
455
+ paddingBottom:'7px'
456
+ }
457
+
458
+ if(this.layoutType==='grid'){
459
+ // 计算最大的行和列
460
+ let maxRow = XEUtils.max(this.columns,p=>p.row)
461
+ let maxCol = XEUtils.max(this.columns,p=>p.col)
462
+ layoutFormStyle = {
463
+ display: 'grid',
464
+ gridTemplateRows: `repeat(${maxRow}, auto)`,
465
+ gridTemplateColumns: `repeat(${maxCol}, 1fr)`,
466
+ columnGrap: this.flexGap + 'px'
467
+ }
468
+ }
469
+ //默认布局
470
+ return layoutFormStyle
471
+
472
+ },
473
+ internalComputedHiddenCols: function () {
474
+ let vm = this
475
+ return this.columns.filter((item) => {
476
+ // if (item.isTitle === true) {
477
+ // // vm.titleCol = item
478
+ // return false
479
+ // }
480
+ // if (item.controlType === controlType.image) {
481
+ // vm.logoCol = item
482
+ // return false
483
+ // }
484
+ return item.visible === true
485
+ })
486
+ },
487
+ },
488
+ filters: {},
489
+ data() {
490
+ return {
491
+ flexGap:10,
492
+ hiddenDetail: false,
493
+ moment,
494
+ editFormName: '',
495
+ internalEdit: false,
496
+ internalCols: [],
497
+ internalValueState: {},
498
+ internalFormState: sysFormState.view,
499
+ rules: {},
500
+ titleCols: [],
501
+ logoCol: null,
502
+ isShowEditForm: false,
503
+ ref: '',
504
+ }
505
+ },
506
+ watch: {
507
+ // row: {
508
+ // handler: function (newVal) {
509
+ // },
510
+ // deep: true
511
+ // },
512
+ // cols: {
513
+ // handler: function (newVal) {
514
+ // this.internalCols = newVal
515
+ // },
516
+ // deep: true
517
+ // },
518
+ // valueState: { // 表单值状态,更新,还是插入
519
+ // handler: function (newVal) {
520
+ // this.internalValueState = newVal
521
+ // },
522
+ // deep: true
523
+ // },
524
+ // formState: {
525
+ // handler: function (newVal) {
526
+ // this.internalFormState = newVal
527
+ // this.setColState()
528
+ // },
529
+ // deep: true
530
+ // }
531
+ },
532
+ created() {
533
+ for (let i = 0; i < this.columns.length; i++) {
534
+ // if (this.columns[i].isLogo === true) {
535
+ // this.logoCol = this.columns[i]
536
+ // continue
537
+ // }
538
+ // if (this.columns[i].isTitle === true) {
539
+ // this.titleCols.push(this.columns[i])
540
+ // continue
541
+ // }
542
+ if (this.columns[i].controlType === 'popup') {
543
+ let formUrl =
544
+ process.env[
545
+ 'VUE_APP_' +
546
+ this.columns[i].linkModuleData.objectService.toUpperCase() +
547
+ '_SERVICE_URL'
548
+ ] +
549
+ '/' +
550
+ this.columns[i].linkModuleData.objectApiVersion +
551
+ '/' +
552
+ this.columns[i].linkModuleData.objectName +
553
+ '/'
554
+ this.columns[i]['api'] = this.columns[i].linkModuleData.objectApiRoute
555
+ ? formUrl + this.columns[i].linkModuleData.objectApiRoute
556
+ : formUrl + 'Search'
557
+
558
+ this.columns[i]['columns'] = {}
559
+
560
+ for (
561
+ let x = 0;
562
+ x < this.columns[i].linkModuleData.moduleFields.length;
563
+ x++
564
+ ) {
565
+ let tempField = this.columns[i].linkModuleData.moduleFields[x]
566
+ this.columns[i]['columns'][tempField.field] = {
567
+ title: tempField.caption,
568
+ width: tempField.width,
569
+ visible: tempField.visible,
570
+ linkField: tempField.linkValueField,
571
+ filter: tempField.isFilter,
572
+ }
573
+ if (tempField.field === this.columns[i].linkCaptionField) {
574
+ this.columns[i]['columns'][tempField.field].linkField =
575
+ this.columns[i].field
576
+ this.columns[i]['columns'][tempField.field].filter = true
577
+ }
578
+ }
579
+ }
580
+
581
+ // this.columns[i]['rules'] = {}
582
+ // if (this.columns[i].isRequire === true) {
583
+ // this.columns[i].rules['required'] = true
584
+ // }
585
+ // if (this.columns[i].maxLength) {
586
+ // this.columns[i].rules['length'] = [0, this.columns[i].maxLength]
587
+ // }
588
+ }
589
+ },
590
+
591
+ mounted() {
592
+ //let letterLength = this.$refs.content.value
593
+ //letterLength = this.$refs['content'].innerText.substr(0, 6) + '...'
594
+ window.addEventListener('beforeunload', (e) => this.beforeunloadHandler(e))
595
+ },
596
+ destroyed() {
597
+ window.removeEventListener('beforeunload', (e) =>
598
+ this.beforeunloadHandler(e)
599
+ )
600
+ },
601
+ activated() {},
602
+ methods: {
603
+ getFieldStyle(colInfo){
604
+ // console.debug('0 0 calc('+colInfo.colSpan*250+'px -'+(colInfo.colSpan-1)*this.flexGap +'px)')
605
+ let fieldStyle ={
606
+ // width: colInfo.colSpan ? ('calc('+colInfo.colSpan*250+'px + '+(colInfo.colSpan-1)*16+'px)'): '250px',
607
+ flex: '0 0 ' + (colInfo.width && colInfo.width>200?colInfo.width:250)+'px', //colInfo.colSpan ? '0 0 '+(colInfo.colSpan*250+(colInfo.colSpan-1)*this.flexGap)+'px': '0 0 250px',
608
+
609
+ // flexGrow: 0,
610
+ // flexShrink: 0,
611
+ // flexBasis: colInfo.colSpan? (colInfo.colSpan*250)+'px':'250px',
612
+ // flexGrow: '1',
613
+ // flexShrink: '1',
614
+ // flexBasis:'250px', //colInfo.colSpan ? ('calc('+colInfo.colSpan*250+'px + '+(colInfo.colSpan-1)*16+'px)'): '250px',
615
+ marginTop: '0px',
616
+ // marginRight: '8px',
617
+ marginBottom: '0px',
618
+ // marginLeft: '8px',
619
+ // padding: '2px 8px 2px 8px',
620
+ // minWidth: '250px',
621
+ borderRadius: '6px',
622
+ maxWidth:'100%'
623
+ }
624
+ if(this.layoutType==='grid'){
625
+ fieldStyle = {
626
+ gridRow: colInfo.row,
627
+ gridColumn: colInfo.col
628
+ }
629
+ }
630
+ return fieldStyle
631
+ },
632
+ preSearch(searchInfo, repeatRowInfo) {
633
+ this.$emit('preSearch', searchInfo, repeatRowInfo)
634
+ },
635
+ beforeunloadHandler(e) {
636
+ if (this.formState !== 'view') {
637
+ e = e || window.event
638
+ e.returnValue = '提示'
639
+ return confirm('确认退出')
640
+ } else {
641
+ return
642
+ }
643
+ },
644
+ pulldownBtnClick(btnInfo) {
645
+ this.$emit('pulldownBtnClick', btnInfo)
646
+ },
647
+ showToolTip() {},
648
+ fieldCaptionClick(col) {
649
+ // 下拉框
650
+ if (
651
+ col.linkModuleData &&
652
+ col.linkModuleData.linkModuleId &&
653
+ col.linkModuleData.linkModuleOperate.indexOf(sysFormState.view) >= 0
654
+ ) {
655
+ // 查找模块信息
656
+ let linkModule = this.$store.getters.addRouters.filter((filterItem) => {
657
+ return (
658
+ filterItem.meta &&
659
+ filterItem.meta.moduleId === col.linkModuleData.linkModuleId
660
+ )
661
+ })
662
+ if (linkModule.length > 0) {
663
+ this.$router.pushRoute({
664
+ name: linkModule[0].name,
665
+ query: { id: this.row[col.field] },
666
+ })
667
+ }
668
+ }
669
+ },
670
+ // selectChange(col) {
671
+ // if (col.field.indexOf('.') < 0) {
672
+ // this.updateDatas[col.field] = this.row[col.field]
673
+ // }
674
+ // if (
675
+ // this.row['sysRowState'] === sysRowState.add ||
676
+ // this.row['sysRowState'] === sysRowState.update
677
+ // ) {
678
+ // return
679
+ // }
680
+ // this.row['sysRowState'] = sysRowState.update
681
+ // },
682
+ pullDownChange(colInfo, row) {
683
+ this.$emit('change', colInfo,row)
684
+ },
685
+ selectMultiChange(colInfo, row) {
686
+ this.$emit('change', colInfo)
687
+ },
688
+ selectChange(colInfo) {
689
+ this.$emit('change', colInfo)
690
+ },
691
+ checkboxChange(colInfo) {
692
+ this.$emit('change', colInfo)
693
+ },
694
+ checkBoxChange(col) {
695
+ if (col.field.indexOf('.') < 0) {
696
+ this.updateDatas[col.field] = this.row[col.field]
697
+ }
698
+ this.$emit('change', col)
699
+ if (
700
+ this.row['sysRowState'] === sysRowState.add ||
701
+ this.row['sysRowState'] === sysRowState.update
702
+ ) {
703
+ return
704
+ }
705
+ this.row['sysRowState'] = sysRowState.update
706
+ },
707
+ dateChange(col) {
708
+ if (col.field.indexOf('.') < 0) {
709
+ this.updateDatas[col.field] = this.row[col.field]
710
+ }
711
+ this.$emit('change', col)
712
+ if (
713
+ this.row['sysRowState'] === sysRowState.add ||
714
+ this.row['sysRowState'] === sysRowState.update
715
+ ) {
716
+ return
717
+ }
718
+ this.row['sysRowState'] = sysRowState.update
719
+ },
720
+ inputChange(colInfo) {
721
+ // 输入框改变
722
+ this.$emit('change', colInfo)
723
+ },
724
+ // 按钮弹出组件返回输入的值
725
+ buttonHandleOk(colInfo, value) {
726
+ // 按钮弹出确定改变内容改变
727
+ this.$emit('buttonHandleOk', colInfo, value)
728
+ },
729
+ blurChange(colInfo) {
730
+ // 输入框失去焦点
731
+ this.$emit('blur', colInfo)
732
+ },
733
+ numberChange(colInfo) {
734
+ // 输入框改变
735
+ this.$emit('change', colInfo)
736
+ },
737
+ longtimeChange(data, col) {
738
+ this.row[col.field] = data
739
+ this.$emit('change', col)
740
+ if (
741
+ this.row['sysRowState'] === sysRowState.add ||
742
+ this.row['sysRowState'] === sysRowState.update
743
+ ) {
744
+ return
745
+ }
746
+ this.row['sysRowState'] = sysRowState.update
747
+ },
748
+ changeControlType(field, controlType) {
749
+ let col = this.internalComputedHiddenCols.find(
750
+ (col) => col.field === field
751
+ )
752
+ col.controlType = controlType
753
+ },
754
+ pulldownMultiSelect(col,pulldownView,selectRows){
755
+ //第一行选中
756
+ // pulldownView.setLinkValue(selectRows[0], this.row)
757
+
758
+ // this.cellValueChange(scope)
759
+ // let vm = this
760
+ // for (let i = 1; i < selectRows.length; i++) {
761
+ // let tempSelectRow = selectRows[i]
762
+ // this.$emit('defaultRow', (newRow) => {
763
+ // pulldownView.setLinkValue(tempSelectRow, newRow)
764
+ // vm.insertAt(newRow, -1, false, (insertRow) => {
765
+ // vm.cellValueChange({ row: insertRow, column: scope.column })
766
+ // })
767
+ // })
768
+ // }
769
+ this.$emit('selectRows', selectRows)
770
+ }
771
+ },
772
+ }
773
+ </script>
774
+
775
+ <style lang="less" scoped>
776
+ .form-container{
777
+ position: relative
778
+ }
779
+ .d-form-item-ghost{
780
+ visibility: hidden;
781
+ height: 0;
782
+ min-height: 0px !important;
783
+ flex-grow: 1;
784
+ flex-shrink: 1;
785
+ flex-basis: auto;
786
+ border: 1px solid #9ad4dc;
787
+ min-width: 150px;
788
+ width: 280px;
789
+ margin-right: 8px;
790
+ margin-left: 8px;
791
+ border-radius: 6px;
792
+ }
793
+ .form-head {
794
+ display: flex;
795
+ flex-flow: row wrap;
796
+ margin-bottom: 10px;
797
+ .form-title {
798
+ margin-left: 10px;
799
+ }
800
+ }
801
+ .input-span {
802
+ // line-height: 33px;
803
+ color: #0b0b0b;
804
+ font-size: 12px;
805
+ font-weight: normal;
806
+ overflow: hidden;
807
+ text-overflow: ellipsis;
808
+ -o-text-overflow: ellipsis;
809
+ display: inline-block;
810
+ width: 100%;
811
+ height: 32.8px;
812
+ white-space: nowrap;
813
+ // font-family: "Arial", "Microsoft YaHei";
814
+ }
815
+ .title-first-input {
816
+ width: 200px;
817
+ height: 25px;
818
+ font-size: 15px;
819
+ margin-left: 10px;
820
+ font-weight: 500;
821
+ }
822
+ .title-second-input {
823
+ width: 200px;
824
+ height: 25px;
825
+ font-size: 15px;
826
+ margin-left: 10px;
827
+ font-weight: 500;
828
+ }
829
+ .title-first-value {
830
+ width: 200px;
831
+ height: 40px;
832
+ font-size: 24px;
833
+ margin-left: 10px;
834
+ font-weight: 700;
835
+ }
836
+ .title-second-value {
837
+ width: 200px;
838
+ height: 26px;
839
+ font-size: 18px;
840
+ margin-left: 10px;
841
+ font-weight: 600;
842
+ }
843
+ .option:hover {
844
+ background-color: #219bff;
845
+ }
846
+ .form {
847
+ margin-left: 30px;
848
+ }
849
+
850
+ .collapse-btn {
851
+ position: absolute;
852
+ top: 0px;
853
+ right: 0px;
854
+ padding: 4px 8px;
855
+ z-index: 100;
856
+ background-color: #fff; // 添加背景色使按钮更突出
857
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); // 添加阴影效果
858
+ border-radius: 4px;
859
+ .collapse-icon {
860
+ transition: transform 0.3s;
861
+ }
862
+ &:hover {
863
+ background-color: #f0f0f0;
864
+ }
865
+ }
866
+
867
+
868
+ </style>
869
+ <style lang="less">
870
+ @import '../../styles/default.less';
871
+ </style>