flame-plus 0.1.23 → 0.1.25
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 +1 -1
- package/packages/components/complex/flmSearch/flmSearch.vue +1 -1
- package/packages/components/page/flmReportPage/flmReportPage.vue +79 -12
- package/packages/model/flmComponentConfig/complex/flmSearch.ts +9 -1
- package/packages/model/flmComponentConfig/page/flmReportPage.ts +10 -1
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
40
|
import { PropType, ref, Ref, computed, ComputedRef } from 'vue'
|
|
41
41
|
import { flmForm } from '../../index'
|
|
42
|
-
import { SearchConfig, FormItemConfig } from '../../../model/flmComponentConfig'
|
|
42
|
+
import { SearchConfig, FormItemConfig ,ButtonType} from '../../../model/flmComponentConfig'
|
|
43
43
|
import { isValidKey } from '../../../utils'
|
|
44
44
|
|
|
45
45
|
const emit = defineEmits(['searchSubmit', 'searchReset', 'searchCustomEvent'])
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<slot :name="`search-${searchSlot}`" :prop="prop" :formModel="formModel"></slot>
|
|
11
11
|
</template>
|
|
12
12
|
</flmSearch>
|
|
13
|
-
<flmToolbar class="page-toolbar" :config="reportPageConfig.toolbar" @toolbarClick="toolbarClick" />
|
|
13
|
+
<flmToolbar v-if="isDialog==false" 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 } from 'vue'
|
|
70
|
+
import { ref, Ref, computed, onMounted,toRaw } from 'vue'
|
|
71
71
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
72
72
|
import {
|
|
73
73
|
flmForm,
|
|
@@ -76,21 +76,26 @@ import {
|
|
|
76
76
|
flmTable,
|
|
77
77
|
flmPagination,
|
|
78
78
|
flmDialog
|
|
79
|
-
} from '
|
|
79
|
+
} from '../../index'
|
|
80
80
|
import {
|
|
81
81
|
FormItemConfig,
|
|
82
82
|
FormConfig,
|
|
83
83
|
TableColumnConfig,
|
|
84
84
|
ReportPageSetting,
|
|
85
|
-
} from '
|
|
86
|
-
import { isValidKey } from '
|
|
85
|
+
} from '../../../model/flmComponentConfig'
|
|
86
|
+
import { isValidKey } from '../../../utils'
|
|
87
87
|
import request from '@/plugins/request'
|
|
88
|
+
import { is } from '@babel/types'
|
|
88
89
|
|
|
89
90
|
const props = defineProps({
|
|
90
91
|
// 表名
|
|
91
92
|
tableName: {
|
|
92
93
|
type: String,
|
|
93
94
|
required: true
|
|
95
|
+
},
|
|
96
|
+
isDialog:{
|
|
97
|
+
type:Boolean,
|
|
98
|
+
default:false,
|
|
94
99
|
}
|
|
95
100
|
})
|
|
96
101
|
|
|
@@ -156,14 +161,21 @@ const queryPageSetting = () => {
|
|
|
156
161
|
const reportPageSetting: ReportPageSetting = items
|
|
157
162
|
reportPageSetting.table['height'] = tableHeight()
|
|
158
163
|
reportPageSetting.table['max-height'] = tableHeight()
|
|
159
|
-
|
|
164
|
+
if(props.isDialog==false) {
|
|
165
|
+
reportPageSetting.tableAction.buttons.length && reportPageSetting.table.columns?.push({
|
|
160
166
|
prop: 'tableAction',
|
|
161
167
|
label: '操作',
|
|
162
168
|
isSlot: true,
|
|
169
|
+
align: 'center',
|
|
170
|
+
'header-align':'center',
|
|
163
171
|
fixed: 'right',
|
|
164
|
-
'min-width': '200px'
|
|
172
|
+
'min-width': '200px',
|
|
173
|
+
'width': '200px'
|
|
165
174
|
})
|
|
175
|
+
}
|
|
176
|
+
|
|
166
177
|
reportPageConfig.value = reportPageSetting
|
|
178
|
+
isLoaded.value =true;
|
|
167
179
|
queryPageData()
|
|
168
180
|
})
|
|
169
181
|
}
|
|
@@ -187,7 +199,6 @@ const queryPageData = () => {
|
|
|
187
199
|
.then(({ items, total }: any) => {
|
|
188
200
|
reportPageConfig.value.table.data = items
|
|
189
201
|
reportPageConfig.value.pagination['total'] = total
|
|
190
|
-
isLoaded.value = true
|
|
191
202
|
})
|
|
192
203
|
}
|
|
193
204
|
|
|
@@ -207,16 +218,15 @@ const searchSubmit = (event: object) => {
|
|
|
207
218
|
const toolbarClick = (event: string) => {
|
|
208
219
|
isValidKey(event, pageDefaultEvent)
|
|
209
220
|
? pageDefaultEvent[event]()
|
|
210
|
-
: emit('customEvent', event)
|
|
221
|
+
: emit('customEvent', {event,data:{}})
|
|
211
222
|
}
|
|
212
223
|
|
|
213
224
|
// 表格操作栏点击
|
|
214
225
|
const tableActionClick = (event: string, scope: any) => {
|
|
215
226
|
isValidKey(event, pageDefaultEvent)
|
|
216
227
|
? pageDefaultEvent[event](scope)
|
|
217
|
-
: emit('customEvent', { event,
|
|
228
|
+
: emit('customEvent', { event,data: toRaw(scope.row) })
|
|
218
229
|
}
|
|
219
|
-
|
|
220
230
|
// 表格操作
|
|
221
231
|
const tableEvent: Record<string, (event?: any) => void> = {
|
|
222
232
|
// 表格勾选项变化
|
|
@@ -246,7 +256,7 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
246
256
|
openReadDialog:(scope: any) => {
|
|
247
257
|
request.flameApi.singleSearch({
|
|
248
258
|
tableName: safeTableName.value,
|
|
249
|
-
data: { key: scope.row.flame_id }
|
|
259
|
+
data: { key: scope.row.flame_id ,ref_level:1}
|
|
250
260
|
})
|
|
251
261
|
.then(({ items }: any) => {
|
|
252
262
|
reportPageConfig.value.readForm['model'] = items
|
|
@@ -288,6 +298,63 @@ const pageDefaultEvent: Record<string, (event?: any) => void> = {
|
|
|
288
298
|
pageDefaultEvent.closeAddDialog()
|
|
289
299
|
})
|
|
290
300
|
},
|
|
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
|
+
},
|
|
291
358
|
// 页面删除
|
|
292
359
|
pageDelete:(scope: any) => {
|
|
293
360
|
ElMessageBox.confirm(
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
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
|
+
import { FormConfig } from '../../../model/flmComponentConfig'
|
|
2
10
|
|
|
3
11
|
export interface SearchConfig extends FormConfig {
|
|
4
12
|
maxFormItem?: number
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 关羽 xiaobing525@163.com
|
|
3
|
+
* @Date: 2023-01-04 22:32:16
|
|
4
|
+
* @LastEditors: 关羽 xiaobing525@163.com
|
|
5
|
+
* @LastEditTime: 2023-01-11 21:37:39
|
|
6
|
+
* @FilePath: /flame-components/packages/model/flmComponentConfig/page/flmReportPage.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
1
9
|
import {
|
|
2
10
|
FormConfig,
|
|
11
|
+
SearchConfig,
|
|
3
12
|
ToolbarConfig,
|
|
4
13
|
TableConfig,
|
|
5
14
|
PaginationConfig,
|
|
@@ -8,7 +17,7 @@ import {
|
|
|
8
17
|
|
|
9
18
|
// 报表页面设置
|
|
10
19
|
export interface ReportPageSetting {
|
|
11
|
-
'search':
|
|
20
|
+
'search': SearchConfig
|
|
12
21
|
'toolbar': ToolbarConfig
|
|
13
22
|
'table': TableConfig
|
|
14
23
|
'tableAction': ToolbarConfig
|