doway-coms 2.11.62 → 2.11.67

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