@tongfun/tf-widget 0.1.7 → 0.1.11

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 (78) hide show
  1. package/.browserslistrc +3 -3
  2. package/.editorconfig +5 -5
  3. package/.eslintrc.js +17 -17
  4. package/README.md +39 -8
  5. package/dist/css/chunk-9c7a8e06.920744ef.css +1 -0
  6. package/dist/css/chunk-vendors.de967301.css +1 -0
  7. package/dist/css/index.153bd82e.css +1 -0
  8. package/dist/fonts/element-icons.535877f5.woff +0 -0
  9. package/dist/fonts/element-icons.732389de.ttf +0 -0
  10. package/dist/js/chunk-9c7a8e06.ffff58b5.js +1 -0
  11. package/dist/js/chunk-vendors.45086d09.js +39 -0
  12. package/dist/js/index.52bcef0d.js +1 -0
  13. package/lib/css/1.920744ef.css +1 -0
  14. package/lib/tf-widget.common.1.js +395 -0
  15. package/lib/tf-widget.common.js +88426 -63173
  16. package/lib/tf-widget.css +1 -1
  17. package/lib/tf-widget.umd.1.js +395 -0
  18. package/lib/tf-widget.umd.js +88425 -63172
  19. package/lib/tf-widget.umd.min.1.js +1 -0
  20. package/lib/tf-widget.umd.min.js +19 -3
  21. package/package/t-data-list/index.js +6 -0
  22. package/package/t-data-list/main.vue +192 -0
  23. package/package/t-data-list/src/condition-input/basic.vue +31 -0
  24. package/package/t-data-list/src/condition-input/date.vue +106 -0
  25. package/package/t-data-list/src/condition-input/index.vue +100 -0
  26. package/package/t-data-list/src/condition-input/input.vue +31 -0
  27. package/package/t-data-list/src/condition-input/number.vue +115 -0
  28. package/package/t-data-list/src/condition-input/select.vue +86 -0
  29. package/package/t-data-list/src/js/fieldTypeEnum.js +10 -0
  30. package/package/t-data-list/src/js/operatorEnum.js +109 -0
  31. package/package/t-data-list/src/js/qureyParamsEnum.js +4 -0
  32. package/package/t-data-list/src/js/util.js +34 -0
  33. package/package/t-data-list/src/mixins/button-controll-mixin.js +77 -0
  34. package/package/t-data-list/src/pushdown/push-down.vue +158 -0
  35. package/package/t-data-list/src/t-list-search.vue +32 -0
  36. package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -0
  37. package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -0
  38. package/package/t-data-list/src/t-plan/index.vue +190 -0
  39. package/package/t-data-list/src/t-plan/plan-content.vue +396 -0
  40. package/package/t-data-list/src/t-table/index.vue +120 -0
  41. package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -0
  42. package/package/t-data-list/src/t-table/table-group-item.vue +87 -0
  43. package/package/t-data-list/src/t-table/table-group.vue +179 -0
  44. package/package/t-data-list/src/t-table/table-records-header-popover.vue +250 -0
  45. package/package/t-data-list/src/t-table/table-records-selected.vue +159 -0
  46. package/package/t-data-list/src/t-table/table-records.vue +324 -0
  47. package/package/t-input/children/address.vue +101 -0
  48. package/package/t-input/children/basic-display.vue +41 -0
  49. package/package/t-input/children/basic.vue +251 -0
  50. package/package/t-input/children/date.vue +89 -0
  51. package/package/t-input/children/group-components/group-dialog.vue +350 -0
  52. package/package/t-input/children/group.vue +126 -0
  53. package/package/t-input/children/input.vue +72 -0
  54. package/package/t-input/children/number.vue +74 -0
  55. package/package/t-input/children/select.vue +89 -0
  56. package/package/t-input/children/tfile/fiile-enclosure.vue +233 -0
  57. package/package/t-input/children/tfile/file-img/comp.png +0 -0
  58. package/package/t-input/children/tfile/file-img/excel.png +0 -0
  59. package/package/t-input/children/tfile/file-img/img.png +0 -0
  60. package/package/t-input/children/tfile/file-img/pdf.png +0 -0
  61. package/package/t-input/children/tfile/file-img/word.png +0 -0
  62. package/package/t-input/index.js +7 -0
  63. package/package/t-input/index.vue +337 -0
  64. package/package/t-input/tInputCache.js +24 -0
  65. package/package/tf-layout/README.md +115 -0
  66. package/package/tf-layout/index.js +8 -0
  67. package/package/tf-layout/src/components/tf-labelbar.vue +378 -0
  68. package/package/tf-layout/src/components/tf-menu.vue +180 -0
  69. package/package/tf-layout/src/components/tf-right-menu.vue +89 -0
  70. package/package/tf-layout/src/components/tf-rotate-box.vue +50 -0
  71. package/package/tf-layout/src/tf-layout.vue +115 -0
  72. package/package.json +4 -2
  73. package/postinstall.js +10 -10
  74. package/src/api/file-enclosure.js +26 -0
  75. package/src/api/push-down.js +19 -0
  76. package/src/api/tableV3.js +186 -0
  77. package/src/index.js +11 -3
  78. package/src/mixins/t-data-query-mixin.js +289 -0
