vue2-client 1.14.63 → 1.14.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.env.message +19 -19
  2. package/.history/public/his/editor/editor_20250606134713.html +51 -0
  3. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +509 -0
  4. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +524 -0
  5. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +524 -0
  6. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +524 -0
  7. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +1320 -0
  8. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +1332 -0
  9. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +1331 -0
  10. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +1331 -0
  11. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +1331 -0
  12. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +1339 -0
  13. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +36 -0
  14. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +1 -0
  15. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -1
  16. package/package.json +109 -109
  17. package/src/base-client/components/TreeList/TreeList.vue +91 -0
  18. package/src/base-client/components/TreeList/TreeNode.vue +81 -0
  19. package/src/base-client/components/common/XCardSet/XTiltle.vue +191 -0
  20. package/src/base-client/components/common/XFormTable/XFormTable.vue +895 -895
  21. package/src/base-client/components/common/XFormTable/demo.vue +86 -86
  22. package/src/base-client/components/common/XTable/XTable.vue +1564 -1564
  23. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  24. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  25. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  26. package/src/base-client/components/his/threeTestOrders/dome.vue +53 -2
  27. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  28. package/src/base-client/components/his/threeTestOrders/index.md +0 -0
  29. package/src/base-client/components/his/threeTestOrders/textBox.vue +457 -463
  30. package/src/base-client/components/his/threeTestOrders/threeTestOrders.vue +55 -19
  31. package/src/utils/routerUtil.js +3 -0
  32. package/vue.config.js +220 -220
