doway-coms 2.10.71 → 2.10.73

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