doway-coms 1.1.75 → 1.1.76

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,12 @@
1
+ {
2
+ "name": "doway-coms",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "doway-coms.common.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "doway-coms",
3
- "version": "1.1.75",
4
- "description": "doway组件库",
5
- "author": "dowaysoft",
6
- "main": "packages/index.js",
7
- "license": "MIT",
8
- "scripts": {
9
- "dev": "vue-cli-service serve",
10
- "build": "vue-cli-service build",
11
- "lint": "vue-cli-service lint",
12
- "lib": "vue-cli-service build --target lib --name doway-coms --dest lib packages/index.js",
13
- "build:test": "vue-cli-service build --report"
14
- },
15
-
16
- "dependencies": {
17
- "ant-design-vue": "1.7.8",
18
- "vue": "2.7.14",
19
- "vuex": "3.6.2",
20
- "vue-router": "3.6.5",
21
- "vee-validate": "3.4.14",
22
- "vxe-table": "3.5.4",
23
- "xe-utils": "3.5.4",
24
- "axios": "0.18.0",
25
- "js-cookie": "2.2.0",
26
- "xe-clipboard":"1.10.2"
27
- },
28
- "devDependencies": {
29
- "@vue/cli-plugin-babel": "~4.2.0",
30
- "@vue/cli-plugin-eslint": "~4.2.0",
31
- "@vue/cli-plugin-vuex": "~4.2.0",
32
- "@vue/cli-service": "~4.2.0",
33
- "babel-eslint": "^10.0.3",
34
- "babel-plugin-component": "^1.1.1",
35
- "babel-plugin-import": "^1.13.6",
36
- "eslint": "^6.7.2",
37
- "eslint-plugin-vue": "^6.1.2",
38
- "extract-text-webpack-plugin": "^3.0.2",
39
- "less-loader": "^6.0.0",
40
- "node-sass": "8.0.0",
41
- "sass-loader": "10.4.1",
42
- "vue-template-compiler": "^2.6.11"
43
- },
44
- "bundleDependencies":false,
45
- "repository": {
46
- "type": "git",
47
- "url": "https://www.npmjs.com/package/doway-coms.git"
48
- },
49
- "keywords": []
50
- }
1
+ {
2
+ "name": "doway-coms",
3
+ "version": "1.1.76",
4
+ "description": "doway组件库",
5
+ "author": "dowaysoft",
6
+ "main": "packages/index.js",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "dev": "vue-cli-service serve",
10
+ "build": "vue-cli-service build",
11
+ "lint": "vue-cli-service lint",
12
+ "lib": "vue-cli-service build --target lib --name doway-coms --dest lib packages/index.js",
13
+ "build:test": "vue-cli-service build --report"
14
+ },
15
+
16
+ "dependencies": {
17
+ "ant-design-vue": "1.7.8",
18
+ "vue": "2.7.14",
19
+ "vuex": "3.6.2",
20
+ "vue-router": "3.6.5",
21
+ "vee-validate": "3.4.14",
22
+ "vxe-table": "3.5.4",
23
+ "xe-utils": "3.5.4",
24
+ "axios": "0.18.0",
25
+ "js-cookie": "2.2.0",
26
+ "xe-clipboard":"1.10.2"
27
+ },
28
+ "devDependencies": {
29
+ "@vue/cli-plugin-babel": "~4.2.0",
30
+ "@vue/cli-plugin-eslint": "~4.2.0",
31
+ "@vue/cli-plugin-vuex": "~4.2.0",
32
+ "@vue/cli-service": "~4.2.0",
33
+ "babel-eslint": "^10.0.3",
34
+ "babel-plugin-component": "^1.1.1",
35
+ "babel-plugin-import": "^1.13.6",
36
+ "eslint": "^6.7.2",
37
+ "eslint-plugin-vue": "^6.1.2",
38
+ "extract-text-webpack-plugin": "^3.0.2",
39
+ "less-loader": "^6.0.0",
40
+ "node-sass": "8.0.0",
41
+ "sass-loader": "10.4.1",
42
+ "vue-template-compiler": "^2.6.11"
43
+ },
44
+ "bundleDependencies":false,
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://www.npmjs.com/package/doway-coms.git"
48
+ },
49
+ "keywords": []
50
+ }
@@ -0,0 +1,10 @@
1
+ // 导入组件,组件必须声明 name
2
+ import BaseGridAdjust from './src/index.vue';
3
+ import VXETable from 'vxe-table'
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ BaseGridAdjust.install = function(Vue) {
6
+ Vue.use(VXETable)
7
+ Vue.component(BaseGridAdjust.name, BaseGridAdjust);
8
+ };
9
+ // 默认导出组件
10
+ export default BaseGridAdjust;
@@ -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] }