@tongfun/tf-widget 0.1.18 → 0.1.22

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 (99) hide show
  1. package/README.md +49 -42
  2. package/lib/css/1.841c5d60.css +1 -0
  3. package/lib/tf-widget.common.1.js +9 -13
  4. package/lib/tf-widget.common.js +1102 -950
  5. package/lib/tf-widget.css +1 -1
  6. package/lib/tf-widget.umd.1.js +9 -13
  7. package/lib/tf-widget.umd.js +1102 -950
  8. package/lib/tf-widget.umd.min.1.js +1 -1
  9. package/lib/tf-widget.umd.min.js +4 -4
  10. package/package/svg-icon/index.js +8 -8
  11. package/package/svg-icon/src/SvgIcon.vue +59 -59
  12. package/package/t-data-list/index.js +6 -6
  13. package/package/t-data-list/main.vue +193 -192
  14. package/package/t-data-list/src/condition-input/basic.vue +31 -31
  15. package/package/t-data-list/src/condition-input/date.vue +106 -106
  16. package/package/t-data-list/src/condition-input/index.vue +100 -100
  17. package/package/t-data-list/src/condition-input/input.vue +31 -31
  18. package/package/t-data-list/src/condition-input/number.vue +115 -115
  19. package/package/t-data-list/src/condition-input/select.vue +86 -86
  20. package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
  21. package/package/t-data-list/src/js/operatorEnum.js +108 -109
  22. package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
  23. package/package/t-data-list/src/js/util.js +34 -34
  24. package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -77
  25. package/package/t-data-list/src/pushdown/push-down.vue +158 -158
  26. package/package/t-data-list/src/t-list-search.vue +36 -32
  27. package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
  28. package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
  29. package/package/t-data-list/src/t-plan/index.vue +195 -190
  30. package/package/t-data-list/src/t-plan/plan-content.vue +389 -396
  31. package/package/t-data-list/src/t-table/index.vue +129 -120
  32. package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
  33. package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
  34. package/package/t-data-list/src/t-table/table-group.vue +180 -179
  35. package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -250
  36. package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
  37. package/package/t-data-list/src/t-table/table-records.vue +337 -324
  38. package/package/t-input/children/address.vue +101 -101
  39. package/package/t-input/children/basic-display.vue +41 -41
  40. package/package/t-input/children/basic.vue +253 -251
  41. package/package/t-input/children/date.vue +89 -89
  42. package/package/t-input/children/group-components/group-dialog.vue +344 -350
  43. package/package/t-input/children/group.vue +126 -126
  44. package/package/t-input/children/input.vue +72 -72
  45. package/package/t-input/children/number.vue +74 -74
  46. package/package/t-input/children/select.vue +89 -89
  47. package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
  48. package/package/t-input/index.js +7 -7
  49. package/package/t-input/index.vue +337 -337
  50. package/package/t-input/tInputCache.js +24 -24
  51. package/package/tf-icon-picker/README.md +7 -7
  52. package/package/tf-icon-picker/index.js +8 -8
  53. package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
  54. package/package/tf-layout/README.md +115 -115
  55. package/package/tf-layout/index.js +8 -8
  56. package/package/tf-layout/src/components/tf-labelbar.vue +394 -382
  57. package/package/tf-layout/src/components/tf-menu.vue +180 -180
  58. package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
  59. package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
  60. package/package/tf-layout/src/tf-layout.vue +140 -120
  61. package/package/tf-widget/index.js +8 -8
  62. package/package/tf-widget/src/assets/common-input.less +10 -10
  63. package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
  64. package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
  65. package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
  66. package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
  67. package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
  68. package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
  69. package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
  70. package/package/tf-widget/src/children/date-time.vue +103 -103
  71. package/package/tf-widget/src/children/date.vue +103 -103
  72. package/package/tf-widget/src/children/decimal.vue +115 -115
  73. package/package/tf-widget/src/children/integer.vue +104 -104
  74. package/package/tf-widget/src/children/property.vue +59 -59
  75. package/package/tf-widget/src/children/single-line-text.vue +82 -82
  76. package/package/tf-widget/src/children/small-pictures.vue +223 -223
  77. package/package/tf-widget/src/children/text-area.vue +74 -74
  78. package/package/tf-widget/src/children/tf-select.vue +113 -113
  79. package/package/tf-widget/src/tf-widget.vue +175 -175
  80. package/package.json +44 -43
  81. package/src/api/edit.js +97 -97
  82. package/src/api/file-enclosure.js +26 -26
  83. package/src/api/push-down.js +19 -19
  84. package/src/api/table.js +294 -294
  85. package/src/api/tableV3.js +166 -186
  86. package/src/assets/images/icons/index.js +9 -9
  87. package/src/assets/images/icons/svg/add.svg +5 -5
  88. package/src/assets/images/icons/svg/push-down.svg +1 -1
  89. package/src/assets/images/icons/svg/remove.svg +1 -1
  90. package/src/assets/styles/common-table.less +202 -202
  91. package/src/directives/debounce.js +24 -0
  92. package/src/index.js +31 -31
  93. package/src/mixins/t-data-query-mixin.js +290 -289
  94. package/src/utils/auth.js +22 -22
  95. package/src/utils/request.js +42 -42
  96. package/src/utils/stato-anormale.js +59 -59
  97. package/src/utils/utils.js +109 -109
  98. package/src/utils/validate.js +84 -84
  99. package/lib/css/1.920744ef.css +0 -1
