@yqg/permission 1.1.2-bate.0 → 1.1.3-beta.0
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-SzDVxN-2.js → apply-modal-C5gl_EGn.js} +906 -906
- package/dist/{checkbox-item-BlnmEaiY.js → checkbox-item-CbU84h2h.js} +946 -966
- package/dist/{index-DFUPlAqp.js → index-CwpGTkMT.js} +2105 -2075
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +71 -71
- package/dist/{yqg-permission-Cfoxcf-d.js → yqg-permission-5wZs7Zr5.js} +744 -753
- package/package.json +1 -1
- package/src/App.vue +4 -11
- package/src/components/apply-modal.vue +9 -19
- package/src/components/checkbox-item.vue +6 -21
- package/src/components/success-modal.vue +10 -4
- package/src/components/yqg-permission.vue +7 -8
- package/src/i18n/en-US.ts +1 -6
- package/src/i18n/zh-CH.ts +0 -2
- package/src/typings/index.d.ts +0 -4
- package/src/vite-env.d.ts +1 -1
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -8,14 +8,7 @@ type LocaleType = 'zh-CN' | 'en-US' | 'id-ID' | 'fil-PH';
|
|
|
8
8
|
const color = ref<string>('#1677ff');
|
|
9
9
|
const locale = ref<LocaleType>('zh-CN');
|
|
10
10
|
|
|
11
|
-
const permissions = reactive(['
|
|
12
|
-
'CRANE.ROLE.CREATE',
|
|
13
|
-
'CRANE.ROLE.UPDATE',
|
|
14
|
-
'CRANE.ROLE.DELETE',
|
|
15
|
-
'CRANE.ROLE.PERMISSION_ASSIGN',
|
|
16
|
-
'CRANE.ROLE.EMPLOYEE_ASSIGN',
|
|
17
|
-
'CRANE.ROLE.DETAIL_QUERY',
|
|
18
|
-
'CRANE.ROLE.EXPORT']);
|
|
11
|
+
const permissions = reactive(['PPDL.0801-test2.XIUGAI.test5', 'PPDL.0801-test2.XIUGAI.test4', 'PPDL.0801-test2.XIUGAI.test6']);
|
|
19
12
|
// const permissions = reactive(['CRANE.BUSINESS.QUERY', 'RANE.BUSINESS.CREATE', 'CRANE.BUSINESS.UPDATE', 'CRANE.BUSINESS.DELETE']);
|
|
20
13
|
const changeColor = () => {
|
|
21
14
|
color.value = color.value === '#f00' ? '#1677ff' : '#f00';
|
|
@@ -38,11 +31,11 @@ const changeLocale = () => {
|
|
|
38
31
|
<!-- 05184 -->
|
|
39
32
|
<yqg-permission
|
|
40
33
|
:permissions="permissions"
|
|
41
|
-
workNumber="
|
|
42
|
-
businessCode="
|
|
34
|
+
workNumber="H00408"
|
|
35
|
+
businessCode="PPDL"
|
|
43
36
|
:color="color"
|
|
44
37
|
:locale="locale"
|
|
45
|
-
@
|
|
38
|
+
@success="() => {console.log('成功')}"
|
|
46
39
|
>
|
|
47
40
|
</yqg-permission>
|
|
48
41
|
</div>
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
width="800px"
|
|
6
6
|
@ok="handleOk"
|
|
7
7
|
:okText="t('submit')"
|
|
8
|
-
:maskClosable="false"
|
|
9
8
|
:ok-button-props="{ loading: loading }"
|
|
10
9
|
:cancelText="t('cancel')">
|
|
11
10
|
<Form
|
|
@@ -35,14 +34,14 @@
|
|
|
35
34
|
|
|
36
35
|
<FormItem
|
|
37
36
|
name="applyReason"
|
|
38
|
-
:label="t('applyReason')"
|
|
37
|
+
:label="t('applyReason')"
|
|
39
38
|
:rules="[{
|
|
40
|
-
required: true, message: t('reasonPlaceholder')
|
|
39
|
+
required: true, message: t('reasonPlaceholder')
|
|
41
40
|
}, {
|
|
42
|
-
max: 300, message: t('maxLengthTips', {length: 300})
|
|
41
|
+
max: 300, message: t('maxLengthTips', {length: 300})
|
|
43
42
|
}]">
|
|
44
43
|
<Textarea
|
|
45
|
-
v-model:value
|
|
44
|
+
v-model:value="formState.applyReason"
|
|
46
45
|
show-count
|
|
47
46
|
:maxlength="300"
|
|
48
47
|
:placeholder="t('applyReasonPlaceholder')"
|
|
@@ -113,7 +112,7 @@
|
|
|
113
112
|
},
|
|
114
113
|
|
|
115
114
|
});
|
|
116
|
-
const emit = defineEmits(['
|
|
115
|
+
const emit = defineEmits(['onSuccess']);
|
|
117
116
|
const open = defineModel({
|
|
118
117
|
required: true,
|
|
119
118
|
default: false,
|
|
@@ -142,7 +141,6 @@
|
|
|
142
141
|
} else {
|
|
143
142
|
formState.applyReason += `、${item}`;
|
|
144
143
|
}
|
|
145
|
-
formRef.value.validateFields(['applyReason']);
|
|
146
144
|
}
|
|
147
145
|
|
|
148
146
|
const handleOk = async() => {
|
|
@@ -156,8 +154,8 @@
|
|
|
156
154
|
const url = res?.body?.oaFlowUrl;
|
|
157
155
|
open.value = false;
|
|
158
156
|
loading.value = false;
|
|
159
|
-
|
|
160
|
-
successModal.value?.countDown(url, () => emit('onSuccess'));
|
|
157
|
+
|
|
158
|
+
successModal.value?.countDown(url, () => emit('onSuccess'));
|
|
161
159
|
})
|
|
162
160
|
};
|
|
163
161
|
|
|
@@ -172,8 +170,8 @@
|
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
const onChangeHandler = throttle(async () => {
|
|
175
|
-
if (formState.roleIds.length >
|
|
176
|
-
return;
|
|
173
|
+
if (formState.roleIds.length > 5) {
|
|
174
|
+
return message.warning(t('maxCountTips', {count: 5}));
|
|
177
175
|
}
|
|
178
176
|
|
|
179
177
|
if (!formState.roleIds.length) {
|
|
@@ -186,14 +184,6 @@
|
|
|
186
184
|
stepNodes.value = res?.body?.nodes || [];
|
|
187
185
|
}, 0)
|
|
188
186
|
|
|
189
|
-
watch(() => formState.roleIds, (val) => {
|
|
190
|
-
// 写到watch里避免闪烁
|
|
191
|
-
if (val.length > 1) {
|
|
192
|
-
formState.roleIds.pop();
|
|
193
|
-
message.warning(t('maxCountTips', {count: 5}));
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
|
|
197
187
|
watch(() => open.value, (cur) => {
|
|
198
188
|
if (cur) {
|
|
199
189
|
formRef.value?.resetFields();
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="crane-checkbox-line">
|
|
3
|
-
<Checkbox
|
|
4
|
-
:value="item.roleId"
|
|
5
|
-
:disabled="['OWNER', 'PENDING', 'NO'].includes(props.item.businessApplyType)"
|
|
6
|
-
@change="onCheck">
|
|
3
|
+
<Checkbox :value="item.roleId" :disabled="disabled" @change="onCheck">
|
|
7
4
|
<div class="crane-flex-center crane-checkbox-label">
|
|
8
5
|
<Tag
|
|
9
6
|
v-if="item.securityLevel"
|
|
@@ -22,26 +19,12 @@
|
|
|
22
19
|
<span class="crane-text-overflow">{{ item.name }}</span>
|
|
23
20
|
</Popover>
|
|
24
21
|
<Tag
|
|
25
|
-
v-if="item.businessApplyType
|
|
22
|
+
v-if="item.businessApplyType"
|
|
26
23
|
:bordered="false"
|
|
27
24
|
class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
|
|
28
|
-
:class="
|
|
25
|
+
:class="item.businessApplyType !== StatusTypePending ? 'crane-disabled-color' : ''">
|
|
29
26
|
{{ statusMap[item.businessApplyType] }}
|
|
30
27
|
</Tag>
|
|
31
|
-
<Popover>
|
|
32
|
-
<template #content>
|
|
33
|
-
<span v-if="item?.ownStatusVO?.dayDiff>0">{{t('lastDays', {count: item?.ownStatusVO?.dayDiff})}}</span>
|
|
34
|
-
<span v-else>{{ t('taday') }}</span>
|
|
35
|
-
</template>
|
|
36
|
-
<Tag
|
|
37
|
-
v-if="item.businessApplyType === 'TEMP_OWNER'"
|
|
38
|
-
:bordered="false"
|
|
39
|
-
class="crane-tag-position crane-margin-left-4 crane-margin-right-0"
|
|
40
|
-
:class="['PENDING'].includes(item.businessApplyType) ? '' : 'crane-disabled-color'">
|
|
41
|
-
{{ statusMap[item.businessApplyType] }}
|
|
42
|
-
</Tag>
|
|
43
|
-
</Popover>
|
|
44
|
-
|
|
45
28
|
</div>
|
|
46
29
|
</Checkbox>
|
|
47
30
|
|
|
@@ -64,7 +47,7 @@
|
|
|
64
47
|
</span>
|
|
65
48
|
</Popover>
|
|
66
49
|
|
|
67
|
-
<span v-
|
|
50
|
+
<span v-show="checkedIds.includes(item.roleId)" class="crane-week-color crane-margin-left-12">
|
|
68
51
|
{{t('availableTime')}}:
|
|
69
52
|
<Select
|
|
70
53
|
v-model:value="validTime"
|
|
@@ -115,6 +98,8 @@
|
|
|
115
98
|
});
|
|
116
99
|
const timeStatusOptions = formatOptions('availiables');
|
|
117
100
|
const statusMap = t('status');
|
|
101
|
+
const StatusTypePending = 'PENDING';
|
|
102
|
+
const disabled = ['NO', 'PENDING'].includes(props.item.businessApplyType);
|
|
118
103
|
const validTime = ref('');
|
|
119
104
|
|
|
120
105
|
//1登录人所在部门 = 权限适用范围,都默认90天,不需要区分等级和类型,
|
|
@@ -21,13 +21,19 @@
|
|
|
21
21
|
onOk: () => {
|
|
22
22
|
window.open(url);
|
|
23
23
|
modal1.destroy();
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (callback) {
|
|
25
|
+
callback();
|
|
26
|
+
} else {
|
|
27
|
+
location.reload();
|
|
28
|
+
}
|
|
26
29
|
},
|
|
27
30
|
onCancel: () => {
|
|
28
31
|
modal1.destroy();
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
if (callback) {
|
|
33
|
+
callback();
|
|
34
|
+
} else {
|
|
35
|
+
location.reload();
|
|
36
|
+
}
|
|
31
37
|
},
|
|
32
38
|
});
|
|
33
39
|
|
|
@@ -76,22 +76,22 @@
|
|
|
76
76
|
:permissionList="permissionList"
|
|
77
77
|
:workNumber="workNumber"
|
|
78
78
|
:businessCode="businessCode"
|
|
79
|
-
@onSuccess="
|
|
80
|
-
@onSubmit="getPermissions">
|
|
79
|
+
@onSuccess="getPermissions">
|
|
81
80
|
</ApplyModal>
|
|
82
81
|
|
|
83
82
|
</ConfigProvider>
|
|
84
83
|
</template>
|
|
85
84
|
<script lang="ts" setup>
|
|
86
85
|
import { ref, defineAsyncComponent, computed, watchEffect, watch} from 'vue';
|
|
87
|
-
import {Button, ConfigProvider, TypographyLink, Popover } from 'ant-design-vue';
|
|
86
|
+
import { Button, ConfigProvider, TypographyLink, Popover , message} from 'ant-design-vue';
|
|
88
87
|
import applyUrl from '@/assets/applying.png';
|
|
89
88
|
import noauthority from '@/assets/noauthority.png';
|
|
90
89
|
import Http from '../axios/index';
|
|
91
90
|
import t from '../utils';
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
);
|
|
91
|
+
|
|
92
|
+
// 重置 message 类名,避免被全局样式覆盖
|
|
93
|
+
message.config({prefixCls: 'yqg-permission-message'});
|
|
94
|
+
const ApplyModal = defineAsyncComponent(() =>import('./apply-modal.vue'));
|
|
95
95
|
const statusMap = {
|
|
96
96
|
DEFAULT: 'DEFAULT',
|
|
97
97
|
PENDING: 'PENDING',
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
flattenData(data);
|
|
156
156
|
// 需要排序,规则:businessApplyType 为 null 在前面, PENDING. OWNER 在中间, NO 在后面
|
|
157
157
|
// 然后再根据 L1, L2, L3 排序
|
|
158
|
-
const sort = [ null, '
|
|
158
|
+
const sort = [ null, 'PENDING', 'OWNER', 'NO'];
|
|
159
159
|
const levelSort = ['L1', 'L2', 'L3'];
|
|
160
160
|
arr.sort((a, b) => {
|
|
161
161
|
return sort.indexOf(a.businessApplyType) - sort.indexOf(b.businessApplyType) || levelSort.indexOf(a.securityLevel) - levelSort.indexOf(b.securityLevel);
|
|
@@ -196,7 +196,6 @@
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
const goViewApproval = () => {
|
|
199
|
-
console.log(curApproving.value)
|
|
200
199
|
if (curApproving.value?.oaFlowUrl) {
|
|
201
200
|
window.open(curApproving.value.oaFlowUrl);
|
|
202
201
|
}
|
package/src/i18n/en-US.ts
CHANGED
|
@@ -28,10 +28,6 @@ export default {
|
|
|
28
28
|
availableTime: '有效期',
|
|
29
29
|
selectPlaceholder: '请选择权限点',
|
|
30
30
|
reasonPlaceholder: '请输入申请理由',
|
|
31
|
-
maxCountTips: '一次最多只可申请{count}个权限',
|
|
32
|
-
maxLengthTips: '最多{length}个字符',
|
|
33
|
-
lastDays: '{count}天后到期',
|
|
34
|
-
taday: '今天到期',
|
|
35
31
|
availiables: {
|
|
36
32
|
SEVEN_DAYS: '7天',
|
|
37
33
|
THIRTY_DAYS: '30天',
|
|
@@ -47,8 +43,7 @@ export default {
|
|
|
47
43
|
status: {
|
|
48
44
|
PENDING: '审批中',
|
|
49
45
|
NO: '不可申请',
|
|
50
|
-
OWNER: '
|
|
51
|
-
TEMP_OWNER: '临时拥有',
|
|
46
|
+
OWNER: '已拥有',
|
|
52
47
|
},
|
|
53
48
|
operationType: {
|
|
54
49
|
QUERY: '查询',
|
package/src/i18n/zh-CH.ts
CHANGED
package/src/typings/index.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ declare type PermissionType = {
|
|
|
26
26
|
businessApplyType: StatusType;
|
|
27
27
|
oaFlowUrl?: string;
|
|
28
28
|
children?: PermissionListType;
|
|
29
|
-
ownStatusVO: any;
|
|
30
29
|
admin?: any[];
|
|
31
30
|
};
|
|
32
31
|
declare type PermissionListType = PermissionType[];
|
|
@@ -53,6 +52,3 @@ declare type formStateType = {
|
|
|
53
52
|
submitWorkNumber: string,
|
|
54
53
|
|
|
55
54
|
};
|
|
56
|
-
declare interface Window {
|
|
57
|
-
YQG_PERMISSION_CALLBACK?: () => void;
|
|
58
|
-
}
|
package/src/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|