@skyfox2000/webui 1.0.13 → 1.0.14

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": "@skyfox2000/webui",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "后台前端通用组件定义",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { onMounted, Ref, ref, watch, provide, useAttrs, onActivated } from 'vue';
2
+ import { onMounted, Ref, ref, watch, provide, useAttrs, onActivated, computed } from 'vue';
3
3
  import { Table, TablePaginationConfig, TableProps } from 'ant-design-vue';
4
4
  import {
5
5
  gridQueryFind,
@@ -55,6 +55,9 @@ const attrs = useAttrs(); // 手动获取 $attrs
55
55
 
56
56
  const gridCtrl = props.gridCtrl;
57
57
 
58
+ // 响应式获取当前路由路径
59
+ const currentPath = computed(() => AppRouter.currentRoute.value.path);
60
+
58
61
  if (gridCtrl) {
59
62
  gridCtrl.pageNo.value = 1;
60
63
  gridCtrl.total.value = 0;
@@ -199,7 +202,7 @@ onMounted(async () => {
199
202
  <template v-if="gridCtrl && bodyCell?.column?.dataIndex === 'enabled'">
200
203
  <Switch
201
204
  v-model:checked="bodyCell.record.Enabled"
202
- v-auth:disable="{ url: AppRouter.currentRoute.value.path, role: ['Super', 'Admin'], permit: ':enabled' }"
205
+ v-auth:disable="{ url: currentPath, role: ['Super', 'Admin'], permit: ':enabled' }"
203
206
  :disabled="statusDisabled ? statusDisabled(bodyCell.record) : false"
204
207
  :data="OPTIONS.EnableDisable"
205
208
  @click="gridStatusUpdate(gridCtrl, bodyCell.record)"
@@ -11,6 +11,7 @@ import {
11
11
  AppRouter,
12
12
  } from '@skyfox2000/webbase';
13
13
  import { ConfigProvider, Button, Space, DropdownButton, Menu, MenuItem, Popconfirm } from 'ant-design-vue';
14
+ import { computed } from 'vue';
14
15
 
15
16
  const props = defineProps<{
16
17
  /**
@@ -25,6 +26,9 @@ const props = defineProps<{
25
26
 
26
27
  const gridCtrl = props.gridCtrl;
27
28
 
29
+ // 响应式获取当前路由路径
30
+ const currentPath = computed(() => AppRouter.currentRoute.value.path);
31
+
28
32
  /// 兼容其它按钮操作参数
29
33
  const defaultOperates: ButtonTool[] = [
30
34
  {
@@ -96,7 +100,7 @@ const disabled = (item: ButtonTool): boolean => {
96
100
  :danger="item.danger"
97
101
  v-if="getToolVisible(item, props.record)"
98
102
  :disabled="disabled(item)"
99
- v-auth="{ url: AppRouter.currentRoute.value.path, role: item.role, permit: item.permit }"
103
+ v-auth="{ url: currentPath, role: item.role, permit: item.permit }"
100
104
  @click="onToolClicked(item, gridCtrl.page, gridCtrl, props.record)"
101
105
  size="small"
102
106
  :style="{
@@ -117,7 +121,7 @@ const disabled = (item: ButtonTool): boolean => {
117
121
  <MenuItem
118
122
  v-if="getToolVisible(item, props.record)"
119
123
  :disabled="disabled(item)"
120
- v-auth="{ url: AppRouter.currentRoute.value.path, role: item.role, permit: item.permit }"
124
+ v-auth="{ url: currentPath, role: item.role, permit: item.permit }"
121
125
  @click="onToolClicked(item, gridCtrl.page, gridCtrl, props.record)"
122
126
  >
123
127
  {{ item.label }}
@@ -12,7 +12,7 @@ import {
12
12
  import { Dropdown, Menu, MenuItem, Space } from 'ant-design-vue';
13
13
  import { Button } from '../../common';
14
14
  import IconTool from './icontool.vue';
15
- import { ref, watch } from 'vue';
15
+ import { ref, watch, computed } from 'vue';
16
16
 
17
17
  const props = defineProps<{
18
18
  /**
@@ -29,6 +29,9 @@ const gridCtrl = props.gridCtrl;
29
29
  const pageCtrl = gridCtrl.page;
30
30
  const editorCtrl = props.editorCtrl;
31
31
 
32
+ // 响应式获取当前路由路径
33
+ const currentPath = computed(() => AppRouter.currentRoute.value.path);
34
+
32
35
  const defaultButtons: ButtonTool[] = [
33
36
  {
34
37
  key: 'New',
@@ -76,7 +79,7 @@ watch(
76
79
  :danger="item.danger"
77
80
  :disabled="getToolStatus(item)"
78
81
  :icon="item.icon"
79
- v-auth="{ url: AppRouter.currentRoute.value.path, role: item.role, permit: item.permit }"
82
+ v-auth="{ url: currentPath, role: item.role, permit: item.permit }"
80
83
  @click="onToolClicked(item, pageCtrl, gridCtrl)"
81
84
  >
82
85
  {{ item.label }}
@@ -88,7 +91,7 @@ watch(
88
91
  v-for="item in ToolbarMenus"
89
92
  :key="item.key"
90
93
  :disabled="getToolStatus(item)"
91
- v-auth="{ url: AppRouter.currentRoute.value.path, role: item.role, permit: item.permit }"
94
+ v-auth="{ url: currentPath, role: item.role, permit: item.permit }"
92
95
  @click="onToolClicked(item, pageCtrl, gridCtrl)"
93
96
  >
94
97
  {{ item.label }}