doway-coms 2.11.25 → 2.11.27

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