agilebuilder-ui 1.0.84 → 1.0.85-temp2

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.
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <el-table-column
3
+ align="center"
4
+ :class-name="column.prop"
5
+ fixed="left"
6
+ header-align="center"
7
+ :prop="column.prop"
8
+ :width="80"
9
+ :label="column.label"
10
+ >
11
+ <template v-slot="scope">
12
+ <el-icon @click="showDetail(scope.$index)"><ElView /></el-icon>
13
+ </template>
14
+ </el-table-column>
15
+ </template>
16
+
17
+ <script>
18
+ import { View as ElView } from '@element-plus/icons-vue'
19
+ export default {
20
+ name: 'RowDetail',
21
+ components: {
22
+ ElView
23
+ },
24
+ props: {
25
+ column: {
26
+ type: Object,
27
+ default: null
28
+ },
29
+ listCode: {
30
+ type: String,
31
+ default: null
32
+ }
33
+ },
34
+ data() {
35
+ },
36
+ computed: {
37
+ },
38
+ created() {
39
+ },
40
+ methods: {
41
+ showDetail(rowIndex) {
42
+ this.$emit('show-detail', rowIndex)
43
+ }
44
+ }
45
+ }
46
+ </script>
47
+
48
+ <style lang="scss" scoped>
49
+
50
+ </style>
@@ -462,10 +462,15 @@ export default {
462
462
  ...searchMethods,
463
463
  getDynamicDataSourceOptions(column) {
464
464
  const gridParams = store.get(this.code)
465
+ let baseURL = gridParams.options.backendUrl
466
+ if (!baseURL) {
467
+ baseURL = window.$vueApp.config.globalProperties.baseURL
468
+ }
465
469
  return getDynamicDataSourceOptions(
466
470
  column,
467
471
  this.isSql,
468
- gridParams.additionalParamMap
472
+ gridParams.additionalParamMap,
473
+ baseURL
469
474
  )
470
475
  },
471
476
  // 值设置是否是动态数据源类型的数据源
@@ -321,10 +321,15 @@ export default {
321
321
  ...searchMethods,
322
322
  getDynamicDataSourceOptions(column) {
323
323
  const gridParams = store.get(this.code)
324
+ let baseURL = gridParams.options.backendUrl
325
+ if (!baseURL) {
326
+ baseURL = window.$vueApp.config.globalProperties.baseURL
327
+ }
324
328
  return getDynamicDataSourceOptions(
325
329
  column,
326
330
  this.isSql,
327
- gridParams.additionalParamMap
331
+ gridParams.additionalParamMap,
332
+ baseURL
328
333
  )
329
334
  },
330
335
  // 值设置是否是动态数据源类型的数据源
@@ -192,6 +192,7 @@ const superGridService = {
192
192
  ? this.isShowPage
193
193
  : false
194
194
  gridParams.isSubTableShowPage = this.isSubTableShowPage
195
+ this.getDetailColumn()
195
196
  this.hasLoadedColumns = true
196
197
  let canFetchData = true
197
198
  if (isHasOptionFunction('loadBeforeSend', this.code)) {
@@ -249,6 +250,45 @@ const superGridService = {
249
250
  console.log('初始化所耗时间', a1 - a)
250
251
  })
251
252
  },
253
+ getDetailColumn() {
254
+ if (this.isFormSubTable && this.options.showRowForm) {
255
+ // 显示详情列
256
+ const detailColumn = {
257
+ "prop": "$detail",
258
+ "orgProp": "$detail",
259
+ "label": "详情",
260
+ "dataType": "TEXT",
261
+ "width": 80,
262
+ "show": true,
263
+ "exportable": false,
264
+ "sortable": "false",
265
+ "filterable": false,
266
+ "fixed": "left",
267
+ "span": false,
268
+ "queryType": "no",
269
+ "querySetting": "{}",
270
+ "editable": false,
271
+ "componentType": "input",
272
+ "titleAlign": "center",
273
+ "contAlign": "center",
274
+ "showType": "default",
275
+ "exportType": "default",
276
+ "displayOrderType": "default",
277
+ "displayOrder": 5,
278
+ "widthType": "default",
279
+ "ifMultiData": true,
280
+ "dynamic": false,
281
+ "total": false,
282
+ "custom": true,
283
+ "remoteEnum": false,
284
+ "fuzzy": true,
285
+ "groupHeader": false
286
+ }
287
+ detailColumn.label = this.$t('superGrid.detail')
288
+ this.detailColumn = detailColumn
289
+ console.log('getDetailColumn----this.detailColumn=', this.detailColumn)
290
+ }
291
+ },
252
292
  getListViewSetting(additionalParams) {
253
293
  return new Promise((resolve, reject) => {
254
294
  console.log('getListViewSetting--this.settings====', this.settings)
@@ -75,6 +75,11 @@
75
75
  @cell-click="selectCell"
76
76
  @cell-dblclick="cellDblClick"
77
77
  >
78
+ <row-detail v-if="detailColumn"
79
+ :column="detailColumn"
80
+ :list-code="code"
81
+ @show-detail="openRowForm"
82
+ />
78
83
  <template v-if="myCustomFormatter">
79
84
  <component
80
85
  :is="getComponentType(column)"
@@ -205,14 +210,34 @@
205
210
  :column="rightClickColumn"
206
211
  @clearHeaderContextmenu="clearHeaderContextmenu"
207
212
  />
208
- <!-- <super-page-dialog
209
- v-if="isShowPageDialog"
210
- :dev-mode="pageDevMode"
211
- :jump-page-setting="jumpPageSetting"
212
- :source-page-code="pageCode"
213
- @close="closePageDialog"
214
- @update-value="updateValues"
215
- /> -->
213
+ <row-form
214
+ v-if="showRowForm"
215
+ :parent-form-data="parentFormData"
216
+ :columns="visibleColumns"
217
+ :row-index="currentEditRowIndex"
218
+ :list-code="code"
219
+ :drag-column-prop="dragColumnProp"
220
+ :is-sql="isSql"
221
+ :base-url="baseURL"
222
+ :options="options"
223
+ :table-name="tableName"
224
+ :page-code="pageCode"
225
+ :list-toolbar-form-data="listToolbarFormData"
226
+ :list-name="listName"
227
+ :current-page="currentPage"
228
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
229
+ :page-grid-data="
230
+ isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
231
+ "
232
+ :line-edit="lineEdit"
233
+ @close="closeRowForm"
234
+ @refresData="refresData"
235
+ @refresPortData="refresPortData"
236
+ @refresPortsData="refresPortsData"
237
+ @refresMainTableFields="refresMainTableFields"
238
+ @open-page="openPageDialog"
239
+ @prohibitToEdit="prohibitToEdit"
240
+ />
216
241
  </div>
217
242
  </template>
218
243
 
@@ -226,6 +251,7 @@ import GroupColumn from './group-column.vue'
226
251
  import ColumnsConfig from './columns-config.vue'
227
252
  import SearchForm from './search-form.vue'
228
253
  import searchFormDialog from './search-form-dialog.vue'
254
+ import RowDetail from './row-detail.vue'
229
255
  import {getEntityFieldValueWithOutCase, setEntityFieldValue} from '../../../src/utils/util'
230
256
  import eventBus from './eventBus'
231
257
  import {
@@ -266,6 +292,7 @@ export default {
266
292
  searchFormDialog,
267
293
  ElIconSetting,
268
294
  ElIconRefresh,
295
+ RowDetail
269
296
  },
270
297
  name: 'SuperGrid',
271
298
  props: {
@@ -461,7 +488,11 @@ export default {
461
488
  configureObj, // 表格配置信息
462
489
  isMobile, // 是否是移动端
463
490
  isShowMobileSearch: false, // 是否显示移动端查询区域
464
- subTableStyle: {}
491
+ subTableStyle: {},
492
+ detailColumn: null, // 详情列。子表展开表单 配置使用。
493
+ currentEditRowIndex: null, // 当前查看的行记录号
494
+ showRowForm: false, // 是否显示行记录详情
495
+ baseURL: null
465
496
  }
466
497
  },
467
498
  computed: {
@@ -976,20 +1007,27 @@ export default {
976
1007
  gridParams.options.formSetHeight
977
1008
  ) {
978
1009
  tempMaxHeight = gridParams.options.formSetHeight
979
- } else if (
980
- !this.basicInfo.displayEffect ||
981
- this.basicInfo.displayEffect === '' ||
982
- this.basicInfo.displayEffect === 'default'
983
- ) {
984
- tempMaxHeight = null
985
1010
  }
1011
+ // else if (
1012
+ // !this.basicInfo.displayEffect ||
1013
+ // this.basicInfo.displayEffect === '' ||
1014
+ // this.basicInfo.displayEffect === 'default'
1015
+ // ) {
1016
+ // tempMaxHeight = null
1017
+ // }
986
1018
  // if(tempHeight !== undefined && tempHeight !== null){
987
1019
  // // el-table的height和maxHeight不能同时设值,会导致列表渲染失败,报脚本错.设置height不起作用,都使用maxHeight控制列表高度吧,暂时不知道原因
988
1020
  // this.tableHeight = tempHeight
989
1021
  // }
990
1022
  }
991
- if(tempMaxHeight !== undefined && tempMaxHeight !== null){
1023
+ if(!this.basicInfo.displayEffect ||
1024
+ this.basicInfo.displayEffect === '' ||
1025
+ this.basicInfo.displayEffect === 'default'){
1026
+ // default默认不铺满
992
1027
  this.maxHeight = tempMaxHeight
1028
+ } else {
1029
+ // 表示需要cover铺满
1030
+ this.tableHeight = tempMaxHeight
993
1031
  }
994
1032
  console.log('resizeTableHeight-----tempMaxHeight=',tempMaxHeight,'this.tableHeight=',this.tableHeight,'this.maxHeight=', this.maxHeight ,'gridParams.options=', gridParams.options)
995
1033
  })
@@ -1341,6 +1379,15 @@ export default {
1341
1379
  ) {
1342
1380
  gridParams.additionalParamMap = this.options.additionalParamMap
1343
1381
  }
1382
+
1383
+ let baseURL
1384
+ if (gridParams.options && gridParams.options.backendUrl) {
1385
+ baseURL = gridParams.options.backendUrl
1386
+ }
1387
+ if (!baseURL) {
1388
+ baseURL = window.$vueApp.config.globalProperties.baseURL
1389
+ }
1390
+ this.baseURL = baseURL
1344
1391
  },
1345
1392
  changeRowStyle(param) {
1346
1393
  // param的格式:{row, rowIndex}
@@ -2303,7 +2350,8 @@ export default {
2303
2350
  }
2304
2351
  if (
2305
2352
  gridParams.query &&
2306
- typeof gridParams.query.defaultQueryCriteria !== 'undefined'
2353
+ typeof gridParams.query.defaultQueryCriteria !== 'undefined' &&
2354
+ gridParams.query.defaultQueryCriteria !== ''
2307
2355
  ) {
2308
2356
  // json字符串转数组
2309
2357
  searchParam.defaultQueryCriteria = JSON.parse(
@@ -2323,15 +2371,10 @@ export default {
2323
2371
  }
2324
2372
  const additionalParamMap = gridParams.additionalParamMap
2325
2373
  if (additionalParamMap) {
2326
- console.log('getSearchParam---additionalParamMap=', additionalParamMap)
2327
2374
  if (additionalParamMap && typeof additionalParamMap === 'object') {
2328
2375
  searchParam.additionalParamMap = additionalParamMap
2329
2376
  } else if (additionalParamMap && additionalParamMap !== '') {
2330
- try {
2331
- searchParam.additionalParamMap = JSON.parse(additionalParamMap)
2332
- } catch (error) {
2333
- console.error('error=', error)
2334
- }
2377
+ searchParam.additionalParamMap = JSON.parse(additionalParamMap)
2335
2378
  }
2336
2379
  }
2337
2380
  return searchParam
@@ -3256,6 +3299,13 @@ export default {
3256
3299
  if (data && data.componentId) {
3257
3300
  eventBus.$emit(data.componentId + '-scanDone', data)
3258
3301
  }
3302
+ },
3303
+ openRowForm (rowIndex) {
3304
+ this.currentEditRowIndex = rowIndex
3305
+ this.showRowForm = true
3306
+ },
3307
+ closeRowForm () {
3308
+ this.showRowForm = false
3259
3309
  }
3260
3310
  },
3261
3311
  emits: [
@@ -2,6 +2,7 @@ import * as Vue from 'vue'
2
2
  import { getToken } from '../../../src/utils/auth'
3
3
  import { isPlateSys, isShowMenuRoute } from '../../../src/utils/common-util'
4
4
  import { getEntityFieldValue } from '../../../src/utils/util'
5
+ import { doFormatWithValueSet } from './formatter'
5
6
  import store from './store'
6
7
  export function getColumnValues(data, prop) {
7
8
  const values = []
@@ -550,64 +551,45 @@ export function addDynamicPropDateSection(target, prop, propValue) {
550
551
  }
551
552
 
552
553
  export function getTableHeight(superGrid, listCode, pageHeight) {
553
- let topDivHeight = 120
554
- const boxCard = document.querySelector('.box-card')
555
- if (boxCard && boxCard !== null) {
556
- // 表示是配置系统的列表页面
557
- // 16 .gray .app-container .box-card,
558
- // 20为内容区域的padding 20
559
- // 34 + 5为翻页 height 和margin-top
560
- topDivHeight = 16 * 2 + 20 + 34 + 5
561
- }
562
-
563
- if (isShowMenuRoute() === true) {
564
- // 如果显示菜单层级,列表高度需要减少50
565
- topDivHeight = topDivHeight + 50
566
- }
567
-
568
- const listGrid = document.querySelector('.el-tabs__content .' + listCode)
569
- if (listGrid) {
570
- // 表示当前列表在tab页签内容,需要减去tab的高度
571
- topDivHeight = topDivHeight + 80
572
- }
573
- if (pageHeight === undefined || pageHeight === null || pageHeight === '') {
574
- pageHeight = window.innerHeight
575
- } else {
576
- // 表示弹框页面的高度
577
- topDivHeight = 0
578
- }
579
- let totalHeight = pageHeight - topDivHeight
554
+ let rect
580
555
  if (superGrid) {
581
- totalHeight = pageHeight - superGrid.$el.offsetTop - topDivHeight
556
+ rect = superGrid.$el.getBoundingClientRect()
582
557
  }
583
- // const cur = document.querySelectorAll("div[class='grid-area']")
584
- // if (cur.length === 1) {
585
- // 表示只有一个表格
558
+ const totalHeight = window.innerHeight - rect.y - 90
559
+ console.log('rect=', rect, 'window.innerHeight=', window.innerHeight, 'totalHeight=', totalHeight)
586
560
  return totalHeight
587
- // } else if (cur.length > 1) {
588
- // // 表示有多个表格
589
- // // TODO 主子表的表格高度自适应待实现
590
- // const gridParams = store.get(listCode)
591
- // let addHeight = 0
592
- // if (gridParams.options.addHeight) {
593
- // addHeight = gridParams.options.addHeight
594
- // }
595
- // const hasLoadMainTable = store.hasLoadMainTable
596
- // if (typeof (hasLoadMainTable) !== 'undefined' && hasLoadMainTable === true) {
597
- // // 表示主表已加载完成
598
- // const gridHeight = store.gridTableHeight + addHeight
599
- // store.hasLoadMainTable = false
600
- // return gridHeight
601
- // } else {
602
- // let gridHeight = totalHeight / cur.length - 5 + addHeight
603
- // if (gridHeight <= 0) {
604
- // gridHeight = 200
605
- // }
606
- // store.hasLoadMainTable = true
607
- // store.gridTableHeight = gridHeight
608
- // return gridHeight
609
- // }
561
+
562
+ // let topDivHeight = 120
563
+ // const boxCard = document.querySelector('.box-card')
564
+ // if (boxCard && boxCard !== null) {
565
+ // // 表示是配置系统的列表页面
566
+ // // 16 .gray .app-container .box-card,
567
+ // // 20为内容区域的padding 20
568
+ // // 34 + 5为翻页 height 和margin-top
569
+ // topDivHeight = 16 * 2 + 20 + 34 + 5
570
+ // }
571
+
572
+ // if (isShowMenuRoute() === true) {
573
+ // // 如果显示菜单层级,列表高度需要减少50
574
+ // topDivHeight = topDivHeight + 50
575
+ // }
576
+
577
+ // const listGrid = document.querySelector('.el-tabs__content .' + listCode)
578
+ // if (listGrid) {
579
+ // // 表示当前列表在tab页签内容,需要减去tab的高度
580
+ // topDivHeight = topDivHeight + 80
581
+ // }
582
+ // if (pageHeight === undefined || pageHeight === null || pageHeight === '') {
583
+ // pageHeight = window.innerHeight
584
+ // } else {
585
+ // // 表示弹框页面的高度
586
+ // topDivHeight = 0
587
+ // }
588
+ // let totalHeight = pageHeight - topDivHeight
589
+ // if (superGrid) {
590
+ // totalHeight = pageHeight - superGrid.$el.offsetTop - topDivHeight
610
591
  // }
592
+ // return totalHeight
611
593
  }
612
594
 
613
595
  export function getExtraParam(searchParam, gridParams) {
@@ -734,7 +716,7 @@ export function getFileList(row, column, isSql) {
734
716
  return fileList
735
717
  }
736
718
 
737
- export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
719
+ export function getDynamicDataSourceOptions(column, isSql, additionalParamMap, baseURL) {
738
720
  let additionalParameter
739
721
  if (additionalParamMap) {
740
722
  console.log('getDynamicDataSourceOptions--additionalParamMap=', additionalParamMap)
@@ -746,7 +728,8 @@ export function getDynamicDataSourceOptions(column, isSql, additionalParamMap) {
746
728
  }
747
729
  const options = {
748
730
  isSql: isSql,
749
- additionalParameter: additionalParameter
731
+ additionalParameter: additionalParameter,
732
+ backendUrl: baseURL
750
733
  }
751
734
  // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
752
735
  if (column.valueSetOptions) {
@@ -808,3 +791,39 @@ export function getControlConfig(column) {
808
791
  }
809
792
  return controlConfig
810
793
  }
794
+
795
+ export function getContentAlign(column, gridParams){
796
+ let align
797
+ if (typeof gridParams.options.align !== 'undefined') {
798
+ align = gridParams.options.align
799
+ } else if (column.contAlign && column.contAlign !== '') {
800
+ align = column.contAlign
801
+ }
802
+ return align
803
+ }
804
+
805
+ export function getHeaderAlign(column, gridParams){
806
+ let headerAlign
807
+ if (typeof gridParams.options.headerAlign !== 'undefined') {
808
+ headerAlign = gridParams.options.headerAlign
809
+ } else if (column.titleAlign && column.titleAlign !== '') {
810
+ headerAlign = column.titleAlign
811
+ } else {
812
+ // 如果没有配置表头对齐方式,默认使用内容对齐方式
813
+ headerAlign = 'left'
814
+ }
815
+ return headerAlign
816
+ }
817
+
818
+
819
+ export function getHeaderLable(column) {
820
+ if (!column.titleValueSet) {
821
+ return column.label.replace(/\\n/g, '</br>')
822
+ } else {
823
+ return formatHeader(column)
824
+ }
825
+ }
826
+
827
+ function formatHeader(column) {
828
+ return doFormatWithValueSet(column.titleValueSetValue, column.label)
829
+ }
@@ -125,7 +125,10 @@ const cn = {
125
125
  previewTitleWhenNotImg: '非图片格式,使用其它方式预览',
126
126
  refresh: '刷新',
127
127
  open: '展开',
128
- fold: '收起'
128
+ fold: '收起',
129
+ prevRow: '上一行',
130
+ nextRow: '下一行',
131
+ detail: '详情'
129
132
  },
130
133
  // 部门树组件
131
134
  departmentTree: {},
@@ -130,6 +130,9 @@ const en = {
130
130
  refresh: 'Refresh',
131
131
  open: 'Open',
132
132
  fold: 'Fold',
133
+ prevRow: 'Prev Row',
134
+ nextRow: 'Next Row',
135
+ detail: 'Detail'
133
136
  },
134
137
  departmentTree: {},
135
138
  departmentTreeInline: {