doway-coms 2.11.6 → 2.11.7

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