flame-plus 0.1.13 → 0.1.15
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/package.json +2 -1
- package/packages/components/base/flmButton/flmButton.vue +1 -1
- package/packages/components/complex/flmForm/flmForm.vue +20 -17
- package/packages/components/complex/flmSearch/flmSearch.vue +34 -31
- package/packages/components/complex/flmTable/flmTable.vue +41 -25
- package/packages/components/complex/flmToolbar/flmToolbar.vue +2 -2
- package/packages/components/index.ts +2 -2
- package/packages/components/page/flmReportPage/flmReportPage.vue +94 -378
- package/packages/model/flmComponentConfig/base/flmButton.ts +4 -1
- package/packages/model/flmComponentConfig/base/flmPagination.ts +0 -1
- package/packages/model/flmComponentConfig/complex/flmSearch.ts +5 -0
- package/packages/model/flmComponentConfig/complex/flmTable.ts +22 -0
- package/packages/model/flmComponentConfig/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flame-plus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "基于 element-plus 的组件库",
|
|
6
6
|
"main": "packages/index.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"core-js": "^3.6.5",
|
|
21
21
|
"editor": "1.0.0",
|
|
22
22
|
"element-plus": "^2.1.8",
|
|
23
|
+
"flame-request": "^1.0.1",
|
|
23
24
|
"html-loader": "^3.1.0",
|
|
24
25
|
"monaco-editor": "0.30.*",
|
|
25
26
|
"monaco-editor-esm-webpack-plugin": "^2.0.2",
|
|
@@ -59,7 +59,7 @@ export default defineComponent({
|
|
|
59
59
|
flmTimeSelect,
|
|
60
60
|
flmTransfer,
|
|
61
61
|
},
|
|
62
|
-
emits: ['submit', 'cancel', 'customEvent'],
|
|
62
|
+
emits: ['submit', 'cancel', 'reset', 'customEvent'],
|
|
63
63
|
props: {
|
|
64
64
|
// 默认设置
|
|
65
65
|
config: {
|
|
@@ -72,7 +72,7 @@ export default defineComponent({
|
|
|
72
72
|
let formModel: FormModel = reactive({}) // 表单数据
|
|
73
73
|
|
|
74
74
|
// 监听表单配置的 model,变化后更新组件内部 formModel
|
|
75
|
-
watch(() => props.config.model, (newModel: FormModel) =>
|
|
75
|
+
watch(() => props.config.model, (newModel: FormModel) => updateFormModel(newModel))
|
|
76
76
|
|
|
77
77
|
// 监听组件内部 formModel,变化后更新控件 value
|
|
78
78
|
watch(formModel, (newModel: FormModel) => updateControl(newModel))
|
|
@@ -80,7 +80,7 @@ export default defineComponent({
|
|
|
80
80
|
onMounted(() => {
|
|
81
81
|
if (props.config?.model && Object.keys(props.config?.model).length) {
|
|
82
82
|
updateControl(props.config.model)
|
|
83
|
-
|
|
83
|
+
updateFormModel(props.config.model)
|
|
84
84
|
}
|
|
85
85
|
})
|
|
86
86
|
|
|
@@ -107,7 +107,7 @@ export default defineComponent({
|
|
|
107
107
|
* @date 2022-05-09
|
|
108
108
|
* @param {FormModel} model
|
|
109
109
|
*/
|
|
110
|
-
const
|
|
110
|
+
const updateFormModel = (model: FormModel) => {
|
|
111
111
|
Object.entries(model).forEach(([key, value]: Array<any>) => formModel[key] = value)
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -122,10 +122,10 @@ export default defineComponent({
|
|
|
122
122
|
/**
|
|
123
123
|
* 表单方法调用
|
|
124
124
|
* @date 2022-04-14
|
|
125
|
-
* @param {'submit' | 'cancel' | string} event 方法名(默认方法直接调用;自定义方法回传方法名及表单数据)
|
|
125
|
+
* @param {'submit' | 'cancel' | 'reset' | string} event 方法名(默认方法直接调用;自定义方法回传方法名及表单数据)
|
|
126
126
|
*/
|
|
127
127
|
const formEvent = (event: FormButtonConfig['event']) => {
|
|
128
|
-
const defaultEvent: Record<FormButtonConfig['event'], Function> = { submit, cancel }
|
|
128
|
+
const defaultEvent: Record<FormButtonConfig['event'], Function> = { submit, cancel, reset }
|
|
129
129
|
isValidKey(event, defaultEvent)
|
|
130
130
|
? defaultEvent[event]()
|
|
131
131
|
: emit('customEvent', { event, formModel })
|
|
@@ -142,7 +142,6 @@ export default defineComponent({
|
|
|
142
142
|
|
|
143
143
|
// 取消
|
|
144
144
|
const cancel = () => {
|
|
145
|
-
reset()
|
|
146
145
|
emit('cancel', formModel)
|
|
147
146
|
}
|
|
148
147
|
|
|
@@ -151,6 +150,7 @@ export default defineComponent({
|
|
|
151
150
|
const formRef: any = instance?.refs['formRef']
|
|
152
151
|
if (!formRef) return
|
|
153
152
|
formRef.resetFields()
|
|
153
|
+
emit('reset', formModel)
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -171,7 +171,7 @@ export default defineComponent({
|
|
|
171
171
|
if (isValidKey('isSlot', item)) {
|
|
172
172
|
const { isSlot, ...itemConfig } = item
|
|
173
173
|
return (
|
|
174
|
-
<el-form-item {...itemConfig}>
|
|
174
|
+
<el-form-item class={`form-${item.prop}`} {...itemConfig}>
|
|
175
175
|
{(slots[item.prop]?.({ prop: item.prop, formModel }))}
|
|
176
176
|
</el-form-item>
|
|
177
177
|
)
|
|
@@ -179,7 +179,7 @@ export default defineComponent({
|
|
|
179
179
|
const { controlType, controlConfig, ...itemConfig } = item
|
|
180
180
|
if (controlType && controlConfig) {
|
|
181
181
|
return (
|
|
182
|
-
<el-form-item {...itemConfig}>
|
|
182
|
+
<el-form-item class={`form-${item.prop}`} {...itemConfig}>
|
|
183
183
|
{controlDom(item.prop, controlType, controlConfig)}
|
|
184
184
|
</el-form-item>
|
|
185
185
|
)
|
|
@@ -198,7 +198,7 @@ export default defineComponent({
|
|
|
198
198
|
const buttonsDom = (buttons: FormConfig['buttons'] = []) => {
|
|
199
199
|
if (buttons.length) {
|
|
200
200
|
return (
|
|
201
|
-
<el-form-item>
|
|
201
|
+
<el-form-item class="form-buttons">
|
|
202
202
|
{buttons.map(({ event, ...config }: FormButtonConfig) =>
|
|
203
203
|
<flm-button config={config} onButtonClick={() => formEvent(event)} />
|
|
204
204
|
)}
|
|
@@ -211,13 +211,16 @@ export default defineComponent({
|
|
|
211
211
|
|
|
212
212
|
// 表单设置
|
|
213
213
|
const formConfig = computed((): FormConfig => filterConfig(formDefaultConfig, props.config))
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
const formDom = () => {
|
|
215
|
+
const { items = [], buttons = [], model, ...defaultConfig } = formConfig.value
|
|
216
|
+
return (
|
|
217
|
+
<el-form ref='formRef' {...defaultConfig} model={formModel}>
|
|
218
|
+
{formItemsDom(items)}
|
|
219
|
+
{buttonsDom(buttons)}
|
|
220
|
+
</el-form>
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
return () => (formDom())
|
|
221
224
|
},
|
|
222
225
|
})
|
|
223
226
|
</script>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
ref="searchDefaultRef"
|
|
6
6
|
:config="defaultConfig"
|
|
7
7
|
@submit="searchSubmit"
|
|
8
|
-
@
|
|
8
|
+
@reset="searchReset"
|
|
9
9
|
@customEvent="searchCustomEvent"
|
|
10
10
|
>
|
|
11
11
|
<template v-for="defaultSlot in defaultSlots" #[defaultSlot]="{ prop, formModel }">
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
|
-
import {
|
|
40
|
+
import { PropType, ref, Ref, computed, ComputedRef } from 'vue'
|
|
41
41
|
import { flmForm } from '../../index'
|
|
42
|
-
import {
|
|
42
|
+
import { SearchConfig, FormItemConfig } from '../../../model/flmComponentConfig'
|
|
43
43
|
import { isValidKey } from '../../../utils'
|
|
44
44
|
|
|
45
|
-
const emit = defineEmits(['searchSubmit', '
|
|
45
|
+
const emit = defineEmits(['searchSubmit', 'searchReset', 'searchCustomEvent'])
|
|
46
46
|
const props = defineProps({
|
|
47
47
|
config: {
|
|
48
|
-
type: Object as PropType<
|
|
48
|
+
type: Object as PropType<SearchConfig>,
|
|
49
49
|
default() {
|
|
50
50
|
return {}
|
|
51
51
|
}
|
|
@@ -57,38 +57,38 @@ const searchExtraRef: Ref<any> = ref() // 额外搜索栏实例
|
|
|
57
57
|
|
|
58
58
|
let showExtra: Ref<boolean> = ref(false) // 显示额外搜索条件
|
|
59
59
|
let hasExtra: Ref<boolean> = ref(false) // 有额外搜索条件
|
|
60
|
-
let extraFormModel: Ref<
|
|
60
|
+
let extraFormModel: Ref<SearchConfig> = ref({}) // 额外搜索条件
|
|
61
61
|
|
|
62
|
-
const maxFormItem = 3
|
|
62
|
+
const maxFormItem = computed(() => props.config.maxFormItem || 3) // 默认搜索栏最大条件数
|
|
63
63
|
|
|
64
64
|
// 默认搜索栏设置
|
|
65
|
-
const defaultConfig: ComputedRef<
|
|
65
|
+
const defaultConfig: ComputedRef<SearchConfig> = computed(() => {
|
|
66
66
|
const { items = [], buttons, ...config } = props.config
|
|
67
|
-
hasExtra.value = items.length > maxFormItem
|
|
68
|
-
hasExtra.value && buttons?.unshift({ '
|
|
67
|
+
hasExtra.value = items.length > maxFormItem.value
|
|
68
|
+
hasExtra.value && buttons?.unshift({ 'buttonText': '更多', 'event': 'openDrawer' }) // 搜索条件大于最大数量,插入更多按钮
|
|
69
69
|
return {
|
|
70
70
|
...config,
|
|
71
71
|
inline: true,
|
|
72
|
-
items: items.slice(0, maxFormItem),
|
|
72
|
+
items: items.slice(0, maxFormItem.value),
|
|
73
73
|
buttons
|
|
74
74
|
}
|
|
75
75
|
})
|
|
76
76
|
// 额外搜索栏设置
|
|
77
|
-
const extraConfig: ComputedRef<
|
|
77
|
+
const extraConfig: ComputedRef<SearchConfig> = computed(() => {
|
|
78
78
|
const { items, buttons, ...config } = props.config
|
|
79
79
|
return {
|
|
80
80
|
...config,
|
|
81
81
|
inline: false,
|
|
82
|
-
items: items?.slice(maxFormItem),
|
|
82
|
+
items: items?.slice(maxFormItem.value),
|
|
83
83
|
// 插入额外搜索栏按钮
|
|
84
84
|
buttons: [
|
|
85
85
|
{
|
|
86
|
-
'
|
|
86
|
+
'buttonText': '取消',
|
|
87
87
|
'event': 'cancel'
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
'type': 'primary',
|
|
91
|
-
'
|
|
90
|
+
'type': ButtonType['primary'],
|
|
91
|
+
'buttonText': '搜索',
|
|
92
92
|
'event': 'submit'
|
|
93
93
|
}
|
|
94
94
|
]
|
|
@@ -96,30 +96,35 @@ const extraConfig: ComputedRef<FormConfig> = computed(() => {
|
|
|
96
96
|
})
|
|
97
97
|
|
|
98
98
|
// 获取表格插槽
|
|
99
|
-
const getFormSlots = (items:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
const getFormSlots = (items: SearchConfig['items'] = []): Array<string> => {
|
|
100
|
+
let slots: Array<string> = []
|
|
101
|
+
items.forEach((item: FormItemConfig) => {
|
|
102
|
+
if (isValidKey('isSlot', item)) {
|
|
103
|
+
const { prop } = item
|
|
104
|
+
prop && typeof(prop) === 'string' && slots.push(prop)
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
return slots
|
|
103
108
|
}
|
|
104
109
|
// 默认搜索栏插槽
|
|
105
|
-
const defaultSlots = computed((): Array<string> => getFormSlots(props.config.items
|
|
110
|
+
const defaultSlots = computed((): Array<string> => getFormSlots(props.config.items?.slice(0, maxFormItem.value)) ?? [])
|
|
106
111
|
// 额外搜索栏插槽
|
|
107
|
-
const extraSlots = computed((): Array<string> => getFormSlots(props.config.items
|
|
112
|
+
const extraSlots = computed((): Array<string> => getFormSlots(props.config.items?.slice(maxFormItem.value)) ?? [])
|
|
108
113
|
|
|
109
114
|
// 搜索栏提交
|
|
110
|
-
const searchSubmit = (formModel:
|
|
115
|
+
const searchSubmit = (formModel: SearchConfig['model']) => {
|
|
111
116
|
emit('searchSubmit', { ...formModel, ...extraFormModel.value })
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
// 搜索栏取消
|
|
115
|
-
const
|
|
120
|
+
const searchReset = () => {
|
|
116
121
|
searchExtraRef.value?.reset()
|
|
117
|
-
const
|
|
118
|
-
emit('
|
|
122
|
+
const extraFormModel = searchExtraRef.value?.formModel ?? {}
|
|
123
|
+
emit('searchReset', { ...extraFormModel, ...searchDefaultRef.value.formModel })
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
// 搜索栏自定义操作
|
|
122
|
-
const searchCustomEvent = ({ event, formModel }: { event: string, formModel:
|
|
127
|
+
const searchCustomEvent = ({ event, formModel }: { event: string, formModel: SearchConfig['model']}) => {
|
|
123
128
|
const customEvent: Record<string, Function> = { openDrawer }
|
|
124
129
|
if (isValidKey(event, customEvent)) {
|
|
125
130
|
customEvent[event](formModel)
|
|
@@ -132,11 +137,9 @@ const openDrawer = () => showExtra.value = true // 打开额外搜索栏弹
|
|
|
132
137
|
const closeDrawer = () => showExtra.value = false // 关闭额外搜索栏弹窗
|
|
133
138
|
|
|
134
139
|
// 额外搜索栏提交
|
|
135
|
-
const drawerSubmit = (formModel:
|
|
140
|
+
const drawerSubmit = (formModel: SearchConfig['model']) => {
|
|
136
141
|
formModel && (extraFormModel.value = formModel)
|
|
137
142
|
emit('searchSubmit', { ...searchDefaultRef.value.formModel, ...formModel })
|
|
138
143
|
closeDrawer()
|
|
139
144
|
}
|
|
140
|
-
</script>
|
|
141
|
-
|
|
142
|
-
<style lang="scss"></style>
|
|
145
|
+
</script>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="tsx">
|
|
2
|
-
import { defineComponent, PropType, computed } from 'vue'
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
3
|
import {
|
|
4
4
|
TableConfig,
|
|
5
5
|
TableColumnConfig,
|
|
6
|
+
TableDefaultEvent,
|
|
6
7
|
tableDefaultConfig,
|
|
7
8
|
tableColumnDefaultConfig
|
|
8
9
|
} from '../../../model/flmComponentConfig'
|
|
@@ -37,6 +38,44 @@ export default defineComponent({
|
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
setup(props, { slots, emit }) {
|
|
41
|
+
// 表格默认事件
|
|
42
|
+
const tableDefaultEvent: TableDefaultEvent = reactive({
|
|
43
|
+
onSelect: (selection: any, row: any) => emit('select', { selection, row }),
|
|
44
|
+
onSelectAll: (selection: any) => emit('select-all', selection),
|
|
45
|
+
onSelectionChange: (row: any, column: any, cell: any, event: any) => emit('selection-change', { row, column, cell, event }),
|
|
46
|
+
onCellMouseEnter: (row: any, column: any, cell: any, event: any) => emit('cell-mouse-enter', { row, column, cell, event }),
|
|
47
|
+
onCellMouseLeave: (row: any, column: any, cell: any, event: any) => emit('cell-mouse-leave', { row, column, cell, event }),
|
|
48
|
+
onCellClick: (row: any, column: any, cell: any, event: any) => emit('cell-click', { row, column, cell, event }),
|
|
49
|
+
onCellDblclick: (row: any, column: any, cell: any, event: any) => emit('cell-dblclick', { row, column, cell, event }),
|
|
50
|
+
onCellContextmenu: (row: any, column: any, cell: any, event: any) => emit('cell-contextmenu', { row, column, cell, event }),
|
|
51
|
+
onRowClick: (row: any, column: any, event: any) => emit('row-click', { row, column, event }),
|
|
52
|
+
onRowContextmenu: (row: any, column: any, event: any) => emit('row-contextmenu', { row, column, event }),
|
|
53
|
+
onRowDblclick: (row: any, column: any, event: any) => emit('row-dblclick', { row, column, event }),
|
|
54
|
+
onHeaderClick: (column: any, event: any) => emit('header-click', { column, event }),
|
|
55
|
+
onHeaderContextmenu: (column: any, event: any) => emit('header-contextmenu', { column, event }),
|
|
56
|
+
onSortChange: ({ column, prop, order }: any) => emit('sort-change', { column, prop, order }),
|
|
57
|
+
onFilterChange: (filters: any) => emit('filter-change', filters),
|
|
58
|
+
onCurrentChange: (currentRow: any, oldCurrentRow: any) => emit('current-change', { currentRow, oldCurrentRow }),
|
|
59
|
+
onHeaderDragend: (newWidth: any, oldWidth: any, column: any, event: any) => emit('header-dragend', { newWidth, oldWidth, column, event }),
|
|
60
|
+
onExpandChange: (row: any, expanded: any) => emit('expand-change', { row, expanded }),
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 表格
|
|
65
|
+
* @date 2022-09-29
|
|
66
|
+
* @param {TableConfig} tableConfig 表格配置
|
|
67
|
+
* @returns {any} 表格dom
|
|
68
|
+
*/
|
|
69
|
+
const tableDom = (tableConfig: TableConfig) => {
|
|
70
|
+
const { columns = [], ...defaultConfig } = tableConfig
|
|
71
|
+
return (
|
|
72
|
+
<el-table
|
|
73
|
+
{...defaultConfig}
|
|
74
|
+
{...tableDefaultEvent}
|
|
75
|
+
>{tableColumnDom(columns)}</el-table>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
40
79
|
/**
|
|
41
80
|
* 表格元素
|
|
42
81
|
* @date 2022-04-14
|
|
@@ -61,30 +100,7 @@ export default defineComponent({
|
|
|
61
100
|
|
|
62
101
|
// 表单设置
|
|
63
102
|
const tableConfig = computed((): TableConfig => filterConfig(tableDefaultConfig, props.config))
|
|
64
|
-
|
|
65
|
-
return () => (
|
|
66
|
-
<el-table
|
|
67
|
-
{...defaultConfig}
|
|
68
|
-
onSelect={(selection: any, row: any) => emit('select', { selection, row })}
|
|
69
|
-
onSelectAll={(selection: any) => emit('select-all', selection)}
|
|
70
|
-
onSelectionChange={(row: any, column: any, cell: any, event: any) => emit('selection-change', { row, column, cell, event })}
|
|
71
|
-
onCellMouseEnter={(row: any, column: any, cell: any, event: any) => emit('cell-mouse-enter', { row, column, cell, event })}
|
|
72
|
-
onCellMouseLeave={(row: any, column: any, cell: any, event: any) => emit('cell-mouse-leave', { row, column, cell, event })}
|
|
73
|
-
onCellClick={(row: any, column: any, cell: any, event: any) => emit('cell-click', { row, column, cell, event })}
|
|
74
|
-
onCellDblclick={(row: any, column: any, cell: any, event: any) => emit('cell-dblclick', { row, column, cell, event })}
|
|
75
|
-
onCellContextmenu={(row: any, column: any, cell: any, event: any) => emit('cell-contextmenu', { row, column, cell, event })}
|
|
76
|
-
onRowClick={(row: any, column: any, event: any) => emit('row-click', { row, column, event })}
|
|
77
|
-
onRowContextmenu={(row: any, column: any, event: any) => emit('row-contextmenu', { row, column, event })}
|
|
78
|
-
onRowDblclick={(row: any, column: any, event: any) => emit('row-dblclick', { row, column, event })}
|
|
79
|
-
onHeaderClick={(column: any, event: any) => emit('header-click', { column, event })}
|
|
80
|
-
onHeaderContextmenu={(column: any, event: any) => emit('header-contextmenu', { column, event })}
|
|
81
|
-
onSortChange={({ column, prop, order }: any) => emit('sort-change', { column, prop, order })}
|
|
82
|
-
onFilterChange={(filters: any) => emit('filter-change', filters)}
|
|
83
|
-
onCurrentChange={(currentRow: any, oldCurrentRow: any) => emit('current-change', { currentRow, oldCurrentRow })}
|
|
84
|
-
onHeaderDragend={(newWidth: any, oldWidth: any, column: any, event: any) => emit('header-dragend', { newWidth, oldWidth, column, event })}
|
|
85
|
-
onExpandChange={(row: any, expanded: any) => emit('expand-change', { row, expanded })}
|
|
86
|
-
>{tableColumnDom(columns)}</el-table>
|
|
87
|
-
)
|
|
103
|
+
return () => (tableDom(tableConfig.value))
|
|
88
104
|
},
|
|
89
105
|
})
|
|
90
106
|
</script>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
trigger="click"
|
|
13
13
|
@command="toolbarClick"
|
|
14
14
|
>
|
|
15
|
-
<flm-button :config="{ ...config.publicConfig,
|
|
15
|
+
<flm-button :config="{ ...config.publicConfig, buttonText: '更多' }" />
|
|
16
16
|
<template #dropdown>
|
|
17
17
|
<el-dropdown-menu>
|
|
18
18
|
<el-dropdown-item
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
:config="buttonConfig"
|
|
21
21
|
:key="buttonConfig.event"
|
|
22
22
|
:command="buttonConfig.event"
|
|
23
|
-
>{{ buttonConfig.
|
|
23
|
+
>{{ buttonConfig.buttonText }}</el-dropdown-item>
|
|
24
24
|
</el-dropdown-menu>
|
|
25
25
|
</template>
|
|
26
26
|
</el-dropdown>
|
|
@@ -5,7 +5,6 @@ export { default as flmCheckbox } from './base/flmCheckbox/flmCheckbox.vue'
|
|
|
5
5
|
export { default as flmCheckboxGroup } from './base/flmCheckbox/flmCheckboxGroup.vue' // 多选框组
|
|
6
6
|
export { default as flmColorPicker } from './base/flmColorPicker/flmColorPicker.vue' // 取色器
|
|
7
7
|
export { default as flmDatePicker } from './base/flmDatePicker/flmDatePicker.vue' // 日期选择器
|
|
8
|
-
export { default as flmDialog } from './base/flmDialog/flmDialog.vue' // 弹窗
|
|
9
8
|
export { default as flmInput } from './base/flmInput/flmInput.vue' // 输入框
|
|
10
9
|
export { default as flmInputNumber } from './base/flmInputNumber/flmInputNumber.vue' // 数字输入框
|
|
11
10
|
export { default as flmPagination } from './base/flmPagination/flmPagination.vue' // 分页器
|
|
@@ -18,12 +17,13 @@ export { default as flmSwitch } from './base/flmSwitch/flmSwitch.vue'
|
|
|
18
17
|
export { default as flmTimePicker } from './base/flmTimePicker/flmTimePicker.vue' // 时间选择器
|
|
19
18
|
export { default as flmTimeSelect } from './base/flmTimeSelect/flmTimeSelect.vue' // 时间选择
|
|
20
19
|
export { default as flmTransfer } from './base/flmTransfer/flmTransfer.vue' // 穿梭框
|
|
20
|
+
export { default as flmDialog } from './base/flmDialog/flmDialog.vue' // 弹窗
|
|
21
21
|
|
|
22
22
|
// 复合组件
|
|
23
23
|
export { default as flmForm } from './complex/flmForm/flmForm.vue' // 表单
|
|
24
|
-
export { default as flmSearch } from './complex/flmSearch/flmSearch.vue' // 搜索
|
|
25
24
|
export { default as flmTable } from './complex/flmTable/flmTable.vue' // 表格
|
|
26
25
|
export { default as flmToolbar } from './complex/flmToolbar/flmToolbar.vue' // 操作栏
|
|
26
|
+
export { default as flmSearch } from './complex/flmSearch/flmSearch.vue' // 搜索
|
|
27
27
|
|
|
28
28
|
// 页面组件
|
|
29
29
|
export { default as flmReportPage } from './page/flmReportPage/flmReportPage.vue' // 报表页面
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</template>
|
|
64
64
|
|
|
65
65
|
<script lang="ts" setup>
|
|
66
|
-
import {
|
|
66
|
+
import { ref, Ref, computed, onMounted } from 'vue'
|
|
67
67
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
68
68
|
import {
|
|
69
69
|
flmForm,
|
|
@@ -74,13 +74,21 @@ import {
|
|
|
74
74
|
flmDialog
|
|
75
75
|
} from '../../index'
|
|
76
76
|
import {
|
|
77
|
-
ControlTypes,
|
|
78
77
|
FormItemConfig,
|
|
79
78
|
FormConfig,
|
|
80
79
|
TableColumnConfig,
|
|
81
80
|
ReportPageSetting,
|
|
82
81
|
} from '../../../model/flmComponentConfig'
|
|
83
82
|
import { isValidKey } from '../../../utils'
|
|
83
|
+
import request from '@/plugins/request'
|
|
84
|
+
|
|
85
|
+
const props = defineProps({
|
|
86
|
+
// 表名
|
|
87
|
+
tableName: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: true
|
|
90
|
+
}
|
|
91
|
+
})
|
|
84
92
|
|
|
85
93
|
const emit = defineEmits(['customEvent'])
|
|
86
94
|
const reportPageRef = ref()
|
|
@@ -113,7 +121,8 @@ let reportPageConfig: Ref<ReportPageSetting> = ref({
|
|
|
113
121
|
},
|
|
114
122
|
editForm: {}
|
|
115
123
|
})
|
|
116
|
-
|
|
124
|
+
const searchParams: FormConfig['model'] = ref({}) // 搜索条件
|
|
125
|
+
let tableSelection: Ref<Array<any>> = ref([]) // 表格勾选项
|
|
117
126
|
|
|
118
127
|
onMounted(() => {
|
|
119
128
|
queryPageSetting()
|
|
@@ -125,389 +134,78 @@ const tableHeight = () => {
|
|
|
125
134
|
headerHight = '50px', // 页眉高度
|
|
126
135
|
mainSpacing = '30px', // 主体内容边距
|
|
127
136
|
pageSearch = '50px', // 搜索栏高度
|
|
128
|
-
|
|
137
|
+
pageFooter = '50px', // 分页高度
|
|
129
138
|
pageSpacing = '40px' // 页面边距
|
|
130
|
-
return `calc(${homeHeight} - ${headerHight} - ${mainSpacing} - ${pageSearch} - ${
|
|
139
|
+
return `calc(${homeHeight} - ${headerHight} - ${mainSpacing} - ${pageSearch} - ${pageFooter} - ${pageSpacing})`
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
// 查询页面配置
|
|
134
143
|
const queryPageSetting = () => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
]
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
'prop': 'email',
|
|
157
|
-
'label': '注册邮箱',
|
|
158
|
-
'controlType': ControlTypes['flm-input'],
|
|
159
|
-
'controlConfig': {},
|
|
160
|
-
'rules': [{
|
|
161
|
-
'trigger': 'blur',
|
|
162
|
-
'validator': (rule: any, value: any, callback: any) => {
|
|
163
|
-
const emailRegExp: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
164
|
-
if (!value || emailRegExp.test(value)) {
|
|
165
|
-
callback()
|
|
166
|
-
} else {
|
|
167
|
-
callback(new Error('请填写正确的邮箱'))
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}]
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
'prop': 'userType',
|
|
174
|
-
'label': '用户类型',
|
|
175
|
-
'controlType': ControlTypes['flm-select'],
|
|
176
|
-
'controlConfig': {
|
|
177
|
-
'options': [
|
|
178
|
-
{ 'value': 0, 'label': '普通用户' },
|
|
179
|
-
{ 'value': 1, 'label': '企业用户' },
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
'prop': 'isAdmin',
|
|
185
|
-
'label': '超级权限',
|
|
186
|
-
'controlType': ControlTypes['flm-switch'],
|
|
187
|
-
'controlConfig': {
|
|
188
|
-
'active-text': "开启",
|
|
189
|
-
'inactive-text': "关闭"
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
'prop': 'searchSlotTwo',
|
|
194
|
-
'label': '搜索插槽2',
|
|
195
|
-
'isSlot': true
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
'buttons': [
|
|
199
|
-
{
|
|
200
|
-
'text': '重置',
|
|
201
|
-
'event': 'cancel'
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
'type': 'primary',
|
|
205
|
-
'plain': true,
|
|
206
|
-
'text': '搜索',
|
|
207
|
-
'event': 'submit'
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
toolbar: {
|
|
212
|
-
publicConfig: { 'type': 'primary', 'plain': true },
|
|
213
|
-
maxButton: 3,
|
|
214
|
-
buttons: [
|
|
215
|
-
{ 'text':'新增', event: 'openAddDialog' },
|
|
216
|
-
{ 'text': '导入', event: 'pageImport' },
|
|
217
|
-
{ 'text': '导出', event: 'pageExport' },
|
|
218
|
-
{ 'text': '批量删除', event: 'pageBatchDelete' },
|
|
219
|
-
{ 'text': '批量审核', event: 'batchAudit' },
|
|
220
|
-
{ 'text': '批量编辑', event: 'batchEdit' },
|
|
221
|
-
]
|
|
222
|
-
},
|
|
223
|
-
table: {
|
|
224
|
-
'border': true,
|
|
225
|
-
'height': "250",
|
|
226
|
-
'max-height': "250",
|
|
227
|
-
'columns': [
|
|
228
|
-
{ prop: 'selection', label: '勾选', type: 'selection', fixed: 'left' },
|
|
229
|
-
{ prop: 'index', label: '序号', type: 'index', width: 60 },
|
|
230
|
-
{ prop: 'userName', label: '用户名' },
|
|
231
|
-
{ prop: 'userType', label: '角色类型', isSlot: true },
|
|
232
|
-
{ prop: 'phone', label: '联系方式' },
|
|
233
|
-
{ prop: 'email', label: '注册邮箱' },
|
|
234
|
-
{
|
|
235
|
-
prop: 'address',
|
|
236
|
-
label: '地址',
|
|
237
|
-
align: 'center',
|
|
238
|
-
columns: [
|
|
239
|
-
{ prop: 'province', label: '省' },
|
|
240
|
-
{ prop: 'city', label: '市' },
|
|
241
|
-
{ prop: 'area', label: '区' },
|
|
242
|
-
{ prop: 'house', label: '详细', 'show-overflow-tooltip': true },
|
|
243
|
-
]
|
|
244
|
-
},
|
|
245
|
-
]
|
|
246
|
-
},
|
|
247
|
-
tableAction: {
|
|
248
|
-
publicConfig: { 'type': 'text' },
|
|
249
|
-
maxButton: 3,
|
|
250
|
-
buttons: [
|
|
251
|
-
{ 'text': '详情', event: 'openReadDialog' },
|
|
252
|
-
{ 'text': '编辑', event: 'openEditDialog' },
|
|
253
|
-
{ 'text': '删除', event: 'pageDelete' },
|
|
254
|
-
{ 'text': '审核', event: 'delete' },
|
|
255
|
-
{ 'text': '忽略', event: 'delete' },
|
|
256
|
-
]
|
|
257
|
-
},
|
|
258
|
-
pagination: {
|
|
259
|
-
'page-size': 100,
|
|
260
|
-
'current-page': 1,
|
|
261
|
-
'page-sizes': [20, 50, 100, 200],
|
|
262
|
-
'total': 400,
|
|
263
|
-
'layout': 'sizes, prev, pager, next, jumper, ->, total',
|
|
264
|
-
},
|
|
265
|
-
readDialog: {
|
|
266
|
-
'model-value': false,
|
|
267
|
-
title: '用户详情'
|
|
268
|
-
},
|
|
269
|
-
readForm: {
|
|
270
|
-
'rules': {
|
|
271
|
-
'userName': [
|
|
272
|
-
{ 'min': 2, 'max': 10, 'message': '用户名字符在 2 ~ 10 以内', 'trigger': 'blur' },
|
|
273
|
-
],
|
|
274
|
-
'email': [{
|
|
275
|
-
'trigger': 'blur',
|
|
276
|
-
'validator': (rule: any, value: any, callback: any) => {
|
|
277
|
-
const emailRegExp: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
278
|
-
if (!emailRegExp.test(value)) return callback(new Error('请填写正确的邮箱'))
|
|
279
|
-
callback()
|
|
280
|
-
}
|
|
281
|
-
}],
|
|
282
|
-
},
|
|
283
|
-
'label-suffix': ':',
|
|
284
|
-
// 自定义属性
|
|
285
|
-
'items': [
|
|
286
|
-
{
|
|
287
|
-
'prop': 'userName',
|
|
288
|
-
'label': '用户名称',
|
|
289
|
-
'controlType': ControlTypes['flm-read'],
|
|
290
|
-
'controlConfig': {}
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
'prop': 'email',
|
|
294
|
-
'label': '注册邮箱',
|
|
295
|
-
'controlType': ControlTypes['flm-read'],
|
|
296
|
-
'controlConfig': {}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
'prop': 'userType',
|
|
300
|
-
'label': '用户类型',
|
|
301
|
-
'isSlot': true,
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
'buttons': [
|
|
305
|
-
{
|
|
306
|
-
'type': 'primary',
|
|
307
|
-
'text': '确定',
|
|
308
|
-
'event': 'cancel'
|
|
309
|
-
}
|
|
310
|
-
]
|
|
311
|
-
},
|
|
312
|
-
addDialog: {
|
|
313
|
-
'model-value': false,
|
|
314
|
-
title: '新增用户',
|
|
315
|
-
},
|
|
316
|
-
addForm: {
|
|
317
|
-
'label-suffix': ':',
|
|
318
|
-
// 自定义属性
|
|
319
|
-
'items': [
|
|
320
|
-
{
|
|
321
|
-
'prop': 'userName',
|
|
322
|
-
'label': '用户名称',
|
|
323
|
-
'required': true,
|
|
324
|
-
'controlType': ControlTypes['flm-input'],
|
|
325
|
-
'controlConfig': {},
|
|
326
|
-
'rules': [
|
|
327
|
-
{ 'required': true, 'message': '用户名不能为空' },
|
|
328
|
-
{ 'min': 2, 'max': 10, 'message': '用户名字符在 2 ~ 10 以内', 'trigger': 'blur' },
|
|
329
|
-
]
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
'prop': 'email',
|
|
333
|
-
'label': '注册邮箱',
|
|
334
|
-
'required': true,
|
|
335
|
-
'controlType': ControlTypes['flm-input'],
|
|
336
|
-
'controlConfig': {},
|
|
337
|
-
'rules': [
|
|
338
|
-
{ 'required': true, 'message': '注册邮箱不能为空' },
|
|
339
|
-
{
|
|
340
|
-
'trigger': 'blur',
|
|
341
|
-
'validator': (rule: any, value: any, callback: any) => {
|
|
342
|
-
const emailRegExp: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
343
|
-
if (!emailRegExp.test(value)) return callback(new Error('请填写正确的邮箱'))
|
|
344
|
-
callback()
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
]
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
'prop': 'userType',
|
|
351
|
-
'label': '用户类型',
|
|
352
|
-
'required': true,
|
|
353
|
-
'controlType': ControlTypes['flm-select'],
|
|
354
|
-
'controlConfig': {
|
|
355
|
-
'options': [
|
|
356
|
-
{ 'value': 0, 'label': '普通用户' },
|
|
357
|
-
{ 'value': 1, 'label': '企业用户' },
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
|
-
'rules': [
|
|
361
|
-
{ 'required': true, 'message': '用户类型不能为空' },
|
|
362
|
-
]
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
'prop': 'isAdmin',
|
|
366
|
-
'label': '超级权限',
|
|
367
|
-
'required': true,
|
|
368
|
-
'controlType': ControlTypes['flm-switch'],
|
|
369
|
-
'controlConfig': {
|
|
370
|
-
'active-text': "开启",
|
|
371
|
-
'inactive-text': "关闭"
|
|
372
|
-
},
|
|
373
|
-
'rules': [
|
|
374
|
-
{ 'required': true, 'message': '超级权限不能为空' },
|
|
375
|
-
]
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
'prop': 'addTips',
|
|
379
|
-
'isSlot': true,
|
|
380
|
-
},
|
|
381
|
-
],
|
|
382
|
-
'buttons': [
|
|
383
|
-
{
|
|
384
|
-
'text': '取消',
|
|
385
|
-
'event': 'cancel'
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
'type': 'primary',
|
|
389
|
-
'text': '确定',
|
|
390
|
-
'event': 'submit'
|
|
391
|
-
}
|
|
392
|
-
]
|
|
393
|
-
},
|
|
394
|
-
editDialog: {
|
|
395
|
-
'model-value': false,
|
|
396
|
-
title: '编辑用户'
|
|
397
|
-
},
|
|
398
|
-
editForm: {
|
|
399
|
-
'model': {},
|
|
400
|
-
'rules': {
|
|
401
|
-
'userName': [
|
|
402
|
-
{ 'min': 2, 'max': 10, 'message': '用户名字符在 2 ~ 10 以内', 'trigger': 'blur' },
|
|
403
|
-
],
|
|
404
|
-
'email': [{
|
|
405
|
-
'trigger': 'blur',
|
|
406
|
-
'validator': (rule: any, value: any, callback: any) => {
|
|
407
|
-
const emailRegExp: RegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
408
|
-
if (!emailRegExp.test(value)) return callback(new Error('请填写正确的邮箱'))
|
|
409
|
-
callback()
|
|
410
|
-
}
|
|
411
|
-
}],
|
|
412
|
-
},
|
|
413
|
-
'label-suffix': ':',
|
|
414
|
-
// 自定义属性
|
|
415
|
-
'items': [
|
|
416
|
-
{
|
|
417
|
-
'prop': 'userName',
|
|
418
|
-
'label': '用户名称',
|
|
419
|
-
'controlType': ControlTypes['flm-input'],
|
|
420
|
-
'controlConfig': {}
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
'prop': 'email',
|
|
424
|
-
'label': '注册邮箱',
|
|
425
|
-
'controlType': ControlTypes['flm-input'],
|
|
426
|
-
'controlConfig': {}
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
'prop': 'userType',
|
|
430
|
-
'label': '用户类型',
|
|
431
|
-
'controlType': ControlTypes['flm-select'],
|
|
432
|
-
'controlConfig': {
|
|
433
|
-
'options': [
|
|
434
|
-
{ 'value': 0, 'label': '普通用户' },
|
|
435
|
-
{ 'value': 1, 'label': '企业用户' },
|
|
436
|
-
]
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
],
|
|
440
|
-
'buttons': [
|
|
441
|
-
{
|
|
442
|
-
'text': '取消',
|
|
443
|
-
'event': 'cancel'
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
'type': 'primary',
|
|
447
|
-
'text': '确定',
|
|
448
|
-
'event': 'submit'
|
|
449
|
-
}
|
|
450
|
-
]
|
|
451
|
-
},
|
|
452
|
-
}
|
|
453
|
-
reportPageSetting.table['height'] = tableHeight()
|
|
454
|
-
reportPageSetting.table['max-height'] = tableHeight()
|
|
455
|
-
reportPageSetting.tableAction.buttons.length && reportPageSetting.table.columns?.push({
|
|
456
|
-
prop: 'tableAction',
|
|
457
|
-
label: '操作',
|
|
458
|
-
isSlot: true,
|
|
459
|
-
fixed: 'right',
|
|
460
|
-
'min-width': '100px'
|
|
144
|
+
request.flameRequest({
|
|
145
|
+
tableName: 'flametableinfo',
|
|
146
|
+
flameMethod: 'webgetpagesetting',
|
|
147
|
+
data: { table_name: 'sys_flame_role', menu_id: null }
|
|
148
|
+
})
|
|
149
|
+
.then(({ items }: any) => {
|
|
150
|
+
const reportPageSetting: ReportPageSetting = items
|
|
151
|
+
reportPageSetting.table['height'] = tableHeight()
|
|
152
|
+
reportPageSetting.table['max-height'] = tableHeight()
|
|
153
|
+
reportPageSetting.tableAction.buttons.length && reportPageSetting.table.columns?.push({
|
|
154
|
+
prop: 'tableAction',
|
|
155
|
+
label: '操作',
|
|
156
|
+
isSlot: true,
|
|
157
|
+
fixed: 'right',
|
|
158
|
+
'min-width': '200px'
|
|
159
|
+
})
|
|
160
|
+
reportPageConfig.value = reportPageSetting
|
|
161
|
+
queryPageData()
|
|
461
162
|
})
|
|
462
|
-
reportPageConfig.value = reportPageSetting
|
|
463
|
-
queryPageData()
|
|
464
|
-
}, 500)
|
|
465
163
|
}
|
|
466
164
|
|
|
467
165
|
// 查询页面数据
|
|
468
166
|
const queryPageData = () => {
|
|
469
167
|
const {
|
|
470
|
-
['current-page']:
|
|
471
|
-
['page-size']:
|
|
168
|
+
['current-page']: page_no = 1,
|
|
169
|
+
['page-size']: page_size = 20,
|
|
472
170
|
}: ReportPageSetting['pagination'] = reportPageConfig.value.pagination
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
171
|
+
request.flameApi.pageSearch({
|
|
172
|
+
tableName: props.tableName,
|
|
173
|
+
data: {
|
|
174
|
+
page_no,
|
|
175
|
+
page_size,
|
|
176
|
+
conditions: searchParams.value,
|
|
177
|
+
ref_level: 1,
|
|
178
|
+
order_by: "flame_id DESC"
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
.then(({ items, total }: any) => {
|
|
182
|
+
reportPageConfig.value.table.data = items
|
|
183
|
+
reportPageConfig.value.pagination['total'] = total
|
|
184
|
+
isLoaded.value = true
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// 页面刷新
|
|
189
|
+
const pageRefresh = () => {
|
|
190
|
+
reportPageConfig.value.pagination['current-page'] = 1
|
|
191
|
+
queryPageData()
|
|
493
192
|
}
|
|
494
193
|
|
|
495
194
|
// 搜索栏提交
|
|
496
195
|
const searchSubmit = (event: object) => {
|
|
497
|
-
|
|
196
|
+
searchParams.value = event
|
|
197
|
+
pageRefresh()
|
|
498
198
|
}
|
|
499
199
|
|
|
500
200
|
// 工具栏点击
|
|
501
201
|
const toolbarClick = (event: string) => {
|
|
502
|
-
console.log(`工具栏调用:${event}`)
|
|
503
202
|
isValidKey(event, pageDefaultEvent)
|
|
504
203
|
? pageDefaultEvent[event]()
|
|
505
|
-
: emit('customEvent',
|
|
204
|
+
: emit('customEvent', event)
|
|
506
205
|
}
|
|
507
206
|
|
|
508
207
|
// 表格操作栏点击
|
|
509
208
|
const tableActionClick = (event: string, scope: any) => {
|
|
510
|
-
console.log(`表格操作:${event}, 数据:`, scope)
|
|
511
209
|
isValidKey(event, pageDefaultEvent)
|
|
512
210
|
? pageDefaultEvent[event](scope)
|
|
513
211
|
: emit('customEvent', { event, scope })
|
|
@@ -517,8 +215,7 @@ const tableActionClick = (event: string, scope: any) => {
|
|
|
517
215
|
const tableEvent: Record<string, (event?: any) => void> = {
|
|
518
216
|
// 表格勾选项变化
|
|
519
217
|
selectionChange: ({ row }: any) => {
|
|
520
|
-
|
|
521
|
-
tableSelection = row
|
|
218
|
+
tableSelection.value = row
|
|
522
219
|
}
|
|
523
220
|
}
|
|
524
221
|
|
|
@@ -526,14 +223,12 @@ const tableEvent: Record<string, (event?: any) => void> = {
|
|
|
526
223
|
const paginationEvent: Record<string, (event?: any) => void> = {
|
|
527
224
|
// 每页数量变化
|
|
528
225
|
sizeChange:(pageSize: number) => {
|
|
529
|
-
console.log(`每页 ${pageSize} 条`)
|
|
530
226
|
reportPageConfig.value.pagination['current-page'] = 1
|
|
531
227
|
reportPageConfig.value.pagination['page-size'] = pageSize
|
|
532
228
|
queryPageData()
|
|
533
229
|
},
|
|
534
230
|
// 当前页变化
|
|
535
231
|
currentChange:(current: number) => {
|
|
536
|
-
console.log(`当前为第 ${current} 页`)
|
|
537
232
|
reportPageConfig.value.pagination['current-page'] = current
|
|
538
233
|
queryPageData()
|
|
539
234
|
},
|
|
@@ -543,7 +238,6 @@ const paginationEvent: Record<string, (event?: any) => void> = {
|
|
|
543
238
|
const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
544
239
|
// 打开详情弹窗
|
|
545
240
|
openReadDialog:(scope: any) => {
|
|
546
|
-
console.log('查看详情,数据:', scope.row)
|
|
547
241
|
reportPageConfig.value.readForm['model'] = scope.row
|
|
548
242
|
reportPageConfig.value.readDialog['model-value'] = true
|
|
549
243
|
},
|
|
@@ -565,7 +259,6 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
565
259
|
},
|
|
566
260
|
// 页面新增
|
|
567
261
|
pageAdd:(formModel: FormConfig['model']) => {
|
|
568
|
-
console.log('页面新增,数据:', formModel)
|
|
569
262
|
pageDefaultEvent.closeAddDialog()
|
|
570
263
|
},
|
|
571
264
|
// 页面删除
|
|
@@ -580,9 +273,14 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
580
273
|
}
|
|
581
274
|
)
|
|
582
275
|
.then(() => {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
276
|
+
request.flameApi.singleDelete({
|
|
277
|
+
tableName: props.tableName,
|
|
278
|
+
data: { key: scope.row.flame_id }
|
|
279
|
+
})
|
|
280
|
+
.then(() => {
|
|
281
|
+
pageRefresh()
|
|
282
|
+
ElMessage.success('删除成功')
|
|
283
|
+
})
|
|
586
284
|
})
|
|
587
285
|
.catch(() => {
|
|
588
286
|
ElMessage.info('取消删除')
|
|
@@ -590,7 +288,6 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
590
288
|
},
|
|
591
289
|
// 打开编辑弹窗
|
|
592
290
|
openEditDialog:(scope: any) => {
|
|
593
|
-
console.log('单条编辑,数据:', scope.row)
|
|
594
291
|
reportPageConfig.value.editForm['model'] = scope.row
|
|
595
292
|
reportPageConfig.value.editDialog['model-value'] = true
|
|
596
293
|
},
|
|
@@ -600,17 +297,24 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
600
297
|
},
|
|
601
298
|
// 页面编辑
|
|
602
299
|
pageEdit:(formModel: FormConfig['model']) => {
|
|
603
|
-
|
|
604
|
-
|
|
300
|
+
request.flameApi.singleUpdate({
|
|
301
|
+
tableName: props.tableName,
|
|
302
|
+
data: {
|
|
303
|
+
key: formModel?.flame_id,
|
|
304
|
+
data: formModel
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
.then(() => {
|
|
308
|
+
pageRefresh()
|
|
309
|
+
ElMessage.success('修改成功')
|
|
310
|
+
pageDefaultEvent.closeEditDialog()
|
|
311
|
+
})
|
|
605
312
|
},
|
|
606
313
|
// 页面导入
|
|
607
|
-
pageImport:() => console.log('页面导入'),
|
|
608
314
|
// 页面导出
|
|
609
|
-
pageExport:() => console.log('页面导出'),
|
|
610
315
|
// 页面批量删除
|
|
611
316
|
pageBatchDelete:() => {
|
|
612
|
-
|
|
613
|
-
if (tableSelection.length) {
|
|
317
|
+
if (tableSelection.value.length) {
|
|
614
318
|
ElMessageBox.confirm(
|
|
615
319
|
'确认要删除勾选数据吗?此操作不可逆',
|
|
616
320
|
'提示',
|
|
@@ -622,8 +326,18 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
622
326
|
)
|
|
623
327
|
.then(() => {
|
|
624
328
|
// 此处需要请求删除接口,并完成回显
|
|
625
|
-
|
|
626
|
-
|
|
329
|
+
request.flameApi.batchDelete({
|
|
330
|
+
tableName: props.tableName,
|
|
331
|
+
data: {
|
|
332
|
+
conditions: {
|
|
333
|
+
flame_id: tableSelection.value.map(({ flame_id }) => flame_id)
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
.then(() => {
|
|
338
|
+
pageRefresh()
|
|
339
|
+
ElMessage.success('删除成功')
|
|
340
|
+
})
|
|
627
341
|
})
|
|
628
342
|
.catch(() => {
|
|
629
343
|
ElMessage.info('取消删除')
|
|
@@ -634,6 +348,8 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
634
348
|
},
|
|
635
349
|
}
|
|
636
350
|
|
|
351
|
+
defineExpose({ tableSelection, pageRefresh })
|
|
352
|
+
|
|
637
353
|
// 表格插槽
|
|
638
354
|
const getTableSlots = computed((): Array<string> => {
|
|
639
355
|
const columns: Array<TableColumnConfig> = reportPageConfig.value.table.columns || []
|
|
@@ -25,6 +25,9 @@ export interface ButtonConfig {
|
|
|
25
25
|
'size'?: ElementSize
|
|
26
26
|
'type'?: ButtonType
|
|
27
27
|
'plain'?: boolean
|
|
28
|
+
'text'?: boolean
|
|
29
|
+
'bg'?: boolean
|
|
30
|
+
'link'?: boolean
|
|
28
31
|
'round'?: boolean
|
|
29
32
|
'circle'?: boolean
|
|
30
33
|
'loading'?: boolean
|
|
@@ -35,7 +38,7 @@ export interface ButtonConfig {
|
|
|
35
38
|
'native-type'?: ButtonNativeType
|
|
36
39
|
'auto-insert-space'?: boolean
|
|
37
40
|
// 自定义属性
|
|
38
|
-
'
|
|
41
|
+
'buttonText'?: string // 按钮文字
|
|
39
42
|
}
|
|
40
43
|
// 按钮默认设置
|
|
41
44
|
export const buttonDefaultConfig: ButtonConfig = {
|
|
@@ -31,7 +31,6 @@ export const paginationDefaultConfig: PaginationConfig = {
|
|
|
31
31
|
'background': false,
|
|
32
32
|
'page-size': 10,
|
|
33
33
|
'pager-count': 7,
|
|
34
|
-
'current-page': 1,
|
|
35
34
|
'layout': 'prev, pager, next, jumper, ->, total',
|
|
36
35
|
'page-sizes': [10, 20, 30, 40, 50, 100],
|
|
37
36
|
'disabled': false,
|
|
@@ -79,6 +79,28 @@ export interface TableColumnConfig {
|
|
|
79
79
|
'columns'?: Array<TableColumnConfig>
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
// 表格默认事件
|
|
83
|
+
export interface TableDefaultEvent {
|
|
84
|
+
onSelect: (selection: any, row: any) => void,
|
|
85
|
+
onSelectAll: (selection: any) => void,
|
|
86
|
+
onSelectionChange: (row: any, column: any, cell: any, event: any) => void,
|
|
87
|
+
onCellMouseEnter: (row: any, column: any, cell: any, event: any) => void,
|
|
88
|
+
onCellMouseLeave: (row: any, column: any, cell: any, event: any) => void,
|
|
89
|
+
onCellClick: (row: any, column: any, cell: any, event: any) => void,
|
|
90
|
+
onCellDblclick: (row: any, column: any, cell: any, event: any) => void,
|
|
91
|
+
onCellContextmenu: (row: any, column: any, cell: any, event: any) => void,
|
|
92
|
+
onRowClick: (row: any, column: any, event: any) => void,
|
|
93
|
+
onRowContextmenu: (row: any, column: any, event: any) => void,
|
|
94
|
+
onRowDblclick: (row: any, column: any, event: any) => void,
|
|
95
|
+
onHeaderClick: (column: any, event: any) => void,
|
|
96
|
+
onHeaderContextmenu: (column: any, event: any) => void,
|
|
97
|
+
onSortChange: ({ column, prop, order }: any) => void,
|
|
98
|
+
onFilterChange: (filters: any) => void,
|
|
99
|
+
onCurrentChange: (currentRow: any, oldCurrentRow: any) => void,
|
|
100
|
+
onHeaderDragend: (newWidth: any, oldWidth: any, column: any, event: any) => void,
|
|
101
|
+
onExpandChange: (row: any, expanded: any) => void,
|
|
102
|
+
}
|
|
103
|
+
|
|
82
104
|
// 表格默认设置
|
|
83
105
|
export const tableDefaultConfig: TableConfig = {
|
|
84
106
|
'stripe': false,
|