doway-coms 1.1.75 → 1.1.77

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,158 @@
1
+ <template>
2
+ <div>
3
+ <vxe-grid
4
+ ref="adjustGrid"
5
+ v-bind="adjustGridOptions"
6
+ :loading="adjustGridLoading"
7
+ @resizable-change="resizableChange"
8
+ column-key
9
+ >
10
+ <template #empty>
11
+ <div>拖拽调整字段位置或者宽度</div>
12
+ </template>
13
+ <template #checkbox="{ column }">
14
+ <a-checkbox
15
+ v-model:checked="column.params.show"
16
+ @change="changeCheckbox(column)"
17
+ ></a-checkbox>
18
+ {{ column.title }}
19
+ </template>
20
+ </vxe-grid>
21
+ </div>
22
+ </template>
23
+ <script>
24
+ import Sortable from 'sortablejs'
25
+ import VXETable from 'vxe-table'
26
+ export default {
27
+ props: ['userDefineColumns'],
28
+ created() {
29
+ this.adjustUserDefineColumns = JSON.parse(
30
+ JSON.stringify(this.userDefineColumns)
31
+ )
32
+ this.adjustUserDefineColumns.forEach(item => {
33
+ if (item.visible) {
34
+ this.$set(item, 'show', true)
35
+ } else {
36
+ this.$set(item, 'show', false)
37
+ }
38
+ })
39
+ this.adjustGridOptions.columns = []
40
+ this.adjustUserDefineColumns.forEach(item => {
41
+ this.adjustGridOptions.columns.push({
42
+ field: item.field,
43
+ title: item.title,
44
+ slots: {
45
+ header: 'checkbox'
46
+ },
47
+ params: {
48
+ show: item.show
49
+ },
50
+ width: item.width
51
+ })
52
+ })
53
+ },
54
+ mounted() {
55
+ this.columnDrop(this.adjustUserDefineColumns)
56
+ },
57
+ beforeDestroy() {
58
+ if (this.sortable) {
59
+ this.sortable.destroy()
60
+ }
61
+ },
62
+ data() {
63
+ return {
64
+ adjustGridLoading: false,
65
+ adjustUserDefineColumns: null,
66
+ adjustGridOptions: {
67
+ border: true,
68
+ class: 'sortable-column-demo',
69
+ columnConfig: {
70
+ useKey: true,
71
+ resizable: true
72
+ },
73
+ scrollX: {
74
+ enabled: false
75
+ },
76
+ columns: [],
77
+ data: []
78
+ }
79
+ }
80
+ },
81
+
82
+ methods: {
83
+ changeCheckbox(val) {
84
+ this.adjustUserDefineColumns.forEach(item => {
85
+ if (item.field === val.field) {
86
+ item.visible = val.params.show
87
+ }
88
+ })
89
+ },
90
+ resizableChange($rowIndex) {
91
+ this.adjustUserDefineColumns.forEach(item => {
92
+ if (item.field === $rowIndex.column.field) {
93
+ item.width = $rowIndex.column.resizeWidth
94
+ }
95
+ })
96
+ },
97
+ columnDrop() {
98
+ this.$nextTick(() => {
99
+ this.adjustGridLoading = true
100
+ const $table = this.$refs.adjustGrid
101
+ this.sortable = Sortable.create(
102
+ $table.$el.querySelector(
103
+ '.body--wrapper>.vxe-table--header .vxe-header--row'
104
+ ),
105
+ {
106
+ handle: '.vxe-header--column',
107
+ onEnd: ({ item, newIndex, oldIndex }) => {
108
+ const { fullColumn, tableColumn } = $table.getTableColumn()
109
+ const targetThElem = item
110
+ const wrapperElem = targetThElem.parentNode
111
+ const newColumn = fullColumn[newIndex]
112
+ if (newColumn.fixed) {
113
+ const oldThElem = wrapperElem.children[oldIndex]
114
+ // 错误的移动
115
+ if (newIndex > oldIndex) {
116
+ wrapperElem.insertBefore(targetThElem, oldThElem)
117
+ } else {
118
+ wrapperElem.insertBefore(
119
+ targetThElem,
120
+ oldThElem ? oldThElem.nextElementSibling : oldThElem
121
+ )
122
+ }
123
+ VXETable.modal.message({
124
+ content: '固定列不允许拖动,即将还原操作!',
125
+ status: 'error'
126
+ })
127
+ return
128
+ }
129
+ // 获取列索引 columnIndex > fullColumn
130
+ const oldColumnIndex = $table.getColumnIndex(
131
+ tableColumn[oldIndex]
132
+ )
133
+ const newColumnIndex = $table.getColumnIndex(
134
+ tableColumn[newIndex]
135
+ )
136
+ // 移动到目标列
137
+ const currRow = fullColumn.splice(oldColumnIndex, 1)[0]
138
+ fullColumn.splice(newColumnIndex, 0, currRow)
139
+ $table.loadColumn(fullColumn)
140
+ this.adjustUserDefineColumns = fullColumn
141
+ }
142
+ }
143
+ )
144
+ this.adjustGridLoading = false
145
+ })
146
+ }
147
+ }
148
+ }
149
+ </script>
150
+ <style scoped>
151
+ .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-ghost,
152
+ .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-chosen {
153
+ background-color: #dfecfb;
154
+ }
155
+ .sortable-column-demo .vxe-header--row .vxe-header--column.col--fixed {
156
+ cursor: no-drop;
157
+ }
158
+ </style>
@@ -386,14 +386,14 @@
386
386
  },
