fast-crud-ui3 1.5.16-tsc-beta → 1.5.16
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/lib/fast-crud-ui3.cjs.js +7 -7
- package/lib/fast-crud-ui3.es.js +1960 -2003
- package/lib/fast-crud-ui3.umd.js +7 -7
- package/lib/style.css +1 -1
- package/package.json +5 -18
- package/lib/assets/fonts/iconfont.d.ts +0 -0
- package/lib/components/checkbox-group/index.d.ts +0 -2
- package/lib/components/checkbox-group/src/fast-checkbox-group.d.ts +0 -72
- package/lib/components/content-dialog/index.d.ts +0 -2
- package/lib/components/content-dialog/src/fast-cell-content.d.ts +0 -83
- package/lib/components/json-viewer/index.d.ts +0 -2
- package/lib/components/json-viewer/src/fast-json-viewer.d.ts +0 -48
- package/lib/components/mapping.d.ts +0 -5
- package/lib/components/object-picker/index.d.ts +0 -2
- package/lib/components/object-picker/src/fast-object-picker.d.ts +0 -132
- package/lib/components/select/index.d.ts +0 -2
- package/lib/components/select/src/fast-select.d.ts +0 -83
- package/lib/components/table/index.d.ts +0 -2
- package/lib/components/table/src/RowConfirm.d.ts +0 -39
- package/lib/components/table/src/dynamic-filter-form.d.ts +0 -118
- package/lib/components/table/src/dynamic-filter-list.d.ts +0 -57
- package/lib/components/table/src/easy-filter.d.ts +0 -118
- package/lib/components/table/src/export-confirm.d.ts +0 -12
- package/lib/components/table/src/quick-filter-form.d.ts +0 -42
- package/lib/components/table/src/row-form.d.ts +0 -33
- package/lib/components/table/src/stored-filter-manager.d.ts +0 -55
- package/lib/components/table/src/stored-filter.d.ts +0 -37
- package/lib/components/table/src/table-head-cell.d.ts +0 -9
- package/lib/components/table/src/table.d.ts +0 -497
- package/lib/components/table/src/util.d.ts +0 -77
- package/lib/components/table-column/config.d.ts +0 -5
- package/lib/components/table-column/index.d.ts +0 -2
- package/lib/components/table-column/src/table-column.d.ts +0 -256
- package/lib/components/table-column-date-picker/config.d.ts +0 -5
- package/lib/components/table-column-date-picker/index.d.ts +0 -2
- package/lib/components/table-column-date-picker/src/table-column-date-picker.d.ts +0 -173
- package/lib/components/table-column-file/config.d.ts +0 -5
- package/lib/components/table-column-file/index.d.ts +0 -2
- package/lib/components/table-column-file/src/table-column-file.d.ts +0 -285
- package/lib/components/table-column-img/config.d.ts +0 -5
- package/lib/components/table-column-img/index.d.ts +0 -2
- package/lib/components/table-column-img/src/table-column-img.d.ts +0 -285
- package/lib/components/table-column-input/config.d.ts +0 -5
- package/lib/components/table-column-input/index.d.ts +0 -2
- package/lib/components/table-column-input/src/table-column-input.d.ts +0 -173
- package/lib/components/table-column-number/config.d.ts +0 -5
- package/lib/components/table-column-number/index.d.ts +0 -2
- package/lib/components/table-column-number/src/table-column-number.d.ts +0 -173
- package/lib/components/table-column-object/config.d.ts +0 -5
- package/lib/components/table-column-object/index.d.ts +0 -2
- package/lib/components/table-column-object/src/table-column-object.d.ts +0 -315
- package/lib/components/table-column-select/config.d.ts +0 -5
- package/lib/components/table-column-select/index.d.ts +0 -2
- package/lib/components/table-column-select/src/table-column-select.d.ts +0 -276
- package/lib/components/table-column-switch/config.d.ts +0 -5
- package/lib/components/table-column-switch/index.d.ts +0 -2
- package/lib/components/table-column-switch/src/table-column-switch.d.ts +0 -175
- package/lib/components/table-column-textarea/config.d.ts +0 -5
- package/lib/components/table-column-textarea/index.d.ts +0 -2
- package/lib/components/table-column-textarea/src/table-column-textarea.d.ts +0 -173
- package/lib/components/table-column-time-picker/config.d.ts +0 -5
- package/lib/components/table-column-time-picker/index.d.ts +0 -2
- package/lib/components/table-column-time-picker/src/table-column-time-picker.d.ts +0 -173
- package/lib/components/upload/index.d.ts +0 -2
- package/lib/components/upload/src/fast-upload.d.ts +0 -120
- package/lib/global.d.ts +0 -42
- package/lib/index.d.ts +0 -56
- package/lib/mixins/table-column.d.ts +0 -104
- package/lib/mixins/upload.d.ts +0 -15
- package/lib/model/cond.d.ts +0 -25
- package/lib/model/editComponentConfig.d.ts +0 -25
- package/lib/model/fastTableOption.d.ts +0 -355
- package/lib/model/filterComponentConfig.d.ts +0 -57
- package/lib/model/opt.d.ts +0 -20
- package/lib/model/order.d.ts +0 -7
- package/lib/model/pageQuery.d.ts +0 -23
- package/lib/model/query.d.ts +0 -33
- package/lib/model/rel.d.ts +0 -5
- package/lib/util/cache.d.ts +0 -17
- package/lib/util/dialog.d.ts +0 -49
- package/lib/util/escape.d.ts +0 -7
- package/lib/util/http.d.ts +0 -8
- package/lib/util/pick.d.ts +0 -14
- package/lib/util/util.d.ts +0 -252
- package/packages/assets/fonts/iconfont.css +0 -163
- package/packages/assets/fonts/iconfont.js +0 -1
- package/packages/assets/fonts/iconfont.ttf +0 -0
- package/packages/assets/fonts/iconfont.woff +0 -0
- package/packages/assets/fonts/iconfont.woff2 +0 -0
- package/packages/components/checkbox-group/index.js +0 -7
- package/packages/components/checkbox-group/src/fast-checkbox-group.vue +0 -83
- package/packages/components/content-dialog/index.js +0 -7
- package/packages/components/content-dialog/src/fast-cell-content.vue +0 -115
- package/packages/components/json-viewer/index.js +0 -7
- package/packages/components/json-viewer/src/fast-json-viewer.vue +0 -54
- package/packages/components/mapping.js +0 -95
- package/packages/components/object-picker/index.js +0 -7
- package/packages/components/object-picker/src/fast-object-picker.vue +0 -170
- package/packages/components/select/index.js +0 -7
- package/packages/components/select/src/fast-select.vue +0 -89
- package/packages/components/table/index.js +0 -7
- package/packages/components/table/src/RowConfirm.vue +0 -87
- package/packages/components/table/src/dynamic-filter-form.vue +0 -253
- package/packages/components/table/src/dynamic-filter-list.vue +0 -172
- package/packages/components/table/src/easy-filter.vue +0 -129
- package/packages/components/table/src/export-confirm.vue +0 -55
- package/packages/components/table/src/quick-filter-form.vue +0 -140
- package/packages/components/table/src/row-form.vue +0 -137
- package/packages/components/table/src/stored-filter-manager.vue +0 -240
- package/packages/components/table/src/stored-filter.vue +0 -180
- package/packages/components/table/src/table-head-cell.vue +0 -41
- package/packages/components/table/src/table.vue +0 -1309
- package/packages/components/table/src/util.js +0 -496
- package/packages/components/table-column/config.js +0 -64
- package/packages/components/table-column/index.js +0 -7
- package/packages/components/table-column/src/table-column.vue +0 -44
- package/packages/components/table-column-date-picker/config.js +0 -139
- package/packages/components/table-column-date-picker/index.js +0 -7
- package/packages/components/table-column-date-picker/src/table-column-date-picker.vue +0 -54
- package/packages/components/table-column-file/config.js +0 -83
- package/packages/components/table-column-file/index.js +0 -7
- package/packages/components/table-column-file/src/table-column-file.vue +0 -79
- package/packages/components/table-column-img/config.js +0 -83
- package/packages/components/table-column-img/index.js +0 -7
- package/packages/components/table-column-img/src/table-column-img.vue +0 -82
- package/packages/components/table-column-input/config.js +0 -77
- package/packages/components/table-column-input/index.js +0 -7
- package/packages/components/table-column-input/src/table-column-input.vue +0 -60
- package/packages/components/table-column-number/config.js +0 -89
- package/packages/components/table-column-number/index.js +0 -7
- package/packages/components/table-column-number/src/table-column-number.vue +0 -54
- package/packages/components/table-column-object/config.js +0 -66
- package/packages/components/table-column-object/index.js +0 -7
- package/packages/components/table-column-object/src/table-column-object.vue +0 -75
- package/packages/components/table-column-select/config.js +0 -66
- package/packages/components/table-column-select/index.js +0 -7
- package/packages/components/table-column-select/src/table-column-select.vue +0 -101
- package/packages/components/table-column-switch/config.js +0 -55
- package/packages/components/table-column-switch/index.js +0 -7
- package/packages/components/table-column-switch/src/table-column-switch.vue +0 -82
- package/packages/components/table-column-textarea/config.js +0 -77
- package/packages/components/table-column-textarea/index.js +0 -7
- package/packages/components/table-column-textarea/src/table-column-textarea.vue +0 -56
- package/packages/components/table-column-time-picker/config.js +0 -62
- package/packages/components/table-column-time-picker/index.js +0 -7
- package/packages/components/table-column-time-picker/src/table-column-time-picker.vue +0 -53
- package/packages/components/upload/index.js +0 -7
- package/packages/components/upload/src/fast-upload.vue +0 -272
- package/packages/global.d.ts +0 -42
- package/packages/index.js +0 -145
- package/packages/mixins/table-column.js +0 -133
- package/packages/mixins/upload.js +0 -14
- package/packages/model/cond.js +0 -65
- package/packages/model/editComponentConfig.js +0 -72
- package/packages/model/fastTableOption.js +0 -538
- package/packages/model/filterComponentConfig.js +0 -185
- package/packages/model/opt.js +0 -21
- package/packages/model/order.js +0 -16
- package/packages/model/pageQuery.js +0 -31
- package/packages/model/query.js +0 -93
- package/packages/model/rel.js +0 -5
- package/packages/style.scss +0 -5
- package/packages/util/cache.js +0 -92
- package/packages/util/dialog.js +0 -133
- package/packages/util/escape.js +0 -34
- package/packages/util/http.js +0 -18
- package/packages/util/pick.js +0 -92
- package/packages/util/util.js +0 -833
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<!-- TODO 借鉴此机制实现脱敏 -->
|
|
4
|
-
<el-link class="fc-ellipsis" :underline="underline" :type="showAsLink ? 'primary' : 'default'"
|
|
5
|
-
@click="handleClick" v-if="needEllipsis || showAsLink">{{ value }}
|
|
6
|
-
</el-link>
|
|
7
|
-
<span v-else>{{ value }}</span>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import {version as elVersion} from 'element-plus'
|
|
13
|
-
import FastJsonViewer from "../../json-viewer/src/fast-json-viewer.vue"
|
|
14
|
-
import * as util from "../../../util/util.js"
|
|
15
|
-
import {openDialog} from "../../../util/dialog.js"
|
|
16
|
-
import FastTableOption from "../../../model/fastTableOption.js"
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: "FastCellContent",
|
|
20
|
-
components: {FastJsonViewer},
|
|
21
|
-
props: {
|
|
22
|
-
value: {
|
|
23
|
-
type: null // 任意类型
|
|
24
|
-
},
|
|
25
|
-
fatRow: Object,
|
|
26
|
-
linkTo: [String, Boolean],
|
|
27
|
-
showLength: {
|
|
28
|
-
type: Number,
|
|
29
|
-
default: () => Number.MAX_VALUE // 不限制
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
computed: {
|
|
33
|
-
underline() {
|
|
34
|
-
return util.versionGte(elVersion, '2.9.9') ? 'never' : false // 2.9.9后支持never, 之前是false
|
|
35
|
-
},
|
|
36
|
-
// 是否展示为链接
|
|
37
|
-
showAsLink() {
|
|
38
|
-
return this.linkTo === true || (util.isString(this.linkTo) && !util.isEmpty(this.linkTo))
|
|
39
|
-
},
|
|
40
|
-
// 链接地址
|
|
41
|
-
linkUrl() {
|
|
42
|
-
if (!this.showAsLink) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return this.linkTo === true ? this.value : this.linkTo
|
|
46
|
-
},
|
|
47
|
-
needEllipsis() {
|
|
48
|
-
return util.isEmpty(this.value) ? false : util.toStr(this.value).length > this.showLength
|
|
49
|
-
},
|
|
50
|
-
row() {
|
|
51
|
-
return this.fatRow.row
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
methods: {
|
|
55
|
-
handleClick() {
|
|
56
|
-
if (this.showAsLink) {
|
|
57
|
-
try {
|
|
58
|
-
this.jumpToLink()
|
|
59
|
-
} catch (err) { // 若链接跳转失败, 又需要预览, 则降级弹窗预览
|
|
60
|
-
console.error(err)
|
|
61
|
-
if (this.needEllipsis) {
|
|
62
|
-
this.openViewer()
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
this.openViewer()
|
|
68
|
-
},
|
|
69
|
-
// 跳转到目标地址(支持路由名、路由地址、http绝对地址)
|
|
70
|
-
jumpToLink() {
|
|
71
|
-
const {linkUrl} = this
|
|
72
|
-
if (util.isEmpty(linkUrl)) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
// 转义linkUrl中可能存在的插值表达式
|
|
76
|
-
const url = util.strFormat(linkUrl, this.row)
|
|
77
|
-
if (util.isUrl(url)) {
|
|
78
|
-
window.open(url, '_blank')
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
// 提取linkUrl中可能存在的query参数, 作为路由跳转的参数
|
|
82
|
-
const {path: pathOrName, query} = util.extractUrlAndQueryParams(url)
|
|
83
|
-
if (url.startsWith('/')) {
|
|
84
|
-
FastTableOption.$router.push({path: pathOrName, query: query})
|
|
85
|
-
return
|
|
86
|
-
}
|
|
87
|
-
FastTableOption.$router.push({name: pathOrName, query: query})
|
|
88
|
-
},
|
|
89
|
-
// 超长预览
|
|
90
|
-
openViewer() {
|
|
91
|
-
openDialog({
|
|
92
|
-
component: FastJsonViewer,
|
|
93
|
-
props: {
|
|
94
|
-
value: (util.isObject(this.value) || util.isJsonStr(this.value)) ? util.toJson(this.value) : this.value
|
|
95
|
-
},
|
|
96
|
-
dialogProps: {
|
|
97
|
-
title: '值预览',
|
|
98
|
-
width: '500px'
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
</script>
|
|
105
|
-
|
|
106
|
-
<style scoped lang="scss">
|
|
107
|
-
.fc-ellipsis, .fc-ellipsis * {
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
overflow: clip;
|
|
111
|
-
text-overflow: ellipsis;
|
|
112
|
-
display: inline-block;
|
|
113
|
-
width: 100%;
|
|
114
|
-
}
|
|
115
|
-
</style>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<JsonViewer :value="value"
|
|
4
|
-
:copyable="copyable"
|
|
5
|
-
:boxed="boxed"
|
|
6
|
-
:expandDepth="expandDepth"
|
|
7
|
-
:theme="theme"
|
|
8
|
-
v-if="isJson"></JsonViewer>
|
|
9
|
-
<span style="word-wrap: break-word;" v-else>{{ value }}</span>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import {defineComponent} from "vue";
|
|
15
|
-
import {JsonViewer} from "vue3-json-viewer"
|
|
16
|
-
import "vue3-json-viewer/dist/vue3-json-viewer.css"
|
|
17
|
-
import {isObject} from "../../../util/util.js";
|
|
18
|
-
|
|
19
|
-
export default defineComponent({
|
|
20
|
-
name: "fast-json-viewer",
|
|
21
|
-
components: {
|
|
22
|
-
// JSDoc强制断言为any, 避免其私有类型CopyableOptions导致npm run build:lib 提示TS9006错误
|
|
23
|
-
JsonViewer: /** @type {any} **/ (JsonViewer)
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
value: null,
|
|
27
|
-
copyable: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: () => true
|
|
30
|
-
},
|
|
31
|
-
boxed: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: () => true
|
|
34
|
-
},
|
|
35
|
-
expandDepth: {
|
|
36
|
-
type: Number,
|
|
37
|
-
default: () => Number.MAX_VALUE
|
|
38
|
-
},
|
|
39
|
-
theme: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: () => 'light' // light/dark
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
computed: {
|
|
45
|
-
isJson() {
|
|
46
|
-
return isObject(this.value)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<style scoped lang="scss">
|
|
53
|
-
|
|
54
|
-
</style>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import EditComponentConfig from '../model/editComponentConfig.js'
|
|
2
|
-
import FilterComponentConfig from '../model/filterComponentConfig.js'
|
|
3
|
-
import {isFunction, replaceKey} from "../util/util.js";
|
|
4
|
-
import FastTableColumnConfig from './table-column/config';
|
|
5
|
-
import FastTableColumnDatePickerConfig from './table-column-date-picker/config';
|
|
6
|
-
import FastTableColumnFileConfig from './table-column-file/config';
|
|
7
|
-
import FastTableColumnImgConfig from './table-column-img/config';
|
|
8
|
-
import FastTableColumnInputConfig from './table-column-input/config';
|
|
9
|
-
import FastTableColumnNumberConfig from './table-column-number/config';
|
|
10
|
-
import FastTableColumnObjectConfig from './table-column-object/config';
|
|
11
|
-
import FastTableColumnSelectConfig from './table-column-select/config';
|
|
12
|
-
import FastTableColumnSwitchConfig from './table-column-switch/config';
|
|
13
|
-
import FastTableColumnTextareaConfig from './table-column-textarea/config';
|
|
14
|
-
import FastTableColumnTimePickerConfig from './table-column-time-picker/config';
|
|
15
|
-
|
|
16
|
-
const MAPPING = {
|
|
17
|
-
'FastTableColumn': FastTableColumnConfig,
|
|
18
|
-
'FastTableColumnDatePicker': FastTableColumnDatePickerConfig,
|
|
19
|
-
'FastTableColumnFile': FastTableColumnFileConfig,
|
|
20
|
-
'FastTableColumnImg': FastTableColumnImgConfig,
|
|
21
|
-
'FastTableColumnInput': FastTableColumnInputConfig,
|
|
22
|
-
'FastTableColumnNumber': FastTableColumnNumberConfig,
|
|
23
|
-
'FastTableColumnObject': FastTableColumnObjectConfig,
|
|
24
|
-
'FastTableColumnSelect': FastTableColumnSelectConfig,
|
|
25
|
-
'FastTableColumnSwitch': FastTableColumnSwitchConfig,
|
|
26
|
-
'FastTableColumnTextarea': FastTableColumnTextareaConfig,
|
|
27
|
-
'FastTableColumnTimePicker': FastTableColumnTimePickerConfig
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 获取配置的装配函数
|
|
32
|
-
* @param tableColumnComponentName 列组件
|
|
33
|
-
* @param type 类型(query/edit)
|
|
34
|
-
* @return {*|null}
|
|
35
|
-
*/
|
|
36
|
-
export const getConfigFn = function (tableColumnComponentName, type) {
|
|
37
|
-
if (!MAPPING.hasOwnProperty(tableColumnComponentName) || !MAPPING[tableColumnComponentName].hasOwnProperty(type)) {
|
|
38
|
-
// console.error(`未定义针对${tableColumnComponentName}的快速搜索控件`)
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return MAPPING[tableColumnComponentName][type]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 构建最终的过滤组件的配置
|
|
47
|
-
* @param customConfig 用户自定义配置。方法内不会改变此值
|
|
48
|
-
* @param tableColumnComponentName table-column组件名
|
|
49
|
-
* @param type 类型, 可选: quick, easy, dynamic, stored
|
|
50
|
-
* @param tableOption FastTable配置
|
|
51
|
-
*/
|
|
52
|
-
export const buildFinalQueryComponentConfig = function (customConfig, tableColumnComponentName, type, tableOption) {
|
|
53
|
-
// 排除props中后缀为_e的属性, 因为这些配置项仅用于编辑控件, 并将_q后缀的属性名移除此后缀
|
|
54
|
-
const customProps = replaceKey(customConfig.props, '_q')
|
|
55
|
-
const customFilterConfig = {
|
|
56
|
-
...customConfig,
|
|
57
|
-
props: {...customProps}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const finalConfigFn = getConfigFn(tableColumnComponentName, 'query');
|
|
61
|
-
if (!isFunction(finalConfigFn)) {
|
|
62
|
-
throw new Error(`未定义针对${tableColumnComponentName}的查询控件配置`)
|
|
63
|
-
}
|
|
64
|
-
const finalConfig = finalConfigFn(customFilterConfig, type, tableOption);
|
|
65
|
-
return new FilterComponentConfig({
|
|
66
|
-
...finalConfig,
|
|
67
|
-
type: type
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 构建最终的过滤组件的配置
|
|
73
|
-
* @param customConfig 用户自定义配置。方法内不会改变此值
|
|
74
|
-
* @param tableColumnComponentName table-column组件名
|
|
75
|
-
* @param type 类型, 可选: inline, form
|
|
76
|
-
* @param tableOption FastTable配置
|
|
77
|
-
*/
|
|
78
|
-
export const buildFinalEditComponentConfig = function (customConfig, tableColumnComponentName, type, tableOption) {
|
|
79
|
-
const customProps = replaceKey(customConfig.props, '_e');
|
|
80
|
-
const customFilterConfig = {
|
|
81
|
-
...customConfig,
|
|
82
|
-
props: {...customProps}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const finalConfigFn = getConfigFn(tableColumnComponentName, 'edit');
|
|
86
|
-
if (!isFunction(finalConfigFn)) {
|
|
87
|
-
throw new Error(`未定义针对${tableColumnComponentName}的编辑控件配置`)
|
|
88
|
-
}
|
|
89
|
-
const finalConfig = finalConfigFn(customFilterConfig, type, tableOption);
|
|
90
|
-
return new EditComponentConfig({
|
|
91
|
-
...finalConfig,
|
|
92
|
-
type: type,
|
|
93
|
-
tableOption: tableOption
|
|
94
|
-
})
|
|
95
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 使用 el-select 以便更好的支持搜索以及多选(可借助el-select的远程搜索模式实现——避免下拉) -->
|
|
3
|
-
<el-select v-model="value"
|
|
4
|
-
:clearable="clearable"
|
|
5
|
-
:placeholder="placeholder"
|
|
6
|
-
:size="size"
|
|
7
|
-
:disabled="disabled"
|
|
8
|
-
:multiple="multiple"
|
|
9
|
-
remote :suffix-icon="null"
|
|
10
|
-
@clear="handleClear"
|
|
11
|
-
@blur="(event) => $emit('blur', event)"
|
|
12
|
-
@change="(val) => $emit('change', val)"
|
|
13
|
-
@click="handleClick"
|
|
14
|
-
@focus="handleFocus">
|
|
15
|
-
<el-option v-for="item in options" :key="item.value" :value="item.value" :label="item.label"/>
|
|
16
|
-
</el-select>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import {pick} from "../../../util/pick"
|
|
21
|
-
import {defaultIfEmpty, isArray, isEmpty, isObject} from "../../../util/util"
|
|
22
|
-
import FastTableOption from "../../../model/fastTableOption.js"
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
name: "FastObjectPicker",
|
|
26
|
-
emits: ['update:modelValue', 'blur', 'change', 'clear', 'click', 'focus'],
|
|
27
|
-
props: {
|
|
28
|
-
modelValue: {
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
tableOption: {
|
|
32
|
-
type: FastTableOption,
|
|
33
|
-
required: true
|
|
34
|
-
},
|
|
35
|
-
showField: String, // 回显到控件上的字段 @deprecated 1.6 使用valKey替代
|
|
36
|
-
valKey: String, // 替代showField, 指定"值"key
|
|
37
|
-
labelKey: String, // 当控件需要"值显"不一致时, 指定"显"key
|
|
38
|
-
pickObject: Object, // 单选时, pick选择后回填到的目标object上
|
|
39
|
-
pickMap: Object, // 单选时, pick选择后回填到目标object上时,指导字段对应关系: key为pick的数据的字段名, value为pickObject中的字段名
|
|
40
|
-
valueCovert: { // 针对showField取值的值转换, 对于多选时, 会讲showField的多个值用英文逗号分隔后返回,作为组件v-model值
|
|
41
|
-
type: Function,
|
|
42
|
-
default: (pickData, field) => {
|
|
43
|
-
if (isArray(pickData)) {
|
|
44
|
-
return pickData.map(row => row[field])
|
|
45
|
-
} else {
|
|
46
|
-
return pickData[field]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
beforeOpen: {
|
|
51
|
-
type: Function,
|
|
52
|
-
default: () => Promise.resolve()
|
|
53
|
-
},
|
|
54
|
-
title: String,
|
|
55
|
-
multiple: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: () => false
|
|
58
|
-
},
|
|
59
|
-
placeholder: {
|
|
60
|
-
type: String,
|
|
61
|
-
default: () => "请点选..."
|
|
62
|
-
},
|
|
63
|
-
appendToBody: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
default: () => true
|
|
66
|
-
},
|
|
67
|
-
disabled: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: () => false
|
|
70
|
-
},
|
|
71
|
-
clearable: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: () => true
|
|
74
|
-
},
|
|
75
|
-
size: String,
|
|
76
|
-
// pick弹窗的宽度
|
|
77
|
-
dialogWidth: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: () => '70%'
|
|
80
|
-
},
|
|
81
|
-
// 用以内置el-select回显
|
|
82
|
-
options: {
|
|
83
|
-
type: Array,
|
|
84
|
-
default: () => []
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
mounted() {
|
|
88
|
-
if (isEmpty(this.options) && !isEmpty(this.modelValue)) { // 有初始值, 先构造一个选项以便正常显示
|
|
89
|
-
// this.options = [{label: this.modelValue, value: this.modelValue}]
|
|
90
|
-
this.options.length = 0
|
|
91
|
-
this.options.push([{label: this.modelValue, value: this.modelValue}])
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
computed: {
|
|
95
|
-
value: {
|
|
96
|
-
get() {
|
|
97
|
-
return this.modelValue
|
|
98
|
-
},
|
|
99
|
-
set(val) {
|
|
100
|
-
this.$emit('update:modelValue', val)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
methods: {
|
|
105
|
-
handleClear(event) {
|
|
106
|
-
this.$emit('clear', event)
|
|
107
|
-
// 清除pickMap的其它属性
|
|
108
|
-
if (!isEmpty(this.pickMap) && !isEmpty(this.pickObject)) {
|
|
109
|
-
Object.entries(this.pickMap).forEach(([pickFieldName, formFieldName]) => {
|
|
110
|
-
this.pickObject[formFieldName] = null
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
handleClick(event) {
|
|
115
|
-
// 检查点击事件的目标是否为清除按钮, 清除按钮的话不上抛点击事件
|
|
116
|
-
if (event.target.classList.contains('el-input__clear')) {
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
this.$emit('click', event)
|
|
120
|
-
this.openPick()
|
|
121
|
-
},
|
|
122
|
-
handleFocus(event) {
|
|
123
|
-
this.$emit('focus', event)
|
|
124
|
-
// this.openPick() // ESC退出后焦点又回到input,会导致ESC关不掉
|
|
125
|
-
},
|
|
126
|
-
openPick() {
|
|
127
|
-
const {beforeOpen, tableOption} = this
|
|
128
|
-
beforeOpen().then(() => {
|
|
129
|
-
pick({
|
|
130
|
-
option: tableOption,
|
|
131
|
-
multiple: this.multiple,
|
|
132
|
-
dialog: {
|
|
133
|
-
title: this.title,
|
|
134
|
-
width: this.dialogWidth,
|
|
135
|
-
appendToBody: this.appendToBody
|
|
136
|
-
}
|
|
137
|
-
}).then((fatData) => {
|
|
138
|
-
const data = isArray(fatData) ? fatData.map((item) => item.row) : fatData.row
|
|
139
|
-
const valKey = defaultIfEmpty(this.valKey, this.showField)
|
|
140
|
-
const labelKey = defaultIfEmpty(this.labelKey, valKey)
|
|
141
|
-
// 赋值options
|
|
142
|
-
const options = (isArray(data) ? data : [data]).map(item => {
|
|
143
|
-
return {value: item[valKey], label: item[labelKey]}
|
|
144
|
-
})
|
|
145
|
-
this.options.length = 0
|
|
146
|
-
this.options.push(...options)
|
|
147
|
-
// 赋值value
|
|
148
|
-
const newVal = this.valueCovert(data, valKey)
|
|
149
|
-
this.value = newVal
|
|
150
|
-
this.$emit('change', newVal)
|
|
151
|
-
if (this.multiple !== true && isObject(data)) {
|
|
152
|
-
// 赋值pickObject
|
|
153
|
-
Object.entries(this.pickMap).forEach(([pickFieldName, formFieldName]) => {
|
|
154
|
-
this.pickObject[formFieldName] = data[pickFieldName]
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}).catch((err = '你取消了pic弹窗') => {
|
|
158
|
-
console.debug(err)
|
|
159
|
-
})
|
|
160
|
-
}).catch((err = '你取消了打开pick') => {
|
|
161
|
-
console.debug(err)
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
</script>
|
|
167
|
-
|
|
168
|
-
<style scoped lang="scss">
|
|
169
|
-
|
|
170
|
-
</style>
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-select v-model="value" v-bind="$attrs" :size="size" :multiple="multiple"
|
|
3
|
-
@change="(val) => $emit('change', val)"
|
|
4
|
-
@clear="() => $emit('clear')"
|
|
5
|
-
@focus="(event) => $emit('focus', event)"
|
|
6
|
-
@blur="(event) => $emit('blur', event)"
|
|
7
|
-
@visible-change="(visible) => $emit('visibleChange', visible)"
|
|
8
|
-
@remove-tag="(tagVal) => $emit('removeTag', tagVal)">
|
|
9
|
-
<el-option v-for="item in nativeOptions" :key="item.value" :label="item[labelKey]" :value="item[valKey]"
|
|
10
|
-
:disabled="disableVal.indexOf(item[valKey]) > -1"></el-option>
|
|
11
|
-
</el-select>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import FastTableOption from '../../../model/fastTableOption.js'
|
|
16
|
-
import Query from '../../../model/query.js'
|
|
17
|
-
import * as util from '../../../util/util.js'
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: "fast-select",
|
|
21
|
-
emits: ['update:modelValue', 'change', 'clear', 'focus', 'blur', 'visibleChange', 'removeTag'],
|
|
22
|
-
props: {
|
|
23
|
-
modelValue: {
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
options: {
|
|
27
|
-
type: [Array, FastTableOption],
|
|
28
|
-
default: () => []
|
|
29
|
-
},
|
|
30
|
-
labelKey: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: () => "label"
|
|
33
|
-
},
|
|
34
|
-
valKey: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: () => "value"
|
|
37
|
-
},
|
|
38
|
-
multiple: { // 多值时, value为数组
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: () => false
|
|
41
|
-
},
|
|
42
|
-
disableVal: {
|
|
43
|
-
type: Array,
|
|
44
|
-
default: () => []
|
|
45
|
-
},
|
|
46
|
-
size: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: 'default'
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
data() {
|
|
52
|
-
return {
|
|
53
|
-
nativeOptions: util.isArray(this.options) ? this.options : []
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
async mounted() {
|
|
57
|
-
if (this.options instanceof FastTableOption) {
|
|
58
|
-
await this.buildSelectOptions()
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
computed: {
|
|
62
|
-
value: {
|
|
63
|
-
get() {
|
|
64
|
-
return this.modelValue
|
|
65
|
-
},
|
|
66
|
-
set(val) {
|
|
67
|
-
this.$emit('update:modelValue', val)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
methods: {
|
|
72
|
-
buildSelectOptions() {
|
|
73
|
-
if (!(this.options instanceof FastTableOption)) {
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
const query = new Query().setDistinct().setCols([this.valKey, this.labelKey]);
|
|
77
|
-
this.options._buildSelectOptions(query, this.valKey, this.labelKey).then(options => {
|
|
78
|
-
this.nativeOptions = options
|
|
79
|
-
}).catch(err => {
|
|
80
|
-
console.error(err)
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<style scoped>
|
|
88
|
-
|
|
89
|
-
</style>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<fast-table class="fc-fast-table"
|
|
3
|
-
:data="rows"
|
|
4
|
-
:is-static="true"
|
|
5
|
-
:option="tableOption"
|
|
6
|
-
@selection-change="handleSelectionChange">
|
|
7
|
-
<template v-for="column in columnProps">
|
|
8
|
-
<component :is="column.componentName"
|
|
9
|
-
v-bind="column.props"
|
|
10
|
-
v-if="column.hidden === false"/>
|
|
11
|
-
</template>
|
|
12
|
-
<template #button>
|
|
13
|
-
<el-button type="danger" plain :disabled="checkedRows.length === 0" @click="handleRemove"
|
|
14
|
-
v-if="action === 'delete' && rows.length > 1">从删除清单里移出</el-button>
|
|
15
|
-
</template>
|
|
16
|
-
</fast-table>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import FastTableOption from "../../../model/fastTableOption.js"
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
name: 'RowConfirm',
|
|
24
|
-
props: {
|
|
25
|
-
rows: {
|
|
26
|
-
type: Array,
|
|
27
|
-
default: () => []
|
|
28
|
-
},
|
|
29
|
-
columnConfigs: Object,
|
|
30
|
-
action: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: () => 'view',
|
|
33
|
-
validator: (value) => ['view', 'delete'].indexOf(value) > -1
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
data() {
|
|
37
|
-
return {
|
|
38
|
-
tableOption: new FastTableOption({
|
|
39
|
-
queryable: false,
|
|
40
|
-
insertable: false,
|
|
41
|
-
updatable: false,
|
|
42
|
-
deletable: false,
|
|
43
|
-
exportable: false,
|
|
44
|
-
enableMulti: this.rows.length > 1
|
|
45
|
-
}),
|
|
46
|
-
checkedRows: []
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
computed: {
|
|
50
|
-
columnProps() {
|
|
51
|
-
return this.columnConfigs.map(({tableColumnComponentName, customConfig}) => {
|
|
52
|
-
const {hidden, showLength, col, label, props} = customConfig
|
|
53
|
-
return {
|
|
54
|
-
componentName: tableColumnComponentName,
|
|
55
|
-
hidden: hidden,
|
|
56
|
-
props: {
|
|
57
|
-
...props,
|
|
58
|
-
filter: false,
|
|
59
|
-
prop: col,
|
|
60
|
-
label: label,
|
|
61
|
-
showOverflowToolTip: true,
|
|
62
|
-
showLength: showLength
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
methods: {
|
|
69
|
-
handleSelectionChange({fatRows}) {
|
|
70
|
-
this.checkedRows = fatRows
|
|
71
|
-
},
|
|
72
|
-
handleRemove() {
|
|
73
|
-
for (let i = this.rows.length - 1; i >= 0; i--) {
|
|
74
|
-
if (this.checkedRows.some(r => r === this.rows[i])) {
|
|
75
|
-
this.rows.splice(i, 1)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
getRows() {
|
|
80
|
-
return this.rows
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<style scoped lang="scss">
|
|
87
|
-
</style>
|