flame-plus 0.1.25 → 0.1.26
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
CHANGED
|
@@ -1,303 +1,237 @@
|
|
|
1
|
-
<script lang="tsx">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const updateFormModel = (model: FormModel) => {
|
|
130
|
-
Object.entries(model).forEach(([key, value]: Array < any > ) => formModel[key] = value)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* 表单修改
|
|
135
|
-
* @date 2022-04-14
|
|
136
|
-
* @param {any} value 修改值
|
|
137
|
-
* @param {string} prop 修改键名
|
|
138
|
-
*/
|
|
139
|
-
const formChange = (value: any, prop: string) => formModel[prop] = value
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* 表单方法调用
|
|
143
|
-
* @date 2022-04-14
|
|
144
|
-
* @param {'submit' | 'cancel' | 'reset' | string} event 方法名(默认方法直接调用;自定义方法回传方法名及表单数据)
|
|
145
|
-
*/
|
|
146
|
-
const formEvent = (event: FormButtonConfig['event']) => {
|
|
147
|
-
const defaultEvent: Record < FormButtonConfig['event'], Function > = {
|
|
148
|
-
submit,
|
|
149
|
-
cancel,
|
|
150
|
-
reset
|
|
151
|
-
}
|
|
152
|
-
isValidKey(event, defaultEvent) ?
|
|
153
|
-
defaultEvent[event]() :
|
|
154
|
-
emit('customEvent', {
|
|
155
|
-
event,
|
|
156
|
-
formModel
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// 提交
|
|
161
|
-
const submit = () => {
|
|
162
|
-
const formRef: any = instance?.refs['formRef']
|
|
163
|
-
if (!formRef) return
|
|
164
|
-
formRef.validate((valid: boolean) => {
|
|
165
|
-
valid && emit('submit', formModel)
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// 取消
|
|
170
|
-
const cancel = () => {
|
|
171
|
-
emit('cancel', formModel)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// 重置
|
|
175
|
-
const reset = () => {
|
|
176
|
-
const formRef: any = instance?.refs['formRef']
|
|
177
|
-
if (!formRef) return
|
|
178
|
-
formRef.resetFields()
|
|
179
|
-
emit('reset', formModel)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* 表单元素
|
|
184
|
-
* @date 2022-04-14
|
|
185
|
-
* @param {Array} items 表单项配置
|
|
186
|
-
* @returns {any} 表单项dom
|
|
187
|
-
*/
|
|
188
|
-
const formItemsDom = (items: FormConfig['items'] = []) => {
|
|
189
|
-
const controlDom = (prop: string, controlType: ControlTypes, controlConfig: ControlConfig) => {
|
|
190
|
-
const config: FormModel = {
|
|
191
|
-
...controlConfig
|
|
192
|
-
}
|
|
193
|
-
const event = controlType === ControlTypes['flmInput'] ? 'onInput' : 'onChange'
|
|
194
|
-
config[event] = (value: any) => formChange(value, prop)
|
|
195
|
-
return h(resolveComponent(controlType), {
|
|
196
|
-
config
|
|
197
|
-
})
|
|
198
|
-
}
|
|
199
|
-
return items.map((item: FormItemConfig) => {
|
|
200
|
-
if (typeof(item.prop) === 'string') {
|
|
201
|
-
if (isValidKey('isSlot', item)) {
|
|
202
|
-
const {
|
|
203
|
-
isSlot,
|
|
204
|
-
...itemConfig
|
|
205
|
-
} = item
|
|
206
|
-
return ( <
|
|
207
|
-
el - form - item class = {
|
|
208
|
-
`form-${item.prop}`
|
|
209
|
-
} {
|
|
210
|
-
...itemConfig
|
|
211
|
-
} > {
|
|
212
|
-
(slots[item.prop]?.({
|
|
213
|
-
prop: item.prop,
|
|
214
|
-
formModel
|
|
215
|
-
}))
|
|
216
|
-
} <
|
|
217
|
-
/el-form-item>
|
|
218
|
-
)
|
|
219
|
-
} else {
|
|
220
|
-
const {
|
|
221
|
-
controlType,
|
|
222
|
-
controlConfig,
|
|
223
|
-
...itemConfig
|
|
224
|
-
} = item
|
|
225
|
-
if (controlType && controlConfig) {
|
|
226
|
-
return ( <
|
|
227
|
-
el - form - item class = {
|
|
228
|
-
`form-${item.prop}`
|
|
229
|
-
} {
|
|
230
|
-
...itemConfig
|
|
231
|
-
} > {
|
|
232
|
-
controlDom(item.prop, controlType, controlConfig)
|
|
233
|
-
} <
|
|
234
|
-
/el-form-item>
|
|
235
|
-
)
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* 表单按钮
|
|
244
|
-
* @date 2022-04-14
|
|
245
|
-
* @param {Array} buttons 表单按钮配置
|
|
246
|
-
* @returns {any} 表单按钮dom
|
|
247
|
-
*/
|
|
248
|
-
const buttonsDom = (buttons: FormConfig['buttons'] = []) => {
|
|
249
|
-
if (buttons.length) {
|
|
250
|
-
return ( <
|
|
251
|
-
el - form - item class = "form-buttons" > {
|
|
252
|
-
buttons.map(({
|
|
253
|
-
event,
|
|
254
|
-
...config
|
|
255
|
-
}: FormButtonConfig) =>
|
|
256
|
-
<
|
|
257
|
-
flm - button config = {
|
|
258
|
-
config
|
|
259
|
-
}
|
|
260
|
-
onButtonClick = {
|
|
261
|
-
() => formEvent(event)
|
|
262
|
-
}
|
|
263
|
-
/>
|
|
264
|
-
)
|
|
265
|
-
} <
|
|
266
|
-
/el-form-item>
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
expose({
|
|
272
|
-
formModel,
|
|
273
|
-
reset
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
// 表单设置
|
|
277
|
-
const formConfig = computed((): FormConfig => filterConfig(formDefaultConfig, props.config))
|
|
278
|
-
const formDom = () => {
|
|
279
|
-
const {
|
|
280
|
-
items = [], buttons = [], model, ...defaultConfig
|
|
281
|
-
} = formConfig.value
|
|
282
|
-
return ( <
|
|
283
|
-
el - form ref = 'formRef' {
|
|
284
|
-
...defaultConfig
|
|
285
|
-
}
|
|
286
|
-
model = {
|
|
287
|
-
formModel
|
|
288
|
-
} > {
|
|
289
|
-
formItemsDom(items)
|
|
290
|
-
} {
|
|
291
|
-
buttonsDom(buttons)
|
|
292
|
-
} <
|
|
293
|
-
/el-form>
|
|
294
|
-
)
|
|
295
|
-
}
|
|
296
|
-
return () => (formDom())
|
|
297
|
-
},
|
|
298
|
-
})
|
|
299
|
-
</script>
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
getCurrentInstance,
|
|
5
|
+
PropType,
|
|
6
|
+
reactive,
|
|
7
|
+
computed,
|
|
8
|
+
watch,
|
|
9
|
+
h,
|
|
10
|
+
resolveComponent,
|
|
11
|
+
onMounted
|
|
12
|
+
} from 'vue'
|
|
13
|
+
import {
|
|
14
|
+
flmButton,
|
|
15
|
+
flmCascader,
|
|
16
|
+
flmCheckbox,
|
|
17
|
+
flmColorPicker,
|
|
18
|
+
flmDatePicker,
|
|
19
|
+
flmInput,
|
|
20
|
+
flmInputNumber,
|
|
21
|
+
flmRadio,
|
|
22
|
+
flmRate,
|
|
23
|
+
flmRead,
|
|
24
|
+
flmSelect,
|
|
25
|
+
flmSlider,
|
|
26
|
+
flmSwitch,
|
|
27
|
+
flmTimePicker,
|
|
28
|
+
flmTimeSelect,
|
|
29
|
+
flmTransfer,
|
|
30
|
+
} from '../../index'
|
|
31
|
+
import {
|
|
32
|
+
ControlTypes,
|
|
33
|
+
ControlConfig,
|
|
34
|
+
isInputControl,
|
|
35
|
+
FormModel,
|
|
36
|
+
FormConfig,
|
|
37
|
+
FormItemConfig,
|
|
38
|
+
FormButtonConfig,
|
|
39
|
+
formDefaultConfig
|
|
40
|
+
} from '../../../model/flmComponentConfig'
|
|
41
|
+
import { filterConfig, isValidKey } from '../../../utils'
|
|
42
|
+
|
|
43
|
+
export default defineComponent({
|
|
44
|
+
components: {
|
|
45
|
+
flmButton,
|
|
46
|
+
flmCascader,
|
|
47
|
+
flmCheckbox,
|
|
48
|
+
flmColorPicker,
|
|
49
|
+
flmDatePicker,
|
|
50
|
+
flmInput,
|
|
51
|
+
flmInputNumber,
|
|
52
|
+
flmRadio,
|
|
53
|
+
flmRate,
|
|
54
|
+
flmRead,
|
|
55
|
+
flmSelect,
|
|
56
|
+
flmSlider,
|
|
57
|
+
flmSwitch,
|
|
58
|
+
flmTimePicker,
|
|
59
|
+
flmTimeSelect,
|
|
60
|
+
flmTransfer,
|
|
61
|
+
},
|
|
62
|
+
emits: ['submit', 'cancel', 'reset', 'customEvent'],
|
|
63
|
+
props: {
|
|
64
|
+
// 默认设置
|
|
65
|
+
config: {
|
|
66
|
+
type: Object as PropType<FormConfig>,
|
|
67
|
+
default: {}
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
columnNumber(): number | boolean {
|
|
72
|
+
const { inline = false, columnNumber = 0 } = this.config
|
|
73
|
+
return inline && columnNumber > 1
|
|
74
|
+
? columnNumber
|
|
75
|
+
: false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
setup(props, { slots, emit, expose }) {
|
|
79
|
+
const instance = getCurrentInstance() // 实例,必须在最外层声明
|
|
80
|
+
let formModel: FormModel = reactive({}) // 表单数据
|
|
81
|
+
|
|
82
|
+
// 监听表单配置的 model,变化后更新组件内部 formModel
|
|
83
|
+
watch(() => props.config.model, (newModel: FormModel) => updateFormModel(newModel))
|
|
84
|
+
|
|
85
|
+
// 监听组件内部 formModel,变化后更新控件 value
|
|
86
|
+
watch(formModel, (newModel: FormModel) => updateControl(newModel))
|
|
87
|
+
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
if (props.config?.model && Object.keys(props.config?.model).length) {
|
|
90
|
+
updateControl(props.config.model)
|
|
91
|
+
updateFormModel(props.config.model)
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 更新控件值
|
|
97
|
+
* @date 2022-05-09
|
|
98
|
+
* @param {FormModel} model
|
|
99
|
+
*/
|
|
100
|
+
const updateControl = (model: FormModel) => {
|
|
101
|
+
props.config.items?.forEach((formItem: FormItemConfig) => {
|
|
102
|
+
if (!isValidKey('isSlot', formItem) && typeof(formItem.prop) === 'string') {
|
|
103
|
+
const { controlConfig } = formItem
|
|
104
|
+
controlConfig && (
|
|
105
|
+
isInputControl(controlConfig)
|
|
106
|
+
? controlConfig['modelValue'] = model[formItem.prop]
|
|
107
|
+
: controlConfig['model-value'] = model[formItem.prop]
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 更新表单值
|
|
115
|
+
* @date 2022-05-09
|
|
116
|
+
* @param {FormModel} model
|
|
117
|
+
*/
|
|
118
|
+
const updateFormModel = (model: FormModel) => {
|
|
119
|
+
Object.entries(model).forEach(([key, value]: Array<any>) => formModel[key] = value)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 表单修改
|
|
124
|
+
* @date 2022-04-14
|
|
125
|
+
* @param {any} value 修改值
|
|
126
|
+
* @param {string} prop 修改键名
|
|
127
|
+
*/
|
|
128
|
+
const formChange = (value: any, prop: string) => formModel[prop] = value
|
|
300
129
|
|
|
130
|
+
/**
|
|
131
|
+
* 表单方法调用
|
|
132
|
+
* @date 2022-04-14
|
|
133
|
+
* @param {'submit' | 'cancel' | 'reset' | string} event 方法名(默认方法直接调用;自定义方法回传方法名及表单数据)
|
|
134
|
+
*/
|
|
135
|
+
const formEvent = (event: FormButtonConfig['event']) => {
|
|
136
|
+
const defaultEvent: Record<FormButtonConfig['event'], Function> = { submit, cancel, reset }
|
|
137
|
+
isValidKey(event, defaultEvent)
|
|
138
|
+
? defaultEvent[event]()
|
|
139
|
+
: emit('customEvent', { event, formModel })
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 提交
|
|
143
|
+
const submit = () => {
|
|
144
|
+
const formRef: any = instance?.refs['formRef']
|
|
145
|
+
if (!formRef) return
|
|
146
|
+
formRef.validate((valid: boolean) => {
|
|
147
|
+
valid && emit('submit', formModel)
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 取消
|
|
152
|
+
const cancel = () => {
|
|
153
|
+
emit('cancel', formModel)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 重置
|
|
157
|
+
const reset = () => {
|
|
158
|
+
const formRef: any = instance?.refs['formRef']
|
|
159
|
+
if (!formRef) return
|
|
160
|
+
formRef.resetFields()
|
|
161
|
+
emit('reset', formModel)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 表单元素
|
|
166
|
+
* @date 2022-04-14
|
|
167
|
+
* @param {Array} items 表单项配置
|
|
168
|
+
* @returns {any} 表单项dom
|
|
169
|
+
*/
|
|
170
|
+
const formItemsDom = (items: FormConfig['items'] = []) => {
|
|
171
|
+
const controlDom = (prop: string, controlType: ControlTypes, controlConfig: ControlConfig) => {
|
|
172
|
+
const config: FormModel = { ...controlConfig }
|
|
173
|
+
const event = controlType === ControlTypes['flmInput'] ? 'onInput' : 'onChange'
|
|
174
|
+
config[event] = (value: any) => formChange(value, prop)
|
|
175
|
+
return h(resolveComponent(controlType), { config })
|
|
176
|
+
}
|
|
177
|
+
return items.map((item: FormItemConfig) => {
|
|
178
|
+
if (typeof(item.prop) === 'string') {
|
|
179
|
+
if (isValidKey('isSlot', item)) {
|
|
180
|
+
const { isSlot, ...itemConfig } = item
|
|
181
|
+
return (
|
|
182
|
+
<el-form-item class={`form-${item.prop}`} {...itemConfig}>
|
|
183
|
+
{(slots[item.prop]?.({ prop: item.prop, formModel }))}
|
|
184
|
+
</el-form-item>
|
|
185
|
+
)
|
|
186
|
+
} else {
|
|
187
|
+
const { controlType, controlConfig, ...itemConfig } = item
|
|
188
|
+
if (controlType && controlConfig) {
|
|
189
|
+
return (
|
|
190
|
+
<el-form-item class={`form-${item.prop}`} {...itemConfig}>
|
|
191
|
+
{controlDom(item.prop, controlType, controlConfig)}
|
|
192
|
+
</el-form-item>
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* 表单按钮
|
|
202
|
+
* @date 2022-04-14
|
|
203
|
+
* @param {Array} buttons 表单按钮配置
|
|
204
|
+
* @returns {any} 表单按钮dom
|
|
205
|
+
*/
|
|
206
|
+
const buttonsDom = (buttons: FormConfig['buttons'] = []) => {
|
|
207
|
+
if (buttons.length) {
|
|
208
|
+
return (
|
|
209
|
+
<el-form-item class="form-buttons">
|
|
210
|
+
{buttons.map(({ event, ...config }: FormButtonConfig) =>
|
|
211
|
+
<flm-button config={config} onButtonClick={() => formEvent(event)} />
|
|
212
|
+
)}
|
|
213
|
+
</el-form-item>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
expose({ formModel, reset })
|
|
219
|
+
|
|
220
|
+
// 表单设置
|
|
221
|
+
const formConfig = computed((): FormConfig => filterConfig(formDefaultConfig, props.config))
|
|
222
|
+
const formDom = () => {
|
|
223
|
+
const { items = [], buttons = [], model, ...defaultConfig } = formConfig.value
|
|
224
|
+
return (
|
|
225
|
+
<el-form ref='formRef' {...defaultConfig} model={formModel}>
|
|
226
|
+
{formItemsDom(items)}
|
|
227
|
+
{buttonsDom(buttons)}
|
|
228
|
+
</el-form>
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
return () => (formDom())
|
|
232
|
+
},
|
|
233
|
+
})
|
|
234
|
+
</script>
|
|
301
235
|
<style lang="scss" scoped>
|
|
302
236
|
$columnNumber: v-bind(columnNumber);
|
|
303
237
|
:deep(.el-form-item) {
|
|
@@ -305,4 +239,4 @@ $columnNumber: v-bind(columnNumber);
|
|
|
305
239
|
width: calc((100% - 32px * $columnNumber) / $columnNumber);
|
|
306
240
|
}
|
|
307
241
|
}
|
|
308
|
-
</style>
|
|
242
|
+
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<slot :name="`search-${searchSlot}`" :prop="prop" :formModel="formModel"></slot>
|
|
11
11
|
</template>
|
|
12
12
|
</flmSearch>
|
|
13
|
-
<flmToolbar
|
|
13
|
+
<flmToolbar class="page-toolbar" :config="reportPageConfig.toolbar" @toolbarClick="toolbarClick" />
|
|
14
14
|
<flmTable
|
|
15
15
|
class="page-table"
|
|
16
16
|
:config="reportPageConfig.table"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
69
|
<script lang="ts" setup>
|
|
70
|
-
import { ref, Ref, computed, onMounted
|
|
70
|
+
import { ref, Ref, computed, onMounted } from 'vue'
|
|
71
71
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
72
72
|
import {
|
|
73
73
|
flmForm,
|
|
@@ -76,26 +76,21 @@ import {
|
|
|
76
76
|
flmTable,
|
|
77
77
|
flmPagination,
|
|
78
78
|
flmDialog
|
|
79
|
-
} from '
|
|
79
|
+
} from '@/components'
|
|
80
80
|
import {
|
|
81
81
|
FormItemConfig,
|
|
82
82
|
FormConfig,
|
|
83
83
|
TableColumnConfig,
|
|
84
84
|
ReportPageSetting,
|
|
85
|
-
} from '
|
|
85
|
+
} from '@/model/flmComponentConfig'
|
|
86
86
|
import { isValidKey } from '../../../utils'
|
|
87
87
|
import request from '@/plugins/request'
|
|
88
|
-
import { is } from '@babel/types'
|
|
89
88
|
|
|
90
89
|
const props = defineProps({
|
|
91
90
|
// 表名
|
|
92
91
|
tableName: {
|
|
93
92
|
type: String,
|
|
94
93
|
required: true
|
|
95
|
-
},
|
|
96
|
-
isDialog:{
|
|
97
|
-
type:Boolean,
|
|
98
|
-
default:false,
|
|
99
94
|
}
|
|
100
95
|
})
|
|
101
96
|
|
|
@@ -161,21 +156,14 @@ const queryPageSetting = () => {
|
|
|
161
156
|
const reportPageSetting: ReportPageSetting = items
|
|
162
157
|
reportPageSetting.table['height'] = tableHeight()
|
|
163
158
|
reportPageSetting.table['max-height'] = tableHeight()
|
|
164
|
-
|
|
165
|
-
reportPageSetting.tableAction.buttons.length && reportPageSetting.table.columns?.push({
|
|
159
|
+
reportPageSetting.tableAction.buttons.length && reportPageSetting.table.columns?.push({
|
|
166
160
|
prop: 'tableAction',
|
|
167
161
|
label: '操作',
|
|
168
162
|
isSlot: true,
|
|
169
|
-
align: 'center',
|
|
170
|
-
'header-align':'center',
|
|
171
163
|
fixed: 'right',
|
|
172
|
-
'min-width': '200px'
|
|
173
|
-
'width': '200px'
|
|
164
|
+
'min-width': '200px'
|
|
174
165
|
})
|
|
175
|
-
}
|
|
176
|
-
|
|
177
166
|
reportPageConfig.value = reportPageSetting
|
|
178
|
-
isLoaded.value =true;
|
|
179
167
|
queryPageData()
|
|
180
168
|
})
|
|
181
169
|
}
|
|
@@ -199,6 +187,7 @@ const queryPageData = () => {
|
|
|
199
187
|
.then(({ items, total }: any) => {
|
|
200
188
|
reportPageConfig.value.table.data = items
|
|
201
189
|
reportPageConfig.value.pagination['total'] = total
|
|
190
|
+
isLoaded.value = true
|
|
202
191
|
})
|
|
203
192
|
}
|
|
204
193
|
|
|
@@ -218,15 +207,16 @@ const searchSubmit = (event: object) => {
|
|
|
218
207
|
const toolbarClick = (event: string) => {
|
|
219
208
|
isValidKey(event, pageDefaultEvent)
|
|
220
209
|
? pageDefaultEvent[event]()
|
|
221
|
-
: emit('customEvent',
|
|
210
|
+
: emit('customEvent', event)
|
|
222
211
|
}
|
|
223
212
|
|
|
224
213
|
// 表格操作栏点击
|
|
225
214
|
const tableActionClick = (event: string, scope: any) => {
|
|
226
215
|
isValidKey(event, pageDefaultEvent)
|
|
227
216
|
? pageDefaultEvent[event](scope)
|
|
228
|
-
: emit('customEvent', { event,
|
|
217
|
+
: emit('customEvent', { event, scope })
|
|
229
218
|
}
|
|
219
|
+
|
|
230
220
|
// 表格操作
|
|
231
221
|
const tableEvent: Record<string, (event?: any) => void> = {
|
|
232
222
|
// 表格勾选项变化
|
|
@@ -256,7 +246,7 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
256
246
|
openReadDialog:(scope: any) => {
|
|
257
247
|
request.flameApi.singleSearch({
|
|
258
248
|
tableName: safeTableName.value,
|
|
259
|
-
data: { key: scope.row.flame_id
|
|
249
|
+
data: { key: scope.row.flame_id }
|
|
260
250
|
})
|
|
261
251
|
.then(({ items }: any) => {
|
|
262
252
|
reportPageConfig.value.readForm['model'] = items
|
|
@@ -298,63 +288,6 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
298
288
|
pageDefaultEvent.closeAddDialog()
|
|
299
289
|
})
|
|
300
290
|
},
|
|
301
|
-
// 页面导入
|
|
302
|
-
pageImport:() => {
|
|
303
|
-
const inputFile: any = document.createElement('input')
|
|
304
|
-
inputFile.type = 'file'
|
|
305
|
-
inputFile.style.display = 'none'
|
|
306
|
-
document.body.appendChild(inputFile)
|
|
307
|
-
inputFile.click()
|
|
308
|
-
inputFile.addEventListener('change', () => {
|
|
309
|
-
const file = inputFile.files[0]
|
|
310
|
-
var fileType = file.name.substring(file.name.lastIndexOf('.') + 1)
|
|
311
|
-
if (!['xls', 'xlsx', 'et'].includes(fileType)) {
|
|
312
|
-
ElMessage.warning('请上传 xls、xlsx、et 格式的文件!')
|
|
313
|
-
document.body.removeChild(inputFile)
|
|
314
|
-
return false
|
|
315
|
-
}
|
|
316
|
-
const formData = new FormData()
|
|
317
|
-
formData.append("file", file)
|
|
318
|
-
request.flameAxios({
|
|
319
|
-
headers: { 'Content-Type': 'multipart/form-data' },
|
|
320
|
-
method: 'post',
|
|
321
|
-
url: `/resource-service/upload_file?source=mongo&token=${request.token}`,
|
|
322
|
-
data: formData
|
|
323
|
-
})
|
|
324
|
-
.then(({ key: code }: any) => {
|
|
325
|
-
request.flameRequest({
|
|
326
|
-
tableName: safeTableName.value,
|
|
327
|
-
flameMethod: 'importfile',
|
|
328
|
-
data: { code }
|
|
329
|
-
})
|
|
330
|
-
.then((res: any) => {
|
|
331
|
-
if(res.result){
|
|
332
|
-
ElMessage.success('导入成功!')
|
|
333
|
-
pageRefresh()
|
|
334
|
-
}
|
|
335
|
-
else{
|
|
336
|
-
ElMessage.error(res.message)
|
|
337
|
-
}
|
|
338
|
-
})
|
|
339
|
-
})
|
|
340
|
-
.finally(() => document.body.removeChild(inputFile))
|
|
341
|
-
})
|
|
342
|
-
},
|
|
343
|
-
// 页面导出
|
|
344
|
-
pageExport:() => {
|
|
345
|
-
request.flameApi.exportFile({
|
|
346
|
-
tableName: safeTableName.value,
|
|
347
|
-
data: {
|
|
348
|
-
conditions: searchParams.value,
|
|
349
|
-
ref_level: 1,
|
|
350
|
-
order_by: "flame_id DESC"
|
|
351
|
-
}
|
|
352
|
-
})
|
|
353
|
-
.then(({ items }: any) => {
|
|
354
|
-
window.open(items.download_url)
|
|
355
|
-
ElMessage.success('导出成功')
|
|
356
|
-
})
|
|
357
|
-
},
|
|
358
291
|
// 页面删除
|
|
359
292
|
pageDelete:(scope: any) => {
|
|
360
293
|
ElMessageBox.confirm(
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: 关羽 xiaobing525@163.com
|
|
3
|
-
* @Date: 2023-01-04 22:32:16
|
|
4
|
-
* @LastEditors: 关羽 xiaobing525@163.com
|
|
5
|
-
* @LastEditTime: 2023-01-05 19:54:43
|
|
6
|
-
* @FilePath: /flame-components/packages/model/flmComponentConfig/complex/flmSearch.ts
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/
|
|
9
1
|
import { FormConfig } from '../../../model/flmComponentConfig'
|
|
10
2
|
|
|
11
3
|
export interface SearchConfig extends FormConfig {
|