387
387
  routeLinkClick() {
388
388
  //首先需要判断是否有权限
389
- // let treeModule = XEUtils.findTree(
390
- // this.$store.getters.addRouters,
391
- // item => item.name === this.route.name
392
- // )
393
- // if (!treeModule) {
394
- // this.$antwarning('没有权限')
395
- // return
396
- // }
389
+ let treeModule = XEUtils.findTree(
390
+ this.$store.getters.addRouters,
391
+ item => item.name === this.route.name
392
+ )
393
+ if (!treeModule) {
394
+ this.$antwarning('没有权限')
395
+ return
396
+ }
397
397
  this.$router.pushRoute({
398
398
  name: this.route.name,
399
399
  query: { id: this.row[this.route.field] }
package/packages/index.js CHANGED
@@ -17,6 +17,7 @@ import BaseIntervalInput from './BaseIntervalInput/index';
17
17
  import BaseForm from './BaseForm/index';
18
18
  import BasePictureCard from './BasePictureCard/index';
19
19
  import BasePrintPreview from './BasePrintPreview/index';
20
+ import BaseGantt from "./BaseGantt/index";
20
21
 
21
22
  import store from './utils/store'
22
23
  import request from './utils/request'
@@ -25,7 +26,7 @@ import BaseGrid from './BaseGrid/index';
25
26
  // 存储组件列表
26
27
  const components = [BaseInput,BaseCheckbox,BaseDate,BaseDatetime,BaseDateWeek,BaseTextArea,BaseSelect,BaseSelectMulti
27
28
  ,BaseTime,BasePagination,
28
- BaseNumberInput,BaseTool,BaseToolStatus,BasePulldown,BaseIntervalInput,BaseForm,BasePictureCard,BaseGrid,BasePrintPreview];
29
+ BaseNumberInput,BaseTool,BaseToolStatus,BasePulldown,BaseIntervalInput,BaseForm,BasePictureCard,BaseGrid,BasePrintPreview, BaseGantt];
29
30
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
30
31
 
31
32
  import 'vxe-table/lib/style.css'
@@ -146,6 +147,7 @@ export {
146
147
  BaseGrid,
147
148
  BasePictureCard,
148
149
  BasePrintPreview,
150
+ BaseGantt,
149
151
  store,
150
152
  request,
151
153
  }