doway-coms 2.10.71 → 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 -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 +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,873 +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
- :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,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>