doway-coms 2.11.60 → 2.11.62

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": "doway-coms",
3
- "version": "2.11.60",
3
+ "version": "2.11.62",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -85,6 +85,8 @@
85
85
  :show-footer="showFooter"
86
86
  @scroll="bodyScroll"
87
87
  @keydown="keydownEvent"
88
+ @cell-mouseenter="cellMouseEnter"
89
+ @cell-mouseleave="cellMouseLeave"
88
90
  >
89
91
  <template v-for="item in internalColumns" #[item.field]>
90
92
  <div :key="item.field">
@@ -818,7 +820,7 @@ import BasePagination from '../../BasePagination/index'
818
820
  import exportCmp from './exportCmp.vue'
819
821
  import BasePulldown from '../../BasePulldown/index'
820
822
  import BaseGridAdjust from '../../BaseGridAdjust/index'
821
- import { saveUserModuleDataFieldApi, userResetApi } from '../../utils/api'
823
+ import { saveUserModuleDataFieldApi, userResetApi, saveUserModuleDataPageSizeApi } from '../../utils/api'
822
824
  import { gridDefaultValueDisplay } from '../../utils/filters'
823
825
  import SeqSetting from './SeqSetting'
824
826
  import request from '../../utils/request'
@@ -850,6 +852,7 @@ export default {
850
852
  },
851
853
  data() {
852
854
  return {
855
+ selectedCells :[],//选中的列信息
853
856
  gridOptions:{},
854
857
  copySaveRow:null, //存储复制的行
855
858
  gridDefaultValueDisplay: gridDefaultValueDisplay,
@@ -924,6 +927,12 @@ export default {
924
927
  visible: true,
925
928
  disabled: false,
926
929
  },
930
+ {
931
+ code: 'batchPasteFirstValue',
932
+ name: '批量修改成第一个值',
933
+ visible: true,
934
+ disabled: false,
935
+ },
927
936
  {
928
937
  code: 'sort',
929
938
  name: '排序',
@@ -959,6 +968,16 @@ export default {
959
968
  if(item.code==='fixedLeft'){
960
969
  item.visible = Boolean(column && !column.fixed && this.moduleCode && this.dataCode && column.type!=='seq' && column.type!=='checkbox')
961
970
  }
971
+ if(item.code==='batchPasteFirstValue'){
972
+ let tempVisible = false
973
+ if(this.selectedCells.length>1){
974
+ let tempColumn = this.$refs.baseGrid.getColumns()[this.selectedCells[0].columnIndex]
975
+ if(tempColumn.params && tempColumn.params.batchPaste===true){
976
+ tempVisible = true
977
+ }
978
+ }
979
+ item.visible =tempVisible
980
+ }
962
981
  })
963
982
  })
964
983
  // if(column && column.fixed){
@@ -1434,7 +1453,17 @@ export default {
1434
1453
  }
1435
1454
  return scope.column.params.controlEdit === true && editExpResult
1436
1455
  },