@@ -1,361 +1,361 @@
1
- <template>
2
- <div>
3
- <el-autocomplete
4
- v-model="displayName"
5
- popper-class="advice-poper"
6
- :class="basicDataStyle"
7
- :fetch-suggestions="getAdvice"
8
- :value-key="displayField"
9
- :trigger-on-focus="false"
10
- :placeholder="placeholder"
11
- :disabled="JSON.parse(disabled)"
12
- @select="handleSelect"
13
- @keydown.delete.native="handleDeleteKeyDown"
14
- >
15
- <i slot="suffix" :class=" disabled ? 'el-icon-lock' : 'el-icon-search' " style="cursor: pointer" @click="showDialog" />
16
- <template slot-scope="{item}">
17
- <div>{{ item[displayField] + ' ' + '[' + item.head__code + ']' }}</div>
18
- </template>
19
- </el-autocomplete>
20
-
21
- <el-dialog
22
- :visible.sync="dialogVisible"
23
- width="80%"
24
- append-to-body
25
- :modal-append-to-body="false"
26
- >
27
- <div class="dataDialog">
28
- <BasicDataSelector :table-id="tableId" :limit-show="limitShow" :dialog-visible="dialogVisible" :much-select="muchSelect" @rowSelect="handleRowSelect" />
29
- </div>
30
- <span slot="footer" class="dialog-footer">
31
- <el-button class="common-header-button close" type="primary" @click="close">取 消</el-button>
32
- <el-button class="common-header-button" type="primary" @click="handleDialogConfirm">确 定</el-button>
33
- </span>
34
- </el-dialog>
35
- </div>
36
- </template>
37
- <script>
38
- import { getBasicDataSearchAdvice, getFormData } from '@/api/edit.js'
39
- import BasicDataSelector from './dependcy/basic-data-selector.vue'
40
- export default {
41
- components: {
42
- BasicDataSelector
43
- // DataSelectorDialog
44
- },
45
- props: {
46
- value: { // 双向绑定
47
- type: [String, Object],
48
- default: () => {
49
- return { name: '', id: '' }
50
- }
51
- },
52
- // 当选中一条基础资料的时候,默认选择基础资料的head__name属性
53
- displayField: {
54
- type: String,
55
- default: 'head__name'
56
- },
57
- basicDataStyle: {
58
- type: String,
59
- default: 'default'
60
- },
61
- tableId: {
62
- type: String,
63
- default: ''
64
- },
65
- disabled: {
66
- type: [Boolean, String],
67
- default: false
68
- },
69
- placeholder: {
70
- type: String,
71
- default: ''
72
- },
73
- // 当前控件操作的属性所在的数据对象(单据体中体现为一行数据
74
- scopeData: {
75
- type: Object,
76
- default: null
77
- },
78
- relationFields: {
79
- type: [Object, Array],
80
- default: null
81
- },
82
- defaultValue: {
83
- type: String,
84
- default: ''
85
- },
86
- field: {
87
- type: String,
88
- default: ''
89
- },
90
- widgets: {
91
- type: Array,
92
- default: () => []
93
- },
94
- muchSelect: {
95
- type: Boolean,
96
- default: false
97
- },
98
- inputMoreSelect: { // 开启input内的多选
99
- type: Boolean,
100
- default: false
101
- },
102
- forDeadComponentFlag: { // 此标识用于写死的组件,将事件发射出去自己处理
103
- type: Boolean,
104
- default: false
105
- }
106
-
107
- },
108
- data () {
109
- return {
110
- limitShow: 0, // 限制基础资料显示某个属性,1:审核状态状态,
111
- dialogVisible: false,
112
- currentSelectRow: {},
113
- showName: '',
114
- currentSelectMap: new Map(),
115
- inputKey: ''
116
- // relationFields:[{}]
117
- }
118
- },
119
- computed: {
120
- displayName: {
121
- set (value) {
122
- // 已经选中了一个值忽略再次输入
123
- if (this.value.id) {
124
- return
125
- }
126
- this.value.name = value
127
- },
128
- get () {
129
- if (!this.value) {
130
- return
131
- }
132
- return this.value.name
133
- }
134
- }
135
- },
136
- watch: {
137
- value (newValue) {
138
- if (!this.value) {
139
- this.$emit('input', { name: '', id: null })
140
- }
141
- }
142
- },
143
- created () {
144
- if (this.defaultValue && (!this.value || this.value.id === '')) {
145
- return this.handleDefaultValue()
146
- }
147
- if (!this.value) {
148
- this.$emit('input', { name: '', id: null })
149
- }
150
- },
151
- methods: {
152
-
153
- /**
154
- * 根据默认值id获取数据
155
- */
156
- handleDefaultValue () {
157
- const interval = setInterval(async () => {
158
- if (this.tableId) {
159
- clearInterval(interval)
160
- const data = {
161
- entityMark: '',
162
- id: this.defaultValue,
163
- pageNum: 1,
164
- pageSize: 1,
165
- tableId: this.tableId
166
- }
167
- const res = await getFormData(data)
168
- if (res.code === 0) {
169
- const data = {
170
- id: this.defaultValue,
171
- name: res.data[res.data.headIdentification].name
172
- }
173
- this.$emit('input', data)
174
- }
175
- }
176
- }, 50)
177
- },
178
- /**
179
- * dialog关闭和确定处理函数
180
- */
181
- handleClose () {
182
- this.dialogVisible = false
183
- },
184
- close () {
185
- this.dialogVisible = false
186
- },
187
- handleDialogConfirm () {
188
- this.$emit('handleSelected', this.currentSelectRow)
189
- if (this.forDeadComponentFlag) {
190
- this.close()
191
- return
192
- }
193
- if (this.currentSelectRow.length === 1 || (!this.muchSelect && !this.inputMoreSelect)) {
194
- this.$emit('input', { id: this.currentSelectRow[0].head__id, name: this.currentSelectRow[0][this.displayField] })
195
- if (this.relationFields) {
196
- for (const key in this.relationFields) {
197
- this.scopeData[this.relationFields[key]] = this.currentSelectRow[0][key]
198
- }
199
- }
200
- this.close()
201
- } else if (this.currentSelectRow.length > 1) {
202
- if (this.inputMoreSelect) {
203
- const idArr = []
204
- const nameArr = []
205
- this.currentSelectRow.forEach(e => {
206
- idArr.push(e.head__id)
207
- nameArr.push(e[this.displayField])
208
- })
209
- const data = {
210
- id: idArr.toString(),
211
- name: nameArr.toString()
212
- }
213
- this.$emit('input', data)
214
- this.close()
215
- }
216
- if (this.muchSelect) {
217
- const insertData = []
218
- this.currentSelectRow.forEach((item, index) => {
219
- const obj = {}
220
- this.widgets.forEach((item2, index2) => {
221
- if (item2.field === this.field) {
222
- obj[item2.field] = { id: this.currentSelectRow[index].head__id, name: this.currentSelectRow[index][this.displayField] }
223
- } else if (item2.type === 'basic_data') {
224
- obj[item2.field] = { id: undefined, name: undefined }
225
- } else {
226
- obj[item2.field] = undefined
227
- }
228
- })
229
- // 添加关联关系
230
- const relationFieldsIndex = this.widgets.findIndex(d => d.field === this.field)
231
- if (relationFieldsIndex !== -1) {
232
- const relationFields = this.widgets[relationFieldsIndex].relationFields
233
- for (const key in relationFields) {
234
- obj[relationFields[key]] = this.currentSelectRow[index][key]
235
- }
236
- }
237
- insertData.push(obj)
238
- })
239
- this.$emit('addMuchData', insertData)
240
- this.close()
241
- }
242
- }
243
- // this.$emit('input', { id: this.currentSelectRow.head__id, name: this.currentSelectRow.head__name })
244
- // if (this.relationFields) {
245
- // for (const key in this.relationFields) {
246
- // this.scopeData[this.relationFields[key]] = this.currentSelectRow[key]
247
- // }
248
- // }
249
- // this.close()
250
- },
251
-
252
- /**
253
- * 在弹窗中选择基础资料
254
- */
255
- handleRowSelect (row) {
256
- this.currentSelectRow = row
257
- },
258
- showDialog () {
259
- // 后端这里的数据可能是字符串也可能是boolean类型
260
- const disabled = typeof this.disabled === 'string'
261
- ? Boolean(this.disabled)
262
- : this.disabled
263
-
264
- if (!disabled) {
265
- this.dialogVisible = true
266
- }
267
- this.limitShow = 1
268
- },
269
-
270
- /**
271
- * 清空选择
272
- */
273
- // delete按键处理
274
- handleDeleteKeyDown () {
275
- if (this.value.id) {
276
- this.$emit('input', { name: '', id: null })
277
- }
278
- },
279
-
280
- /**
281
- * 基础资料搜索建议
282
- */
283
- // 获取建议结果
284
- async getAdvice (queryString, callback) {
285
- // 如果输入空字符串,不调用接口
286
- const reg = /^\s*$/g
287
- /* eslint-disable */
288
- if (reg.test(this.displayName)) {
289
- return callback([])
290
- }
291
-
292
- try {
293
- const res = await getBasicDataSearchAdvice(this.tableId, this.displayName)
294
- if (res.code !== 0) {
295
- return
296
- }
297
- callback(res.data.records)
298
- } catch (err) {
299
- console.log(err)
300
- }
301
- },
302
- // 选择一条建议
303
- handleSelect (item) {
304
- this.$emit('input', { name: item[this.displayField], id: item.head__id })
305
- if (this.relationFields) {
306
- for (const key in this.relationFields) {
307
- this.scopeData[this.relationFields[key]] = item[key]
308
- }
309
- }
310
- // 将处理携带属性
311
- }
312
-
313
- }
314
- }
315
- </script>
316
-
317
- <style lang='less' scoped>
318
- @import "@/assets/styles/common-table.less";
319
- @import '../../assets/common-input.less';
320
- .el-autocomplete{
321
- display:block;
322
- ::v-deep .el-input__inner{
323
- // height: 3vh;
324
- width: 100%;
325
- border: none;
326
- border-bottom: 1px solid #DCDCDC;
327
- border-radius: 0;
328
- }
329
- }
330
- ::v-deep .el-input__suffix {
331
- display: flex;
332
- align-items: center;
333
- }
334
- ::v-deep .el-dialog__body{
335
- padding: 0 10px;
336
- }
337
- // 弹框样式修改
338
- ::v-deep .el-dialog__wrapper{
339
- overflow: hidden;
340
- }
341
-
342
- ::v-deep .el-dialog__footer{
343
- padding-bottom: 5px;
344
- .el-button{
345
- width: 2.5vw;
346
- height: 2.222vh;
347
- border-radius: 2px;
348
- padding: 0;
349
- margin-left: 0;
350
- margin-right: 0.4166vw;
351
- ::v-deep span{
352
- opacity: 1;
353
- font-size: 0.625vw;
354
- font-family: Source Han Sans SC, Source Han Sans SC-Regular;
355
- font-weight: 400;
356
- color: #ffffff;
357
- }
358
- }
359
- }
360
-
361
- </style>
1
+ <template>
2
+ <div>
3
+ <el-autocomplete
4
+ v-model="displayName"
5
+ popper-class="advice-poper"
6
+ :class="basicDataStyle"
7
+ :fetch-suggestions="getAdvice"
8
+ :value-key="displayField"
9
+ :trigger-on-focus="false"
10
+ :placeholder="placeholder"
11
+ :disabled="JSON.parse(disabled)"
12
+ @select="handleSelect"
13
+ @keydown.delete.native="handleDeleteKeyDown"
14
+ >
15
+ <i slot="suffix" :class=" disabled ? 'el-icon-lock' : 'el-icon-search' " style="cursor: pointer" @click="showDialog" />
16
+ <template slot-scope="{item}">
17
+ <div>{{ item[displayField] + ' ' + '[' + item.head__code + ']' }}</div>
18
+ </template>
19
+ </el-autocomplete>
20
+
21
+ <el-dialog
22
+ :visible.sync="dialogVisible"
23
+ width="80%"
24
+ append-to-body
25
+ :modal-append-to-body="false"
26
+ >
27
+ <div class="dataDialog">
28
+ <BasicDataSelector :table-id="tableId" :limit-show="limitShow" :dialog-visible="dialogVisible" :much-select="muchSelect" @rowSelect="handleRowSelect" />
29
+ </div>
30
+ <span slot="footer" class="dialog-footer">
31
+ <el-button class="common-header-button close" type="primary" @click="close">取 消</el-button>
32
+ <el-button class="common-header-button" type="primary" @click="handleDialogConfirm">确 定</el-button>
33
+ </span>
34
+ </el-dialog>
35
+ </div>
36
+ </template>
37
+ <script>
38
+ import { getBasicDataSearchAdvice, getFormData } from '@/api/edit.js'
39
+ import BasicDataSelector from './dependcy/basic-data-selector.vue'
40
+ export default {
41
+ components: {
42
+ BasicDataSelector
43
+ // DataSelectorDialog
44
+ },
45
+ props: {
46
+ value: { // 双向绑定
47
+ type: [String, Object],
48
+ default: () => {
49
+ return { name: '', id: '' }
50
+ }
51
+ },
52
+ // 当选中一条基础资料的时候,默认选择基础资料的head__name属性
53
+ displayField: {
54
+ type: String,
55
+ default: 'head__name'
56
+ },
57
+ basicDataStyle: {
58
+ type: String,
59
+ default: 'default'
60
+ },
61
+ tableId: {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ disabled: {
66
+ type: [Boolean, String],
67
+ default: false
68
+ },
69
+ placeholder: {
70
+ type: String,
71
+ default: ''
72
+ },
73
+ // 当前控件操作的属性所在的数据对象(单据体中体现为一行数据
74
+ scopeData: {
75
+ type: Object,
76
+ default: null
77
+ },
78
+ relationFields: {
79
+ type: [Object, Array],
80
+ default: null
81
+ },
82
+ defaultValue: {
83
+ type: String,
84
+ default: ''
85
+ },
86
+ field: {
87
+ type: String,
88
+ default: ''
89
+ },
90
+ widgets: {
91
+ type: Array,
92
+ default: () => []
93
+ },
94
+ muchSelect: {
95
+ type: Boolean,
96
+ default: false
97
+ },
98
+ inputMoreSelect: { // 开启input内的多选
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ forDeadComponentFlag: { // 此标识用于写死的组件,将事件发射出去自己处理
103
+ type: Boolean,
104
+ default: false
105
+ }
106
+
107
+ },
108
+ data () {
109
+ return {
110
+ limitShow: 0, // 限制基础资料显示某个属性,1:审核状态状态,
111
+ dialogVisible: false,
112
+ currentSelectRow: {},
113
+ showName: '',
114
+ currentSelectMap: new Map(),
115
+ inputKey: ''
116
+ // relationFields:[{}]
117
+ }
118
+ },
119
+ computed: {
120
+ displayName: {
121
+ set (value) {
122
+ // 已经选中了一个值忽略再次输入
123
+ if (this.value.id) {
124
+ return
125
+ }
126
+ this.value.name = value
127
+ },
128
+ get () {
129
+ if (!this.value) {
130
+ return
131
+ }
132
+ return this.value.name
133
+ }
134
+ }
135
+ },
136
+ watch: {
137
+ value (newValue) {
138
+ if (!this.value) {
139
+ this.$emit('input', { name: '', id: null })
140
+ }
141
+ }
142
+ },
143
+ created () {
144
+ if (this.defaultValue && (!this.value || this.value.id === '')) {
145
+ return this.handleDefaultValue()
146
+ }
147
+ if (!this.value) {
148
+ this.$emit('input', { name: '', id: null })
149
+ }
150
+ },
151
+ methods: {
152
+
153
+ /**
154
+ * 根据默认值id获取数据
155
+ */
156
+ handleDefaultValue () {
157
+ const interval = setInterval(async () => {
158
+ if (this.tableId) {
159
+ clearInterval(interval)
160
+ const data = {
161
+ entityMark: '',
162
+ id: this.defaultValue,
163
+ pageNum: 1,
164
+ pageSize: 1,
165
+ tableId: this.tableId
166
+ }
167
+ const res = await getFormData(data)
168
+ if (res.code === 0) {
169
+ const data = {
170
+ id: this.defaultValue,
171
+ name: res.data[res.data.headIdentification].name
172
+ }
173
+ this.$emit('input', data)
174
+ }
175
+ }
176
+ }, 50)
177
+ },
178
+ /**
179
+ * dialog关闭和确定处理函数
180
+ */
181
+ handleClose () {
182
+ this.dialogVisible = false
183
+ },
184
+ close () {
185
+ this.dialogVisible = false
186
+ },
187
+ handleDialogConfirm () {
188
+ this.$emit('handleSelected', this.currentSelectRow)
189
+ if (this.forDeadComponentFlag) {
190
+ this.close()
191
+ return
192
+ }
193
+ if (this.currentSelectRow.length === 1 || (!this.muchSelect && !this.inputMoreSelect)) {
194
+ this.$emit('input', { id: this.currentSelectRow[0].head__id, name: this.currentSelectRow[0][this.displayField] })
195
+ if (this.relationFields) {
196
+ for (const key in this.relationFields) {
197
+ this.scopeData[this.relationFields[key]] = this.currentSelectRow[0][key]
198
+ }
199
+ }
200
+ this.close()
201
+ } else if (this.currentSelectRow.length > 1) {
202
+ if (this.inputMoreSelect) {
203
+ const idArr = []
204
+ const nameArr = []
205
+ this.currentSelectRow.forEach(e => {
206
+ idArr.push(e.head__id)
207
+ nameArr.push(e[this.displayField])
208
+ })
209
+ const data = {
210
+ id: idArr.toString(),
211
+ name: nameArr.toString()
212
+ }
213
+ this.$emit('input', data)
214
+ this.close()
215
+ }
216
+ if (this.muchSelect) {
217
+ const insertData = []
218
+ this.currentSelectRow.forEach((item, index) => {
219
+ const obj = {}
220
+ this.widgets.forEach((item2, index2) => {
221
+ if (item2.field === this.field) {
222
+ obj[item2.field] = { id: this.currentSelectRow[index].head__id, name: this.currentSelectRow[index][this.displayField] }
223
+ } else if (item2.type === 'basic_data') {
224
+ obj[item2.field] = { id: undefined, name: undefined }
225
+ } else {
226
+ obj[item2.field] = undefined
227
+ }
228
+ })
229
+ // 添加关联关系
230
+ const relationFieldsIndex = this.widgets.findIndex(d => d.field === this.field)
231
+ if (relationFieldsIndex !== -1) {
232
+ const relationFields = this.widgets[relationFieldsIndex].relationFields
233
+ for (const key in relationFields) {
234
+ obj[relationFields[key]] = this.currentSelectRow[index][key]
235
+ }
236
+ }
237
+ insertData.push(obj)
238
+ })
239
+ this.$emit('addMuchData', insertData)
240
+ this.close()
241
+ }
242
+ }
243
+ // this.$emit('input', { id: this.currentSelectRow.head__id, name: this.currentSelectRow.head__name })
244
+ // if (this.relationFields) {
245
+ // for (const key in this.relationFields) {
246
+ // this.scopeData[this.relationFields[key]] = this.currentSelectRow[key]
247
+ // }
248
+ // }
249
+ // this.close()
250
+ },
251
+
252
+ /**
253
+ * 在弹窗中选择基础资料
254
+ */
255
+ handleRowSelect (row) {
256
+ this.currentSelectRow = row
257
+ },
258
+ showDialog () {
259
+ // 后端这里的数据可能是字符串也可能是boolean类型
260
+ const disabled = typeof this.disabled === 'string'
261
+ ? Boolean(this.disabled)
262
+ : this.disabled
263
+
264
+ if (!disabled) {
265
+ this.dialogVisible = true
266
+ }
267
+ this.limitShow = 1
268
+ },
269
+
270
+ /**
271
+ * 清空选择
272
+ */
273
+ // delete按键处理
274
+ handleDeleteKeyDown () {
275
+ if (this.value.id) {
276
+ this.$emit('input', { name: '', id: null })
277
+ }
278
+ },
279
+
280
+ /**
281
+ * 基础资料搜索建议
282
+ */
283
+ // 获取建议结果
284
+ async getAdvice (queryString, callback) {
285
+ // 如果输入空字符串,不调用接口
286
+ const reg = /^\s*$/g
287
+ /* eslint-disable */
288
+ if (reg.test(this.displayName)) {
289
+ return callback([])
290
+ }
291
+
292
+ try {
293
+ const res = await getBasicDataSearchAdvice(this.tableId, this.displayName)
294
+ if (res.code !== 0) {
295
+ return
296
+ }
297
+ callback(res.data.records)
298
+ } catch (err) {
299
+ console.log(err)
300
+ }
301
+ },
302
+ // 选择一条建议
303
+ handleSelect (item) {
304
+ this.$emit('input', { name: item[this.displayField], id: item.head__id })
305
+ if (this.relationFields) {
306
+ for (const key in this.relationFields) {
307
+ this.scopeData[this.relationFields[key]] = item[key]
308
+ }
309
+ }
310
+ // 将处理携带属性
311
+ }
312
+
313
+ }
314
+ }
315
+ </script>
316
+
317
+ <style lang='less' scoped>
318
+ @import "@/assets/styles/common-table.less";
319
+ @import '../../assets/common-input.less';
320
+ .el-autocomplete{
321
+ display:block;
322
+ ::v-deep .el-input__inner{
323
+ // height: 3vh;
324
+ width: 100%;
325
+ border: none;
326
+ border-bottom: 1px solid #DCDCDC;
327
+ border-radius: 0;
328
+ }
329
+ }
330
+ ::v-deep .el-input__suffix {
331
+ display: flex;
332
+ align-items: center;
333
+ }
334
+ ::v-deep .el-dialog__body{
335
+ padding: 0 10px;
336
+ }
337
+ // 弹框样式修改
338
+ ::v-deep .el-dialog__wrapper{
339
+ overflow: hidden;
340
+ }
341
+
342
+ ::v-deep .el-dialog__footer{
343
+ padding-bottom: 5px;
344
+ .el-button{
345
+ width: 2.5vw;
346
+ height: 2.222vh;
347
+ border-radius: 2px;
348
+ padding: 0;
349
+ margin-left: 0;
350
+ margin-right: 0.4166vw;
351
+ ::v-deep span{
352
+ opacity: 1;
353
+ font-size: 0.625vw;
354
+ font-family: Source Han Sans SC, Source Han Sans SC-Regular;
355
+ font-weight: 400;
356
+ color: #ffffff;
357
+ }
358
+ }
359
+ }
360
+
361
+ </style>