@yqg/permission 1.3.7 → 1.3.8-bate.2
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/dist/{apply-modal-CTYgpCDi.js → apply-modal-vNbmgdPR.js} +4 -4
- package/dist/{category-selector-DyIpOw0V.js → category-selector-B2yEMLYM.js} +63 -63
- package/dist/{index-B_8TwHV1.js → index-DcRMlXfi.js} +1 -1
- package/dist/{index-BSXxLRqm.js → index-r4_L4Wy-.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/{permission-item-EPKvQkXL.js → permission-item-CT0UwVta.js} +4 -4
- package/dist/{yqg-permission-EZ-WtiwC.js → yqg-permission-8e7RGZ5e.js} +1157 -1148
- package/dist/yqg-permission.umd.js +7 -7
- package/package.json +1 -1
- package/src/App.vue +6 -6
- package/src/components/category-selector.vue +4 -1
- package/src/components/yqg-permission.vue +16 -1
- package/src/hooks/useFormat.ts +2 -2
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref
|
|
2
|
+
import { ref } from 'vue';
|
|
3
3
|
import {Button} from 'ant-design-vue';
|
|
4
4
|
|
|
5
5
|
// 中英印尼菲律宾
|
|
@@ -8,10 +8,10 @@ type LocaleType = 'zh-CN' | 'en-US' | 'id-ID' | 'fil-PH';
|
|
|
8
8
|
const color = ref<string>('#1677ff');
|
|
9
9
|
const locale = ref<LocaleType>('id-ID');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
const permissions = reactive([
|
|
13
|
-
|
|
14
|
-
]);
|
|
11
|
+
const permissions = ref('CALL_CENTER.DATA_BUSINESS.QUERY,CALL_CENTER.ENTER_ADMIN,CALL_CENTER.USER.QUERY,CALL_CENTER.USER.MANAGE,CALL_CENTER.BUSINESS.QUERY,CALL_CENTER.SKILL_GROUP.QUERY');
|
|
12
|
+
// const permissions = reactive([
|
|
13
|
+
// 'yewei0313.REAQS.DEPAWED_ANQ2.QUERY',
|
|
14
|
+
// ]);
|
|
15
15
|
//05615
|
|
16
16
|
// const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
|
|
17
17
|
const changeColor = () => {
|
|
@@ -34,7 +34,7 @@ const changeLocale = () => {
|
|
|
34
34
|
<!-- 02124 -->
|
|
35
35
|
<!-- 05184 -->
|
|
36
36
|
<yqg-permission :permissions="permissions" workNumber="03817" :color="color" :locale="locale"
|
|
37
|
-
@onSuccess="() => {console.log('成功')}">
|
|
37
|
+
:omitCategoryIds="[]" @onSuccess="() => {console.log('成功')}">
|
|
38
38
|
</yqg-permission>
|
|
39
39
|
</div>
|
|
40
40
|
<data class="case-card">
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<span v-else>{{ attributeName }}</span>
|
|
20
20
|
</template>
|
|
21
21
|
</TreeSelect>
|
|
22
|
-
<span v-if="item.attributeValueIds_view?.includes(
|
|
22
|
+
<span v-if="item.attributeValueIds_view?.includes(ALL_CATEGORY_ID)" style="color: #ff4d4f; font-size: 12px;">
|
|
23
23
|
{{ t('categoryChangeTips', { category: item.categoryName }) }}
|
|
24
24
|
</span>
|
|
25
25
|
</FormItem>
|
|
@@ -36,8 +36,11 @@ import {
|
|
|
36
36
|
import { defineProps, PropType, ref, computed, defineExpose } from 'vue';
|
|
37
37
|
import t from '../utils';
|
|
38
38
|
import useAttributesCache from '../hooks/useAttributesCache';
|
|
39
|
+
|
|
39
40
|
const SHOW_PARENT = TreeSelect.SHOW_PARENT;
|
|
40
41
|
|
|
42
|
+
const ALL_CATEGORY_ID = -1;
|
|
43
|
+
|
|
41
44
|
const props = defineProps({
|
|
42
45
|
categoryList: {
|
|
43
46
|
type: Array as PropType<CategoryType[]>,
|
|
@@ -131,6 +131,13 @@ const props = defineProps({
|
|
|
131
131
|
type: Number,
|
|
132
132
|
default: 10000
|
|
133
133
|
},
|
|
134
|
+
// 某些业务场景需要在特定页面隐藏某些数据维度
|
|
135
|
+
omitCategoryIds: {
|
|
136
|
+
type: [String, Array<number>],
|
|
137
|
+
required: false,
|
|
138
|
+
default: () => []
|
|
139
|
+
},
|
|
140
|
+
|
|
134
141
|
});
|
|
135
142
|
|
|
136
143
|
const open = ref(false);
|
|
@@ -152,6 +159,14 @@ const allPermissions = computed(() => {
|
|
|
152
159
|
return props.permissions?.split(',')?.filter((item) => item.trim()) || [];
|
|
153
160
|
});
|
|
154
161
|
|
|
162
|
+
|
|
163
|
+
const needOmitCategoryIds = computed(() => {
|
|
164
|
+
if (Array.isArray(props.omitCategoryIds)) {
|
|
165
|
+
return props.omitCategoryIds;
|
|
166
|
+
}
|
|
167
|
+
return props.omitCategoryIds?.split(',')?.map((item) => Number(item)) || [];
|
|
168
|
+
});
|
|
169
|
+
|
|
155
170
|
const goViewApproval = () => {
|
|
156
171
|
const url = curApproving.value?.oaFlowUrl;
|
|
157
172
|
if (!url) return;
|
|
@@ -171,7 +186,7 @@ const getPermissions = async () => {
|
|
|
171
186
|
|
|
172
187
|
loading.value = true;
|
|
173
188
|
const res = await Http.getPermissions(params);
|
|
174
|
-
const datalist = useFormat(res.body || []);
|
|
189
|
+
const datalist = useFormat(res.body || [], needOmitCategoryIds.value);
|
|
175
190
|
permissionList.value = datalist.data;
|
|
176
191
|
defaultCheckedIds.value = datalist.checkList;
|
|
177
192
|
isAllChecked.value = datalist.isAllChecked;
|
package/src/hooks/useFormat.ts
CHANGED
|
@@ -8,7 +8,7 @@ const StatusType = {
|
|
|
8
8
|
OWNER: 'OWNER',
|
|
9
9
|
TEMP_OWNER: 'TEMP_OWNER'
|
|
10
10
|
}
|
|
11
|
-
export default function useFormat(tree: PermissionListType) {
|
|
11
|
+
export default function useFormat(tree: PermissionListType, needOmitCategoryIds: number[] = []) {
|
|
12
12
|
const checkList: string[] = [];
|
|
13
13
|
let allCount: number = 0;
|
|
14
14
|
function sortTree(
|
|
@@ -20,7 +20,7 @@ export default function useFormat(tree: PermissionListType) {
|
|
|
20
20
|
node.key = node.feature;
|
|
21
21
|
allCount++;
|
|
22
22
|
if (!node.children || node.children.length === 0) {
|
|
23
|
-
node.categoryVOS = (node.categoryVOS || []).filter((item: any) => item.configWay !== Category.AUTO);
|
|
23
|
+
node.categoryVOS = (node.categoryVOS || []).filter((item: any) => (item.configWay !== Category.AUTO) && !needOmitCategoryIds.includes(item.id));
|
|
24
24
|
|
|
25
25
|
if ([StatusType.NO].includes(node.businessApplyType)) {
|
|
26
26
|
node.disabled = true;
|