@tongfun/tf-widget 0.1.21 → 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.
- package/README.md +49 -49
- package/lib/tf-widget.common.js +547 -503
- package/lib/tf-widget.css +1 -1
- package/lib/tf-widget.umd.js +547 -503
- package/lib/tf-widget.umd.min.js +4 -4
- package/package/svg-icon/index.js +8 -8
- package/package/svg-icon/src/SvgIcon.vue +59 -59
- package/package/t-data-list/index.js +6 -6
- package/package/t-data-list/main.vue +193 -193
- package/package/t-data-list/src/condition-input/basic.vue +31 -31
- package/package/t-data-list/src/condition-input/date.vue +106 -106
- package/package/t-data-list/src/condition-input/index.vue +100 -100
- package/package/t-data-list/src/condition-input/input.vue +31 -31
- package/package/t-data-list/src/condition-input/number.vue +115 -115
- package/package/t-data-list/src/condition-input/select.vue +86 -86
- package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
- package/package/t-data-list/src/js/operatorEnum.js +108 -108
- package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
- package/package/t-data-list/src/js/util.js +34 -34
- package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -93
- package/package/t-data-list/src/pushdown/push-down.vue +158 -158
- package/package/t-data-list/src/t-list-search.vue +36 -36
- package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
- package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
- package/package/t-data-list/src/t-plan/index.vue +195 -195
- package/package/t-data-list/src/t-plan/plan-content.vue +389 -389
- package/package/t-data-list/src/t-table/index.vue +129 -129
- package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
- package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
- package/package/t-data-list/src/t-table/table-group.vue +180 -180
- package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -246
- package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
- package/package/t-data-list/src/t-table/table-records.vue +337 -337
- package/package/t-input/children/address.vue +101 -101
- package/package/t-input/children/basic-display.vue +41 -41
- package/package/t-input/children/basic.vue +253 -253
- package/package/t-input/children/date.vue +89 -89
- package/package/t-input/children/group-components/group-dialog.vue +344 -344
- package/package/t-input/children/group.vue +126 -126
- package/package/t-input/children/input.vue +72 -72
- package/package/t-input/children/number.vue +74 -74
- package/package/t-input/children/select.vue +89 -89
- package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
- package/package/t-input/index.js +7 -7
- package/package/t-input/index.vue +337 -337
- package/package/t-input/tInputCache.js +24 -24
- package/package/tf-icon-picker/README.md +7 -7
- package/package/tf-icon-picker/index.js +8 -8
- package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
- package/package/tf-layout/README.md +115 -115
- package/package/tf-layout/index.js +8 -8
- package/package/tf-layout/src/components/tf-labelbar.vue +394 -394
- package/package/tf-layout/src/components/tf-menu.vue +180 -180
- package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
- package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
- package/package/tf-layout/src/tf-layout.vue +140 -140
- package/package/tf-widget/index.js +8 -8
- package/package/tf-widget/src/assets/common-input.less +10 -10
- package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
- package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
- package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
- package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
- package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
- package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
- package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
- package/package/tf-widget/src/children/date-time.vue +103 -103
- package/package/tf-widget/src/children/date.vue +103 -103
- package/package/tf-widget/src/children/decimal.vue +115 -115
- package/package/tf-widget/src/children/integer.vue +104 -104
- package/package/tf-widget/src/children/property.vue +59 -59
- package/package/tf-widget/src/children/single-line-text.vue +82 -82
- package/package/tf-widget/src/children/small-pictures.vue +223 -223
- package/package/tf-widget/src/children/text-area.vue +74 -74
- package/package/tf-widget/src/children/tf-select.vue +113 -113
- package/package/tf-widget/src/tf-widget.vue +175 -175
- package/package.json +44 -44
- package/src/api/edit.js +97 -97
- package/src/api/file-enclosure.js +26 -26
- package/src/api/push-down.js +19 -19
- package/src/api/table.js +294 -294
- package/src/api/tableV3.js +166 -160
- package/src/assets/images/icons/index.js +9 -9
- package/src/assets/images/icons/svg/add.svg +5 -5
- package/src/assets/images/icons/svg/push-down.svg +1 -1
- package/src/assets/images/icons/svg/remove.svg +1 -1
- package/src/assets/styles/common-table.less +202 -202
- package/src/directives/debounce.js +24 -24
- package/src/index.js +31 -31
- package/src/mixins/t-data-query-mixin.js +290 -290
- package/src/utils/auth.js +22 -22
- package/src/utils/request.js +42 -42
- package/src/utils/stato-anormale.js +59 -59
- package/src/utils/utils.js +109 -109
- package/src/utils/validate.js +84 -84
|
@@ -1,337 +1,337 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<component
|
|
4
|
-
:is="typeRelations[type]"
|
|
5
|
-
v-if="entity || notForm"
|
|
6
|
-
class="common-input"
|
|
7
|
-
:value="value"
|
|
8
|
-
:target="target"
|
|
9
|
-
:show-field="showField"
|
|
10
|
-
v-bind="property"
|
|
11
|
-
:common-flag="commonFlag"
|
|
12
|
-
:append-to-body="false"
|
|
13
|
-
:modal-append-to-body="true"
|
|
14
|
-
@selected="handleSelected"
|
|
15
|
-
@handleSelected="handleSelected"
|
|
16
|
-
@input="handleInput"
|
|
17
|
-
@isDel="handleDel"
|
|
18
|
-
@change="handleChange"
|
|
19
|
-
@delete="$emit('delete')"
|
|
20
|
-
@suggestSelected="$emit('suggestSelected',$event)"
|
|
21
|
-
/>
|
|
22
|
-
|
|
23
|
-
<el-form-item v-else :label-width="labelWidth" :prop="prop">
|
|
24
|
-
<template v-slot:label>
|
|
25
|
-
<el-tooltip effect="dark" :content="title" placement="top">
|
|
26
|
-
<span>{{ title }}</span>
|
|
27
|
-
</el-tooltip>
|
|
28
|
-
</template>
|
|
29
|
-
<component
|
|
30
|
-
:is="typeRelations[type]"
|
|
31
|
-
v-if="type !== 'basicCus'"
|
|
32
|
-
class="common-input"
|
|
33
|
-
:value="value"
|
|
34
|
-
:target="target"
|
|
35
|
-
:show-field="showField"
|
|
36
|
-
:common-flag="commonFlag"
|
|
37
|
-
:append-to-body="true"
|
|
38
|
-
:modal-append-to-body="false"
|
|
39
|
-
v-bind="property"
|
|
40
|
-
@isDel="handleDel"
|
|
41
|
-
@selected="handleSelected"
|
|
42
|
-
@handleSelected="handleSelected"
|
|
43
|
-
@input="handleInput"
|
|
44
|
-
@change="handleChange"
|
|
45
|
-
@delete="$emit('delete')"
|
|
46
|
-
@suggestSelected="$emit('suggestSelected',$event)"
|
|
47
|
-
/>
|
|
48
|
-
|
|
49
|
-
<slot />
|
|
50
|
-
</el-form-item>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
<script>
|
|
54
|
-
import tinput from './children/input.vue'
|
|
55
|
-
import tselect from './children/select.vue'
|
|
56
|
-
import tdate from './children/date.vue'
|
|
57
|
-
import tnumber from './children/number.vue'
|
|
58
|
-
import tbasicDisplay from './children/basic-display'
|
|
59
|
-
import tfile from './children/tfile/fiile-enclosure.vue'
|
|
60
|
-
import tbasic from './children/basic.vue'
|
|
61
|
-
import tGroup from './children/group.vue'
|
|
62
|
-
import tAddress from './children/address.vue'
|
|
63
|
-
import basicData from '../tf-widget/src/children/basic-data/basic-data.vue'
|
|
64
|
-
import { getTableIdByTableName } from '@/api/edit.js'
|
|
65
|
-
export default {
|
|
66
|
-
name: 'Tinput',
|
|
67
|
-
components: {
|
|
68
|
-
tinput, tnumber, tselect, tdate, tfile, tbasic, tbasicDisplay, basicData, tGroup, tAddress
|
|
69
|
-
},
|
|
70
|
-
props: {
|
|
71
|
-
// 双向绑定
|
|
72
|
-
value: {
|
|
73
|
-
type: [String, Number, Object, Array],
|
|
74
|
-
default: undefined
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* 控件类型
|
|
78
|
-
* input : 文本输入
|
|
79
|
-
* select: 下拉选择
|
|
80
|
-
* date 日期
|
|
81
|
-
* datetime 日期时间
|
|
82
|
-
* integer 整数
|
|
83
|
-
* decimal 小数
|
|
84
|
-
* text 文本域
|
|
85
|
-
* basicDisplay 基础资料展示字段,用于创建人等永远不能被填写的字段
|
|
86
|
-
* basicData 通用的基础资料
|
|
87
|
-
* basicCus 非通用的基础资料,
|
|
88
|
-
*/
|
|
89
|
-
type: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: 'input'
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* 控件属性
|
|
95
|
-
*/
|
|
96
|
-
// el-form-item 属性
|
|
97
|
-
labelWidth: {
|
|
98
|
-
type: String,
|
|
99
|
-
default: '150px'
|
|
100
|
-
},
|
|
101
|
-
// el-form-item属性
|
|
102
|
-
title: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: ''
|
|
105
|
-
},
|
|
106
|
-
// el form item属性,用来指定校验的属性的规则
|
|
107
|
-
prop: {
|
|
108
|
-
type: String,
|
|
109
|
-
default: ''
|
|
110
|
-
},
|
|
111
|
-
// 不在表单中使用这个控件,默认在表单中
|
|
112
|
-
notForm: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: false
|
|
115
|
-
},
|
|
116
|
-
// 在单据体中显示,当使用这个属性,默认开启not form
|
|
117
|
-
entity: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: false
|
|
120
|
-
},
|
|
121
|
-
/**
|
|
122
|
-
* 子组件的通用属性
|
|
123
|
-
*/
|
|
124
|
-
// 默认值
|
|
125
|
-
defaultValue: {
|
|
126
|
-
type: String,
|
|
127
|
-
default: ''
|
|
128
|
-
},
|
|
129
|
-
// 关闭
|
|
130
|
-
disabled: {
|
|
131
|
-
type: Boolean,
|
|
132
|
-
default: false
|
|
133
|
-
},
|
|
134
|
-
// 提示
|
|
135
|
-
placeholder: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: ''
|
|
138
|
-
},
|
|
139
|
-
/**
|
|
140
|
-
* select枚举类型属性
|
|
141
|
-
*/
|
|
142
|
-
// 下拉框属性,获取下拉的选项的参数
|
|
143
|
-
enumType: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: ''
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 数值类型属性
|
|
150
|
-
*/
|
|
151
|
-
// 小数属性,保留的小数个数
|
|
152
|
-
percision: {
|
|
153
|
-
type: Number,
|
|
154
|
-
default: 2
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* 多行文本文本类型
|
|
159
|
-
*/
|
|
160
|
-
// 文本域的行数
|
|
161
|
-
rows: {
|
|
162
|
-
type: Number,
|
|
163
|
-
default: 3
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* 基础资料类型属性
|
|
168
|
-
*/
|
|
169
|
-
// 基础资料相关信息的网络请求地址,和基础资料相关的一个请求参数
|
|
170
|
-
target: {
|
|
171
|
-
type: String,
|
|
172
|
-
default: ''
|
|
173
|
-
},
|
|
174
|
-
// 基础资料的搜索限制条件,将会被解析成多个高级过滤条件,拼接到查询条件里面
|
|
175
|
-
// 格式如下:{a:{name:'xx',id:'xx'}
|
|
176
|
-
limitation: {
|
|
177
|
-
type: Object,
|
|
178
|
-
default: () => {}
|
|
179
|
-
},
|
|
180
|
-
// 指定基础资料显示哪个属性作为展示的字段
|
|
181
|
-
// 没有值使用后端提供的配置,有值则覆盖后端的配置
|
|
182
|
-
displayField: {
|
|
183
|
-
type: String,
|
|
184
|
-
default: null
|
|
185
|
-
},
|
|
186
|
-
// todo:这两个属性功能已经重复,需要对接 // 基础资料需要展示的数据
|
|
187
|
-
showField: {
|
|
188
|
-
type: String,
|
|
189
|
-
default: ''
|
|
190
|
-
},
|
|
191
|
-
// 通用基础资料的表名
|
|
192
|
-
tableConfig: {
|
|
193
|
-
type: Object,
|
|
194
|
-
default: function () {
|
|
195
|
-
return {
|
|
196
|
-
enum: {},
|
|
197
|
-
name: ''
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
// 此标识用于写死的组件,将事件发射出去自己处理 ???????????
|
|
202
|
-
commonFlag: {
|
|
203
|
-
type: Boolean,
|
|
204
|
-
default: false
|
|
205
|
-
},
|
|
206
|
-
// 附件上传的文件列表
|
|
207
|
-
fileList: {
|
|
208
|
-
type: Array,
|
|
209
|
-
default: () => []
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
provide () {
|
|
214
|
-
return {
|
|
215
|
-
entity: this.entity,
|
|
216
|
-
target: this.target,
|
|
217
|
-
enumType: this.enumType,
|
|
218
|
-
placeholder: this.placeholder,
|
|
219
|
-
// 是否是日期时间控件
|
|
220
|
-
datetime: this.type === 'datetime',
|
|
221
|
-
// 小数的情况下,指定小数的精度
|
|
222
|
-
percision: this.type === 'decimal' ? this.percision : null,
|
|
223
|
-
// 是否是文本域控件
|
|
224
|
-
text: this.type === 'text',
|
|
225
|
-
// 文本域的行数
|
|
226
|
-
rows: this.type === 'text' ? this.rows : null,
|
|
227
|
-
defaultValue: this.defaultValue
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
data () {
|
|
231
|
-
return {
|
|
232
|
-
typeRelations: {
|
|
233
|
-
input: 'tinput',
|
|
234
|
-
text: 'tinput',
|
|
235
|
-
date: 'tdate',
|
|
236
|
-
datetime: 'tdate',
|
|
237
|
-
integer: 'tnumber',
|
|
238
|
-
decimal: 'tnumber',
|
|
239
|
-
select: 'tselect',
|
|
240
|
-
basicDisplay: 'tbasicDisplay',
|
|
241
|
-
basicData: 'basicData',
|
|
242
|
-
basic: 'tbasic',
|
|
243
|
-
file: 'tfile',
|
|
244
|
-
group: 'tGroup',
|
|
245
|
-
address: 'tAddress'
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
computed: {
|
|
250
|
-
// 部分属性加入到计算属性传递下去,不使用provide的属性是为了获取响应式支持
|
|
251
|
-
property () {
|
|
252
|
-
return {
|
|
253
|
-
disabled: this.disabled,
|
|
254
|
-
tableId: this.tableConfig.enum[this.tableConfig.name] || null,
|
|
255
|
-
fileList: this.fileList,
|
|
256
|
-
displayField: this.displayField,
|
|
257
|
-
limitation: this.limitation
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
created () {
|
|
262
|
-
if (this.type === 'basicData') {
|
|
263
|
-
this.getTableId()
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
methods: {
|
|
267
|
-
// 通知触发了删除事件
|
|
268
|
-
handleDel () {
|
|
269
|
-
this.$emit('isDel')
|
|
270
|
-
},
|
|
271
|
-
// 基础资料的方法
|
|
272
|
-
handleSelected (rows) {
|
|
273
|
-
this.$emit('selected', rows)
|
|
274
|
-
},
|
|
275
|
-
// 选中的值发生了变化,目前仅仅是为了 枚举/下拉类型使用
|
|
276
|
-
handleChange (newValue) {
|
|
277
|
-
this.$emit('change', newValue)
|
|
278
|
-
},
|
|
279
|
-
handleInput (value) {
|
|
280
|
-
this.$emit('input', value)
|
|
281
|
-
},
|
|
282
|
-
async getTableId () {
|
|
283
|
-
const conf = this.tableConfig
|
|
284
|
-
// 如果已经存在了tableId,则不进行获取
|
|
285
|
-
if (conf.enum[conf.name]) {
|
|
286
|
-
return
|
|
287
|
-
}
|
|
288
|
-
const res = await getTableIdByTableName(conf.name)
|
|
289
|
-
if (res.code !== 0) {
|
|
290
|
-
return this.$message.error(res.msg)
|
|
291
|
-
}
|
|
292
|
-
conf.enum[conf.name] = res.data
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
</script>
|
|
297
|
-
|
|
298
|
-
<style scoped lang='less'>
|
|
299
|
-
.common-input {
|
|
300
|
-
// 即便是disable,也不改变背景色
|
|
301
|
-
// 采用直接子元素的方式避免影响到分页的样式
|
|
302
|
-
::v-deep >.el-input__inner {
|
|
303
|
-
background: #fff !important;
|
|
304
|
-
border:none;
|
|
305
|
-
border-bottom:1px solid #DCDCDC;
|
|
306
|
-
border-radius: 0;
|
|
307
|
-
}
|
|
308
|
-
::v-deep>div{
|
|
309
|
-
>div{
|
|
310
|
-
>.el-input__inner{
|
|
311
|
-
background: #fff !important;
|
|
312
|
-
border:none;
|
|
313
|
-
border-bottom:1px solid #DCDCDC;
|
|
314
|
-
border-radius: 0;
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
>div{
|
|
318
|
-
>.el-input__inner{
|
|
319
|
-
background: #fff !important;
|
|
320
|
-
border:none;
|
|
321
|
-
border-bottom:1px solid #DCDCDC;
|
|
322
|
-
border-radius: 0;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
.el-form-item{
|
|
330
|
-
::v-deep .el-form-item__label{
|
|
331
|
-
overflow: hidden;
|
|
332
|
-
white-space: nowrap;
|
|
333
|
-
text-overflow: ellipsis;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<component
|
|
4
|
+
:is="typeRelations[type]"
|
|
5
|
+
v-if="entity || notForm"
|
|
6
|
+
class="common-input"
|
|
7
|
+
:value="value"
|
|
8
|
+
:target="target"
|
|
9
|
+
:show-field="showField"
|
|
10
|
+
v-bind="property"
|
|
11
|
+
:common-flag="commonFlag"
|
|
12
|
+
:append-to-body="false"
|
|
13
|
+
:modal-append-to-body="true"
|
|
14
|
+
@selected="handleSelected"
|
|
15
|
+
@handleSelected="handleSelected"
|
|
16
|
+
@input="handleInput"
|
|
17
|
+
@isDel="handleDel"
|
|
18
|
+
@change="handleChange"
|
|
19
|
+
@delete="$emit('delete')"
|
|
20
|
+
@suggestSelected="$emit('suggestSelected',$event)"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<el-form-item v-else :label-width="labelWidth" :prop="prop">
|
|
24
|
+
<template v-slot:label>
|
|
25
|
+
<el-tooltip effect="dark" :content="title" placement="top">
|
|
26
|
+
<span>{{ title }}</span>
|
|
27
|
+
</el-tooltip>
|
|
28
|
+
</template>
|
|
29
|
+
<component
|
|
30
|
+
:is="typeRelations[type]"
|
|
31
|
+
v-if="type !== 'basicCus'"
|
|
32
|
+
class="common-input"
|
|
33
|
+
:value="value"
|
|
34
|
+
:target="target"
|
|
35
|
+
:show-field="showField"
|
|
36
|
+
:common-flag="commonFlag"
|
|
37
|
+
:append-to-body="true"
|
|
38
|
+
:modal-append-to-body="false"
|
|
39
|
+
v-bind="property"
|
|
40
|
+
@isDel="handleDel"
|
|
41
|
+
@selected="handleSelected"
|
|
42
|
+
@handleSelected="handleSelected"
|
|
43
|
+
@input="handleInput"
|
|
44
|
+
@change="handleChange"
|
|
45
|
+
@delete="$emit('delete')"
|
|
46
|
+
@suggestSelected="$emit('suggestSelected',$event)"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<slot />
|
|
50
|
+
</el-form-item>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<script>
|
|
54
|
+
import tinput from './children/input.vue'
|
|
55
|
+
import tselect from './children/select.vue'
|
|
56
|
+
import tdate from './children/date.vue'
|
|
57
|
+
import tnumber from './children/number.vue'
|
|
58
|
+
import tbasicDisplay from './children/basic-display'
|
|
59
|
+
import tfile from './children/tfile/fiile-enclosure.vue'
|
|
60
|
+
import tbasic from './children/basic.vue'
|
|
61
|
+
import tGroup from './children/group.vue'
|
|
62
|
+
import tAddress from './children/address.vue'
|
|
63
|
+
import basicData from '../tf-widget/src/children/basic-data/basic-data.vue'
|
|
64
|
+
import { getTableIdByTableName } from '@/api/edit.js'
|
|
65
|
+
export default {
|
|
66
|
+
name: 'Tinput',
|
|
67
|
+
components: {
|
|
68
|
+
tinput, tnumber, tselect, tdate, tfile, tbasic, tbasicDisplay, basicData, tGroup, tAddress
|
|
69
|
+
},
|
|
70
|
+
props: {
|
|
71
|
+
// 双向绑定
|
|
72
|
+
value: {
|
|
73
|
+
type: [String, Number, Object, Array],
|
|
74
|
+
default: undefined
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* 控件类型
|
|
78
|
+
* input : 文本输入
|
|
79
|
+
* select: 下拉选择
|
|
80
|
+
* date 日期
|
|
81
|
+
* datetime 日期时间
|
|
82
|
+
* integer 整数
|
|
83
|
+
* decimal 小数
|
|
84
|
+
* text 文本域
|
|
85
|
+
* basicDisplay 基础资料展示字段,用于创建人等永远不能被填写的字段
|
|
86
|
+
* basicData 通用的基础资料
|
|
87
|
+
* basicCus 非通用的基础资料,
|
|
88
|
+
*/
|
|
89
|
+
type: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: 'input'
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* 控件属性
|
|
95
|
+
*/
|
|
96
|
+
// el-form-item 属性
|
|
97
|
+
labelWidth: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: '150px'
|
|
100
|
+
},
|
|
101
|
+
// el-form-item属性
|
|
102
|
+
title: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: ''
|
|
105
|
+
},
|
|
106
|
+
// el form item属性,用来指定校验的属性的规则
|
|
107
|
+
prop: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ''
|
|
110
|
+
},
|
|
111
|
+
// 不在表单中使用这个控件,默认在表单中
|
|
112
|
+
notForm: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: false
|
|
115
|
+
},
|
|
116
|
+
// 在单据体中显示,当使用这个属性,默认开启not form
|
|
117
|
+
entity: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* 子组件的通用属性
|
|
123
|
+
*/
|
|
124
|
+
// 默认值
|
|
125
|
+
defaultValue: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: ''
|
|
128
|
+
},
|
|
129
|
+
// 关闭
|
|
130
|
+
disabled: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
// 提示
|
|
135
|
+
placeholder: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: ''
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* select枚举类型属性
|
|
141
|
+
*/
|
|
142
|
+
// 下拉框属性,获取下拉的选项的参数
|
|
143
|
+
enumType: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: ''
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 数值类型属性
|
|
150
|
+
*/
|
|
151
|
+
// 小数属性,保留的小数个数
|
|
152
|
+
percision: {
|
|
153
|
+
type: Number,
|
|
154
|
+
default: 2
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 多行文本文本类型
|
|
159
|
+
*/
|
|
160
|
+
// 文本域的行数
|
|
161
|
+
rows: {
|
|
162
|
+
type: Number,
|
|
163
|
+
default: 3
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 基础资料类型属性
|
|
168
|
+
*/
|
|
169
|
+
// 基础资料相关信息的网络请求地址,和基础资料相关的一个请求参数
|
|
170
|
+
target: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: ''
|
|
173
|
+
},
|
|
174
|
+
// 基础资料的搜索限制条件,将会被解析成多个高级过滤条件,拼接到查询条件里面
|
|
175
|
+
// 格式如下:{a:{name:'xx',id:'xx'}
|
|
176
|
+
limitation: {
|
|
177
|
+
type: Object,
|
|
178
|
+
default: () => {}
|
|
179
|
+
},
|
|
180
|
+
// 指定基础资料显示哪个属性作为展示的字段
|
|
181
|
+
// 没有值使用后端提供的配置,有值则覆盖后端的配置
|
|
182
|
+
displayField: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: null
|
|
185
|
+
},
|
|
186
|
+
// todo:这两个属性功能已经重复,需要对接 // 基础资料需要展示的数据
|
|
187
|
+
showField: {
|
|
188
|
+
type: String,
|
|
189
|
+
default: ''
|
|
190
|
+
},
|
|
191
|
+
// 通用基础资料的表名
|
|
192
|
+
tableConfig: {
|
|
193
|
+
type: Object,
|
|
194
|
+
default: function () {
|
|
195
|
+
return {
|
|
196
|
+
enum: {},
|
|
197
|
+
name: ''
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
// 此标识用于写死的组件,将事件发射出去自己处理 ???????????
|
|
202
|
+
commonFlag: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
default: false
|
|
205
|
+
},
|
|
206
|
+
// 附件上传的文件列表
|
|
207
|
+
fileList: {
|
|
208
|
+
type: Array,
|
|
209
|
+
default: () => []
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
},
|
|
213
|
+
provide () {
|
|
214
|
+
return {
|
|
215
|
+
entity: this.entity,
|
|
216
|
+
target: this.target,
|
|
217
|
+
enumType: this.enumType,
|
|
218
|
+
placeholder: this.placeholder,
|
|
219
|
+
// 是否是日期时间控件
|
|
220
|
+
datetime: this.type === 'datetime',
|
|
221
|
+
// 小数的情况下,指定小数的精度
|
|
222
|
+
percision: this.type === 'decimal' ? this.percision : null,
|
|
223
|
+
// 是否是文本域控件
|
|
224
|
+
text: this.type === 'text',
|
|
225
|
+
// 文本域的行数
|
|
226
|
+
rows: this.type === 'text' ? this.rows : null,
|
|
227
|
+
defaultValue: this.defaultValue
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
data () {
|
|
231
|
+
return {
|
|
232
|
+
typeRelations: {
|
|
233
|
+
input: 'tinput',
|
|
234
|
+
text: 'tinput',
|
|
235
|
+
date: 'tdate',
|
|
236
|
+
datetime: 'tdate',
|
|
237
|
+
integer: 'tnumber',
|
|
238
|
+
decimal: 'tnumber',
|
|
239
|
+
select: 'tselect',
|
|
240
|
+
basicDisplay: 'tbasicDisplay',
|
|
241
|
+
basicData: 'basicData',
|
|
242
|
+
basic: 'tbasic',
|
|
243
|
+
file: 'tfile',
|
|
244
|
+
group: 'tGroup',
|
|
245
|
+
address: 'tAddress'
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
computed: {
|
|
250
|
+
// 部分属性加入到计算属性传递下去,不使用provide的属性是为了获取响应式支持
|
|
251
|
+
property () {
|
|
252
|
+
return {
|
|
253
|
+
disabled: this.disabled,
|
|
254
|
+
tableId: this.tableConfig.enum[this.tableConfig.name] || null,
|
|
255
|
+
fileList: this.fileList,
|
|
256
|
+
displayField: this.displayField,
|
|
257
|
+
limitation: this.limitation
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
created () {
|
|
262
|
+
if (this.type === 'basicData') {
|
|
263
|
+
this.getTableId()
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
methods: {
|
|
267
|
+
// 通知触发了删除事件
|
|
268
|
+
handleDel () {
|
|
269
|
+
this.$emit('isDel')
|
|
270
|
+
},
|
|
271
|
+
// 基础资料的方法
|
|
272
|
+
handleSelected (rows) {
|
|
273
|
+
this.$emit('selected', rows)
|
|
274
|
+
},
|
|
275
|
+
// 选中的值发生了变化,目前仅仅是为了 枚举/下拉类型使用
|
|
276
|
+
handleChange (newValue) {
|
|
277
|
+
this.$emit('change', newValue)
|
|
278
|
+
},
|
|
279
|
+
handleInput (value) {
|
|
280
|
+
this.$emit('input', value)
|
|
281
|
+
},
|
|
282
|
+
async getTableId () {
|
|
283
|
+
const conf = this.tableConfig
|
|
284
|
+
// 如果已经存在了tableId,则不进行获取
|
|
285
|
+
if (conf.enum[conf.name]) {
|
|
286
|
+
return
|
|
287
|
+
}
|
|
288
|
+
const res = await getTableIdByTableName(conf.name)
|
|
289
|
+
if (res.code !== 0) {
|
|
290
|
+
return this.$message.error(res.msg)
|
|
291
|
+
}
|
|
292
|
+
conf.enum[conf.name] = res.data
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
</script>
|
|
297
|
+
|
|
298
|
+
<style scoped lang='less'>
|
|
299
|
+
.common-input {
|
|
300
|
+
// 即便是disable,也不改变背景色
|
|
301
|
+
// 采用直接子元素的方式避免影响到分页的样式
|
|
302
|
+
::v-deep >.el-input__inner {
|
|
303
|
+
background: #fff !important;
|
|
304
|
+
border:none;
|
|
305
|
+
border-bottom:1px solid #DCDCDC;
|
|
306
|
+
border-radius: 0;
|
|
307
|
+
}
|
|
308
|
+
::v-deep>div{
|
|
309
|
+
>div{
|
|
310
|
+
>.el-input__inner{
|
|
311
|
+
background: #fff !important;
|
|
312
|
+
border:none;
|
|
313
|
+
border-bottom:1px solid #DCDCDC;
|
|
314
|
+
border-radius: 0;
|
|
315
|
+
|
|
316
|
+
}
|
|
317
|
+
>div{
|
|
318
|
+
>.el-input__inner{
|
|
319
|
+
background: #fff !important;
|
|
320
|
+
border:none;
|
|
321
|
+
border-bottom:1px solid #DCDCDC;
|
|
322
|
+
border-radius: 0;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
}
|
|
329
|
+
.el-form-item{
|
|
330
|
+
::v-deep .el-form-item__label{
|
|
331
|
+
overflow: hidden;
|
|
332
|
+
white-space: nowrap;
|
|
333
|
+
text-overflow: ellipsis;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
</style>
|