1456
+ cellMouseEnter(scope){
1457
+ if(scope.$event.buttons===1){
1458
+ //左键被按下进行拖动
1459
+ this.setRangeSelectCell(scope)
1460
+ }
1461
+ // console.debug('cellMouseEnter',scope)
1462
+ },
1463
+ cellMouseLeave(scope){
1464
+ },
1437
1465
  keydownEvent({$event,$grid,$table}){
1466
+ console.log('keydownEvent',$event)
1438
1467
  if(this.keyBoardNavi){
1439
1468
  const key=$event.key
1440
1469
  //当前行
@@ -1555,6 +1584,8 @@ export default {
1555
1584
  //设置筛选过滤条件
1556
1585
  this.setFilterExpression()
1557
1586
  //通知外部筛选改变事件
1587
+ //清空选中单元格信息
1588
+ this.selectedCells = []
1558
1589
  this.$emit('filterChange', { filterCol: colInfo })
1559
1590
  } else {
1560
1591
  // 手动触发重新筛选filterMethod()方法
@@ -1776,7 +1807,7 @@ export default {
1776
1807
  contextMenuClickEvent({ menu, row, column }) {
1777
1808
  let vm = this
1778
1809
  const $table = this.$refs.baseGrid
1779
- console.debug('menu',menu)
1810
+ // console.debug('menu',menu)
1780
1811
  // if (column && column.field) {
1781
1812
  // if (
1782
1813
  // menu.code !== 'sort' &&
@@ -1887,6 +1918,8 @@ export default {
1887
1918
  this.tagData = JSON.parse(
1888
1919
  JSON.stringify(this.$refs.baseGrid.getCheckedFilters())
1889
1920
  )
1921
+ //清空选中单元格信息
1922
+ this.selectedCells = []
1890
1923
  vm.$emit('filterChange')
1891
1924
  break
1892
1925
  case 'desc':
@@ -1925,8 +1958,55 @@ export default {
1925
1958
  })
1926
1959
  this.$emit('sortChange', data)
1927
1960
  break
1928
- default:
1961
+ case 'batchPasteFirstValue':
1962
+ this.batchPasteFirstValue()
1963
+ break
1964
+ default:
1965
+ }
1966
+ },
1967
+ batchPasteFirstValue(){
1968
+ console.debug('batchPasteFirstValue')
1969
+ if(this.selectedCells.length===0){
1970
+ return
1971
+ }
1972
+ //获取第一个单元格的值,并且判断是否可以编辑
1973
+ if(this.gridEdit!==true){
1974
+ return
1975
+ }
1976
+
1977
+ let tempVisibleColumns = this.$refs.baseGrid.getColumns()
1978
+
1979
+ let firstColumn = tempVisibleColumns[this.selectedCells[0].columnIndex]
1980
+ if(!(firstColumn.params && firstColumn.params.edit===true)){
1981
+ //不可编辑的状态
1982
+ return
1983
+ }
1984
+ //可以批量复制的控件类型
1985
+ let availableControlTypes = [controlType.text,controlType.number,controlType.date,
1986
+ controlType.datetime,controlType.select
1987
+ ]
1988
+
1989
+ if(XEUtils.indexOf(availableControlTypes,firstColumn.params.controlType)<0){
1990
+ //不可编辑的状态
1991
+ return
1929
1992
  }
1993
+
1994
+ let visibleData = this.getVisibleData()
1995
+ let firstValue = visibleData[this.selectedCells[0].rowIndex][firstColumn.field]
1996
+ //可以编辑的状态
1997
+ for(let i=1;i<this.selectedCells.length;i++){
1998
+ if(this.selectedCells[i].columnIndex!==this.selectedCells[0].columnIndex){
1999
+ //如果不是同一列 就不处理
2000
+ continue
2001
+ }
2002
+ let currentRowInfo = visibleData[this.selectedCells[i].rowIndex]
2003
+ currentRowInfo[firstColumn.field]=firstValue
2004
+ this.cellValueChange({row:currentRowInfo,column:firstColumn})
2005
+ // console.debug('currentRowInfo',currentRowInfo)
2006
+ }
2007
+
2008
+
2009
+ // let firstCellValue=this.selectedCells[0].
1930
2010
  },
1931
2011
  /**
1932
2012
  * 固定列到左侧
@@ -1956,6 +2036,8 @@ export default {
1956
2036
  return this.defaultSort.map((item) => [item.field, item.order])
1957
2037
  },
1958
2038
  filterChange({ column, property, values, datas, filterList, $event }) {
2039
+ //清空选中单元格信息
2040
+ this.selectedCells = []
1959
2041
  let vm = this
1960
2042
  //如果不是远程筛选 就不emit了
1961
2043
  if (!this.filterRemote) {
@@ -2127,6 +2209,9 @@ export default {
2127
2209
  if (originCol.editStates) {
2128
2210
  colParams['editStates'] = originCol.editStates
2129
2211
  }
2212
+ if(originCol.batchPaste===true){
2213
+ colParams['batchPaste'] = originCol.batchPaste
2214
+ }
2130
2215
  if (originCol.editStatuss) {
2131
2216
  colParams['editStatuss'] = originCol.editStatuss
2132
2217
  }
@@ -2146,8 +2231,10 @@ export default {
2146
2231
  colInfo.width = 100
2147
2232
  }
2148
2233
 
2149
- // 设置最小列宽为60px
2150
- colInfo.minWidth = originCol.minWidth || 60
2234
+ if (this.showHeaderOverflow === false){
2235
+ // 设置最小列宽为60px
2236
+ colInfo.minWidth = originCol.minWidth || 60
2237
+ }
2151
2238
 
2152
2239
  if (originCol.controlType === 'operation') {
2153
2240
  customSlot['default'] = 'operation_edit'
@@ -2444,6 +2531,9 @@ export default {
2444
2531
  })
2445
2532
  },
2446
2533
  sortChange({ column, property, order, sortBy, sortList, $event }) {
2534
+ //清空单元格选中信息
2535
+ this.selectedCells = []
2536
+ // console.debug('sortChange')
2447
2537
  if (this.filterRemote) {
2448
2538
  let tempSortList = []
2449
2539
  XEUtils.arrayEach(sortList, (loopSort) => {
@@ -2456,6 +2546,12 @@ export default {
2456
2546
  this.$emit('currentChange', scope.row)
2457
2547
  },
2458
2548
  pageSizeChange(page, pageSize) {
2549
+ let postData = {
2550
+ moduleCode: this.moduleCode,
2551
+ dataCode: this.dataCode,
2552
+ pageSize: pageSize
2553
+ }
2554
+ saveUserModuleDataPageSizeApi(postData)
2459
2555
  this.$emit('pageSizeChange', page, pageSize, this.filterExpression)
2460
2556
  },
2461
2557
  pageChange(page, pageSize) {
@@ -2992,6 +3088,8 @@ export default {
2992
3088
  },
2993
3089
  checkBoxChanged({ checked, records, row }) {
2994
3090
  this.$emit('checkBoxChanged', checked, records, row)
3091
+ //更新表尾选中合计
3092
+ this.$refs.baseGrid.updateFooter()
2995
3093
  },
2996
3094
  checkBoxAllChanged({ checked, records }) {
2997
3095
  this.$emit('checkBoxAllChanged', checked, records)
@@ -3221,12 +3319,40 @@ export default {
3221
3319
  * 表尾
3222
3320
  */
3223
3321
  footerMethod({ columns, data }) {
3322
+ // console.debug('footer method',columns,data)
3224
3323
  let footerData= this.customFooterMethod({ columns, data })
3225
3324
  if(footerData){
3226
3325
  return footerData
3227
3326
  }else{
3228
3327
  if (this.footerSum.length > 0) {
3229
- let tempResult = [
3328
+ let tempResult = []
3329
+ //选中后合计
3330
+ let tempSelectRows = this.$refs.baseGrid.getCheckboxRecords(true)
3331
+ if(tempSelectRows.length>0){
3332
+ let tempCheckedResult = columns.map((column, columnIndex) => {
3333
+ if (columnIndex === 0) {
3334
+ return '选中'
3335
+ }
3336
+ if (this.footerSum.includes(column.property)) {
3337
+ let tempSumVal = XEUtils.sum(tempSelectRows, column.property)
3338
+ if (
3339
+ column.formatter &&
3340
+ column.formatter !== 'defaultFormat' &&
3341
+ VXETable.formats.store[column.formatter]
3342
+ ) {
3343
+ tempSumVal = VXETable.formats.store[column.formatter].cellFormatMethod({
3344
+ cellValue: tempSumVal,
3345
+ })
3346
+ }
3347
+ return tempSumVal
3348
+ }
3349
+ return null
3350
+ })
3351
+ tempResult.push(tempCheckedResult)
3352
+ }
3353
+
3354
+ //所有合计
3355
+ let tempTotalResult =
3230
3356
  columns.map((column, columnIndex) => {
3231
3357
  if (columnIndex === 0) {
3232
3358
  return '合计'
@@ -3245,16 +3371,58 @@ export default {
3245
3371
  return tempSumVal
3246
3372
  }
3247
3373
  return null
3248
- }),
3249
- ]
3374
+ })
3375
+
3376
+
3377
+ tempResult.push(tempTotalResult)
3378
+ // console.debug('tempResult',tempResult)
3250
3379
  return tempResult
3251
3380
  } else {
3252
3381
  return []
3253
3382
  }
3254
3383
  }
3255
3384
  },
3256
- async cellClick({ row, column }) {
3257
- this.$emit('cellClick', { row, column })
3385
+ async cellClick(scope) {
3386
+ // console.debug('cellClick',scope)
3387
+ // console.debug('cellClick event',scope.$event)
3388
+ let rowKeyField = '_X_ROW_KEY'
3389
+ // let rowElId = row._X_ROW_KEY
3390
+ if(this.rowConfig!=null&&this.rowConfig.keyField){
3391
+ rowKeyField= this.rowConfig.keyField
3392
+ }
3393
+
3394
+ // console.debug('columnIndex',scope.$columnIndex,scope.columnIndex)
3395
+ // console.debug(XEUtils.map(this.$refs.baseGrid.getColumns(),p=>p.field))
3396
+
3397
+
3398
+
3399
+
3400
+ // console.debug('cellClick',column.property,rowElId,row)
3401
+ if(scope.$event.ctrlKey===true){
3402
+ //按住了ctrl键后的点击
3403
+ this.selectedCells.push({
3404
+ columnIndex:scope.$columnIndex,
3405
+ rowIndex:scope.$rowIndex
3406
+ })
3407
+
3408
+ }else if(scope.$event.shiftKey===true && this.selectedCells.length>0){
3409
+ //按住了shift键后的点击,需要计算选中后的区域,清空除第一个之后的数据
3410
+ this.setRangeSelectCell(scope)
3411
+ // scope.$event.preventDefault()
3412
+ // scope.$event.stopPropagation()
3413
+
3414
+ }else{
3415
+ this.selectedCells = [{
3416
+ columnIndex:scope.$columnIndex,
3417
+ rowIndex:scope.$rowIndex
3418
+ }]
3419
+ }
3420
+ // console.debug('this.selectedCells',this.selectedCells)
3421
+ this.$emit('cellClick', { row:scope.row, column:scope.column })
3422
+ // if(this.selectedCells.lengh>1){
3423
+ // //多选情况下就不开启编辑行
3424
+ // return
3425
+ // }
3258
3426
  //判断是否可以跳转
3259
3427
  // if (
3260
3428
  // this.gridEdit != true ||
@@ -3286,7 +3454,7 @@ export default {
3286
3454
  if (this.gridEdit !== true) {
3287
3455
  return
3288
3456
  }
3289
- if (this.$refs.baseGrid.isEditByRow(row) === true) {
3457
+ if (this.$refs.baseGrid.isEditByRow(scope.row) === true) {
3290
3458
  //判断当前行是否是编辑行
3291
3459
  return
3292
3460
  }
@@ -3300,7 +3468,7 @@ export default {
3300
3468
  while (attempt < maxAttempts) {
3301
3469
  const editingRecord = this.$refs.baseGrid.getEditRecord()
3302
3470
  // 如果没有正在编辑的行,或者只有当前行在编辑,则退出等待
3303
- if (!editingRecord || editingRecord.row===row) {
3471
+ if (!editingRecord || editingRecord.row===scope.row) {
3304
3472
  // console.debug('当前行编辑')
3305
3473
  return true
3306
3474
  }
@@ -3317,11 +3485,40 @@ export default {
3317
3485
  //检查是否存在其他行还是编辑状态,如果还是编辑状态就等待关闭编辑状态后再执行当前行的编辑
3318
3486
  //因为会存在如果有校验的话会存在切换快,并且页面卡顿的情况的话会出现当前行打开编辑后又
3319
3487
 
3320
- if (column.editRender && column.editRender.enabled === true) {
3321
- this.$refs.baseGrid.setEditCell(row, column)
3488
+ if (scope.column.editRender && scope.column.editRender.enabled === true) {
3489
+ this.$refs.baseGrid.setEditCell(scope.row, scope.column)
3322
3490
  } else {
3323
- this.$refs.baseGrid.setEditRow(row)
3491
+ this.$refs.baseGrid.setEditRow(scope.row)
3492
+ }
3493
+ },
3494
+ setRangeSelectCell(scope){
3495
+ if(this.selectedCells.length===0){
3496
+ return
3324
3497
  }
3498
+ let startRowIndex = this.selectedCells[0].rowIndex
3499
+ let endRowIndex = scope.$rowIndex
3500
+ let startColumnIndex = this.selectedCells[0].columnIndex
3501
+ let endColumnIndex = scope.$columnIndex
3502
+ //清空除第一个的坐标
3503
+ this.selectedCells.splice(1)
3504
+ if(startRowIndex>endRowIndex){
3505
+ [startRowIndex, endRowIndex] = [endRowIndex, startRowIndex]
3506
+ }
3507
+ if (startColumnIndex > endColumnIndex) {
3508
+ [startColumnIndex, endColumnIndex] = [endColumnIndex, startColumnIndex]
3509
+ }
3510
+ for (let rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {
3511
+ for (let colIndex = startColumnIndex; colIndex <= endColumnIndex; colIndex++) {
3512
+ if(this.selectedCells[0].rowIndex===rowIndex&&this.selectedCells[0].columnIndex===colIndex){
3513
+ //第一个跳过
3514
+ continue
3515
+ }
3516
+ this.selectedCells.push({
3517
+ columnIndex:colIndex,
3518
+ rowIndex:rowIndex
3519
+ })
3520
+ }
3521
+ }
3325
3522
  },
3326
3523
  linkClick({item,index, row, column }) {
3327
3524
  if ( this.gridEdit !== true || !(column.editRender && column.editRender.enabled === true) ) {
@@ -3392,6 +3589,9 @@ export default {
3392
3589
  return customStyle
3393
3590
  },
3394
3591
  cellStyleFunc(scope){
3592
+
3593
+ // console.debug('cellstyle',scope.column.property)
3594
+
3395
3595
  let customStyle = {}
3396
3596
  if(this.cellStyle){
3397
3597
  customStyle = this.cellStyle
@@ -3401,6 +3601,20 @@ export default {
3401
3601
  customStyle[loopProp] = scope.column.params.cellStyle[loopProp]
3402
3602
  }
3403
3603
  }
3604
+
3605
+ //设置选中列样式
3606
+ let selectedCell = XEUtils.find(this.selectedCells,p=>p.rowIndex===scope.$rowIndex && p.columnIndex===scope.$columnIndex)
3607
+ if(selectedCell){
3608
+ // console.debug('scope',scope.column.property,scope.row.id,this.selectedCells)
3609
+ customStyle.border = '1px solid #409eff'
3610
+ customStyle.backgroundColor = 'rgb(198 223 247)'
3611
+ }
3612
+
3613
+ if(this.selectedCells.length>1){
3614
+ //多选情况下就禁用文本选择
3615
+ customStyle.userSelect = 'none'
3616
+ }
3617
+
3404
3618
  // customStyle.border = '1px solid black'
3405
3619
  this.$emit('cellStyleCallback',scope,customStyle)
3406
3620
  return customStyle
@@ -3499,6 +3713,8 @@ export default {
3499
3713
  this.tagData = JSON.parse(
3500
3714
  JSON.stringify(this.$refs.baseGrid.getCheckedFilters())
3501
3715
  )
3716
+ //清空选中单元格信息
3717
+ this.selectedCells = []
3502
3718
  vm.$emit('filterChange')
3503
3719
  },
3504
3720
  filterAddExp(colInfo) {
@@ -3543,6 +3759,8 @@ export default {
3543
3759
  if (this.filterRemote) {
3544
3760
  //设置筛选过滤条件
3545
3761
  this.setFilterExpression()
3762
+ //清空选中单元格信息
3763
+ this.selectedCells = []
3546
3764
  //通知外部筛选改变事件
3547
3765
  this.$emit('filterChange', { filterCol: colInfo }, this.filterExpression)
3548
3766
  } else {
@@ -19,7 +19,13 @@ export function saveUserModuleDataFieldApi(data) {
19
19
  data: data
20
20
  })
21
21
  }
22
-
22
+ export function saveUserModuleDataPageSizeApi(data) {
23
+ return request({
24
+ url: store.getters.umsUrl + '/v1/user/saveUserModuleDataPageSize',
25
+ method: 'post',
26
+ data: data
27
+ })
28
+ }
23
29
  export function attachGetAttachUrlApi() {
24
30
  return store.getters.msgUrl + '/v1/Attach'
25
31
  }