vue2-client 1.19.81 → 1.19.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.19.81",
3
+ "version": "1.19.83",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -623,6 +623,11 @@ export default {
623
623
  Object.assign(this.fixedQueryForm, prefixedData)
624
624
  },
625
625
 
626
+ // 固定条件(key 已包含表别名,不再处理)
627
+ setFixedQueryFormWithAlias (data) {
628
+ Object.assign(this.fixedQueryForm, data)
629
+ },
630
+
626
631
  importExcelOk (data) {
627
632
  this.$emit('importExcelOk', data)
628
633
  },
@@ -3,7 +3,15 @@
3
3
  <x-form-table
4
4
  title="示例表单"
5
5
  :queryParamsName="queryParamsName"
6
- serviceName="af-linepatrol"
6
+ :fixedAddForm="fixedAddForm"
7
+ :externalSelectedRowKeys="selectedKeys"
8
+ @action="action"
9
+ @selectRow="selectRow"
10
+ @columnClick="columnClick"
11
+ @ceshi="ceshi"
12
+ @rowDblClick="rowDblClick"
13
+ :defaultPageSize="5"
14
+ serviceName="af-revenue"
7
15
  ref="xFormTable"
8
16
  ></x-form-table>
9
17
  </a-card>
@@ -20,7 +28,7 @@ export default {
20
28
  data() {
21
29
  return {
22
30
  // 查询配置文件名
23
- queryParamsName: 't_subhighpressure_pipelineCRUD',
31
+ queryParamsName: 'address_management',
24
32
  // 查询配置左侧tree
25
33
  xTreeConfigName: 'addressType',
26
34
  // 新增表单固定值
@@ -16,6 +16,7 @@
16
16
  <!-- 表格区域 -->
17
17
  <div class="table-container" :class="{ 'table-report-mode': isReportMode }" :style="{ height: tableHeight }">
18
18
  <a-table
19
+ :loading="loading"
19
20
  :columns="processedColumns"
20
21
  :dataSource="tableData"
21
22
  :pagination="false"
@@ -54,16 +55,15 @@ export default {
54
55
  scrollY: undefined,
55
56
  rowStyleConfig: {},
56
57
  isReportMode: false,
57
- // 标题数据 - 添加 show 字段
58
+ // 标题数据
58
59
  titleData: {
59
- // 默认不显示
60
60
  show: false,
61
61
  text: '',
62
62
  value: null,
63
63
  line: false
64
64
  },
65
- // 从配置中读取的数据模式
66
- dataMode: 'normal'
65
+ dataMode: 'normal',
66
+ loading: false // 新增加载状态
67
67
  }
68
68
  },
69
69
  watch: {
@@ -75,7 +75,6 @@ export default {
75
75
  }
76
76
  },
77
77
  computed: {
78
- // 是否显示标题 - 必须明确配置 show: true 才显示
79
78
  showTitle () {
80
79
  return this.titleData.show === true && (this.titleData.text || this.titleData.value !== null)
81
80
  },
@@ -272,67 +271,89 @@ export default {
272
271
  }
273
272
  },
274
273
 
274
+ // 修改 init 为返回 Promise,并添加 loading 控制
275
275
  init (config, parameterData) {
276
- getConfigByName(config, 'af-his', res => {
277
- this.tableHeight = res.tableHeight || '400px'
278
- this.columns = res.columns || []
279
-
280
- this.rowStyleConfig = res.rowStyle || {}
281
-
282
- // 从配置中读取数据模式
283
- this.dataMode = res.dataMode || 'normal'
284
-
285
- // 从 $attrs 判断是否启用报表模式
286
- this.isReportMode = this.$attrs['report-mode'] === true ||
287
- this.$attrs['report-mode'] === '' ||
288
- this.$attrs['report-mode'] === 'true'
289
-
290
- // 读取标题配置,默认不显示
291
- const titleConfig = res.titleConfig || {}
292
- this.titleData = {
293
- // 默认 false
294
- show: titleConfig.show || false,
295
- text: titleConfig.text || '',
296
- line: titleConfig.line || false,
297
- value: null
298
- }
276
+ return new Promise((resolve, reject) => {
277
+ this.loading = true // 开始加载
278
+
279
+ getConfigByName(config, 'af-his', res => {
280
+ // 配置获取成功
281
+ this.tableHeight = res.tableHeight || '400px'
282
+ this.columns = res.columns || []
283
+ this.rowStyleConfig = res.rowStyle || {}
284
+ this.dataMode = res.dataMode || 'normal'
285
+
286
+ // 报表模式判断
287
+ this.isReportMode = this.$attrs['report-mode'] === true ||
288
+ this.$attrs['report-mode'] === '' ||
289
+ this.$attrs['report-mode'] === 'true'
290
+
291
+ // 标题配置
292
+ const titleConfig = res.titleConfig || {}
293
+ this.titleData = {
294
+ show: titleConfig.show || false,
295
+ text: titleConfig.text || '',
296
+ line: titleConfig.line || false,
297
+ value: null
298
+ }
299
299
 
300
- runLogic(res.logicName, parameterData, 'af-his').then(result => {
301
- // 根据配置中的dataMode处理返回的数据
302
- if (this.dataMode === 'title' && result && typeof result === 'object') {
303
- if (result.title) {
304
- // 如果接口返回了title,则显示标题(即使配置中show: false)
305
- this.titleData.show = true
306
- this.titleData = {
307
- ...this.titleData,
308
- ...result.title,
309
- value: result.title.value !== undefined ? result.title.value : result.title.count
300
+ // 执行逻辑获取数据
301
+ runLogic(res.logicName, parameterData, 'af-his')
302
+ .then(result => {
303
+ // 根据 dataMode 处理返回数据
304
+ if (this.dataMode === 'title' && result && typeof result === 'object') {
305
+ if (result.title) {
306
+ this.titleData.show = true
307
+ this.titleData = {
308
+ ...this.titleData,
309
+ ...result.title,
310
+ value: result.title.value !== undefined ? result.title.value : result.title.count
311
+ }
312
+ }
313
+ this.tableData = result.data || []
314
+ } else {
315
+ this.tableData = Array.isArray(result) ? result : []
310
316
  }
311
- }
312
317
 
313
- this.tableData = result.data || []
314
- } else {
315
- // 普通模式:返回的是数组
316
- this.tableData = Array.isArray(result) ? result : []
317
- }
318
+ // 标题数据补全
319
+ if (this.titleData.show) {
320
+ if (this.titleData.value === null || this.titleData.value === undefined) {
321
+ this.titleData.value = this.tableData.length
322
+ }
323
+ }
318
324
 
319
- // 只有在显示标题的情况下才设置value
320
- if (this.titleData.show) {
321
- if (this.titleData.value === null || this.titleData.value === undefined) {
322
- this.titleData.value = this.tableData.length
323
- }
324
- }
325
+ // 添加 key
326
+ this.tableData = this.tableData.map((item, index) => ({
327
+ ...item,
328
+ key: item[this.rowKey] || `row_${index}`
329
+ }))
325
330
 
326
- this.tableData = this.tableData.map((item, index) => ({
327
- ...item,
328
- key: item[this.rowKey] || `row_${index}`
329
- }))
331
+ this.$nextTick(() => {
332
+ this.scrollY = this.tableHeight
333
+ })
330
334
 
331
- this.$nextTick(() => {
332
- this.scrollY = this.tableHeight
333
- })
335
+ resolve(result) // 成功 resolve
336
+ })
337
+ .catch(error => {
338
+ console.error('数据加载失败', error)
339
+ reject(error) // 失败 reject
340
+ })
341
+ .finally(() => {
342
+ this.loading = false // 无论成功或失败,最终关闭 loading
343
+ })
344
+ }, error => {
345
+ // getConfigByName 错误回调
346
+ console.error('配置获取失败', error)
347
+ this.loading = false
348
+ reject(error)
334
349
  })
335
350
  })
351
+ },
352
+
353
+ // 刷新表格方法,返回 Promise 以便外部可 await
354
+ refreshTable (parameterData) {
355
+ const params = parameterData !== undefined ? parameterData : this.parameter
356
+ return this.init(this.queryParamsName, params)
336
357
  }
337
358
  }
338
359
  }
@@ -95,7 +95,7 @@ routerResource.XReportView = () => import('@vue2-client/pages/XReportView')
95
95
 
96
96
  routerResource.XReportGrid = () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo')
97
97
 
98
- routerResource.XTab = () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue')
98
+ routerResource.XTab = () => import('@vue2-client/base-client/components/common/AfMap/demo.vue')
99
99
  routerResource.addressManage = () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue')
100
100
  // 大屏界面, 放行登录
101
101
  routerResource.bigDashboard = () => import('@vue2-client/pages/dashboard/index.vue')