@yqg/permission 1.0.10 → 1.0.11

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": "@yqg/permission",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
package/src/App.vue CHANGED
@@ -21,7 +21,7 @@ const permissions = reactive([
21
21
  // const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
22
22
  const changeColor = () => {
23
23
  color.value = color.value === '#f00' ? '#1677ff' : '#f00';
24
- }
24
+ }
25
25
  const changeLocale = () => {
26
26
  locale.value = locale.value === 'zh-CN' ? 'en-US' : 'zh-CN';
27
27
  }
@@ -38,7 +38,7 @@ const changeLocale = () => {
38
38
  <!-- 03541 -->
39
39
  <!-- 02124 -->
40
40
  <!-- 05184 -->
41
- <yqg-permission
41
+ <yqg-permission
42
42
  :permissions="permissions"
43
43
  workNumber="05184"
44
44
  businessCode="CRANE"
@@ -50,7 +50,7 @@ const changeLocale = () => {
50
50
  </div>
51
51
  <!-- <data class="case-card">
52
52
  <div>2:文字组件</div>
53
- <yqg-permission
53
+ <yqg-permission
54
54
  :permissions="permissions"
55
55
  businessCode="CRANE"
56
56
  :color="color"
@@ -61,21 +61,21 @@ const changeLocale = () => {
61
61
  </data>
62
62
  -->
63
63
 
64
-
64
+
65
65
  <!-- <div class="case-card">
66
66
  <div>3:自定义</div>
67
- <yqg-permission
67
+ <yqg-permission
68
68
  :permissions="permissions"
69
69
  businessCode="CRANE"
70
70
  :color="color"
71
71
  workNumber="02124"
72
- locale="zh-CN"
72
+ locale="zh-CN"
73
73
  type="custom"
74
74
  >
75
75
  <div style="color: red;" slot="custom">自定义按钮</div>
76
76
  </yqg-permission>
77
77
  </div> -->
78
-
78
+
79
79
  </div>
80
80
 
81
81
  </template>
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <div class="crane-checkbox-line">
3
- <Checkbox
3
+ <Checkbox
4
4
  :value="item.roleId"
5
5
  :disabled="['OWNER', 'PENDING', 'NO'].includes(props.item.businessApplyType)"
6
6
  @change="onCheck">
7
7
  <div class="crane-flex-center crane-checkbox-label">
8
8
  <Tag
9
- v-if="item.securityLevel"
10
- :bordered="false"
9
+ v-if="item.securityLevel"
10
+ :bordered="false"
11
11
  :color="levelMap[item.securityLevel].color"
12
12
  class="crane-tag-position">
13
13
  {{ levelMap[item.securityLevel].text }}
14
14
  </Tag>
15
-
15
+
16
16
  <span>{{t(`operationType.${item.operationType}`)}}|
17
17
  </span>
18
18
  <Popover>
@@ -22,8 +22,8 @@
22
22
  <span class="crane-text-overflow">{{ item.name }}</span>
23
23
  </Popover>
24
24
  <Tag
25
- v-if="item.businessApplyType && item.businessApplyType !== 'TEMP_OWNER'"
26
- :bordered="false"
25
+ v-if="item.businessApplyType && item.businessApplyType !== 'TEMP_OWNER'"
26
+ :bordered="false"
27
27
  class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
28
28
  :class="['PENDING', 'TEMP_OWNER'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
29
29
  {{ statusMap[item.businessApplyType] }}
@@ -34,14 +34,14 @@
34
34
  <span v-else>{{ t('taday') }}</span>
35
35
  </template>
36
36
  <Tag
37
- v-if="item.businessApplyType === 'TEMP_OWNER'"
38
- :bordered="false"
37
+ v-if="item.businessApplyType === 'TEMP_OWNER'"
38
+ :bordered="false"
39
39
  class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
40
40
  :class="['PENDING'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
41
41
  {{ statusMap[item.businessApplyType] }}
42
42
  </Tag>
43
43
  </Popover>
44
-
44
+
45
45
  </div>
46
46
  </Checkbox>
47
47
 
@@ -94,7 +94,7 @@
94
94
  L2: {
95
95
  color: 'orange',
96
96
  text: t('levels.L2')
97
- },
97
+ },
98
98
  L3: {
99
99
  color: 'red',
100
100
  text: t('levels.L3')
@@ -155,7 +155,7 @@
155
155
  }
156
156
  .crane-checkbox-line {
157
157
  margin-bottom: 12px;
158
- display: flex;
158
+ display: flex;
159
159
  align-items: center;
160
160
  }
161
161
  .crane-checkbox-line:last-child {
@@ -166,8 +166,8 @@
166
166
  }
167
167
  .crane-tag-position {
168
168
  margin-right: 4px;
169
- font-size: 10px;
170
- padding: 2px 4px;
169
+ font-size: 10px;
170
+ padding: 2px 4px;
171
171
  line-height: 12px;
172
172
  font-weight: 500;
173
173
  }
@@ -194,5 +194,5 @@
194
194
  overflow: hidden;
195
195
  text-overflow: ellipsis
196
196
  }
197
-
197
+
198
198
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <contextHolder></contextHolder>
2
+ <contextHolder></contextHolder>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
5
  import { createVNode } from 'vue';
@@ -9,8 +9,8 @@
9
9
  }"
10
10
  >
11
11
  <div class="crane-wraper">
12
- <template v-if="type==='text'">
13
- <TypographyLink @click="showModal">{{t('permissionApply')}}</TypographyLink>
12
+ <template v-if="type === 'text'">
13
+ <TypographyLink @click="showModal" v-show="isShowText">{{t('permissionApply')}}</TypographyLink>
14
14
  </template>
15
15
  <template v-else-if="type==='custom'">
16
16
  <div @click="showModal">
@@ -147,6 +147,12 @@
147
147
  return props.permissions.split(',');
148
148
  });
149
149
 
150
+ const isShowText = computed(() => {
151
+ // 所有权限点的状态要么是NO,要么是OWNER,那么不显示文字组件
152
+ return !permissionList.value.every((item) => item.businessApplyType === 'NO' || item.businessApplyType === 'OWNER');
153
+
154
+ });
155
+
150
156
  const formatPermissionsData = (data: PermissionListType) => {
151
157
  const arr:PermissionListType = [];
152
158
  const flattenData = (list: PermissionListType) => {