@@ -1,1564 +1,1564 @@
1
- <template>
2
- <div v-show="tableColumns.length > 0">
3
- <a-row :gutter="48">
4
- <a-col v-show="showLeftOperaBtn">
5
- <span :style="{ float: 'left', marginBottom: '8px' }">
6
- <a-space>
7
- <!-- <a-button v-if="eventState.customDelete" type="primary" @click="custom('customDelete')">-->
8
- <!-- <a-icon type="delete"/>删除-->
9
- <!-- </a-button>-->
10
- <!-- <a-button v-if="eventState.customSave" type="primary" @click="custom('customSave')">-->
11
- <!-- <a-icon type="save"/>保存-->
12
- <!-- </a-button>-->
13
- <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
14
- <a-button v-if="buttonState.add && buttonRendering('add')" type="primary" @click="add">
15
- <a-icon type="plus"/>新增
16
- </a-button>
17
- <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
18
- <a-icon type="plus"/>添加
19
- </a-button>
20
- <a-button
21
- v-if="buttonState.choose && buttonRendering('choose')"
22
- :disabled="!isChoose"
23
- type="primary"
24
- @click="choose">
25
- <a-icon type="check-square"/>选择
26
- </a-button>
27
- <a-button
28
- v-if="buttonState.edit && buttonRendering('edit')"
29
- :disabled="!isModify"
30
- :loading="editLoading"
31
- class="btn-success"
32
- type="dashed"
33
- @click="edit()">
34
- <a-icon :style="iconStyle" type="form"/>修改
35
- </a-button>
36
- <template
37
- v-if="buttonState.editRow && buttonRendering('editRow')">
38
- <a-button
39
- v-if="isEditMode"
40
- class="ant-btn-hover"
41
- @click="editRowSave">
42
- <a-icon :style="iconStyle" type="save"/>保存
43
- </a-button>
44
- <a-button
45
- v-else
46
- @click="openEditMode">
47
- <a-icon :style="iconStyle" type="edit"/>行编辑
48
- </a-button>
49
- </template>
50
- <a-button
51
- v-if="buttonState.delete && buttonRendering('delete')"
52
- :disabled="!isDelete"
53
- type="danger"
54
- @click="deleteItem">
55
- <a-icon :style="iconStyle" type="delete"/>删除
56
- </a-button>
57
- <a-button
58
- v-if="buttonState.import && buttonRendering('import')"
59
- type="dashed"
60
- @click="importData">
61
- <a-icon :style="iconStyle" type="import"/>导入
62
- </a-button>
63
- <a-dropdown v-if="!buttonState || buttonState.export && buttonRendering('export')">
64
- <a-menu slot="overlay">
65
- <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handleExport('selected')"><a-icon
66
- :style="iconStyle"
67
- type="ordered-list"/>导出选中数据</a-menu-item>
68
- <a-menu-item key="2" @click="handleExport('curPage')"><a-icon :style="iconStyle" type="snippets"/>导出本页数据</a-menu-item>
69
- <a-menu-item key="3" @click="handleExport('exportByQuery')"><a-icon :style="iconStyle" type="download"/>导出所有符合条件的数据</a-menu-item>
70
- </a-menu>
71
- <a-button>导出 <a-icon type="down" :style="iconStyle"/> </a-button>
72
- </a-dropdown>
73
- <a-dropdown v-if="!buttonState || buttonState.print && buttonRendering('print')">
74
- <a-menu slot="overlay">
75
- <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handlePrint('selected')"><a-icon
76
- :style="iconStyle"
77
- type="ordered-list"/>打印选中数据</a-menu-item>
78
- <a-menu-item key="2" @click="handlePrint('curPage')"><a-icon :style="iconStyle" type="snippets"/>打印本页数据</a-menu-item>
79
- <a-menu-item key="3" @click="handlePrint('exportByQuery')"><a-icon :style="iconStyle" type="download"/>打印所有符合条件的数据</a-menu-item>
80
- </a-menu>
81
- <a-button>打印 <a-icon type="printer" :style="iconStyle"/> </a-button>
82
- </a-dropdown>
83
- <!-- 遍历按钮配置数组,动态生成按钮 -->
84
- <a-button
85
- v-for="(button, index) in editButtonStateData"
86
- :key="index"
87
- :type="button.type || 'dashed'"
88
- @click="editButtonStateDataClick(index)"
89
- class="btn-success"
90
- >
91
- <a-icon type="dashed" :style="iconStyle"/>
92
- {{ button.buttonName }}
93
- </a-button>
94
- <a-button
95
- v-if="allowedCardMode && !simpleMode"
96
- @click="changeViewMode"
97
- :type="isTableMode ? '' : 'primary'">
98
- 看板模式
99
- </a-button>
100
- <a-badge
101
- v-if="selectRowMode === 'listView'"
102
- :count="selectedRows.length"
103
- :number-style="{ backgroundColor:theme.color }"
104
- >
105
- <a-button
106
- type="dashed"
107
- @click="showTempData">
108
- <a-icon :style="iconStyle" type="monitor"/>已选择
109
- </a-button>
110
- </a-badge>
111
- <!-- 头部附加栅格 -->
112
- <x-report
113
- v-if="attachGrid"
114
- :env="env"
115
- :isWidget="true"
116
- :use-oss-for-img="false"
117
- :config-name="attachGrid"
118
- :show-img-in-cell="true"
119
- :display-only="true"
120
- :edit-mode="false"
121
- :show-save-button="false"
122
- :dont-format="true"/>
123
-
124
- <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
125
- </a-space>
126
-
127
- </span>
128
- </a-col>
129
- <a-col v-show="showRightTools && !simpleMode">
130
- <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
131
- <a-button-group>
132
- <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
133
- <a-tooltip title="汇总" placement="bottom">
134
- <a-button @click="showDrawer">
135
- <a-icon :style="iconStyle" type="project"/>
136
- </a-button>
137
- </a-tooltip>
138
- <a-tooltip title="重新查询" placement="bottom">
139
- <a-button @click="refresh(true)">
140
- <a-icon :style="iconStyle" type="reload"/>
141
- </a-button>
142
- </a-tooltip>
143
- <a-tooltip title="列展示/排序" placement="bottom">
144
- <table-setting v-if="columnSelectLoaded" v-model="tableColumns"/>
145
- </a-tooltip>
146
- </a-button-group>
147
- </span>
148
- </a-col>
149
- </a-row>
150
- <!-- 如果当前是表格模式 -->
151
- <template v-if="isTableMode">
152
- <x-table-wrapper
153
- ref="table"
154
- @rowClick="handleRowClick"
155
- @beforeDataChange="beforeDataChange"
156
- @expand="onExpand">
157
- <template slot="expandedRowRender">
158
- <!-- 列扩展栅格 -->
159
- <x-report
160
- v-if="expandedGrid"
161
- :env="env"
162
- ref="report"
163
- :isWidget="true"
164
- :use-oss-for-img="false"
165
- :config-name="expandedGrid"
166
- :show-img-in-cell="true"
167
- :display-only="true"
168
- :edit-mode="false"
169
- :show-save-button="false"
170
- :dont-format="true"/>
171
- </template>
172
- <template slot="footer">
173
- <slot
174
- name="footer"
175
- :selectedRowKeys="selectedRowKeys"
176
- :selectedRows="selectedRows"></slot>
177
- </template>
178
- </x-table-wrapper>
179
- </template>
180
- <!-- 如果当前是看板模式 -->
181
- <template v-else>
182
- <XDataCard
183
- ref="table"
184
- @cardEmit="handleCardEmit"
185
- :tableColumns="tableColumns"
186
- :card-config="cardModeConfig"
187
- :show-pagination="!simpleMode"
188
- :prePageSize="simpleMode ? 1000 : undefined"
189
- :serviceName="serviceName"
190
- :card-data="loadData"
191
- :env="env"
192
- :createdQuery="createdQuery"
193
- :simple-mode="simpleMode"/>
194
- </template>
195
- <!-- 上传文件 -->
196
- <a-drawer
197
- title="汇总信息"
198
- placement="right"
199
- :closable="false"
200
- :visible="summaryDrawerVisible"
201
- :z-index="2000"
202
- :width="`${summaryDrawerWidth}vw`"
203
- :after-visible-change="afterVisibleChange"
204
- @close="onClose"
205
- >
206
- <template>
207
- <a-row>
208
- <a-col :span="8" v-for="(f,index) in summaryData" :key="index">
209
- <a-statistic
210
- :title="f.title + ':'"
211
- :value="f.value"
212
- :precision="2">
213
- <template #prefix>
214
- <a-spin :spinning="f.loading">
215
- </a-spin>
216
- </template>
217
- <template #suffix>
218
- <a-icon
219
- v-show="!f.loading"
220
- :type="f.success !== false ? 'check-circle' : 'close-circle'"
221
- :style="{color: f.success !== false ? 'green' : 'red'}"/>
222
- </template>
223
- </a-statistic>
224
- </a-col>
225
- <a-col
226
- :span="item.span"
227
- v-for="(item,index) in chartsConfigArray"
228
- :key="index"
229
- style="height: 20rem; margin-bottom: 3rem">
230
- <div class="custom-chart-title" v-if="item.config.title">{{ item.config.title }}</div>
231
- <div class="custom-chart-desc" v-if="item.config.description">{{ item.config.description }}</div>
232
- <g2Charts
233
- :key="index"
234
- :chatsKey="index"
235
- :is-dev="env === 'dev'"
236
- :config="item.config"
237
- :requestParameters="requestParameters"/>
238
- </a-col>
239
- </a-row>
240
- </template>
241
- </a-drawer>
242
- <x-import-excel
243
- ref="importExcel"
244
- @ok="importExcelOk"
245
- :title="title"
246
- :service-name="serviceName"
247
- :env="env"
248
- :query-params-name="queryParamsName"
249
- >
250
- <template #importExcelSlot>
251
- <slot name="importExcelSlot"></slot>
252
- </template>
253
- </x-import-excel>
254
- <ExportExcel
255
- ref="exportExcel"
256
- />
257
- <a-modal @cancel="$refs.table.refresh()" v-model="selectedRowModalVisible" width="80vw" title="已选中数据" :footer="null">
258
- <x-table-wrapper
259
- ref="selectedDataTable"
260
- :load-selected-data="true"
261
- @beforeDataChange="beforeDataChange"
262
- @rowClick="handleRowClick">
263
- </x-table-wrapper>
264
- </a-modal>
265
- </div>
266
- </template>
267
- <script>
268
- import { STable } from '@vue2-client/components'
269
- import { getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
270
- import * as util from '@vue2-client/utils/util'
271
- import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
272
- import {
273
- query,
274
- querySummary,
275
- queryWithResource,
276
- remove,
277
- getConfigByNameAsync,
278
- editRowSave,
279
- runLogic
280
- } from '@vue2-client/services/api/common'
281
- import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
282
- import { Modal } from 'ant-design-vue'
283
- import { mapState } from 'vuex'
284
- import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
285
- import debounce from 'lodash.debounce'
286
- import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
287
- import { getRealKeyData } from '@vue2-client/utils/formatter'
288
- import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
289
- import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
290
- import ExportExcel from '@vue2-client/base-client/components/common/XTable/ExportExcel.vue'
291
- import g2Charts from '@vue2-client/components/g2Charts/index.vue'
292
- import moment from 'moment/moment'
293
- import XTableWrapper from './XTableWrapper.vue'
294
-
295
- export default {
296
- name: 'XTable',
297
- components: {
298
- ExportExcel,
299
- CustomFuncCel,
300
- XDataCard,
301
- TableSetting,
302
- STable,
303
- XImportExcel,
304
- g2Charts,
305
- XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
306
- ReportTableHome,
307
- XTableWrapper
308
- },
309
- inject: ['getSelf'],
310
- provide () {
311
- return {
312
- tableContext: this
313
- }
314
- },
315
- data () {
316
- return {
317
- uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
318
- // 筛选列加载状态
319
- columnSelectLoaded: false,
320
- // 预览模式
321
- viewMode: false,
322
- // 本地编辑模式
323
- localEditMode: false,
324
- // 本地编辑表单提交方式
325
- formSubmitTypeInLocalEditMode: 'cover',
326
- // 本地编辑模式所用数据源
327
- localEditModeDataSource: [],
328
- // 本地编辑模式数据源是否已由外部加载
329
- isLocalDataSourceLoadedExternally: false,
330
- // 行选择模式
331
- rowSelectMode: false,
332
- // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
333
- allowSelectRowNum: 0,
334
- // 头部附件的栅格配置名
335
- attachGrid: '',
336
- // 表格行扩展区域的栅格配置名
337
- expandedGrid: '',
338
- // 是否展示右侧工具栏
339
- showRightTools: true,
340
- // 是否展示左边按钮栏
341
- showLeftOperaBtn: true,
342
- // 加载数据方法 必须为 Promise 对象
343
- loadData: parameter => {
344
- // 取到表格携带的表单参数
345
- const requestParameters = Object.assign({}, parameter)
346
- // 取到父组件传入的表单参数
347
- const conditionParams = {}
348
- Object.assign(conditionParams, this.fixedQueryForm)
349
- Object.assign(conditionParams, this.form)
350
- // 如果传了燃气公司字段,则进行数据处理
351
- if (conditionParams.orgName) {
352
- requestParameters.orgName = conditionParams.orgName
353
- delete conditionParams.orgName
354
- }
355
- Object.keys(conditionParams).forEach(key => {
356
- if (Array.isArray(conditionParams[key])) {
357
- // 检查数组中是否包含 null
358
- const hasNull = conditionParams[key].every(item => item === '') || conditionParams[key].length === 0
359
- // 如果包含 null,则删除该属性
360
- if (hasNull) {
361
- delete conditionParams[key]
362
- }
363
- }
364
- })
365
- requestParameters.conditionParams = conditionParams
366
- requestParameters.queryParamsName = this.queryParamsName
367
- requestParameters.queryParams = this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined
368
- this.requestParameters = requestParameters
369
- // 加载数据
370
- return this.loadTableData(requestParameters)
371
- },
372
- requestParameters: {},
373
- rowKey: undefined,
374
- // x滚动条宽度
375
- scrollXWidth: 1600,
376
- // y滚动条高度
377
- scrollYHeight: 'calc(100vh - 31rem)',
378
- // 表格选择列Key集合
379
- selectedRowKeys: [],
380
- // 表格选择Row集合
381
- selectedRows: [],
382
- // 表格选择列Key集合
383
- innerSelectedRowKeys: [],
384
- // 表格选择Row集合
385
- innerSelectedRows: [],
386
- // 禁止表格选择Row集合
387
- selectedDisableRows: [],
388
- // 业务标题
389
- title: '',
390
- // 数据列
391
- tableColumns: [],
392
- // 查询用表单
393
- form: {},
394
- oldForm: {},
395
- // 是否允许修改
396
- isModify: false,
397
- // 是否允许删除
398
- isDelete: false,
399
- // 是否允许选择
400
- isChoose: false,
401
- // 选中用于修改的id
402
- selectId: undefined,
403
- // 是否显示展示列抽屉
404
- visible: false,
405
- // 编辑按钮加载状态
406
- editLoading: false,
407
- // 按钮状态
408
- buttonState: {},
409
- // eventBtnState
410
- eventState: {},
411
- // 自定义按钮数组
412
- editButtonStateData: [],
413
- // 按钮权限
414
- buttonPermissions: [],
415
- // 是否展示汇总
416
- showSummary: false,
417
- // 自定义汇总
418
- showCustomSummary: false,
419
- summaryData: [],
420
- // 图标样式
421
- iconStyle: {
422
- position: 'relative',
423
- top: '1px'
424
- },
425
- // 当前环境
426
- env: 'prod',
427
- // 预览模式(表格 or 看板)
428
- isTableMode: true,
429
- // 汇总抽屉是否显示
430
- summaryDrawerVisible: false,
431
- // 汇总更新标志
432
- summaryUpdate: false,
433
- customSummaryArray: [],
434
- formItems: [],
435
- // 是否为行编辑模式
436
- isEditMode: false,
437
- // 定义主键
438
- primaryKey: '',
439
- // 是否进行初始化查询
440
- createdQuery: false,
441
- // 允许看板模式
442
- allowedCardMode: false,
443
- // 看板模式配置
444
- cardModeConfig: undefined,
445
- // 暂存行编辑前数据 用于比较哪些变化了才需要保存
446
- editRowBeforeData: [],
447
- // 是否简易模式
448
- simpleMode: false,
449
- // crud打印模板配置
450
- printTemplate: false,
451
- queryParams: {},
452
- // 定义总行数
453
- totalCount: 0,
454
- user: {},
455
- chartsConfigArray: [],
456
- summaryDrawerWidth: 35,
457
- // 行选择模式
458
- selectRowMode: 'default',
459
- tableSize: 'default',
460
- clearSelectRowAfterQuery: false,
461
- selectedRowModalVisible: false
462
- }
463
- },
464
- props: {
465
- // 查询配置文件名
466
- queryParamsName: {
467
- type: String,
468
- default: () => {
469
- return ''
470
- }
471
- },
472
- // 查询配置文件名
473
- serviceName: {
474
- type: String,
475
- default: () => {
476
- return ''
477
- }
478
- },
479
- // 查询配置文件Json
480
- queryParamsJson: {
481
- type: Object,
482
- default: null
483
- },
484
- // 固定查询表单
485
- fixedQueryForm: {
486
- type: Object,
487
- default: () => {
488
- return {}
489
- }
490
- },
491
- // 数据只有一页时是否展示分页,true:展示,auto:隐藏
492
- showPagination: {
493
- type: Boolean,
494
- default: true
495
- },
496
- // 是否自定义删除功能
497
- customDelete: {
498
- type: Boolean,
499
- default: false
500
- },
501
- // 自适应底部边距
502
- extraHeight: {
503
- type: Number,
504
- default: 80
505
- },
506
- pageMaxSize: {
507
- type: Number,
508
- default: null
509
- },
510
- // 外部传入的选中行keys
511
- externalSelectedRowKeys: {
512
- type: Array,
513
- default: () => []
514
- }
515
- },
516
- computed: {
517
- ...mapState('setting', ['theme']),
518
- rowSelection () {
519
- return this.selectRowMode === 'disabled' ? undefined : {
520
- selectedRowKeys: this.innerSelectedRowKeys,
521
- onChange: this.onSelectChange,
522
- onSelect: this.selectRowMode === 'listView' ? this.onSelect : undefined,
523
- onSelectAll: this.selectRowMode === 'listView' ? this.onSelectAll : undefined,
524
- getCheckboxProps: record => ({
525
- props: {
526
- disabled: this.selectedDisableRows.includes(record[this.rowKey]), // Column configuration not to be checked
527
- name: record.name,
528
- },
529
- }),
530
- }
531
- },
532
- ...mapState('account', { currUser: 'user' }),
533
- ...mapState('setting', ['compatible'])
534
- },
535
- watch: {
536
- pageMaxSize: {
537
- handler (val) {
538
- if (this.tableContext) {
539
- this.tableContext.pageMaxSize = val
540
- }
541
- },
542
- immediate: true
543
- },
544
- externalSelectedRowKeys: {
545
- handler (newVal) {
546
- // 如果新值和当前值相同,则不处理
547
- if (JSON.stringify(newVal) === JSON.stringify(this.selectedRowKeys)) {
548
- return
549
- }
550
- if (newVal && newVal.length > 0) {
551
- this.$nextTick(() => {
552
- this.updateTableSelection(newVal)
553
- })
554
- }
555
- }
556
- }
557
- },
558
- mounted () {
559
- window.addEventListener('resize', this.handleResize)
560
- // 初始化时如果有外部选中值,等待 table 准备好后设置
561
- if (this.externalSelectedRowKeys && this.externalSelectedRowKeys.length > 0) {
562
- this.$nextTick(() => {
563
- this.updateTableSelection(this.externalSelectedRowKeys)
564
- })
565
- }
566
- },
567
- beforeDestroy () {
568
- // 销毁页面查询定时器
569
- if (this.queryTimer) {
570
- clearInterval(this.queryTimer)
571
- }
572
- window.removeEventListener('resize', this.handleResize)
573
- },
574
- methods: {
575
- showTempData () {
576
- this.selectedRowModalVisible = true
577
- this.$nextTick(() => {
578
- if (this.$refs.selectedDataTable) {
579
- // 确保数据已经准备好
580
- const selectedData = this.selectedRows.map(row => ({ ...row }))
581
- this.$refs.selectedDataTable.refresh(true)
582
- // 等待数据加载完成后再更新选中状态
583
- setTimeout(() => {
584
- if (this.$refs.selectedDataTable) {
585
- this.$refs.selectedDataTable.updateSelect(
586
- selectedData.map(row => row[this.primaryKey || this.rowKey]),
587
- selectedData
588
- )
589
- }
590
- }, 100)
591
- }
592
- })
593
- },
594
- customFunctionShow (customFunction, record, cIndex) {
595
- return executeStrFunctionByContext(this, customFunction, [record, cIndex])
596
- },
597
- getConfigByNameAsync,
598
- runLogic,
599
- executeStrFunctionByContext,
600
- columnClick (key, value, record) {
601
- this.$emit('columnClick', key, value, record)
602
- },
603
- gotoUserDetail (key, value, record) {
604
- this.$emit('gotoUserDetail', key, value, record)
605
- },
606
- // 打开行编辑
607
- openEditMode () {
608
- this.isEditMode = true
609
- this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
610
- },
611
- // 标记行保存
612
- editRowSave () {
613
- // 获取最新数据
614
- const editRowAfterData = this.getTableData()
615
- const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
616
- if (this.eventState?.customSave) {
617
- this.custom('customSave', {
618
- tableData: editRowAfterData,
619
- changeData
620
- })
621
- return
622
- }
623
- if (changeData.length === 0) {
624
- this.$message.info('没有数据发生变化')
625
- } else {
626
- Modal.confirm({
627
- title: '是否确认保存?',
628
- content: `此操作将保存当前行编辑的数据,共修改${changeData.length}条数据`,
629
- zIndex: 1001,
630
- onOk: () => {
631
- return new Promise((resolve, reject) => {
632
- const requestParameters = {
633
- queryParamsName: this.queryParamsName,
634
- changeData: changeData.map(h => getRealKeyData(h)),
635
- operaInfo: this.currUser.operaInfo
636
- }
637
- editRowSave(requestParameters, this.serviceName, this.env === 'dev').then(res => {
638
- this.$message.success('行内数据保存成功')
639
- this.isEditMode = false
640
- this.refresh()
641
- resolve(res)
642
- }).catch(e => {
643
- reject(e)
644
- this.$message.error('保存失败!')
645
- })
646
- })
647
- },
648
- onCancel () {
649
- }
650
- })
651
- }
652
- },
653
- importExcelOk (data) {
654
- this.refresh(true)
655
- this.$emit('importExcelOk', data)
656
- },
657
- /**
658
- * 行选择事件
659
- * @param row 选中行集合
660
- * @param attr 表单项属性
661
- */
662
- async rowChoose (row, attr, callback, record) {
663
- // 如果配置了自定义函数
664
- if (attr.dataChangeFunc) {
665
- await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
666
- ...attr,
667
- selectRows: row
668
- }, util, this.getSelf(), this.mode, runLogic, getConfigByNameAsync])
669
- } else {
670
- // 默认填充选中行数据到当前表单
671
- setDataByRealKey(record, row[0])
672
- }
673
- if (callback) {
674
- callback()
675
- }
676
- },
677
- setForm (record, obj) {
678
- Object.assign(record, obj)
679
- this.$forceUpdate()
680
- },
681
- handleResize () {
682
- debounce(() => {
683
- this.setScrollYHeight({})
684
- }, 100)()
685
- },
686
- isInAModal () {
687
- let parent = this.$parent
688
- while (parent) {
689
- // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
690
- if (parent.$options.name === 'AModal') {
691
- return true
692
- }
693
- parent = parent.$parent
694
- }
695
- return false
696
- },
697
- executeStrFunction,
698
- // 切换看板模式和表格模式
699
- changeViewMode () {
700
- this.isTableMode = !this.isTableMode
701
- // 看板切换回表格模式 刷新列表
702
- this.refresh(true)
703
- },
704
- /**
705
- * 初始化表格参数
706
- */
707
- init (params) {
708
- const {
709
- // 查询参数对象, 用于没有对应查询配置文件名时
710
- queryParams,
711
- tableColumns,
712
- attachGrid,
713
- expandedGrid,
714
- buttonState,
715
- eventState = {},
716
- buttonPermissions,
717
- editButtonStateData = [],
718
- title,
719
- form,
720
- tableSummaryMap = {},
721
- customTableSummaryArray = [],
722
- viewMode,
723
- localEditMode,
724
- formSubmitTypeInLocalEditMode = 'cover',
725
- rowSelectMode,
726
- allowSelectRowNum = 0,
727
- formItems,
728
- env = 'prod',
729
- createdQuery = true,
730
- createdEditMode = false,
731
- primaryKey,
732
- allowedCardMode = false,
733
- simpleMode = false,
734
- showRightTools = true,
735
- cardModeConfig,
736
- summaryUpdate,
737
- summaryDrawerWidth = 35,
738
- chartsConfigArray = [],
739
- printTemplate = 'DEFAULT_CRUD_PRINT_TEMPLATE',
740
- selectRowMode = 'default',
741
- tableSize = 'default',
742
- clearSelectRowAfterQuery = false
743
- } = params
744
- this.showSummary = Object.keys(tableSummaryMap).length > 0
745
- if (this.showSummary) {
746
- Object.keys(tableSummaryMap).forEach(item => {
747
- this.summaryData.push({
748
- key: item,
749
- title: tableSummaryMap[item],
750
- value: ' ',
751
- loading: true,
752
- success: false
753
- })
754
- })
755
- }
756
- if (customTableSummaryArray.length > 0) {
757
- customTableSummaryArray.forEach(item => {
758
- this.summaryData.push({
759
- key: item.key,
760
- title: item.title,
761
- value: ' ',
762
- loading: true,
763
- success: false
764
- })
765
- })
766
- this.showCustomSummary = true
767
- this.customSummaryArray = customTableSummaryArray
768
- }
769
- this.queryParams = queryParams
770
- this.tableColumns = JSON.parse(JSON.stringify(tableColumns))
771
- if (this.tableColumns.length === 0) {
772
- return
773
- }
774
- this.attachGrid = attachGrid
775
- this.expandedGrid = expandedGrid
776
- this.viewMode = viewMode
777
- this.localEditMode = localEditMode
778
- this.formSubmitTypeInLocalEditMode = formSubmitTypeInLocalEditMode
779
- this.rowSelectMode = rowSelectMode
780
- this.allowSelectRowNum = allowSelectRowNum
781
- this.simpleMode = simpleMode
782
- this.formItems = formItems
783
- this.user = this.currUser
784
- this.createdQuery = createdQuery
785
- this.primaryKey = primaryKey
786
- this.buttonState = buttonState
787
- this.eventState = eventState
788
- this.showRightTools = showRightTools
789
- this.printTemplate = printTemplate
790
- this.summaryDrawerWidth = summaryDrawerWidth
791
- this.chartsConfigArray = chartsConfigArray
792
- this.selectRowMode = selectRowMode
793
- this.tableSize = tableSize
794
- this.clearSelectRowAfterQuery = clearSelectRowAfterQuery
795
- if (this.chartsConfigArray.length > 0) {
796
- // 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
797
- this.chartsConfigArray.forEach(item => {
798
- item.config.queryParams = JSON.parse(JSON.stringify(this.queryParams))
799
- item.config.queryParamsName = this.queryParamsName
800
- })
801
- }
802
- if (this.localEditMode) {
803
- this.localEditModeDataSource = []
804
- if (this.formSubmitTypeInLocalEditMode === 'append') {
805
- this.isLocalDataSourceLoadedExternally = true
806
- const defaultItem = {}
807
- defaultItem['序号'] = 0
808
- this.localEditModeDataSource.push(defaultItem)
809
- } else {
810
- this.isLocalDataSourceLoadedExternally = false
811
- }
812
- this.buttonState.import = false
813
- this.buttonState.export = false
814
- this.showRightTools = false
815
- }
816
- if (this.rowSelectMode) {
817
- this.buttonState = {
818
- choose: true
819
- }
820
- this.showRightTools = false
821
- }
822
- this.buttonPermissions = buttonPermissions
823
- this.editButtonStateData = editButtonStateData
824
- this.title = title
825
- this.env = env
826
- this.rowKey = this.getPrimaryKeyName()
827
- this.allowedCardMode = allowedCardMode
828
- this.cardModeConfig = cardModeConfig
829
- this.summaryUpdate = summaryUpdate
830
- this.isEditMode = createdEditMode
831
- let totalWidth = 0
832
- for (let i = 0; i < this.tableColumns.length; i++) {
833
- const item = this.tableColumns[i]
834
- // 设置操作列
835
- if (item.slotType === 'action') {
836
- item.fixed = 'right'
837
- item.width = 70
838
- }
839
- // 设置表格宽度
840
- if (item.width) {
841
- totalWidth = totalWidth + item.width
842
- } else {
843
- totalWidth = totalWidth + 180
844
- }
845
- }
846
- // 横向滚动长度大于所有宽度,才能实现固定表头
847
- this.scrollXWidth = totalWidth
848
- // 加载筛选列完成
849
- this.columnSelectLoaded = true
850
- this.setQueryForm(form || {})
851
- // 简易模式,并且是看板模式,默认直接进入看板模式
852
- if (this.allowedCardMode && this.simpleMode) {
853
- this.isTableMode = false
854
- }
855
- if (params.queryInterval) {
856
- this.queryTimer = setInterval(() => {
857
- this.refresh()
858
- }, params.queryInterval * 1000)
859
- }
860
- },
861
- // 操作面板按钮渲染
862
- buttonRendering (button) {
863
- if (!this.buttonPermissions) {
864
- return true
865
- }
866
- try {
867
- const existingItem = this.buttonPermissions.find(item => item.btnName === button)
868
- const rolestr = this.currUser.rolestr?.split(',')
869
- if (existingItem?.state) {
870
- const currUserRole = existingItem.roleStr
871
- return rolestr.some(item => currUserRole && currUserRole.includes(item))
872
- } else {
873
- return true
874
- }
875
- } catch (e) {
876
- console.error(e)
877
- return false
878
- }
879
- },
880
- // 防止查询多次点击处理
881
- loadTableData (requestParameters) {
882
- if (this.queryPromise) {
883
- return this.queryPromise
884
- }
885
- this.queryPromise = this.loadTableDataGen(requestParameters).finally(() => {
886
- this.queryPromise = undefined
887
- })
888
- return this.queryPromise
889
- },
890
- /**
891
- * 加载表格数据
892
- * @param requestParameters 请求参数
893
- */
894
- async loadTableDataGen (requestParameters) {
895
- let result
896
- if (this.localEditMode) {
897
- if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
898
- const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
899
- this.serviceName, this.env === 'dev')
900
- if (result.data) {
901
- let no = 0
902
- this.localEditModeDataSource = result.data.map(item => {
903
- item['序号'] = no
904
- no++
905
- return item
906
- })
907
- }
908
- this.isLocalDataSourceLoadedExternally = true
909
- }
910
- result = new Promise((resolve) => {
911
- resolve({
912
- data: this.localEditModeDataSource
913
- })
914
- })
915
- } else {
916
- result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
917
- result.then(res => {
918
- this.totalCount = res.totalCount || 0
919
-
920
- // 在数据加载完成后,立即检查并更新选中状态
921
- if (this.selectRowMode !== 'disabled' && !this.clearSelectRowAfterQuery) {
922
- const primaryKeyName = this.primaryKey || this.rowKey
923
- // 找出当前页中应该被选中的行
924
- const currentPageSelectedRows = res.data.filter(row =>
925
- this.selectedRowKeys.includes(row[primaryKeyName])
926
- )
927
- // 更新表格的选中状态
928
- this.$nextTick(() => {
929
- // 更新内部选中状态
930
- this.innerSelectedRowKeys = currentPageSelectedRows.map(row => row[primaryKeyName])
931
- this.innerSelectedRows = currentPageSelectedRows
932
- // 更新表格显示
933
- this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
934
- // 更新总选中状态
935
- if (currentPageSelectedRows.length > 0) {
936
- // 保留不在当前页面的已选中行
937
- const otherPageSelectedRows = this.selectedRows.filter(row =>
938
- !currentPageSelectedRows.some(currentRow =>
939
- currentRow[primaryKeyName] === row[primaryKeyName]
940
- )
941
- )
942
- // 合并当前页面和其他页面的选中行
943
- const rowsMap = new Map()
944
- // 先添加其他页面的行
945
- otherPageSelectedRows.forEach(row => {
946
- rowsMap.set(row[primaryKeyName], row)
947
- })
948
- // 再添加当前页面的行(会覆盖重复的)
949
- currentPageSelectedRows.forEach(row => {
950
- rowsMap.set(row[primaryKeyName], row)
951
- })
952
- this.selectedRows = Array.from(rowsMap.values())
953
- }
954
- // 触发选择事件
955
- this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
956
- })
957
- }
958
- })
959
- }
960
-
961
- this.$emit('afterQuery', result, requestParameters.conditionParams)
962
- return result
963
- },
964
- /**
965
- * 操作列事件
966
- * @param record 本条数据
967
- * @param actionType 操作类型
968
- * @param func 事件默认 action
969
- * @param index 行下标
970
- */
971
- action (record, actionType, func = 'action', index) {
972
- this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func, index)
973
- },
974
- // 看板点击事件
975
- handleCardEmit (data, eventName) {
976
- this.action(data, undefined, eventName)
977
- },
978
- /**
979
- * 选择列勾选改变事件
980
- * @param record 被选择的列数据
981
- * @param selected 是否选中
982
- * @param selectedRows 被选择的列集合
983
- * @param nativeEvent 原生事件
984
- */
985
- onSelect (record, selected, selectedRows, nativeEvent) {
986
- console.log('onSelect', record, selected, selectedRows)
987
- if (this.selectRowMode === 'listView') {
988
- const primaryKeyName = this.primaryKey || this.rowKey
989
- // 获取主键数据
990
- const primaryData = record[primaryKeyName]
991
- // 取消勾选时
992
- if (!selected) {
993
- this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== primaryData)
994
- this.selectedRows = this.selectedRows.filter(item => item[primaryKeyName] !== primaryData)
995
- }
996
- }
997
- },
998
- /**
999
- * 选择列全选事件
1000
- * @param selected 是否选中
1001
- * @param selectedRows 被选择的列集合
1002
- * @param changeRows 改变的行集合
1003
- */
1004
- onSelectAll (selected, selectedRows, changeRows) {
1005
- console.log('onSelectAll', selected, selectedRows, changeRows)
1006
- if (this.selectRowMode === 'listView') {
1007
- if (!selected) {
1008
- const primaryKeyName = this.primaryKey || this.rowKey
1009
- // 获取所有改变的key
1010
- const changeKeys = changeRows.map(item => item[primaryKeyName])
1011
- this.selectedRowKeys = this.selectedRowKeys.filter(item => !changeKeys.includes(item))
1012
- this.selectedRows = this.selectedRows.filter(item => !changeKeys.includes(item[primaryKeyName]))
1013
- }
1014
- }
1015
- },
1016
- /**
1017
- * 选择列数据改变事件
1018
- * @param currentPageSelectedKeys 被选择的列Key集合
1019
- * @param currentPageSelectedRows 被选择的列集合
1020
- */
1021
- onSelectChange (currentPageSelectedKeys, currentPageSelectedRows) {
1022
- if (this.selectRowMode === 'listView' && !this.clearSelectRowAfterQuery) {
1023
- const primaryKeyName = this.primaryKey || this.rowKey
1024
- if (primaryKeyName) {
1025
- // 获取当前页面所有行的key
1026
- const currentPageAllKeys = this.$refs.table.localDataSource.map(row => row[primaryKeyName])
1027
- // 1. 保留不在当前页的已选中keys,并去重
1028
- const otherPageSelectedKeys = [...new Set(this.selectedRowKeys.filter(key => !currentPageAllKeys.includes(key)))]
1029
- console.log('其他页的keys', otherPageSelectedKeys)
1030
- // 2. 添加当前页新选中的keys,并去重
1031
- this.selectedRowKeys = [...new Set([...otherPageSelectedKeys, ...currentPageSelectedKeys])]
1032
- console.log('onSelectChange - updated selectedRowKeys:', this.selectedRowKeys)
1033
- // 更新总的 selectedRows
1034
- // 1. 保留不在当前页的已选中行,并去重
1035
- const otherPageSelectedRows = this.selectedRows.filter(row =>
1036
- !currentPageAllKeys.includes(row[primaryKeyName])
1037
- )
1038
- // 2. 合并结果,使用 Map 去重
1039
- const rowsMap = new Map()
1040
- // 先添加其他页面的行
1041
- otherPageSelectedRows.forEach(row => {
1042
- rowsMap.set(row[primaryKeyName], row)
1043
- })
1044
- // 再添加当前页面的行(会覆盖重复的)
1045
- currentPageSelectedRows.forEach(row => {
1046
- rowsMap.set(row[primaryKeyName], row)
1047
- })
1048
- this.selectedRows = Array.from(rowsMap.values())
1049
- console.log('onSelectChange - updated selectedRows:', this.selectedRows)
1050
- } else {
1051
- // 如果没有主键,则直接使用当前选中的行(此情况可能无法跨页选中,但为了兼容保留)
1052
- this.selectedRowKeys = currentPageSelectedKeys
1053
- this.selectedRows = currentPageSelectedRows
1054
- }
1055
- } else {
1056
- // 非 listView 模式或 clearSelectRowAfterQuery 为 true,直接使用当前页的选中状态作为总状态
1057
- this.selectedRowKeys = currentPageSelectedKeys
1058
- this.selectedRows = currentPageSelectedRows
1059
- }
1060
-
1061
- // 更新内部状态和表格显示
1062
- this.innerSelectedRowKeys = currentPageSelectedKeys
1063
- this.innerSelectedRows = currentPageSelectedRows
1064
-
1065
- // 确保在DOM更新后调用 updateSelect,以正确反映当前页的选中状态
1066
- this.$nextTick(() => {
1067
- this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
1068
- })
1069
-
1070
- // 更新按钮状态基于总选中数量
1071
- this.isModify = this.selectedRowKeys.length === 1
1072
- this.isDelete = this.selectedRowKeys.length > 0
1073
- this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
1074
-
1075
- // 触发选择事件,传递总的选中数据
1076
- this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
1077
- },
1078
- /**
1079
- * 清除表格选中项
1080
- */
1081
- clearRowKeys () {
1082
- this.$refs.table.clearSelected()
1083
- },
1084
- /**
1085
- * 为表格附加查询条件
1086
- */
1087
- setQueryForm (form = {}) {
1088
- this.form = form
1089
- if (this.createdQuery) {
1090
- this.refresh(true)
1091
- } else {
1092
- this.createdQuery = true
1093
- }
1094
- },
1095
- /**
1096
- * 表格重新加载方法
1097
- * 如果参数为 true, 则强制刷新到第一页
1098
- */
1099
- refresh (bool) {
1100
- this.$nextTick(() => {
1101
- this.$refs.table.refresh(bool)
1102
- })
1103
- },
1104
- setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
1105
- this.$nextTick(() => {
1106
- setTimeout(() => {
1107
- const curDocument = window?.rawDocument || document
1108
- const innerHeight = window?.rawWindow?.innerHeight || window.innerHeight || 0
1109
- if (typeof extraHeight == 'undefined') {
1110
- // 默认底部分页32 + 边距48
1111
- extraHeight = 48 + 32
1112
- }
1113
- let tHeader = null
1114
- if (id) {
1115
- tHeader = curDocument.getElementById(id) ? curDocument.getElementById(id).getElementsByClassName('ant-table-thead')[0] : null
1116
- } else {
1117
- tHeader = curDocument.getElementsByClassName('ant-table-thead')[0]
1118
- }
1119
- // 表格内容距离顶部的距离
1120
- let tHeaderBottom = 0
1121
- if (tHeader) {
1122
- tHeaderBottom = tHeader.getBoundingClientRect().bottom
1123
- }
1124
- if (tHeaderBottom === 0) {
1125
- this.scrollYHeight = 'calc(100vh - 31rem)'
1126
- if (window.__MICRO_APP_ENVIRONMENT__) {
1127
- this.scrollYHeight = 'calc(100vh - 28.5rem)'
1128
- }
1129
- return
1130
- }
1131
-
1132
- // 判断是否在 modal 中
1133
- if (this.isInAModal()) {
1134
- let modalElement = null
1135
- if (tHeader) {
1136
- modalElement = tHeader.closest('.ant-modal-body')
1137
- } else {
1138
- modalElement = curDocument.querySelector('.ant-modal-body')
1139
- }
1140
- if (modalElement) {
1141
- const modalRect = modalElement.getBoundingClientRect()
1142
- // 48 是 modal 通常的边距 32 是分页
1143
- extraHeight = innerHeight - modalRect.bottom + 32 + 48
1144
- }
1145
- }
1146
- if (innerHeight - (tHeaderBottom + extraHeight) < 210) {
1147
- this.scrollYHeight = 'calc(100vh - 31rem)'
1148
- return
1149
- }
1150
- // 窗体高度-表格内容顶部的高度-表格内容底部的高度
1151
- // this.scrollYHeight = document.body.clientHeight - tHeaderBottom - extraHeight
1152
- this.scrollYHeight = `calc(100vh - ${tHeaderBottom + extraHeight}px)`
1153
- }, 60)
1154
- })
1155
- },
1156
- /**
1157
- * 获取主键列名称
1158
- */
1159
- getPrimaryKeyName () {
1160
- if (this.primaryKey) {
1161
- return this.primaryKey
1162
- }
1163
- const indexColumn = this.tableColumns.find(i => i?.slotType === 'index')
1164
- return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
1165
- },
1166
- handleExport (type) {
1167
- this.$refs.exportExcel.handleExport(type, this.title)
1168
- },
1169
- handlePrint (type) {
1170
- const printData = {
1171
- title: this.title,
1172
- form: this.form,
1173
- operaInfo: this.currUser.operaInfo,
1174
- operaTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1175
- summary: this.retrieveSummaryData
1176
- }
1177
- this.$refs.exportExcel.handlePrint(type, printData)
1178
- },
1179
- validateTableAndSyncData (currRow, defaultAppendRowData) {
1180
- let isLastRow = false
1181
- if (this.localEditModeDataSource.length === 0) {
1182
- isLastRow = true
1183
- } else if (currRow['序号'] === this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号']) {
1184
- isLastRow = true
1185
- }
1186
- if (isLastRow) {
1187
- this.appendLocalData(defaultAppendRowData)
1188
- }
1189
- },
1190
- // 新增业务
1191
- add () {
1192
- if (this.eventState?.customAdd) {
1193
- this.custom('customAdd', {})
1194
- return
1195
- }
1196
- if (this.localEditMode && this.isEditMode) {
1197
- this.appendLocalData({})
1198
- } else {
1199
- this.$emit('add')
1200
- }
1201
- },
1202
- // 添加业务
1203
- move () {
1204
- this.$emit('move')
1205
- },
1206
- // 通用事件业务
1207
- custom (func) {
1208
- this.$emit('customEvent', func)
1209
- },
1210
- // 编辑业务
1211
- edit (id) {
1212
- this.editLoading = true
1213
- this.getEditData(id).then(modifyModelData => {
1214
- if (this.eventState?.customEdit) {
1215
- this.custom('customEdit', { id, modifyModelData })
1216
- return
1217
- }
1218
- this.$emit('edit', modifyModelData)
1219
- this.editLoading = false
1220
- })
1221
- },
1222
- // 行选择业务
1223
- choose () {
1224
- if (this.isChoose) {
1225
- // 如果配置了自定义函数
1226
- this.$emit('rowChoose', this.selectedRows)
1227
- } else {
1228
- this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1229
- }
1230
- },
1231
- // 自定义按钮点击
1232
- editButtonStateDataClick (index) {
1233
- this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1234
- },
1235
- // 获取被编辑的数据
1236
- getEditData (id) {
1237
- if (!id) {
1238
- this.selectId = this.selectedRowKeys[0]
1239
- } else {
1240
- this.selectId = id
1241
- }
1242
- const primaryKeyName = this.getPrimaryKeyName()
1243
- if (this.tableColumns[0].dataIndex !== primaryKeyName) {
1244
- this.selectId = this.selectedRows[0][primaryKeyName]
1245
- }
1246
- // 将更新需要的主键值加入到primaryKeyData中
1247
- const primaryKeyData = {}
1248
- primaryKeyData[primaryKeyName] = this.selectId
1249
- if (this.localEditMode) {
1250
- return new Promise((resolve) => {
1251
- const modifyData = this.getDataByRowKeyValue(this.selectId)
1252
- resolve({
1253
- data: modifyData,
1254
- primaryKeyData: primaryKeyData
1255
- })
1256
- })
1257
- }
1258
- const requestParameters = {
1259
- queryParamsName: this.queryParamsName,
1260
- queryParams: this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined,
1261
- conditionParams: {},
1262
- pageNo: 1,
1263
- pageSize: 1
1264
- }
1265
- requestParameters.conditionParams[primaryKeyName] = this.selectId
1266
- requestParameters.f_businessid = this.selectId
1267
- return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1268
- return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1269
- })
1270
- },
1271
- // 删除业务
1272
- deleteItem () {
1273
- if (this.viewMode) {
1274
- this.$message.info('预览模式禁止删除')
1275
- return
1276
- }
1277
- Modal.confirm({
1278
- title: '提示',
1279
- content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
1280
- zIndex: 1001,
1281
- onOk: () => {
1282
- const requestParameters = {
1283
- queryParamsName: this.queryParamsName,
1284
- idList: this.selectedRowKeys
1285
- }
1286
- if (this.eventState?.customDelete) {
1287
- this.custom('customDelete', {
1288
- selectedRowKeys: this.selectedRowKeys,
1289
- selectedRows: this.selectedRows
1290
- })
1291
- return
1292
- }
1293
- return new Promise((resolve, reject) => {
1294
- if (this.localEditMode) {
1295
- this.localEditModeDataSource = this.getLocalData().filter(item => !this.selectedRowKeys.includes(item[this.rowKey]))
1296
- resolve(200)
1297
- this.$message.success('删除成功!')
1298
- this.refresh(true)
1299
- // afterDelete
1300
- this.$emit('afterDelete', requestParameters)
1301
- } else if (this.customDelete) {
1302
- this.$emit('del', this.selectedRows, resolve)
1303
- } else {
1304
- remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1305
- resolve(res)
1306
- this.$message.success('删除成功!')
1307
- this.refresh(true)
1308
- // afterDelete
1309
- this.$emit('afterDelete', requestParameters)
1310
- }).catch(e => {
1311
- reject(e)
1312
- this.$message.error('删除失败!')
1313
- })
1314
- }
1315
- })
1316
- },
1317
- onCancel () {
1318
- }
1319
- })
1320
- },
1321
- // 导入业务
1322
- importData () {
1323
- this.$refs.importExcel.importExcelHandleOpen()
1324
- },
1325
- afterVisibleChange (val) {
1326
- if (val) {
1327
- this.retrieveSummaryData()
1328
- }
1329
- },
1330
- async retrieveSummaryData () {
1331
- const promises = []
1332
-
1333
- if (this.requestParameters.querySummary) {
1334
- const querySummaryPromise = querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1335
- .then(res => {
1336
- if (this.compatible === 'V3') {
1337
- res = res.data
1338
- }
1339
- if (res.length > 0) {
1340
- this.summaryData.forEach(item => {
1341
- res.forEach(summary => {
1342
- if (item.title === summary.title) {
1343
- item.value = summary.value
1344
- item.success = true
1345
- item.loading = false
1346
- }
1347
- })
1348
- })
1349
- }
1350
- })
1351
- promises.push(querySummaryPromise)
1352
- }
1353
-
1354
- if (this.showCustomSummary) {
1355
- this.customSummaryArray.forEach(item => {
1356
- const runLogicPromise = runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1357
- .then(res => {
1358
- this.summaryData.forEach(summary => {
1359
- if (item.key === summary.key) {
1360
- summary.value = res.value
1361
- summary.success = true
1362
- summary.loading = false
1363
- }
1364
- })
1365
- })
1366
- .catch(e => {
1367
- this.summaryData.forEach(summary => {
1368
- if (item.key === summary.key) {
1369
- summary.value = 0
1370
- summary.success = false
1371
- summary.loading = false
1372
- }
1373
- })
1374
- })
1375
- promises.push(runLogicPromise)
1376
- })
1377
- }
1378
-
1379
- await Promise.all(promises)
1380
- return this.summaryData
1381
- },
1382
- showDrawer () {
1383
- if (this.summaryUpdate) {
1384
- this.summaryData.forEach(item => {
1385
- item.loading = true
1386
- item.success = false
1387
- item.value = ' '
1388
- })
1389
- this.summaryDrawerVisible = true
1390
- } else {
1391
- this.$message.warning('请查询后再来查看')
1392
- }
1393
- },
1394
- onClose () {
1395
- this.summaryDrawerVisible = false
1396
- },
1397
- // 获取表格内所有数据
1398
- getTableData () {
1399
- return this.$refs.table.localDataSource
1400
- },
1401
- // 设置表格内数据
1402
- setTableData (data) {
1403
- if (this.localEditMode) {
1404
- // 本地编辑模式下,需要修改 localEditModeDataSource
1405
- this.localEditModeDataSource = data.map((item, index) => ({
1406
- ...item,
1407
- 序号: index + 1
1408
- }))
1409
- this.$nextTick(() => {
1410
- this.$refs.table?.refresh()
1411
- })
1412
- } else {
1413
- // 普通模式
1414
- this.$nextTick(() => {
1415
- if (this.$refs.table) {
1416
- this.$refs.table.setLocalDataSource(data)
1417
- }
1418
- })
1419
- }
1420
- },
1421
- // 获取所有本地数据
1422
- getLocalData () {
1423
- return this.localEditModeDataSource
1424
- },
1425
- // 获取指定rowKey的value的本地数据
1426
- getDataByRowKeyValue (rowKeyValue) {
1427
- return this.getLocalData().find(item => {
1428
- return item[this.rowKey] === rowKeyValue
1429
- })
1430
- },
1431
- // 修改本地数据
1432
- modifyLocalData (rowKeyValue, data) {
1433
- const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1434
- if (modifyItem) {
1435
- Object.assign(modifyItem, data)
1436
- }
1437
- },
1438
- // 追加本地数据
1439
- appendLocalData (item) {
1440
- if (this.localEditModeDataSource.length === 0) {
1441
- item['序号'] = 1
1442
- } else {
1443
- item['序号'] = this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号'] + 1
1444
- }
1445
- this.localEditModeDataSource.push(item)
1446
- },
1447
- handleRowClick (record) {
1448
- this.$emit('rowClick', record)
1449
- },
1450
- beforeDataChange (record) {
1451
- this.$emit('beforeDataChange', record)
1452
- },
1453
- onExpand (expanded, record) {
1454
- this.$emit('expand', expanded, record)
1455
- },
1456
- // 添加新方法处理表格选中状态
1457
- updateTableSelection (selectedKeys) {
1458
- console.log('selectedKeys', selectedKeys)
1459
- if (!this.$refs.table) {
1460
- return
1461
- }
1462
-
1463
- // 检查数据是否已加载
1464
- if (!this.$refs.table.localDataSource || this.$refs.table.localDataSource.length === 0) {
1465
- // 等待数据加载完成后再处理
1466
- const checkDataLoaded = () => {
1467
- if (this.$refs.table.localDataSource && this.$refs.table.localDataSource.length > 0) {
1468
- this.doUpdateTableSelection(selectedKeys)
1469
- } else {
1470
- setTimeout(checkDataLoaded, 100)
1471
- }
1472
- }
1473
- checkDataLoaded()
1474
- return
1475
- }
1476
-
1477
- this.doUpdateTableSelection(selectedKeys)
1478
- },
1479
-
1480
- // 实际执行更新选中状态的方法
1481
- doUpdateTableSelection (selectedKeys) {
1482
- const primaryKeyName = this.primaryKey || this.rowKey
1483
-
1484
- // 更新内部选中状态
1485
- this.selectedRowKeys = [...selectedKeys]
1486
- this.innerSelectedRowKeys = this.$refs.table.localDataSource
1487
- .filter(row => selectedKeys.includes(row[primaryKeyName]))
1488
- .map(row => row[primaryKeyName])
1489
-
1490
- // 更新选中行数据
1491
- this.selectedRows = this.$refs.table.localDataSource.filter(row =>
1492
- selectedKeys.includes(row[primaryKeyName])
1493
- )
1494
- this.innerSelectedRows = this.selectedRows
1495
-
1496
- // 更新表格选中状态
1497
- if (this.selectRowMode !== 'disabled' && !this.clearSelectRowAfterQuery) {
1498
- this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
1499
- }
1500
-
1501
- // 更新按钮状态
1502
- this.isModify = this.selectedRowKeys.length === 1
1503
- this.isDelete = this.selectedRowKeys.length > 0
1504
- this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
1505
-
1506
- // 触发选择事件
1507
- this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
1508
- }
1509
- }
1510
- }
1511
- </script>
1512
- <style lang="less" scoped>
1513
-
1514
- .custom-chart-title {
1515
- font-size: 16px;
1516
- font-weight: 700;
1517
- margin-bottom: 8px;
1518
- }
1519
-
1520
- .custom-chart-desc {
1521
- font-size: 12px;
1522
- color: rgba(0, 0, 0, .45);
1523
- margin-bottom: 16px;
1524
- }
1525
-
1526
- :deep(.ant-table-thead > tr > th) {
1527
- font-weight: 600;
1528
- }
1529
-
1530
- :deep(.table-wrapper .ant-pagination) {
1531
- display: flex;
1532
- flex-direction: row;
1533
- align-items: center;
1534
- padding: 0;
1535
- }
1536
-
1537
- :deep(.table-wrapper .ant-pagination .ant-pagination-total-text) {
1538
- white-space: nowrap;
1539
- }
1540
-
1541
- :deep(.ant-table td) {
1542
- white-space: nowrap;
1543
- }
1544
-
1545
- .footer_sum_title {
1546
- color: @primary-color;
1547
- font-weight: bold;
1548
- }
1549
-
1550
- .footer_sum_item {
1551
- white-space: nowrap;
1552
- }
1553
-
1554
- .ant-btn-hover {
1555
- border-color: @primary-color;
1556
- color: @primary-color;
1557
- }
1558
-
1559
- .innerTable {
1560
- :deep(.ant-form-item) {
1561
- margin: 0;
1562
- }
1563
- }
1564
- </style>
1
+ <template>
2
+ <div v-show="tableColumns.length > 0">
3
+ <a-row :gutter="48">
4
+ <a-col v-show="showLeftOperaBtn">
5
+ <span :style="{ float: 'left', marginBottom: '8px' }">
6
+ <a-space>
7
+ <!-- <a-button v-if="eventState.customDelete" type="primary" @click="custom('customDelete')">-->
8
+ <!-- <a-icon type="delete"/>删除-->
9
+ <!-- </a-button>-->
10
+ <!-- <a-button v-if="eventState.customSave" type="primary" @click="custom('customSave')">-->
11
+ <!-- <a-icon type="save"/>保存-->
12
+ <!-- </a-button>-->
13
+ <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
14
+ <a-button v-if="buttonState.add && buttonRendering('add')" type="primary" @click="add">
15
+ <a-icon type="plus"/>新增
16
+ </a-button>
17
+ <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
18
+ <a-icon type="plus"/>添加
19
+ </a-button>
20
+ <a-button
21
+ v-if="buttonState.choose && buttonRendering('choose')"
22
+ :disabled="!isChoose"
23
+ type="primary"
24
+ @click="choose">
25
+ <a-icon type="check-square"/>选择
26
+ </a-button>
27
+ <a-button
28
+ v-if="buttonState.edit && buttonRendering('edit')"
29
+ :disabled="!isModify"
30
+ :loading="editLoading"
31
+ class="btn-success"
32
+ type="dashed"
33
+ @click="edit()">
34
+ <a-icon :style="iconStyle" type="form"/>修改
35
+ </a-button>
36
+ <template
37
+ v-if="buttonState.editRow && buttonRendering('editRow')">
38
+ <a-button
39
+ v-if="isEditMode"
40
+ class="ant-btn-hover"
41
+ @click="editRowSave">
42
+ <a-icon :style="iconStyle" type="save"/>保存
43
+ </a-button>
44
+ <a-button
45
+ v-else
46
+ @click="openEditMode">
47
+ <a-icon :style="iconStyle" type="edit"/>行编辑
48
+ </a-button>
49
+ </template>
50
+ <a-button
51
+ v-if="buttonState.delete && buttonRendering('delete')"
52
+ :disabled="!isDelete"
53
+ type="danger"
54
+ @click="deleteItem">
55
+ <a-icon :style="iconStyle" type="delete"/>删除
56
+ </a-button>
57
+ <a-button
58
+ v-if="buttonState.import && buttonRendering('import')"
59
+ type="dashed"
60
+ @click="importData">
61
+ <a-icon :style="iconStyle" type="import"/>导入
62
+ </a-button>
63
+ <a-dropdown v-if="!buttonState || buttonState.export && buttonRendering('export')">
64
+ <a-menu slot="overlay">
65
+ <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handleExport('selected')"><a-icon
66
+ :style="iconStyle"
67
+ type="ordered-list"/>导出选中数据</a-menu-item>
68
+ <a-menu-item key="2" @click="handleExport('curPage')"><a-icon :style="iconStyle" type="snippets"/>导出本页数据</a-menu-item>
69
+ <a-menu-item key="3" @click="handleExport('exportByQuery')"><a-icon :style="iconStyle" type="download"/>导出所有符合条件的数据</a-menu-item>
70
+ </a-menu>
71
+ <a-button>导出 <a-icon type="down" :style="iconStyle"/> </a-button>
72
+ </a-dropdown>
73
+ <a-dropdown v-if="!buttonState || buttonState.print && buttonRendering('print')">
74
+ <a-menu slot="overlay">
75
+ <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handlePrint('selected')"><a-icon
76
+ :style="iconStyle"
77
+ type="ordered-list"/>打印选中数据</a-menu-item>
78
+ <a-menu-item key="2" @click="handlePrint('curPage')"><a-icon :style="iconStyle" type="snippets"/>打印本页数据</a-menu-item>
79
+ <a-menu-item key="3" @click="handlePrint('exportByQuery')"><a-icon :style="iconStyle" type="download"/>打印所有符合条件的数据</a-menu-item>
80
+ </a-menu>
81
+ <a-button>打印 <a-icon type="printer" :style="iconStyle"/> </a-button>
82
+ </a-dropdown>
83
+ <!-- 遍历按钮配置数组,动态生成按钮 -->
84
+ <a-button
85
+ v-for="(button, index) in editButtonStateData"
86
+ :key="index"
87
+ :type="button.type || 'dashed'"
88
+ @click="editButtonStateDataClick(index)"
89
+ class="btn-success"
90
+ >
91
+ <a-icon type="dashed" :style="iconStyle"/>
92
+ {{ button.buttonName }}
93
+ </a-button>
94
+ <a-button
95
+ v-if="allowedCardMode && !simpleMode"
96
+ @click="changeViewMode"
97
+ :type="isTableMode ? '' : 'primary'">
98
+ 看板模式
99
+ </a-button>
100
+ <a-badge
101
+ v-if="selectRowMode === 'listView'"
102
+ :count="selectedRows.length"
103
+ :number-style="{ backgroundColor:theme.color }"
104
+ >
105
+ <a-button
106
+ type="dashed"
107
+ @click="showTempData">
108
+ <a-icon :style="iconStyle" type="monitor"/>已选择
109
+ </a-button>
110
+ </a-badge>
111
+ <!-- 头部附加栅格 -->
112
+ <x-report
113
+ v-if="attachGrid"
114
+ :env="env"
115
+ :isWidget="true"
116
+ :use-oss-for-img="false"
117
+ :config-name="attachGrid"
118
+ :show-img-in-cell="true"
119
+ :display-only="true"
120
+ :edit-mode="false"
121
+ :show-save-button="false"
122
+ :dont-format="true"/>
123
+
124
+ <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
125
+ </a-space>
126
+
127
+ </span>
128
+ </a-col>
129
+ <a-col v-show="showRightTools && !simpleMode">
130
+ <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
131
+ <a-button-group>
132
+ <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
133
+ <a-tooltip title="汇总" placement="bottom">
134
+ <a-button @click="showDrawer">
135
+ <a-icon :style="iconStyle" type="project"/>
136
+ </a-button>
137
+ </a-tooltip>
138
+ <a-tooltip title="重新查询" placement="bottom">
139
+ <a-button @click="refresh(true)">
140
+ <a-icon :style="iconStyle" type="reload"/>
141
+ </a-button>
142
+ </a-tooltip>
143
+ <a-tooltip title="列展示/排序" placement="bottom">
144
+ <table-setting v-if="columnSelectLoaded" v-model="tableColumns"/>
145
+ </a-tooltip>
146
+ </a-button-group>
147
+ </span>
148
+ </a-col>
149
+ </a-row>
150
+ <!-- 如果当前是表格模式 -->
151
+ <template v-if="isTableMode">
152
+ <x-table-wrapper
153
+ ref="table"
154
+ @rowClick="handleRowClick"
155
+ @beforeDataChange="beforeDataChange"
156
+ @expand="onExpand">
157
+ <template slot="expandedRowRender">
158
+ <!-- 列扩展栅格 -->
159
+ <x-report
160
+ v-if="expandedGrid"
161
+ :env="env"
162
+ ref="report"
163
+ :isWidget="true"
164
+ :use-oss-for-img="false"
165
+ :config-name="expandedGrid"
166
+ :show-img-in-cell="true"
167
+ :display-only="true"
168
+ :edit-mode="false"
169
+ :show-save-button="false"
170
+ :dont-format="true"/>
171
+ </template>
172
+ <template slot="footer">
173
+ <slot
174
+ name="footer"
175
+ :selectedRowKeys="selectedRowKeys"
176
+ :selectedRows="selectedRows"></slot>
177
+ </template>
178
+ </x-table-wrapper>
179
+ </template>
180
+ <!-- 如果当前是看板模式 -->
181
+ <template v-else>
182
+ <XDataCard
183
+ ref="table"
184
+ @cardEmit="handleCardEmit"
185
+ :tableColumns="tableColumns"
186
+ :card-config="cardModeConfig"
187
+ :show-pagination="!simpleMode"
188
+ :prePageSize="simpleMode ? 1000 : undefined"
189
+ :serviceName="serviceName"
190
+ :card-data="loadData"
191
+ :env="env"
192
+ :createdQuery="createdQuery"
193
+ :simple-mode="simpleMode"/>
194
+ </template>
195
+ <!-- 上传文件 -->
196
+ <a-drawer
197
+ title="汇总信息"
198
+ placement="right"
199
+ :closable="false"
200
+ :visible="summaryDrawerVisible"
201
+ :z-index="2000"
202
+ :width="`${summaryDrawerWidth}vw`"
203
+ :after-visible-change="afterVisibleChange"
204
+ @close="onClose"
205
+ >
206
+ <template>
207
+ <a-row>
208
+ <a-col :span="8" v-for="(f,index) in summaryData" :key="index">
209
+ <a-statistic
210
+ :title="f.title + ':'"
211
+ :value="f.value"
212
+ :precision="2">
213
+ <template #prefix>
214
+ <a-spin :spinning="f.loading">
215
+ </a-spin>
216
+ </template>
217
+ <template #suffix>
218
+ <a-icon
219
+ v-show="!f.loading"
220
+ :type="f.success !== false ? 'check-circle' : 'close-circle'"
221
+ :style="{color: f.success !== false ? 'green' : 'red'}"/>
222
+ </template>
223
+ </a-statistic>
224
+ </a-col>
225
+ <a-col
226
+ :span="item.span"
227
+ v-for="(item,index) in chartsConfigArray"
228
+ :key="index"
229
+ style="height: 20rem; margin-bottom: 3rem">
230
+ <div class="custom-chart-title" v-if="item.config.title">{{ item.config.title }}</div>
231
+ <div class="custom-chart-desc" v-if="item.config.description">{{ item.config.description }}</div>
232
+ <g2Charts
233
+ :key="index"
234
+ :chatsKey="index"
235
+ :is-dev="env === 'dev'"
236
+ :config="item.config"
237
+ :requestParameters="requestParameters"/>
238
+ </a-col>
239
+ </a-row>
240
+ </template>
241
+ </a-drawer>
242
+ <x-import-excel
243
+ ref="importExcel"
244
+ @ok="importExcelOk"
245
+ :title="title"
246
+ :service-name="serviceName"
247
+ :env="env"
248
+ :query-params-name="queryParamsName"
249
+ >
250
+ <template #importExcelSlot>
251
+ <slot name="importExcelSlot"></slot>
252
+ </template>
253
+ </x-import-excel>
254
+ <ExportExcel
255
+ ref="exportExcel"
256
+ />
257
+ <a-modal @cancel="$refs.table.refresh()" v-model="selectedRowModalVisible" width="80vw" title="已选中数据" :footer="null">
258
+ <x-table-wrapper
259
+ ref="selectedDataTable"
260
+ :load-selected-data="true"
261
+ @beforeDataChange="beforeDataChange"
262
+ @rowClick="handleRowClick">
263
+ </x-table-wrapper>
264
+ </a-modal>
265
+ </div>
266
+ </template>
267
+ <script>
268
+ import { STable } from '@vue2-client/components'
269
+ import { getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
270
+ import * as util from '@vue2-client/utils/util'
271
+ import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
272
+ import {
273
+ query,
274
+ querySummary,
275
+ queryWithResource,
276
+ remove,
277
+ getConfigByNameAsync,
278
+ editRowSave,
279
+ runLogic
280
+ } from '@vue2-client/services/api/common'
281
+ import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
282
+ import { Modal } from 'ant-design-vue'
283
+ import { mapState } from 'vuex'
284
+ import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
285
+ import debounce from 'lodash.debounce'
286
+ import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
287
+ import { getRealKeyData } from '@vue2-client/utils/formatter'
288
+ import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
289
+ import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
290
+ import ExportExcel from '@vue2-client/base-client/components/common/XTable/ExportExcel.vue'
291
+ import g2Charts from '@vue2-client/components/g2Charts/index.vue'
292
+ import moment from 'moment/moment'
293
+ import XTableWrapper from './XTableWrapper.vue'
294
+
295
+ export default {
296
+ name: 'XTable',
297
+ components: {
298
+ ExportExcel,
299
+ CustomFuncCel,
300
+ XDataCard,
301
+ TableSetting,
302
+ STable,
303
+ XImportExcel,
304
+ g2Charts,
305
+ XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
306
+ ReportTableHome,
307
+ XTableWrapper
308
+ },
309
+ inject: ['getSelf'],
310
+ provide () {
311
+ return {
312
+ tableContext: this
313
+ }
314
+ },
315
+ data () {
316
+ return {
317
+ uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
318
+ // 筛选列加载状态
319
+ columnSelectLoaded: false,
320
+ // 预览模式
321
+ viewMode: false,
322
+ // 本地编辑模式
323
+ localEditMode: false,
324
+ // 本地编辑表单提交方式
325
+ formSubmitTypeInLocalEditMode: 'cover',
326
+ // 本地编辑模式所用数据源
327
+ localEditModeDataSource: [],
328
+ // 本地编辑模式数据源是否已由外部加载
329
+ isLocalDataSourceLoadedExternally: false,
330
+ // 行选择模式
331
+ rowSelectMode: false,
332
+ // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
333
+ allowSelectRowNum: 0,
334
+ // 头部附件的栅格配置名
335
+ attachGrid: '',
336
+ // 表格行扩展区域的栅格配置名
337
+ expandedGrid: '',
338
+ // 是否展示右侧工具栏
339
+ showRightTools: true,
340
+ // 是否展示左边按钮栏
341
+ showLeftOperaBtn: true,
342
+ // 加载数据方法 必须为 Promise 对象
343
+ loadData: parameter => {
344
+ // 取到表格携带的表单参数
345
+ const requestParameters = Object.assign({}, parameter)
346
+ // 取到父组件传入的表单参数
347
+ const conditionParams = {}
348
+ Object.assign(conditionParams, this.fixedQueryForm)
349
+ Object.assign(conditionParams, this.form)
350
+ // 如果传了燃气公司字段,则进行数据处理
351
+ if (conditionParams.orgName) {
352
+ requestParameters.orgName = conditionParams.orgName
353
+ delete conditionParams.orgName
354
+ }
355
+ Object.keys(conditionParams).forEach(key => {
356
+ if (Array.isArray(conditionParams[key])) {
357
+ // 检查数组中是否包含 null
358
+ const hasNull = conditionParams[key].every(item => item === '') || conditionParams[key].length === 0
359
+ // 如果包含 null,则删除该属性
360
+ if (hasNull) {
361
+ delete conditionParams[key]
362
+ }
363
+ }
364
+ })
365
+ requestParameters.conditionParams = conditionParams
366
+ requestParameters.queryParamsName = this.queryParamsName
367
+ requestParameters.queryParams = this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined
368
+ this.requestParameters = requestParameters
369
+ // 加载数据
370
+ return this.loadTableData(requestParameters)
371
+ },
372
+ requestParameters: {},
373
+ rowKey: undefined,
374
+ // x滚动条宽度
375
+ scrollXWidth: 1600,
376
+ // y滚动条高度
377
+ scrollYHeight: 'calc(100vh - 31rem)',
378
+ // 表格选择列Key集合
379
+ selectedRowKeys: [],
380
+ // 表格选择Row集合
381
+ selectedRows: [],
382
+ // 表格选择列Key集合
383
+ innerSelectedRowKeys: [],
384
+ // 表格选择Row集合
385
+ innerSelectedRows: [],
386
+ // 禁止表格选择Row集合
387
+ selectedDisableRows: [],
388
+ // 业务标题
389
+ title: '',
390
+ // 数据列
391
+ tableColumns: [],
392
+ // 查询用表单
393
+ form: {},
394
+ oldForm: {},
395
+ // 是否允许修改
396
+ isModify: false,
397
+ // 是否允许删除
398
+ isDelete: false,
399
+ // 是否允许选择
400
+ isChoose: false,
401
+ // 选中用于修改的id
402
+ selectId: undefined,
403
+ // 是否显示展示列抽屉
404
+ visible: false,
405
+ // 编辑按钮加载状态
406
+ editLoading: false,
407
+ // 按钮状态
408
+ buttonState: {},
409
+ // eventBtnState
410
+ eventState: {},
411
+ // 自定义按钮数组
412
+ editButtonStateData: [],
413
+ // 按钮权限
414
+ buttonPermissions: [],
415
+ // 是否展示汇总
416
+ showSummary: false,
417
+ // 自定义汇总
418
+ showCustomSummary: false,
419
+ summaryData: [],
420
+ // 图标样式
421
+ iconStyle: {
422
+ position: 'relative',
423
+ top: '1px'
424
+ },
425
+ // 当前环境
426
+ env: 'prod',
427
+ // 预览模式(表格 or 看板)
428
+ isTableMode: true,
429
+ // 汇总抽屉是否显示
430
+ summaryDrawerVisible: false,
431
+ // 汇总更新标志
432
+ summaryUpdate: false,
433
+ customSummaryArray: [],
434
+ formItems: [],
435
+ // 是否为行编辑模式
436
+ isEditMode: false,
437
+ // 定义主键
438
+ primaryKey: '',
439
+ // 是否进行初始化查询
440
+ createdQuery: false,
441
+ // 允许看板模式
442
+ allowedCardMode: false,
443
+ // 看板模式配置
444
+ cardModeConfig: undefined,
445
+ // 暂存行编辑前数据 用于比较哪些变化了才需要保存
446
+ editRowBeforeData: [],
447
+ // 是否简易模式
448
+ simpleMode: false,
449
+ // crud打印模板配置
450
+ printTemplate: false,
451
+ queryParams: {},
452
+ // 定义总行数
453
+ totalCount: 0,
454
+ user: {},
455
+ chartsConfigArray: [],
456
+ summaryDrawerWidth: 35,
457
+ // 行选择模式
458
+ selectRowMode: 'default',
459
+ tableSize: 'default',
460
+ clearSelectRowAfterQuery: false,
461
+ selectedRowModalVisible: false
462
+ }
463
+ },
464
+ props: {
465
+ // 查询配置文件名
466
+ queryParamsName: {
467
+ type: String,
468
+ default: () => {
469
+ return ''
470
+ }
471
+ },
472
+ // 查询配置文件名
473
+ serviceName: {
474
+ type: String,
475
+ default: () => {
476
+ return ''
477
+ }
478
+ },
479
+ // 查询配置文件Json
480
+ queryParamsJson: {
481
+ type: Object,
482
+ default: null
483
+ },
484
+ // 固定查询表单
485
+ fixedQueryForm: {
486
+ type: Object,
487
+ default: () => {
488
+ return {}
489
+ }
490
+ },
491
+ // 数据只有一页时是否展示分页,true:展示,auto:隐藏
492
+ showPagination: {
493
+ type: Boolean,
494
+ default: true
495
+ },
496
+ // 是否自定义删除功能
497
+ customDelete: {
498
+ type: Boolean,
499
+ default: false
500
+ },
501
+ // 自适应底部边距
502
+ extraHeight: {
503
+ type: Number,
504
+ default: 80
505
+ },
506
+ pageMaxSize: {
507
+ type: Number,
508
+ default: null
509
+ },
510
+ // 外部传入的选中行keys
511
+ externalSelectedRowKeys: {
512
+ type: Array,
513
+ default: () => []
514
+ }
515
+ },
516
+ computed: {
517
+ ...mapState('setting', ['theme']),
518
+ rowSelection () {
519
+ return this.selectRowMode === 'disabled' ? undefined : {
520
+ selectedRowKeys: this.innerSelectedRowKeys,
521
+ onChange: this.onSelectChange,
522
+ onSelect: this.selectRowMode === 'listView' ? this.onSelect : undefined,
523
+ onSelectAll: this.selectRowMode === 'listView' ? this.onSelectAll : undefined,
524
+ getCheckboxProps: record => ({
525
+ props: {
526
+ disabled: this.selectedDisableRows.includes(record[this.rowKey]), // Column configuration not to be checked
527
+ name: record.name,
528
+ },
529
+ }),
530
+ }
531
+ },
532
+ ...mapState('account', { currUser: 'user' }),
533
+ ...mapState('setting', ['compatible'])
534
+ },
535
+ watch: {
536
+ pageMaxSize: {
537
+ handler (val) {
538
+ if (this.tableContext) {
539
+ this.tableContext.pageMaxSize = val
540
+ }
541
+ },
542
+ immediate: true
543
+ },
544
+ externalSelectedRowKeys: {
545
+ handler (newVal) {
546
+ // 如果新值和当前值相同,则不处理
547
+ if (JSON.stringify(newVal) === JSON.stringify(this.selectedRowKeys)) {
548
+ return
549
+ }
550
+ if (newVal && newVal.length > 0) {
551
+ this.$nextTick(() => {
552
+ this.updateTableSelection(newVal)
553
+ })
554
+ }
555
+ }
556
+ }
557
+ },
558
+ mounted () {
559
+ window.addEventListener('resize', this.handleResize)
560
+ // 初始化时如果有外部选中值,等待 table 准备好后设置
561
+ if (this.externalSelectedRowKeys && this.externalSelectedRowKeys.length > 0) {
562
+ this.$nextTick(() => {
563
+ this.updateTableSelection(this.externalSelectedRowKeys)
564
+ })
565
+ }
566
+ },
567
+ beforeDestroy () {
568
+ // 销毁页面查询定时器
569
+ if (this.queryTimer) {
570
+ clearInterval(this.queryTimer)
571
+ }
572
+ window.removeEventListener('resize', this.handleResize)
573
+ },
574
+ methods: {
575
+ showTempData () {
576
+ this.selectedRowModalVisible = true
577
+ this.$nextTick(() => {
578
+ if (this.$refs.selectedDataTable) {
579
+ // 确保数据已经准备好
580
+ const selectedData = this.selectedRows.map(row => ({ ...row }))
581
+ this.$refs.selectedDataTable.refresh(true)
582
+ // 等待数据加载完成后再更新选中状态
583
+ setTimeout(() => {
584
+ if (this.$refs.selectedDataTable) {
585
+ this.$refs.selectedDataTable.updateSelect(
586
+ selectedData.map(row => row[this.primaryKey || this.rowKey]),
587
+ selectedData
588
+ )
589
+ }
590
+ }, 100)
591
+ }
592
+ })
593
+ },
594
+ customFunctionShow (customFunction, record, cIndex) {
595
+ return executeStrFunctionByContext(this, customFunction, [record, cIndex])
596
+ },
597
+ getConfigByNameAsync,
598
+ runLogic,
599
+ executeStrFunctionByContext,
600
+ columnClick (key, value, record) {
601
+ this.$emit('columnClick', key, value, record)
602
+ },
603
+ gotoUserDetail (key, value, record) {
604
+ this.$emit('gotoUserDetail', key, value, record)
605
+ },
606
+ // 打开行编辑
607
+ openEditMode () {
608
+ this.isEditMode = true
609
+ this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
610
+ },
611
+ // 标记行保存
612
+ editRowSave () {
613
+ // 获取最新数据
614
+ const editRowAfterData = this.getTableData()
615
+ const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
616
+ if (this.eventState?.customSave) {
617
+ this.custom('customSave', {
618
+ tableData: editRowAfterData,
619
+ changeData
620
+ })
621
+ return
622
+ }
623
+ if (changeData.length === 0) {
624
+ this.$message.info('没有数据发生变化')
625
+ } else {
626
+ Modal.confirm({
627
+ title: '是否确认保存?',
628
+ content: `此操作将保存当前行编辑的数据,共修改${changeData.length}条数据`,
629
+ zIndex: 1001,
630
+ onOk: () => {
631
+ return new Promise((resolve, reject) => {
632
+ const requestParameters = {
633
+ queryParamsName: this.queryParamsName,
634
+ changeData: changeData.map(h => getRealKeyData(h)),
635
+ operaInfo: this.currUser.operaInfo
636
+ }
637
+ editRowSave(requestParameters, this.serviceName, this.env === 'dev').then(res => {
638
+ this.$message.success('行内数据保存成功')
639
+ this.isEditMode = false
640
+ this.refresh()
641
+ resolve(res)
642
+ }).catch(e => {
643
+ reject(e)
644
+ this.$message.error('保存失败!')
645
+ })
646
+ })
647
+ },
648
+ onCancel () {
649
+ }
650
+ })
651
+ }
652
+ },
653
+ importExcelOk (data) {
654
+ this.refresh(true)
655
+ this.$emit('importExcelOk', data)
656
+ },
657
+ /**
658
+ * 行选择事件
659
+ * @param row 选中行集合
660
+ * @param attr 表单项属性
661
+ */
662
+ async rowChoose (row, attr, callback, record) {
663
+ // 如果配置了自定义函数
664
+ if (attr.dataChangeFunc) {
665
+ await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
666
+ ...attr,
667
+ selectRows: row
668
+ }, util, this.getSelf(), this.mode, runLogic, getConfigByNameAsync])
669
+ } else {
670
+ // 默认填充选中行数据到当前表单
671
+ setDataByRealKey(record, row[0])
672
+ }
673
+ if (callback) {
674
+ callback()
675
+ }
676
+ },
677
+ setForm (record, obj) {
678
+ Object.assign(record, obj)
679
+ this.$forceUpdate()
680
+ },
681
+ handleResize () {
682
+ debounce(() => {
683
+ this.setScrollYHeight({})
684
+ }, 100)()
685
+ },
686
+ isInAModal () {
687
+ let parent = this.$parent
688
+ while (parent) {
689
+ // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
690
+ if (parent.$options.name === 'AModal') {
691
+ return true
692
+ }
693
+ parent = parent.$parent
694
+ }
695
+ return false
696
+ },
697
+ executeStrFunction,
698
+ // 切换看板模式和表格模式
699
+ changeViewMode () {
700
+ this.isTableMode = !this.isTableMode
701
+ // 看板切换回表格模式 刷新列表
702
+ this.refresh(true)
703
+ },
704
+ /**
705
+ * 初始化表格参数
706
+ */
707
+ init (params) {
708
+ const {
709
+ // 查询参数对象, 用于没有对应查询配置文件名时
710
+ queryParams,
711
+ tableColumns,
712
+ attachGrid,
713
+ expandedGrid,
714
+ buttonState,
715
+ eventState = {},
716
+ buttonPermissions,
717
+ editButtonStateData = [],
718
+ title,
719
+ form,
720
+ tableSummaryMap = {},
721
+ customTableSummaryArray = [],
722
+ viewMode,
723
+ localEditMode,
724
+ formSubmitTypeInLocalEditMode = 'cover',
725
+ rowSelectMode,
726
+ allowSelectRowNum = 0,
727
+ formItems,
728
+ env = 'prod',
729
+ createdQuery = true,
730
+ createdEditMode = false,
731
+ primaryKey,
732
+ allowedCardMode = false,
733
+ simpleMode = false,
734
+ showRightTools = true,
735
+ cardModeConfig,
736
+ summaryUpdate,
737
+ summaryDrawerWidth = 35,
738
+ chartsConfigArray = [],
739
+ printTemplate = 'DEFAULT_CRUD_PRINT_TEMPLATE',
740
+ selectRowMode = 'default',
741
+ tableSize = 'default',
742
+ clearSelectRowAfterQuery = false
743
+ } = params
744
+ this.showSummary = Object.keys(tableSummaryMap).length > 0
745
+ if (this.showSummary) {
746
+ Object.keys(tableSummaryMap).forEach(item => {
747
+ this.summaryData.push({
748
+ key: item,
749
+ title: tableSummaryMap[item],
750
+ value: ' ',
751
+ loading: true,
752
+ success: false
753
+ })
754
+ })
755
+ }
756
+ if (customTableSummaryArray.length > 0) {
757
+ customTableSummaryArray.forEach(item => {
758
+ this.summaryData.push({
759
+ key: item.key,
760
+ title: item.title,
761
+ value: ' ',
762
+ loading: true,
763
+ success: false
764
+ })
765
+ })
766
+ this.showCustomSummary = true
767
+ this.customSummaryArray = customTableSummaryArray
768
+ }
769
+ this.queryParams = queryParams
770
+ this.tableColumns = JSON.parse(JSON.stringify(tableColumns))
771
+ if (this.tableColumns.length === 0) {
772
+ return
773
+ }
774
+ this.attachGrid = attachGrid
775
+ this.expandedGrid = expandedGrid
776
+ this.viewMode = viewMode
777
+ this.localEditMode = localEditMode
778
+ this.formSubmitTypeInLocalEditMode = formSubmitTypeInLocalEditMode
779
+ this.rowSelectMode = rowSelectMode
780
+ this.allowSelectRowNum = allowSelectRowNum
781
+ this.simpleMode = simpleMode
782
+ this.formItems = formItems
783
+ this.user = this.currUser
784
+ this.createdQuery = createdQuery
785
+ this.primaryKey = primaryKey
786
+ this.buttonState = buttonState
787
+ this.eventState = eventState
788
+ this.showRightTools = showRightTools
789
+ this.printTemplate = printTemplate
790
+ this.summaryDrawerWidth = summaryDrawerWidth
791
+ this.chartsConfigArray = chartsConfigArray
792
+ this.selectRowMode = selectRowMode
793
+ this.tableSize = tableSize
794
+ this.clearSelectRowAfterQuery = clearSelectRowAfterQuery
795
+ if (this.chartsConfigArray.length > 0) {
796
+ // 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
797
+ this.chartsConfigArray.forEach(item => {
798
+ item.config.queryParams = JSON.parse(JSON.stringify(this.queryParams))
799
+ item.config.queryParamsName = this.queryParamsName
800
+ })
801
+ }
802
+ if (this.localEditMode) {
803
+ this.localEditModeDataSource = []
804
+ if (this.formSubmitTypeInLocalEditMode === 'append') {
805
+ this.isLocalDataSourceLoadedExternally = true
806
+ const defaultItem = {}
807
+ defaultItem['序号'] = 0
808
+ this.localEditModeDataSource.push(defaultItem)
809
+ } else {
810
+ this.isLocalDataSourceLoadedExternally = false
811
+ }
812
+ this.buttonState.import = false
813
+ this.buttonState.export = false
814
+ this.showRightTools = false
815
+ }
816
+ if (this.rowSelectMode) {
817
+ this.buttonState = {
818
+ choose: true
819
+ }
820
+ this.showRightTools = false
821
+ }
822
+ this.buttonPermissions = buttonPermissions
823
+ this.editButtonStateData = editButtonStateData
824
+ this.title = title
825
+ this.env = env
826
+ this.rowKey = this.getPrimaryKeyName()
827
+ this.allowedCardMode = allowedCardMode
828
+ this.cardModeConfig = cardModeConfig
829
+ this.summaryUpdate = summaryUpdate
830
+ this.isEditMode = createdEditMode
831
+ let totalWidth = 0
832
+ for (let i = 0; i < this.tableColumns.length; i++) {
833
+ const item = this.tableColumns[i]
834
+ // 设置操作列
835
+ if (item.slotType === 'action') {
836
+ item.fixed = 'right'
837
+ item.width = 70
838
+ }
839
+ // 设置表格宽度
840
+ if (item.width) {
841
+ totalWidth = totalWidth + item.width
842
+ } else {
843
+ totalWidth = totalWidth + 180
844
+ }
845
+ }
846
+ // 横向滚动长度大于所有宽度,才能实现固定表头
847
+ this.scrollXWidth = totalWidth
848
+ // 加载筛选列完成
849
+ this.columnSelectLoaded = true
850
+ this.setQueryForm(form || {})
851
+ // 简易模式,并且是看板模式,默认直接进入看板模式
852
+ if (this.allowedCardMode && this.simpleMode) {
853
+ this.isTableMode = false
854
+ }
855
+ if (params.queryInterval) {
856
+ this.queryTimer = setInterval(() => {
857
+ this.refresh()
858
+ }, params.queryInterval * 1000)
859
+ }
860
+ },
861
+ // 操作面板按钮渲染
862
+ buttonRendering (button) {
863
+ if (!this.buttonPermissions) {
864
+ return true
865
+ }
866
+ try {
867
+ const existingItem = this.buttonPermissions.find(item => item.btnName === button)
868
+ const rolestr = this.currUser.rolestr?.split(',')
869
+ if (existingItem?.state) {
870
+ const currUserRole = existingItem.roleStr
871
+ return rolestr.some(item => currUserRole && currUserRole.includes(item))
872
+ } else {
873
+ return true
874
+ }
875
+ } catch (e) {
876
+ console.error(e)
877
+ return false
878
+ }
879
+ },
880
+ // 防止查询多次点击处理
881
+ loadTableData (requestParameters) {
882
+ if (this.queryPromise) {
883
+ return this.queryPromise
884
+ }
885
+ this.queryPromise = this.loadTableDataGen(requestParameters).finally(() => {
886
+ this.queryPromise = undefined
887
+ })
888
+ return this.queryPromise
889
+ },
890
+ /**
891
+ * 加载表格数据
892
+ * @param requestParameters 请求参数
893
+ */
894
+ async loadTableDataGen (requestParameters) {
895
+ let result
896
+ if (this.localEditMode) {
897
+ if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
898
+ const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
899
+ this.serviceName, this.env === 'dev')
900
+ if (result.data) {
901
+ let no = 0
902
+ this.localEditModeDataSource = result.data.map(item => {
903
+ item['序号'] = no
904
+ no++
905
+ return item
906
+ })
907
+ }
908
+ this.isLocalDataSourceLoadedExternally = true
909
+ }
910
+ result = new Promise((resolve) => {
911
+ resolve({
912
+ data: this.localEditModeDataSource
913
+ })
914
+ })
915
+ } else {
916
+ result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
917
+ result.then(res => {
918
+ this.totalCount = res.totalCount || 0
919
+
920
+ // 在数据加载完成后,立即检查并更新选中状态
921
+ if (this.selectRowMode !== 'disabled' && !this.clearSelectRowAfterQuery) {
922
+ const primaryKeyName = this.primaryKey || this.rowKey
923
+ // 找出当前页中应该被选中的行
924
+ const currentPageSelectedRows = res.data.filter(row =>
925
+ this.selectedRowKeys.includes(row[primaryKeyName])
926
+ )
927
+ // 更新表格的选中状态
928
+ this.$nextTick(() => {
929
+ // 更新内部选中状态
930
+ this.innerSelectedRowKeys = currentPageSelectedRows.map(row => row[primaryKeyName])
931
+ this.innerSelectedRows = currentPageSelectedRows
932
+ // 更新表格显示
933
+ this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
934
+ // 更新总选中状态
935
+ if (currentPageSelectedRows.length > 0) {
936
+ // 保留不在当前页面的已选中行
937
+ const otherPageSelectedRows = this.selectedRows.filter(row =>
938
+ !currentPageSelectedRows.some(currentRow =>
939
+ currentRow[primaryKeyName] === row[primaryKeyName]
940
+ )
941
+ )
942
+ // 合并当前页面和其他页面的选中行
943
+ const rowsMap = new Map()
944
+ // 先添加其他页面的行
945
+ otherPageSelectedRows.forEach(row => {
946
+ rowsMap.set(row[primaryKeyName], row)
947
+ })
948
+ // 再添加当前页面的行(会覆盖重复的)
949
+ currentPageSelectedRows.forEach(row => {
950
+ rowsMap.set(row[primaryKeyName], row)
951
+ })
952
+ this.selectedRows = Array.from(rowsMap.values())
953
+ }
954
+ // 触发选择事件
955
+ this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
956
+ })
957
+ }
958
+ })
959
+ }
960
+
961
+ this.$emit('afterQuery', result, requestParameters.conditionParams)
962
+ return result
963
+ },
964
+ /**
965
+ * 操作列事件
966
+ * @param record 本条数据
967
+ * @param actionType 操作类型
968
+ * @param func 事件默认 action
969
+ * @param index 行下标
970
+ */
971
+ action (record, actionType, func = 'action', index) {
972
+ this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func, index)
973
+ },
974
+ // 看板点击事件
975
+ handleCardEmit (data, eventName) {
976
+ this.action(data, undefined, eventName)
977
+ },
978
+ /**
979
+ * 选择列勾选改变事件
980
+ * @param record 被选择的列数据
981
+ * @param selected 是否选中
982
+ * @param selectedRows 被选择的列集合
983
+ * @param nativeEvent 原生事件
984
+ */
985
+ onSelect (record, selected, selectedRows, nativeEvent) {
986
+ console.log('onSelect', record, selected, selectedRows)
987
+ if (this.selectRowMode === 'listView') {
988
+ const primaryKeyName = this.primaryKey || this.rowKey
989
+ // 获取主键数据
990
+ const primaryData = record[primaryKeyName]
991
+ // 取消勾选时
992
+ if (!selected) {
993
+ this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== primaryData)
994
+ this.selectedRows = this.selectedRows.filter(item => item[primaryKeyName] !== primaryData)
995
+ }
996
+ }
997
+ },
998
+ /**
999
+ * 选择列全选事件
1000
+ * @param selected 是否选中
1001
+ * @param selectedRows 被选择的列集合
1002
+ * @param changeRows 改变的行集合
1003
+ */
1004
+ onSelectAll (selected, selectedRows, changeRows) {
1005
+ console.log('onSelectAll', selected, selectedRows, changeRows)
1006
+ if (this.selectRowMode === 'listView') {
1007
+ if (!selected) {
1008
+ const primaryKeyName = this.primaryKey || this.rowKey
1009
+ // 获取所有改变的key
1010
+ const changeKeys = changeRows.map(item => item[primaryKeyName])
1011
+ this.selectedRowKeys = this.selectedRowKeys.filter(item => !changeKeys.includes(item))
1012
+ this.selectedRows = this.selectedRows.filter(item => !changeKeys.includes(item[primaryKeyName]))
1013
+ }
1014
+ }
1015
+ },
1016
+ /**
1017
+ * 选择列数据改变事件
1018
+ * @param currentPageSelectedKeys 被选择的列Key集合
1019
+ * @param currentPageSelectedRows 被选择的列集合
1020
+ */
1021
+ onSelectChange (currentPageSelectedKeys, currentPageSelectedRows) {
1022
+ if (this.selectRowMode === 'listView' && !this.clearSelectRowAfterQuery) {
1023
+ const primaryKeyName = this.primaryKey || this.rowKey
1024
+ if (primaryKeyName) {
1025
+ // 获取当前页面所有行的key
1026
+ const currentPageAllKeys = this.$refs.table.localDataSource.map(row => row[primaryKeyName])
1027
+ // 1. 保留不在当前页的已选中keys,并去重
1028
+ const otherPageSelectedKeys = [...new Set(this.selectedRowKeys.filter(key => !currentPageAllKeys.includes(key)))]
1029
+ console.log('其他页的keys', otherPageSelectedKeys)
1030
+ // 2. 添加当前页新选中的keys,并去重
1031
+ this.selectedRowKeys = [...new Set([...otherPageSelectedKeys, ...currentPageSelectedKeys])]
1032
+ console.log('onSelectChange - updated selectedRowKeys:', this.selectedRowKeys)
1033
+ // 更新总的 selectedRows
1034
+ // 1. 保留不在当前页的已选中行,并去重
1035
+ const otherPageSelectedRows = this.selectedRows.filter(row =>
1036
+ !currentPageAllKeys.includes(row[primaryKeyName])
1037
+ )
1038
+ // 2. 合并结果,使用 Map 去重
1039
+ const rowsMap = new Map()
1040
+ // 先添加其他页面的行
1041
+ otherPageSelectedRows.forEach(row => {
1042
+ rowsMap.set(row[primaryKeyName], row)
1043
+ })
1044
+ // 再添加当前页面的行(会覆盖重复的)
1045
+ currentPageSelectedRows.forEach(row => {
1046
+ rowsMap.set(row[primaryKeyName], row)
1047
+ })
1048
+ this.selectedRows = Array.from(rowsMap.values())
1049
+ console.log('onSelectChange - updated selectedRows:', this.selectedRows)
1050
+ } else {
1051
+ // 如果没有主键,则直接使用当前选中的行(此情况可能无法跨页选中,但为了兼容保留)
1052
+ this.selectedRowKeys = currentPageSelectedKeys
1053
+ this.selectedRows = currentPageSelectedRows
1054
+ }
1055
+ } else {
1056
+ // 非 listView 模式或 clearSelectRowAfterQuery 为 true,直接使用当前页的选中状态作为总状态
1057
+ this.selectedRowKeys = currentPageSelectedKeys
1058
+ this.selectedRows = currentPageSelectedRows
1059
+ }
1060
+
1061
+ // 更新内部状态和表格显示
1062
+ this.innerSelectedRowKeys = currentPageSelectedKeys
1063
+ this.innerSelectedRows = currentPageSelectedRows
1064
+
1065
+ // 确保在DOM更新后调用 updateSelect,以正确反映当前页的选中状态
1066
+ this.$nextTick(() => {
1067
+ this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
1068
+ })
1069
+
1070
+ // 更新按钮状态基于总选中数量
1071
+ this.isModify = this.selectedRowKeys.length === 1
1072
+ this.isDelete = this.selectedRowKeys.length > 0
1073
+ this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
1074
+
1075
+ // 触发选择事件,传递总的选中数据
1076
+ this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
1077
+ },
1078
+ /**
1079
+ * 清除表格选中项
1080
+ */
1081
+ clearRowKeys () {
1082
+ this.$refs.table.clearSelected()
1083
+ },
1084
+ /**
1085
+ * 为表格附加查询条件
1086
+ */
1087
+ setQueryForm (form = {}) {
1088
+ this.form = form
1089
+ if (this.createdQuery) {
1090
+ this.refresh(true)
1091
+ } else {
1092
+ this.createdQuery = true
1093
+ }
1094
+ },
1095
+ /**
1096
+ * 表格重新加载方法
1097
+ * 如果参数为 true, 则强制刷新到第一页
1098
+ */
1099
+ refresh (bool) {
1100
+ this.$nextTick(() => {
1101
+ this.$refs.table.refresh(bool)
1102
+ })
1103
+ },
1104
+ setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
1105
+ this.$nextTick(() => {
1106
+ setTimeout(() => {
1107
+ const curDocument = window?.rawDocument || document
1108
+ const innerHeight = window?.rawWindow?.innerHeight || window.innerHeight || 0
1109
+ if (typeof extraHeight == 'undefined') {
1110
+ // 默认底部分页32 + 边距48
1111
+ extraHeight = 48 + 32
1112
+ }
1113
+ let tHeader = null
1114
+ if (id) {
1115
+ tHeader = curDocument.getElementById(id) ? curDocument.getElementById(id).getElementsByClassName('ant-table-thead')[0] : null
1116
+ } else {
1117
+ tHeader = curDocument.getElementsByClassName('ant-table-thead')[0]
1118
+ }
1119
+ // 表格内容距离顶部的距离
1120
+ let tHeaderBottom = 0
1121
+ if (tHeader) {
1122
+ tHeaderBottom = tHeader.getBoundingClientRect().bottom
1123
+ }
1124
+ if (tHeaderBottom === 0) {
1125
+ this.scrollYHeight = 'calc(100vh - 31rem)'
1126
+ if (window.__MICRO_APP_ENVIRONMENT__) {
1127
+ this.scrollYHeight = 'calc(100vh - 28.5rem)'
1128
+ }
1129
+ return
1130
+ }
1131
+
1132
+ // 判断是否在 modal 中
1133
+ if (this.isInAModal()) {
1134
+ let modalElement = null
1135
+ if (tHeader) {
1136
+ modalElement = tHeader.closest('.ant-modal-body')
1137
+ } else {
1138
+ modalElement = curDocument.querySelector('.ant-modal-body')
1139
+ }
1140
+ if (modalElement) {
1141
+ const modalRect = modalElement.getBoundingClientRect()
1142
+ // 48 是 modal 通常的边距 32 是分页
1143
+ extraHeight = innerHeight - modalRect.bottom + 32 + 48
1144
+ }
1145
+ }
1146
+ if (innerHeight - (tHeaderBottom + extraHeight) < 210) {
1147
+ this.scrollYHeight = 'calc(100vh - 31rem)'
1148
+ return
1149
+ }
1150
+ // 窗体高度-表格内容顶部的高度-表格内容底部的高度
1151
+ // this.scrollYHeight = document.body.clientHeight - tHeaderBottom - extraHeight
1152
+ this.scrollYHeight = `calc(100vh - ${tHeaderBottom + extraHeight}px)`
1153
+ }, 60)
1154
+ })
1155
+ },
1156
+ /**
1157
+ * 获取主键列名称
1158
+ */
1159
+ getPrimaryKeyName () {
1160
+ if (this.primaryKey) {
1161
+ return this.primaryKey
1162
+ }
1163
+ const indexColumn = this.tableColumns.find(i => i?.slotType === 'index')
1164
+ return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
1165
+ },
1166
+ handleExport (type) {
1167
+ this.$refs.exportExcel.handleExport(type, this.title)
1168
+ },
1169
+ handlePrint (type) {
1170
+ const printData = {
1171
+ title: this.title,
1172
+ form: this.form,
1173
+ operaInfo: this.currUser.operaInfo,
1174
+ operaTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1175
+ summary: this.retrieveSummaryData
1176
+ }
1177
+ this.$refs.exportExcel.handlePrint(type, printData)
1178
+ },
1179
+ validateTableAndSyncData (currRow, defaultAppendRowData) {
1180
+ let isLastRow = false
1181
+ if (this.localEditModeDataSource.length === 0) {
1182
+ isLastRow = true
1183
+ } else if (currRow['序号'] === this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号']) {
1184
+ isLastRow = true
1185
+ }
1186
+ if (isLastRow) {
1187
+ this.appendLocalData(defaultAppendRowData)
1188
+ }
1189
+ },
1190
+ // 新增业务
1191
+ add () {
1192
+ if (this.eventState?.customAdd) {
1193
+ this.custom('customAdd', {})
1194
+ return
1195
+ }
1196
+ if (this.localEditMode && this.isEditMode) {
1197
+ this.appendLocalData({})
1198
+ } else {
1199
+ this.$emit('add')
1200
+ }
1201
+ },
1202
+ // 添加业务
1203
+ move () {
1204
+ this.$emit('move')
1205
+ },
1206
+ // 通用事件业务
1207
+ custom (func) {
1208
+ this.$emit('customEvent', func)
1209
+ },
1210
+ // 编辑业务
1211
+ edit (id) {
1212
+ this.editLoading = true
1213
+ this.getEditData(id).then(modifyModelData => {
1214
+ if (this.eventState?.customEdit) {
1215
+ this.custom('customEdit', { id, modifyModelData })
1216
+ return
1217
+ }
1218
+ this.$emit('edit', modifyModelData)
1219
+ this.editLoading = false
1220
+ })
1221
+ },
1222
+ // 行选择业务
1223
+ choose () {
1224
+ if (this.isChoose) {
1225
+ // 如果配置了自定义函数
1226
+ this.$emit('rowChoose', this.selectedRows)
1227
+ } else {
1228
+ this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1229
+ }
1230
+ },
1231
+ // 自定义按钮点击
1232
+ editButtonStateDataClick (index) {
1233
+ this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1234
+ },
1235
+ // 获取被编辑的数据
1236
+ getEditData (id) {
1237
+ if (!id) {
1238
+ this.selectId = this.selectedRowKeys[0]
1239
+ } else {
1240
+ this.selectId = id
1241
+ }
1242
+ const primaryKeyName = this.getPrimaryKeyName()
1243
+ if (this.tableColumns[0].dataIndex !== primaryKeyName) {
1244
+ this.selectId = this.selectedRows[0][primaryKeyName]
1245
+ }
1246
+ // 将更新需要的主键值加入到primaryKeyData中
1247
+ const primaryKeyData = {}
1248
+ primaryKeyData[primaryKeyName] = this.selectId
1249
+ if (this.localEditMode) {
1250
+ return new Promise((resolve) => {
1251
+ const modifyData = this.getDataByRowKeyValue(this.selectId)
1252
+ resolve({
1253
+ data: modifyData,
1254
+ primaryKeyData: primaryKeyData
1255
+ })
1256
+ })
1257
+ }
1258
+ const requestParameters = {
1259
+ queryParamsName: this.queryParamsName,
1260
+ queryParams: this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined,
1261
+ conditionParams: {},
1262
+ pageNo: 1,
1263
+ pageSize: 1
1264
+ }
1265
+ requestParameters.conditionParams[primaryKeyName] = this.selectId
1266
+ requestParameters.f_businessid = this.selectId
1267
+ return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1268
+ return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1269
+ })
1270
+ },
1271
+ // 删除业务
1272
+ deleteItem () {
1273
+ if (this.viewMode) {
1274
+ this.$message.info('预览模式禁止删除')
1275
+ return
1276
+ }
1277
+ Modal.confirm({
1278
+ title: '提示',
1279
+ content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
1280
+ zIndex: 1001,
1281
+ onOk: () => {
1282
+ const requestParameters = {
1283
+ queryParamsName: this.queryParamsName,
1284
+ idList: this.selectedRowKeys
1285
+ }
1286
+ if (this.eventState?.customDelete) {
1287
+ this.custom('customDelete', {
1288
+ selectedRowKeys: this.selectedRowKeys,
1289
+ selectedRows: this.selectedRows
1290
+ })
1291
+ return
1292
+ }
1293
+ return new Promise((resolve, reject) => {
1294
+ if (this.localEditMode) {
1295
+ this.localEditModeDataSource = this.getLocalData().filter(item => !this.selectedRowKeys.includes(item[this.rowKey]))
1296
+ resolve(200)
1297
+ this.$message.success('删除成功!')
1298
+ this.refresh(true)
1299
+ // afterDelete
1300
+ this.$emit('afterDelete', requestParameters)
1301
+ } else if (this.customDelete) {
1302
+ this.$emit('del', this.selectedRows, resolve)
1303
+ } else {
1304
+ remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1305
+ resolve(res)
1306
+ this.$message.success('删除成功!')
1307
+ this.refresh(true)
1308
+ // afterDelete
1309
+ this.$emit('afterDelete', requestParameters)
1310
+ }).catch(e => {
1311
+ reject(e)
1312
+ this.$message.error('删除失败!')
1313
+ })
1314
+ }
1315
+ })
1316
+ },
1317
+ onCancel () {
1318
+ }
1319
+ })
1320
+ },
1321
+ // 导入业务
1322
+ importData () {
1323
+ this.$refs.importExcel.importExcelHandleOpen()
1324
+ },
1325
+ afterVisibleChange (val) {
1326
+ if (val) {
1327
+ this.retrieveSummaryData()
1328
+ }
1329
+ },
1330
+ async retrieveSummaryData () {
1331
+ const promises = []
1332
+
1333
+ if (this.requestParameters.querySummary) {
1334
+ const querySummaryPromise = querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1335
+ .then(res => {
1336
+ if (this.compatible === 'V3') {
1337
+ res = res.data
1338
+ }
1339
+ if (res.length > 0) {
1340
+ this.summaryData.forEach(item => {
1341
+ res.forEach(summary => {
1342
+ if (item.title === summary.title) {
1343
+ item.value = summary.value
1344
+ item.success = true
1345
+ item.loading = false
1346
+ }
1347
+ })
1348
+ })
1349
+ }
1350
+ })
1351
+ promises.push(querySummaryPromise)
1352
+ }
1353
+
1354
+ if (this.showCustomSummary) {
1355
+ this.customSummaryArray.forEach(item => {
1356
+ const runLogicPromise = runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1357
+ .then(res => {
1358
+ this.summaryData.forEach(summary => {
1359
+ if (item.key === summary.key) {
1360
+ summary.value = res.value
1361
+ summary.success = true
1362
+ summary.loading = false
1363
+ }
1364
+ })
1365
+ })
1366
+ .catch(e => {
1367
+ this.summaryData.forEach(summary => {
1368
+ if (item.key === summary.key) {
1369
+ summary.value = 0
1370
+ summary.success = false
1371
+ summary.loading = false
1372
+ }
1373
+ })
1374
+ })
1375
+ promises.push(runLogicPromise)
1376
+ })
1377
+ }
1378
+
1379
+ await Promise.all(promises)
1380
+ return this.summaryData
1381
+ },
1382
+ showDrawer () {
1383
+ if (this.summaryUpdate) {
1384
+ this.summaryData.forEach(item => {
1385
+ item.loading = true
1386
+ item.success = false
1387
+ item.value = ' '
1388
+ })
1389
+ this.summaryDrawerVisible = true
1390
+ } else {
1391
+ this.$message.warning('请查询后再来查看')
1392
+ }
1393
+ },
1394
+ onClose () {
1395
+ this.summaryDrawerVisible = false
1396
+ },
1397
+ // 获取表格内所有数据
1398
+ getTableData () {
1399
+ return this.$refs.table.localDataSource
1400
+ },
1401
+ // 设置表格内数据
1402
+ setTableData (data) {
1403
+ if (this.localEditMode) {
1404
+ // 本地编辑模式下,需要修改 localEditModeDataSource
1405
+ this.localEditModeDataSource = data.map((item, index) => ({
1406
+ ...item,
1407
+ 序号: index + 1
1408
+ }))
1409
+ this.$nextTick(() => {
1410
+ this.$refs.table?.refresh()
1411
+ })
1412
+ } else {
1413
+ // 普通模式
1414
+ this.$nextTick(() => {
1415
+ if (this.$refs.table) {
1416
+ this.$refs.table.setLocalDataSource(data)
1417
+ }
1418
+ })
1419
+ }
1420
+ },
1421
+ // 获取所有本地数据
1422
+ getLocalData () {
1423
+ return this.localEditModeDataSource
1424
+ },
1425
+ // 获取指定rowKey的value的本地数据
1426
+ getDataByRowKeyValue (rowKeyValue) {
1427
+ return this.getLocalData().find(item => {
1428
+ return item[this.rowKey] === rowKeyValue
1429
+ })
1430
+ },
1431
+ // 修改本地数据
1432
+ modifyLocalData (rowKeyValue, data) {
1433
+ const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1434
+ if (modifyItem) {
1435
+ Object.assign(modifyItem, data)
1436
+ }
1437
+ },
1438
+ // 追加本地数据
1439
+ appendLocalData (item) {
1440
+ if (this.localEditModeDataSource.length === 0) {
1441
+ item['序号'] = 1
1442
+ } else {
1443
+ item['序号'] = this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号'] + 1
1444
+ }
1445
+ this.localEditModeDataSource.push(item)
1446
+ },
1447
+ handleRowClick (record) {
1448
+ this.$emit('rowClick', record)
1449
+ },
1450
+ beforeDataChange (record) {
1451
+ this.$emit('beforeDataChange', record)
1452
+ },
1453
+ onExpand (expanded, record) {
1454
+ this.$emit('expand', expanded, record)
1455
+ },
1456
+ // 添加新方法处理表格选中状态
1457
+ updateTableSelection (selectedKeys) {
1458
+ console.log('selectedKeys', selectedKeys)
1459
+ if (!this.$refs.table) {
1460
+ return
1461
+ }
1462
+
1463
+ // 检查数据是否已加载
1464
+ if (!this.$refs.table.localDataSource || this.$refs.table.localDataSource.length === 0) {
1465
+ // 等待数据加载完成后再处理
1466
+ const checkDataLoaded = () => {
1467
+ if (this.$refs.table.localDataSource && this.$refs.table.localDataSource.length > 0) {
1468
+ this.doUpdateTableSelection(selectedKeys)
1469
+ } else {
1470
+ setTimeout(checkDataLoaded, 100)
1471
+ }
1472
+ }
1473
+ checkDataLoaded()
1474
+ return
1475
+ }
1476
+
1477
+ this.doUpdateTableSelection(selectedKeys)
1478
+ },
1479
+
1480
+ // 实际执行更新选中状态的方法
1481
+ doUpdateTableSelection (selectedKeys) {
1482
+ const primaryKeyName = this.primaryKey || this.rowKey
1483
+
1484
+ // 更新内部选中状态
1485
+ this.selectedRowKeys = [...selectedKeys]
1486
+ this.innerSelectedRowKeys = this.$refs.table.localDataSource
1487
+ .filter(row => selectedKeys.includes(row[primaryKeyName]))
1488
+ .map(row => row[primaryKeyName])
1489
+
1490
+ // 更新选中行数据
1491
+ this.selectedRows = this.$refs.table.localDataSource.filter(row =>
1492
+ selectedKeys.includes(row[primaryKeyName])
1493
+ )
1494
+ this.innerSelectedRows = this.selectedRows
1495
+
1496
+ // 更新表格选中状态
1497
+ if (this.selectRowMode !== 'disabled' && !this.clearSelectRowAfterQuery) {
1498
+ this.$refs.table.updateSelect(this.innerSelectedRowKeys, this.innerSelectedRows)
1499
+ }
1500
+
1501
+ // 更新按钮状态
1502
+ this.isModify = this.selectedRowKeys.length === 1
1503
+ this.isDelete = this.selectedRowKeys.length > 0
1504
+ this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
1505
+
1506
+ // 触发选择事件
1507
+ this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
1508
+ }
1509
+ }
1510
+ }
1511
+ </script>
1512
+ <style lang="less" scoped>
1513
+
1514
+ .custom-chart-title {
1515
+ font-size: 16px;
1516
+ font-weight: 700;
1517
+ margin-bottom: 8px;
1518
+ }
1519
+
1520
+ .custom-chart-desc {
1521
+ font-size: 12px;
1522
+ color: rgba(0, 0, 0, .45);
1523
+ margin-bottom: 16px;
1524
+ }
1525
+
1526
+ :deep(.ant-table-thead > tr > th) {
1527
+ font-weight: 600;
1528
+ }
1529
+
1530
+ :deep(.table-wrapper .ant-pagination) {
1531
+ display: flex;
1532
+ flex-direction: row;
1533
+ align-items: center;
1534
+ padding: 0;
1535
+ }
1536
+
1537
+ :deep(.table-wrapper .ant-pagination .ant-pagination-total-text) {
1538
+ white-space: nowrap;
1539
+ }
1540
+
1541
+ :deep(.ant-table td) {
1542
+ white-space: nowrap;
1543
+ }
1544
+
1545
+ .footer_sum_title {
1546
+ color: @primary-color;
1547
+ font-weight: bold;
1548
+ }
1549
+
1550
+ .footer_sum_item {
1551
+ white-space: nowrap;
1552
+ }
1553
+
1554
+ .ant-btn-hover {
1555
+ border-color: @primary-color;
1556
+ color: @primary-color;
1557
+ }
1558
+
1559
+ .innerTable {
1560
+ :deep(.ant-form-item) {
1561
+ margin: 0;
1562
+ }
1563
+ }
1564
+ </style>