doway-coms 2.10.70 → 2.10.72

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