sh-view 2.5.2 → 2.5.3

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": "sh-view",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "基于vxe-table二次封装",
5
5
  "main": "packages/index.js",
6
6
  "scripts": {
@@ -4,9 +4,8 @@ import { columnDefaultFilterMethod, tableFooterCompute, getTransfarFields, getFi
4
4
  const globalConfigDefault = {
5
5
  tableName: '',
6
6
  title: false, // 是否显示 tableName
7
- checkbox: true, // 是否展示复选框
8
- radio: false, // 是否展示单选框
9
- seq: true, // 是否展示序号列
7
+ selectType: '', // 是否选择框 空 radio checkbox
8
+ seq: false, // 是否展示序号列
10
9
  ghost: false, // 是否开启透明
11
10
  search: false, // 表格是否开启查询,默认不开启,根据columns配置字段 search 为 true
12
11
  globalFilter: false, // 表格是否开启全局过滤
@@ -37,11 +36,11 @@ const toolsList = [
37
36
  // 表头默认值
38
37
  const columnObjDefault = { minWidth: 120, sortable: true, filter: true }
39
38
  // 表头默认列
40
- const columnsConfigDefault = [
41
- { title: '', type: 'checkbox', width: 60, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-checkbox' },
42
- { title: '单选', type: 'radio', width: 60, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-radio' },
43
- { title: '序号', type: 'seq', width: 70, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-seq' }
44
- ]
39
+ const columnsMapDefault = {
40
+ checkbox: { title: '', type: 'checkbox', width: 60, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-checkbox' },
41
+ radio: { title: '单选', type: 'radio', width: 60, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-radio' },
42
+ seq: { title: '序号', type: 'seq', width: 70, align: 'center', fixed: 'left', sortable: false, resizable: false, className: 'table-row-seq' }
43
+ }
45
44
 
46
45
  export default function (props, context, proxy, isGrid) {
47
46
  const { $vUtils, $vxePluginNames } = proxy
@@ -70,9 +69,18 @@ export default function (props, context, proxy, isGrid) {
70
69
  return toolsList.filter(tool => tools.includes(tool.code))
71
70
  })
72
71
  const tableViewData = computed(() => tableFilterData.value || props.dataSourse)
72
+ const tablePrevColumns = computed(() => {
73
+ let prevColumns = []
74
+ let prevFields = ['seq', 'selectType']
75
+ prevFields.forEach(prev => {
76
+ if (tableGlobalConfig.value[prev]) {
77
+ prevColumns.push(columnsMapDefault[prev])
78
+ }
79
+ })
80
+ return prevColumns
81
+ })
73
82
  const tableColumns = computed(() => {
74
- let defaultColumns = columnsConfigDefault.filter(item => tableGlobalConfig.value[item.type])
75
- return defaultColumns.concat(tableColumnsFixed.value)
83
+ return tablePrevColumns.value.concat(tableColumnsFixed.value)
76
84
  })
77
85
  const tableColumnObjConfig = computed(() => Object.assign({}, columnObjDefault, props.columnObj))
78
86
  const tableColumnConfig = computed(() => Object.assign({ isCurrent: false, isHover: true, resizable: true }, props.columnConfig))
@@ -184,8 +192,7 @@ export default function (props, context, proxy, isGrid) {
184
192
  return footerData
185
193
  }
186
194
  const tableFooterSpanMethod = ({ $rowIndex, column, $columnIndex, data }) => {
187
- let defaultColumns = columnsConfigDefault.filter(item => tableGlobalConfig.value[item.type])
188
- let colspan = defaultColumns.length || 1
195
+ let colspan = tablePrevColumns.value.length || 1
189
196
  if (column.type === 'seq') {
190
197
  return { rowspan: 1, colspan: colspan }
191
198
  } else if (column.type === 'checkbox' || column.type === 'radio') {
@@ -533,6 +540,7 @@ export default function (props, context, proxy, isGrid) {
533
540
  renderKey,
534
541
  wrapHeight,
535
542
  tableGlobalConfig,
543
+ tablePrevColumns,
536
544
  tableColumns,
537
545
  tableColumnConfig,
538
546
  tableColumnObjConfig,
@@ -553,7 +561,6 @@ export default function (props, context, proxy, isGrid) {
553
561
  tableSlots,
554
562
  selectionRows,
555
563
  importVisible,
556
- columnsConfigDefault,
557
564
  tableFooterMethod,
558
565
  tableFooterSpanMethod,
559
566
  onCurrentChange,
@@ -116,8 +116,8 @@
116
116
  @toolbar-button-click="onToolbarButtonClick"
117
117
  @toolbar-tool-click="onToolbarToolClick"
118
118
  @option-click="handleGoptionClick">
119
- <template v-for="(column, columnIndex) in columnsConfigDefault" :key="columnIndex">
120
- <vxe-column v-if="!!tableGlobalConfig[column.type]" v-bind="column"></vxe-column>
119
+ <template v-for="(column, columnIndex) in tablePrevColumns" :key="columnIndex">
120
+ <vxe-column v-bind="column"></vxe-column>
121
121
  </template>
122
122
  <template v-for="(column, columnIndex) in columns" :key="columnIndex">
123
123
  <sh-column :column="column"></sh-column>