@@ -0,0 +1,396 @@
1
+ <template>
2
+ <div v-show="visible" v-clickoutside="handleClickOut" class="plan-content">
3
+ <!--
4
+ 方案详情,包含名称,过滤条件
5
+ -->
6
+ <div class="plan-details">
7
+ <div class="plan-title">
8
+ <span class="title">方案名称:</span>
9
+ <el-input v-model="planContent.name" size="mini" />
10
+ <span class="error">{{ errorMsg }}</span>
11
+ </div>
12
+
13
+ <!-- 常用条件 -->
14
+ <div class="condition-always">
15
+ <span class="title">常用条件</span>
16
+ <el-scrollbar>
17
+ <ConditionAlwaysItem
18
+ v-for="item in planContent.schemeUsefulList"
19
+ :key="item.field"
20
+ v-model="item.values"
21
+ :data="item"
22
+ />
23
+ </el-scrollbar>
24
+ </div>
25
+
26
+ <!--高级过滤条件 -->
27
+ <div class="plan-conditions">
28
+ <span class="title">高级查询</span>
29
+ <div>
30
+ <ConditionItem
31
+ v-for="condition in planContent.contentsList"
32
+ :key="condition.id"
33
+ :condition="condition"
34
+ @remove="removeCondition(condition)"
35
+ />
36
+ </div>
37
+
38
+ <div class="add-button" @click="addCondition">
39
+ <i class="el-icon-plus" />
40
+ <span>添加</span>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+ <!--
46
+ 方案操作
47
+ -->
48
+ <div class="plan-buttons">
49
+ <div class="buttons">
50
+ <el-button type="primary" size="mini" @click="conditionChange">查询</el-button>
51
+ <el-button type="primary" size="mini" @click="update($event)">保存</el-button>
52
+ <el-button type="primary" size="mini" @click="add">保存为新方案</el-button>
53
+ <el-button type="primary" size="mini" :disabled="planContent.isDefault" @click="update($event,true)">保存为默认</el-button>
54
+ <el-button type="primary" size="mini" @click="deletePlan">删除方案</el-button>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </template>
59
+ <script>
60
+ import { getAllOverOperatorList } from '../js/operatorEnum'
61
+ import Clickoutside from 'element-ui/src/utils/clickoutside'
62
+ import ConditionItem from './condition-mult-item.vue'
63
+ import ConditionAlwaysItem from './condition-always-item.vue'
64
+ import { addPlan, deletePlan, updatePlan } from '@/api/tableV3.js'
65
+ export default {
66
+ components: {
67
+ ConditionItem,
68
+ ConditionAlwaysItem
69
+ },
70
+ directives: { Clickoutside },
71
+ props: {
72
+ visible: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ // 方案详情的内容
77
+ content: {
78
+ type: Object,
79
+ default: null
80
+ },
81
+ // 当前所有方案的名称
82
+ planNames: {
83
+ type: Array,
84
+ default: null
85
+ }
86
+ },
87
+ data () {
88
+ return {
89
+ doSearch: false,
90
+ errorMsg: '',
91
+ planContent: {
92
+ name: '',
93
+ schemeUsefulList: [],
94
+ contentsList: []
95
+ }
96
+ }
97
+ },
98
+ inject: ['target'],
99
+ watch: {
100
+ content (newValue) {
101
+ const contentCopy = JSON.parse(JSON.stringify(newValue))
102
+ // 后端大佬骗人,高级过滤条件没有值不一定都是空数组,还有可能是null
103
+ contentCopy.contentsList = contentCopy.contentsList || []
104
+ // 后端大佬没有给常用默认值的时候,前端自行添加默认值
105
+ for (const alwaysItem of contentCopy.schemeUsefulList) {
106
+ if (!alwaysItem.values.length) {
107
+ alwaysItem.values.push('-1')
108
+ }
109
+ }
110
+
111
+ this.planContent = contentCopy
112
+ if (this.doSearch) {
113
+ this.conditionChange()
114
+ this.doSearch = false
115
+ }
116
+ }
117
+ },
118
+ created () {
119
+ this.$on('doSearch', () => {
120
+ this.doSearch = true
121
+ })
122
+ },
123
+ methods: {
124
+ handleClickOut () {
125
+ if (!this.visible) return
126
+ this.$emit('update:visible', false)
127
+ },
128
+ /**
129
+ * 添加一个高级过滤条件
130
+ */
131
+ addCondition () {
132
+ const conditionModel = {
133
+ id: Math.random().toString(36).slice(8),
134
+ leftBracket: '(',
135
+ field: '',
136
+ operator: '',
137
+ value: '',
138
+ rightBracket: ')',
139
+ relation: 'AND',
140
+ fieldType: '',
141
+ userSchemeId: this.content.id
142
+ }
143
+ this.planContent.contentsList.push(conditionModel)
144
+ },
145
+
146
+ /**
147
+ * 删除一个高级过滤条件
148
+ */
149
+ removeCondition (condition) {
150
+ const index = this.planContent.contentsList.indexOf(condition)
151
+ this.planContent.contentsList.splice(index, 1)
152
+ },
153
+
154
+ /**
155
+ * 条件前端校验
156
+ * 校验含有空值,以及括号是否闭合
157
+ */
158
+ conditionValidate () {
159
+ const bracketStack = []
160
+ for (const condition of this.planContent.contentsList) {
161
+ if (!getAllOverOperatorList().includes(condition.operator) && !condition.value) {
162
+ this.$message.error('方案中存在没有填写内容的条件')
163
+ return false
164
+ }
165
+
166
+ bracketStack.push(...condition.leftBracket.split(''))
167
+ for (let i = 0; i < condition.rightBracket.length; i++) {
168
+ if (!bracketStack.pop()) {
169
+ this.$message.error('方案中条件的括号没有闭合')
170
+ return false
171
+ }
172
+ }
173
+ }
174
+
175
+ if (bracketStack.length) {
176
+ this.$message.error('方案中条件的括号没有闭合')
177
+ return false
178
+ }
179
+
180
+ return true
181
+ },
182
+
183
+ /**
184
+ * 搜索按钮的处理函数
185
+ * 条件已经变更,将变更后的条件发射出去,父组件接受处理后使用新的条件调用接口查询数据
186
+ */
187
+ conditionChange () {
188
+ if (!this.conditionValidate()) {
189
+ return
190
+ }
191
+
192
+ // 常用条件格式化
193
+ const conditionAlways = []
194
+ for (const conditionAlwaysItem of this.planContent.schemeUsefulList) {
195
+ conditionAlways.push({
196
+ field: conditionAlwaysItem.field,
197
+ values: conditionAlwaysItem.values
198
+ })
199
+ }
200
+
201
+ // 高级过滤条件格式化
202
+ const conditionMulti = []
203
+ const getQueryMultiConditonItem = function (sourceMultiItem, index) {
204
+ const keys = [
205
+ 'leftBracket',
206
+ 'field',
207
+ 'operator',
208
+ 'value',
209
+ 'rightBracket',
210
+ 'relation',
211
+ 'fieldType'
212
+ ]
213
+ const res = {}
214
+ res.sort = index
215
+ for (const key of keys) {
216
+ res[key] = sourceMultiItem[key]
217
+ }
218
+ return res
219
+ }
220
+
221
+ this.planContent.contentsList.forEach((item, index) => {
222
+ conditionMulti.push(getQueryMultiConditonItem(item, index))
223
+ })
224
+ this.$emit('update:visible', false)
225
+ this.$emit('change', { conditionAlways, conditionMulti })
226
+ },
227
+
228
+ /**
229
+ * 方案增改接口数据格式处理
230
+ * 新增和修改方案的接口数据格式一致,统一将页面数据格式化
231
+ */
232
+ paramDataFormat (type, setDefault) {
233
+ // 处理方案信息
234
+ const planMsg = {
235
+ name: this.planContent.name,
236
+ isDefault: false
237
+ }
238
+ if (type === 'update') {
239
+ planMsg.id = this.planContent.id
240
+ planMsg.isDefault = typeof setDefault === 'undefined'
241
+ ? this.planContent.isDefault
242
+ : setDefault
243
+ }
244
+
245
+ // 处理常用条件的结果
246
+ const alwaysConditionData = []
247
+ for (const alwaysItem of this.planContent.schemeUsefulList) {
248
+ alwaysConditionData.push({
249
+ field: alwaysItem.field,
250
+ values: alwaysItem.values
251
+ })
252
+ }
253
+ // 添加高级过滤条件的sort属性
254
+ const multiConditionData = JSON.parse(JSON.stringify(this.planContent.contentsList))
255
+ multiConditionData.forEach((item, index) => {
256
+ item.sort = index
257
+ item.id = null
258
+ })
259
+
260
+ return {
261
+ planMsg,
262
+ conditionAlways: alwaysConditionData,
263
+ conditionMulti: multiConditionData
264
+ }
265
+ },
266
+
267
+ /**
268
+ * 保存按钮和设置为默认方案按钮的处理函数
269
+ * 方案的修改,和修改为默认方案
270
+ */
271
+ async update (event, setDefault) {
272
+ if (this.planContent.id === '0') {
273
+ return this.$message.error('缺省方案不能被修改,可以尝试保存为新方案')
274
+ }
275
+ if (this.planNames.filter(name => name !== this.planContent.name).includes(this.planContent.name)) {
276
+ return this.$message.error('该名称已经被其他方案占用')
277
+ }
278
+ if (!this.conditionValidate()) {
279
+ return
280
+ }
281
+ const res = await updatePlan(this.target, this.paramDataFormat('update', setDefault))
282
+ if (res.code !== 0) {
283
+ return this.$message.error(res.msg)
284
+ }
285
+ this.$message.success('修改成功')
286
+ this.$emit('listChange', this.planContent.id)
287
+ },
288
+
289
+ /**
290
+ * 保存为新方案的按钮处理函数
291
+ * 添加一个新的方案
292
+ */
293
+ async add () {
294
+ if (this.planNames.includes(this.planContent.name)) {
295
+ return this.$message.error('该方案名称已经存在')
296
+ }
297
+ if (!this.conditionValidate()) {
298
+ return
299
+ }
300
+ const res = await addPlan(this.target, this.paramDataFormat('insert'))
301
+ if (res.code !== 0) {
302
+ return this.$message.error(res.msg)
303
+ }
304
+ this.$message.success('保存成功')
305
+ this.$emit('listChange', res.data)
306
+ },
307
+
308
+ /**
309
+ * 删除当前方案
310
+ */
311
+ async deletePlan () {
312
+ if (this.planContent.id === '0') {
313
+ return this.$message.error('缺省方案不允许删除')
314
+ }
315
+ const res = await deletePlan(this.target, this.planContent.id)
316
+ if (res.code !== 0) {
317
+ return this.$message.error(res.msg)
318
+ }
319
+ this.$message.success('删除成功')
320
+ this.$emit('listChange')
321
+ }
322
+ }
323
+ }
324
+ </script>
325
+
326
+ <style scoped lang='less'>
327
+ .title {
328
+ font-size:18px;
329
+ }
330
+ .plan-content {
331
+ position:absolute;
332
+ top:24px;
333
+ width:900px;
334
+ display:flex;
335
+ background-color: #fff;
336
+ z-index:9;
337
+ box-shadow: 5px 5px 10px 3px rgba(0, 0, 0, 0.2);
338
+
339
+ // 左侧的方案详情
340
+ .plan-details {
341
+ padding:20px;
342
+ flex:6;
343
+ // background-color: #f6f7f9;
344
+ background-color: #fff;
345
+ // .condition-always {
346
+ // margin-top:15px;
347
+ // }
348
+
349
+ .condition-always {
350
+ margin-top:30px;
351
+ /deep/.el-scrollbar{
352
+ height: 20vh;
353
+ .el-scrollbar__wrap{
354
+ overflow-x: hidden;
355
+ }
356
+ }
357
+ }
358
+
359
+ .plan-conditions {
360
+ .add-button {
361
+ cursor:pointer;
362
+ user-select: none;
363
+ width:50px;
364
+ // border:1px solid black;
365
+ span {
366
+ margin-left:3px;
367
+ }
368
+ span:hover {
369
+ color:#0a5295;
370
+ }
371
+ }
372
+ }
373
+ }
374
+
375
+ // 右侧的操作按钮组
376
+ .plan-buttons {
377
+ border-left:1px solid #dddfe6;
378
+ flex:2;
379
+
380
+ .buttons{
381
+ height:300px;
382
+ display:flex;
383
+ flex-direction:column;
384
+ .el-button {
385
+ margin:10px 40px;
386
+ background-color: #055A9D;
387
+ border:none;
388
+ }
389
+ .is-disabled {
390
+ background-color: #357bc2;
391
+ }
392
+ }
393
+ }
394
+ }
395
+
396
+ </style>
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <div class="t-table">
3
+ <!-- 表格分组 -->
4
+ <div v-if="enableGroup" class="t-table-left">
5
+ <TableGroup @groupChange="$emit('groupChange', $event)" />
6
+ </div>
7
+
8
+ <!-- 表格记录 -->
9
+ <div class="t-table-right">
10
+ <TableRecords
11
+ :layout="layout"
12
+ :is-selector="isSelector"
13
+ :sum="sum"
14
+ :disable-sum="disableSum"
15
+ :data="data"
16
+ :update-in-dialog="updateInDialog"
17
+ :page-size="pageSize"
18
+ :current-page="currentPage"
19
+ @size-change="$emit('size-change', $event)"
20
+ @current-change="$emit('current-change', $event)"
21
+ @condition-change="$emit('condition-change', $event)"
22
+ @dbClick="$emit('dbClick', $event)"
23
+ @dbRowClick="$emit('dbRowClick',$event)"
24
+ @fastConfirm="$emit('fastConfirm',$event)"
25
+ />
26
+ </div>
27
+
28
+ </div>
29
+ </template>
30
+ <script>
31
+ import TableGroup from './table-group.vue'
32
+ import TableRecords from './table-records.vue'
33
+ export default {
34
+ components: {
35
+ TableGroup, TableRecords
36
+ },
37
+ props: {
38
+ // 表格的布局
39
+ layout: {
40
+ type: Array,
41
+ default: null
42
+ },
43
+ enableGroup: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ // 分组是否可以编辑,再基础资料的弹窗中,分组不可以被编辑
48
+ enableGroupEdit: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ /**
53
+ * 是否是选择器(弹窗)
54
+ */
55
+ isSelector: {
56
+ type: Boolean,
57
+ default: false
58
+ },
59
+ // 表格的合计
60
+ sum: {
61
+ type: Array,
62
+ default: () => []
63
+ },
64
+ // 表格的数据,包含了records属性和total属性
65
+ data: {
66
+ type: Object,
67
+ default: null
68
+ },
69
+ pageSize: {
70
+ type: Number,
71
+ default: 100
72
+ },
73
+ currentPage: {
74
+ type: Number,
75
+ default: 1
76
+ },
77
+ updateInDialog: {
78
+ type: Boolean,
79
+ default: false
80
+ },
81
+ disableSum: {
82
+ type: Boolean,
83
+ default: false
84
+ }
85
+ },
86
+ data () {
87
+ return {
88
+
89
+ }
90
+ },
91
+ provide () {
92
+ return {
93
+ enableGroupEdit: this.enableGroupEdit
94
+ }
95
+ }
96
+ }
97
+ </script>
98
+
99
+ <style scoped lang='less'>
100
+ .t-table {
101
+ height:100%;
102
+ display: flex;
103
+
104
+ .t-table-left{
105
+ width:300px;
106
+ // min-width: 290px;
107
+ height: 100%;
108
+ .table-group{
109
+ height: 100%;
110
+ }
111
+ }
112
+
113
+ .t-table-right{
114
+ flex: 1;
115
+ // width:100%;
116
+ min-width: 500px;
117
+ }
118
+ }
119
+
120
+ </style>